:root {
  --ink: #11140f;
  --paper: #f3f1e8;
  --panel: rgba(255, 255, 250, 0.78);
  --line: rgba(17, 20, 15, 0.16);
  --muted: #686d62;
  --acid: #c9ff37;
  --orange: #ff6b2c;
  --red: #bf2735;
  --green: #1d7b4d;
  --shadow: 0 24px 70px rgba(35, 38, 27, 0.12);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  background:
    linear-gradient(rgba(17, 20, 15, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 20, 15, .045) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.ambient-a { width: 34rem; height: 34rem; right: -14rem; top: -12rem; background: radial-gradient(circle, rgba(201,255,55,.46), transparent 68%); }
.ambient-b { width: 28rem; height: 28rem; left: -13rem; bottom: -12rem; background: radial-gradient(circle, rgba(255,107,44,.25), transparent 68%); }

a { color: inherit; }
button, input { font: inherit; }
.shell { width: min(1540px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 90px; }
.topbar { width: min(1540px, calc(100% - 40px)); margin: 0 auto; min-height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 50%; background: var(--ink); color: var(--acid); font-weight: 900; letter-spacing: -.06em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

h1, h2, p { margin-top: 0; }
h1, h2 { font-family: "Iowan Old Style", "Palatino Linotype", serif; }
h1 { margin-bottom: 18px; font-size: clamp(48px, 6vw, 94px); line-height: .91; letter-spacing: -.055em; font-weight: 600; }
h1 em { color: var(--orange); font-style: italic; }
h2 { margin-bottom: 8px; font-size: 30px; letter-spacing: -.025em; }
.eyebrow { margin-bottom: 14px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.text-muted { color: var(--muted); }
.text-ok { color: var(--green); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--ink); border-radius: 999px; padding: 0 21px; color: var(--ink); background: transparent; cursor: pointer; font-weight: 750; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(17,20,15,.14); }
.button-primary { background: var(--acid); }
.button-secondary { background: var(--ink); color: white; }
.button-quiet { border-color: var(--line); background: rgba(255,255,255,.35); }
.button-danger { border-color: var(--red); background: var(--red); color: white; }

.flash-stack { display: grid; gap: 9px; margin-bottom: 24px; }
.flash { padding: 14px 18px; border: 1px solid; border-radius: 12px; background: white; font-weight: 650; }
.flash-success { border-color: rgba(29,123,77,.4); color: var(--green); }
.flash-error { border-color: rgba(191,39,53,.4); color: var(--red); }

.hero, .plan-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin: 24px 0 42px; }
.hero p, .plan-hero p { max-width: 720px; color: var(--muted); font-size: 17px; }
.hero-actions { display: flex; flex: 0 0 auto; gap: 10px; padding-bottom: 8px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric-grid article { position: relative; overflow: hidden; min-height: 150px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.metric-grid article::after { content: ""; position: absolute; right: -24px; bottom: -35px; width: 100px; height: 100px; border: 1px solid var(--line); border-radius: 50%; }
.metric-grid span, .metric-grid small { display: block; color: var(--muted); }
.metric-grid strong { display: block; margin: 9px 0 4px; font-family: "Iowan Old Style", serif; font-size: 52px; line-height: 1; }
.metric-grid .metric-warn { background: rgba(255,107,44,.12); }
.metric-grid.compact article { min-height: 120px; }

.panel { margin-bottom: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.status-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.status-strip div { min-width: 0; padding-right: 18px; border-right: 1px solid var(--line); }
.status-strip div:last-child { border: 0; }
.status-strip span, .status-strip strong { display: block; }
.status-strip span { margin-bottom: 5px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.status-strip strong { overflow: hidden; text-overflow: ellipsis; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.table-tools { display: flex; gap: 8px; }
input { min-height: 43px; width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; color: var(--ink); background: rgba(255,255,255,.76); outline: none; }
input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(201,255,55,.7); }
#config-filter { width: min(410px, 42vw); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.config-table { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: 13px; }
.config-table th { position: sticky; top: 0; z-index: 1; padding: 12px; color: var(--muted); background: #e8e7dd; text-align: left; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.config-table td { padding: 14px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.config-table tr:first-child td { border-top: 0; }
.config-table strong, .config-table small { display: block; }
.config-table small { max-width: 310px; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.config-table .check-cell { width: 42px; }
.config-check { width: 18px; min-height: 18px; accent-color: var(--ink); }
.row-mismatch { background: rgba(255,107,44,.09); }
.row-stale { opacity: .58; }
.config-row.is-hidden { display: none; }
.pill { display: inline-block; width: fit-content; margin-top: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.pill-warn { color: #8d380d; border-color: rgba(255,107,44,.55); background: rgba(255,107,44,.13); }
.pill-error { color: var(--red); border-color: rgba(191,39,53,.45); }
.pill-muted { color: var(--muted); }
.country-override { display: grid; grid-template-columns: auto 58px; align-items: center; gap: 7px; margin-top: 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.country-override input { min-height: 30px; padding: 4px 7px; text-transform: uppercase; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.form-footer p { margin: 0; color: var(--muted); font-size: 13px; }

.split-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.settings-panel summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
.settings-panel summary::-webkit-details-marker { display: none; }
.settings-panel summary strong { display: block; font-family: "Iowan Old Style", serif; font-size: 28px; }
.summary-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; font-size: 25px; transition: transform .2s ease; }
.settings-panel[open] .summary-icon { transform: rotate(45deg); }
.settings-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.settings-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.settings-form .wide { grid-column: 1 / -1; }
.settings-form .toggle-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.toggle-row input { width: 18px; min-height: 18px; accent-color: var(--ink); }
.event-list { margin: 22px 0 0; padding: 0; list-style: none; }
.event-list li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.event-list li > span { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--green); }
.event-list .event-error > span { background: var(--red); }
.event-list strong, .event-list small { display: block; }
.event-list strong { font-size: 13px; }
.event-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.plan-hero h1 { margin-bottom: 10px; font-size: clamp(50px, 7vw, 95px); }
.warning-panel { border-color: rgba(255,107,44,.5); background: rgba(255,107,44,.1); }
.warning-panel p:last-child { margin-bottom: 0; }
.operation-list { display: grid; gap: 10px; }
.operation { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.46); }
.operation > div > strong, .operation > div > small { display: block; }
.operation > div > strong { margin-top: 7px; }
.operation > div > small { color: var(--muted); }
.operation-unchanged { opacity: .55; }
.operation details { width: min(620px, 54vw); }
.operation details summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700; }
pre { overflow: auto; max-height: 380px; padding: 14px; border-radius: 10px; color: #e9ffd0; background: #171b15; font: 12px/1.55 "SFMono-Regular", Consolas, monospace; }
.apply-bar { position: sticky; bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border: 1px solid var(--ink); border-radius: 17px; color: white; background: rgba(17,20,15,.94); box-shadow: 0 18px 55px rgba(17,20,15,.28); backdrop-filter: blur(12px); }
.apply-bar strong, .apply-bar small { display: block; }
.apply-bar small { margin-top: 3px; color: #b9beb4; }
.empty { padding: 30px !important; color: var(--muted); text-align: center; }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 35px 0; }
.login-card { width: min(960px, 100%); padding: clamp(30px, 6vw, 75px); border: 1px solid var(--line); border-radius: 30px; background: rgba(255,255,250,.83); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card h1 { max-width: 780px; }
.login-card > p { max-width: 640px; color: var(--muted); font-size: 17px; }
.login-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; margin-top: 36px; }
.login-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .split-grid { grid-template-columns: 1fr; }
  .hero, .plan-hero { align-items: start; flex-direction: column; }
  .hero-actions { padding: 0; }
}

@media (max-width: 680px) {
  .shell, .topbar { width: min(100% - 22px, 1540px); }
  .shell { padding-top: 28px; }
  h1 { font-size: 48px; }
  .brand small { display: none; }
  .hero-actions, .table-tools, .form-footer { width: 100%; align-items: stretch; flex-direction: column; }
  .hero-actions form, .hero-actions button, .form-footer button { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article { min-height: 125px; padding: 16px; }
  .metric-grid strong { font-size: 42px; }
  .status-strip { grid-template-columns: 1fr; }
  .status-strip div { padding: 0 0 12px; border: 0; border-bottom: 1px solid var(--line); }
  .section-head { align-items: stretch; flex-direction: column; }
  #config-filter { width: 100%; }
  .panel { padding: 17px; border-radius: 15px; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-form .wide { grid-column: auto; }
  .operation { flex-direction: column; }
  .operation details { width: 100%; }
  .apply-bar { align-items: stretch; flex-direction: column; bottom: 8px; }
  .apply-bar button { width: 100%; }
  .login-card { padding: 27px 20px; border-radius: 20px; }
  .login-form { grid-template-columns: 1fr; }
}
