/* RLM - OWN THE DAY!  —  mobile-first styles (approved palette from the concept) */
:root {
  --paper: #f5f3ed; --card: #fffefa; --ink: #243946; --muted: #64737a; --line: #d9e1e2;
  --action: #315c75; --action-text: #fffefa; --soft: #e9f0f3; --error: #994134; --ok: #2f6b4f; --ok-soft: #e4f1ea;
  --warn: #8a6a1f; --warn-soft: #f6efdc; --optional: #6a7d86; --radius: 12px; --nav-h: 64px;
  --fs: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17252c; --card: #20313b; --ink: #ecf2f4; --muted: #bdcbd0; --line: #455963;
    --action: #a8cfe1; --action-text: #142a35; --soft: #2a414d; --error: #ffb4a5; --ok: #9fd8b8; --ok-soft: #244235;
    --warn: #e8c97a; --warn-soft: #3d3520; --optional: #9fb0b8; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17252c; --card: #20313b; --ink: #ecf2f4; --muted: #bdcbd0; --line: #455963;
  --action: #a8cfe1; --action-text: #142a35; --soft: #2a414d; --error: #ffb4a5; --ok: #9fd8b8; --ok-soft: #244235;
  --warn: #e8c97a; --warn-soft: #3d3520; --optional: #9fb0b8; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: var(--fs)/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--paper); overflow-wrap: anywhere; }
[hidden] { display: none !important; }
h1 { font-size: 22px; line-height: 1.2; font-weight: 600; margin: 0; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 600; margin: 0 0 8px; }
h3 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
p { margin: 0 0 10px; }
small, .muted { color: var(--muted); font-size: 14px; }
a { color: var(--action); }
button { font: inherit; }

/* layout */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); border-bottom: 1px solid var(--line); padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; gap: 12px; }
.topbar .brand { flex: 1; min-width: 0; }
.topbar .brand small { display: block; font-size: 13px; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; flex-shrink: 0; }
.main { flex: 1; padding-block: 16px calc(var(--nav-h) + 24px); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 760px; width: 100%; margin: 0 auto; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line); display: flex; z-index: 5; padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.bottomnav button { flex: 1; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 6px 2px; }
.bottomnav button .ic { font-size: 22px; line-height: 1; }
.bottomnav button[aria-current="page"] { color: var(--action); }
.bottomnav button span:last-child, .bottomnav button { white-space: nowrap; }
@media (min-width: 760px) {
  .bottomnav { left: 50%; right: auto; transform: translateX(-50%); width: 760px; height: 56px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .bottomnav button { flex-direction: row; gap: 8px; font-size: 15px; }
}

/* cards & lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; }
.card.tight { padding: 12px 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.tag { display: inline-block; background: var(--soft); color: var(--ink); padding: 3px 9px; border-radius: 6px; font-size: 13px; margin: 6px 6px 0 0; }
.tag.done { background: var(--ok-soft); color: var(--ok); }
.tag.partial { background: var(--warn-soft); color: var(--warn); }
.tag.skipped { text-decoration: line-through; }
.tag.optional { color: var(--optional); border: 1px dashed var(--line); background: transparent; }
.tag.fixed { border: 1px solid var(--line); background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--card); font-size: 14px; cursor: pointer; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--action); color: var(--action-text); border-color: var(--action); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }

/* schedule */
.daystrip { display: grid; grid-template-columns: 32px repeat(7, 1fr) 32px; gap: 4px; align-items: stretch; margin: 0 0 14px; }
.daystrip button { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 6px 0; min-height: 56px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; }
.daystrip button b { font-size: 17px; font-weight: 600; }
.daystrip button .dots { font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.daystrip button[aria-pressed="true"] { background: var(--action); color: var(--action-text); border-color: var(--action); }
.daystrip button[aria-pressed="true"] .dots { color: var(--action-text); }
.daystrip button.today { outline: 2px solid var(--action); outline-offset: -2px; }
.daystrip .arrow { font-size: 18px; min-height: 56px; padding: 0; }
.block { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 0 0 10px; cursor: pointer; }
.block:active { background: var(--soft); }
.block .time { width: 84px; flex-shrink: 0; font-size: 14px; color: var(--muted); line-height: 1.3; padding-top: 2px; }
.block .time b { display: block; color: var(--ink); font-size: 15px; }
.block .title { font-size: 17px; font-weight: 600; }
.block .grow > small { display: block; }
.block.done .title { color: var(--ok); }
.block.skipped .title, .block.optional .title { color: var(--muted); }
.block.skipped .title { text-decoration: line-through; }
.block.sleep { background: transparent; border-style: dashed; }
.block .check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; margin-top: 3px; }
.block.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.block.partial .check { border-color: var(--warn); color: var(--warn); }
.progress { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.progress > i { display: block; height: 100%; background: var(--action); border-radius: 4px; }
.progress.met > i { background: var(--ok); }

/* forms */
label.field { display: block; margin: 0 0 14px; font-weight: 600; font-size: 14px; }
label.field > span { display: block; margin-bottom: 6px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; background: var(--card); color: var(--ink); font: 400 16px/1.4 inherit; font-family: inherit; }
textarea { resize: vertical; min-height: 96px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--action); margin: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .pair { grid-template-columns: 1fr; } }
.btn { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer; min-height: 44px; }
.btn.primary { background: var(--action); color: var(--action-text); border-color: var(--action); }
.btn.danger { color: var(--error); }
.btn.block { width: 100%; display: block; }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 14px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: default; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btnrow .btn { flex: 1 1 auto; }
.error { color: var(--error); font-size: 14px; margin: 6px 0 10px; }
.note { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.status { color: var(--muted); font-size: 14px; min-height: 1.2em; margin: 8px 0 0; }
.daysel { display: flex; gap: 6px; margin: 6px 0 14px; }
.daysel button { flex: 1; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 8px 0; font-size: 14px; cursor: pointer; min-height: 40px; }
.daysel button[aria-pressed="true"] { background: var(--action); color: var(--action-text); border-color: var(--action); }
.mic { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.mic .btn.small[aria-pressed="true"] { background: var(--error); color: #fff; border-color: var(--error); }

/* sheet (bottom dialog) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } }
.sheet h2 { margin-bottom: 4px; }
.actions { display: grid; gap: 10px; margin-top: 12px; }
.actions .btn { text-align: left; }

/* auth */
.auth { max-width: 420px; margin: 8vh auto 0; }
.auth h1 { font-size: 26px; margin-bottom: 4px; }

/* goals */
.goal { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 0 0 10px; }
.goal .title { font-size: 17px; font-weight: 600; }
.goal.paused { opacity: .6; }

.weekbar { display: grid; grid-template-columns: 44px 1fr 110px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.weekbar .bar { height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; position: relative; }
.weekbar .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--action); }
.weekbar .bar i.plan { background: var(--line); }
.weekbar .nums { text-align: right; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; max-width: 90vw; }
@media (min-width: 760px) { .toast { bottom: 24px; } }
.spinner { text-align: center; padding: 40px; color: var(--muted); }
.sample-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sample-row small { display: block; }
@media (max-width: 380px) { .sample-row { grid-template-columns: 1fr; gap: 2px; } }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple td, table.simple th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
