:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #172033;
  --muted: #687386;
  --line: #e2e7ef;
  --line-strong: #cfd6e2;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --success: #138a60;
  --success-soft: #e8f7f1;
  --danger: #c43d4d;
  --danger-soft: #fff0f2;
  --shadow: 0 14px 40px rgba(31, 42, 68, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -10%, rgba(79, 70, 229, .08), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 76px;
  border-bottom: 1px solid rgba(226, 231, 239, .88);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px);
}
.topbar-shell {
  width: min(1540px, calc(100% - 48px));
  height: 100%;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 38px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.brand-mark, .login-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #fff;
  border-radius: 12px;
  background: linear-gradient(145deg, #7068f4, #4338ca);
  box-shadow: 0 8px 20px rgba(79, 70, 229, .25);
  font-weight: 850;
  font-size: 19px;
}
.brand > span:last-child, .user-meta { display: grid; line-height: 1.2; }
.brand strong { font-size: 16px; letter-spacing: -.01em; }
.brand small, .user-meta small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.main-nav { display: flex; align-self: stretch; align-items: center; gap: 4px; }
.main-nav a {
  position: relative;
  padding: 12px 15px;
  color: #596579;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  transition: .18s ease;
}
.main-nav a:hover { color: var(--primary); background: var(--primary-soft); }
.main-nav a.active { color: var(--primary); }
.main-nav a.active::after { content: ""; position: absolute; left: 15px; right: 15px; bottom: -14px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.user-area { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(31, 42, 68, .06);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.theme-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, .2); }
.theme-toggle-icon { font-size: 20px; line-height: 1; transform: translateY(-1px); }
.theme-toggle + .user-area { margin-left: 0; }
.user-area form { margin: 0 0 0 5px; }
.balance-chip {
  display: grid;
  gap: 1px;
  min-width: 92px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
  line-height: 1.15;
}
.balance-chip span { color: var(--muted); font-size: 9px; }
.balance-chip strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.balance-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.user-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--primary-dark); background: var(--primary-soft); font-weight: 800; }
.user-meta strong { font-size: 13px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 17px; text-decoration: none; }
.icon-button:hover { color: var(--danger); border-color: #f1bbc2; background: var(--danger-soft); }
.account-button:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.guide-button { display: none; }

main { width: min(1540px, calc(100% - 48px)); margin: auto; padding: 42px 0 60px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 3vw, 46px); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 17px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #24b47e; box-shadow: 0 0 0 4px rgba(36, 180, 126, .12); }
.page-heading, .hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 28px; margin-bottom: 28px; }
.page-heading > div:first-child { max-width: 800px; }
.page-heading p, .hero p { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 16px; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.heading-actions form { margin: 0; }
.table-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.badge, .pill, .success-badge, .warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.setup-panel { grid-column: 1 / -1; }
.text-panel { align-self: stretch; }
.text-panel > .panel-header { min-height: 52px; }
.workspace-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.source-anonymize-action { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.panel, .card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.account-layout { width: min(720px, 100%); margin: 0 auto; }
.account-card { padding: 30px; }
.account-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.account-actions .button { width: auto; min-width: 150px; margin-top: 0; }
.settings-layout { width: min(1180px, 100%); margin: 0 auto; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.settings-card { min-width: 0; }
.settings-card .stack { margin-top: 18px; }
.current-setting {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.current-setting span, .current-setting small { color: var(--muted); font-size: 10px; }
.current-setting strong { overflow-wrap: anywhere; font-size: 14px; }
.prompt-settings-card { grid-column: 1 / -1; }
.settings-security-note {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid #dcd9ff;
  border-radius: 11px;
  color: #5148bf;
  background: var(--primary-soft);
  font-size: 11px;
}
.prompt-settings-form { display: grid; gap: 18px; }
.prompt-create-panel { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.prompt-create-panel summary { cursor: pointer; color: var(--primary); font-size: 11px; font-weight: 800; }
.prompt-create-panel .stack { margin-top: 14px; }
.prompt-editor > label { display: grid; gap: 6px; margin-bottom: 10px; }
.prompt-editor > label > span { color: var(--muted); font-size: 10px; font-weight: 750; }
.prompt-picker-row {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(280px, 1.2fr);
  align-items: end;
  gap: 16px;
}
.prompt-picker-control { display: grid; gap: 7px; }
.prompt-picker-control > span { color: var(--muted); font-size: 10px; font-weight: 750; }
.prompt-picker-control .custom-select { width: 100%; }
.prompt-picker-summary {
  display: grid;
  gap: 3px;
  min-height: 42px;
  padding: 8px 0;
}
.prompt-picker-summary strong { font-size: 11px; }
.prompt-picker-summary span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.prompt-automatic-note {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border-left: 3px solid #8179f5;
  border-radius: 0 11px 11px 0;
  background: #f4f2ff;
}
.prompt-automatic-note strong { color: #5148bf; font-size: 10px; }
.prompt-automatic-note span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.prompt-editor-stage {
  min-height: 250px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}
.prompt-editor-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 248px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.prompt-editor-empty > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 850;
}
.prompt-editor-empty strong { color: var(--ink); font-size: 13px; }
.prompt-editor-empty p { margin: 4px 0 0; font-size: 10px; }
.prompt-editor {
  padding: 17px;
  border: 0;
  background: transparent;
}
.prompt-editor[hidden], .prompt-editor-empty[hidden] { display: none; }
.prompt-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.prompt-editor-head > div { display: grid; gap: 3px; }
.prompt-editor-head strong { font-size: 13px; }
.prompt-editor-head span:not(.prompt-state) { color: var(--muted); font-size: 10px; }
.prompt-state {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #e9edf4;
  font-size: 9px;
  font-weight: 800;
}
.prompt-state.custom { color: #5148bf; background: #e7e5ff; }
.prompt-editor textarea {
  min-height: 170px;
  padding: 13px;
  resize: vertical;
  font: 12px/1.55 Inter, system-ui, sans-serif;
}
.prompt-editor textarea[hidden] { display: none; }
.prompt-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.prompt-editor-actions small { color: var(--muted); font-size: 9px; }
.subscription-layout, .admin-billing-layout { width: min(1180px, 100%); margin: 0 auto; }
.balance-card, .invitation-result, .scheduled-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.balance-card-copy, .scheduled-plan { display: flex; align-items: center; }
.balance-card-copy { gap: 14px; min-width: 0; }
.balance-icon, .scheduled-plan-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 21px;
  font-weight: 850;
}
.balance-card-copy > div, .invitation-result > div, .scheduled-plan > div { display: grid; gap: 2px; min-width: 0; }
.balance-card-copy span, .invitation-result span, .scheduled-plan span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.balance-card-copy strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.balance-card-copy p, .invitation-result p, .scheduled-plan p { margin: 0; color: var(--muted); font-size: 10px; }
.balance-card .button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.auto-renew-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.auto-renew-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.auto-renew-copy > div { display: grid; gap: 3px; min-width: 0; }
.auto-renew-copy > div > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.auto-renew-copy strong { font-size: 17px; }
.auto-renew-copy p { margin: 0; color: var(--muted); font-size: 10px; }
.auto-renew-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; color: var(--success); background: var(--success-soft); font-size: 22px; font-weight: 850; }
.auto-renew-card form { flex: 0 0 auto; }
.renewal-issue { margin-bottom: 16px; }
.balance-adjustment-card { margin-bottom: 20px; }
.balance-adjustment-form { display: grid; grid-template-columns: minmax(240px, 1.15fr) minmax(190px, .62fr) minmax(300px, 1.35fr) auto; gap: 14px; align-items: start; }
.balance-adjustment-form label { display: grid; gap: 6px; min-width: 0; }
.balance-adjustment-form label > span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.balance-adjustment-form input, .balance-adjustment-form .custom-select { width: 100%; min-width: 0; }
.balance-adjustment-form small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.balance-adjustment-form > .button { min-height: 42px; margin-top: 21px; white-space: nowrap; }
.invitation-result { border-color: #9edbc5; background: var(--success-soft); }
.invitation-result strong { overflow-wrap: anywhere; color: var(--success); font: 11px/1.45 "Cascadia Code", Consolas, monospace; }
.scheduled-plan { justify-content: flex-start; border-color: #cfcaff; background: var(--primary-soft); }
.scheduled-plan strong { font-size: 14px; }
.subscription-bypass, .subscription-empty {
  display: flex;
  align-items: center;
  gap: 16px;
}
.subscription-empty > span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 15px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 22px;
  font-weight: 800;
}
.subscription-empty h2, .subscription-bypass h2 { margin-bottom: 4px; }
.subscription-empty p, .subscription-bypass p { margin: 0; color: var(--muted); }
.subscription-summary { margin-bottom: 22px; }
.subscription-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.subscription-summary-head > div > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.subscription-summary-head h2 { margin: 3px 0; }
.subscription-summary-head p { margin: 0; color: var(--muted); font-size: 11px; }
.subscription-state, .group-role {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 9px;
  font-weight: 850;
}
.quota-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(180px, .55fr); gap: 14px; }
.quota-card {
  display: grid;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.quota-card > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.quota-card span, .quota-card small { color: var(--muted); font-size: 9px; }
.quota-card strong { font-size: 13px; }
.quota-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e5e8ef; }
.quota-track span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: linear-gradient(90deg, #635bdf, #8a83ff); }
.quota-card.compact { align-content: center; }
.group-create-card, .group-card { margin-top: 22px; }
.subscription-inline { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 10px; }
.subscription-inline .button { width: auto; margin: 0; }
.group-invite-note { margin: 8px 0 2px; color: var(--muted); font-size: 9px; }
.member-list, .billing-plan-list, .billing-order-list { display: grid; }
.member-list article, .billing-plan-list article, .billing-order-list article {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
}
.member-role-form { margin-left: auto; }
.member-list article:last-child, .billing-plan-list article:last-child, .billing-order-list article:last-child { border-bottom: 0; }
.member-list article > div, .billing-plan-list article > div, .billing-order-list article > div { display: grid; gap: 2px; min-width: 0; flex: 1; }
.member-list strong, .billing-plan-list strong, .billing-order-list strong { overflow-wrap: anywhere; font-size: 12px; }
.member-list small, .billing-plan-list span, .billing-order-list span { color: var(--muted); font-size: 9px; }
.danger-text { color: var(--danger)!important; }
.group-leave-form { display: flex; justify-content: flex-end; margin-top: 14px; }
.expired-group-leave {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
}
.expired-group-leave .button { width: auto; margin: 0; }
.order-history { display: grid; gap: 6px; margin: 14px 0 20px; color: var(--muted); font-size: 10px; }
.renewal-plans > p { color: var(--muted); font-size: 10px; }
.renewal-plan-list { display: grid; gap: 10px; margin-top: 14px; }
.renewal-plan-list > form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(340px, 1.35fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.renewal-plan-list > form > span { display: grid; }
.renewal-plan-list > form > span small { color: var(--muted); font-size: 9px; }
.activation-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.activation-choice legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.activation-choice label { position: relative; cursor: pointer; }
.activation-choice input { position: absolute; opacity: 0; pointer-events: none; }
.activation-choice label > span {
  display: grid;
  gap: 1px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition: .16s ease;
}
.activation-choice label > span strong { font-size: 10px; }
.activation-choice label > span small { color: var(--muted); font-size: 8px; }
.activation-choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px rgba(79, 70, 229, .09); }
.activation-choice input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.plan-card { display: grid; align-content: start; gap: 16px; }
.plan-card-head > span { color: var(--primary); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.plan-card-head h2 { margin: 5px 0; }
.plan-card-head p { min-height: 34px; margin: 0; color: var(--muted); font-size: 10px; }
.plan-price { font-size: 24px; }
.plan-price small { color: var(--muted); font-size: 10px; font-weight: 500; }
.plan-card ul { display: grid; gap: 8px; min-height: 80px; margin: 0; padding: 0; list-style: none; }
.plan-card li { color: var(--muted); font-size: 10px; }
.plan-card li::before { content: "✓"; margin-right: 7px; color: var(--success); font-weight: 900; }
.plan-card form, .plan-card .button { width: 100%; margin: 0; }
.no-plans { grid-column: 1 / -1; text-align: center; }
.guide-layout { width: min(1180px, 100%); margin: 0 auto; }
.guide-heading { align-items: center; }
.guide-heading .button { flex: 0 0 auto; }
.guide-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.guide-step { display: flex; align-items: flex-start; gap: 12px; padding: 18px; }
.guide-step > span {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 850;
}
.guide-step h2 { margin-bottom: 5px; font-size: 14px; }
.guide-step p { margin: 0; color: var(--muted); font-size: 10px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.guide-card ul { display: grid; gap: 9px; margin: 18px 0 0; padding: 0; list-style: none; }
.guide-card li { position: relative; padding-left: 18px; color: var(--muted); font-size: 11px; }
.guide-card li::before { content: "•"; position: absolute; left: 3px; color: var(--primary); font-weight: 900; }
.guide-note { display: flex; gap: 14px; margin-top: 18px; }
.guide-note strong { color: var(--primary); }
.guide-note p { margin: 0; color: var(--muted); font-size: 11px; }
.invitation-layout { display: grid; place-items: center; min-height: calc(100vh - 180px); }
.invitation-card { width: min(540px, 100%); }
.invitation-card .login-mark { margin-bottom: 18px; }
.invitation-card h1 { margin-bottom: 10px; font-size: 30px; }
.invitation-card > p { color: var(--muted); }
.invitation-security { margin-top: 14px; padding: 10px 12px; border-radius: 10px; color: var(--success); background: var(--success-soft); font-size: 10px; }
.admin-billing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.billing-orders { margin-top: 20px; }
.billing-order-list article { align-items: center; }
.billing-order-list .inline { display: flex; flex: 0 1 520px; }
.billing-order-list .inline input { flex: 1; }
.billing-order-list .button { margin: 0; white-space: nowrap; }
.renewal-plans { margin-top: 22px; }
.renewal-plans > summary { cursor: pointer; color: var(--primary); font-size: 11px; font-weight: 800; }
.renewal-plans > p { color: var(--muted); font-size: 10px; }
.renewal-plan-list { display: grid; gap: 8px; margin-top: 14px; }
.renewal-plan-list form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(340px, 1.35fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.renewal-plan-list form > span { display: grid; gap: 2px; min-width: 0; }
.renewal-plan-list small { color: var(--muted); font-size: 9px; }
.renewal-plan-list .button { width: auto; margin: 0; }
.panel-header, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.panel-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.step { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: 13px; font-weight: 850; }
.profile-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

input, select {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus { border-color: #8179f5; box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.profile-control select { min-height: 36px; padding: 7px 30px 7px 10px; border-color: var(--line); background-color: var(--surface-soft); font-size: 12px; font-weight: 700; }
.custom-select { position: relative; min-width: 150px; font: inherit; }
.custom-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px 9px 14px;
  border: 1px solid #d8d5f1;
  border-radius: 12px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff, #f8f7ff);
  box-shadow: 0 4px 12px rgba(67, 56, 202, .06);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.custom-select-trigger:hover { border-color: #a8a1f3; background: #f7f5ff; }
.custom-select.open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  outline: none;
  border-color: #8179f5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .13), 0 8px 20px rgba(67, 56, 202, .1);
}
.custom-select-arrow {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .18s;
}
.custom-select.open .custom-select-arrow { transform: translateY(2px) rotate(225deg); }
.custom-select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  right: 0;
  width: max(100%, 230px);
  max-width: min(390px, calc(100vw - 40px));
  padding: 6px;
  border: 1px solid #dcd8f5;
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 42px rgba(38, 31, 94, .18);
  backdrop-filter: blur(16px);
}
.custom-select-menu[hidden] { display: none; }
.custom-select-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  color: #384158;
  background: transparent;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.custom-select-option:hover,
.custom-select-option:focus-visible {
  outline: none;
  color: #332a9e;
  background: var(--primary-soft);
}
.custom-select-option.selected {
  color: #fff;
  background: linear-gradient(135deg, #6f65ef, #4f46e5);
}
.custom-select-option-label { font-weight: 780; }
.custom-select-option-description {
  max-height: 0;
  overflow: hidden;
  color: #6f7890;
  font-size: 10px;
  font-weight: 520;
  line-height: 1.45;
  opacity: 0;
  transition: max-height .18s, opacity .18s, margin .18s;
}
.custom-select-option:hover .custom-select-option-description,
.custom-select-option:focus-visible .custom-select-option-description {
  max-height: 70px;
  margin-top: 2px;
  opacity: 1;
}
.custom-select-option.selected .custom-select-option-description { color: #e4e1ff; }
.custom-select.disabled { opacity: .58; }
.custom-select.disabled .custom-select-trigger { cursor: not-allowed; }
.profile-control .custom-select { width: 190px; }
.profile-control .custom-select-trigger { min-height: 38px; }
.external-review-select .custom-select { width: 100%; }

.upload-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 16px;
  border: 1.5px dashed #bdc6d5;
  border-radius: 14px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: .18s ease;
}
.upload-zone:hover, .upload-zone.dragging { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone.extracting { border-color: #8b84f7; background: #f2f1ff; cursor: wait; }
.upload-zone.extracted { border-color: #8ed7bc; background: var(--success-soft); }
.upload-zone.extract-error { border-color: #efadb5; background: var(--danger-soft); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { display: grid; place-items: center; width: 50px; height: 50px; flex: 0 0 50px; border: 1px solid #dfe2ff; border-radius: 14px; background: #fff; color: var(--primary); }
.upload-icon svg { width: 35px; height: 35px; overflow: visible; }
.upload-icon path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.upload-document { stroke-width: 2.2; opacity: .38; }
.upload-fold { stroke-width: 2.2; opacity: .62; }
.upload-arrow { stroke-width: 3; }
.upload-copy { display: grid; min-width: 0; margin-right: auto; }
.upload-copy strong { font-size: 13px; }
.upload-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 10px; padding: 6px 9px; border-radius: 8px; color: var(--success); background: var(--success-soft); font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.extraction-progress { margin-top: 10px; padding: 11px 12px; border: 1px solid #dcd9ff; border-radius: 11px; background: #f7f6ff; }
.extraction-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: #4d45bd; font-size: 11px; }
.extraction-progress-head span { flex: 0 0 auto; color: #7770c9; font-variant-numeric: tabular-nums; }
.progress-track { position: relative; height: 7px; overflow: hidden; border-radius: 999px; background: #e6e3ff; }
.progress-track > span { position: absolute; inset: 0 auto 0 -35%; width: 35%; border-radius: inherit; background: linear-gradient(90deg, #8179f5, #4f46e5); animation: extraction-progress 1.35s ease-in-out infinite; }
.extraction-progress.complete { border-color: #bfe8d8; background: var(--success-soft); }
.extraction-progress.complete .extraction-progress-head { color: var(--success); }
.extraction-progress.complete .progress-track { background: #d9f1e7; }
.extraction-progress.complete .progress-track > span { inset: 0; width: 100%; background: var(--success); animation: none; }
.extraction-progress.failed { border-color: #f1c1c7; background: var(--danger-soft); }
.extraction-progress.failed .extraction-progress-head { color: var(--danger); }
.extraction-progress.failed .progress-track > span { display: none; }
.extraction-progress small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
@keyframes extraction-progress { 0% { left: -35%; } 55% { left: 70%; } 100% { left: 105%; } }
@media (prefers-reduced-motion: reduce) { .progress-track > span { animation-duration: 2.8s; } }
.upload-status { margin-top: 9px; padding: 8px 10px; border-radius: 9px; font-size: 11px; font-weight: 650; }
.upload-status.processing { color: #5349cb; background: #f0efff; }
.upload-status.success { color: var(--success); background: var(--success-soft); }
.upload-status.error { color: var(--danger); background: var(--danger-soft); }
.separator { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #8993a4; font-size: 11px; }
.separator::before, .separator::after { content: ""; height: 1px; background: var(--line); flex: 1; }
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: none;
  background: #fbfcfe;
  color: var(--ink);
  line-height: 1.65;
  transition: border-color .18s, box-shadow .18s;
}
.document-text { min-height: 390px; padding: 16px; font: 13px/1.65 "Cascadia Code", Consolas, ui-monospace, monospace; }
.comparison-text { height: 560px; min-height: 560px; max-height: 560px; overflow-y: auto; overflow-x: hidden; resize: none; scrollbar-gutter: stable; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.comparison-text[hidden] { display: none; }
.text-pane-toolbar { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.text-pane-toolbar > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.replacement-legend { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 7px; color: #0b6b52; background: #e4f8f1; font-weight: 750; }
.replacement-legend[hidden] { display: none; }
.replacement-legend i { width: 7px; height: 7px; border-radius: 2px; background: #25a77d; }
.potential-legend { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 7px; color: #9f2635; background: #fff0f2; font-weight: 750; }
.potential-legend[hidden] { display: none; }
.potential-legend i { width: 7px; height: 7px; border-radius: 2px; background: #e5485b; }
.result-text { background: #f8fafc; }
.source-comparison { border: 1px solid var(--line-strong); background: #fbfcfe; }
.comparison-line { display: block; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.source-comparison::after, .result-text::after { content: ""; display: block; height: calc(50% - 1em); min-height: 120px; pointer-events: none; }
.comparison-line::after { content: "\200b"; }
.comparison-line--replacement-continuation { position: relative; }
.comparison-line--replacement-continuation::before {
  content: "";
  position: absolute;
  top: -3px;
  bottom: 3px;
  left: var(--replacement-continuation-left, 2px);
  width: var(--replacement-continuation-width, 64px);
  border-left: 2px solid #25a77d;
  border-bottom: 2px solid #25a77d;
  border-radius: 0 0 0 7px;
  background: linear-gradient(90deg, rgba(37, 167, 125, .11), rgba(37, 167, 125, .02));
  pointer-events: none;
}
textarea.small { min-height: 100px; padding: 12px; }
textarea.json { min-height: 110px; padding: 12px; font-family: "Cascadia Code", Consolas, monospace; }
.advanced-settings { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.advanced-settings summary { cursor: pointer; color: #3f4a5f; font-size: 12px; font-weight: 750; }
.advanced-settings summary span { color: #9aa3b2; font-weight: 500; }
.advanced-settings p { margin: 10px 0 0; color: var(--muted); font-size: 11px; }

.button, button {
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 10px 16px; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: linear-gradient(135deg, #5d54ea, #4338ca); box-shadow: 0 8px 18px rgba(79, 70, 229, .2); }
.button.primary:hover { background: linear-gradient(135deg, #5147dd, #3730a3); }
.button.secondary, .ghost { color: #3f4a5f; border: 1px solid var(--line-strong); background: #fff; }
.button.compact { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.privacy-note { color: var(--muted); font-size: 11px; }
.privacy-note span { color: var(--success); }
.submit-button { min-width: 178px; }
.submit-button:disabled { opacity: .65; cursor: wait; transform: none; }
.anonymization-progress { grid-column: 1 / -1; display: grid; gap: 10px; padding: 14px; border: 1px solid #d9d6ff; border-radius: 13px; background: linear-gradient(135deg, #f8f7ff, #f1f4ff); }
.anonymization-progress[hidden] { display: none; }
.anonymization-progress-head, .anonymization-progress-head > div { display: flex; align-items: center; gap: 11px; }
.anonymization-progress-head { justify-content: space-between; }
.anonymization-progress-head > div > div { display: grid; gap: 2px; }
.anonymization-progress-head strong { color: #4038ad; font-size: 12px; }
.anonymization-progress-head small { color: var(--muted); font-size: 10px; }
.anonymization-progress-value { display: flex; align-items: baseline; justify-content: flex-end; gap: 9px; flex: 0 0 auto; font-family: "Cascadia Code", Consolas, monospace; font-variant-numeric: tabular-nums; }
.anonymization-progress-value strong { min-width: 42px; color: #4038ad; font-size: 15px; text-align: right; }
.anonymization-progress-value span { color: #5d56b7; font-size: 11px; }
.processing-spinner { width: 24px; height: 24px; flex: 0 0 24px; border: 3px solid #dcd9ff; border-top-color: var(--primary); border-radius: 50%; animation: processing-spin .85s linear infinite; }
.anonymization-progress-track { position: relative; height: 7px; overflow: hidden; border-radius: 999px; background: #dfddff; }
.anonymization-progress-track > span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: linear-gradient(90deg, #8179f5, #4338ca); box-shadow: 0 0 12px rgba(79, 70, 229, .28); transition: width .35s linear; }
.anonymization-progress.failed { border-color: #f2b8bd; background: linear-gradient(135deg, #fff8f8, #fff1f2); }
.anonymization-progress.failed .anonymization-progress-head strong { color: #b4232c; }
.anonymization-progress.failed .anonymization-progress-track > span { background: linear-gradient(90deg, #ef767d, #c93643); box-shadow: none; }
.anonymization-stages { display: flex; flex-wrap: wrap; gap: 6px; }
.anonymization-stages span { padding: 5px 8px; border-radius: 7px; color: #8a92a3; background: rgba(255,255,255,.72); font-size: 9px; font-weight: 700; transition: color .2s, background .2s; }
.anonymization-stages span.active { color: #fff; background: var(--primary); }
.anonymization-stages span.complete { color: var(--success); background: var(--success-soft); }
.anonymization-stages span.skipped { display: none; }
@keyframes processing-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .anonymization-progress-track > span { transition-duration: .8s; }
  .processing-spinner { animation-duration: 1.8s; }
}

.success-badge { color: var(--success); border-color: #bee7d7; background: var(--success-soft); }
.warning-badge { color: #a44b12; border-color: #f2c49f; background: #fff4e8; }
.result-toolbar { min-height: 30px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; }
.result-toolbar > div { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.text-button { padding: 6px 9px; color: var(--primary); background: transparent; font-size: 11px; }
.text-button:hover { background: var(--primary-soft); }
.text-button:disabled { opacity: .45; cursor: not-allowed; }
.text-button:disabled:hover { background: transparent; }
.result-save-button { color: #fff; background: var(--primary); }
.result-save-button:hover { background: #4338ca; }
.highlighted-output { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.result-editor { border-color: #8d86f3; background: #fff; box-shadow: 0 0 0 3px rgba(79, 70, 229, .11); }
.clipboard-source { position: fixed; left: -10000px; top: 0; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.potential-fragment, .potential-source-fragment { padding: 1px 2px; border-radius: 3px; color: #a51020; background: #ffd9de; box-shadow: inset 0 -2px 0 #e5485b; font-weight: 750; cursor: help; }
.potential-fragment.current-potential-fragment,
.potential-source-fragment.current-potential-fragment { outline: 2px solid #bd2639; outline-offset: 2px; background: #ffc1ca; animation: potential-focus-pulse .42s ease-out; }
@keyframes potential-focus-pulse { from { outline-width: 5px; } to { outline-width: 2px; } }
.anonymized-fragment, .anonymized-source-fragment { padding: 1px 2px; border-radius: 4px; color: #0b6b52; background: #dff7ef; box-shadow: inset 0 -2px 0 #25a77d; font-weight: 750; }
.anonymized-fragment { white-space: nowrap; cursor: help; }
.anonymized-source-fragment { cursor: help; }
.correction-menu {
  position: fixed;
  z-index: 1200;
  width: min(250px, calc(100vw - 16px));
  max-height: min(440px, calc(100vh - 16px));
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 50px rgba(31, 35, 48, .2);
  backdrop-filter: blur(14px);
}
.correction-menu[hidden] { display: none; }
.correction-menu.saving { opacity: .65; pointer-events: none; }
.correction-menu-title {
  padding: 7px 9px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.correction-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  text-align: left;
}
.correction-menu-item:hover,
.correction-menu-item:focus-visible {
  outline: none;
  color: var(--primary);
  background: var(--primary-soft);
}
.correction-menu-item:first-of-type {
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.correction-menu-item small {
  flex: 0 0 auto;
  color: var(--muted);
  font: 9px/1.2 "Cascadia Code", Consolas, monospace;
}
.potential-warning { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 11px 12px; border: 1px solid #f1b8c0; border-radius: 11px; color: #8f2633; background: #fff0f2; }
.potential-warning-copy { min-width: 0; flex: 1 1 auto; }
.potential-warning p { margin: 3px 0 0; color: #a04954; font-size: 11px; }
.potential-warning-icon { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; color: #fff; background: var(--danger); font-size: 12px; font-weight: 850; }
.potential-navigation { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.potential-navigation-counter { min-width: 50px; color: #8f2633; text-align: center; font: 750 11px/1.2 "Cascadia Code", Consolas, monospace; }
.potential-navigation button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid #e7a7b1; border-radius: 8px; color: #9f2635; background: #fff; font-size: 16px; font-weight: 850; }
.potential-navigation button:hover { border-color: #d96070; background: #ffe1e5; }
.potential-navigation button:focus-visible { outline: 2px solid #bd2639; outline-offset: 2px; }
.potential-navigation button:disabled { opacity: .45; cursor: default; }
.result-statistics-panel { grid-column: 1 / -1; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.metric { display: grid; gap: 5px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.metric > span { color: var(--muted); font-size: 10px; }
.metric strong { font-size: 17px; letter-spacing: -.02em; }
.metric strong small { color: var(--muted); font-size: 10px; font-weight: 600; }
.result-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.result-meta span { padding: 5px 8px; border-radius: 7px; color: var(--muted); background: #f1f4f8; font-size: 10px; }
.result-meta b { color: #475166; }
.empty-state { min-height: 500px; display: grid; place-content: center; justify-items: center; text-align: center; padding: 40px; }
.empty-state h3 { margin: 22px 0 8px; }
.empty-state p { max-width: 360px; margin: 0; color: var(--muted); font-size: 13px; }
.comparison-empty { min-height: 560px; padding: 30px; border: 1px dashed var(--line-strong); background: var(--surface-soft); }
.empty-illustration { position: relative; width: 96px; height: 82px; }
.empty-illustration span { position: absolute; width: 62px; height: 76px; border: 1px solid #dce2eb; border-radius: 10px; background: #fff; box-shadow: 0 8px 20px rgba(42,54,82,.06); }
.empty-illustration span:nth-child(1) { left: 0; top: 4px; transform: rotate(-9deg); }
.empty-illustration span:nth-child(2) { right: 0; top: 4px; transform: rotate(9deg); }
.empty-illustration span:nth-child(3) { left: 17px; top: 0; border-color: #c9c6fa; background: linear-gradient(#fff 28%, #eef2ff 28% 32%, #fff 32% 48%, #eef2ff 48% 52%, #fff 52%); }

.alert { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 20px; padding: 14px 16px; border: 1px solid #f5cbd0; border-radius: 13px; color: #8d2d38; background: var(--danger-soft); }
.alert-success { border-color: #a9dfca; color: #126e4e; background: var(--success-soft); }
.alert p { margin: 3px 0 0; font-size: 12px; }
.alert-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; background: var(--danger); font-weight: 800; }
.compact-alert { display: block; padding: 10px 12px; font-size: 12px; }

.login-layout { min-height: calc(100vh - 180px); display: grid; grid-template-columns: minmax(0, 1fr) 440px; align-items: center; gap: 9vw; max-width: 1120px; margin: auto; }
.login-intro h1 { max-width: 620px; font-size: clamp(42px, 5vw, 68px); }
.login-intro > p { max-width: 560px; color: var(--muted); font-size: 18px; }
.trust-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.trust-list span { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: #526074; background: rgba(255,255,255,.7); font-size: 11px; }
.login-card { padding: 38px; }
.login-card .login-mark { width: 46px; height: 46px; margin-bottom: 24px; }
.login-card h2 { font-size: 26px; }
.login-card > p { margin: 7px 0 24px; color: var(--muted); }
.stack { display: grid; gap: 16px; }
.stack label { display: grid; gap: 7px; color: #445066; font-size: 12px; font-weight: 700; }
.stack label small { color: var(--muted); font-size: 10px; font-weight: 500; }
.stack input { width: 100%; min-height: 46px; }
.stack .button { width: 100%; margin-top: 4px; }
.auth-switch { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; }
.auth-switch a { color: var(--primary); font-weight: 750; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.external-review-panel { grid-column: 1 / -1; }
.external-review-launch { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.external-review-launch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.external-review-launch-head > div { display: grid; gap: 3px; }
.external-review-launch-head strong { font-size: 13px; }
.external-review-launch-head span:not(.external-ai-badge) { color: var(--muted); font-size: 10px; }
.external-ai-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #d8d4ff;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
}
.external-review-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr); gap: 18px; }
.result-panel .external-review-grid { grid-template-columns: 1fr; gap: 12px; }
.external-review-controls { display: grid; align-content: start; gap: 14px; }
.external-review-field { display: grid; gap: 7px; color: #445066; font-size: 12px; font-weight: 750; }
.external-review-select { position: relative; display: block; }
.external-review-select::after {
  content: "⌄";
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 850;
  line-height: 1;
  pointer-events: none;
  transform: translateY(-58%);
}
.external-review-field select { width: 100%; padding-right: 42px; appearance: none; cursor: pointer; }
.external-review-field select:disabled { cursor: not-allowed; opacity: .62; }
.external-review-field small { color: var(--muted); font-size: 10px; font-weight: 500; }
.external-review-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  cursor: pointer;
}
.external-review-consent input {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 1px 0 0;
  padding: 0;
  flex: 0 0 17px;
  accent-color: var(--primary);
}
.external-review-button { justify-self: start; min-width: 210px; }
.external-review-button:disabled {
  opacity: .42;
  color: #8b90a0;
  background: #e3e6ed;
  box-shadow: none;
  cursor: not-allowed;
  filter: saturate(.2);
  transform: none;
}
.external-review-button:disabled:hover { background: #e3e6ed; transform: none; }
.external-review-disclosure {
  padding: 16px;
  border: 1px solid #dcd9ff;
  border-radius: 13px;
  background: #f7f6ff;
}
.external-review-disclosure strong { color: #4d45bd; font-size: 12px; }
.external-review-disclosure p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.external-review-unavailable { margin-top: 12px; padding: 9px 10px; border-radius: 9px; color: #796c18; background: #fff8d9; font-size: 11px; font-weight: 650; }
.external-review-progress {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid #d9d6ff;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8f7ff, #f1f4ff);
}
.external-review-progress[hidden] { display: none; }
.external-review-progress > div { display: grid; gap: 2px; }
.external-review-progress strong { color: #4038ad; font-size: 12px; }
.external-review-progress small { color: var(--muted); font-size: 10px; }
.external-review-status { margin-top: 16px; padding: 11px 12px; border: 1px solid #f1b8c0; border-radius: 11px; color: #8f2633; background: var(--danger-soft); font-size: 11px; }
.external-review-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}
.external-review-empty[hidden] { display: none; }
.external-review-empty > span { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 10px; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-weight: 850; }
.external-review-empty strong { color: var(--ink); font-size: 14px; }
.external-review-empty p { max-width: 560px; margin: 5px 0 0; font-size: 11px; }
.external-review-result { margin: 0; padding: 0; border: 0; }
.external-review-result-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.external-review-result-head > div:first-child { display: grid; gap: 3px; }
.external-review-result-head span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.external-review-result-head strong { font-size: 14px; }
.external-review-result-head > div:last-child { display: flex; gap: 5px; }
.external-review-result pre {
  min-height: 180px;
  max-height: 520px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fbfcfe;
  color: var(--ink);
  font: 13px/1.65 Inter, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.external-review-meta { margin-top: 8px; color: var(--muted); font-size: 10px; }
.external-review-result-actions { display: flex; justify-content: flex-end; gap: 5px; margin-top: 9px; }

/* Administrative screens */
.hero.compact { align-items: center; }
.admin-grid { display: grid; gap: 22px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card > p { color: var(--muted); }
.card h2 { margin-bottom: 18px; }
.card h3 { margin-top: 28px; }
.card form > button:not(.icon-button) { min-height: 38px; padding: 8px 13px; color: #fff; background: var(--primary); }
.card .ghost { color: var(--ink)!important; background: #fff!important; }
.danger { color: var(--danger)!important; background: var(--danger-soft)!important; }
table { width: 100%; border-collapse: collapse; }
th, td { max-width: 360px; padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
th { color: var(--muted); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.scroll { overflow: auto; margin-top: 18px; }
.table-list { display: grid; }
.table-list a { display: grid; grid-template-columns: 220px 1fr 70px; gap: 16px; padding: 15px 6px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.table-list a:hover { color: var(--primary); }
.table-list span, .meta { color: var(--muted); }
.table-list b { text-align: right; }
.candidate-list { display: grid; margin-top: 20px; }
.candidate { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 4px; border-bottom: 1px solid var(--line); }
.candidate-main { min-width: 0; }
.candidate-main > strong { display: block; margin-bottom: 8px; font-size: 16px; overflow-wrap: anywhere; }
.meta { margin-left: 8px; font-size: 11px; }
.candidate-actions { display: flex; gap: 8px; flex-shrink: 0; }
.candidate-actions form { margin: 0; }
.protect { color: #394456!important; background: #eef1f5!important; }
.decision { padding: 7px 10px; border-radius: 8px; font-size: 11px; font-weight: 700; }
.decision.accepted { color: var(--success); background: var(--success-soft); }
.decision.rejected { color: #536059; background: #eef1f5; }
.empty, .empty.short { min-height: 180px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; padding: 11px 15px; border-radius: 10px; color: #fff; background: #172033; box-shadow: var(--shadow); font-size: 12px; }

.database-preview { display: grid; align-content: start; gap: 14px; }
.database-preview > p { margin: -5px 0 0; color: var(--muted); font-size: 12px; }
.database-preview-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.database-preview-stats span { display: grid; gap: 2px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-soft); font-size: 10px; }
.database-preview-stats strong { color: var(--ink); font-size: 20px; }
.database-layout, .database-table-layout { width: min(1460px, 100%); margin: 0 auto; }
.database-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 24px; }
.database-summary article { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 7px 18px rgba(42,54,82,.04); }
.database-summary span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.database-summary strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.database-category { margin-top: 24px; }
.database-category-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.database-category-head h2 { margin: 0; font-size: 18px; }
.database-category-head span { color: var(--muted); font-size: 10px; }
.database-table-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.database-table-card { display: grid; gap: 9px; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: var(--surface); text-decoration: none; transition: border-color .18s, transform .18s, box-shadow .18s; }
.database-table-card:hover { border-color: #b7b2f5; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(42,54,82,.07); }
.database-table-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.database-table-card strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 750 12px/1.3 "Cascadia Code", Consolas, monospace; }
.database-table-card p { min-height: 31px; margin: 0; color: var(--muted); font-size: 10px; }
.database-table-card footer { display: flex; gap: 10px; color: var(--muted); font-size: 9px; }
.database-read-badge, .database-write-badge { display: inline-flex; align-items: center; width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.database-read-badge { color: #526078; background: #edf1f6; }
.database-write-badge { color: #0b6b52; background: #e4f8f1; }
.database-filter-panel { margin-bottom: 14px; padding: 14px; }
.database-filter-form { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, .75fr)) auto; gap: 9px; align-items: end; }
.database-filter-form label { display: grid; gap: 5px; min-width: 0; }
.database-filter-form label > span { color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.database-data-panel { padding: 0; overflow: visible; }
.database-data-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.database-data-head > div { display: flex; align-items: baseline; gap: 6px; }
.database-data-head strong { color: var(--ink); font-size: 18px; }
.database-scroll { max-height: 690px; overflow: auto; scrollbar-gutter: stable; }
.database-table { min-width: 100%; width: max-content; border-collapse: separate; border-spacing: 0; }
.database-table th { position: sticky; z-index: 2; top: 0; min-width: 130px; padding: 10px 12px; border-bottom: 1px solid var(--line-strong); background: var(--surface-soft); text-align: left; }
.database-table th span, .database-table th small { display: block; }
.database-table th span { color: var(--ink); font: 750 10px/1.2 "Cascadia Code", Consolas, monospace; }
.database-table th small { margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 600; }
.database-table td { max-width: 260px; padding: 9px 12px; border-bottom: 1px solid var(--line); color: #465065; font: 10px/1.45 "Cascadia Code", Consolas, monospace; vertical-align: top; }
.database-table tbody tr:hover td { background: var(--primary-soft); }
.database-cell { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.database-actions-column { right: 0; min-width: 88px!important; }
.database-row-actions { position: sticky; z-index: 1; right: 0; min-width: 88px; background: var(--surface); font-family: inherit!important; }
.database-row-actions details { position: relative; }
.database-row-actions summary { cursor: pointer; color: var(--primary); font-size: 9px; font-weight: 800; list-style: none; }
.database-row-actions summary::-webkit-details-marker { display: none; }
.database-row-popover { position: absolute; z-index: 8; top: 27px; right: 0; width: min(520px, 72vw); padding: 14px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); font-family: Inter, system-ui, sans-serif; }
.database-row-popover-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.database-row-popover-head span { color: var(--muted); font-size: 9px; }
.database-row-popover pre { max-height: 360px; margin: 0; padding: 12px; overflow: auto; border-radius: 9px; background: var(--surface-soft); white-space: pre-wrap; overflow-wrap: anywhere; font: 10px/1.5 "Cascadia Code", Consolas, monospace; }
.database-row-popover form { display: grid; gap: 8px; margin: 0 0 8px; }
.database-row-popover textarea { min-height: 280px; }
.database-create-row { margin-top: 14px; }
.database-create-row > summary { cursor: pointer; color: var(--primary); font-weight: 800; }
.database-create-row > p { color: var(--muted); font-size: 10px; }
.database-create-row form { display: grid; gap: 10px; }

@media (max-width: 1100px) {
  .result-panel { min-height: auto; }
  .empty-state { min-height: 320px; }
  .login-layout { gap: 5vw; }
  .renewal-plan-list > form { grid-template-columns: 1fr auto; }
  .renewal-plan-list .activation-choice { grid-column: 1 / -1; grid-row: 2; }
  .guide-steps { grid-template-columns: 1fr 1fr; }
  .database-table-grid { grid-template-columns: 1fr 1fr; }
  .database-filter-form { grid-template-columns: repeat(3, 1fr); }
  .database-search { grid-column: span 2; }
  .balance-adjustment-form { grid-template-columns: 1fr 1fr; }
  .balance-reason { grid-column: 1 / -1; }
  .balance-adjustment-form > .button { margin-top: 0; justify-self: start; }
}
@media (max-width: 760px) {
  .topbar { height: 66px; }
  .topbar-shell, main { width: min(100% - 28px, 1540px); }
  .topbar-shell { gap: 14px; }
  .brand small, .user-meta, .main-nav, .balance-chip { display: none; }
  .guide-button { display: inline-grid; margin-left: auto; }
  .guide-button + .theme-toggle { margin-left: 0; }
  .user-area { margin-left: auto; }
  main { padding: 28px 0 42px; }
  .page-heading, .hero { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; justify-content: space-between; }
  h1 { font-size: 34px; }
  .panel, .card { padding: 18px; border-radius: 15px; }
  .panel-header { align-items: flex-start; }
  .panel-title p, .profile-control > span { display: none; }
  .upload-zone { align-items: flex-start; flex-wrap: wrap; }
  .upload-zone .button { width: 100%; }
  .workspace { grid-template-columns: 1fr; }
  .setup-panel, .source-panel, .result-panel, .workspace-footer { grid-column: 1; }
  .document-text { min-height: 330px; }
  .comparison-text, .comparison-empty { height: 390px; min-height: 390px; max-height: 390px; }
  .text-pane-toolbar { align-items: flex-start; flex-direction: column; }
  .potential-warning { align-items: flex-start; flex-wrap: wrap; }
  .potential-navigation { width: 100%; justify-content: flex-end; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .workspace-footer { grid-template-columns: 1fr; }
  .submit-button { width: 100%; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .login-layout { min-height: auto; grid-template-columns: 1fr; gap: 28px; }
  .login-intro h1 { font-size: 42px; }
  .login-intro > p { font-size: 15px; }
  .trust-list { display: none; }
  .login-card { padding: 26px; }
  .account-actions { align-items: stretch; flex-direction: column-reverse; }
  .account-actions .button { width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
  .quota-grid, .plan-grid, .admin-billing-grid, .form-grid { grid-template-columns: 1fr; }
  .subscription-inline { grid-template-columns: 1fr; }
  .subscription-inline .button { width: 100%; }
  .balance-card, .invitation-result { align-items: stretch; flex-direction: column; }
  .auto-renew-card { align-items: stretch; flex-direction: column; }
  .auto-renew-card .button { width: 100%; }
  .balance-card .button, .invitation-result .button { width: 100%; }
  .renewal-plan-list > form { grid-template-columns: 1fr; }
  .renewal-plan-list .activation-choice { grid-column: 1; grid-row: auto; }
  .database-summary { grid-template-columns: 1fr 1fr; }
  .database-table-grid, .database-filter-form, .balance-adjustment-form { grid-template-columns: 1fr; }
  .database-search, .balance-reason { grid-column: 1; }
  .balance-adjustment-form > .button { width: 100%; }
  .database-row-popover { position: fixed; inset: 78px 14px auto; width: auto; max-height: calc(100vh - 96px); overflow: auto; }
  .activation-choice { grid-template-columns: 1fr; }
  .guide-steps, .guide-grid { grid-template-columns: 1fr; }
  .guide-heading .button { width: 100%; }
  .billing-order-list article { align-items: stretch; flex-direction: column; }
  .billing-order-list .inline { width: 100%; flex: none; flex-direction: column; }
  .prompt-settings-card { grid-column: 1; }
  .prompt-picker-row { grid-template-columns: 1fr; }
  .prompt-picker-summary { padding: 0; }
  .prompt-editor-head { flex-direction: column; }
  .table-list a { grid-template-columns: 1fr 50px; }
  .table-list span { display: none; }
  .candidate { align-items: flex-start; flex-direction: column; }
  .candidate-actions { width: 100%; flex-direction: column; }
  .candidate-actions button { width: 100%; }
  .external-review-grid { grid-template-columns: 1fr; }
  .external-review-button { width: 100%; }
  .external-review-result-head { align-items: flex-start; flex-direction: column; }
}

/* Dark theme */
html[data-theme="dark"] {
  --bg: #0b0b14;
  --surface: #141421;
  --surface-soft: #1a1a2a;
  --ink: #f0f0f8;
  --muted: #9da2b8;
  --line: #29293d;
  --line-strong: #3a3a54;
  --primary: #8d86ff;
  --primary-dark: #aaa5ff;
  --primary-soft: #252241;
  --success: #55d6a5;
  --success-soft: #123329;
  --danger: #ff7180;
  --danger-soft: #3a1b24;
  --shadow: 0 18px 48px rgba(0, 0, 0, .28);
  color-scheme: dark;
  scrollbar-color: #45415f #141421;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% -10%, rgba(111, 99, 255, .18), transparent 30rem),
    radial-gradient(circle at 92% 20%, rgba(79, 70, 229, .06), transparent 24rem),
    var(--bg);
}
html[data-theme="dark"] .topbar {
  border-bottom-color: rgba(48, 48, 70, .9);
  background: rgba(14, 14, 24, .88);
}
html[data-theme="dark"] .main-nav a { color: #a9adc0; }
html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .login-mark {
  background: linear-gradient(145deg, #8179f5, #5146d8);
  box-shadow: 0 9px 24px rgba(96, 83, 238, .32);
}
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .icon-button {
  background: #191927;
  box-shadow: none;
}
html[data-theme="dark"] .icon-button:hover {
  border-color: #713844;
  background: var(--danger-soft);
}
html[data-theme="dark"] .account-button:hover {
  color: #b9b5ff;
  border-color: #6258dd;
  background: var(--primary-soft);
}
html[data-theme="dark"] .alert-success { border-color: #2f6a54; color: #9ce0c4; }
html[data-theme="dark"] .badge,
html[data-theme="dark"] .pill {
  background: rgba(27, 27, 43, .9);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #10101b;
  color: var(--ink);
}
html[data-theme="dark"] select option {
  color: #e8e7f3;
  background: #141321;
}
html[data-theme="dark"] select option:checked {
  color: #fff;
  background: #5147dd;
}
html[data-theme="dark"] .custom-select-trigger {
  border-color: #45405f;
  color: #f0eff9;
  background: linear-gradient(180deg, #1a1928, #131321);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .2);
}
html[data-theme="dark"] .custom-select-trigger:hover { border-color: #756de0; background: #1d1b30; }
html[data-theme="dark"] .custom-select.open .custom-select-trigger,
html[data-theme="dark"] .custom-select-trigger:focus-visible {
  border-color: #8d86ff;
  box-shadow: 0 0 0 3px rgba(141, 134, 255, .17), 0 10px 24px rgba(0, 0, 0, .26);
}
html[data-theme="dark"] .custom-select-menu {
  border-color: #403b60;
  background: rgba(20, 19, 33, .98);
  box-shadow: 0 20px 46px rgba(0, 0, 0, .42);
}
html[data-theme="dark"] .custom-select-option { color: #c9cbd8; }
html[data-theme="dark"] .custom-select-option:hover,
html[data-theme="dark"] .custom-select-option:focus-visible {
  color: #fff;
  background: #292549;
}
html[data-theme="dark"] .custom-select-option.selected {
  color: #fff;
  background: linear-gradient(135deg, #756cf2, #5147dd);
}
html[data-theme="dark"] .custom-select-option-description { color: #9b9eb2; }
html[data-theme="dark"] .custom-select-option.selected .custom-select-option-description { color: #e5e2ff; }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #72768c; }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: #8d86ff;
  box-shadow: 0 0 0 3px rgba(141, 134, 255, .16);
}
html[data-theme="dark"] .upload-zone { border-color: #454560; }
html[data-theme="dark"] .upload-zone.extracting { border-color: #7770e8; background: #211e3b; }
html[data-theme="dark"] .upload-zone.extracted { border-color: #39775f; }
html[data-theme="dark"] .upload-zone.extract-error { border-color: #7c3e49; }
html[data-theme="dark"] .upload-icon { border-color: #383459; background: #1d1b31; }
html[data-theme="dark"] .balance-chip { border-color: #343448; background: #171724; }
html[data-theme="dark"] .balance-chip:hover { border-color: #7770e8; background: #211f3c; }
html[data-theme="dark"] .invitation-result { border-color: #2d6c56; background: #143229; }
html[data-theme="dark"] .scheduled-plan { border-color: #484270; background: #1d1b35; }
html[data-theme="dark"] .renewal-plan-list > form { border-color: #303044; background: #11111d; }
html[data-theme="dark"] .activation-choice label > span { border-color: #3b3a50; background: #181825; }
html[data-theme="dark"] .activation-choice input:checked + span { border-color: #8d86ff; background: #242141; }
html[data-theme="dark"] .invitation-security { color: #83e8c1; background: #17372e; }
html[data-theme="dark"] .extraction-progress { border-color: #403b70; background: #1d1a35; }
html[data-theme="dark"] .extraction-progress.complete { border-color: #2d6c56; background: var(--success-soft); }
html[data-theme="dark"] .extraction-progress.complete .progress-track { background: #235241; }
html[data-theme="dark"] .extraction-progress.failed { border-color: #713844; background: var(--danger-soft); }
html[data-theme="dark"] .extraction-progress-head { color: #b0abff; }
html[data-theme="dark"] .extraction-progress-head span { color: #9690de; }
html[data-theme="dark"] .progress-track { background: #34305d; }
html[data-theme="dark"] .upload-status.processing { color: #bbb6ff; background: #242140; }
html[data-theme="dark"] .separator { color: #777c91; }
html[data-theme="dark"] .result-text,
html[data-theme="dark"] .source-comparison { background: #10101b; }
html[data-theme="dark"] .advanced-settings summary { color: #c4c6d4; }
html[data-theme="dark"] .replacement-legend { color: #6ee7b7; background: #14352c; }
html[data-theme="dark"] .potential-legend { color: #ffb1b9; background: #351b23; }
html[data-theme="dark"] .button.secondary,
html[data-theme="dark"] .ghost,
html[data-theme="dark"] .card .ghost {
  color: #d8dae5 !important;
  background: #1a1a29 !important;
}
html[data-theme="dark"] .anonymization-progress {
  border-color: #403b70;
  background: linear-gradient(135deg, #1e1b36, #181a30);
}
html[data-theme="dark"] .anonymization-progress-head strong { color: #b9b5ff; }
html[data-theme="dark"] .anonymization-progress-value strong { color: #c6c2ff; }
html[data-theme="dark"] .anonymization-progress-value span { color: #9993dc; }
html[data-theme="dark"] .processing-spinner { border-color: #3a3665; border-top-color: var(--primary); }
html[data-theme="dark"] .anonymization-progress-track { background: #373260; }
html[data-theme="dark"] .anonymization-progress.failed { border-color: #6f3038; background: linear-gradient(135deg, #23191d, #29171c); }
html[data-theme="dark"] .anonymization-progress.failed .anonymization-progress-head strong { color: #ff9ca5; }
html[data-theme="dark"] .anonymization-stages span { color: #8e92a7; background: rgba(33, 33, 51, .88); }
html[data-theme="dark"] .anonymization-stages span.active {
  color: #fff;
  background: linear-gradient(135deg, #8d86ff, #6559e8);
  box-shadow: 0 0 0 1px rgba(185, 181, 255, .28), 0 5px 14px rgba(79, 70, 229, .28);
}
html[data-theme="dark"] .anonymization-stages span.active::before {
  content: "●";
  margin-right: 5px;
  font-size: 7px;
  vertical-align: 1px;
}
html[data-theme="dark"] .anonymization-stages span.complete {
  color: #73e5b8;
  background: #17382f;
  box-shadow: inset 0 0 0 1px rgba(115, 229, 184, .16);
}
html[data-theme="dark"] .anonymization-stages span.complete::before {
  content: "✓";
  margin-right: 4px;
  font-weight: 900;
}
html[data-theme="dark"] .success-badge { color: var(--success); border-color: #2d6c56; background: var(--success-soft); }
html[data-theme="dark"] .warning-badge { color: #f6b978; border-color: #6c4a2f; background: #352519; }
html[data-theme="dark"] .result-editor { border-color: #8d86f3; background: #12111e; }
html[data-theme="dark"] .potential-fragment,
html[data-theme="dark"] .potential-source-fragment {
  color: #ffb1b9;
  background: #4a202a;
  box-shadow: inset 0 -2px 0 #e65a69;
}
html[data-theme="dark"] .potential-fragment.current-potential-fragment,
html[data-theme="dark"] .potential-source-fragment.current-potential-fragment {
  outline-color: #ff8290;
  background: #622934;
}
html[data-theme="dark"] .anonymized-fragment,
html[data-theme="dark"] .anonymized-source-fragment {
  color: #8aebc7;
  background: #173b31;
  box-shadow: inset 0 -2px 0 #35bd91;
}
html[data-theme="dark"] .correction-menu {
  border-color: #414155;
  background: rgba(24, 24, 38, .98);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
html[data-theme="dark"] .correction-menu-item { color: #e5e7ef; }
html[data-theme="dark"] .correction-menu-item:hover,
html[data-theme="dark"] .correction-menu-item:focus-visible {
  color: #c8c4ff;
  background: #272342;
}
html[data-theme="dark"] .potential-warning {
  border-color: #6b3640;
  color: #ffb0b8;
  background: #351b23;
}
html[data-theme="dark"] .potential-warning p { color: #dc8f98; }
html[data-theme="dark"] .potential-navigation-counter { color: #ffb0b8; }
html[data-theme="dark"] .potential-navigation button {
  border-color: #70404a;
  color: #ffb0b8;
  background: #21151a;
}
html[data-theme="dark"] .potential-navigation button:hover {
  border-color: #a95866;
  background: #49232c;
}
html[data-theme="dark"] .auto-renew-icon { color: #72dfb5; background: #14352c; }
html[data-theme="dark"] .database-summary article,
html[data-theme="dark"] .database-table-card,
html[data-theme="dark"] .database-row-actions,
html[data-theme="dark"] .database-row-popover { border-color: #303044; background: #151521; }
html[data-theme="dark"] .database-table-card:hover { border-color: #7770e8; box-shadow: 0 10px 24px rgba(0,0,0,.24); }
html[data-theme="dark"] .database-read-badge { color: #b6bdce; background: #272735; }
html[data-theme="dark"] .database-write-badge { color: #6ee7b7; background: #14352c; }
html[data-theme="dark"] .database-table th { border-color: #303044; background: #1b1b28; }
html[data-theme="dark"] .database-table td { border-color: #292938; color: #c6c8d4; }
html[data-theme="dark"] .database-table tbody tr:hover td { background: #24213f; }
html[data-theme="dark"] .result-meta span { background: #1c1c2b; }
html[data-theme="dark"] .result-meta b { color: #c8cad6; }
html[data-theme="dark"] .empty-illustration span {
  border-color: #35354b;
  background: #191927;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}
html[data-theme="dark"] .empty-illustration span:nth-child(3) {
  border-color: #504a8a;
  background: linear-gradient(#191927 28%, #29264a 28% 32%, #191927 32% 48%, #29264a 48% 52%, #191927 52%);
}
html[data-theme="dark"] .trust-list span {
  color: #b7bbcc;
  background: rgba(25, 25, 39, .75);
}
html[data-theme="dark"] .stack label { color: #c6c8d4; }
html[data-theme="dark"] .external-ai-badge { border-color: #464071; }
html[data-theme="dark"] .external-review-field { color: #c6c8d4; }
html[data-theme="dark"] .external-review-field select {
  border-color: #5b5591;
  background: #11101c;
  box-shadow: inset 0 0 0 1px rgba(141, 134, 255, .08);
}
html[data-theme="dark"] .external-review-field select:hover { border-color: #8179e8; }
html[data-theme="dark"] .external-review-consent { border-color: #383852; background: #191927; }
html[data-theme="dark"] .external-review-button:disabled,
html[data-theme="dark"] .external-review-button:disabled:hover {
  color: #727488;
  background: #242433;
  box-shadow: none;
}
html[data-theme="dark"] .external-review-disclosure {
  border-color: #403b70;
  background: #1d1a35;
}
html[data-theme="dark"] .external-review-disclosure strong { color: #b0abff; }
html[data-theme="dark"] .external-review-unavailable { color: #e1cd75; background: #39331b; }
html[data-theme="dark"] .external-review-progress {
  border-color: #403b70;
  background: linear-gradient(135deg, #1e1b36, #181a30);
}
html[data-theme="dark"] .external-review-progress strong { color: #b9b5ff; }
html[data-theme="dark"] .external-review-status { border-color: #6b3640; color: #ffb0b8; }
html[data-theme="dark"] .external-review-result pre { background: #10101b; }
html[data-theme="dark"] .current-setting,
html[data-theme="dark"] .prompt-editor-stage { border-color: #34344b; background: #161624; }
html[data-theme="dark"] .settings-security-note { border-color: #403b70; color: #bbb6ff; background: #1d1a35; }
html[data-theme="dark"] .prompt-automatic-note { border-color: #8179f5; background: #1d1a35; }
html[data-theme="dark"] .prompt-automatic-note strong { color: #bbb6ff; }
html[data-theme="dark"] .prompt-state { color: #a8abbb; background: #242434; }
html[data-theme="dark"] .prompt-state.custom { color: #c7c3ff; background: #312c56; }
html[data-theme="dark"] .quota-card { border-color: #34344b; background: #161624; }
html[data-theme="dark"] .quota-track { background: #29293d; }
html[data-theme="dark"] .external-review-empty { border-color: #3a3a54; background: rgba(16, 16, 27, .45); }
html[data-theme="dark"] .protect { color: #c9cbd6 !important; background: #252536 !important; }
html[data-theme="dark"] .decision.rejected { color: #b6b9c8; background: #252536; }
html[data-theme="dark"] .toast { background: #e9e8ff; color: #171624; }

@media (prefers-reduced-motion: no-preference) {
  body,
  .topbar,
  .panel,
  .card,
  input,
  select,
  textarea,
  .theme-toggle,
  .icon-button {
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
  }
}
