:root {
  --brown-900: #3a2313;
  --brown-800: #4a2c17;
  --brown-700: #5c3a1e;
  --brown-600: #6b3f1e;
  --brown-500: #8a5a2c;
  --gold: #c8892f;
  --gold-light: #e0ac54;
  --cream: #faf3e7;
  --cream-2: #f3e7d3;
  --paper: #fffdf9;
  --ink: #2c1d10;
  --muted: #8a7a68;
  --border: #e6d8bf;
  --green: #2f7d3c;
  --green-bg: #e3f2e5;
  --red: #b5352e;
  --red-bg: #fbe6e4;
  --shadow: 0 1px 3px rgba(58, 35, 19, 0.12), 0 1px 2px rgba(58, 35, 19, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
}
a { color: var(--brown-600); }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

.hidden { display: none !important; }

/* ---------- login ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, var(--cream-2), var(--cream) 60%);
  padding: 24px;
}
.login-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
  padding: 36px 32px;
  text-align: center;
}
.login-card .logo-badge { width: 96px; height: 96px; margin: 0 auto 14px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; color: var(--brown-800); }
.login-card .tagline { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--brown-700); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--paper); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,137,47,0.15); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 8px; padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brown-600); color: #fff; }
.btn-primary:hover { background: var(--brown-700); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #b57a26; }
.btn-secondary { background: var(--cream-2); color: var(--brown-800); }
.btn-secondary:hover { background: #ecdcb9; }
.btn-outline { background: transparent; color: var(--brown-700); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--cream-2); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #f6d3d0; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.login-error { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px; }
.login-hint { margin-top: 16px; font-size: 12px; color: var(--muted); }
.google-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; margin-bottom: 14px; }
.login-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- app shell ---------- */
#app-screen { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--brown-900);
  color: #f3e6d3; display: flex; flex-direction: column; padding: 18px 0;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 18px 18px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 12px; }
.sidebar .brand .logo-badge { width: 40px; height: 40px; flex-shrink: 0; }
.sidebar .brand .brand-text { font-size: 13px; font-weight: 700; line-height: 1.25; color: #f3e6d3; }
.sidebar .brand .brand-text small { display: block; font-weight: 400; color: #c9b393; font-size: 10.5px; letter-spacing: 0.06em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; font-size: 13.5px; font-weight: 500;
  color: #d9c6a8; cursor: pointer; border-left: 3px solid transparent; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(200,137,47,0.18); color: #fff; border-left-color: var(--gold); }
.nav-item .icon { width: 18px; text-align: center; }
.sidebar-spacer { flex: 1; }
.sidebar-foot { padding: 12px 18px 0; border-top: 1px solid rgba(255,255,255,0.1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--paper); border-bottom: 1px solid var(--border); padding: 10px 22px;
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; margin-left: 6px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

.content { flex: 1; padding: 22px; overflow-y: auto; }
.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-title h2 { margin: 0; font-size: 20px; color: var(--brown-800); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-dash { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--paper); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 14.5px; color: var(--brown-800); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 12px 16px; }
.card-body.no-pad { padding: 0; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 7px; border: none; background: transparent; color: var(--brown-600);
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.icon-btn:hover { background: var(--cream-2); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 8px 16px; border-bottom: 1px solid var(--border); }
td { padding: 9px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-done td { color: var(--muted); text-decoration: line-through; }
tr.row-in-progress td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.table-wrap { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gold { background: #f6e6cb; color: #8a5a1a; }
.badge-gray { background: var(--cream-2); color: var(--muted); }
.status-select { border: none; background: transparent; font-weight: 600; font-size: 12.5px; cursor: pointer; }

.empty-state { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 13px; }

.meeting-item { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.meeting-item:last-child { border-bottom: none; }
.meeting-item .meeting-name { font-weight: 600; color: var(--brown-700); font-size: 13.5px; cursor: pointer; }
.meeting-item .meeting-name:hover { text-decoration: underline; }
.meeting-item .meeting-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.scorecard-table td.cell-green { background: var(--green-bg); color: var(--green); font-weight: 700; }
.scorecard-table td.cell-red { background: var(--red-bg); color: var(--red); font-weight: 700; }
.scorecard-table td.cell-goal { background: var(--brown-900); color: #fff; font-weight: 700; }
.scorecard-table td.cell-editable { cursor: text; }
.scorecard-table input.cell-input { width: 70px; border: none; background: transparent; font-weight: 700; font-size: 13px; text-align: center; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(42,26,13,0.45); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--paper); border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  width: 100%; max-width: 520px; max-height: calc(100vh - 80px); display: flex; flex-direction: column;
}
.modal.modal-wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--brown-800); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.close-x { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }

.row-flex { display: flex; gap: 10px; }
.row-flex > .field { flex: 1; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--cream-2); font-size: 12px; cursor: pointer; border: 1px solid transparent;
}
.chip.selected { background: #f6e6cb; border-color: var(--gold); color: #8a5a1a; font-weight: 600; }

/* ---------- meeting create / agenda ---------- */
.meeting-type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.type-card { border: 2px solid var(--border); border-radius: 10px; padding: 14px 10px; text-align: center; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brown-700); }
.type-card small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; }
.type-card.selected { border-color: var(--gold); background: #fbf1de; }
.agenda-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.agenda-row input[type=text] { flex: 1; }
.agenda-row input[type=number] { width: 64px; text-align: center; }
.drag-handle { color: var(--muted); cursor: grab; }

/* ---------- live meeting ---------- */
.live-meeting { max-width: 720px; margin: 0 auto; }
.live-header { text-align: center; margin-bottom: 18px; }
.live-header h2 { margin: 4px 0; color: var(--brown-800); }
.timer-ring { text-align: center; margin: 18px 0; }
.timer-display { font-size: 56px; font-weight: 800; color: var(--brown-800); font-variant-numeric: tabular-nums; }
.timer-display.over { color: var(--red); }
.timer-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.agenda-progress { display: flex; gap: 5px; margin: 18px 0; flex-wrap: wrap; }
.agenda-chip { flex: 1; min-width: 80px; padding: 8px 6px; text-align: center; border-radius: 8px; font-size: 11.5px; font-weight: 600; background: var(--cream-2); color: var(--muted); }
.agenda-chip.current { background: var(--gold); color: #fff; }
.agenda-chip.done { background: #e3d7bd; color: var(--brown-700); }
.live-controls { display: flex; justify-content: center; gap: 10px; margin: 20px 0; }
.live-section-tools { margin-top: 22px; }

/* ---------- live meeting: sidebar-timer layout ---------- */
.live-layout { display: flex; gap: 0; min-height: calc(100vh - 100px); margin: -22px; }
.live-sidebar { width: 230px; flex-shrink: 0; background: var(--paper); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 0; }
.live-sidebar-head { padding: 0 16px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.live-sidebar-head .lsh-eyebrow { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.live-sidebar-head .lsh-name { font-weight: 700; color: var(--brown-800); font-size: 14px; margin-top: 2px; }
.agenda-side-item { padding: 9px 16px; cursor: pointer; border-left: 3px solid transparent; position: relative; }
.agenda-side-item .asi-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agenda-side-item .asi-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.agenda-side-item .asi-time { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.agenda-side-item .asi-budget { font-size: 10.5px; color: var(--muted); text-align: right; }
.agenda-side-item.current { background: #fbf1de; border-left-color: var(--gold); }
.agenda-side-item.current .asi-label, .agenda-side-item.current .asi-time { color: var(--brown-800); }
.agenda-side-item.done .asi-time { color: var(--green); }
.asi-progress { height: 3px; background: var(--border); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.asi-progress-fill { height: 100%; background: var(--gold); }
.live-sidebar-spacer { flex: 1; }
.live-sidebar-foot { padding: 12px 16px 0; border-top: 1px solid var(--border); }
.live-main { flex: 1; min-width: 0; padding: 22px 28px; overflow-y: auto; }
.live-section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.live-section-title h3 { margin: 0; font-size: 17px; color: var(--brown-800); }
.live-section-title .lst-desc { font-size: 12.5px; color: var(--muted); }
.live-bottom-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); }
.attendee-strip { display: flex; gap: 4px; }

.rock-group-head { font-size: 11.5px; font-weight: 700; color: var(--brown-700); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 16px 4px; }
.rock-progress-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 4px 0 14px; background: var(--cream-2); }
.rock-progress-seg-good { background: var(--green); }
.rock-progress-seg-bad { background: var(--red); }
.rock-progress-legend { display: flex; gap: 16px; font-size: 12px; margin-bottom: 8px; }

.discussion-list { list-style: none; margin: 0; padding: 4px 16px; }
.discussion-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.discussion-list li:last-child { border-bottom: none; }
.discussion-list li::before { content: '\2022'; color: var(--gold); font-weight: 800; font-size: 16px; flex-shrink: 0; }
.discussion-list li input { flex: 1; border: none; background: transparent; font-size: 13.5px; padding: 4px 2px; color: var(--ink); }
.discussion-list li input:focus { outline: none; box-shadow: 0 1px 0 0 var(--gold); }

.waiting-room { max-width: 640px; margin: 40px auto; text-align: center; }
.waiting-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin: 24px 0; }
.waiting-person { width: 110px; text-align: center; }
.waiting-person .join-pill { margin-top: 6px; font-size: 11px; padding: 2px 8px; border-radius: 999px; display: inline-block; }
.join-pill.joined { background: var(--green-bg); color: var(--green); }
.join-pill.pending { background: var(--cream-2); color: var(--muted); }

.ids-pick-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.ids-pick-row .ipr-num { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.ids-pick-row .ipr-num.active { background: var(--gold); color: #fff; border-color: var(--gold); }
.ids-solve-panel { border: 1px solid var(--border); border-radius: 10px; padding: 16px; background: var(--paper); }
.ids-solve-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ids-solve-actions { display: flex; justify-content: space-between; margin-top: 14px; }

/* ---------- V/TO ---------- */
.vto-section { margin-bottom: 18px; }
.vto-section h4 { color: var(--brown-700); font-size: 13.5px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.list-editor { display: flex; flex-direction: column; gap: 6px; }
.list-editor-row { display: flex; gap: 6px; align-items: center; }
.list-editor-row input { flex: 1; }

/* ---------- accountability chart ---------- */
.org-tree { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 10px 0 30px; }
.org-level { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.seat-card { background: var(--paper); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); width: 210px; padding: 12px 14px; }
.seat-card .seat-title { font-weight: 700; color: var(--brown-800); font-size: 13.5px; margin-bottom: 4px; }
.seat-card .seat-person { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.seat-card ul { margin: 0; padding-left: 16px; font-size: 12px; color: var(--ink); }
.seat-card .seat-actions { margin-top: 8px; display: flex; gap: 6px; }

/* ---------- settings / team ---------- */
.team-list .team-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.team-list .team-row:last-child { border-bottom: none; }
.team-meta { flex: 1; }
.team-meta .team-name { font-weight: 600; font-size: 13.5px; color: var(--brown-800); }
.team-meta .team-email { font-size: 11.5px; color: var(--muted); }

/* ---------- notifications ---------- */
.notif-wrap { position: relative; margin-left: 4px; }
.notif-bell { width: 32px; height: 32px; font-size: 17px; }
.notif-badge {
  position: absolute; top: -2px; right: -2px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 3px;
  pointer-events: none;
}
.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.18); z-index: 90;
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.notif-head h4 { margin: 0; font-size: 13.5px; color: var(--brown-800); }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--cream-2); }
.notif-item.unread { background: #fbf1de; }
.notif-item .notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex-shrink: 0; margin-top: 5px; }
.notif-item .notif-dot.read { background: transparent; }
.notif-item .notif-msg { font-size: 12.5px; color: var(--ink); line-height: 1.4; }
.notif-item .notif-time { font-size: 11px; color: var(--muted); margin-top: 2px; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--brown-800); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); }
.toast.toast-error { background: var(--red); }

@media (max-width: 900px) {
  .sidebar { width: 68px; }
  .sidebar .brand-text, .nav-item span.label { display: none; }
  .grid-2, .grid-dash, .meeting-type-cards { grid-template-columns: 1fr; }
}
