/* SecureVault — mobile first. No inline styles are used anywhere (strict CSP).

   Design concept: a security ledger / vault plate, not a generic SaaS card kit.
   Surfaces sit flush on rules like entries in a log, instead of floating on
   soft shadows. Radius is a signal, not a default: sharp on structure
   (cards, inputs, tables), a little fuller only on the one thing you press.
   Monospace is reserved for real security data (codes, tokens, hashes) —
   never used as a decorative label font. Status colors (red/green/blue) are
   reserved strictly for verdicts; the amber accent is the only color used for
   anything live or actionable. */
/* Always dark — this isn't following the OS light/dark setting on purpose. */
:root {
  --ink: #e7eaf0; --paper: #141922; --panel: #1b212c; --muted: #8b95a5;
  --line: #2b333f; --brass: #d3a44c; --brass-ink: #1a1304;
  --danger: #e08a8a; --ok: #6cbf8e; --info: #8fb0e6;
  --radius-sm: 4px; --radius-md: 8px; --nav-h: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 .3rem; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
p { margin: .5rem 0; }
a { color: var(--brass); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); font-size: .92rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .02em; word-break: break-all; }
.big { font-size: 1.3rem; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.noscript { padding: 1rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* ---- sign-in screens ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.auth-card {
  width: 100%; max-width: 408px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1.75rem 1.5rem;
  border-top: 3px solid var(--brass);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: 1.1rem; font-size: 1.05rem; }
.brand .mark { display: flex; gap: 2px; }
.brand .mark span { width: 4px; height: 14px; background: var(--brass); border-radius: 1px; }
.brand .mark span:nth-child(2) { height: 20px; }
.brand .mark span:nth-child(3) { height: 10px; }
.links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; font-size: .95rem; }

/* ---- app shell ---- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .75rem 1rem; padding-top: calc(.75rem + env(safe-area-inset-top, 0px));
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar .brand { margin-bottom: 0; }
.topbar .who { margin-left: auto; color: var(--muted); font-size: .9rem; }
.container { max-width: 760px; margin: 0 auto; padding: 1rem; padding-bottom: calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom, 0px)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--panel); border-top: 1px solid var(--line);
}
.bottom-nav a { flex: 1; display: grid; place-items: center; color: var(--muted); font-weight: 600; }
.bottom-nav a.active { color: var(--ink); box-shadow: inset 0 2px 0 var(--brass); }
.bottom-nav a:hover { text-decoration: none; }

/* ---- building blocks ---- */
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tab { flex: 1; text-align: center; padding: .65rem .5rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--brass); }
.tab:hover { text-decoration: none; color: var(--ink); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; margin: .75rem 0; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; margin-top: .5rem; }
.list { display: grid; gap: .5rem; margin-top: .75rem; }
.list-item {
  display: flex; justify-content: space-between; gap: .75rem; align-items: center; width: 100%; text-align: left;
  min-height: 48px; padding: .75rem 1rem; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; cursor: pointer;
  border-left: 3px solid transparent;
}
.list-item:hover { border-left-color: var(--brass); }
.pre { white-space: pre-wrap; word-break: break-word; margin: .5rem 0; font: inherit; }
.pill {
  display: inline-flex; align-items: center; padding: .05rem .5rem; border-radius: var(--radius-sm);
  border-left: 2px solid var(--muted); font-size: .8rem; color: var(--muted);
}
.pill.ok { color: var(--ok); border-left-color: var(--ok); }
.pill.danger { color: var(--danger); border-left-color: var(--danger); }
.slot { margin-top: .5rem; }

