/* Morning Sheet — calm, premium, friendly. Same interaction patterns as MeDaily, its own identity:
   deep navy + slate blue + cool teal on off-white, charcoal text, soft rounded cards, newspaper serif headings. */
:root {
  --navy: #14284A;   --navy-2: #1E3864;
  --slate: #3E5C80;  --slate-soft: #E6ECF4;
  --teal: #0F7F82;   --teal-dark: #0B6467;  --teal-soft: #E1F2F1;
  --ink: #2B2D31;    --muted: #6A707A;
  --line: #E3E1DA;   --line-2: #CFCCC3;
  --bg: #F6F4EF;     --card: #FFFFFF;
  --ok: #1E7A55;     --ok-soft: #E2F3EA;
  --bad: #B83A30;    --bad-soft: #FAE8E5;
  --amber: #B7791F;  --amber-soft: #FBF1DE;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "Georgia", "Iowan Old Style", "Times New Roman", serif;
  --r: 12px; --r-s: 8px;
  --shadow: 0 1px 2px rgba(20, 40, 74, .05), 0 6px 20px rgba(20, 40, 74, .06);
  --tabbar-h: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--navy); }
h1 { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--teal-dark); }
img { display: block; max-width: 100%; }
code { font: 13px ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; word-break: break-all; }
.icon { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.ok-text { color: var(--ok); font-weight: 600; }
.bad-text { color: var(--bad); font-weight: 600; }
.label { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); }
.hint { font-size: 13px; color: var(--muted); }
.hint a { font-weight: 600; }
.mt { margin-top: 14px; }
.mt-s { margin-top: 8px; }
.mt-l { margin-top: 22px; }
[hidden] { display: none !important; }

