/* Clean Full-Width Obsidian & Alabaster Console (Zero Redundancy) */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --subtle: #f7f7f8;
  --pill: #f1f1f4;
  --hover: #f4f4f6;
  --ink: #09090b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --line: #e4e4e7;
  --line-soft: #efefef;
  --line-strong: #d4d4d8;
  --primary: #09090b;
  --primary-hover: #27272a;
  --primary-ink: #ffffff;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --ok-line: #bbf7d0;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --warn-line: #fde68a;
  --high: #ea580c;
  --high-soft: #fff7ed;
  --high-line: #fed7aa;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --err-line: #fecaca;
  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.04);
  --shadow-md: 0 12px 30px -10px rgba(9, 9, 11, 0.14), 0 2px 6px rgba(9, 9, 11, 0.05);
  --shadow-lg: 0 24px 60px -16px rgba(9, 9, 11, 0.24);
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #09090b;
  --surface: #111113;
  --subtle: #16161a;
  --pill: #1f1f24;
  --hover: #1a1a1f;
  --ink: #fafafa;
  --ink-2: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: #27272a;
  --line-soft: #1d1d22;
  --line-strong: #3f3f46;
  --primary: #fafafa;
  --primary-hover: #e4e4e7;
  --primary-ink: #09090b;
  --ok: #4ade80;
  --ok-soft: rgba(34, 197, 94, 0.14);
  --ok-line: rgba(34, 197, 94, 0.3);
  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --warn-line: rgba(245, 158, 11, 0.3);
  --high: #fb923c;
  --high-soft: rgba(249, 115, 22, 0.14);
  --high-line: rgba(249, 115, 22, 0.32);
  --err: #f87171;
  --err-soft: rgba(239, 68, 68, 0.16);
  --err-line: rgba(239, 68, 68, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 28px 64px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 13.5px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--pill);
}

/* Login Gate */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  background: radial-gradient(60% 42% at 50% 0%, rgba(9, 9, 11, 0.045) 0%, var(--bg) 100%);
}
html[data-theme="dark"] .login-view {
  background: radial-gradient(55% 40% at 50% 0%, rgba(255, 255, 255, 0.06) 0%, var(--bg) 100%);
}
.login-card {
  width: 100%;
  max-width: 376px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-md);
}
.login-head { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; }
.login-mark { width: 46px; height: 46px; border-radius: 13px; overflow: hidden; margin-bottom: 13px; box-shadow: 0 8px 20px -6px rgba(9, 9, 11, 0.25); }
.login-mark img { width: 100%; height: 100%; display: block; }
.login-head h1 { margin: 0; font-size: 20px; font-weight: 750; letter-spacing: -0.025em; }
.login-sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.pwd-input-wrap { position: relative; display: flex; align-items: center; }
.pwd-input-wrap input { width: 100%; padding-right: 38px; }
.pwd-eye-btn {
  position: absolute; right: 6px; width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted);
}
.pwd-eye-btn:hover { background: var(--pill); color: var(--ink); }
.pwd-eye-btn svg { width: 15px; height: 15px; }
.form-error {
  padding: 9px 12px; border-radius: 9px;
  background: var(--err-soft); border: 1px solid var(--err-line); color: var(--err);
  font-size: 12.5px; font-weight: 500;
}

/* Inputs & Buttons */
.field-group { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.field-group > span, .field-group > label, .field-label { color: var(--muted); font-weight: 500; font-size: 12.5px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], textarea, .select-control {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], .select-control { height: 34px; }
input:focus, textarea:focus, .select-control:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(9, 9, 11, 0.07);
}
html[data-theme="dark"] input:focus, html[data-theme="dark"] textarea:focus, html[data-theme="dark"] .select-control:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}
input:disabled, select:disabled { opacity: 0.45; cursor: not-allowed; }
.textarea-code { width: 100%; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; resize: vertical; background: var(--subtle); }
.checkbox-row { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 13px; color: var(--ink-2); }
.checkbox-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--ink); cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 33px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 13.5px; }
.btn-sm { height: 29px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--hover); border-color: var(--line-strong); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); }

.icon-btn {
  width: 27px; height: 27px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); padding: 0;
  transition: all 0.12s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); border-color: var(--line); }
