/* Expiring Date - application styles (no framework, no external fonts) */
:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #f8fafc; --text: #0f172a; --muted: #64748b; --border: #e2e8f0;
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-soft: #dbeafe;
  --danger: #dc2626; --danger-soft: #fee2e2; --warn: #d97706; --warn-soft: #fef3c7; --ok: #16a34a; --ok-soft: #dcfce7; --info-soft: #e0f2fe;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 8px rgba(15, 23, 42, .04);
  --c-red: #dc2626; --c-orange: #ea580c; --c-amber: #d97706; --c-green: #16a34a; --c-teal: #0d9488; --c-cyan: #0891b2;
  --c-blue: #2563eb; --c-indigo: #4f46e5; --c-violet: #7c3aed; --c-pink: #db2777; --c-brown: #92400e; --c-slate: #475569;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #111a2e; --surface-2: #16213a; --text: #e5e9f2; --muted: #94a3b8; --border: #25324d;
    --primary: #3b82f6; --primary-hover: #60a5fa; --primary-soft: #1e3a8a;
    --danger: #f87171; --danger-soft: #451a1a; --warn: #fbbf24; --warn-soft: #422006; --ok: #4ade80; --ok-soft: #14532d; --info-soft: #0c4a6e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
h2 .icon, h1 .icon { vertical-align: -3px; margin-right: 4px; }
p { margin: 0 0 1em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
[hidden] { display: none !important; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1; padding: 28px 20px 48px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: 8px; }
.skip:focus { left: 8px; z-index: 100; }
.icon { width: 18px; height: 18px; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.muted { color: var(--muted); } .small { font-size: .86em; } .center { text-align: center; } .right { text-align: right; } .left { text-align: left; }
.danger-text { color: var(--danger); } .ok-text { color: var(--ok); }
.inline { display: inline; } .upper { text-transform: uppercase; }
ul.plain { list-style: none; padding: 0; margin: 0 0 1em; } ul.plain li { padding: 4px 0; }
.stack > * + * { margin-top: 10px; }

/* Header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-icon { width: 24px; height: 24px; color: var(--primary); }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-link { padding: 8px 12px; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav-link:hover, .nav-link.active { background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--primary); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; color: var(--text); cursor: pointer; }
.subnav { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.subnav-inner { display: flex; gap: 2px; overflow-x: auto; }
.subnav-link { padding: 10px 12px; color: var(--muted); font-size: .92rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.subnav-link:hover { text-decoration: none; color: var(--text); }
.subnav-link.active { color: var(--primary); border-bottom-color: var(--primary); }
@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  .nav.open { display: flex; }
  .nav .btn { justify-content: center; }
}
.footer { border-top: 1px solid var(--border); background: var(--surface); font-size: .86rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 20px; }

/* Layout */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1, .page-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 860px) { .grid-side { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card > :last-child { margin-bottom: 0; }
.card-danger { border-color: var(--danger); }
.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.auth-card { max-width: 440px; margin: 24px auto; }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid transparent; background: var(--info-soft); }
.alert .icon { flex: none; margin-top: 2px; }
.alert span { flex: 1; }
.alert-success { background: var(--ok-soft); } .alert-error { background: var(--danger-soft); } .alert-warning { background: var(--warn-soft); }
.alert-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .6; }
.alert-close:hover { opacity: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.3; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); background: var(--danger); }
.btn-warn { border-color: var(--warn); color: var(--warn); }
.btn-ghost { border-color: transparent; background: transparent; padding: 6px; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .88rem; }
.btn-lg { padding: 12px 22px; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-link { background: none; border: 0; cursor: pointer; font: inherit; }

/* Forms */
.form label { display: block; margin-bottom: 14px; font-weight: 500; }
.form label small { display: block; font-weight: 400; margin-top: 4px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .filters input, .filters select {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.form input:focus, .form select:focus, .form textarea:focus, .filters input:focus, .filters select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.form input:disabled { background: var(--surface-2); color: var(--muted); }
.form textarea { resize: vertical; min-height: 80px; }
.form .check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
.form .check input { margin-top: 4px; }
.form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 4px; margin: 0 0 14px; }
.form legend { font-weight: 600; padding: 0 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.form-inline { display: flex; gap: 8px; align-items: flex-end; }
.form-inline input { margin-top: 0 !important; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; margin-top: 0; min-width: 160px; flex: 1; }
.code-input { font-family: ui-monospace, monospace; letter-spacing: .2em; font-size: 1.2rem; text-align: center; }
.strength { height: 5px; border-radius: 3px; background: var(--border); margin-top: 6px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.strength[data-level="2"] span { background: var(--warn); } .strength[data-level="3"] span { background: var(--ok); } .strength[data-level="4"] span { background: var(--ok); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.swatch { position: relative; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; margin: 0 !important; display: inline-block; }
.swatch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c, var(--border)); border: 2px solid transparent; }
.swatch input:checked + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.swatch-icon span { background: var(--surface-2); border-color: var(--border); display: flex; align-items: center; justify-content: center; color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
button.chip { cursor: pointer; font: inherit; }

/* Tables */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table.small td, .table.small th { padding: 7px 10px; font-size: .88rem; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.col-date { white-space: nowrap; }
.item-title { font-weight: 550; color: var(--text); margin-right: 6px; }
.item-row.status-done .item-title { text-decoration: line-through; color: var(--muted); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 1em; }
.dl dt { color: var(--muted); font-size: .9em; } .dl dd { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 18px 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Badges & status */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-fail { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.due { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.due-overdue { background: var(--danger-soft); color: var(--danger); }
.due-soon { background: var(--warn-soft); color: var(--warn); }
.due-upcoming { background: var(--primary-soft); color: var(--primary); }
.due-ok { background: var(--surface-2); color: var(--muted); }
.due-done { background: var(--ok-soft); color: var(--ok); }
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #fff; background: var(--c, var(--primary)); border: 0; }
a.chip:hover { text-decoration: none; filter: brightness(1.1); }
.dot { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; background: var(--c, var(--primary)); color: #fff; margin-right: 8px; vertical-align: middle; }
.cat-name { color: var(--text); font-weight: 550; display: inline-flex; align-items: center; }

/* Colour classes */
.c-red { --c: var(--c-red); } .c-orange { --c: var(--c-orange); } .c-amber { --c: var(--c-amber); } .c-green { --c: var(--c-green); }
.c-teal { --c: var(--c-teal); } .c-cyan { --c: var(--c-cyan); } .c-blue { --c: var(--c-blue); } .c-indigo { --c: var(--c-indigo); }
.c-violet { --c: var(--c-violet); } .c-pink { --c: var(--c-pink); } .c-brown { --c: var(--c-brown); } .c-slate { --c: var(--c-slate); }

/* Stats & tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); border-left: 4px solid var(--border); }
.stat:hover { text-decoration: none; background: var(--surface-2); }
.stat strong { font-size: 1.7rem; line-height: 1.1; } .stat span { color: var(--muted); font-size: .86rem; }
.stat-overdue { border-left-color: var(--danger); } .stat-soon { border-left-color: var(--warn); } .stat-upcoming { border-left-color: var(--primary); } .stat-done { border-left-color: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c, var(--primary)); color: var(--text); box-shadow: var(--shadow); }
.tile .icon { color: var(--c, var(--primary)); width: 22px; height: 22px; }
.tile span { color: var(--muted); font-size: .84rem; }
a.tile:hover { text-decoration: none; background: var(--surface-2); }

/* Home */
.hero { text-align: center; padding: 40px 0 28px; }
.hero h1 { font-size: 2.3rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; margin: 0 auto 22px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.features { margin-bottom: 28px; }
.features h3 { display: flex; align-items: center; gap: 8px; }

/* Misc */
.secret code { font-size: 1.1rem; letter-spacing: .08em; word-break: break-all; }
.codes { columns: 2; list-style: none; padding: 0; } .codes li { padding: 4px 0; } .codes code { font-size: 1.05rem; }
.legal h2 { margin-top: 1.6em; } .legal p, .legal li { line-height: 1.65; }
