/* EMDEX Logbook: navy and white, large type, plain words.
   Font: Figtree from Google Fonts when online, system font otherwise. */
:root {
  --navy: #0B2E59; --navy2: #123A6D; --mid: #1F4E8C; --ink: #1B1F27; --mute: #5B6573;
  --line: #DCE3EE; --bg: #F3F6FB; --card: #fff; --pale: #EAF0F8; --sky: #9DB7DA;
  --green: #1E7B4F; --green-bg: #E6F4EC; --amber: #8A5300; --amber-bg: #FFF1D6; --amber-line: #F0C77A;
  --red: #B3261E; --red-bg: #FBE9E7;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/28px 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--mid); }
h1 { margin: 0; font-size: 38px; line-height: 44px; font-weight: 800; color: var(--navy); }
h2 { margin: 0 0 6px; font-size: 26px; line-height: 32px; font-weight: 800; color: var(--navy); }
h3 { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: var(--navy); }
.sub { font-size: 20px; color: var(--mute); margin-top: 6px; }
.mute { color: var(--mute); }
.small { font-size: 16px; line-height: 24px; }
.sr { position: absolute; left: -9999px; }
:focus-visible { outline: 3px solid #F5A623; outline-offset: 2px; }

/* top bar */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 10px rgba(11,46,89,.25); }
html { scroll-padding-top: 96px; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 0 24px; min-height: 72px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-size: 19px; font-weight: 800; padding: 10px 0; white-space: nowrap; }
.brand .mark { width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; flex-grow: 1; }
.tabs a { display: inline-flex; align-items: center; height: 44px; padding: 0 9px; border-radius: 999px; font-size: 15px; font-weight: 700; color: #DCE6F5; text-decoration: none; }
.tabs a:hover { background: rgba(255,255,255,.12); }
.tabs a.on { background: #fff; color: var(--navy); }
.who { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; margin-left: auto; }
.who .av { width: 40px; height: 40px; border-radius: 50%; background: var(--mid); display: flex; align-items: center; justify-content: center; }
.who a:not(.x) { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who a, .who button { color: #DCE6F5; background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }

main { max-width: 1240px; margin: 0 auto; padding: 40px 24px 64px; display: flex; flex-direction: column; gap: 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px; }
.card.tight { padding: 20px 24px; }
.row { display: flex; gap: 24px; flex-wrap: wrap; }
.row > * { flex: 1 1 260px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid3 { grid-template-columns: 1fr; } h1 { font-size: 30px; line-height: 36px; } main { padding: 24px 16px 48px; } }

/* pills, bars, buttons */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; line-height: 24px; white-space: nowrap; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.mute { background: var(--pale); color: var(--mid); }
.bar { position: relative; width: 100%; height: 26px; background: #E6ECF5; border-radius: 26px; }
.bar.thin { height: 14px; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--mid); }
.bar > i.g { background: var(--green); }
.bar > b { position: absolute; top: -5px; width: 3px; height: calc(100% + 10px); background: var(--navy); border-radius: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 0 32px; border-radius: 14px; border: 0; background: var(--navy); color: #fff; font: 700 19px 'Figtree', system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--navy2); }
.btn.big { min-height: 72px; padding: 0 52px; font-size: 22px; }
.btn.light { background: #fff; color: var(--navy); border: 2px solid var(--sky); }
.btn.danger { background: var(--red); }
.btn.small { min-height: 44px; padding: 0 20px; font-size: 16px; border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: 600 17px 'Figtree', system-ui, sans-serif; color: var(--mid); text-decoration: underline; cursor: pointer; }

/* forms */
label, .label { display: block; font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%; min-height: 56px; border: 3px solid var(--sky); border-radius: 14px; padding: 10px 18px; font: 19px 'Figtree', system-ui, sans-serif; color: var(--ink); background: #fff;
}
textarea { min-height: 120px; line-height: 28px; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
.field { margin-bottom: 18px; }
.help { font-size: 16px; line-height: 24px; color: var(--mute); margin-top: 6px; }
.step { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.step .n { width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; flex-shrink: 0; }
.step h2 { margin: 0; }
.errors { background: var(--red-bg); border: 2px solid #E8B4AE; color: var(--red); border-radius: 14px; padding: 16px 20px; margin-bottom: 20px; }
.errors ul { margin: 0; padding-left: 22px; }

/* choice buttons (radio styled as big buttons) */
.choices { display: flex; gap: 16px; flex-wrap: wrap; }
.choice { flex: 1 1 200px; position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.choice span { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border-radius: 16px; border: 3px solid var(--line); background: #fff; color: var(--navy); font-weight: 800; font-size: 21px; }
.choice span small { font-size: 16px; font-weight: 500; color: var(--mute); }
.choice input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.choice input:checked + span small { color: #DCE6F5; }
.choice input:focus-visible + span { outline: 3px solid #F5A623; outline-offset: 2px; }

/* flash */
.flash { padding: 16px 22px; border-radius: 14px; font-weight: 600; }
.flash.ok { background: var(--green-bg); color: var(--green); border: 2px solid #B7DFC9; }
.flash.warn { background: var(--amber-bg); color: var(--amber); border: 2px solid var(--amber-line); }
.flash.err { background: var(--red-bg); color: var(--red); border: 2px solid #E8B4AE; }

/* score */
.score { display: flex; gap: 56px; align-items: center; flex-wrap: wrap; }
.score .big { font-size: 112px; line-height: 118px; font-weight: 800; color: var(--navy); }
.score .of { font-size: 26px; color: var(--mute); }
.score .meter { flex: 1 1 320px; display: flex; flex-direction: column; gap: 14px; }
.stat { display: flex; align-items: center; gap: 20px; }
.stat .ico { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 28px; font-weight: 800; }
.stat .v { font-size: 52px; line-height: 54px; font-weight: 800; }
.stat .ok { background: var(--green-bg); color: var(--green); } .stat .warn { background: var(--amber-bg); color: var(--amber); } .stat .mute { background: var(--pale); color: var(--mid); }

/* lists and tables */
.item { display: flex; align-items: center; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.item:first-of-type { border-top: 0; }
.item .grow { flex: 1 1 260px; }
.item .t { font-size: 20px; font-weight: 700; }
table.t { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 22px; }
table.t th { text-align: left; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); padding: 10px 12px; border-bottom: 2px solid var(--line); }
table.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; }
.tablewrap { overflow-x: auto; }

.areacard { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; }
.areacard .name { font-size: 21px; line-height: 26px; font-weight: 800; color: var(--navy); min-height: 52px; }
.areacard .sc { font-size: 56px; line-height: 58px; font-weight: 800; color: var(--mid); }

.callout { border-radius: 14px; padding: 18px 22px; background: var(--amber-bg); border: 2px solid var(--amber-line); color: #5b3900; }
.callout.info { background: var(--pale); border-color: var(--sky); color: var(--navy); }
.sticky-bar { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 24px; padding: 20px 28px; border-radius: 20px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.sticky-bar .msg { flex: 1 1 300px; font-size: 19px; line-height: 28px; font-weight: 500; }
.sticky-bar .btn { background: #fff; color: var(--navy); }
.hidden { display: none !important; }

/* login */
.login { min-height: 100vh; display: flex; background: #fff; }
.login .side { flex: 0 0 46%; background: var(--navy); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: space-between; }
.login .side h1 { color: #fff; font-size: 44px; line-height: 52px; }
.login .side p { font-size: 20px; line-height: 30px; color: #C9D8EE; margin: 18px 0 0; }
.login .form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }
.login form { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 800px) { .login { flex-direction: column; } .login .side { flex-basis: auto; padding: 32px; } .login .side h1 { font-size: 30px; line-height: 38px; } }

/* report (screen + print) */
.report { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 40px 48px; max-width: 900px; margin: 0 auto; width: 100%; font-size: 15px; line-height: 22px; }
.report h1 { font-size: 30px; line-height: 36px; }
.report h2 { font-size: 20px; line-height: 26px; margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--navy); }
.report .head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 3px solid var(--navy); padding-bottom: 14px; margin-bottom: 8px; }
.report .kv { display: grid; grid-template-columns: 170px 1fr; gap: 4px 16px; }
.report .kv dt { color: var(--mute); font-weight: 600; }
.report .kv dd { margin: 0; }
.report table.t { font-size: 13px; line-height: 18px; }
.report table.t th { font-size: 11px; padding: 6px 8px; }
.report table.t td { padding: 7px 8px; }
.report .big { font-size: 64px; line-height: 68px; font-weight: 800; color: var(--navy); }
.sign { display: flex; gap: 48px; margin-top: 36px; }
.sign div { flex: 1; border-top: 1px solid var(--ink); padding-top: 6px; font-size: 13px; color: var(--mute); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--pale); color: var(--mid); white-space: nowrap; }
.tag.self { background: var(--amber-bg); color: var(--amber); }

/* Computer / Phone switch (see assets/js/view.js) */
.viewsw { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255,255,255,.12); margin-left: auto; flex: none; }
.viewsw button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 36px; height: 34px; border: 0; border-radius: 999px; background: transparent; color: #DCE6F5; cursor: pointer; padding: 0; font: inherit; font-size: 15px; font-weight: 700; }
.viewsw button:hover { background: rgba(255,255,255,.14); }
.viewsw button[aria-pressed="true"] { background: #fff; color: var(--navy); }
.viewsw .vs-label { position: absolute; left: -9999px; }
.viewsw.on-light { background: var(--pale); border: 1px solid var(--line); }
.viewsw.on-light button { color: var(--mid); width: auto; padding: 0 14px; }
.viewsw.on-light button:hover { background: #dfe8f5; }
.viewsw.on-light button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.viewsw.on-light .vs-label { position: static; }
.viewsw.corner { position: fixed; top: 16px; right: 16px; z-index: 5; margin: 0; }
@media (max-width: 800px) { .viewsw.corner { position: static; display: flex; width: max-content; margin: 12px auto; } }

/* Phone view: a phone-width column with the same rules a small screen gets. Works on any device. */
html[data-view="phone"] { background: #CFD8E6; }
html[data-view="phone"] body { max-width: 430px; margin: 0 auto; min-height: 100vh; box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(11, 46, 89, .22); }
html[data-view="phone"] .grid3 { grid-template-columns: 1fr; }
html[data-view="phone"] h1 { font-size: 30px; line-height: 36px; }
html[data-view="phone"] main { padding: 24px 16px 48px; }
html[data-view="phone"] .login { flex-direction: column; min-height: 100vh; }
html[data-view="phone"] .login .side { flex-basis: auto; padding: 32px; }
html[data-view="phone"] .login .side h1 { font-size: 30px; line-height: 38px; }
html[data-view="phone"] .viewsw.corner { position: static; display: flex; width: max-content; margin: 12px auto; }


/* sticky header stays short on a phone: the tabs slide sideways on one row */
@media (max-width: 620px) {
  .top-in { padding: 0 16px; gap: 4px 12px; min-height: 0; }
  .tabs { order: 5; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: 0 0 auto; }
  .brand { padding: 6px 0; } .brand span:last-child { display: none; }
  .who a:not(.x) { display: none; }
  html { scroll-padding-top: 112px; }
}
html[data-view="phone"] .top-in { padding: 0 16px; gap: 4px 12px; min-height: 0; }
html[data-view="phone"] .tabs { order: 5; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; scrollbar-width: none; }
html[data-view="phone"] .tabs::-webkit-scrollbar { display: none; }
html[data-view="phone"] .tabs a { flex: 0 0 auto; }
html[data-view="phone"] .brand { padding: 6px 0; }
html[data-view="phone"] .brand span:last-child { display: none; }
html[data-view="phone"] .who a:not(.x) { display: none; }
html[data-view="phone"] { scroll-padding-top: 112px; }

@media print {
  html[data-view="phone"], body { background: #fff; }
  html[data-view="phone"] body { max-width: none; box-shadow: none; }
  html[data-view="phone"] main { padding: 0; }
  body { font-size: 12pt; }
  .viewsw { display: none !important; }
  .top, .noprint, .flash { display: none !important; }
  main { padding: 0; max-width: none; }
  .report { border: 0; border-radius: 0; padding: 0; max-width: none; }
  .report h2 { break-after: avoid; }
  .report table, .report .keep { break-inside: avoid; }
  .report tr { break-inside: avoid; }
  @page { size: A4; margin: 16mm 14mm; }
}
