:root {
  --bg: #f5f4f0;
  --panel: #ffffff;
  --ink: #1d1c1a;
  --muted: #6d6a62;
  --faint: #9a968c;
  --line: #e5e2da;
  --line-soft: #efede7;
  --accent: #1f4e5f;
  --accent-dark: #173c49;
  --accent-soft: #e5eef1;
  --usable: #1d6a44;
  --usable-soft: #e2f1e8;
  --remove: #a23a2a;
  --remove-soft: #f8e7e3;
  --warn: #7d5200;
  --warn-soft: #fbf2de;
  --radius: 10px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- the frame ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: 0.02em; font-size: 14px; }
.brand-name { font-weight: 650; font-size: 15px; line-height: 1.2; }
.brand-name span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-weight: 500; }
.nav a:hover { background: var(--line-soft); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.side-foot { margin-top: auto; padding: 8px; display: flex; flex-direction: column; gap: 12px; }
.mode { border: 1px solid var(--line); border-radius: 9px; padding: 10px; font-size: 13px; }
.mode b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.main { padding: 34px 40px 80px; max-width: 1280px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.head .sub { color: var(--muted); margin-top: 4px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: block; }

/* ---------- pieces ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.card-body { padding: 18px 22px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > .grow { flex: 1 1 220px; }
.stack > * + * { margin-top: 14px; }
.stats { display: flex; gap: 34px; flex-wrap: wrap; }
.stat b { display: block; font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.stat span { color: var(--muted); font-size: 13px; }

button, .btn { font: inherit; font-weight: 550; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; cursor: pointer; }
button:hover, .btn:hover { border-color: #cfcbc0; text-decoration: none; }
button:disabled { opacity: 0.5; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.danger { color: var(--remove); border-color: #e3c4bd; }
button.danger:hover { background: var(--remove-soft); }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 500; }
button.link:hover { text-decoration: underline; }
button.small { padding: 4px 10px; font-size: 13px; }

label.field { display: block; }
label.field > span, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #d5d1c7; border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
select.inline, input.inline { width: auto; }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 18px; max-height: 220px; overflow: auto; }
.indent { margin: 6px 0 8px 26px; }

.seg { display: inline-flex; border: 1px solid #d5d1c7; border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid #d5d1c7; padding: 8px 14px; font-weight: 500; background: #fff; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button.on.usable { background: var(--usable); }
.seg button.on.remove { background: var(--remove); }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.pill.usable { background: var(--usable-soft); color: var(--usable); }
.pill.remove { background: var(--remove-soft); color: var(--remove); }
.pill.accent { background: var(--accent-soft); color: var(--accent-dark); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfaf8; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th.right, td.right { text-align: right; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #faf9f6; }
tr.ask td { background: var(--warn-soft); }
.scroll-x { overflow-x: auto; }
.tight td, .tight th { padding: 7px 10px; font-size: 13.5px; }

.notice { border-radius: 9px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--panel); }
.notice.error { background: var(--remove-soft); border-color: #ebcbc4; color: #6e2318; }
.notice.warn { background: var(--warn-soft); border-color: #eedcae; color: #5e3f00; }
.notice.ok { background: var(--usable-soft); border-color: #c3dfce; color: #134a2f; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.empty { text-align: center; color: var(--muted); padding: 46px 20px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

td code, .card code { font-family: var(--mono); font-size: 13px; }
pre.paper { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: #fbfaf8; border: 1px solid var(--line); border-radius: 9px; padding: 16px 18px; overflow: auto; margin: 0; white-space: pre; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 500; }
details[open] > summary { margin-bottom: 10px; }

.drop { border: 2px dashed #cfcbc0; border-radius: 14px; background: var(--panel); padding: 54px 20px; text-align: center; transition: border-color .12s, background .12s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { display: block; font-size: 18px; margin-bottom: 6px; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 14px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.meter { display: inline-block; width: 46px; height: 6px; border-radius: 99px; background: var(--line); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.meter.low > i { background: #c98a00; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-height: 150px; display: flex; flex-direction: column; gap: 8px; }
.tile b { font-size: 16px; }
.tile .pill { align-self: flex-start; margin-top: auto; }
.tile.blank { border-style: dashed; background: transparent; color: var(--muted); justify-content: center; align-items: center; text-align: center; }

.test-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(140px, 1fr) minmax(160px, 2fr) auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.test-row .when { display: flex; gap: 8px; }
.test-row .when select { flex: 1 1 55%; }
.test-row .when input { flex: 1 1 45%; min-width: 0; }
.why { color: var(--muted); font-size: 13px; min-width: 250px; }
.example { min-width: 200px; max-width: 300px; overflow-wrap: anywhere; }
.words { background: #fbfaf8; border: 1px solid var(--line); border-radius: 9px; padding: 12px 16px; }
.words p { margin: 0 0 4px; }
.words p:last-child { margin: 0; }
.levels-caption { font-size: 13px; color: var(--muted); margin-top: 6px; min-height: 20px; }

/* ---------- signing in ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .card { width: 100%; max-width: 400px; padding: 30px; }
.gate .brand { padding: 0 0 18px; }
.gate button.primary { width: 100%; padding: 10px; margin-top: 6px; }

/* ---------- asking to be sure ---------- */
.veil { position: fixed; inset: 0; background: rgba(29, 28, 26, 0.45); display: grid; place-items: center; padding: 20px; z-index: 10; }
.veil .card { max-width: 480px; width: 100%; margin: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.actions.left { justify-content: flex-start; }
.actions.center { justify-content: center; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; }
  .brand { padding: 0 8px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; }
  .mode { display: none; }
  .main { padding: 22px 16px 60px; }
  .test-row { grid-template-columns: 1fr 1fr; }
}

/* Two-factor sign-in */
.gate .card.wide { max-width: 560px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; }
.steps li { line-height: 1.5; }
.scan { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.square { border: 1px solid var(--line); border-radius: 6px; }
.key { display: block; margin-top: 6px; font-size: 15px; letter-spacing: 0.04em; overflow-wrap: anywhere; }
input.code { width: 11em; font-size: 17px; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.steps .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.recovery code { font-size: 16px; letter-spacing: 0.06em; }
.warn-text { color: var(--remove); }
.gate .steps button.primary, .gate .actions button.primary { width: auto; margin-top: 0; padding: 8px 14px; }

/* The time meter */
.timer { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 16px 18px; display: grid; gap: 9px; margin-bottom: 16px; }
.timer-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timer-left { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.stop-row { margin: -6px 0 16px; align-items: center; }
.timer-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.timer-bar > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .8s linear; }
.timer-bar.unknown > i { width: 28%; animation: to-and-fro 1.3s ease-in-out infinite alternate; }
@keyframes to-and-fro { from { margin-left: 0; } to { margin-left: 72%; } }
.activity { display: grid; gap: 10px; padding: 14px 10px 4px; font-size: 13px; }
.activity:empty { display: none; }
.activity > b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.activity a { display: grid; gap: 4px; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.activity a:hover { background: var(--line-soft); text-decoration: none; }
.activity .timer-bar { height: 4px; }
@media (max-width: 860px) { .activity { width: 100%; padding: 4px 0; } }

/* Files still held */
.btn.small { padding: 4px 10px; font-size: 13px; }
.held-actions { display: flex; gap: 8px; justify-content: flex-end; white-space: nowrap; }
.drop + .card { margin-top: 16px; }

a.tile { color: inherit; text-decoration: none; }
a.tile:hover { border-color: var(--accent); text-decoration: none; }
