/* ============================================================================
 * mySafeKeys - web vault
 * Petrol and brass on fog; translucent panels over soft colour fields.
 * Type: Atkinson Hyperlegible Next (interface) and Mono (secrets) - letterforms
 * that keep l/I/1 and O/0 apart, which is what reading a password needs.
 * No external resources: fonts are served from /vendor/fonts.
 * ========================================================================== */
@import url("../vendor/fonts/fonts.css");

:root {
  color-scheme: light;
  --bg: #e8edee;
  --field-a: rgba(13, 100, 112, .20);
  --field-b: rgba(168, 117, 26, .16);
  --ink: #11222a;
  --ink-2: #45585f;
  --ink-3: #5b6d75;
  --glass: rgba(255, 255, 255, .66);
  --glass-strong: rgba(255, 255, 255, .86);
  --well: rgba(17, 34, 42, .055);
  --input: rgba(255, 255, 255, .82);
  --line: rgba(17, 34, 42, .12);
  --line-strong: rgba(17, 34, 42, .24);
  --edge: rgba(17, 34, 42, .5);   /* boundary of inputs and buttons: 3:1 against the surface */
  --brand: #0d6470;
  --brand-strong: #094e58;
  --brand-ink: #0a5560;
  --brand-soft: rgba(13, 100, 112, .12);
  --on-brand: #ffffff;
  --brass: #8a5c0c;
  --brass-soft: rgba(168, 117, 26, .13);
  --danger: #b3322e;
  --danger-soft: rgba(179, 50, 46, .10);
  --ok: #1a7446;
  --ok-soft: rgba(30, 122, 76, .12);
  --scrim: rgba(17, 34, 42, .34);
  --shadow: 0 1px 1px rgba(17, 34, 42, .04), 0 12px 32px -12px rgba(17, 34, 42, .22);
  --shadow-lift: 0 2px 4px rgba(17, 34, 42, .06), 0 30px 70px -20px rgba(17, 34, 42, .42);
  --r-s: 9px;
  --r-m: 14px;
  --r-l: 22px;
  --sidebar-w: 272px;
  --topbar-h: 68px;
  --font: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, Consolas, monospace;
  --blur: blur(22px) saturate(1.5);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1b22;
    --field-a: rgba(40, 150, 165, .22);
    --field-b: rgba(200, 150, 50, .10);
    --ink: #e7eff1;
    --ink-2: #a9bac0;
    --ink-3: #8b9ea5;
    --glass: rgba(255, 255, 255, .055);
    --glass-strong: rgba(24, 41, 50, .84);
    --well: rgba(255, 255, 255, .06);
    --input: rgba(0, 0, 0, .24);
    --line: rgba(255, 255, 255, .11);
    --line-strong: rgba(255, 255, 255, .24);
    --edge: rgba(255, 255, 255, .42);
    --brand: #17808d;
    --brand-strong: #1c93a1;
    --brand-ink: #7fd3dd;
    --brand-soft: rgba(63, 169, 182, .17);
    --brass: #e2b458;
    --brass-soft: rgba(226, 180, 88, .13);
    --danger: #f0817a;
    --danger-soft: rgba(240, 129, 122, .13);
    --ok: #6fd3a0;
    --ok-soft: rgba(111, 211, 160, .13);
    --scrim: rgba(3, 9, 12, .58);
    --shadow: 0 1px 1px rgba(0, 0, 0, .2), 0 12px 32px -12px rgba(0, 0, 0, .5);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .3), 0 30px 70px -20px rgba(0, 0, 0, .75);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; background: var(--bg); scroll-padding-top: calc(var(--topbar-h) + 12px); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0; min-height: 100%;
  font: .9375rem/1.5 var(--font);
  color: var(--ink);
  background:
    radial-gradient(60vw 50vh at 8% -5%, var(--field-a), transparent 70%),
    radial-gradient(55vw 55vh at 100% 100%, var(--field-b), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.012em; line-height: 1.2; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
code, pre { font-family: var(--mono); }
.ico { flex: 0 0 auto; display: block; }

/* ------------------------------- Layout ---------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.main { min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px 14px;
  background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.topbar__brand { display: flex; align-items: center; gap: 11px; }
.sidebar .topbar__brand { padding: 2px 8px 14px; }
.brand__mark { display: grid; place-items: center; }
.brand__name { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.brand__plan { margin: auto 8px 0; padding-top: 14px; font-size: 12.5px; color: var(--ink-3); }
.logo__plate { fill: var(--brand); }
.logo__key { fill: none; stroke: #f4d48a; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.logo__pin { fill: #f4d48a; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
}
.topbar > .topbar__brand { display: none; }
.topbar__search { position: relative; flex: 1; max-width: 620px; }
.search__icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
#search {
  width: 100%; height: 42px; padding: 0 16px 0 40px;
  background: var(--input); border: 1px solid var(--edge); border-radius: 999px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#search::placeholder { color: var(--ink-3); }
#search:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.topbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: var(--brass-soft); border: 1px solid var(--line); color: var(--brass);
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
@media (hover: hover) { .avatar:hover { border-color: var(--brass); } }
.iconbtn.navtoggle { display: none; }

.content { padding: 30px 28px 60px; width: 100%; max-width: 1280px; }
.content__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.content__title { font-size: 30px; letter-spacing: -.02em; line-height: 1.1; overflow-wrap: anywhere; }
.content__header p.muted { margin-top: 6px; font-size: 14.5px; max-width: 70ch; }
.panel p, .content p.muted { max-width: 75ch; }
.content__tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ------------------------------ Navigation ------------------------------- */
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; min-height: 36px; padding: 6px 10px;
  background: transparent; border: 0; border-radius: var(--r-s);
  color: var(--ink-2); text-align: left; cursor: pointer;
}
@media (hover: hover) { .nav__item:hover { background: var(--well); color: var(--ink); } }
.nav__item.is-active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav__ico { display: grid; place-items: center; width: 20px; flex: 0 0 20px; }
.nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__count { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav__item.is-active .nav__count { color: inherit; }
.nav__group { margin-top: 14px; }
.nav__headrow { display: flex; align-items: center; gap: 4px; padding-right: 4px; }
.nav__heading {
  flex: 1; display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 8px;
  background: none; border: 0; border-radius: var(--r-s); cursor: pointer; text-align: left;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
}
@media (hover: hover) { .nav__heading:hover { color: var(--ink); background: var(--well); } }
.nav__heading .ico { transition: transform .16s; }
.nav__heading[aria-expanded="true"] .ico { transform: rotate(90deg); }
.nav__heading .nav__count { font-weight: 400; }
.nav__heading-btn {
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
  background: none; border: 0; border-radius: 8px; color: var(--ink-3); cursor: pointer;
}
@media (hover: hover) { .nav__heading-btn:hover { background: var(--well); color: var(--ink); } }
.nav__list { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; }
.badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 20px; }

.menuwrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 50px; min-width: 250px; padding: 8px; z-index: 30;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow-lift);
  transform-origin: top right; overscroll-behavior: contain;
}
.menu__who { padding: 8px 10px 10px; color: var(--ink-2); font-size: 13.5px; word-break: break-all; border-bottom: 1px solid var(--line); margin-bottom: 6px; }

/* -------------------------------- Items ---------------------------------- */
.items--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; }
.items--list { display: flex; flex-direction: column; background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.items--list:empty { display: none; }
.item {
  display: flex; align-items: center; gap: 13px; width: 100%; padding: 13px 14px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-m);
  text-align: left; cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s;
}
@media (hover: hover) { .item:hover { border-color: var(--line-strong); background: var(--glass-strong); box-shadow: var(--shadow); } }
.items--list .item { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 9px 14px; }
.items--list .item:last-child { border-bottom: 0; }
@media (hover: hover) { .items--list .item:hover { background: var(--well); box-shadow: none; } }
.item__text { display: flex; flex-direction: column; min-width: 0; }
.item__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__sub { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__marks { margin-left: auto; display: flex; align-items: center; gap: 7px; flex: 0 0 auto; color: var(--ink-3); }
.item__fav { color: var(--brass); }
.item__fav .ico { fill: currentColor; }

/* Key tag: the monogram every item hangs on, with the punched hole of a real tag. */
.keytag {
  --tag: #0d6470;
  position: relative; flex: 0 0 auto; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 6px 12px 12px 12px;
  background: var(--tag); color: #fff; font-weight: 700; font-size: 16px;
}
.keytag::before { content: ""; position: absolute; top: 5px; left: 5px; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .78); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .35); }
.keytag--h0 { --tag: #0d6470; } .keytag--h1 { --tag: #8a5a12; } .keytag--h2 { --tag: #3d5a9b; } .keytag--h3 { --tag: #7a4a78; }
.keytag--h4 { --tag: #2f7450; } .keytag--h5 { --tag: #a2493f; } .keytag--h6 { --tag: #4b6470; } .keytag--h7 { --tag: #62681f; }
.keytag--plain { --tag: var(--well); color: var(--ink-2); border: 1px solid var(--line); }
.keytag--plain::before { background: var(--line-strong); box-shadow: none; }
.keytag--s { width: 30px; height: 30px; font-size: 13px; border-radius: 5px 9px 9px 9px; }
.keytag--s::before { top: 4px; left: 4px; width: 4px; height: 4px; }

.empty { color: var(--ink-2); text-align: center; padding: 64px 16px; max-width: 46ch; margin: 0 auto; }

/* ------------------------------- Controls -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 11px;
  background: var(--input); border: 1px solid var(--edge);
  color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .12s ease-out, border-color .12s ease-out, scale .15s ease-out;
}
.btn .ico, .minibtn .ico, .chip .ico, .nav__item.is-active .ico { stroke-width: 2; }
.btn:not(:disabled):active, .minibtn:not(:disabled):active, .iconbtn:not(:disabled):active, .toolcard:active { scale: .96; }
@media (hover: hover) { .btn:hover { border-color: var(--ink-3); } }
.btn--primary { background: var(--brand); border-color: transparent; color: var(--on-brand); }
@media (hover: hover) { .btn--primary:hover { background: var(--brand-strong); border-color: transparent; } }
.btn--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
@media (hover: hover) { .btn--danger:hover { border-color: var(--danger); } }
.btn--block { width: 100%; }
.iconbtn { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; background: transparent; border: 0; border-radius: 10px; color: var(--ink-2); cursor: pointer; transition: background-color .12s ease-out, scale .15s ease-out; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .iconbtn:hover { background: var(--well); color: var(--ink); } }
.minibtn { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid var(--edge); border-radius: 8px; padding: 4px 10px; color: var(--ink-2); font-size: 13px; transition: scale .15s ease-out; font-weight: 600; cursor: pointer; white-space: nowrap; }
@media (hover: hover) { .minibtn:hover { color: var(--ink); border-color: var(--ink-3); } }
.minibtn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.minibtn--ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.link { background: none; border: 0; padding: 0; color: var(--brand-ink); font-weight: 600; cursor: pointer; text-align: left; }
@media (hover: hover) { .link:hover { text-decoration: underline; text-underline-offset: 3px; } }
button:disabled { opacity: .55; cursor: progress; }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }

input:not([type=checkbox]):not([type=range]):not([type=file]):not(#search), select, textarea {
  min-height: 40px; padding: 8px 12px; max-width: 100%;
  background: var(--input); border: 1px solid var(--edge); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
input[type=password], input[autocomplete=one-time-code] { font-family: var(--mono); }
input[type=checkbox], input[type=range] { accent-color: var(--brand); }
input[type=checkbox] { width: 17px; height: 17px; flex: 0 0 auto; }
textarea { resize: vertical; font-family: var(--mono); font-size: 14px; }
::placeholder { color: var(--ink-3); }
.file { color: var(--ink-2); max-width: 100%; }
.file::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--edge); background: var(--input); color: var(--ink); cursor: pointer; }

.sort { color: var(--ink-2); display: flex; align-items: center; gap: 8px; font-size: 14px; }
.viewtoggle { display: inline-flex; padding: 3px; gap: 2px; background: var(--well); border-radius: 11px; }
.viewtoggle__btn { display: grid; place-items: center; width: 36px; height: 34px; background: none; border: 0; border-radius: 8px; color: var(--ink-3); cursor: pointer; }
.viewtoggle__btn.is-active { background: var(--glass-strong); color: var(--ink); box-shadow: var(--shadow); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; }
.field--check { display: flex; flex-direction: row; align-items: center; gap: 10px; }
.field--check input { width: 17px; }
.field--check > span { font-weight: 400; color: var(--ink); font-size: 15px; }
.hint { color: var(--ink-3); font-size: 13px; }
.muted { color: var(--ink-2); }
.muted.pad { padding: 14px 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack--tight { gap: 6px; align-items: flex-start; }
.center { text-align: center; align-items: center; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline.wrap { flex-wrap: wrap; }
.inline > input, .inline > select { flex: 1; min-width: 0; }
.toolbar { margin-top: 14px; }
.customrow input[type=text], .customrow input[type=password] { flex: 1; min-width: 0; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--well); color: var(--ink-2); }
.chip--warn { background: var(--brass-soft); color: var(--brass); }
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }

/* Callouts: something the reader should not skip. */
.premium-lead { padding: 12px 14px; border-radius: var(--r-s); background: var(--brass-soft); border-left: 3px solid var(--brass); font-size: 14px; color: var(--ink); }
.locked { text-align: center; padding: 36px 20px; background: var(--well); border: 1px dashed var(--line-strong); border-radius: var(--r-m); }
.locked__lock { display: grid; place-items: center; color: var(--ink-3); }
.locked__t { font-weight: 700; margin: 10px 0 4px; }
.locked .btn { margin-top: 12px; }

/* ----------------------------- Item drawer ------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer__scrim, .modal__scrim { position: absolute; inset: 0; background: var(--scrim); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fade .16s ease-out; }
.drawer__panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; z-index: 1; width: min(480px, calc(100vw - 24px));
  display: flex; flex-direction: column;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-lift);
}
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 14px 22px; }
.drawer__title { display: flex; align-items: center; gap: 13px; min-width: 0; }
.drawer__title h2 { font-size: 21px; overflow-wrap: anywhere; }
.drawer__body { padding: 4px 22px 18px; overflow: auto; overscroll-behavior: contain; flex: 1; scrollbar-width: thin; }
.drawer__foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }

.row { margin-bottom: 14px; }
.row__label { font-size: 13px; font-weight: 600; color: var(--ink-3); margin-bottom: 5px; }
.row__value { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 44px; padding: 8px 8px 8px 13px; background: var(--well); border-radius: 11px; }
.row__value + .row__value, .row__value.file { margin-top: 6px; }
.row__value code { font-size: 14.5px; word-break: break-all; }
.row__value .grow { flex: 1; min-width: 0; }
.row__value .multi { white-space: pre-wrap; word-break: break-word; }
.row__value a { color: var(--brand-ink); text-decoration: none; overflow-wrap: anywhere; }
@media (hover: hover) { .row__value a:hover { text-decoration: underline; text-underline-offset: 3px; } }
.otpcode { font-size: 22px; font-weight: 600; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
details.row > summary { cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 13.5px; }

/* -------------------------------- Dialogs -------------------------------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal__box {
  position: relative; z-index: 1; width: min(540px, 100%); max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-lift);
}
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 16px 6px 24px; }
.modal__head h2 { font-size: 21px; }
.modal__form { display: flex; flex-direction: column; min-height: 0; }
.modal__body { padding: 12px 24px 20px; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; }
.modal__body p.muted, .modal__body .premium-lead { white-space: pre-line; overflow-wrap: anywhere; }
.modal__foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 0 24px 22px; }
.codes { margin: 0; padding: 14px 16px; background: var(--well); border-radius: var(--r-s); font-size: 15px; line-height: 1.7; white-space: pre-wrap; user-select: all; }

.progress { height: 8px; border-radius: 999px; background: var(--well); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand); transition: width .25s ease-out; }
.progress.is-done i { background: var(--ok); }
.progress__text { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.progress__text b { font-size: 17px; }
.donemark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }

.toast {
  position: fixed; bottom: 26px; left: 0; right: 0; width: fit-content; margin-inline: auto; z-index: 60;
  display: flex; align-items: center; gap: 10px; max-width: min(560px, 92vw);
  padding: 11px 18px; border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 90%, transparent); color: var(--bg);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  font-weight: 600; box-shadow: var(--shadow-lift);
}
.toast__x { display: grid; place-items: center; width: 28px; height: 28px; margin: -4px -8px -4px 0; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; }
@media (hover: hover) { .toast__x:hover { background: rgba(255, 255, 255, .2); } }
.toast--bad { background: color-mix(in srgb, var(--danger) 92%, transparent); color: #fff; padding-right: 14px; }
@media (prefers-color-scheme: dark) { .toast--bad { color: #2a0b09; } }

/* ------------------------- Panels, tables, cards ------------------------- */
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-m); padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.panel + .panel, .panel + .tool-panel, .tools + .tool-panel { margin-top: 16px; }
.tool-panel:not(:empty) { margin-top: 18px; }
.subhead { margin: 28px 0 10px; font-size: 17px; }
.subhead--first { margin-top: 0; }
.content p.muted + .btn, .content p.muted + .inline, .content .btn + .tblwrap, .content .btn + div, .content p + .tblwrap, .content p.muted + p { margin-top: 12px; }

.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--glass); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14.5px; vertical-align: middle; }
.tbl th { color: var(--ink-3); font-weight: 600; font-size: 13px; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
@media (hover: hover) { .tbl tbody tr:hover { background: var(--well); } }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 4px; }
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; }
.card--score { grid-column: span 2; display: flex; align-items: center; gap: 18px; }
.card__title { font-weight: 600; color: var(--ink-2); }
.stat { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ring { --p: 0; width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; position: relative;
  background: conic-gradient(var(--brand-ink) calc(var(--p) * 1%), var(--well) 0); }
.ring::before { content: ""; position: absolute; inset: 8px; background: var(--bg); border-radius: 50%; }
.ring span { position: relative; font-weight: 700; font-size: 21px; font-variant-numeric: tabular-nums; }

.settings { background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.setrow { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; }
.setrow__l { color: var(--ink-2); }
.setrow__v { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; text-align: right; word-break: break-word; }

.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 12px; }
.toolcard { display: grid; grid-template-columns: auto 1fr; column-gap: 13px; align-items: center; text-align: left; padding: 15px 16px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r-m); cursor: pointer; transition: border-color .12s, background .12s; }
@media (hover: hover) { .toolcard:hover { border-color: var(--line-strong); background: var(--glass-strong); } }
.toolcard.is-active { border-color: var(--brand); background: var(--brand-soft); }
.toolcard__ico { grid-row: span 2; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-ink); }
.toolcard__t { font-weight: 600; }
.toolcard__s { color: var(--ink-2); font-size: 13.5px; line-height: 1.35; }

