:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #152033;
  --muted: #6d778a;
  --line: #e5eaf2;
  --navy: #101a2e;
  --navy-2: #18243b;
  --blue: #2f6fed;
  --blue-dark: #1d55c4;
  --green: #13a86b;
  --red: #e14d5d;
  --amber: #dc941c;
  --violet: #7657e8;
  --cyan: #1496bb;
  --shadow: 0 14px 36px rgba(21, 32, 51, .08);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 26px 20px;
  display: flex; flex-direction: column; color: #fff;
  background:
    radial-gradient(circle at 10% 15%, rgba(47,111,237,.24), transparent 28%),
    linear-gradient(170deg, var(--navy-2), var(--navy));
}
.brand { display: flex; gap: 12px; align-items: center; padding: 2px 6px 28px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; font-weight: 800; letter-spacing: -.5px;
  background: linear-gradient(135deg, #4385ff, #7259e8); box-shadow: 0 8px 22px rgba(47,111,237,.36);
}
.brand strong { display: block; font-size: 14px; }
.brand span { display: block; margin-top: 3px; font-size: 11px; color: #93a1bb; }
.nav-list { display: grid; gap: 6px; }
.nav-item {
  border: 0; border-radius: 11px; padding: 12px 14px; display: flex; align-items: center; gap: 12px;
  color: #aab6cc; background: transparent; text-align: left; transition: .18s ease;
}
.nav-item span { width: 20px; text-align: center; font-size: 17px; }
.nav-item-count { min-width: 22px; margin-left: auto; padding: 2px 6px; border-radius: 8px; color: #dce7fb; background: rgba(255,255,255,.1); font-size: 9px; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(47,111,237,.18); box-shadow: inset 3px 0 #4d89ff; }
.sidebar-note {
  margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 13px;
  border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.035);
}
.sidebar-note b, .sidebar-note small { display: block; }
.sidebar-note b { font-size: 12px; }
.sidebar-note small { margin-top: 3px; color: #8794aa; font-size: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #27d98b; box-shadow: 0 0 0 5px rgba(39,217,139,.11); }

.main { min-width: 0; padding: 16px clamp(22px, 4vw, 58px) 36px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 10px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }
.topbar h1, .modal-head h2 { margin: 0; letter-spacing: -.7px; }
.topbar h1 { font-size: clamp(25px, 2.6vw, 31px); }
.topbar > div > p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; gap: 10px; }

.button {
  border: 1px solid transparent; border-radius: 9px; min-height: 38px; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12px; font-weight: 700; white-space: nowrap; transition: .18s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(47,111,237,.22); }
.button.primary:hover:not(:disabled) { background: var(--blue-dark); }
.button.secondary { border-color: var(--line); color: #33405a; background: #fff; }
.button.ghost { border-color: #dce4f2; color: #40506d; background: #f8faff; }
.button.danger { color: #fff; background: var(--red); }
.button.danger-soft { color: #c93a4a; border-color: #ffd7dc; background: #fff4f6; }
.button.export { color: #3b4d6f; border-color: #dbe4f5; background: #f5f8fe; }
.button.extract { color: #8a5a00; border-color: #f0c96f; background: #fff5d8; }
.button.mfa { color: #5b3bb6; border-color: #d6c8ff; background: #f3efff; }
.button.deactivation { color: #a02d3d; border-color: #f0bcc4; background: #fff1f3; }
.button.deactivation:hover:not(:disabled) { color: #fff; border-color: #c93a4a; background: #c93a4a; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(115px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat-card {
  position: relative; overflow: hidden; min-height: 82px; padding: 11px 14px;
  border: 1px solid #ebeff6; border-radius: 14px; background: var(--card); box-shadow: 0 5px 18px rgba(29,43,68,.04);
}
.stat-card::after { content: ""; position: absolute; width: 56px; height: 56px; border-radius: 50%; top: -21px; right: -16px; background: currentColor; opacity: .08; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card span { font-size: 11px; font-weight: 700; }
.stat-card strong { display: block; margin: 6px 0 3px; font-size: 22px; line-height: 1; letter-spacing: -1px; }
.stat-card small { font-size: 10px; }
.accent-blue { color: var(--blue); } .accent-violet { color: var(--violet); } .accent-cyan { color: var(--cyan); }
.accent-green { color: var(--green); } .accent-red { color: var(--red); } .accent-amber { color: var(--amber); }
.stat-card span, .stat-card small { color: #737f93; }

.workspace-card { border: 1px solid #e7ebf2; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.toolbar { padding: 11px 18px; display: flex; flex-wrap: wrap; gap: 9px; align-items: center; border-bottom: 1px solid var(--line); }
.search-box { min-width: 230px; flex: 1; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #dde4ef; border-radius: 9px; background: #fbfcfe; }
.search-box span { font-size: 18px; color: #8a95a8; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.toolbar select { height: 38px; padding: 0 30px 0 11px; border: 1px solid #dde4ef; border-radius: 9px; color: #45526b; background: #fff; font-size: 12px; }
.check-mode { height: 38px; display: inline-grid; grid-auto-flow: column; align-items: stretch; padding: 3px; border: 1px solid #dce3ef; border-radius: 9px; background: #f5f7fb; }
.check-mode label { position: relative; min-width: 49px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.check-mode input { position: absolute; opacity: 0; pointer-events: none; }
.check-mode span { min-width: 100%; padding: 0 8px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: #68758b; font-size: 10px; font-weight: 700; white-space: nowrap; }
.check-mode input:checked + span { color: #fff; background: #2f6fed; box-shadow: 0 2px 7px rgba(47,111,237,.2); }
.check-mode input:focus-visible + span { outline: 2px solid #8eb1fa; outline-offset: 1px; }
.toolbar-commands { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.toolbar-commands .button { min-height: 38px; }
.selection-bar { min-height: 40px; padding: 5px 18px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; background: #fbfcff; border-bottom: 1px solid var(--line); }
.selection-bar > div:first-child { flex: 0 0 auto; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 11px; white-space: nowrap; }
.selection-bar b { color: var(--ink); }
.selection-actions { min-width: 0; flex: 1 1 720px; display: flex; flex-wrap: wrap; justify-content: end; gap: 7px; }
.selection-actions .button { min-height: 31px; padding: 0 10px; font-size: 10px; }
.sequential-select-control { flex: 0 0 auto; display: inline-flex; align-items: stretch; gap: 4px; }
.sequential-count-input { width: 64px; min-height: 31px; padding: 0 5px 0 8px; border: 1px solid #dbe3ef; border-radius: 7px; outline: 0; color: #35435b; background: #fff; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sequential-count-input:focus { border-color: #8eb1fa; box-shadow: 0 0 0 3px rgba(47,111,237,.09); }
.sequential-count-input:disabled { color: #a8b0be; background: #f4f6f9; cursor: not-allowed; }
.color-legend { padding: 4px 18px; display: flex; flex-wrap: wrap; justify-content: end; gap: 15px; border-bottom: 1px solid var(--line); color: #7a8597; background: #fff; font-size: 8px; }
.color-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #dfe4ec; }
.dot.white { background: #fff; } .dot.yellow { background: #ffd86c; border-color: #e7b93b; }
.dot.red { background: #ee6575; border-color: #d94d5d; } .dot.green { background: #37be7c; border-color: #1ca462; }
.dot.orange { background: #f59b45; border-color: #d87720; }
.payment-cdk-quick-add { min-height: 41px; padding: 4px 18px; display: grid; grid-template-columns: auto minmax(260px, 1fr) auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); background: #f4fbff; }
.payment-cdk-quick-add > div { min-width: 165px; }
.payment-cdk-quick-add b, .payment-cdk-quick-add span { display: block; }
.payment-cdk-quick-add b { color: #17445f; font-size: 10px; }
.payment-cdk-quick-add span { margin-top: 2px; color: #5d8094; font-size: 8px; }
.payment-cdk-quick-add input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid #bcdbe9; border-radius: 8px; outline: 0; color: #17445f; background: #fff; font-family: Consolas, monospace; font-size: 9px; }
.payment-cdk-quick-add input:focus { border-color: #38a6d6; box-shadow: 0 0 0 3px rgba(56,166,214,.12); }
.button.payment { color: #12658b; border-color: #abd9eb; background: #eaf8ff; }

.table-wrap { position: relative; overflow: auto; min-height: 410px; max-height: calc(100vh - 300px); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead { position: sticky; top: 0; z-index: 2; background: #f7f9fc; }
th { padding: 11px 12px; color: #778196; font-size: 10px; letter-spacing: .35px; text-align: left; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 9px 12px; border-bottom: 1px solid #edf0f5; vertical-align: middle; }
tbody tr { transition: background .15s ease, box-shadow .15s ease; }
tbody tr:hover { box-shadow: inset 4px 0 #b8c9e9; }
tbody tr.selected { background: #f3f7ff; }
tbody tr.extract-white { background: #fff; }
tbody tr.extract-yellow { background: #fff9e8; box-shadow: inset 4px 0 #efbf44; }
tbody tr.extract-red { background: #fff1f3; box-shadow: inset 4px 0 #e45464; }
tbody tr.extract-green { background: #eaf9f1; box-shadow: inset 4px 0 #24aa69; }
tbody tr.extract-orange { background: #fff3e7; box-shadow: inset 4px 0 #ee8b32; }
.check-col { width: 38px; text-align: center; }
.actions-col { width: 580px; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue); }
.row-index { color: #9aa4b5; font-variant-numeric: tabular-nums; }
.account-cell { display: flex; gap: 10px; align-items: center; min-width: 235px; }
.avatar { width: 31px; height: 31px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; color: #3564be; background: #eaf1ff; font-size: 11px; font-weight: 800; }
.account-meta strong, .account-meta small { display: block; max-width: 310px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta strong { color: #27344b; font-size: 11px; }
.account-meta small { margin-top: 4px; color: #949eaf; font-size: 9px; }
.extraction-box { margin-top: 7px; max-width: 430px; display: grid; gap: 4px; }
.payment-link-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.payment-link { display: block; min-width: 0; max-width: 315px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #2b64d8; font-size: 9px; text-decoration: none; }
.payment-link:hover { text-decoration: underline; }
.copy-link-button { flex: 0 0 auto; min-height: 23px; padding: 0 8px; border: 1px solid #a9c1f4; border-radius: 6px; color: #255cc6; background: #f2f6ff; font-size: 8px; font-weight: 800; }
.copy-link-button:hover { color: #fff; background: #2f6fed; }
.extract-state-line { display: flex; flex-wrap: wrap; gap: 7px; color: #69768a; font-size: 9px; }
.extract-state-line b { color: #3d4b62; }
.extract-state-line .paid { color: #0f8e56; }
.extract-state-line .failed { color: #ca3b4b; }
.extract-state-line .expired { color: #aa7312; }
.extract-message { max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #7f899a; font-size: 8px; }
.payment-submit-state { max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #28759a; font-size: 8px; font-weight: 700; }
.payment-submit-state.pay-completed { color: #0f8e56; }
.payment-submit-state.pay-failed, .payment-submit-state.pay-expired { color: #ca3b4b; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.plan-plus { color: #6240c5; background: #eee9ff; }
.plan-free { color: #187fa0; background: #e5f7fb; }
.plan-error { color: #c33c4d; background: #fff0f2; }
.plan-unknown { color: #6e7788; background: #eef1f5; }
.deactivation-deactivated { color: #fff; background: #c93a4a; }
.deactivation-not_found { color: #16724e; background: #e8f7f0; }
.deactivation-error { color: #9a6710; background: #fff1d5; }
.deactivation-unchecked { color: #6e7788; background: #eef1f5; }
.elig-eligible { color: #108351; background: #e5f8ef; }
.elig-ineligible { color: #cb3d4d; background: #ffedf0; }
.elig-unknown { color: #8a6519; background: #fff4dc; }
.time-cell { color: #818c9e; font-size: 10px; white-space: nowrap; }
.row-actions { min-width: 560px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.mini-btn { border: 1px solid #dfe5ef; border-radius: 7px; min-height: 28px; padding: 0 8px; color: #52617b; background: #fff; font-size: 9px; font-weight: 700; white-space: nowrap; }
.mini-btn:hover { color: var(--blue); border-color: #b8cafa; background: #f4f7ff; }
.mini-btn.check { color: #fff; border-color: var(--blue); background: var(--blue); }
.mini-btn.deactivation { color: #a02d3d; border-color: #f0bcc4; background: #fff1f3; }
.mini-btn.deactivation:hover:not(:disabled) { color: #fff; border-color: #c93a4a; background: #c93a4a; }
.mini-btn.extract { min-width: 96px; color: #805400; border-color: #edc65f; background: #fff1be; }
.mini-btn.recheck { min-width: 104px; color: #0c7451; border-color: #a9ddc9; background: #eaf8f2; }
.mini-btn.recheck:hover:not(:disabled) { color: #fff; border-color: #13865a; background: #13865a; }
.mini-btn.payment { color: #12658b; border-color: #abd9eb; background: #eaf8ff; }
.mini-btn.mail { min-width: 46px; color: #176c56; border-color: #b9ded2; background: #effaf6; }
.mini-btn.mail:hover:not(:disabled) { color: #fff; border-color: #198264; background: #198264; }
.mini-btn.subscription { color: #12658b; border-color: #abd9eb; background: #eef9fd; }
.mini-btn.subscription:hover { color: #fff; border-color: #167ba6; background: #167ba6; }
.mini-btn.mfa { color: #5b3bb6; border-color: #d4c7f8; background: #f4f0ff; }
.mini-btn.mfa.enabled { color: #087a4b; border-color: #a9ddc9; background: #eaf8f2; }
.mini-btn.standby { color: #3f5877; border-color: #cbd7e6; background: #f5f8fc; }
.mini-btn.standby:hover { color: #fff; border-color: #526d91; background: #526d91; }
.mini-btn.recycle:hover { color: var(--red); border-color: #f5bdc4; background: #fff7f8; }
.mini-btn.direct-delete { color: #c93a4a; border-color: #f2c4ca; background: #fff4f6; }
.mini-btn.direct-delete:hover { color: #fff; border-color: var(--red); background: var(--red); }
.empty-state { position: absolute; inset: 0; padding: 60px 20px; text-align: center; background: #fff; }
.empty-state > div { color: #aac0ed; font-size: 40px; }
.empty-state h3 { margin: 10px 0 6px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.inventory-footer { padding: 13px 18px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); background: #fcfdff; }
.inventory-footer > div { display: flex; gap: 8px; }

.job-panel { position: fixed; left: 50%; bottom: 22px; z-index: 20; width: min(520px, calc(100vw - 32px)); transform: translateX(-50%); padding: 13px 16px; border: 1px solid #dce4f2; border-radius: 13px; background: rgba(255,255,255,.97); box-shadow: 0 14px 40px rgba(18,32,57,.18); backdrop-filter: blur(12px); }
.job-copy { display: flex; justify-content: space-between; margin-bottom: 9px; font-size: 11px; }
.job-copy span { color: var(--muted); }
.job-reasons { margin: -3px 0 9px; color: #6b7890; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: #e9eef7; }
.progress-track div { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--violet)); transition: width .3s ease; }

dialog { width: min(760px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 17px; box-shadow: 0 28px 80px rgba(10,20,38,.28); }
dialog::backdrop { background: rgba(13,23,41,.58); backdrop-filter: blur(4px); }
.range-select-dialog { width: min(430px, calc(100vw - 28px)); }
.latest-email-dialog { width: min(700px, calc(100vw - 28px)); }
.subscription-dialog { width: min(720px, calc(100vw - 28px)); }
.mfa-dialog { width: min(720px, calc(100vw - 28px)); }
.recycle-bin-dialog { width: min(1080px, calc(100vw - 28px)); }
.modal-card { padding: 25px; background: #fff; }
.modal-card.compact { max-width: 560px; max-height: calc(100vh - 28px); margin: 0 auto; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: start; }
.modal-head h2 { font-size: 23px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #6e788a; background: #f1f4f8; font-size: 20px; }
.modal-hint { margin: 14px 0 18px; padding: 12px 14px; border-radius: 10px; color: #5d6c85; background: #f4f7fd; font-size: 11px; line-height: 1.7; }
.import-position-hint { margin: -8px 0 14px; color: #52647e; font-size: 11px; font-weight: 700; }
.field-label { display: block; margin: 13px 0 7px; color: #35435b; font-size: 11px; font-weight: 800; }
.field-row { display: flex; justify-content: space-between; align-items: end; }
.field-row span { color: #8a95a8; font-size: 9px; }
textarea, .text-input { width: 100%; border: 1px solid #dce3ef; border-radius: 10px; outline: 0; color: #2b3850; background: #fbfcfe; }
textarea { padding: 12px; resize: vertical; min-height: 120px; font-family: Consolas, "SFMono-Regular", monospace; font-size: 10px; line-height: 1.55; }
.cdk-input { min-height: 76px; }
.text-input { height: 42px; padding: 0 12px; font-size: 12px; }
textarea:focus, .text-input:focus { border-color: #8eb1fa; box-shadow: 0 0 0 3px rgba(47,111,237,.09); }
.range-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.range-fields label { min-width: 0; display: grid; gap: 7px; color: #35435b; font-size: 11px; font-weight: 800; }
.recycle-bin-card { max-height: calc(100vh - 28px); display: flex; flex-direction: column; overflow: hidden; }
.recycle-selection-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.recycle-selection-bar > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.recycle-selection-bar > div { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.stored-selection-actions { margin-bottom: 10px; padding: 9px; justify-content: start; border: 1px solid var(--line); border-radius: 8px; background: #fbfcff; }
.stored-filter-bar { margin-bottom: 10px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.stored-filter-bar label { min-width: min(390px, 100%); display: grid; gap: 6px; color: #4f5d74; font-size: 10px; font-weight: 800; }
.stored-filter-bar select { height: 36px; padding: 0 32px 0 11px; border: 1px solid #dce3ef; border-radius: 8px; color: #45526b; background: #fff; font-size: 11px; }
.stored-filter-bar > span { padding-bottom: 9px; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.recycle-table-wrap { position: relative; min-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.recycle-table { min-width: 760px; }
.invalid-token-table { min-width: 980px; }
.recycle-table .account-cell { min-width: 260px; }
.recycle-table .account-meta strong { max-width: 330px; }
.stored-copy-cell { width: 1%; white-space: nowrap; }
.stored-copy-actions { min-width: 160px; display: flex; align-items: center; gap: 5px; }
.invalid-token-avatar { color: #bd3545; background: #fff0f2; }
.invalid-token-reason { min-width: 190px; max-width: 280px; overflow: hidden; color: #bd3545; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.recycle-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: #fff; font-size: 12px; }
.recycle-empty[hidden] { display: none; }
.recycle-footer { align-items: center; }
.latest-email-card { max-height: calc(100vh - 28px); display: flex; flex-direction: column; overflow: hidden; }
.latest-email-account { margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.latest-email-tabs { align-self: flex-start; margin-bottom: 12px; padding: 3px; display: inline-flex; gap: 3px; border: 1px solid #dce3ef; border-radius: 8px; background: #f5f7fa; }
.latest-email-tab { min-width: 92px; height: 32px; padding: 0 13px; border: 0; border-radius: 6px; color: #657187; background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.latest-email-tab:hover { color: #25334a; background: #e9edf3; }
.latest-email-tab.active { color: #fff; background: #26364f; }
.latest-email-tab:focus-visible { outline: 2px solid #3c77d8; outline-offset: 2px; }
.latest-email-refresh { width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 6px; color: #3d557a; background: #e6ecf5; font-size: 19px; line-height: 1; }
.latest-email-refresh:hover { color: #fff; background: #3d557a; }
.latest-email-refresh:focus-visible { outline: 2px solid #3c77d8; outline-offset: 2px; }
.latest-email-status { min-height: 180px; display: grid; place-items: center; padding: 24px; border: 1px solid var(--line); border-radius: 8px; color: #637087; background: #fafbfd; font-size: 12px; text-align: center; }
.latest-email-status[hidden], .latest-email-content[hidden], .all-email-content[hidden] { display: none; }
.latest-email-status.error { color: #bd3545; border-color: #f2c6cc; background: #fff5f6; }
.latest-email-content { min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.latest-email-content h3 { margin: 0; padding: 15px 17px 9px; color: #25334a; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.latest-email-meta { padding: 0 17px 13px; display: flex; flex-wrap: wrap; gap: 7px 18px; border-bottom: 1px solid var(--line); color: #758196; font-size: 10px; }
.latest-email-body { max-height: min(430px, calc(100vh - 310px)); overflow: auto; padding: 17px; color: #3f4d63; background: #fcfdff; font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.all-email-content { min-height: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.all-email-heading { padding: 11px 15px; border-bottom: 1px solid var(--line); color: #536178; background: #f8fafc; font-size: 11px; }
.all-email-list { max-height: min(460px, calc(100vh - 340px)); overflow-y: auto; }
.all-email-item { border-bottom: 1px solid var(--line); }
.all-email-item:last-child { border-bottom: 0; }
.all-email-item[open] { background: #fcfdff; }
.all-email-summary { padding: 13px 15px; color: #344158; cursor: pointer; }
.all-email-summary::marker { color: #7a8799; }
.all-email-summary strong { margin-left: 4px; display: inline; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.all-email-summary-meta { margin: 7px 0 0 17px; display: flex; flex-wrap: wrap; gap: 5px 16px; color: #7a8799; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.all-email-body { padding: 15px 17px 17px; border-top: 1px solid #edf1f6; color: #3f4d63; background: #fff; font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.subscription-card { max-height: calc(100vh - 28px); overflow-y: auto; }
.subscription-summary { margin-top: 16px; padding-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.subscription-summary strong { min-width: 0; overflow: hidden; color: #293750; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.subscription-summary span { flex: 0 0 auto; color: #7b8799; font-size: 9px; }
.subscription-empty { margin: 18px 0 2px; padding: 18px; color: #7b8799; border: 1px dashed #cbd5e2; background: #f8fafc; font-size: 11px; text-align: center; }
.subscription-empty[hidden], .subscription-detail-grid[hidden] { display: none; }
.subscription-detail-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.subscription-detail-grid > div { min-width: 0; padding: 15px 8px 14px 0; border-bottom: 1px solid var(--line); }
.subscription-detail-grid > div:nth-child(even) { padding-right: 0; padding-left: 18px; border-left: 1px solid var(--line); }
.subscription-detail-grid dt { margin: 0 0 6px; color: #7b8799; font-size: 9px; font-weight: 800; }
.subscription-detail-grid dd { margin: 0; color: #293750; font-size: 12px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.mfa-card { max-height: calc(100vh - 28px); overflow-y: auto; }
.mfa-card [hidden] { display: none !important; }
.mfa-account-line { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mfa-account-line > div { min-width: 0; display: flex; align-items: center; gap: 10px; }
.mfa-account-line strong { min-width: 0; overflow: hidden; color: #293750; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.mfa-account-line small { flex: 0 0 auto; color: #7b8799; font-size: 9px; }
.mfa-none { color: #6e7788; background: #eef1f5; }
.mfa-enrolling { color: #8a6519; background: #fff4dc; }
.mfa-enabled { color: #108351; background: #e5f8ef; }
.mfa-external { color: #176c8d; background: #e7f5fb; }
.mfa-error, .mfa-locked { color: #c33c4d; background: #fff0f2; }
.mfa-code-panel { margin-top: 18px; padding: 18px 0; text-align: center; border-block: 1px solid var(--line); }
.mfa-code-panel[hidden], .mfa-secret-panel[hidden], #mfa-error[hidden] { display: none; }
.mfa-code { min-height: 52px; display: grid; place-items: center; color: #273e78; font-family: Consolas, "SFMono-Regular", monospace; font-size: 38px; font-weight: 800; letter-spacing: 0; font-variant-numeric: tabular-nums; cursor: pointer; }
.otp-progress { width: min(360px, 80%); height: 5px; margin: 10px auto 7px; overflow: hidden; border-radius: 999px; background: #e9eef7; }
.otp-progress > div { width: 100%; height: 100%; border-radius: inherit; background: var(--blue); transition: width 1s linear; }
.mfa-code-panel small { color: #7b8799; font-size: 9px; }
.mfa-secret-panel { margin-top: 18px; display: grid; grid-template-columns: 164px minmax(0, 1fr); gap: 18px; align-items: start; }
.mfa-secret-panel img { width: 164px; height: 164px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; object-fit: contain; }
.copy-field { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.copy-field input { width: 100%; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid #dce3ef; border-radius: 8px; outline: 0; color: #2b3850; background: #fbfcfe; font-family: Consolas, "SFMono-Regular", monospace; font-size: 10px; }
.copy-field input:focus { border-color: #8eb1fa; box-shadow: 0 0 0 3px rgba(47,111,237,.09); }
.copy-field .button { min-height: 38px; }
.mfa-import-panel { margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.mfa-import-panel summary { color: #526078; font-size: 10px; font-weight: 800; cursor: pointer; }
.mfa-import-panel .copy-field { margin-top: 10px; }
.provider-settings { margin-top: 17px; padding: 14px; border: 1px solid #dce4f2; border-radius: 8px; background: #fbfcff; }
.provider-fields { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; }
.provider-fields label { min-width: 0; display: grid; gap: 5px; color: #4c5970; font-size: 9px; font-weight: 700; }
.provider-fields .text-input { height: 36px; font-size: 10px; }
.provider-fields .button { min-height: 36px; }
.worker-indicator { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: #aeb7c5; box-shadow: 0 0 0 4px rgba(139,151,169,.12); }
.worker-indicator.ok { background: #13a86b; box-shadow: 0 0 0 4px rgba(19,168,107,.12); }
.worker-indicator.error { background: #e14d5d; box-shadow: 0 0 0 4px rgba(225,77,93,.12); }
.provider-settings .connection-state { margin-top: 9px; }
.browser-settings { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--line); }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.settings-section-head h3 { margin: 0; color: #293750; font-size: 13px; }
.settings-section-head > div > span { display: block; margin-top: 4px; color: #7b8799; font-size: 9px; }
.browser-mode { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid #dce3ef; border-radius: 9px; background: #f5f7fb; }
.browser-mode label { position: relative; min-height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.browser-mode input { position: absolute; opacity: 0; pointer-events: none; }
.browser-mode span { width: 100%; height: 100%; padding: 0 10px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: #68758b; font-size: 10px; font-weight: 700; }
.browser-mode input:checked + span { color: #fff; background: var(--blue); box-shadow: 0 2px 7px rgba(47,111,237,.2); }
.browser-mode input:focus-visible + span { outline: 2px solid #8eb1fa; outline-offset: 1px; }
.browser-fields { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.browser-fields label { min-width: 0; display: grid; gap: 5px; color: #4c5970; font-size: 9px; font-weight: 700; }
.browser-fields .wide { grid-column: 1 / -1; }
.browser-fields .text-input { height: 36px; font-size: 10px; }
.browser-fields .disabled { opacity: .45; }
.switch-control { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: #526078; font-size: 9px; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control > span { position: relative; width: 32px; height: 18px; flex: 0 0 auto; border-radius: 999px; background: #cfd7e4; transition: .18s ease; }
.switch-control > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(28,42,66,.25); transition: .18s ease; }
.switch-control input:checked + span { background: var(--blue); }
.switch-control input:checked + span::after { transform: translateX(14px); }
.switch-control input:focus-visible + span { outline: 2px solid #8eb1fa; outline-offset: 2px; }
.switch-control b { font-weight: 700; white-space: nowrap; }
.connection-state { margin-top: 13px; padding: 9px 11px; border-radius: 8px; color: #68748a; background: #f5f7fa; font-size: 10px; }
.connection-state.ok { color: #11764c; background: #e9f8f1; }
.connection-state.error { color: #bd3545; background: #fff0f2; }
.modal-actions { margin-top: 20px; display: flex; justify-content: end; gap: 8px; }
.modal-actions.split { justify-content: space-between; }
.modal-actions.split > div { display: flex; gap: 8px; }

.toast { position: fixed; z-index: 50; right: 24px; top: 24px; max-width: min(420px, calc(100vw - 48px)); padding: 12px 15px; border-radius: 10px; color: #fff; background: #22314a; box-shadow: 0 12px 34px rgba(16,26,46,.22); font-size: 11px; line-height: 1.5; }
.toast.error { background: #c84151; }
.toast.success { background: #13865a; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .toolbar { flex-wrap: wrap; }
  .search-box { min-width: 100%; }
  .check-mode { flex: 1; }
  .toolbar-commands { margin-left: 0; }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 15px 18px; flex-direction: row; align-items: center; gap: 14px; }
  .brand { padding: 0; }
  .brand span, .sidebar-note { display: none; }
  .nav-list { min-width: 0; margin-left: auto; display: flex; overflow-x: auto; scrollbar-width: none; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-item { padding: 9px 10px; font-size: 0; }
  .nav-item span { font-size: 16px; }
  .nav-item-count { min-width: 18px; margin-left: -8px; padding: 2px 4px; font-size: 8px; }
  .main { padding: 24px 15px 50px; }
  .topbar { align-items: start; }
  .top-actions .secondary { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .selection-bar, .inventory-footer { align-items: stretch; flex-direction: column; }
  .payment-cdk-quick-add, .provider-fields { grid-template-columns: 1fr; }
  .selection-actions { width: 100%; flex: 0 0 auto; justify-content: start; }
  .selection-actions .button { min-height: 36px; }
  .sequential-count-input { min-height: 36px; }
  .selection-actions, .inventory-footer > div { flex-wrap: wrap; }
  .toolbar-commands { width: 100%; flex-wrap: wrap; }
  .toolbar-commands .button { flex: 1; }
  .browser-fields { grid-template-columns: 1fr; }
  .range-fields { grid-template-columns: 1fr; }
  .recycle-selection-bar { align-items: stretch; flex-direction: column; }
  .recycle-selection-bar > div { justify-content: start; }
  .stored-filter-bar { align-items: stretch; flex-direction: column; }
  .stored-filter-bar label { min-width: 0; }
  .stored-filter-bar > span { padding-bottom: 0; }
  .recycle-footer { align-items: stretch; flex-direction: column-reverse; }
  .recycle-footer .button { width: 100%; }
  .browser-fields .wide { grid-column: auto; }
  .actions-col { min-width: 560px; }
  .table-wrap { max-height: none; }
}
@media (max-width: 520px) {
  .sidebar { padding-inline: 12px; gap: 8px; }
  .brand > div:last-child { display: none; }
  .nav-list { gap: 2px; }
  .nav-item { padding-inline: 7px; }
  .recycle-bin-card { padding: 18px 14px; }
  .latest-email-card { padding: 18px 14px; }
  .subscription-card { padding: 18px 14px; }
  .subscription-summary { align-items: start; flex-direction: column; }
  .subscription-detail-grid { grid-template-columns: 1fr; }
  .subscription-detail-grid > div, .subscription-detail-grid > div:nth-child(even) { padding: 13px 0; border-left: 0; }
  .mfa-card { padding: 18px 14px; }
  .mfa-account-line { align-items: start; flex-direction: column; }
  .mfa-secret-panel { grid-template-columns: 1fr; }
  .mfa-secret-panel img { margin-inline: auto; }
  .mfa-code { font-size: 32px; }
  .mfa-card .modal-actions.split { align-items: stretch; flex-direction: column; }
  .mfa-card .modal-actions.split > div { display: grid; }
  .latest-email-body { max-height: calc(100vh - 330px); }
  .latest-email-tabs { width: 100%; }
  .latest-email-tab { min-width: 0; flex: 1 1 0; }
  .all-email-list { max-height: calc(100vh - 370px); }
}