.icon-btn.danger:hover { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.icon-btn svg { width: 14px; height: 14px; }

/* Single Clean Topbar */
.app-shell { min-height: 100vh; padding-bottom: 84px; }

.topbar {
  position: sticky; top: 0; z-index: 35;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1640px;
  margin: 0 auto;
  height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; }
.brand-title { font-size: 14.5px; font-weight: 750; letter-spacing: -0.02em; white-space: nowrap; }
.v-divider { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }

/* Compact Inline Expiry Tabs */
.expiry-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--pill);
  border-radius: 9px;
  overflow-x: auto;
  scrollbar-width: none;
}
.expiry-tabs::-webkit-scrollbar { display: none; }

.exp-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: all 0.12s;
}
.exp-tab:hover { color: var(--ink); }
.exp-tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
}
.exp-tab.tab-critical.has-alert,
.exp-tab.tab-expired.has-alert { color: var(--err); }
.exp-tab.tab-critical.has-alert.active,
.exp-tab.tab-expired.has-alert.active { background: var(--err-soft); color: var(--err); }

.tab-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  opacity: 0.85;
}

.dot { width: 6.5px; height: 6.5px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.dot-critical { background: #ef4444; }
.dot-high { background: #f97316; }
.dot-warn { background: #f59e0b; }
.dot-expired { background: #b91c1c; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.topbar-icon-btn { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; }

.sub2-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex-shrink: 0;
}
.sub2-dot.connected { background: #16a34a; box-shadow: 0 0 0 2.5px rgba(22, 163, 74, 0.22); }
.sub2-dot.error { background: #dc2626; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Main Content */
.main-wrap {
  max-width: 1640px;
  margin: 0 auto;
  padding: 14px 20px 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Single Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pills-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: all 0.12s;
}
.status-filter-pill:hover { border-color: var(--line-strong); background: var(--hover); }
.status-filter-pill.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--primary-ink);
}
.status-filter-pill.active .pill-cnt { color: inherit; opacity: 0.78; }
.pill-cnt { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.filter-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box { position: relative; width: 240px; }
.search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--faint); pointer-events: none;
}
.search-box input { width: 100%; height: 32px; padding-left: 30px; font-size: 12.5px; }
#sort-select { height: 32px; font-size: 12.5px; }

/* Table Card */
.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1060px;
}

.accounts-table th {
  text-align: left;
  padding: 8px 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--subtle);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.accounts-table td {
  padding: 7px 7px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.accounts-table tbody tr:last-child td { border-bottom: 0; }
.accounts-table tbody tr { transition: background 0.1s; }
.accounts-table tbody tr:hover { background: var(--subtle); }
.accounts-table tbody tr.row-selected { background: rgba(9, 9, 11, 0.045); }
html[data-theme="dark"] .accounts-table tbody tr.row-selected { background: rgba(255, 255, 255, 0.06); }

/* Escalating Red Expiry Highlights */
.accounts-table tbody tr.row-warn {
  background: var(--warn-soft);
  box-shadow: inset 3px 0 0 var(--warn);
}
.accounts-table tbody tr.row-high {
  background: var(--high-soft);
  box-shadow: inset 3px 0 0 var(--high);
}
.accounts-table tbody tr.row-critical,
.accounts-table tbody tr.row-red-strong {
  background: var(--err-soft);
  box-shadow: inset 3.5px 0 0 var(--err);
}
.accounts-table tbody tr.row-expired {
  background: color-mix(in srgb, var(--err-soft) 135%, var(--surface));
  box-shadow: inset 4px 0 0 #b91c1c;
}

.col-check { width: 36px; text-align: center; }
.col-check input[type="checkbox"] { width: 14.5px; height: 14.5px; accent-color: var(--ink); cursor: pointer; }

/* Account Cell */
.account-cell { display: flex; align-items: center; gap: 5px; min-width: 165px; }
.copy-email-btn {
  font-family: var(--font-mono);
  font-size: 12.2px;
  font-weight: 600;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-email-btn:hover { text-decoration: underline; }
.mini-plan-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  line-height: 16px;
  border-radius: 4px;
  text-transform: uppercase;
  background: var(--pill);
  color: var(--muted);
  flex-shrink: 0;
}
.mini-plan-tag.pro { background: #f3e8ff; color: #7e22ce; }
.mini-plan-tag.free { background: var(--err-soft); color: var(--err); }

/* Inline Editable Note Right Next to Account! */
.col-note { min-width: 116px; max-width: 165px; }
.inline-note-input {
  width: 100%;
  height: 28px !important;
  padding: 3px 7px !important;
  font-size: 12.2px !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  color: var(--ink-2);
  transition: background 0.12s, border-color 0.12s;
}
.inline-note-input::placeholder { color: var(--faint); }
.inline-note-input:hover {
  background: var(--surface) !important;
  border-color: var(--line) !important;
}
.inline-note-input:focus {
  background: var(--surface) !important;
  border-color: var(--ink) !important;
  color: var(--ink);
}
.inline-note-input.saved-flash {
  border-color: var(--ok) !important;
  background: var(--ok-soft) !important;
}

/* True Colored Status Pill Button */
.status-pill-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.8px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: filter 0.12s, transform 0.08s;
}
.status-pill-trigger:hover { filter: brightness(0.95); }
.status-pill-trigger svg { width: 11.5px; height: 11.5px; opacity: 0.7; }

/* Password Cell */
.pwd-cell { display: flex; align-items: center; gap: 2px; font-family: var(--font-mono); font-size: 11.8px; }
.pwd-value { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

.th-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.th-eye-btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}
.th-eye-btn:hover,
.th-eye-btn.active {
  background: var(--pill);
  color: var(--ink);
}
.th-eye-btn svg {
  width: 13.5px;
  height: 13.5px;
}

/* Compact Single-Line TOTP Cell (Hidden by default with eye reveal!) */
.totp-inline {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.totp-masked {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  min-width: 48px;
}
.totp-code-btn {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--pill);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}
.totp-code-btn:hover { border-color: var(--ink); background: var(--surface); }
.totp-sec-pill {
  font-family: var(--font-mono);
  font-size: 10.8px;
  color: var(--muted);
  min-width: 22px;
  font-variant-numeric: tabular-nums;
}
.totp-sec-pill.urgent { color: var(--err); font-weight: 700; }
.twofa-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 23px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  color: var(--ok);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.twofa-link:hover { filter: brightness(0.95); }
.twofa-link svg { width: 10px; height: 10px; }
.twofa-icon-link {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.12s;
}
.twofa-icon-link:hover {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok-line);
}
.twofa-icon-link svg {
  width: 13px;
  height: 13px;
}

/* Compact Expiry Cell */
.expiry-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.expiry-date-btn {
  font-family: var(--font-mono);
  font-size: 11.8px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 2px 3px;
}
.expiry-date-btn:hover { background: var(--pill); border-color: var(--line); }

.expiry-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.8px;
  font-weight: 650;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn-line); }