.gen__out { display: flex; gap: 8px; align-items: center; background: var(--well); border-radius: 11px; padding: 12px 14px; }
.gen__out code { flex: 1; font-size: 17px; word-break: break-all; }
.gen .field { margin: 8px 0; }

.meterwrap { display: flex; align-items: center; gap: 10px; }
.meterwrap--row { margin: -6px 0 14px; }
.meter { flex: 1; height: 6px; border-radius: 999px; background: var(--well); overflow: hidden; }
.meter i { display: block; height: 100%; width: 8%; background: var(--danger); border-radius: inherit; transition: width .2s, background .2s; }
.meter.s1 i { width: 28%; background: #c8642a; }
.meter.s2 i { width: 52%; background: var(--brass); }
.meter.s3 i { width: 78%; background: #5d9a3a; }
.meter.s4 i { width: 100%; background: var(--ok); }
.usage { height: 8px; border-radius: 999px; background: var(--well); overflow: hidden; margin: 6px 0 16px; }
.usage i { display: block; height: 100%; min-width: 2px; background: var(--brand); border-radius: inherit; }

/* ------------------------------ Sign-in ---------------------------------- */
.boot { text-align: center; color: var(--ink-2); padding: 80px 20px; }
.authwrap { min-height: 100dvh; display: grid; place-items: center; padding: 28px 16px; }
.auth {
  width: min(440px, 100%); padding: 34px 32px 28px;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-lift);
}
.auth .topbar__brand { gap: 14px; margin-bottom: 2px; }
.auth .brand__name { font-size: 30px; letter-spacing: -.03em; }
.auth .premium-lead { font-size: 13.5px; }
.auth .btn--block { min-height: 46px; font-size: 16px; }

/* ------------------------------- Motion ---------------------------------- */
/* Small things move fast, large ones slower; exits are instant. Travel and scale only for readers who have not asked for less motion. */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; scale: .97; translate: 0 -6px; } }
@keyframes rise { from { opacity: 0; scale: .98; translate: 0 8px; } }
@keyframes slide { from { opacity: 0; translate: 32px 0; } }
@keyframes toast { from { opacity: 0; translate: 0 10px; } }
@media (prefers-reduced-motion: no-preference) {
  .menu { animation: pop .2s cubic-bezier(.2, 0, 0, 1); }
  .modal__box { animation: rise .3s cubic-bezier(.2, 0, 0, 1); }
  .drawer__panel { animation: slide .35s cubic-bezier(.2, 0, 0, 1); }
  .toast { animation: toast .2s cubic-bezier(.2, 0, 0, 1); }
}
@media (prefers-reduced-motion: reduce) {
  .menu, .modal__box, .drawer__panel, .toast { animation: fade .15s ease-out; }
  .nav__heading .ico, .progress i, .meter i { transition: none; }
}