/* ---- forms ---- */
.field { margin: .75rem 0; }
.field label { display: block; margin-bottom: .25rem; font-weight: 600; font-size: .92rem; }
.input {
  width: 100%; min-height: 46px; padding: .6rem .75rem; font: inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.input:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
textarea.input { resize: vertical; min-height: 120px; }
.btn {
  min-height: 44px; padding: .55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.btn:hover { border-color: var(--brass); }
.btn.primary { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 38px; padding: .3rem .8rem; font-size: .9rem; border-radius: var(--radius-sm); }
.btn.block { width: 100%; margin-top: .5rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.msg { margin: .5rem 0; padding: .6rem .75rem; border-radius: var(--radius-sm); font-size: .92rem; border: 1px solid var(--line); border-left: 3px solid var(--line); }
.msg.error { color: var(--danger); border-left-color: var(--danger); }
.msg.ok { color: var(--ok); border-left-color: var(--ok); }
.msg.info { color: var(--info); border-left-color: var(--info); }

/* ---- account activity list ---- */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.activity-list li:last-child { border-bottom: none; }
.activity-list li span:last-child { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; color: var(--muted); }

/* ---- MFA recovery codes ---- */
.recovery-codes-box { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.recovery-codes { list-style: none; padding: 0; margin: .5rem 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.recovery-codes li {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .4rem .6rem;
  text-align: center; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem;
}
.recovery-status { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }

/* ---- password strength hint (UI nudge only; server enforces the real rule) ---- */
.strength { display: flex; align-items: center; gap: .5rem; margin: -.25rem 0 .5rem; }
.strength-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.strength-bar i { display: block; height: 100%; width: 0; }
.strength-bar i.s0 { width: 0; background: var(--danger); }
.strength-bar i.s1 { width: 25%; background: var(--danger); }
.strength-bar i.s2 { width: 50%; background: var(--info); }
.strength-bar i.s3 { width: 75%; background: var(--ok); }
.strength-bar i.s4 { width: 100%; background: var(--ok); }
.strength-label { font-size: .82rem; color: var(--muted); min-width: 4.5em; text-align: right; }

/* ---- images ---- */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-top: .75rem; }
.image-item { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem; }
.image-item img, .thumb { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--paper); }
.thumb { display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.image-item figcaption { margin: .4rem 0; font-size: .85rem; word-break: break-word; }

/* ---- account / admin ---- */
.qr { display: inline-block; background: #ffffff; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.qr img { display: block; width: 200px; height: 200px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 1px; margin: .75rem 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.stat { background: var(--panel); padding: .75rem; text-align: center; }
.stat strong { display: block; font-size: 1.4rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); margin: .5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: .5rem .65rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.filters { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; align-items: end; }
.filters .field { margin: 0; }
section.block { margin-top: 1.5rem; }

/* ---- encryption chat ---- */
.chat-log {
  display: flex; flex-direction: column; gap: .5rem; margin: .75rem 0; padding: .75rem;
  max-height: 55vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.chat-bubble {
  max-width: 85%; padding: .55rem .75rem; border-radius: var(--radius-sm); font-size: .92rem;
  border: 1px solid var(--line); line-height: 1.45;
}
.chat-bubble.bot, .chat-bubble.them { align-self: flex-start; background: var(--paper); border-left: 3px solid var(--brass); }
.chat-bubble.me { align-self: flex-end; background: var(--paper); border-right: 3px solid var(--info); text-align: right; position: relative; padding-right: 1.9rem; }
.chat-delete {
  position: absolute; top: .2rem; right: .35rem; border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 1rem; line-height: 1; padding: .1rem .3rem;
}
.chat-delete:hover { color: var(--danger); }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; align-self: flex-start; max-width: 100%; }
.chat-suggestions .pill { cursor: pointer; background: transparent; font: inherit; }
.chat-suggestions .pill:hover { color: var(--ink); border-left-color: var(--brass); }
.chat-form { display: flex; gap: .5rem; align-items: flex-end; }
.chat-form .field { flex: 1; margin: 0; }

/* ---- toasts (the one thing that is genuinely floating, so the one place with a shadow) ---- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: grid; gap: .5rem; justify-items: center; padding: 0 1rem; pointer-events: none; }
.toast { max-width: 460px; padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); font-size: .92rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

@media (min-width: 720px) {
  .container { padding-top: 1.5rem; }
}