.badge-high { background: var(--high-soft); color: var(--high); border: 1px solid var(--high-line); }
.badge-critical { background: var(--err); color: #fff; }
.badge-expired { background: #991b1b; color: #fff; }
.badge-none { background: var(--pill); color: var(--muted); }

/* Sub2 Dual-Window Quota Cell */
.sub2-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 138px;
}
.sub2-bars-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sub2-meter {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sub2-meter-lbl {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sub2-meter-lbl strong { color: var(--ink); font-weight: 650; }
.mini-bar { height: 4px; border-radius: 999px; background: var(--pill); overflow: hidden; }
.mini-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--ink); }
.mini-bar > i.mid { background: var(--warn); }
.mini-bar > i.high { background: var(--err); }

.sub2-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10.5px;
}
.sub2-state-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--ok);
}
.sub2-state-tag.paused { color: var(--muted); }
.sub2-state-tag.limited { color: var(--warn); }
.sub2-state-tag.error { color: var(--err); }

.manual-quota-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.manual-quota-btn:hover { background: var(--pill); color: var(--ink); }

.row-actions { display: flex; align-items: center; gap: 2px; white-space: nowrap; }

/* Empty & Footer */
.empty-state { text-align: center; padding: 54px 24px; }
.empty-icon-wrap {
  width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px;
  background: var(--pill); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.empty-icon-wrap svg { width: 22px; height: 22px; }
.empty-title { font-size: 15px; font-weight: 650; margin-bottom: 5px; }
.empty-desc { color: var(--muted); font-size: 13px; max-width: 400px; margin: 0 auto 16px; }
.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

.table-footer {
  padding: 9px 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Floating Batch Action Bar */
.batch-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  width: min(94vw, 840px); padding: 9px 14px;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 13px; box-shadow: var(--shadow-lg);
}
.batch-left, .batch-actions, .batch-status-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Popovers */
.popover {
  position: fixed; z-index: 65; width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow-lg);
}
.popover-menu { width: 196px; padding: 6px; }
.popover-title { font-weight: 650; margin-bottom: 8px; font-size: 12.5px; }
.popover-form { display: flex; flex-direction: column; gap: 9px; }
.popover-actions { display: flex; align-items: center; gap: 6px; }
.popover-divider { height: 1px; background: var(--line-soft); margin: 5px 0; }
.spacer { flex: 1; }