/* ---------- Top bar + tabs ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff; }
.topbar-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 22px; padding: 0 20px; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand img { height: 38px; width: auto; background: #fff; border-radius: 10px; padding: 3px 5px; }
.brand b { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.tabs { display: flex; height: 100%; gap: 2px; }
.tab { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 100%; text-decoration: none; font-weight: 600; font-size: 14.5px; color: #B9C6DA; position: relative; }
.tab:hover { color: #fff; }
.tab.is-active { color: #fff; }
.tab.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: #5FD0C9; }
.tab .badge { min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; text-align: center; background: var(--bad); color: #fff; font-weight: 700; border-radius: 9px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.whoami { font-size: 13px; color: #B9C6DA; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: #fff; }
.logout-btn:hover { border-color: #fff; }

@media (max-width: 820px) {
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar-in { height: 58px; gap: 12px; padding: 0 14px; }
  .brand img { height: 32px; }
  .brand b { font-size: 18px; }
  .whoami { display: none; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
          padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; }
  .tab { flex-direction: column; justify-content: center; gap: 3px; padding: 0; font-size: 11px; color: var(--muted); }
  .tab.is-active { color: var(--teal-dark); }
  .tab.is-active::after { top: 0; bottom: auto; border-radius: 0 0 3px 3px; background: var(--teal); }
}

/* ---------- Page ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 26px 20px 44px; display: grid; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 640px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-main { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px) { .grid-2, .grid-main, .grid-side { grid-template-columns: 1fr; } .page { padding: 16px 14px 32px; gap: 14px; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; min-width: 0; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--teal); }
.card.attention { border-left: 4px solid var(--bad); }
.section-title { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 12px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; font: inherit; font-weight: 650;
       font-size: 14px; border: 1px solid var(--navy); border-radius: 999px; background: var(--navy); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-teal { background: var(--teal); border-color: var(--teal); }
.btn-teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-secondary { background: var(--card); color: var(--navy); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--slate-soft); border-color: var(--slate); }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: var(--slate-soft); color: var(--navy); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #962C24; }
.btn-small { min-height: 34px; padding: 0 13px; font-size: 13px; }
.btn-xl { min-height: 50px; font-size: 15.5px; padding: 0 26px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row form { margin: 0; }
.link-btn { background: none; border: 0; padding: 0 4px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: underline; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; color: var(--slate); cursor: pointer; }
.icon-btn:hover { border-color: var(--slate); color: var(--navy); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.chip-btn { font: inherit; font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--slate); cursor: pointer; }
.chip-btn:hover { border-color: var(--slate); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; align-content: start; }
.field-label { font-weight: 650; font-size: 13.5px; color: var(--navy); }
.input, select.input, textarea.input { width: 100%; min-height: 42px; padding: 9px 12px; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-s); }
.input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15, 127, 130, .22); outline-offset: 0; border-color: var(--teal); }
select { font: inherit; min-height: 36px; padding: 4px 8px; border: 1px solid var(--line-2); border-radius: var(--r-s); background: #fff; }
.input[type=time] { width: auto; min-width: 140px; }
.pw-wrap { display: flex; gap: 6px; align-items: center; }
.field-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.field-row:first-child { border-top: 0; padding-top: 0; }
.field-row b { display: block; font-size: 14px; }
.field-row small { display: block; font-size: 13px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .input { width: auto; flex: 1; min-width: 150px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.switch { position: relative; display: inline-block; vertical-align: middle; flex: none; width: 48px; height: 28px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid rgba(15, 127, 130, .3); outline-offset: 2px; }

.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { position: relative; }
.days input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.days span { display: grid; place-items: center; width: 50px; height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-s); font-weight: 700; font-size: 13px; background: #fff; color: var(--slate); }
.days input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.days input:focus-visible + span { outline: 3px solid rgba(15, 127, 130, .3); }
.radio-list { display: grid; gap: 8px; }
.radio-list label { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-s); cursor: pointer; background: #fff; }
.radio-list label:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.radio-list input { margin-top: 4px; accent-color: var(--teal); }
.radio-list small { display: block; color: var(--muted); font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: #fff; gap: 2px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 6px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--slate); }
.seg input:checked + span { background: var(--navy); color: #fff; }

/* ---------- Pills, banners, toasts ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 12px; font-weight: 700; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--ok); background: var(--ok-soft); border-color: #B6DEC9; }
.pill-bad { color: var(--bad); background: var(--bad-soft); border-color: #EFC0BA; }
.pill-info { color: var(--slate); background: var(--slate-soft); border-color: #C6D3E4; }
.pill-muted { color: var(--muted); background: var(--bg); border-color: var(--line-2); }
.pill-amber { color: #8A5A10; background: var(--amber-soft); border-color: #EBD3A6; }
.pill-teal { color: var(--teal-dark); background: var(--teal-soft); border-color: #B5DEDB; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--amber-soft);
          border: 1px solid #EBD3A6; border-radius: var(--r-s); font-weight: 600; font-size: 14px; }
.banner.bad { background: var(--bad-soft); border-color: #EFC0BA; }
.banner.info { background: var(--slate-soft); border-color: #C6D3E4; }
.toasts { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(540px, calc(100% - 28px)); }
.toast { padding: 13px 18px; background: var(--navy); color: #fff; font-weight: 600; font-size: 14px; border-radius: var(--r-s); border-left: 5px solid #5FD0C9;
         box-shadow: 0 10px 28px rgba(20, 40, 74, .25); transition: opacity .4s, transform .4s; }
.toast-error { border-left-color: #F08A7E; }
.toast-info { border-left-color: #9AB0CC; }
.toast.is-gone { opacity: 0; transform: translateY(-8px); }

/* ---------- Today ---------- */
.hero { position: relative; overflow: hidden; background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 55%, #24507A 100%); color: #fff; border-radius: 18px;
        padding: 26px 30px; display: flex; gap: 22px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -40px; top: -70px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(95, 208, 201, .28), transparent 65%); }
