:root {
  --bg:         #f2f4f7;
  --panel:      #ffffff;
  --ink:        #1a2433;
  --muted:      #5f6f82;
  --line:       #dbe0e6;
  --brand:      #0d3535;
  --brand-soft: #e6f0ee;
  --accent:     #b06030;
  --ok:         #1a7a4a;
  --warn:       #8a5c10;
  --err:        #aa2828;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(ellipse at 12% 8%, #f5ebe0 0%, #f2f4f7 50%, #edf0f5 100%);
  color: var(--ink);
  min-height: 100vh;
}

a { color: #1a5caf; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(165deg, #0a2828 0%, #0f3535 60%, #154545 100%);
  color: #e8f4f3;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-block { }
.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #80bab8;
  margin-bottom: 4px;
}
.sidebar h1 { font-size: 22px; font-weight: 700; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  color: #c8e4e2;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms, transform 100ms;
}
.nav a:hover  { background: rgba(255,255,255,.09); text-decoration: none; transform: translateX(2px); }
.nav a.active { background: rgba(255,255,255,.15); color: #fff; }

.content { padding: 28px; }

/* ── Page header ── */
.page-head { margin-bottom: 22px; }
.page-head h2 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.page-head p  { color: var(--muted); font-size: 14px; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.stat-card h3   { font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.stat-value     { font-size: 32px; font-weight: 700; }

/* ── Panels ── */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.panel h3 { font-size: 17px; font-weight: 600; margin-bottom: 14px; }

/* ── Card grid (WA accounts) ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
}
.account-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}
.qr-box img { max-width: 200px; border: 1px solid var(--line); border-radius: 10px; }
.qr-empty   { color: var(--muted); font-size: 13px; padding: 8px; }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f6f8fa; color: #4a5c70; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* ── Badges ── */
.badge {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e6ecf2;
  color: #3c4f66;
}
.badge.ok   { background: #d8f0e6; color: var(--ok); }
.badge.warn { background: #fcebd4; color: var(--warn); }
.badge.err  { background: #fde2e2; color: var(--err); }

/* ── Forms ── */
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }

input, select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
}
input:focus, select:focus { outline: 2px solid #3a8888; outline-offset: 1px; }

button {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  border: none;
  border-radius: 9px;
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: filter 120ms;
}
button:hover    { filter: brightness(1.15); }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }
button.ghost    { background: #e4eaed; color: var(--ink); }
button.warn     { background: #fce9d4; color: #7a4a10; }
button.danger   { background: #fde2e2; color: #7d1212; }

.action-group { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.check-row { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* ── Meta rows ── */
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.meta-row:last-child { border-bottom: none; }
.meta-row span { color: var(--muted); }

/* ── Log box ── */
.logbox {
  background: #0c1520;
  color: #ccd8f0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  border-radius: 10px;
  padding: 14px;
  min-height: 300px;
  max-height: 600px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Misc ── */
.muted { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; padding: 12px 0; }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar   { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 14px; }
  table      { display: block; overflow-x: auto; }
}
