:root {
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

.wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.hidden { display: none !important; }

h1 {
  font-size: 1.4rem;
  margin: 0 0 12px;
}

h2 {
  font-size: 1.05rem;
  margin: 28px 0 6px;
  color: #cbd5e1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.field {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.85rem;
  color: #94a3b8;
}

select, input[type="text"], input[type="number"] {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px;
  font-size: 1rem;
  width: 100%;
}

.hint {
  font-size: 0.75rem;
  color: #64748b;
  margin: 4px 0 0;
}

.controls {
  display: flex;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

button {
  flex: 1;
  min-width: 100px;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #334155;
  color: #e2e8f0;
  cursor: pointer;
}

button.link {
  flex: none;
  background: transparent;
  color: #60a5fa;
  padding: 6px 8px;
  text-decoration: underline;
  min-width: unset;
}

#registerBtn, #startFreeBtn {
  background: #16a34a;
}

#stopBtn {
  background: #dc2626;
}

#pauseBtn {
  background: #d97706;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
}

.status p {
  margin: 6px 0;
  font-size: 0.95rem;
}

/* category tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.category-tab {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.9rem;
}

.category-tab.active {
  background: #0e7490;
  border-color: #0e7490;
  color: #ecfeff;
  font-weight: 600;
}

.error {
  color: #fca5a5;
  font-size: 0.85rem;
  margin: 4px 0 12px;
}

.topbar-links {
  display: flex;
  gap: 4px;
}

/* welcome nav tiles */
.nav-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.nav-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  color: #e2e8f0;
}

.nav-tile-title {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tile-sub {
  font-size: 0.8rem;
  color: #94a3b8;
}

.badge-count {
  background: #dc2626;
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 999px;
}

/* inbox / compose */
#composeToggleBtn {
  margin: 4px 0 12px;
  background: #334155;
}

textarea {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  width: 100%;
}

.message-item {
  cursor: pointer;
}

.message-item.unread .h-name::before {
  content: "● ";
  color: #60a5fa;
}

.message-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #334155;
  font-size: 0.9rem;
  color: #cbd5e1;
  white-space: pre-wrap;
}

.badge.coming_soon {
  background: #1e3a8a;
  color: #93c5fd;
}

.badge.passed {
  background: #3f3f46;
  color: #d4d4d8;
}

.badge.attended {
  background: #14532d;
  color: #86efac;
}

.badge.missed {
  background: #7f1d1d;
  color: #fca5a5;
}

.meeting-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.meeting-actions button {
  padding: 8px;
  font-size: 0.85rem;
}

.meeting-actions .attend-btn {
  background: #16a34a;
}

.meeting-actions .miss-btn {
  background: #7f1d1d;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: auto;
}

.slot-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}
.slot-card .slot-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.slot-card .slot-name {
  font-weight: 600;
}
.slot-card .slot-detail {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 8px;
}
.slot-card .slot-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.slot-card input[type="number"] {
  width: 80px;
}
.slot-card button {
  flex: none;
}
.done-check {
  color: #86efac;
  font-weight: 600;
}

/* nested chamber accordion (admin) */
.accordion-group {
  margin-bottom: 10px;
}
.accordion-header {
  width: 100%;
  text-align: left;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.accordion-header .chevron {
  transition: transform 0.15s;
  color: #64748b;
}
.accordion-header.open .chevron {
  transform: rotate(90deg);
}
.accordion-body {
  padding: 8px 0 4px 14px;
  border-left: 2px solid #334155;
  margin-left: 10px;
}
.accordion-body.hidden {
  display: none;
}
.person-header {
  background: #172033;
  font-weight: 500;
  font-size: 0.95rem;
}
.person-body .history-item {
  margin-bottom: 8px;
}
.chamber-select-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.chamber-select-inline select {
  width: auto;
  flex: none;
}

/* profile list */
.profile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  color: #e2e8f0;
}

.profile-card .p-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.profile-card .p-detail {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* history list */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.9rem;
}

.history-item .h-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.history-item .h-name {
  font-weight: 600;
}

.badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge.completed {
  background: #14532d;
  color: #86efac;
}

.badge.stopped {
  background: #7f1d1d;
  color: #fca5a5;
}

.history-item .h-meta {
  color: #94a3b8;
  font-size: 0.8rem;
}

.empty {
  color: #64748b;
  font-size: 0.9rem;
}
