/* =========================================================================
 * php2fa — Authenticator UI
 * Neutral slate base · single violet accent · one radius scale · dark theme
 * ========================================================================= */

:root {
  /* Surfaces */
  --bg:          #0b0d10;
  --surface:     #14171c;
  --surface-2:   #1a1e25;
  --surface-3:   #21262f;
  --border:      #262c36;
  --border-strong:#343c48;

  /* Text */
  --text:        #e8ebf0;
  --text-dim:    #98a2b3;
  --text-faint:  #6b7482;

  /* Accent (single, locked) */
  --accent:      #8b5cf6;
  --accent-strong:#7c3aed;
  --accent-ink:  #f5f3ff;
  --accent-soft: rgba(139,92,246,.14);
  --accent-line: rgba(139,92,246,.34);

  /* Status */
  --danger:      #f2555a;
  --danger-soft: rgba(242,85,90,.12);
  --danger-line: rgba(242,85,90,.32);
  --warn:        #f2b544;
  --warn-soft:   rgba(242,181,68,.10);
  --warn-line:   rgba(242,181,68,.28);

  /* Radius scale (locked) */
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Type */
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 12px 40px -16px rgba(0,0,0,.7);
  --shadow-pop: 0 20px 60px -18px rgba(0,0,0,.75);

  --ring-focus: 0 0 0 3px var(--accent-soft);
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .88em; color: var(--text); background: var(--surface-3); padding: .1em .38em; border-radius: 6px; }

/* Icons */
.ic { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -.16em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .ic { stroke-width: 1.8; }

/* =========================================================================
 * BUTTONS
 * ========================================================================= */
.btn {
  --btn-bg: var(--surface-3);
  --btn-fg: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--sans); font-size: .92rem; font-weight: 600; line-height: 1;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid transparent; border-radius: var(--r-md);
  padding: .72rem 1.1rem; cursor: pointer; white-space: nowrap;
  transition: transform .06s var(--ease), background .15s var(--ease), border-color .15s var(--ease), filter .15s var(--ease);
}
.btn .ic { width: 1.1em; height: 1.1em; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-block { width: 100%; }

.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); font-weight: 700; box-shadow: var(--shadow-1); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }

.btn-ghost { --btn-bg: transparent; --btn-fg: var(--text-dim); border-color: var(--border); }
.btn-ghost:hover { --btn-fg: var(--text); background: var(--surface-2); }

.btn-danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger); border-color: var(--danger-line); }
.btn-danger-ghost:hover { background: var(--danger-soft); }

.btn-icon-text { padding: .6rem .95rem; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  color: var(--text-dim); background: transparent;
  border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn .ic { width: 1.25em; height: 1.25em; }

:focus-visible { outline: none; box-shadow: var(--ring-focus); border-radius: var(--r-sm); }

/* =========================================================================
 * BRAND
 * ========================================================================= */
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  color: var(--accent-ink); background: linear-gradient(160deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-radius: 10px; box-shadow: 0 6px 18px -8px var(--accent);
}
.brand-mark .ic { width: 20px; height: 20px; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; }
.brand--compact { margin-bottom: 1.6rem; }

/* =========================================================================
 * FIELDS / INPUTS
 * ========================================================================= */
.field { display: block; margin-bottom: 1rem; }
.field-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-dim); margin-bottom: .45rem; }
.field-label .muted, .muted { color: var(--text-faint); font-weight: 500; }
.field-help { display: block; margin-top: .4rem; font-size: .78rem; color: var(--text-faint); }

input, textarea, select {
  width: 100%; font-family: var(--sans); font-size: .95rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: .72rem .85rem; transition: border-color .15s var(--ease), box-shadow .15s var(--ease); resize: vertical;
}
textarea, input#secret { font-family: var(--mono); letter-spacing: .02em; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring-focus); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 1rem; padding-right: 2.2rem; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-right: 2.9rem; }
.input-wrap .in-lead { position: absolute; left: .85rem; color: var(--text-faint); pointer-events: none; display: grid; }
.input-wrap .in-lead ~ input { padding-left: 2.6rem; }
.in-btn {
  position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: grid; place-items: center;
  background: transparent; border: none; color: var(--text-faint); cursor: pointer; border-radius: 8px;
}
.in-btn:hover { color: var(--text); background: var(--surface-3); }

.inline-error, .inline-status {
  display: flex; align-items: flex-start; gap: .5rem;
  font-size: .86rem; border-radius: var(--r-md); padding: .65rem .8rem; margin: .2rem 0 0;
}
.inline-error { color: #ffb4b7; background: var(--danger-soft); border: 1px solid var(--danger-line); }
.inline-status { color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); }

