:root {
  --ink: #182230;
  --muted: #718096;
  --line: #e7ebf2;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --navy: #152238;
  --blue: #356ae6;
  --blue-soft: #edf3ff;
  --green: #17835b;
  --green-soft: #e8f7f0;
  --amber: #a86813;
  --amber-soft: #fff5df;
  --red: #c24147;
  --red-soft: #fff0f0;
  --shadow: 0 10px 30px rgba(27, 45, 73, .06);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 14px; line-height: 1.55; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
h2 { margin: 30px 0 14px; font-size: 18px; }
p { color: var(--muted); }

.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 238px; flex: 0 0 238px; display: flex; flex-direction: column; padding: 24px 14px; color: #d8e2f2; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 28px; color: #fff; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: #92a8c8; font-size: 11px; }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #5e8df4, #325dc8); font-weight: 800; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #aebed5; transition: background .15s, color .15s; }
.nav-item span { width: 18px; color: #7f9bc5; font-size: 17px; text-align: center; }
.nav-item:hover, .nav-item.is-active { color: #fff; background: rgba(103, 145, 219, .2); text-decoration: none; }
.nav-item.is-active span { color: #8db1ff; }
.sidebar-footer { margin-top: auto; padding: 18px 12px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.sign-out { color: #aebed5; }
.main-column { min-width: 0; flex: 1; }
.topbar { display: flex; justify-content: space-between; align-items: center; height: 64px; padding: 0 40px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.76); }
.eyebrow { color: #9aa7ba; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.live-dot { color: var(--green); font-size: 12px; }
.live-dot::before { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #2bb779; content: ""; }
.container { max-width: 1280px; margin: 0 auto; padding: 36px 40px 64px; }
.public-container { max-width: 1100px; margin: 40px auto; }
.login-card { max-width: 420px; margin: 10vh auto 0; padding: 32px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.brand--login { padding: 0 0 26px; color: var(--ink); }
.brand--login small { color: var(--muted); }
.form-card--login { max-width: none; padding: 0; border: 0; box-shadow: none; }
.flash { display: flex; align-items: center; gap: 9px; margin: 0 0 20px; padding: 11px 14px; border: 1px solid; border-radius: 9px; }
.flash span { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; font-weight: 700; }
.flash--notice { border-color: #bce8d4; color: #176c4e; background: var(--green-soft); }
.flash--notice span { color: #fff; background: var(--green); }
.flash--alert { border-color: #f1c5c5; color: #a2353b; background: var(--red-soft); }
.flash--alert span { color: #fff; background: var(--red); }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.page-heading p { margin: 5px 0 0; }
.page-actions, .page-links { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.button-link { display: inline-flex; align-items: center; min-height: 38px; padding: 8px 13px; border-radius: 7px; color: #fff; background: var(--blue); font-weight: 650; }
.button-link:hover { color: #fff; background: #2858c9; text-decoration: none; }
.page-links { margin: 9px 0 24px; }
.page-links a { color: var(--muted); }
.page-links a:first-child { color: var(--blue); }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 14px; margin: 24px 0 30px; }
.metrics div { min-height: 112px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
.metrics strong { display: block; margin-top: 12px; color: var(--ink); font-size: 28px; line-height: 1; }
.table-scroll { max-height: min(62vh, 680px); overflow: auto; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
table { width: 100%; min-width: max-content; border-spacing: 0; background: var(--surface); }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; color: #69788c; background: #fafbfe; font-size: 12px; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcff; }
form { margin: 14px 0; }
label { display: inline-block; margin-right: 6px; color: #526174; font-size: 13px; font-weight: 600; }
input, select, textarea, button, input[type=submit] { min-height: 40px; padding: 9px 12px; border: 1px solid #d3dce9; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; transition: border-color .15s, box-shadow .15s, background .15s; }
input::placeholder, textarea::placeholder { color: #a4afbd; }
input:focus, select:focus, textarea:focus { border-color: #6d91e9; outline: 0; box-shadow: 0 0 0 3px rgba(53, 106, 230, .13); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], select, textarea { width: 100%; }
textarea { min-height: 132px; resize: vertical; line-height: 1.65; }
button, input[type=submit] { border-color: var(--blue); color: #fff; background: var(--blue); cursor: pointer; font-weight: 650; box-shadow: 0 2px 5px rgba(53, 106, 230, .18); }
button:hover, input[type=submit]:hover { border-color: #2858c9; background: #2858c9; }
button:active, input[type=submit]:active { transform: translateY(1px); }
form.button_to { display: inline-block; margin: 0; }
.button_to button { min-height: 32px; padding: 5px 10px; border-radius: 6px; font-size: 12px; box-shadow: none; }
.form-card { max-width: 780px; padding: 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.form-card form { margin: 0; }
.form-card p { margin: 0 0 16px; }
.form-card p:last-of-type { margin-bottom: 22px; }
.form-card p > label, .form-card p > .label { display: block; margin-bottom: 6px; }
.form-card p > br { display: none; }
.form-card .form-submit { margin-top: 4px; }
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.filter-bar select, .filter-bar input { width: auto; min-width: 150px; }
.filter-bar input[type=submit] { min-width: 78px; }
.card .filter-bar { margin: 0; }
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; color: #5f6d7e; background: #eef1f5; font-size: 12px; font-weight: 650; }
.badge--approved, .badge--enabled, .badge--delivered, .badge--active { color: var(--green); background: var(--green-soft); }
.badge--pending, .badge--created, .badge--draft, .badge--queued, .badge--submitting, .badge--requested { color: var(--amber); background: var(--amber-soft); }
.badge--rejected, .badge--failed, .badge--provider-error, .badge--disabled, .badge--inactive { color: var(--red); background: var(--red-soft); }
.badge--suspended { color: var(--red); background: var(--red-soft); }
.status-stack, .table-actions { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.table-link { display: inline-flex; align-items: center; min-height: 32px; padding: 5px 9px; border: 1px solid #d6deea; border-radius: 6px; color: #526174; background: #fff; font-size: 12px; font-weight: 650; }
.table-link:hover { border-color: #b7c7e8; color: var(--blue); background: var(--blue-soft); text-decoration: none; }
.copy-button { min-height: 28px; padding: 3px 8px; border-radius: 6px; font-size: 12px; box-shadow: none; }
.error-cell { max-width: 220px; overflow: hidden; color: var(--red); text-overflow: ellipsis; }
.card { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.setting-card { display: flex; gap: 15px; min-height: 150px; }
.setting-icon { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 10px; color: var(--blue); background: var(--blue-soft); font-size: 18px; font-weight: 700; }
.setting-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.setting-value { display: block; overflow-wrap: anywhere; color: var(--ink); font-size: 16px; }
.setting-card p { margin: 10px 0 0; font-size: 13px; }
.settings-detail { margin-top: 16px; }
.settings-detail h2 { margin-top: 0; }
.event-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-note { margin-bottom: 0; }
.card form { margin: 0; }
small { color: var(--muted); }
code { padding: 2px 5px; border-radius: 4px; color: #53637a; background: #f1f4f8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-field { display: grid; gap: 6px; }
.form-field--wide { grid-column: 1 / -1; }
.alert { color: var(--red); }
.notice { color: var(--green); }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 18px; max-width: 760px; }
dt { color: var(--muted); }
dd { margin: 0; }

@media (max-width: 900px) {
  .sidebar { width: 76px; flex-basis: 76px; padding: 18px 10px; }
  .brand { justify-content: center; padding: 4px 0 24px; }
  .brand > span:last-child, .nav-item:not(.is-active)::after, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; padding: 11px 4px; }
  .nav-item span { font-size: 18px; }
  .sidebar-footer { padding: 18px 0 4px; text-align: center; }
  .sign-out { font-size: 0; }
  .sign-out::after { color: #aebed5; content: "↪"; font-size: 18px; }
  .topbar { padding: 0 24px; }
  .container { padding: 28px 24px 48px; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .topbar { height: 54px; padding: 0 16px; }
  .eyebrow { font-size: 9px; }
  .container { padding: 22px 14px 40px; }
  h1 { font-size: 22px; }
  .page-heading { display: block; }
  .page-actions { margin-top: 14px; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .metrics div { min-height: 92px; padding: 13px; }
  .metrics strong { font-size: 23px; }
  .table-scroll { max-height: 58vh; }
  .form-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-field--wide { grid-column: auto; }
  dl { grid-template-columns: 1fr; gap: 3px; }
  dd { margin-bottom: 10px; }
}