/* ------------------------------ Selecting --------------------------------- */
.selbar {
  position: sticky; top: calc(var(--topbar-h) + 10px); z-index: 10;
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; padding: 10px 12px 10px 18px;
  background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow);
}
.selbar b { margin-right: auto; font-variant-numeric: tabular-nums; }
.is-selecting .item::before {
  content: "\2713"; flex: 0 0 22px; height: 22px; display: grid; place-items: center; border-radius: 7px;
  border: 1.5px solid var(--edge); background: var(--input); color: transparent; font-size: 14px; font-weight: 700; line-height: 1;
}
.is-selecting .item.is-selected::before { background: var(--brand); border-color: var(--brand); color: #fff; }
.is-selecting .item.is-selected { border-color: var(--brand); background: var(--brand-soft); }
.items--list .item.is-selected { background: var(--brand-soft); }

/* ------------------------------- Phones ---------------------------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .iconbtn.navtoggle { display: grid; }
  .sidebar { display: none; }
  .sidebar.is-open { display: flex; position: fixed; inset: 0 auto 0 0; width: min(310px, 88vw); z-index: 35; background: var(--glass-strong); box-shadow: var(--shadow-lift); }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__actions { gap: 4px; }
  .topbar__actions .btn { padding: 8px 12px; }
  .content { padding: 20px 14px 48px; }
  .content__title { font-size: 25px; }
  .card--score { grid-column: span 1; }
  .setrow__v { justify-content: flex-start; text-align: left; }
  .drawer__panel { top: 0; right: 0; bottom: 0; width: 100vw; border-radius: 0; border: 0; }
  .auth { padding: 28px 22px 24px; }
  input:not([type=checkbox]):not([type=range]), select, textarea { font-size: 16px; }   /* below 16px iOS zooms the page on focus */
  .selbar { top: calc(var(--topbar-h) + 6px); }
}

/* The opened list of a select does not see through translucent field colours: give it solid system colours. */
option, optgroup { background-color: Canvas; color: CanvasText; }
