:root {
  --ink: #191c1d;
  --muted: #5f5e5e;
  --line: #e1e3e4;
  --paper: #f8f9fa;
  --card: #ffffff;
  --sidebar: #0f1016;
  --sidebar-2: #16171d;
  --gold: #e30613;
  --gold-2: #ff4d57;
  --teal: #e30613;
  --danger: #ba1a1a;
  --ok: #1f7a46;
  --warn: #b57614;
  --info: #0059a8;
  --shadow: 0 14px 40px rgba(15, 16, 22, .08);
  --radius: 14px;
  --font: "Inter", system-ui, sans-serif;
  --serif: "Plus Jakarta Sans", Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: #c0000c; }
img { max-width: 100%; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}
.auth-brand {
  background:
    radial-gradient(900px 500px at -10% 110%, rgba(227, 6, 19, .28), transparent 55%),
    linear-gradient(165deg, #0f1016 0%, #16171d 60%, #0f1016 100%);
  color: #f4f5f7;
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-mark small {
  display: block;
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-2);
  font-weight: 600;
  margin-top: 2px;
}
.brand-logo {
  height: 42px;
  width: auto;
  display: block;
  object-fit: contain;
}
.brand-logo.mark {
  height: 40px;
  width: 40px;
  border-radius: 10px;
  background: #fff;
  object-fit: cover;
}
.auth-brand .brand-logo { height: 52px; filter: none; }
.auth-brand h1 {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 42px;
  line-height: 1.15;
  margin: 0 0 16px;
}
.auth-brand p { color: rgba(244, 245, 247, .78); max-width: 460px; font-size: 17px; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--paper); }
.auth-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 36px;
}
.auth-card h2 { font-family: var(--serif); margin: 0 0 8px; font-size: 30px; font-weight: 800; }
.auth-card .lede { color: var(--muted); margin-bottom: 24px; }

.app-shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  color: #f4f5f7;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(244, 245, 247, .72);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active {
  background: rgba(227, 6, 19, .16);
  color: #ffb4aa;
}
.nav .section-label {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(227, 6, 19, .85);
  padding: 16px 12px 6px;
  font-weight: 700;
}
.sidebar-foot { margin-top: auto; padding: 12px; color: rgba(244, 245, 247, .55); font-size: 12px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 249, 250, .86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-family: var(--serif); font-size: 24px; margin: 0; font-weight: 800; }
.page { padding: 28px; }

.quota {
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.quota .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.bar { height: 8px; background: #edeeef; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #c0000c, var(--gold)); }

.grid { display: grid; gap: 18px; }
.grid.stats { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: 1.3fr .7fr; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card, .stat, .table-wrap, .form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat { padding: 18px 20px; }
.stat .k { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.stat .v { font-family: var(--serif); font-size: 32px; margin-top: 6px; font-weight: 800; }
.card { padding: 22px; }
.card h3, .form-card h3 { font-family: var(--serif); margin: 0 0 14px; font-weight: 800; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: #f3f4f5; }
tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #edeeef;
  color: #474746;
}
.badge.ok, .badge.sent, .badge.completed, .badge.active { background: #e4f3e8; color: #215c34; }
.badge.warn, .badge.paused, .badge.scheduled, .badge.queued { background: #f8ead0; color: #8a5a12; }
.badge.danger, .badge.failed, .badge.cancelled, .badge.error, .badge.disabled { background: #ffdad5; color: #930007; }
.badge.info, .badge.running, .badge.pending { background: #d5e3ff; color: #004788; }

.btn, button.btn, input[type=submit].btn {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { filter: brightness(1.08); }
.btn.gold { background: var(--gold); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.teal { background: var(--ink); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 999px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-weight: 700; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 500; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=datetime-local], input[type=time], input[type=file], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  color: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(227, 6, 19, .15);
}
textarea { min-height: 180px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-card { padding: 22px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.check-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
}
.check-list label { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 0; }

.flash { margin: 0 28px 0; display: grid; gap: 8px; }
.flash .item {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 650;
}
.flash .success { background: #e4f3e8; color: #215c34; }
.flash .error { background: #ffdad5; color: #930007; }
.flash .info { background: #d5e3ff; color: #004788; }

.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}
.progress {
  height: 10px;
  background: #edeeef;
  border-radius: 99px;
  overflow: hidden;
}
.progress > span { display: block; height: 100%; background: var(--gold); }
.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  border: 1px dashed #e9bcb6;
  background: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  color: inherit;
  font-family: inherit;
}
button.chip { appearance: none; margin: 0; }
.insert-chips { margin: 0 0 10px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.help-box {
  background: #fff5f3;
  border: 1px solid #ffdad5;
  border-radius: 14px;
  padding: 14px 16px;
  color: #5e3f3b;
  font-size: 14px;
}

@media (max-width: 980px) {
  .auth-shell, .app-shell, .grid.stats, .grid.two, .form-grid { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .sidebar { display: none; }
  .page { padding: 18px; }
}
