:root {
  --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f0f1f6; --border: #e1e3ec; --outline: #8a8fa6;
  --text: #1c1e2b; --muted: #6b7086; --accent: #4f46e5; --accent-soft: #eceafd; --on-accent: #fff;
  --note: #64748b; --decision: #0f766e; --action: #b45309; --danger: #c0262d;
  --note-bg: #eef1f5; --decision-bg: #dcf5f0; --action-bg: #fdf0db;
  --shadow: 0 1px 2px rgba(20, 22, 40, .06), 0 8px 24px rgba(20, 22, 40, .06);
  --radius: 12px;
}
/* Dark theme: used when chosen with the toggle, or when the device prefers dark and nothing was chosen. */
:root[data-theme="dark"] {
  --bg: #12131a; --surface: #1b1d27; --surface-2: #242734; --border: #2f3344; --outline: #6f7590;
  --text: #e8e9f1; --muted: #9a9fb5; --accent: #8b85ff; --accent-soft: #2a2852; --on-accent: #11121a;
  --note: #a3adbd; --decision: #4fd1c0; --action: #f2b55c; --danger: #ff7b7f;
  --note-bg: #272b37; --decision-bg: #153a36; --action-bg: #40301a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12131a; --surface: #1b1d27; --surface-2: #242734; --border: #2f3344; --outline: #6f7590;
    --text: #e8e9f1; --muted: #9a9fb5; --accent: #8b85ff; --accent-soft: #2a2852; --on-accent: #11121a;
    --note: #a3adbd; --decision: #4fd1c0; --action: #f2b55c; --danger: #ff7b7f;
    --note-bg: #272b37; --decision-bg: #153a36; --action-bg: #40301a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
.center-screen > .btn.theme-toggle { position: fixed; top: 12px; right: 12px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 15px; }
a { color: inherit; text-decoration: none; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .error { color: var(--danger); }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

input, select, textarea, button { font: inherit; color: inherit; }
/* Form fields are outlined, with rounded corners and a 2px accent outline on focus. */
input[type=text], input[type=email], input[type=date], input[type=password], select, textarea, .md-field {
  width: 100%; min-height: 44px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--outline); border-radius: 10px; outline: none;
}
input[type=text]:hover, input[type=email]:hover, input[type=password]:hover, textarea:hover, .md-field:hover:not(:disabled) { border-color: var(--text); }
input:focus, select:focus, textarea:focus, .md-field:focus-visible, .md-field[aria-expanded=true] {
  border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
}

/* Material dropdown + date picker (static/material.js). The native control stays in the page, hidden. */
.md-native { display: none !important; }
.md-field { display: inline-flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; color: var(--text); vertical-align: middle; }
.md-field:disabled { opacity: .5; cursor: default; }
.md-field .md-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-field .md-placeholder { color: var(--muted); }
.md-icon { display: inline-flex; flex: none; color: var(--muted); }
.md-field[aria-expanded=true] .md-icon { color: var(--accent); }
.md-select[aria-expanded=true] .md-icon { transform: rotate(180deg); }
.md-field.md-dense { min-height: 30px; padding: 2px 8px 2px 12px; font-size: 13px; }
.meta .md-field, .composer .extra .md-field { width: auto; }
.composer .extra .md-field { flex: 1; }

.md-popup { position: fixed; z-index: 100; margin: 0; background: var(--surface-2); color: var(--text); border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .28), 0 1px 2px rgba(0, 0, 0, .3); animation: md-in .12s ease-out; }
@keyframes md-in { from { opacity: 0; transform: scale(.96); } }
.md-menu { list-style: none; padding: 8px 0; max-height: min(320px, 70vh); overflow-y: auto; max-width: 92vw; }
.md-item { min-height: 44px; padding: 0 16px; display: flex; align-items: center; cursor: pointer; outline: none; white-space: nowrap; }
.md-item:hover, .md-item:focus-visible { background: color-mix(in srgb, var(--text) 9%, transparent); }
.md-item.selected { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.md-picker { width: 304px; padding: 8px 12px 6px; border-radius: 16px; }
.md-picker-head { display: flex; align-items: center; height: 44px; }
.md-spacer { flex: 1; }
.md-text-btn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 8px 12px; border-radius: 20px; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.md-text-btn.md-month { color: var(--text); padding-left: 8px; }
.md-icon-btn { width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; cursor: pointer; display: inline-grid; place-items: center; color: var(--text); }
.md-icon-btn .md-icon { color: inherit; }
.md-text-btn:hover, .md-icon-btn:hover, .md-text-btn:focus-visible, .md-icon-btn:focus-visible { background: color-mix(in srgb, var(--text) 9%, transparent); outline: none; }
.md-days { display: grid; grid-template-columns: repeat(7, 40px); justify-items: center; }
.md-weekday { height: 36px; display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.md-day { width: 36px; height: 36px; margin: 2px 0; border: 1px solid transparent; background: none; border-radius: 50%; cursor: pointer; color: var(--text); font-size: 14px; }
.md-day:hover, .md-day:focus-visible, .md-year:hover, .md-year:focus-visible { background: color-mix(in srgb, var(--text) 9%, transparent); outline: none; }
.md-day.today { border-color: var(--accent); color: var(--accent); }
.md-day.selected, .md-year.selected { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.md-years { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 252px; overflow-y: auto; padding: 4px 0; }
.md-year { height: 36px; border: 0; background: none; border-radius: 18px; cursor: pointer; color: var(--text); font-size: 14px; }
.md-picker-actions { display: flex; justify-content: flex-end; gap: 4px; padding-top: 4px; }
textarea { resize: vertical; min-height: 90px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 8px 10px; position: relative; }
.btn.rec { background: var(--danger); border-color: var(--danger); color: #fff; }

.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.login-card { text-align: center; width: min(400px, 100%); padding: 36px 28px; display: grid; gap: 12px; justify-items: center; }
.login-card .logo { font-size: 44px; }
.setup { width: min(560px, 100%); display: grid; gap: 10px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; font-size: 17px; display: flex; gap: 8px; align-items: center; }
.me { display: flex; align-items: center; gap: 8px; }
.count { position: absolute; top: 0; right: 0; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; min-width: 17px; padding: 0 4px; line-height: 17px; }
.bell-wrap { position: relative; }
.dropdown { position: absolute; right: 0; top: 46px; width: min(360px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 30; }
.dropdown .head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.notif { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: grid; gap: 2px; }
.notif:hover { background: var(--surface-2); }
.notif.unread { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 56px); }
/* Left menu: navigation on top, Admin + signed-in user + Sign out pinned to the bottom. */
.sidebar { border-right: 1px solid var(--border); padding: 16px 10px 10px; display: flex; flex-direction: column; position: sticky; top: 56px; height: calc(100vh - 56px); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; }
.side-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--border); }
.side-user { display: flex; align-items: center; gap: 4px; }
.user-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; }
.user-btn:hover { background: var(--surface-2); }
.user-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.user-btn .avatar { flex: none; }
.user-btn .who { display: grid; min-width: 0; line-height: 1.3; }
.user-btn .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .name { font-weight: 600; }
.admin-card { margin-bottom: 16px; padding: 20px; }
.admin-card > h2, .admin-card .section-head h2 { font-size: 17px; }
.admin-card > h2 { margin-bottom: 6px; }
.sidebar .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; display: flex; align-items: center; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .x { margin-left: auto; opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); }
.nav-item:hover .x { opacity: 1; }
.nav-item .n { margin-left: auto; font-size: 12px; color: var(--muted); }
.main { padding: 24px; max-width: 980px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.meeting-card { cursor: pointer; display: grid; gap: 8px; padding: 16px; transition: transform .1s; }
.meeting-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.chip { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 20px; background: var(--surface-2); color: var(--muted); }
.chip.project { background: var(--accent-soft); color: var(--accent); }
.avatars { display: flex; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; object-fit: cover; border: 2px solid var(--surface); flex: none; }
.avatars .avatar + .avatar { margin-left: -8px; }

.title-input { font-size: 24px; font-weight: 700; border-color: transparent !important; background: transparent !important; padding: 4px 6px !important; margin-left: -6px; }
.title-input:hover { border-color: var(--border) !important; }
.meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 18px; }
.meta input[type=date], .meta select { width: auto; padding: 6px 10px; }
.section { margin-bottom: 18px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.summary { white-space: pre-wrap; min-height: 70px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.points { display: grid; gap: 8px; }
.point { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.point.done .ptext { text-decoration: line-through; color: var(--muted); }
.point input[type=checkbox] { margin-top: 5px; width: 16px; height: 16px; accent-color: var(--accent); }
.point .body { flex: 1; min-width: 0; }
.ptext { overflow-wrap: anywhere; white-space: pre-wrap; }
.point .tools { display: flex; gap: 2px; opacity: 0; }
.point:hover .tools, .point:focus-within .tools { opacity: 1; }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; margin-top: 2px; flex: none; }
.badge.note { background: var(--note-bg); color: var(--note); }
.badge.decision { background: var(--decision-bg); color: var(--decision); }
.badge.action { background: var(--action-bg); color: var(--action); }

.composer { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 16px; margin-top: 12px; }
.composer .box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; display: grid; gap: 10px; }
.composer .line { display: flex; gap: 8px; }
.composer .extra { display: flex; gap: 8px; }
.composer .extra input { width: auto; flex: 1; }

#modal-root .overlay { position: fixed; inset: 0; background: rgba(10, 11, 20, .5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; width: min(480px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(720px, 100%); }
.modal .mhead { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal .mbody { padding: 20px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.linkbox { display: flex; gap: 8px; margin: 10px 0; }
.rec-status { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.xrow { display: grid; grid-template-columns: auto 136px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.xrow .sub { grid-column: 3; display: flex; gap: 8px; }
.xrow input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: min(420px, 92vw); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); text-align: center; }
.toast.err { background: var(--danger); color: #fff; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 12px; align-items: center; position: static; height: auto; gap: 8px; }
  .side-nav { flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; flex: 1; min-width: 0; }   /* the menu scrolls; user + sign out stay in view */
  .side-foot { flex-direction: row; align-items: center; border-top: 0; margin: 0 0 0 auto; padding: 0; }
  .side-foot .txt, .user-btn .who { display: none; }
  .user-btn { flex: none; }
  .sidebar .label { padding: 0 6px; white-space: nowrap; }
  .nav-item { white-space: nowrap; }
  .main { padding: 16px; }
  .brand span { display: none; }
  .point .tools { opacity: 1; }
  .composer .line { flex-wrap: wrap; }
}

/* Username + password sign-in */
.login-card .or { display: flex; align-items: center; gap: 10px; width: 100%; }
.login-card .or::before, .login-card .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.login-card .or { margin: 6px 0 2px; }
.pw-form { display: grid; gap: 12px; width: 100%; text-align: left; }
.btn.wide { width: 100%; justify-content: center; min-height: 48px; border-radius: 10px; font-weight: 600; gap: 10px; }
.btn.google { border-color: var(--outline); }
.btn.google:hover { background: var(--surface-2); border-color: var(--text); }
.btn:focus-visible, .link:focus-visible, .fl-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { border: 0; background: none; padding: 2px 0; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.pw-links { display: flex; justify-content: flex-end; margin-top: -4px; }
/* Fields with the label inside: it rests in the field and moves up when the field is focused or filled.
   .fl-up = label always at the top (dropdowns, dates, text areas). */
.fl-field { position: relative; display: block; margin-bottom: 14px; }
.pw-form .fl-field, .linkbox .fl-field { margin-bottom: 0; }
.linkbox .fl-field { flex: 1; min-width: 0; }
.linkbox > .btn { border-radius: 10px; }
.fl-field > input, .fl-field > textarea, .fl-field > .md-field { min-height: 54px; padding: 22px 14px 6px 14px; border-radius: 10px; }
.fl-field > textarea { padding-top: 26px; }
.fl-field.has-icon > input { padding-left: 44px; }
.fl-field.has-eye > input { padding-right: 50px; }
.fl-icon { position: absolute; left: 14px; top: 17px; color: var(--muted); pointer-events: none; }
.fl-label { position: absolute; left: 15px; right: 14px; top: 16px; color: var(--muted); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: top .12s, font-size .12s, color .12s; }
.fl-field.has-icon .fl-label { left: 44px; }
.fl-field.has-eye .fl-label { right: 50px; }
.fl-field > input:focus ~ .fl-label, .fl-field > input:not(:placeholder-shown) ~ .fl-label, .fl-field.fl-up .fl-label { top: 7px; font-size: 12px; }
.fl-field > input:-webkit-autofill ~ .fl-label { top: 7px; font-size: 12px; }
.fl-field:focus-within .fl-label, .fl-field:focus-within .fl-icon { color: var(--accent); }
/* the example text only shows once the label has moved out of the way */
.fl-field > input::placeholder { color: transparent; }
.fl-field > input:focus::placeholder { color: var(--muted); }
.fl-field > .md-field .md-icon { margin-top: -16px; }
/* keep typed text from scrolling under a text area's label */
.fl-field.fl-up > textarea ~ .fl-label { top: 1px; left: 1px; right: 18px; padding: 6px 14px 3px; background: var(--surface); border-radius: 10px 0 0 0; }
.fl-eye { position: absolute; right: 7px; top: 7px; width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.fl-eye:hover { background: var(--surface-2); color: var(--text); }
.fl-eye[aria-pressed=true] { color: var(--accent); }
.fl-eye[aria-pressed=false]::after { content: ""; position: absolute; width: 22px; border-top: 2px solid currentColor; transform: rotate(-45deg); box-shadow: 0 2px 0 var(--surface); }
.chip.warn { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.list-row .chip { margin-left: 6px; }
.cred-box { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; margin: 10px 0; font-family: ui-monospace, Consolas, monospace; font-size: 14px; white-space: pre-wrap; word-break: break-all; }
