@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  --ink: #0c1b2a;
  --ink-soft: #3d5166;
  --muted: #6b7c8f;
  --line: #d9e2ec;
  --surface: #ffffff;
  --bg: #eef2f6;
  --bg-deep: #e4ebf2;
  --accent: #0b4f8a;
  --accent-2: #0a7a6a;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #0f7b4b;
  --sidebar: #0c1b2a;
  --sidebar-ink: #d9e6f2;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(12, 27, 42, 0.08);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(11, 79, 138, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(10, 122, 106, 0.07), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hq-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.hq-sidebar {
  background: linear-gradient(185deg, #0c1b2a 0%, #13283d 55%, #0a1622 100%);
  color: var(--sidebar-ink);
  padding: 1.4rem 1rem 2rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.06);
}
.hq-brand { padding: .4rem .7rem 1.4rem; }
.hq-brand .mark {
  font-family: var(--display);
  font-size: 1.85rem;
  color: #fff;
  letter-spacing: .02em;
  line-height: 1;
}
.hq-brand .sub { font-size: .78rem; color: #8aa0b5; margin-top: .35rem; }

.hq-nav { display: flex; flex-direction: column; gap: .2rem; }
.hq-nav a {
  display: flex; align-items: center; gap: .65rem;
  color: #c5d4e3; padding: .62rem .75rem; border-radius: 10px;
  text-decoration: none; font-weight: 500; font-size: .92rem;
}
.hq-nav a:hover, .hq-nav a.active {
  background: rgba(255,255,255,.08); color: #fff; text-decoration: none;
}
.hq-nav .sec {
  margin: 1rem .75rem .35rem;
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: #6f8499; font-weight: 600;
}

.hq-main { padding: 1.5rem 1.75rem 2.5rem; min-width: 0; }
.hq-top {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; margin-bottom: 1.35rem; flex-wrap: wrap;
}
.hq-top h1 {
  margin: 0; font-family: var(--display); font-size: 2rem; font-weight: 400;
  letter-spacing: .01em;
}
.hq-top .meta { color: var(--muted); font-size: .9rem; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.15rem 1.25rem;
}
.card + .card { margin-top: 1rem; }
.card h2, .card h3 { margin: 0 0 .85rem; font-size: 1.05rem; }

.grid-stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1.15rem;
}
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
}
.stat .lbl { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .val { font-size: 1.7rem; font-weight: 700; margin-top: .25rem; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 999px; padding: .62rem 1.1rem; font-weight: 600;
  font-family: inherit; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #e8eef5; color: var(--ink); }
.btn-success { background: var(--accent-2); color: #fff; }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .7rem .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

.badge {
  display: inline-block; padding: .18rem .5rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge-active { background: #e8f7ef; color: var(--ok); }
.badge-inactive { background: #f1f3f5; color: var(--muted); }
.badge-error, .badge-failed { background: #fdecec; color: var(--danger); }
.badge-provisioning { background: #fff7e8; color: var(--warn); }
.badge-pushed, .badge-sent { background: #e7f3fb; color: var(--accent); }
.badge-draft, .badge-partial { background: #f4f1ea; color: #7a5c2e; }

.flash { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: #eaf8f0; color: var(--ok); border: 1px solid #c6ebd7; }
.flash-err { background: #fdecec; color: var(--danger); border: 1px solid #f3c6c6; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .88rem; }
label.field span.hint { font-weight: 400; color: var(--muted); font-size: .78rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=color],
input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .65rem .75rem;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.check {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; font-weight: 500; font-size: .88rem;
}
.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; align-items: center; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
.hero-panel {
  background: linear-gradient(135deg, #0c1b2a 0%, #0b4f8a 55%, #0a7a6a 120%);
  color: #fff; border-radius: 16px; padding: 1.5rem 1.6rem; margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
}
.hero-panel h2 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; margin: 0 0 .4rem; }
.hero-panel p { margin: 0; opacity: .88; max-width: 52ch; }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    linear-gradient(160deg, rgba(12,27,42,.92), rgba(11,79,138,.75)),
    radial-gradient(800px 400px at 20% 20%, rgba(10,122,106,.35), transparent);
}
.auth-card {
  width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 1.6rem 1.5rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.auth-card .mark { font-family: var(--display); font-size: 2rem; margin: 0 0 .2rem; }
.auth-card .sub { color: var(--muted); margin: 0 0 1.2rem; }

@media (max-width: 1100px) {
  .grid-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .hq-shell { grid-template-columns: 1fr; }
  .hq-sidebar { position: relative; height: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .hq-main { padding: 1rem; }
  .grid-stats { grid-template-columns: 1fr 1fr; }
}
