:root {
  --bg: #f4f7fb;
  --navy: #061425;
  --navy-2: #0d2137;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dce6f3;
  --panel: #ffffff;
  --blue: #2f80ff;
  --blue-2: #dbeafe;
  --green: #22c55e;
  --gold: #f2a93b;
  --red: #ef4444;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--navy), #091b2f);
  color: #e8f1ff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #102844;
  font-weight: 800;
  color: #fff;
}

.brand-title {
  font-weight: 800;
  font-size: 16px;
}

.brand-subtitle {
  color: #93a8c3;
  font-size: 13px;
  margin-top: 2px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  color: #b9c9df;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
}

.side-nav a.active,
.side-nav a:hover {
  background: rgba(47, 128, 255, 0.16);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
  color: #d9e5f5;
  font-size: 13px;
}

.sidebar-footer span {
  display: block;
  color: #93a8c3;
  margin-top: 2px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.14);
}

.main {
  padding: 28px;
  display: grid;
  gap: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.12;
}

.topbar p,
.panel-heading p,
.muted {
  color: var(--muted);
}

.topbar p {
  margin-top: 6px;
  font-size: 15px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ghost-btn,
.outline-btn,
.login-form button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}

.ghost-btn {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.ok::before,
.status-pill.warning::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.status-pill.warning::before {
  background: var(--gold);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.kpi-card,
.brand-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 18px;
}

.kpi-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-card strong {
  display: block;
  font-size: 32px;
  line-height: 1;
  margin-top: 12px;
}

.kpi-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.35;
}

.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.brand-card {
  padding: 20px;
  border-top: 4px solid var(--brand-accent, var(--blue));
}

.brand-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.account-id {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 150px;
  padding: 4px 8px;
  border-radius: 5px;
  background: #eef5ff;
  color: #1d4ed8;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.brand-card h2,
.panel h2 {
  font-size: 18px;
}

.brand-card .phone {
  color: var(--muted);
  margin-top: 6px;
  font-size: 14px;
}

.brand-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mini-metric {
  background: #f8fbff;
  border: 1px solid #e6eef8;
  border-radius: 7px;
  padding: 12px;
}

.mini-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mini-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.panel {
  padding: 20px;
  min-width: 0;
}

.panel-wide {
  min-height: 380px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}

.legend-blue {
  background: var(--blue);
}

.legend-green {
  background: var(--green);
}

.legend-gold {
  background: var(--gold);
}

.chart-wrap {
  width: 100%;
  min-height: 280px;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
}

.channel-list {
  display: grid;
  gap: 10px;
}

.channel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.channel-bar {
  height: 8px;
  border-radius: 999px;
  background: #e8eef7;
  overflow: hidden;
  margin-top: 7px;
}

.channel-bar span {
  display: block;
  height: 100%;
  background: var(--blue);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  background: #f8fbff;
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  font-size: 13px;
  color: #263449;
}

.status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--blue-2);
  color: #1d4ed8;
  white-space: nowrap;
}

.status-badge.follow {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.live {
  background: #dcfce7;
  color: #166534;
}

.status-badge.qa {
  background: #fee2e2;
  color: #991b1b;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #475569;
}

.login-body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(47, 128, 255, 0.16), transparent 38%),
    linear-gradient(135deg, #061425, #0d2137);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 10px;
  padding: 30px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.login-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 850;
  margin-bottom: 18px;
}

.login-panel h1 {
  font-size: 24px;
}

.login-panel p {
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.login-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
}

.login-form button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  margin-top: 4px;
}

.login-error {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .panel-grid,
  .brand-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .panel-heading,
  .brand-card-head {
    flex-direction: column;
  }

  .side-nav,
  .kpi-grid,
  .brand-metrics {
    grid-template-columns: 1fr;
  }
}