.callout {
  display: flex; align-items: flex-start; gap: .6rem; margin-top: 1.1rem;
  font-size: .84rem; line-height: 1.45; border-radius: var(--r-md); padding: .75rem .85rem;
}
.callout .ic { margin-top: .05rem; width: 1.05rem; height: 1.05rem; }
.callout--warn { color: #f6d79a; background: var(--warn-soft); border: 1px solid var(--warn-line); }
.callout--warn .ic { color: var(--warn); }
.callout--muted { color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); }

.pw-strength { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; }
.pw-bar { flex: 1; height: 5px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; position: relative; }
.pw-bar::after { content: ""; position: absolute; inset: 0; width: var(--pw, 0%); background: var(--pw-color, var(--danger)); border-radius: inherit; transition: width .25s var(--ease), background .25s var(--ease); }
.pw-label { font-size: .74rem; color: var(--text-faint); min-width: 4.5rem; }

/* =========================================================================
 * LOGIN SCREEN
 * ========================================================================= */
.login { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr .95fr; }

.login-brandside {
  position: relative; overflow: hidden; padding: 3.5rem;
  display: flex; align-items: center;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(16,185,129,.16) 0%, transparent 55%),
    radial-gradient(90% 80% at 90% 100%, rgba(16,185,129,.08) 0%, transparent 60%),
    var(--surface);
  border-right: 1px solid var(--border);
}
.login-brandside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 22px 22px; mask-image: radial-gradient(120% 100% at 20% 10%, #000 0%, transparent 70%);
}
.brandside-inner { position: relative; max-width: 30rem; }
.brandside-title { font-size: clamp(1.7rem, 2.4vw, 2.5rem); line-height: 1.12; letter-spacing: -.025em; font-weight: 800; margin: 2rem 0 2.2rem; }
.trust-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.trust-list li { display: flex; align-items: center; gap: .75rem; color: var(--text-dim); font-size: .96rem; }
.trust-list .ic { color: var(--accent); width: 1.25rem; height: 1.25rem; }
.brandside-foot { margin-top: 2.6rem; font-family: var(--mono); font-size: .74rem; color: var(--text-faint); letter-spacing: .02em; }

.login-formside { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2.5rem 1.5rem; }
.login-card { width: 100%; max-width: 24rem; }
.login-title { font-size: 1.65rem; letter-spacing: -.02em; font-weight: 800; margin-bottom: .4rem; }
.login-desc { color: var(--text-dim); margin-bottom: 1.8rem; font-size: .95rem; }
#login-form .field:last-of-type { margin-bottom: 1.2rem; }
#unlock-btn { padding: .82rem 1.1rem; font-size: .98rem; }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brandside { display: none; }
  .login-formside { min-height: 100dvh; }
}

/* =========================================================================
 * APP BAR
 * ========================================================================= */
.appbar { position: sticky; top: 0; z-index: 30; background: rgba(11,13,16,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.appbar-inner { max-width: 780px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; gap: .8rem; }
.brand--bar .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
.brand--bar .brand-mark .ic { width: 17px; height: 17px; }
.brand--bar .brand-name { font-size: 1rem; }
@media (max-width: 560px) { .brand--bar .brand-name { display: none; } }

.search { position: relative; flex: 1; min-width: 0; }
.search .search-ic { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 1.05rem; height: 1.05rem; }
.search input { padding: .55rem .8rem .55rem 2.4rem; border-radius: var(--r-pill); background: var(--surface-2); font-size: .9rem; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.appbar-actions { display: flex; align-items: center; gap: .5rem; }
@media (max-width: 480px) { .btn-icon-text span { display: none; } .btn-icon-text { width: 38px; height: 38px; padding: 0; } }

.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--border-strong); font-weight: 700; font-size: .85rem; color: var(--text); }

/* Menu */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + .5rem); width: 15rem; z-index: 40;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: .4rem; animation: pop .12s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-head { padding: .55rem .6rem .65rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; }
.menu-title { font-weight: 700; font-size: .9rem; }
.menu-sub { font-size: .76rem; color: var(--text-faint); margin-top: .1rem; }
.menu-item { display: flex; align-items: center; gap: .65rem; width: 100%; text-align: left;
  padding: .6rem .6rem; font-size: .9rem; font-weight: 500; color: var(--text);
  background: transparent; border: none; border-radius: var(--r-sm); cursor: pointer; }
.menu-item .ic { color: var(--text-dim); width: 1.1rem; height: 1.1rem; }
.menu-item:hover { background: var(--surface-3); }
.menu-item--danger { color: var(--danger); } .menu-item--danger .ic { color: var(--danger); }
.menu-item--danger:hover { background: var(--danger-soft); }