.status-picker-list { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }
.status-picker-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; border: 0; border-radius: 7px; padding: 6px 8px;
  background: transparent; text-align: left; font-size: 12.5px; font-weight: 550;
}
.status-picker-opt:hover { background: var(--hover); }
.status-picker-opt .opt-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.status-picker-foot {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border: 0; background: transparent; padding: 6px 8px; border-radius: 7px;
  font-size: 12px; color: var(--muted); font-weight: 550;
}
.status-picker-foot:hover { background: var(--hover); color: var(--ink); }
.status-picker-foot svg { width: 13px; height: 13px; }

/* Day Presets (+25 to +31 days) */
.import-expiry-box {
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--subtle);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-expiry-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.expiry-resolved-tag { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); }
.day-pills-row, .day-pills-grid { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.day-pill {
  height: 28px; padding: 0 10px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 12px; font-weight: 600; transition: all 0.12s;
}
.day-pill:hover { border-color: var(--line-strong); background: var(--hover); }
.day-pill.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* Modals */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(9, 9, 11, 0.48); backdrop-filter: blur(3px); }
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 55;
  width: min(94vw, 590px); max-height: 89vh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-lg);
}
.modal.modal-lg { width: min(95vw, 880px); }
.modal.modal-sm { width: min(92vw, 410px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-header h2 { margin: 0; font-size: 15px; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--muted); border-radius: 7px;
}
.modal-close:hover { background: var(--hover); color: var(--ink); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 15px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 13px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 11px 18px; border-top: 1px solid var(--line-soft); background: var(--subtle);
  border-radius: 0 0 15px 15px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.import-help-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); }
.preview-header { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.text-danger { color: var(--err); }
.preview-table-wrap { max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.preview-table th, .preview-table td { padding: 6px 9px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.preview-table th { position: sticky; top: 0; background: var(--subtle); color: var(--muted); font-weight: 600; }

.totp-live-preview {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 8px; background: var(--subtle); border: 1px solid var(--line); font-size: 12.5px;
}
.totp-live-preview a { color: var(--ok); text-decoration: none; font-weight: 600; }
.muted-text { margin: 0; color: var(--muted); font-size: 12.5px; }
.confirm-text { margin: 0; color: var(--ink-2); font-size: 13.5px; }

.batch-field-row {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--subtle);
}
.batch-expiry-controls { display: flex; gap: 8px; flex-wrap: wrap; }

.status-add-form { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.status-add-form input[type="text"] { flex: 1; min-width: 180px; }
.color-swatches { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.swatch-btn { width: 19px; height: 19px; border-radius: 50%; border: 2px solid transparent; }
.swatch-btn.active { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }
.status-manage-list { display: flex; flex-direction: column; gap: 7px; }
.status-manage-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  background: var(--subtle); border: 1px solid var(--line); border-radius: 9px;
}
.status-manage-item input[type="text"] { flex: 1; }
.status-manage-item input[type="color"] {
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 7px;
  background: transparent; cursor: pointer; padding: 2px;
}

.settings-section { display: flex; flex-direction: column; gap: 9px; }
.settings-section h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
.sub2-info-box {
  padding: 9px 12px; border-radius: 8px; background: var(--subtle); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-2);
}
.section-actions, .backup-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.divider { border: none; border-top: 1px solid var(--line-soft); margin: 2px 0; }

/* Toast */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 95; display: flex; flex-direction: column; gap: 6px; }
.toast {
  padding: 8px 13px; border-radius: 9px; background: var(--ink); color: var(--bg);
  font-size: 12.5px; font-weight: 500; box-shadow: var(--shadow-md); animation: toastIn 0.14s ease-out;
}
.toast.error { background: var(--err); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1120px) {
  .hide-lg { display: none; }
}
@media (max-width: 900px) {
  .topbar-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .hide-md { display: none; }
  .main-wrap { padding: 12px 14px; }
  .search-box { width: 180px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .btn-icon-md { width: 33px; padding: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .search-box { width: 100%; }
  .filter-right { width: 100%; }
}
