* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f7fa; color: #333; line-height: 1.6;
}
header {
  background: linear-gradient(135deg, #AF3042, #0d47a1);
  color: #fff; padding: 16px 24px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
header h1 { font-size: 1.4em; }
#auth-bar { display: flex; align-items: center; gap: 10px; }
.badge {
  padding: 3px 10px; border-radius: 12px; font-size: .8em; font-weight: 600;
}
.badge.guest { background: rgba(255,255,255,.2); }
.badge.admin { background: #ff9800; color: #fff; }
button {
  padding: 6px 14px; border: none; border-radius: 6px; cursor: default;
  background: rgba(255,255,255,.2); color: #fff; font-size: .85em;
  transition: background .2s;
}
button:hover { background: rgba(255,255,255,.35); }
button.primary { background: #ff9800; color: #fff; }
button.primary:hover { background: #f57c00; }
button.danger { background: #e53935; color: #fff; }

main { max-width: 1400px; margin: 24px auto; padding: 0 16px; }

.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.toolbar h2 { color: #AF3042; }

/* Event Cards */
/* Table View */
.table-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.event-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88em;
}

.event-table thead tr {
  background: #f0f4ff;
  border-bottom: 2px solid #e0e8ff;
}

.event-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
}

.event-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  cursor: default;
  transition: background .15s;
}

.event-table tbody tr:hover {
  background: #f8faff;
}

.event-table td {
  padding: 12px 14px;
  vertical-align: middle;
}

.event-table td.evt-name {
  font-weight: 600;
  color: #1a1a1a;
  max-width: 200px;
}

.event-table td.num {
  font-size: 1.1em;
  font-weight: 700;
  color: #AF3042;
  text-align: center;
}

.event-table td.gift {
  width: 20%;
  max-width: 20%;
  color: #555;
  font-size: .85em;
}

.del-row {
  background: none !important;
  color: #e53935 !important;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: default;
  font-size: .85em;
}
.del-row:hover { background: #ffebee !important; }

/* Status tags */
.status-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .78em;
  font-weight: 600; white-space: nowrap;
}
.status-籌備中 { background: #fff3e0; color: #e65100; }
.status-進行中 { background: #e3f2fd; color: #1565c0; }
.status-已完成 { background: #e8f5e9; color: #2e7d32; }

/* Detail View */
.back-btn {
  background: none; color: #AF3042; padding: 4px 0; margin-bottom: 16px;
  font-size: .95em;
}
.back-btn:hover { background: none; text-decoration: underline; }

.detail-header { margin-bottom: 20px; }
.detail-header h2 { font-size: 1.5em; color: #AF3042; margin-bottom: 8px; }

.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px;
}
.detail-box {
  background: #fff; border-radius: 8px; padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.detail-box h4 { color: #AF3042; margin-bottom: 8px; font-size: .9em; }
.detail-box .value { font-size: 1em; }
.detail-box ul { padding-left: 18px; }
.detail-box li { margin-bottom: 3px; }

.detail-actions { display: flex; gap: 8px; margin-bottom: 20px; }
.detail-actions button { color: #333; background: #e8eaf0; }
.detail-actions button:hover { background: #d5d8e0; }

/* Messages */
#messages-section { margin-top: 24px; }
#messages-section h3 { margin-bottom: 12px; color: #AF3042; }
.msg-item {
  background: #fff; border-radius: 8px; padding: 10px 14px;
  margin-bottom: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.msg-item .msg-body { flex: 1; }
.msg-item .msg-author { font-weight: 600; color: #AF3042; font-size: .85em; }
.msg-item .msg-text { margin-top: 2px; }
.msg-item .msg-time { font-size: .75em; color: #999; white-space: nowrap; margin-left: 12px; }
.msg-item .msg-del {
  background: none; color: #e53935; padding: 0 4px; font-size: .8em;
  margin-left: 8px; cursor: default;
}

#msg-form {
  display: flex; gap: 8px; margin-top: 12px;
}
#msg-form input {
  padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: .9em;
}
#msg-form button { color: #fff; background: #AF3042; }

/* Modal */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4); display: flex; align-items: center;
  justify-content: center; z-index: 100;
}
.modal-content {
  background: #fff; border-radius: 12px; padding: 24px;
  min-width: 320px; max-width: 90vw; box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-content.wide { min-width: 420px; max-width: 520px; }
.modal-content h3 { margin-bottom: 16px; color: #AF3042; }
.modal-content input, .modal-content textarea, .modal-content select {
  width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px;
  font-size: .9em; margin-bottom: 10px;
}
.modal-content label { display: block; margin-bottom: 6px; font-size: .85em; color: #555; font-weight: 500; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions button { color: #333; background: #e8eaf0; }
.modal-actions .primary { color: #fff; background: #AF3042; }
.error { color: #e53935; font-size: .85em; margin-top: 8px; }

/* Responsive */
@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; }
  .modal-content.wide { min-width: auto; margin: 0 16px; }
  header { flex-direction: column; gap: 8px; }
}

/* Invitation column */
.inv-cell {
  font-size: .82em;
  max-width: 120px;
  width: 120px;
  white-space: normal;
  word-break: break-all;
}
.inv-name {
  color: #AF3042;
  cursor: default;
  margin-right: 4px;
  display: inline-block;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.inv-name:hover { text-decoration: underline; }
.inv-empty {
  color: #bbb;
  cursor: default;
  font-size: .9em;
}
.inv-empty:hover { color: #AF3042; }
.inv-add {
  color: #AF3042;
  cursor: default;
  font-size: 1.1em;
  font-weight: 700;
  margin-left: 4px;
}
.upload-icon {
  font-size: .9em;
  background: #e8f0fe;
  color: #AF3042;
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 700;
}

/* Agenda column */
.agenda-cell {
  font-size: .82em;
  max-width: 120px;
  width: 120px;
  white-space: normal;
  word-break: break-all;
}