/* =========================================================================
 * CONTENT / GROUPS / ACCOUNTS
 * ========================================================================= */
.content { max-width: 780px; margin: 0 auto; padding: 1.2rem 1rem 5rem; }

.group-count { font-size: .78rem; color: var(--text-faint); background: var(--surface-3); padding: .05rem .5rem; border-radius: var(--r-pill); font-variant-numeric: tabular-nums; }

/* Folder home (folder-first navigation) */
.folder-home { display: grid; gap: .55rem; }
.folder-row { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); transition: border-color .15s var(--ease), background .15s var(--ease); }
.folder-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.folder-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: .85rem;
  padding: .9rem 1rem; background: transparent; border: none; cursor: pointer; color: var(--text); text-align: left; }
.folder-row-ic { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 11px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.folder-row-ic .ic { width: 1.25rem; height: 1.25rem; }
.folder-row--muted .folder-row-ic { color: var(--text-dim); background: var(--surface-3); border-color: var(--border); }
.folder-row-name { flex: 1; min-width: 0; font-weight: 600; font-size: .98rem; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-row-chev { color: var(--text-faint); flex: none; }
.folder-row-rename { margin-right: .5rem; }

/* Folder detail header */
.detail-head { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }
.back-btn { display: inline-flex; align-items: center; gap: .35rem; flex: none;
  padding: .5rem .8rem .5rem .6rem; font-size: .85rem; font-weight: 600; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill); cursor: pointer;
  transition: color .15s var(--ease), background .15s var(--ease); }
.back-btn:hover { color: var(--text); background: var(--surface-3); }
.back-btn .ic { width: 1.05em; height: 1.05em; transform: rotate(180deg); }
.detail-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; }
.detail-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Folder chip shown on search results */
.acct-folder { display: inline-flex; align-items: center; gap: .25rem; margin-left: .45rem; vertical-align: middle;
  padding: .05rem .45rem; font-size: .72rem; color: var(--text-dim); background: var(--surface-3); border-radius: var(--r-pill); }
.acct-folder .ic { width: .85em; height: .85em; color: var(--text-faint); }

.acct-list { display: grid; gap: .6rem; }
.acct {
  display: flex; align-items: center; gap: .85rem;
  padding: .8rem .9rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); transition: border-color .15s var(--ease), background .15s var(--ease);
}
.acct:hover { border-color: var(--border-strong); background: var(--surface-2); }

.acct-badge { display: grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 11px; font-weight: 800; font-size: 1.05rem; color: var(--accent);
  background: var(--accent-soft); border: 1px solid var(--accent-line); text-transform: uppercase; }

