/* Fraunces (SIL Open Font License, see /fonts/FRAUNCES-OFL.txt), self-hosted: the security policy allows fonts from this site only */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
:root {
  --ink: #1d2b3a;
  --ink-2: #3c4b5c;
  --muted: #6b7785;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #e4e0d7;
  --accent: #1f7a5c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ea;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 43, 58, .06), 0 4px 16px rgba(29, 43, 58, .05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; line-height: 1.15; margin: .4rem 0 .6rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: .3rem 0; line-height: 1.45; }
a { color: var(--accent); }

.muted { color: var(--muted); font-weight: 400; }
.fine { font-size: .8rem; color: var(--muted); }
.small { font-size: .9rem; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .3rem; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; gap: .5rem; }
.row.gap { gap: .6rem; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: .75rem; }

label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--ink-2); }
input, select {
  font: inherit; font-weight: 400; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .75rem; background: #fff; width: 100%;
  min-height: 46px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: .65rem 1rem; cursor: pointer; text-align: center; text-decoration: none;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { min-height: 52px; font-size: 1.05rem; }
.btn.danger { color: var(--danger); border-color: #efc9c6; }
.btn.link { border: 0; background: none; color: var(--accent); padding: .3rem; min-height: 0; }
.btn[disabled] { opacity: .55; cursor: default; }
.link { cursor: pointer; text-decoration: underline; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin: .75rem 0; }
.card.danger { border-color: #f0d4d2; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { max-width: 420px; width: 100%; }
.brand { display: flex; align-items: center; }
/* Wordmark: lowercase "elsie", the i's dot replaced by a green dot */
.wordmark { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 30px; letter-spacing: -.03em; line-height: 1; color: var(--ink); display: inline-flex; }
.wordmark > span { display: inline-flex; align-items: baseline; }
.wm-i { position: relative; display: inline-block; }
.wm-dot { position: absolute; left: 50%; top: .02em; width: .22em; height: .22em; margin-left: -.11em; border-radius: 999px; background: var(--accent); }
.brand-lg .wordmark { font-size: 52px; }
.login .brand { margin-bottom: 1.2rem; }

/* App chrome */
#app { max-width: 640px; margin: 0 auto; padding: 0 1rem calc(84px + env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: calc(.8rem + env(safe-area-inset-top)) 0 .4rem; }
.sync { font-size: .8rem; color: var(--muted); }
.sync.pending { color: var(--warn); }
.tab > h2:first-child, .tab > .row:first-child { margin-top: .6rem; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.tabbar button { font: inherit; font-size: .72rem; font-weight: 600; background: none; border: 0; color: var(--muted); padding: .55rem 0 .6rem; display: flex; flex-direction: column; align-items: center; gap: .2rem; cursor: pointer; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.active { color: var(--accent); }

.netbar { position: sticky; top: 0; z-index: 6; background: var(--ink); color: #fff; text-align: center; font-size: .82rem; padding: .4rem; }

/* Log */
.timer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--ink); color: #fff; border-color: var(--ink); }
.timer .eyebrow { color: #b8c3cf; }
.timer-text { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.timer.running { background: var(--accent); border-color: var(--accent); }
.timer.running .btn.primary { background: #fff; color: var(--accent); border-color: #fff; }

.seg { display: inline-flex; background: #efece5; border-radius: 10px; padding: 3px; }
.seg-btn { font: inherit; font-size: .82rem; font-weight: 600; border: 0; background: none; color: var(--ink-2); padding: .4rem .7rem; border-radius: 8px; cursor: pointer; }
.seg-btn.active { background: #fff; box-shadow: var(--shadow); color: var(--ink); }
.chips { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .5rem; }
.chip { font: inherit; font-weight: 600; font-size: .9rem; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .4rem .9rem; cursor: pointer; min-height: 36px; }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.warn { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: .55rem .7rem; font-size: .85rem; }

.list-head { margin: 1.2rem 0 .3rem; }
.entries, .evidence, .plain, .checklist, .history { list-style: none; padding: 0; margin: 0; }
.entries li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem .2rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.entries .date { font-weight: 600; }
.entries .sub { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.entries .hrs { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 6px; padding: .12rem .4rem; margin-left: .35rem; vertical-align: 1px; }
.badge.late { background: var(--warn-soft); color: var(--warn); }
.badge.edited { background: #eceff3; color: var(--ink-2); }
.badge.pending { background: #e8eefc; color: #2c4fa8; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem 0; }

/* Evidence */
.fy-select { width: auto; min-height: 38px; padding: .35rem .6rem; font-size: .9rem; }
.checklist { display: flex; flex-wrap: wrap; gap: .4rem; }
.checklist li { font-size: .82rem; border-radius: 999px; padding: .3rem .7rem; border: 1px dashed var(--line); color: var(--muted); }
.checklist li.done { border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.checklist li.done::before { content: "✓ "; }
.file-drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 1rem; text-align: center; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-drop:focus-within { outline: 2px solid var(--accent); }
.storage { display: flex; align-items: center; gap: .6rem; font-size: .78rem; }
.bar { flex: 1; height: 6px; background: #efece5; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); }
.evidence li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); }
.evidence .name { font-weight: 600; word-break: break-word; }
.evidence .sub { font-size: .8rem; color: var(--muted); }
.evidence .actions { display: flex; gap: .3rem; flex-shrink: 0; }
.evidence .actions .btn { min-height: 36px; padding: .35rem .6rem; font-size: .85rem; }

/* Summary */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stat { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.arith { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.disclaimer { font-size: .8rem; color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: .5rem .65rem; margin-top: .7rem; }
.downloads { display: grid; gap: .5rem; margin: .4rem 0 .6rem; }

/* Dialogs */
dialog { border: 0; border-radius: var(--radius); padding: 1.1rem; width: min(92vw, 440px); box-shadow: 0 10px 40px rgba(0, 0, 0, .2); color: var(--ink); }
dialog::backdrop { background: rgba(29, 43, 58, .45); }
.history { font-size: .78rem; color: var(--muted); max-height: 140px; overflow: auto; }
.history li { padding: .2rem 0; border-bottom: 1px dotted var(--line); }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: .65rem 1rem; border-radius: 10px; font-size: .9rem; z-index: 20; max-width: 90vw; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }

@media (min-width: 700px) {
  .tabbar { max-width: 640px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
}

/* Toggle, reminders */
.lbl { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: .55rem; font-weight: 500; font-size: .95rem; color: var(--ink); cursor: pointer; }
label.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.stack.tight { gap: .4rem; }
.days { display: flex; flex-wrap: wrap; gap: .35rem; }
.day { flex-direction: row; cursor: pointer; }
.day input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day span { display: inline-block; min-width: 48px; text-align: center; border: 1px solid var(--line); border-radius: 999px; padding: .4rem .6rem; font-weight: 600; font-size: .85rem; color: var(--ink-2); background: #fff; }
.day input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.day input:focus-visible + span { outline: 2px solid var(--accent); }
.badge.elsewhere { background: #eef0f6; color: #4a5672; }
.entries li.elsewhere .hrs { color: var(--muted); font-weight: 600; }

/* Evidence rows: actions drop below the file details on narrow screens */
.evidence li { flex-wrap: wrap; }
.evidence li > div:first-child { flex: 1 1 240px; min-width: 0; }
.evidence .actions select.retag { width: auto; max-width: 170px; }

/* Sign-in security check */
.captcha:empty { display: none; }
.captcha { min-height: 0; display: flex; justify-content: center; }

/* Access, plans, household */
.access-bar { display: block; text-decoration: none; background: var(--accent-soft); color: #175c45; border-radius: 10px; padding: .55rem .8rem; font-size: .88rem; font-weight: 600; margin: .3rem 0 .2rem; }
.access-bar.expired { background: var(--warn-soft); color: var(--warn); }
.locked-card { border-color: #f0d9a8; background: #fffaf0; }
.locked-card h2 { margin-bottom: .3rem; }
.plan-options { display: grid; gap: .5rem; }
.plan-option { display: flex; justify-content: space-between; align-items: center; gap: .75rem; text-align: left; width: 100%; }
.plan-option .po-label { font-weight: 600; }
.plan-option .po-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.members li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; word-break: break-word; }
.members .btn { min-height: 36px; padding: .3rem .6rem; font-size: .85rem; flex-shrink: 0; }
.tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-left: .35rem; }
.wrap-sm { flex-wrap: wrap; align-items: flex-end; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
