:root {
  --navy: #10243e;
  --blue: #1f6feb;
  --blue-dark: #1558bd;
  --cyan: #45b8d8;
  --bg: #f3f6fa;
  --card: #fff;
  --text: #172033;
  --muted: #667085;
  --line: #dbe3ed;
  --green: #087a55;
  --red: #bd2c2c;
  --orange: #b65b0a;
  --radius: 15px;
  --shadow: 0 8px 28px rgba(16,36,62,.08);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); font: 15px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { color: var(--navy); line-height: 1.18; margin: 0; }
h1 { font-size: clamp(1.7rem,3vw,2.35rem); }
h2 { font-size: 1.18rem; }
p { margin: .4rem 0 1rem; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 .25rem; color: var(--blue); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.topbar { position: sticky; top: 0; z-index: 50; min-height: 70px; display: flex; align-items: center; gap: 24px; padding: 10px max(20px,calc((100vw - 1440px)/2)); background: rgba(16,36,62,.98); box-shadow: 0 4px 20px rgba(0,0,0,.18); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 190px; color: white; }
.brand:hover { text-decoration: none; }
.brand-mark,.login-logo { display: grid; place-items: center; border-radius: 10px; background: linear-gradient(135deg,var(--blue),var(--cyan)); color: #fff; font-weight: 900; }
.brand-mark { width: 42px; height: 42px; }
.brand strong,.brand small { display: block; }
.brand small { color: #b7c6d9; font-size: .7rem; }
nav { display: flex; align-items: center; gap: 5px; flex: 1; }
nav a { padding: 9px 10px; border-radius: 9px; color: #dce7f5; font-weight: 600; font-size: .9rem; }
nav a:hover { color: white; background: rgba(255,255,255,.1); text-decoration: none; }
.nav-toggle { display: none; margin-left: auto; border: 0; background: transparent; color: white; font-size: 1.5rem; }
.logout-form { margin-left: auto; }
.container { width: min(1400px,calc(100% - 40px)); margin: 34px auto 60px; }
.auth-container { min-height: 100vh; display: grid; place-items: center; margin-top: 0; }
.page-head,.card-head,.actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.page-head { margin-bottom: 24px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); padding: 22px; }
.cards { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4,1fr); margin-bottom: 20px; }
.stat { color: var(--text); transition: transform .15s ease,box-shadow .15s ease; }
.stat:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 12px 32px rgba(16,36,62,.13); }
.stat span,.stat strong { display: block; }
.stat span { color: var(--muted); font-weight: 600; }
.stat strong { margin-top: 6px; color: var(--navy); font-size: 2rem; }
.stat.attention strong { color: var(--orange); }
.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.card-head { margin-bottom: 16px; }
.status-list { margin: 0; }
.status-list div { display: flex; justify-content: space-between; gap: 15px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.status-list div:last-child { border-bottom: 0; }
.status-list dt { color: var(--muted); }
.status-list dd { margin: 0; text-align: right; }
.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--green); }.status-dot.bad { background: var(--red); }.status-dot.warn { background: var(--orange); }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-actions a { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; font-weight: 700; }
.quick-actions a:hover { border-color: var(--blue); background: #eef5ff; text-decoration: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th,td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 99px; background: #e8edf4; color: #475467; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.status-sent,.status-indexed,.status-ok,.status-completed { background: #dcfce7; color: #087a55; }
.status-failed,.status-delivery_failed,.status-denied,.status-deleted,.status-access_revoked { background: #fee2e2; color: #a51d1d; }
.status-pending_approval,.status-awaiting_edit,.status-edit_review,.status-queued,.status-processing,.status-syncing { background: #fff1d6; color: #99520a; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 39px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 750; }
.button:hover { text-decoration: none; }
.button.primary { color: white; background: var(--blue); }.button.primary:hover { background: var(--blue-dark); }
.button.secondary { color: var(--navy); border-color: var(--line); background: white; }
.button.danger { color: var(--red); border-color: #f5bcbc; background: #fff8f8; }
.button.ghost { color: #dce7f5; border-color: rgba(255,255,255,.22); background: transparent; }
.button.small { min-height: 32px; padding: 5px 9px; font-size: .8rem; }
.button.full { width: 100%; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 6px; color: #344054; font-weight: 700; }
input,textarea,select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 9px; background: white; color: var(--text); font: inherit; }
textarea { min-height: 120px; resize: vertical; }
input:focus,textarea:focus,select:focus { outline: 3px solid rgba(31,111,235,.14); border-color: var(--blue); }
input[type=checkbox] { width: 18px; min-height: 18px; accent-color: var(--blue); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1/-1; }
.form-card { max-width: 1000px; }
.help { color: var(--muted); font-size: .82rem; font-weight: 400; }
.alert { margin-bottom: 18px; padding: 12px 15px; border-radius: 10px; background: #e8f4ff; color: #154b79; border: 1px solid #b9dcfa; }
.alert.error { background: #fff1f1; color: #9a1b1b; border-color: #f7c4c4; }
.alert.warning { background: #fff7e8; color: #80430d; border-color: #f5d29d; }
.login-card { width: min(460px,100%); padding: 38px; border-radius: 22px; background: white; box-shadow: 0 20px 60px rgba(16,36,62,.16); }
.login-logo { width: 58px; height: 58px; margin-bottom: 22px; font-size: 1.25rem; }
.login-card h1 { margin-bottom: 10px; }
.source-box,.answer-box { padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-box { border-left: 4px solid var(--blue); background: #f5f9ff; }
.dropzone { padding: 28px; border: 2px dashed #a8bed8; border-radius: 13px; background: #f8fbff; text-align: center; }
.dropzone input { margin-top: 10px; border: 0; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.details { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.scope-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
code { padding: 2px 5px; border-radius: 5px; background: #edf1f6; color: #243750; }
footer { padding: 24px 20px; color: var(--muted); text-align: center; font-size: .82rem; }
@media (max-width: 1050px) {
  .stats { grid-template-columns: repeat(2,1fr); }
  .nav-toggle { display: block; }
  .topbar { flex-wrap: wrap; }
  nav { display: none; order: 4; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  nav.open { display: flex; }
  .logout-form { margin-left: 0; }
}
@media (max-width: 720px) {
  .container { width: min(100% - 24px,1400px); margin-top: 22px; }
  .grid.two,.grid.three,.form-grid,.stats { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .card { padding: 17px; }
  .login-card { padding: 26px; }
  .brand { min-width: 0; }
}
