/* SINDY: dark, calm, one lime accent. Big targets for reception, readable on a phone. */
:root {
  --bg: #0d0f0c; --surface: #161a14; --surface-2: #1d2219; --line: #2b3226; --fg: #f4f6ef; --fg-2: #b9c0b0; --fg-3: #8a937f;
  --accent: #c8f25a; --accent-ink: #13180a; --ok: #7ad97a; --warn: #f2c14e; --bad: #ff7a6b; --info: #7ab8ff;
  --r: 14px; --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font); padding-bottom: env(safe-area-inset-bottom); overflow-x: hidden; }
h1 { font-size: 1.6rem; line-height: 1.15; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
a { color: var(--accent); }
.muted { color: var(--fg-3); } .small { font-size: .85rem; } .bad { color: var(--bad); } .nowrap { white-space: nowrap; }
.center { min-height: 60vh; display: grid; place-items: center; color: var(--fg-2); }
code, pre { font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg-2); }

/* header + status */
.top { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: rgba(13, 15, 12, .96); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .3em; font-size: 1.05rem; }
.brand.big { font-size: 2rem; letter-spacing: .35em; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: .9rem; color: var(--fg-2); }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .88rem; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--fg-3); flex: none; }
.s-synced .dot { background: var(--ok); } .s-online .dot { background: var(--info); } .s-syncing .dot { background: var(--info); animation: pulse 1s infinite; }
.s-offline { border-color: var(--warn); } .s-offline .dot { background: var(--warn); }
.s-attention { border-color: var(--bad); } .s-attention .dot { background: var(--bad); }
.status .pend.has { color: var(--warn); font-weight: 700; }
.status .serr { color: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .s-syncing .dot { animation: none; } }

.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { flex: none; padding: 10px 14px; border-radius: 10px; color: var(--fg-2); text-decoration: none; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.tabs a[aria-current] { background: var(--accent); color: var(--accent-ink); }
main#view { padding: 16px; max-width: 1100px; margin: 0 auto; outline: none; }

/* buttons + forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--fg-3); } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: #3a1611; color: #ffd2cc; border-color: #6b2a21; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
.btn.big { min-height: 60px; font-size: 1.15rem; padding: 12px 28px; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 8px 0; min-height: 40px; }
.icon-btn { background: none; border: 0; color: var(--fg-2); font-size: 1.6rem; width: 44px; height: 44px; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.field { display: grid; gap: 4px; margin: 0 0 12px; }
.field > span { font-size: .85rem; color: var(--fg-2); font-weight: 600; }
.field small { color: var(--fg-3); }
.field.inline { margin: 0; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: 16px var(--font); }
textarea { min-height: 80px; resize: vertical; }
input[aria-invalid] { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: center; margin: 4px 0 12px; min-height: 44px; }
.check input { width: 22px; height: 22px; min-height: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err-line { color: var(--bad); min-height: 1.4em; margin: 0 0 8px; }

/* blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 14px; }
.card.warn { border-color: var(--warn); } .card.ok { border-color: #355b2c; }
.note { padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; background: var(--surface-2); border-left: 4px solid var(--info); }
.note.warn { border-left-color: var(--warn); } .note.err { border-left-color: var(--bad); } .note.info { border-left-color: var(--info); }
a.note.block { display: block; color: var(--fg); text-decoration: none; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg-2); }
.pill.warn { color: var(--warn); border-color: #6b5520; }
.badge { padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .9rem; background: var(--surface-2); white-space: nowrap; }
.badge.ok { background: #1f3a1b; color: var(--ok); } .badge.bad { background: #3a1611; color: var(--bad); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.time { color: var(--fg-3); font-variant-numeric: tabular-nums; margin-right: 6px; }
.voided { opacity: .5; text-decoration: line-through; }
.voided .btn { text-decoration: none; }
.back { display: inline-block; margin: 4px 0 8px; text-decoration: none; }

/* check-in */
.searchbar { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.searchbar input { font-size: 1.15rem; min-height: 56px; }
.results { display: grid; gap: 6px; margin: 8px 0; }
.result { text-align: left; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--fg); font: inherit; cursor: pointer; min-height: 52px; }
.result:hover, .result:focus-visible { border-color: var(--accent); }
.member-card.ok { border-color: #355b2c; } .member-card.bad { border-color: #6b2a21; }
.mc-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.mc-head h2 { font-size: 1.4rem; margin: 0; }
.owes { color: var(--bad); font-weight: 700; }
.notes { white-space: pre-wrap; background: var(--surface-2); padding: 8px 12px; border-radius: 10px; color: var(--fg-2); }
.msrow { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; margin: 0 0 14px; }
.kpi { display: grid; gap: 4px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.kpi .kl { font-size: .85rem; color: var(--fg-2); font-weight: 600; }
.kpi .kv { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .ks { font-size: .85rem; color: var(--fg-3); }
.kpi.bad .kv { color: var(--bad); }
.reception.warn { border-color: var(--warn); }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; height: 140px; align-items: end; }
.bar { display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; font-size: .78rem; color: var(--fg-3); }
.bar .b { align-self: end; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 3px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .8rem; color: var(--fg-3); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr[data-id] { cursor: pointer; } .tbl tr[data-id]:hover { background: var(--surface-2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; } .filters .field { flex: 1 1 160px; }
.conflict { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* modal + toasts */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 12px; }
.modal { width: min(520px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.modal.wide { width: min(800px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 8px 0 18px; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 12px 18px 18px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 8px; }
#toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(520px, calc(100% - 24px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: #23301c; border: 1px solid #355b2c; color: var(--fg); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.toast.warn { background: #33290f; border-color: #6b5520; } .toast.err { background: #3a1611; border-color: #6b2a21; }

/* sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px 22px; text-align: center; }
.login-card form { text-align: left; margin-top: 12px; }
.login-card h1 { font-size: 1.3rem; }

@media (max-width: 640px) {
  main#view { padding: 12px; }
  .who span { display: none; }
  .status { order: 3; width: 100%; border-radius: 12px; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: grid; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .tbl.stack td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  .tbl.stack td::before { content: attr(data-l); color: var(--fg-3); text-align: left; flex: none; max-width: 45%; }
  .tbl.stack td:empty { display: none; }
  .btn.big { width: 100%; }
}
