:root {
  color-scheme: light;
  --navy: #22396c;
  --ink: #10233f;
  --blue: #034d8f;
  --sky: #c7eafb;
  --ice: #e8f5fc;
  --border: #bfd9ec;
  --muted: #46617c;
  --red: #a52624;
  --gold: #815000;
  --green: #19654a;
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--ice);
  color: var(--ink);
  line-height: 1.55;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #297dbd; outline-offset: 3px; }
button:disabled { opacity: .52; cursor: default; }
a { color: var(--blue); }
.bar { background: var(--navy); color: white; }
.bar-inner { max-width: 1510px; min-height: 70px; padding: 0 clamp(16px, 3vw, 36px); margin-inline: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand { color: inherit; font-size: 1.55rem; font-weight: 750; display: inline-flex; gap: 9px; align-items: center; text-decoration: none; justify-self: start; }
.brand span, .logout span:first-child { display: grid; }
.brand svg { width: 29px; height: 29px; }
nav { display: flex; gap: 7px; align-items: center; }
nav button, .logout { background: transparent; color: white; border: 1px solid transparent; border-bottom-width: 2px; border-radius: 8px; padding: 8px 13px; }
nav button[aria-current] { background: #2c6096; border-bottom: 2px solid #99d4fd; }
nav button:hover, .logout:hover { background: #2c6096; }
.logout { justify-self: end; grid-column: 3; display: flex; align-items: center; gap: 7px; }
.logout [data-icon="account"] { display: none; }
main { max-width: 1510px; margin-inline: auto; padding: 32px clamp(16px, 3vw, 36px) 50px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 3.1vw, 2.55rem); font-weight: 800; line-height: 1.25; }
h2 { font-size: 1.5rem; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--blue); border: 1px solid #91b9dd; background: #fff; border-radius: 9px; min-height: 41px; padding: 8px 13px; font-weight: 700; text-decoration: none; width: fit-content; }
.button:hover, .icon-button:hover { background: #f0f8fe; }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover { background: #093e70; }
.button.danger { color: var(--red); border-color: #f1c0be; }
.icon-button { min-width: 36px; min-height: 36px; padding: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat, .card { border: 1px solid var(--border); background: white; color: var(--ink); border-radius: 14px; text-align: start; }
.stat { min-height: 106px; padding: 15px; display: flex; align-items: center; gap: 13px; font-weight: 700; }
.stat[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.stat strong { display: block; color: var(--tone); line-height: 1.15; font-size: 1.9rem; }
.today, .open, .card { --tone: var(--blue); --tint: #deeffc; }
.near, .card.urgent { --tone: var(--gold); --tint: #fff0cf; }
.late { --tone: var(--red); --tint: #fae4e2; }
.done { --tone: var(--green); --tint: #dff3e9; }
.mark { width: 45px; height: 45px; border-radius: 11px; display: inline-grid; place-items: center; flex: none; background: var(--tint, #deeffc); color: var(--tone, var(--blue)); }
.mark svg { width: 23px; height: 23px; }
.panel { border: 1px solid var(--border); border-radius: 15px; background: white; overflow: hidden; }
.toolbar { display: flex; gap: 10px; padding: 13px; }
.search { flex: 1; min-width: 130px; color: var(--muted); position: relative; }
.search svg { position: absolute; inset-inline-start: 11px; top: 11px; pointer-events: none; }
.search input[type="search"] { padding-inline-start: 38px; }
input:not([type="checkbox"]), select, textarea { width: 100%; min-height: 41px; padding: 7px 10px; color: var(--ink); background: #fff; border: 1px solid #a5c8e3; border-radius: 8px; }
input[type="checkbox"] { accent-color: var(--blue); }
.toolbar select { width: auto; min-width: 125px; }
.table-wrap { overflow-x: auto; padding: 0 13px 13px; }
.panel > .table-wrap { padding-top: 13px; }
.panel > .toolbar + #results .table-wrap { padding-top: 0; }
table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 590px; overflow: hidden; border-radius: 9px; border: 1px solid #d7e8f4; }
th, td { padding: 11px 15px; text-align: start; }
thead th { background: #ceeafa; color: var(--ink); white-space: nowrap; font-size: .94rem; }
tbody td { border-top: 1px solid #e2edf5; }
tbody tr:hover { background: #f7fbfe; }
td:last-child { width: 1%; }
.time, time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.item-name { font-weight: 700; }
.text-button { padding: 2px 0; background: transparent; border: 0; color: var(--ink); font-weight: 700; text-align: start; }
.text-button:hover { color: var(--blue); text-decoration: underline; }
.badge { display: inline-flex; min-width: 62px; justify-content: center; padding: 3px 9px; color: var(--tone); background: var(--tint); font-weight: 750; font-size: .88rem; white-space: nowrap; border-radius: 8px; }
.empty, .state { text-align: center; padding: 30px 14px; color: var(--muted); }
/* Both views share the same bar, width, heading and controls; only the content differs. */
html { scrollbar-gutter: stable; }
body { min-height: 100vh; }
.expiry-view { --outline: #7bb9ff; --expiry-ink: #080e2a; }
.expiry-sort { position: relative; flex: none; }
.expiry-sort select { appearance: none; width: auto; min-width: 170px; padding-inline: 12px 36px; }
.expiry-sort svg { pointer-events: none; position: absolute; inset-inline-end: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; }
/* Fixed sizes in proportion to the rest of the page (not tied to the window width). */
.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.card { --tone: #0d4189; --tint: #e2f0fb; min-width: 0; min-height: 200px; padding: 16px 12px; display: grid; align-content: space-between; justify-items: center; gap: 8px; text-align: center; border: 1px solid var(--outline); border-radius: 16px; color: var(--expiry-ink); background: #fff; }
.card.urgent { --tone: #8e5100; --tint: #fff0d1; }
.card:hover { border-color: #1d6ed1; background: #f8fcff; }
.card .mark { width: 46px; height: 46px; border-radius: 12px; background: #d3e9fb; }
.card.urgent .mark { background: #fff5e0; }
.card .mark svg { width: 24px; height: 24px; }
.card strong { color: var(--tone); font-size: 1.9rem; font-weight: 800; line-height: 1.2; }
.card-title { width: 100%; background: var(--tint); padding: 5px 8px; border-radius: 10px; font-size: 1rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.card-date { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); }
.card-date svg { width: 18px; height: 18px; flex: none; }
.card time { font-size: .98rem; font-weight: 700; color: var(--expiry-ink); }
.expiry-empty { display: grid; justify-items: center; gap: 12px; margin-top: 16px; padding: 32px 16px; text-align: center; background: #fff; border: 1px solid var(--outline); border-radius: 15px; }
.expired { margin-top: 24px; padding: 0; background: #fff; border: 1px solid var(--border); border-inline-start: 5px solid #df222b; border-radius: 15px; overflow: hidden; }
.expired summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; list-style: none; padding: 10px 18px; font-size: 1.12rem; font-weight: 800; cursor: pointer; }
.expired summary::-webkit-details-marker { display: none; }
.expired-label { display: flex; align-items: center; gap: 10px; }
.expired .badge { color: #c91a22; background: #fce0e2; min-width: 34px; }
.expired-arrow { display: grid; }
.expired-arrow svg { width: 20px; height: 20px; stroke-width: 2.2; }
.expired[open] .expired-arrow { transform: rotate(180deg); }
.auth { max-width: 435px; margin: 6vh auto 0; padding: 24px; }
.auth h1 { margin: 12px 0 19px; font-size: 1.9rem; }
.form, .form label:not(.checks label) { display: grid; gap: 5px; }
.form { gap: 13px; }
.form small { font-weight: 400; color: var(--muted); }
dialog { width: min(620px, calc(100% - 24px)); max-height: 90vh; color: var(--ink); border: 1px solid var(--border); border-radius: 17px; padding: 20px; }
dialog::backdrop { background: #10274699; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.dialog-head button { font-size: 1.3rem; padding: 0 7px; }
.fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.wide { grid-column: 1 / -1; }
.checks, .inline { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.evidence { background: #e4f3ff; padding: 8px 11px; border-radius: 8px; }
.error { color: var(--red); font-weight: 650; }
.form-actions { padding-top: 6px; }
.share-select { overflow: auto; max-height: 175px; padding: 8px; border: 1px solid var(--border); border-radius: 9px; }
.share-select label { display: flex !important; padding: 4px 0; }
.share-list { padding: 0; list-style: none; margin: 8px 0 0; }
.share-list li { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--border); }
#dialog h3 { margin-top: 18px; }
#link-result .button { margin-top: 7px; }
#toast { position: fixed; z-index: 5; inset-inline-start: 18px; bottom: 18px; padding: 10px 16px; background: var(--navy); color: white; border-radius: 9px; box-shadow: 0 3px 12px #10233f40; }
@media (max-width: 1050px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
}
@media (max-width: 680px) {
  .bar-inner { min-height: 62px; gap: 8px; grid-template-columns: auto 1fr auto; }
  .brand { font-size: 1.12rem; }
  .brand svg { width: 23px; height: 23px; }
  nav { justify-content: center; gap: 2px; }
  nav button { padding: 5px; font-size: .78rem; }
  .logout { padding: 6px; }
  .logout span:last-child { display: none; }
  main { padding-top: 20px; }
  .title-row { align-items: start; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .title-row .button { font-size: .84rem; gap: 5px; padding-inline: 8px; }
  .title-row svg { width: 16px; }
  .stat { min-height: 90px; padding: 8px 5px; gap: 4px; flex-direction: column; justify-content: center; text-align: center; font-size: .84rem; }
  .stat .mark { width: 30px; height: 30px; }
  .stat svg { width: 17px; }
  .stat strong { font-size: 1.25rem; }
  .stats, .cards { gap: 8px; }
  .toolbar { flex-wrap: wrap; }
  .search { flex: 1 1 100%; }
  .toolbar select { flex: 1; }
  .expiry-sort { flex: 1; }
  .expiry-sort select { width: 100%; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { min-height: 170px; padding: 12px 8px; border-radius: 14px; }
  .card strong { font-size: 1.5rem; }
  .card-title { font-size: .9rem; }
  .expired { margin-top: 22px; border-inline-start-width: 5px; }
  .expired summary { min-height: 52px; font-size: 1rem; }
  th, td { padding-inline: 10px; }
}


/* Upload review */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.file-preview { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: #f6fbff; }
.file-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #fff; flex: none; }
.file-preview > span:not(.mark) { display: grid; min-width: 0; flex: 1; }
.file-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview small { color: var(--muted); }
.reading { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px; background: #e4f3ff; color: var(--blue); font-weight: 650; }
.reading.done { background: #dff3e9; color: var(--green); }
.reading.failed { background: #fae4e2; color: var(--red); }
.spinner { width: 18px; height: 18px; border: 2.5px solid #9cc8ec; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.due-hint { min-height: 1.2em; }
.review { display: grid; gap: 9px; }
.evidence { background: #e4f3ff; padding: 9px 12px; border-radius: 9px; border-inline-start: 4px solid var(--blue); }
.evidence span { font-weight: 700; }
.evidence q { font-weight: 650; unicode-bidi: plaintext; }
.warning { background: #fff0cf; color: #5f3b00; padding: 9px 12px; border-radius: 9px; border-inline-start: 4px solid var(--gold); font-weight: 600; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.choice { display: grid; gap: 2px; text-align: start; padding: 10px 12px; border: 1.5px solid #91b9dd; border-radius: 10px; background: #fff; color: var(--ink); }
.choice small { color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--blue); background: #e4f3ff; box-shadow: 0 0 0 1px var(--blue); }
.confirm { display: flex !important; align-items: center; gap: 8px; font-weight: 700; padding: 6px 2px; }
.confirm input { width: 20px; height: 20px; }
.ocr summary, .more summary { color: var(--blue); font-weight: 700; padding: 4px 0; }
.ocr ol { margin: 6px 0 0; padding-inline-start: 22px; color: var(--muted); font-size: .92rem; max-height: 180px; overflow: auto; }
.more { border-top: 1px solid var(--border); padding-top: 8px; }
.more-body { display: grid; gap: 12px; padding-top: 10px; }
dialog { overflow-y: auto; }
.form-actions { flex-wrap: wrap; }

/* One table for everything; rows open details */
tr.clickable { cursor: pointer; }
.narrow-only { display: none; }
@media (max-width: 680px) {
  table.items { min-width: 0; }
  .table-wrap { padding: 0 8px 8px; }
  .items .wide-only { display: none; }
  .items th, .items td { padding: 11px 8px; }
  .items td:last-child { width: auto; }
  .items .item-name { width: 100%; }
  .items .narrow-only { display: block; color: var(--muted); font-weight: 500; font-size: .84rem; overflow-wrap: anywhere; }
  .items .text-button { font-size: .98rem; }
  .items .badge { min-width: 52px; }
  .items time { font-size: .9rem; }
  dialog { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; padding: 16px; }
  .fields { grid-template-columns: 1fr; }
  .form-actions .button { flex: 1 1 auto; }
}
q { quotes: "«" "»"; }
.alert-block { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border); }
.alert-block:first-of-type { border-top: 0; padding-top: 0; }
.alert-block h3 { margin: 0 !important; display: flex; align-items: center; gap: 8px; font-size: 1.08rem; }
.alert-block p { color: var(--muted); }
.share-list li small { display: block; color: var(--muted); }
#feed-result { display: grid; gap: 8px; }

/* Review window: fields on the right, document preview on the left */
dialog.wide-dialog { width: min(1180px, calc(100% - 24px)); }
.editor-layout.with-preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.doc-view { order: 2; position: sticky; top: 0; display: grid; gap: 6px; }
.doc-frame { height: min(72vh, 760px); overflow: auto; border: 1px solid var(--border); border-radius: 12px; background: #eef4f9; display: grid; place-items: start center; }
.doc-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.doc-frame img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; background: #fff; }
.doc-frame img.zoomed { max-width: none; max-height: none; width: 180%; cursor: zoom-out; }
.doc-view .subtle-link { justify-self: start; font-size: .9rem; }
.file-preview .mark { width: 40px; height: 40px; }
/* Reminder options: email and call, each with its own days */
.reminders { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 8px; }
.reminders legend { font-weight: 700; padding: 0 6px; }
.reminder-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.form label.check, .reminder-row .check { display: flex !important; align-items: center; gap: 7px; font-weight: 700; min-width: 80px; }
.form label.check input { width: 18px; height: 18px; }
.reminder-row .days { display: flex !important; align-items: center; gap: 7px; }
.reminder-row .days input { width: 130px; min-height: 36px; text-align: center; }
.reminder-row .off { color: var(--gold) !important; font-weight: 600 !important; }
.reminders > small { color: var(--muted); }
@media (max-width: 900px) {
  .editor-layout.with-preview { grid-template-columns: 1fr; }
  .doc-view { order: 0; position: static; }
  .doc-frame { height: 46vh; }
}

/* ───────────── V0.1.0 visual layer: IBM Plex Sans Arabic, refined blue, motion ───────────── */
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 700 900; src: url(/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/ibm-plex-sans-arabic-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/ibm-plex-sans-arabic-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-display: swap; font-weight: 700 900; src: url(/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow-sm: 0 1px 2px rgba(16, 35, 63, .06), 0 2px 8px rgba(16, 35, 63, .05);
  --shadow-md: 0 4px 12px rgba(16, 35, 63, .08), 0 10px 28px rgba(16, 35, 63, .07);
  --shadow-lg: 0 10px 24px rgba(16, 35, 63, .12), 0 22px 48px rgba(16, 35, 63, .10);
  --line: #d9e8f4;
}
body {
  display: flex; flex-direction: column;
  background:
    radial-gradient(1100px 520px at 105% -8%, #d3eafb 0, transparent 62%),
    radial-gradient(900px 520px at -12% 108%, #e0ecfd 0, transparent 60%),
    #eef6fc;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
main { flex: 1; width: 100%; }
h1 { font-weight: 700; letter-spacing: 0; }

/* Top bar: deep navy gradient, sticky, with a slow light sweep along its edge */
.bar { position: sticky; top: 0; z-index: 20; background: linear-gradient(115deg, #142650 0%, #22396c 48%, #1c4c88 100%); box-shadow: 0 6px 24px rgba(16, 35, 63, .22); }
.bar::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; background: linear-gradient(90deg, transparent, rgba(153, 212, 253, .9), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: sweep 7s var(--ease) infinite; opacity: .8; }
@keyframes sweep { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.brand { font-weight: 700; letter-spacing: 0; }
.brand span { padding: 6px; border-radius: 10px; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.brand svg { width: 24px; height: 24px; }
nav { background: rgba(255, 255, 255, .07); padding: 4px; border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
nav button { border: 0 !important; border-radius: 9px; padding: 8px 16px; font-weight: 500; color: #d9e9f8; transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease); }
nav button:hover { background: rgba(255, 255, 255, .09); color: #fff; }
nav button[aria-current] { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 2px 10px rgba(0, 0, 0, .15); }
.logout { border: 0 !important; transition: background .25s var(--ease); }

/* Buttons */
.button, .icon-button { border-radius: 10px; transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s; box-shadow: var(--shadow-sm); font-weight: 600; }
.button:hover, .icon-button:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: #6ea6d8; }
.button:active, .icon-button:active { transform: translateY(0) scale(.98); }
.button.primary { background: linear-gradient(135deg, #0c63bd 0%, #034d8f 100%); border-color: transparent; box-shadow: 0 4px 14px rgba(3, 77, 143, .28); }
.button.primary:hover { background: linear-gradient(135deg, #0f6dcc 0%, #04529a 100%); box-shadow: 0 8px 22px rgba(3, 77, 143, .34); }

/* Surfaces */
.panel { border-color: var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.stat { border-color: var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; position: relative; overflow: hidden; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--tone); opacity: .55; }
.stat strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.mark { background: linear-gradient(145deg, #fff, var(--tint, #deeffc)); box-shadow: inset 0 0 0 1px rgba(3, 77, 143, .08); }
input:not([type="checkbox"]), select, textarea { border-color: #bcd6ea; border-radius: 10px; transition: border-color .2s, box-shadow .2s; }
input:not([type="checkbox"]):focus, select:focus, textarea:focus { outline: none; border-color: #2f7fd0; box-shadow: 0 0 0 4px rgba(47, 127, 208, .15); }

/* Table */
table { border-color: var(--line); border-radius: 12px; }
thead th { background: linear-gradient(180deg, #e3f2fc, #d4ebfa); font-weight: 600; color: #1a3458; }
tbody tr { transition: background .2s var(--ease); }
tbody tr.clickable:hover { background: #f3f9fe; }
.badge { border-radius: 999px; font-weight: 600; padding: 3px 11px; }

/* Expiry cards */
.card { position: relative; overflow: hidden; border-color: var(--line); background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); box-shadow: var(--shadow-sm); transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--tone), #8fd0ff); }
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: #b9d6ef; background: #fff; }
.card strong { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.card .mark { transition: transform .35s var(--ease); }
.card:hover .mark { transform: scale(1.08) rotate(-4deg); }
.card.urgent .mark { animation: halo 2.6s ease-in-out infinite; }
@keyframes halo { 0%, 100% { box-shadow: 0 0 0 0 rgba(142, 81, 0, .28); } 50% { box-shadow: 0 0 0 8px rgba(142, 81, 0, 0); } }
.expired { box-shadow: var(--shadow-sm); }
.expired summary { transition: background .2s; }
.expired summary:hover { background: #fdf6f6; }
.expired-arrow svg { transition: transform .3s var(--ease); }
.expired[open] .expired-arrow { transform: none; }
.expired[open] .expired-arrow svg { transform: rotate(180deg); }
.expired[open] > .table-wrap { animation: rise .4s var(--ease) both; }

/* Entrance motion: only on page load and view changes, never while typing in search */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
main.enter .title-row { animation: rise .5s var(--ease) both; }
main.enter .stat, main.enter > .panel, main.enter > section.panel { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 60ms); }
#results.enter .card { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 65ms + 120ms); }
#results.enter tbody tr { animation: fade .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms + 120ms); }
#results.enter .expired { animation: rise .6s var(--ease) both; animation-delay: .35s; }

/* Dialogs and toast */
dialog { border: 0; border-radius: 20px; box-shadow: 0 24px 64px rgba(10, 30, 60, .28); }
dialog[open] { animation: pop .32s var(--ease) both; }
dialog::backdrop { background: rgba(14, 33, 62, .45); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fade .25s ease both; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
#toast { border-radius: 12px; box-shadow: var(--shadow-lg); animation: toast .35s var(--ease) both; background: linear-gradient(135deg, #1b3466, #22396c); }
@keyframes toast { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Sign-in */
.auth { border-radius: 20px; box-shadow: var(--shadow-lg); animation: rise .55s var(--ease) both; }
.auth .mark { width: 54px; height: 54px; border-radius: 14px; }

/* Developer footer */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 18px 16px 26px; color: #5a7290; font-size: .88rem; }
.site-footer strong { color: #1f3a63; font-weight: 600; }
.site-footer .version { direction: ltr; padding: 1px 8px; border-radius: 999px; background: #e1eefa; color: #1c4c88; font-weight: 600; font-size: .82rem; }
.site-footer a { color: #1c4c88; text-decoration: none; font-weight: 600; direction: ltr; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .sep { width: 4px; height: 4px; border-radius: 50%; background: #9db5cc; }

@media (max-width: 680px) {
  nav { padding: 3px; }
  nav button { padding: 6px 8px; }
  .site-footer { font-size: .8rem; padding-bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
.brand-logo { width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
@media (max-width: 680px) { .brand-logo { width: 30px; height: 30px; } }
