/* ── Reset & Tokens ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #f0f2f5;
  --bg-subtle:    #e8eaf0;
  --surface:      #ffffff;
  --border:       #e1e4ea;
  --border-light: #eceef3;
  --text:         #111827;
  --text-muted:   #6b7280;
  --text-faint:   #9ca3af;
  --accent:       #2563eb;
  --accent-dark:  #1d4ed8;
  --accent-light: #eff6ff;
  --accent-ring:  rgba(37,99,235,.15);
  --danger:       #dc2626;
  --danger-dark:  #b91c1c;
  --danger-light: #fef2f2;
  --success:      #16a34a;
  --success-light:#f0fdf4;
  --warning:      #d97706;
  --warning-light:#fffbeb;
  --info:         #0891b2;
  --info-light:   #ecfeff;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-xs:    0 1px 2px rgba(0,0,0,.06);
  --shadow:       0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --nav-h:        52px;
  --sidebar-w:    200px;
  --transition:   .15s ease;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
html { font-size: 14px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-xs);
  gap: 1rem;
}
.navbar-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-brand span.badge-admin {
  font-size: .6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  letter-spacing: .4px;
  text-transform: uppercase;
  vertical-align: middle;
}
.navbar-nav {
  display: flex;
  align-items: center;
  gap: .1rem;
  list-style: none;
  margin-left: auto;
}
.navbar-nav a {
  display: block;
  padding: .35rem .8rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}
.navbar-nav .divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 .4rem;
}

/* ── Layout ───────────────────────────────────────────────────────────── */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.3px;
  line-height: 1.3;
}
.page-header p {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: .2rem;
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-body { padding: 1.5rem; }
.card-header {
  padding: .9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
}

/* ── Stat Cards ───────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .85rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--accent);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -.5px;
}
.stat-card .stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .35rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}

/* ── Table ────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: .875rem;
}
thead th {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: .65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody td { padding: .7rem 1rem; vertical-align: middle; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition),
              box-shadow var(--transition), opacity var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 2px 6px rgba(37,99,235,.35);
  opacity: 1;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg); border-color: #d1d5db; opacity: 1; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 1px 3px rgba(220,38,38,.25);
}
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); opacity: 1; }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); opacity: 1; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--text);
}
.form-control {
  display: block;
  width: 100%;
  padding: .5rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-control::placeholder { color: var(--text-faint); }
select.form-control { cursor: pointer; }
select[multiple].form-control { height: auto; min-height: 110px; }
textarea.form-control { resize: vertical; min-height: 85px; }
.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check input[type=checkbox] { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--accent); }
.form-check label { margin: 0; font-size: .875rem; cursor: pointer; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.field-error { font-size: .78rem; color: var(--danger); margin-top: .3rem; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: .85rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert-success { background: var(--success-light); color: #14532d; border-color: #bbf7d0; }
.alert-danger  { background: var(--danger-light);  color: #7f1d1d; border-color: #fecaca; }
.alert-warning { background: var(--warning-light); color: #78350f; border-color: #fde68a; }
.alert-info    { background: var(--info-light);    color: #164e63; border-color: #a5f3fc; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .1px;
}
.badge-active   { background: var(--success-light); color: #15803d; }
.badge-inactive { background: #f3f4f6; color: var(--text-muted); }
.badge-channel  { background: var(--accent-light);  color: var(--accent); }

/* ── Login page ───────────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 2rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.25rem;
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo .brand {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.4px;
}
.login-logo .sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .2rem;
}
/* ── Channel cards (customer dashboard) ──────────────────────────────── */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
}
.channel-card:hover { box-shadow: var(--shadow-md); }
.channel-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}
.channel-card-header h2 {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.1px;
}
.channel-card-header p {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .15rem;
}
.channel-card-body { padding: 0; flex: 1; }
.update-row {
  display: flex;
  align-items: center;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  gap: 1rem;
}
.update-row:last-child { border-bottom: none; }
.update-info { flex: 1; min-width: 0; }
.update-info .title {
  font-weight: 500;
  font-size: .875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.update-info .meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .1rem;
}
.no-updates {
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: .875rem;
  text-align: center;
}

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state h2 { font-size: 1rem; margin-bottom: .4rem; color: var(--text); font-weight: 600; }
.empty-state p { font-size: .875rem; }

/* ── Utility ──────────────────────────────────────────────────────────── */
.actions { display: flex; gap: .35rem; align-items: center; }
.channel-tags { display: flex; flex-wrap: wrap; gap: .3rem; }

/* ── Layout (sidebar + content) ───────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - var(--nav-h));
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem .6rem;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.sidebar-nav { display: flex; flex-direction: column; }
.sidebar-section { display: flex; flex-direction: column; gap: .1rem; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .7rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  line-height: 1;
}
.sidebar-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.sidebar-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.sidebar-link svg { flex-shrink: 0; opacity: .65; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-link:hover svg { opacity: .9; }

.main-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .channel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .page { padding: 1.25rem 1rem; }
  .navbar { padding: 0 1rem; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header .btn { align-self: flex-start; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: .5rem .6rem;
  }
  .sidebar-section {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .2rem;
  }
  .sidebar-link { padding: .4rem .6rem; font-size: .8rem; }
  .layout { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .login-card { padding: 1.75rem 1.25rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-wrap { border-radius: var(--radius); }
  .btn { font-size: .8rem; }
}