.hero h1 { color: #fff; font-size: 30px; }
.hero p { color: #C4D0E2; margin-top: 4px; }
.hero-date { display: grid; place-items: center; width: 82px; height: 82px; border-radius: 16px; background: #fff; color: var(--navy); flex: none; line-height: 1; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.hero-date small { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
.hero-date b { font-family: var(--serif); font-size: 38px; }
.hero-stats { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stat { min-width: 130px; padding: 10px 14px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 12px; }
.hero-stat span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #9FB1CC; }
.hero-stat b { display: block; font-size: 16px; margin-top: 3px; white-space: nowrap; }
.hero-stat b.ok { color: #8BE3C3; } .hero-stat b.warn { color: #F6CB7D; }
@media (max-width: 760px) { .hero { padding: 20px; } .hero-stats { margin-left: 0; width: 100%; } .hero-stat { flex: 1; min-width: 0; } .hero-date { width: 64px; height: 64px; } .hero-date b { font-size: 28px; } }

.power { display: flex; align-items: center; gap: 20px; width: 100%; padding: 20px 22px; font: inherit; text-align: left; cursor: pointer; border-radius: 18px;
         background: var(--teal); color: #fff; border: 0; box-shadow: 0 8px 24px rgba(15, 127, 130, .28); }
.power .knob { display: grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; background: #fff; color: var(--teal); flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.power b { display: block; font-size: 19px; }
.power small { display: block; color: #D7F0EE; font-size: 13.5px; margin-top: 2px; }
.power .state { margin-left: auto; font-size: 30px; font-weight: 800; letter-spacing: .06em; }
.power.is-off { background: var(--card); color: var(--ink); border: 2px dashed var(--line-2); box-shadow: none; }
.power.is-off .knob { background: var(--bg); color: var(--muted); box-shadow: none; border: 1px solid var(--line-2); }
.power.is-off small { color: var(--muted); }
.power.is-off .state { color: var(--muted); }

.papers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.paper-card { display: flex; flex-direction: column; gap: 14px; }
.paper-card.is-off { background: #FBFAF7; }
.paper-top { display: flex; gap: 14px; align-items: flex-start; }
.paper-top h2 { font-family: var(--serif); font-size: 21px; }
.paper-top .who { font-size: 13px; color: var(--muted); }
.mini-switch { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mini-switch button { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 800; font-size: 13px; letter-spacing: .06em; color: var(--muted); }
.mini-switch .track { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--line-2); transition: background .15s; }
.mini-switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.mini-switch .on .track { background: var(--teal); }
.mini-switch .on .track::after { transform: translateX(22px); }
.mini-switch .on { color: var(--teal-dark); }
.status-line { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: var(--r-s); background: var(--bg); font-size: 14px; }
.status-line .icon { margin-top: 2px; color: var(--slate); }
.status-on { background: var(--teal-soft); } .status-on .icon { color: var(--teal-dark); }
.status-setup, .status-held { background: var(--amber-soft); }
.todo-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.todo-list a { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-s); text-decoration: none; font-weight: 600; background: #fff; color: var(--navy); }
.todo-list a:hover { border-color: var(--teal); }
.edition-row { display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: start; }
.page-thumb { display: block; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; background: #fff; box-shadow: 0 4px 12px rgba(20, 40, 74, .1); }
.page-thumb img { width: 100%; height: auto; }
.page-thumb-empty { display: grid; place-items: center; aspect-ratio: 8.5 / 11; color: var(--muted); background: var(--bg); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.issues li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--bad-soft); border-radius: var(--r-s); font-size: 14px; }
.issues li .icon { color: var(--bad); margin-top: 1px; }

/* ---------- Lists + tables ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item b { display: block; }
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); padding: 8px 10px; border-bottom: 2px solid var(--navy); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td small { display: block; color: var(--muted); font-size: 12px; }
.table tr:last-child td { border-bottom: 0; }
.table.log td { font: 12.5px ui-monospace, Menlo, Consolas, monospace; padding: 5px 8px; }
.lvl-error { color: var(--bad); font-weight: 700; }
.lvl-warn { color: var(--amber); font-weight: 700; }
.thumb-mini { width: 54px; border: 1px solid var(--line-2); border-radius: 4px; background: #fff; }

/* ---------- Printers ---------- */
.device { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.device + .device { margin-top: 10px; }
.device.is-default { border-color: var(--teal); box-shadow: inset 4px 0 0 var(--teal); }
.device-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--slate-soft); color: var(--slate); flex: none; }
.device h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Paper editor + setup ---------- */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.subnav a { padding: 10px 14px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subnav a.is-active { color: var(--navy); border-bottom-color: var(--teal); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.steps a { display: flex; gap: 12px; align-items: center; padding: 9px 11px; border-radius: var(--r-s); text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.steps a:hover { background: #fff; }
.steps .n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); font-size: 12.5px; font-weight: 700; flex: none; background: #fff; }
.steps .done .n { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); }
.steps .is-active a { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.steps .is-active .n { background: var(--navy); border-color: var(--navy); color: #fff; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 3px; }
.setup-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sec-list { display: grid; gap: 8px; }
.sec { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; }
.sec.is-on { border-color: #B5DEDB; background: #FBFEFE; }
.sec-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--slate-soft); color: var(--slate); flex: none; }
.sec.is-on .sec-ic { background: var(--teal-soft); color: var(--teal-dark); }
.sec small { display: block; color: var(--muted); font-size: 12.5px; }
.sec .order { display: flex; gap: 4px; }
.outlets { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.outlet { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; }
.outlet.is-on { border-color: var(--teal); background: var(--teal-soft); }
.outlet b { display: block; font-size: 14px; }
.outlet small { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; }
.outlet select { min-height: 30px; font-size: 13px; }
.sec-block { padding: 18px 0; border-top: 1px solid var(--line); }
.sec-block:first-of-type { border-top: 0; padding-top: 4px; }
.sec-block h3 { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 16px; }
.sec-block h3 .icon { color: var(--teal); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--slate-soft); color: var(--navy); font-size: 13px; font-weight: 600; }
.chip form { margin: 0; }
.chip button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(20,40,74,.08); color: var(--slate); cursor: pointer; }
.chip button:hover { background: var(--bad-soft); color: var(--bad); }
.chip.block { background: var(--bad-soft); color: var(--bad); }
.check-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.check-chips label { position: relative; }
.check-chips input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.check-chips span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; background: #fff; color: var(--slate); }
.check-chips input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.check-chips input:focus-visible + span { outline: 3px solid rgba(15, 127, 130, .3); }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tpl { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; cursor: pointer; }
.tpl input { position: absolute; opacity: 0; }
.tpl-img { background: var(--bg); border-bottom: 1px solid var(--line); aspect-ratio: 8.5 / 11; overflow: hidden; }
.tpl-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tpl-body { padding: 10px 12px; }
.tpl-body b { display: block; font-size: 14px; color: var(--navy); }
.tpl-body small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.tpl:has(input:checked) { border: 2px solid var(--teal); box-shadow: 0 0 0 4px rgba(15, 127, 130, .12); }
.tpl:has(input:checked)::after { content: "Selected"; position: absolute; top: 8px; left: 8px; background: var(--teal); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; }
.preview-pair { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.preview-pair figure { margin: 0; width: min(330px, 100%); }
.preview-pair figcaption { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin-bottom: 6px; }
.preview-img { position: relative; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; box-shadow: 0 10px 30px rgba(20, 40, 74, .15); min-height: 200px; }
.preview-img img { width: 100%; }
.preview-img .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; background: repeating-linear-gradient(-45deg, #fff, #fff 10px, var(--bg) 10px, var(--bg) 20px); }
.callout { padding: 14px 16px; border-radius: var(--r-s); background: var(--slate-soft); font-size: 14px; }
.callout b { color: var(--navy); }
.callout.teal { background: var(--teal-soft); }

/* ---------- History ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .input, .filters select { width: auto; min-width: 140px; min-height: 38px; }
.filters .input[type=search] { min-width: 220px; flex: 1; }
.tl { display: grid; gap: 2px; font-size: 12.5px; }
.tl span { color: var(--muted); }
.art { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.art:first-child { border-top: 0; }
.art h3 { font-family: var(--serif); font-size: 17px; }
.art h3 a { color: var(--navy); text-decoration: none; }
.art h3 a:hover { text-decoration: underline; }
.art p { font-size: 14px; color: var(--ink); }
.art .meta { font-size: 12.5px; color: var(--muted); }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; background: var(--card); }
.auth-art { position: relative; overflow: hidden; background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 60%, #255A80 100%); color: #fff; padding: 46px 56px; display: flex; flex-direction: column; gap: 30px; }
.auth-art::after { content: ""; position: absolute; right: -120px; bottom: -160px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(95, 208, 201, .25), transparent 65%); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { height: 52px; background: #fff; border-radius: 12px; padding: 4px 6px; }
.auth-brand b { font-family: var(--serif); font-size: 26px; }
.auth-art-body { flex: 1; display: grid; grid-template-columns: 1fr 270px; gap: 40px; align-items: center; position: relative; z-index: 1; }
.auth-art h2 { font-family: var(--serif); color: #fff; font-size: 46px; font-weight: 700; line-height: 1.06; letter-spacing: -.02em; }
.auth-art h2 em { font-style: italic; color: #8BE3DC; }
.auth-art p { color: #C4D0E2; font-size: 16px; margin-top: 18px; max-width: 440px; }
.auth-art ul { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 10px; color: #E4EAF3; font-size: 15px; }
.auth-art li { display: flex; gap: 12px; align-items: center; }
.auth-art li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #5FD0C9; flex: none; }
.paper-stack { position: relative; width: 270px; aspect-ratio: 8.5 / 11; }
.sheet { position: absolute; width: 100%; height: auto; background: #fff; border-radius: 3px; box-shadow: 0 22px 46px rgba(0, 0, 0, .45); }
.sheet-back { transform: translate(28px, -22px) rotate(4deg); opacity: .6; }
.sheet-front { transform: rotate(-2.5deg); }
.paper-tag { position: absolute; left: -20px; bottom: 28px; background: #fff; color: var(--navy); font-weight: 800; font-size: 12px; letter-spacing: .06em;
             text-transform: uppercase; padding: 8px 12px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
.auth-art .powered { display: flex; align-items: center; gap: 10px; color: #9FB1CC; font-size: 13px; position: relative; z-index: 1; }
.auth-art .powered img { height: 22px; background: #fff; padding: 3px 6px; border-radius: 4px; }
.auth { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: min(430px, 100%); }
.auth-card .card { padding: 32px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 20px; }
.auth-logo-m { display: none; width: 170px; margin: 0 auto 20px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth-switch a { font-weight: 700; }
@media (max-width: 1100px) { .auth-art-body { grid-template-columns: 1fr; } .paper-stack { display: none; } }
@media (max-width: 860px) { .auth-body { grid-template-columns: 1fr; } .auth-art { display: none; } .auth { align-items: start; padding-top: 40px; } .auth-logo-m { display: block; } }

/* ---------- Error page, footer, modal ---------- */
.error-body { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.error-card { width: min(460px, 100%); background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 32px; text-align: center; display: grid; gap: 12px; justify-items: center; box-shadow: var(--shadow); }
.error-logo { width: 160px; height: auto; margin-bottom: 8px; }
.error-card p { color: var(--muted); }
.footer { max-width: 1120px; margin: 0 auto; padding: 8px 20px 28px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12.5px; }
.footer .powered { display: inline-flex; align-items: center; gap: 6px; }
.footer .powered img { height: 14px; }
.modal { border: 0; padding: 0; border-radius: var(--r); width: min(460px, calc(100% - 28px)); box-shadow: 0 24px 60px rgba(20, 40, 74, .3); }
.modal::backdrop { background: rgba(20, 40, 74, .5); }
.modal form { padding: 24px; display: grid; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Admin ---------- */
.admin-top { background: var(--navy); color: #fff; }
.admin-top .topbar-in { height: 60px; }
.admin-top h1 { font-family: var(--font); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: #8BE3DC; padding-left: 16px; border-left: 1px solid rgba(255,255,255,.2); }
.admin-nav { background: var(--card); border-bottom: 1px solid var(--line); }
.admin-nav .topbar-in { height: 50px; gap: 2px; overflow-x: auto; }
.admin-nav a { display: flex; align-items: center; gap: 7px; height: 100%; padding: 0 14px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted);
               border-bottom: 3px solid transparent; white-space: nowrap; }
.admin-nav a.is-active { color: var(--navy); border-bottom-color: var(--teal); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 30px; color: var(--navy); }
.stat span { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 170px; padding-top: 10px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar i { display: block; background: var(--teal); min-height: 1px; border-radius: 3px 3px 0 0; }
.bar i.fail { background: var(--bad); border-radius: 0; }
.bar span { font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; overflow: hidden; }
.bar em { font-style: normal; font-size: 11px; font-weight: 700; text-align: center; }
.filter-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.filter-row a { padding: 4px 11px; border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none; color: var(--slate); }
.filter-row a.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }
.user-tools summary { cursor: pointer; font-weight: 700; font-size: 13px; list-style: none; padding: 4px 11px; border: 1px solid var(--line-2); border-radius: 999px; display: inline-block; }
.user-tools[open] summary { background: var(--navy); color: #fff; }
.user-tools > div { display: grid; gap: 6px; margin-top: 8px; min-width: 180px; }
.temp-pw { display: inline-block; margin-top: 6px; padding: 4px 8px; background: var(--amber-soft); border: 1px solid #EBD3A6; border-radius: 6px; font: 13px ui-monospace, Menlo, monospace; font-weight: 700; }

/* ---------- Preview loading page ---------- */
.loading-body { min-height: 100vh; margin: 0; display: grid; place-items: center; padding: 24px;
                background: radial-gradient(circle at 80% 10%, rgba(95, 208, 201, .22), transparent 45%), linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 60%, #255A80 100%); }
.loading-card { width: min(540px, 100%); background: #fff; border-radius: 20px; padding: 32px 34px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); display: grid; gap: 10px; }
.loading-card .auth-brand b { color: var(--navy); font-size: 22px; }
.loading-card .auth-brand img { height: 42px; border: 1px solid var(--line); }
.loading-tag { margin-top: 10px; color: var(--teal-dark); }
.loading-card h1 { font-size: 32px; }
.loading-date { color: var(--muted); margin-top: -4px; }
.loading-sheet { position: relative; height: 92px; margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 8px; background: #FBFAF7; padding: 12px 14px; display: grid; gap: 7px; overflow: hidden; }
.loading-sheet i { display: block; height: 8px; border-radius: 4px; background: var(--line); }
.loading-sheet i:nth-child(1) { width: 62%; height: 14px; background: #D5DCE6; }
.loading-sheet i:nth-child(2) { width: 92%; } .loading-sheet i:nth-child(3) { width: 84%; } .loading-sheet i:nth-child(4) { width: 88%; }
.loading-sheet i:nth-child(5) { width: 70%; } .loading-sheet i:nth-child(6) { width: 40%; }
.loading-sheet::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .85) 50%, transparent 70%);
                        transform: translateX(-100%); animation: ms-shine 1.6s ease-in-out infinite; }
@keyframes ms-shine { to { transform: translateX(100%); } }
.loading-bar { height: 10px; border-radius: 5px; background: var(--slate-soft); overflow: hidden; }
.loading-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--teal), #3FB3AE); transition: width .12s linear; }
.loading-bar.is-failed i { background: var(--bad); }
.loading-step { font-weight: 650; color: var(--navy); }
.loading-note { font-size: 14px; color: var(--muted); }
.loading-explain { font-size: 13px; color: var(--ink); background: var(--slate-soft); border-radius: var(--r-s); padding: 11px 13px; line-height: 1.55; }
.loading-fail { padding: 12px 14px; background: var(--bad-soft); border-radius: var(--r-s); font-size: 14px; }
.loading-card .powered { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.loading-card .powered img { height: 16px; }
@media (prefers-reduced-motion: reduce) { .loading-sheet::after { animation: none; } }
.block { display: block; }
/* Kid's age: only when "Kid" is the chosen reader */
.kid-only { display: none; }
form:has(input[name=reader][value=kid]:checked) .kid-only { display: grid; }