.acct-main { min-width: 0; flex: 1; }
.acct-name { font-size: .82rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-code { font-family: var(--mono); font-size: 1.72rem; font-weight: 700; letter-spacing: .08em; color: var(--text); line-height: 1.15; }
.acct-code.copyable { cursor: pointer; }
.acct-code.reveal-hidden { letter-spacing: .18em; color: var(--text-faint); }
.acct-side { display: flex; align-items: center; gap: .35rem; flex: none; }

/* Countdown ring */
.ring { position: relative; width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--accent) var(--deg,360deg), var(--surface-3) 0); }
.ring::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--surface); }
.ring .sec { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; font-size: .72rem; font-weight: 700; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.acct:hover .ring::after { background: var(--surface-2); }
.ring.warn { background: conic-gradient(var(--danger) var(--deg,360deg), var(--surface-3) 0); }
.ring.warn .sec { color: var(--danger); }

.acct .icon-btn { width: 34px; height: 34px; }
.icon-btn.copied { color: var(--accent); }
.acct-broken .acct-code { color: var(--danger); font-size: 1rem; letter-spacing: normal; }

/* Skeleton */
.skeleton { height: 62px; border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Empty states */
.empty { text-align: center; padding: 3.5rem 1.5rem; max-width: 26rem; margin: 1.5rem auto; }
.empty-art { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 1.2rem;
  border-radius: var(--r-lg); color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.empty-art .ic { width: 30px; height: 30px; }
.empty h2 { font-size: 1.3rem; letter-spacing: -.02em; margin-bottom: .5rem; }
.empty p { color: var(--text-dim); margin-bottom: 1.5rem; font-size: .95rem; }
.empty--small { padding: 2.5rem 1rem; color: var(--text-faint); }
.empty--small p { margin: 0; }

/* =========================================================================
 * MODALS (native <dialog>)
 * ========================================================================= */
.modal { border: none; padding: 0; background: transparent; max-width: 30rem; width: calc(100% - 2rem); color: var(--text); }
.modal::backdrop { background: rgba(6,8,11,.62); backdrop-filter: blur(3px); }
/* Animate the inner card (not the <dialog>) so the dialog stays transform-free —
 * a transformed ancestor would break position:fixed on the folder dropdown. */
.modal[open] .modal-card { animation: modal-in .18s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; max-height: min(88dvh, 46rem); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 1.15rem; letter-spacing: -.02em; }
.modal-x { width: 34px; height: 34px; }
.modal-body { padding: 1.2rem; overflow-y: auto; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.2rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot--split { justify-content: space-between; }
.modal-card--sm { max-width: 24rem; }
.move-sub { font-size: .9rem; color: var(--text-dim); margin-bottom: 1.1rem; }
.move-name { color: var(--text); font-weight: 700; }

/* Reveal secret-key + QR modal */
.reveal-sub { font-size: .9rem; color: var(--text-dim); margin-bottom: .9rem; }
.reveal-account { font-weight: 700; color: var(--text); margin-bottom: 1rem; word-break: break-word; }
.reveal-qr { display: flex; justify-content: center; margin: 0 auto 1.1rem; }
.reveal-qr svg { width: 12.5rem; height: 12.5rem; max-width: 100%; border-radius: 10px; background: #fff; padding: 8px; box-sizing: border-box; }
.reveal-qr-fail { font-size: .85rem; color: var(--text-faint); text-align: center; }
#reveal-secret { font-family: var(--mono); letter-spacing: .02em; }

/* Sensitive area: blurred + covered until the user taps to reveal */
.reveal-sensitive { position: relative; margin-bottom: 1.1rem; }
.reveal-sensitive .reveal-inner { transition: filter .18s ease; }
.reveal-qr { margin-bottom: 1.1rem; }
.reveal-sensitive:not(.revealed) .reveal-inner { filter: blur(11px); pointer-events: none; user-select: none; }
.reveal-cover {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  border: 1px dashed var(--border, var(--surface-3)); border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2, #14171c) 55%, transparent);
  color: var(--text-dim); font-size: .9rem; font-weight: 600; cursor: pointer;
}
.reveal-cover .ic { width: 1.5rem; height: 1.5rem; }
.reveal-cover:hover { color: var(--text); background: color-mix(in srgb, var(--surface-2, #14171c) 40%, transparent); }
.reveal-sensitive.revealed .reveal-cover { display: none; }

/* Per-account actions menu (fixed-positioned popover) */
.item-menu { position: fixed; right: auto; top: auto; width: 13.5rem; z-index: 50; }

/* Folder combobox */
.combo { position: relative; }
.combo input { padding-right: 2.6rem; }
.combo-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: grid; place-items: center; background: transparent; border: none;
  color: var(--text-faint); cursor: pointer; border-radius: 8px; }
.combo-toggle:hover { color: var(--text); background: var(--surface-3); }
.combo-toggle .ic { width: 1.1em; height: 1.1em; transform: rotate(90deg); transition: transform .15s var(--ease); }
.combo.open .combo-toggle .ic { transform: rotate(-90deg); }
.combo-panel { position: fixed; z-index: 70;
  max-height: 15rem; overflow-y: auto; padding: .35rem;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-pop); }
.combo-option { display: flex; align-items: center; gap: .55rem; width: 100%; text-align: left;
  padding: .55rem .6rem; font-size: .9rem; color: var(--text); background: transparent; border: none;
  border-radius: var(--r-sm); cursor: pointer; }
.combo-option:hover { background: var(--surface-3); }
.combo-option .ic { color: var(--text-faint); width: 1.05em; height: 1.05em; flex: none; }
.combo-create { color: var(--accent); font-weight: 600; }
.combo-create .ic { color: var(--accent); }
.foot-right { display: flex; gap: .6rem; }

.seg-label { font-size: .82rem; font-weight: 600; color: var(--text-dim); margin-bottom: .6rem; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.method { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: .95rem .4rem;
  font-size: .8rem; font-weight: 600; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease), background .15s var(--ease); }
.method .ic { width: 1.4rem; height: 1.4rem; color: var(--text); }
.method:hover { border-color: var(--accent-line); color: var(--text); background: var(--surface-3); }
.method.busy { opacity: .6; pointer-events: none; }

.or-row { display: flex; align-items: center; gap: .8rem; margin: 1.1rem 0 .8rem; color: var(--text-faint); font-size: .78rem; }
.or-row::before, .or-row::after { content: ""; height: 1px; background: var(--border); flex: 1; }

.divider { display: flex; align-items: center; gap: .8rem; margin: 1.3rem 0 1rem; color: var(--text-dim); font-size: .8rem; font-weight: 600; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }

.advanced { margin-top: .3rem; }
.advanced summary { cursor: pointer; color: var(--accent); font-size: .86rem; font-weight: 600; user-select: none; list-style: none; padding: .3rem 0; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "＋ "; color: var(--text-faint); }
.advanced[open] summary::before { content: "－ "; }
.advanced-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-top: .8rem; }
.advanced-grid .field { margin-bottom: 0; }

/* Multi-account import (Google Authenticator export) */
.batch-hint { margin: 0 0 .8rem; font-size: .82rem; color: var(--text-dim); line-height: 1.45; }
.batch-list { display: flex; flex-direction: column; gap: .5rem; max-height: 15rem; overflow-y: auto; padding-right: .2rem; }
.batch-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem;
  padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); cursor: pointer; transition: border-color var(--duration-fast, 150ms) var(--ease);
}
.batch-row:hover { border-color: var(--border-strong); }
.batch-row input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); cursor: pointer; }
.batch-name { font-weight: 600; font-size: .9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-meta { font-size: .74rem; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* =========================================================================
 * TOAST
 * ========================================================================= */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(1rem);
  display: flex; align-items: center; gap: .55rem; z-index: 60;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong);
  padding: .7rem 1.05rem; border-radius: var(--r-pill); box-shadow: var(--shadow-pop);
  font-size: .88rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ic { color: var(--accent); }
.toast.toast--err .ic { color: var(--danger); }

@media (max-width: 480px) {
  .acct-code { font-size: 1.5rem; }
  .method-grid { gap: .45rem; }
  .method { padding: .8rem .3rem; font-size: .74rem; }
  .advanced-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* =========================================================================
 * MULTI-USER: roles, admin panel, users list, activity log
 * ========================================================================= */

/* Role badge */
.role-badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem;
  border-radius: var(--r-pill); font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; border: 1px solid var(--border-strong); color: var(--text-dim); }
.role-badge.role-admin { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.role-badge.role-staff { color: var(--text-dim); background: var(--surface-3); }

/* Admin tabs in the appbar */
.admin-tabs { margin-left: auto; display: flex; gap: .3rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-pill); padding: .2rem; }
.tab { border: none; background: transparent; color: var(--text-dim); font: inherit; font-size: .82rem;
  font-weight: 600; padding: .35rem .8rem; border-radius: var(--r-pill); cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--accent); color: var(--accent-ink); }

/* Pane heading (Users / Activity log) */
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.pane-head h2 { font-size: 1.15rem; font-weight: 700; }
.pane-muted { color: var(--text-faint); padding: 1.5rem .2rem; text-align: center; }

/* Users list */
.users-list { display: flex; flex-direction: column; gap: .5rem; }
.user-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .85rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.user-row:hover { border-color: var(--border-strong); }
.avatar--sm { width: 30px; height: 30px; font-size: .8rem; flex: none; }
.user-main { min-width: 0; flex: 1; }
.user-name { font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: .4rem; }
.user-sub { font-size: .76rem; color: var(--text-faint); margin-top: .1rem; }
.you-tag { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--r-pill); padding: 0 .4rem; }
.user-edit-btn { flex: none; }

/* Small status pill (e.g. temp password) */
.pill { display: inline-flex; align-items: center; padding: .1rem .5rem; border-radius: var(--r-pill);
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; flex: none; }
.pill--warn { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn-line); }
.pill--lock { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.user-lock { flex: none; display: grid; place-items: center; width: 34px; height: 34px; color: var(--text-faint); }
.user-lock .ic { width: 1.05rem; height: 1.05rem; }

/* Activity log */
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: flex; gap: .75rem; padding: .7rem .2rem; border-bottom: 1px solid var(--border); }
.audit-row:last-child { border-bottom: none; }
.audit-dot { flex: none; width: 9px; height: 9px; border-radius: var(--r-pill); margin-top: .38rem;
  background: var(--text-faint); }
.audit-dot.audit-auth { background: var(--accent); }
.audit-dot.audit-create { background: #3ecf8e; }
.audit-dot.audit-update { background: var(--warn); }
.audit-dot.audit-danger { background: var(--danger); }
.audit-main { min-width: 0; flex: 1; }
.audit-line { font-size: .88rem; line-height: 1.35; word-break: break-word; }
.audit-line strong { font-weight: 700; }
.audit-sub { font-size: .74rem; color: var(--text-faint); margin-top: .15rem; }

@media (max-width: 560px) {
  .admin-tabs { margin-left: 0; }
  .appbar-inner { flex-wrap: wrap; }
}
