/* Tiger OTT Admin — UI styles on top of Bootstrap 5. */

:root {
  --brand-bg: #0f172a;
  --brand-hover: #1e293b;
  --page-bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border-color: #e5e7eb;
  --text: #0f172a;
  --text-muted: #64748b;
  --track: #eef2f7;
  --sidebar-bg: #ffffff;
  --sidebar-active: #2563eb;
  --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --card-shadow-hover: 0 8px 24px rgba(15,23,42,.10);
  --sidebar-w: 268px;
}

[data-theme="dark"] {
  --page-bg: #0b1120;
  --surface: #111827;
  --surface-2: #0f172a;
  --border-color: #1f2937;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --track: #1f2937;
  --sidebar-bg: #0d1424;
  --card-shadow: 0 1px 3px rgba(0,0,0,.4);
  --card-shadow-hover: 0 8px 24px rgba(0,0,0,.5);
}

/* ── Base ─────────────────────────────────────────────── */
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
}

.page-main  { flex: 1; }
.page-footer, .app-footer { background: transparent; }
.app-footer { padding: 1.5rem 0 .5rem; text-align: center; }

/* ── App shell (sidebar + main) ───────────────────────── */
.app-shell { display: flex; min-height: 100vh; }
.app-main {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}
.app-content { flex: 1; padding: 1.5rem 1.75rem 2rem; }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1040;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.15rem 1.35rem;
  font-weight: 800; font-size: 1.08rem; letter-spacing: -.02em;
  color: var(--text);
  border-bottom: 1px solid var(--border-color);
}
.sidebar-brand .brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: .85rem .75rem; }
.sidebar-group-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: .9rem .65rem .35rem;
}
.sidebar-group-label:first-child { padding-top: .25rem; }
.sidebar-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .7rem;
  border-radius: 9px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text); }
.sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.sidebar-footer { padding: .85rem; border-top: 1px solid var(--border-color); }
.server-status {
  display: flex; align-items: center; gap: .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border-color);
  border-radius: 11px;
  padding: .7rem .85rem;
}
.server-status .ss-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.18);
  flex: 0 0 auto;
}
.server-status .ss-title { font-size: .78rem; font-weight: 700; color: var(--text); }
.server-status .ss-sub { font-size: .72rem; color: var(--text-muted); }
.server-status .ss-shield { margin-left: auto; color: #10b981; font-size: 1.1rem; }

.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  z-index: 1035; display: none;
}

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.75rem;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border-color);
}
.topbar-search {
  position: relative; flex: 1; max-width: 420px;
}
.topbar-search i {
  position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .95rem;
}
.topbar-search input {
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--surface-2);
  border-radius: 9px;
  padding: .5rem .8rem .5rem 2.2rem;
  font-size: .85rem; color: var(--text);
}
.topbar-search input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .55rem; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--border-color); background: var(--surface);
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.notif-dot {
  position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444; border: 2px solid var(--surface);
}
.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: inline; }
.pill-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--border-color); background: var(--surface);
  color: var(--text); border-radius: 9px; padding: .45rem .75rem; font-size: .82rem;
}
.pill-btn:hover { background: var(--surface-2); }
.pill-btn .pill-text { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-quick { border-radius: 9px; font-weight: 600; padding: .5rem .9rem; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.profile-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--border-color); background: var(--surface);
  border-radius: 10px; padding: .3rem .55rem .3rem .35rem; cursor: pointer;
}
.profile-btn:hover { background: var(--surface-2); }
.profile-btn .avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #60a5fa); color: #fff;
  display: grid; place-items: center; font-size: 1rem;
}
.profile-meta { text-align: left; line-height: 1.1; }
.profile-name { display: block; font-size: .82rem; font-weight: 600; color: var(--text); }
.profile-role { display: block; font-size: .7rem; color: var(--text-muted); }
.profile-btn i { color: var(--text-muted); font-size: .8rem; }

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  background: var(--brand-bg) !important;
  padding-top: .6rem;
  padding-bottom: .6rem;
}
.navbar-brand {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff !important;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.navbar-brand .brand-icon {
  width: 28px;
  height: 28px;
  background: #3b82f6;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  color: #fff;
}
.navbar-toggler { border-color: rgba(255,255,255,.25); }
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.navbar .nav-link {
  color: rgba(255,255,255,.75) !important;
  font-size: .88rem;
  padding: .4rem .7rem;
  border-radius: 5px;
  transition: color .15s, background .15s;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,.1);
}
.navbar .dropdown-menu {
  border: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  border-radius: 8px;
  padding: .4rem;
  margin-top: 6px;
}
.navbar .dropdown-item {
  border-radius: 5px;
  font-size: .875rem;
  padding: .45rem .8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.navbar .dropdown-item:hover { background: #f1f5f9; }
.navbar .dropdown-divider { margin: .3rem 0; }
.navbar-text {
  color: rgba(255,255,255,.65) !important;
  font-size: .82rem;
}
.nav-user-badge {
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  padding: .3rem .75rem;
  font-size: .82rem;
  color: rgba(255,255,255,.85) !important;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.nav-user-badge .badge {
  font-size: .68rem;
}

/* ── Cards ────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  background: var(--surface);
  color: var(--text);
}
.card-header {
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border-color);
  padding: .9rem 1.25rem;
  border-radius: 16px 16px 0 0 !important;
  font-weight: 600;
  font-size: .9rem;
}

/* Stat cards */
.stat-card {
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow: var(--card-shadow);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.stat-card .stat-icon {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.8rem;
  opacity: .25;
}
.stat-card .stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.stat-card .stat-value { font-size: 2.2rem; font-weight: 700; line-height: 1.1; margin: .2rem 0; }
.stat-card .stat-link { font-size: .8rem; opacity: .9; color: #fff; text-decoration: none; }
.stat-card .stat-link:hover { opacity: 1; text-decoration: underline; }
.stat-card.blue  { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.stat-card.green { background: linear-gradient(135deg, #059669, #10b981); }
.stat-card.amber { background: linear-gradient(135deg, #d97706, #f59e0b); }

/* Quick-access tiles (dashboard shortcuts) */
.quick-tile {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.quick-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
  border-color: #cbd5e1;
  color: inherit;
}
.quick-tile .qt-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}
.quick-tile .qt-title { font-weight: 600; font-size: .92rem; line-height: 1.2; }
.quick-tile .qt-sub   { font-size: .76rem; color: #64748b; }
.quick-tile .qt-arrow { margin-left: auto; color: #cbd5e1; font-size: 1.1rem; transition: transform .15s, color .15s; }
.quick-tile:hover .qt-arrow { transform: translateX(3px); color: #64748b; }
/* Soft icon backgrounds */
.qt-icon.blue    { background: #dbeafe; color: #2563eb; }
.qt-icon.cyan    { background: #cffafe; color: #0891b2; }
.qt-icon.indigo  { background: #e0e7ff; color: #4f46e5; }
.qt-icon.amber   { background: #fef3c7; color: #d97706; }
.qt-icon.slate   { background: #e2e8f0; color: #475569; }
.qt-icon.green   { background: #d1fae5; color: #059669; }
.qt-icon.violet  { background: #ede9fe; color: #7c3aed; }
.qt-icon.red     { background: #fee2e2; color: #dc2626; }

/* ── Tables ───────────────────────────────────────────── */
.table { font-size: .875rem; color: var(--text); --bs-table-bg: transparent; }
.table th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.table td { vertical-align: middle; border-color: var(--border-color); color: var(--text); }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table-hover tbody tr:hover > * { color: var(--text); }

.table-projects { font-size: .875rem; }
.table-projects td.url {
  word-break: break-all;
  font-family: SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
}

/* ── Badges ───────────────────────────────────────────── */
.badge { font-weight: 500; }
.action-badge { font-size: .72rem; font-weight: 600; padding: .3em .6em; border-radius: 4px; }

/* ── Forms ────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: #cbd5e1;
  border-radius: 6px;
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-label { font-size: .83rem; font-weight: 600; color: #374151; margin-bottom: .35rem; }
.form-text  { font-size: .78rem; }

/* ── Buttons ──────────────────────────────────────────── */
.btn { border-radius: 6px; font-size: .875rem; font-weight: 500; transition: all .15s; }
.btn-primary   { background: #2563eb; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-success   { background: #059669; border-color: #059669; }
.btn-success:hover { background: #047857; border-color: #047857; }
.btn-sm { font-size: .8rem; padding: .28rem .65rem; }

/* ── Login page ───────────────────────────────────────── */
body.login-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 14px;
  border: none;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-card .login-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
}
.login-card .login-logo {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
  margin: 0 auto 1rem;
}
.login-card .card-body { padding: 1rem 2rem 2rem; }

/* ── Page headers ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h2 { margin: 0; font-size: 1.4rem; font-weight: 700; color: #0f172a; }
.page-header .page-subtitle { font-size: .82rem; color: #64748b; margin-top: .1rem; }

/* ── Flash messages ───────────────────────────────────── */
.alert { border-radius: 8px; border: none; font-size: .875rem; display: flex; align-items: center; gap: .6rem; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef9c3; color: #854d0e; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ── Empty state ──────────────────────────────────────── */
.empty {
  padding: 3.5rem 1rem;
  text-align: center;
  color: #94a3b8;
}
.empty i { font-size: 2.5rem; display: block; margin-bottom: .75rem; }

/* ── Breadcrumb ───────────────────────────────────────── */
.breadcrumb { font-size: .82rem; }

/* ── List group ───────────────────────────────────────── */
.list-group-item-action {
  border-color: #e2e8f0;
  transition: background .12s;
}
.list-group-item-action:hover { background: #f8fafc; }

/* ── Setup stepper (project creation flow) ────────────── */
.setup-stepper {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 1.25rem 1.5rem 1.5rem;
}
.setup-step-header {
  font-size: .9rem;
  margin-bottom: .25rem;
}
.setup-step-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  height: 100%;
  display: flex;
  gap: 1rem;
  transition: border-color .15s;
}
.setup-step-card.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.setup-step-card.disabled {
  opacity: .55;
}
.setup-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.setup-step-card.disabled .setup-step-number {
  background: #94a3b8;
}
.setup-step-body { flex: 1; min-width: 0; }
.setup-step-title {
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .5rem;
}

/* ══════════════════════════════════════════════════════════
   Modern dashboard components
   ══════════════════════════════════════════════════════════ */

/* Dashboard header */
.dash-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.4rem;
}
.dash-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin: 0; color: var(--text); }
.dash-welcome { font-size: .95rem; font-weight: 600; color: var(--text); margin-top: .35rem; }
.dash-sub { font-size: .84rem; color: var(--text-muted); }
.dash-header-actions { display: flex; align-items: center; gap: .6rem; }
.date-pill {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--surface); border: 1px solid var(--border-color);
  border-radius: 9px; padding: .5rem .85rem; font-size: .82rem; color: var(--text); font-weight: 500;
}
.date-pill i { color: var(--text-muted); }

/* KPI cards */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--card-shadow);
  height: 100%;
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.kpi-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.35rem;
}
.kpi-icon.blue  { background: #dbeafe; color: #2563eb; }
.kpi-icon.green { background: #d1fae5; color: #059669; }
.kpi-icon.amber { background: #fef3c7; color: #d97706; }
.kpi-icon.cyan  { background: #cffafe; color: #0891b2; }
.kpi-card .spark { width: 84px; height: 30px; }
.kpi-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.kpi-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.kpi-sub { font-size: .76rem; color: #059669; font-weight: 600; display: flex; align-items: center; gap: .25rem; margin-top: .35rem; }
.kpi-sub i { font-size: .8rem; }
[data-theme="dark"] .kpi-icon.blue  { background: rgba(37,99,235,.18); }
[data-theme="dark"] .kpi-icon.green { background: rgba(16,185,129,.18); }
[data-theme="dark"] .kpi-icon.amber { background: rgba(245,158,11,.18); }
[data-theme="dark"] .kpi-icon.cyan  { background: rgba(8,145,178,.20); }

/* Line chart */
.line-chart { width: 100%; height: 220px; display: block; }
.line-chart .grid-line { stroke: var(--border-color); stroke-width: 1; stroke-dasharray: 3 4; }
.line-chart .axis-label { fill: var(--text-muted); font-size: 9px; font-family: inherit; }

/* Donut */
.donut-wrap { width: 160px; }
.donut { width: 100%; height: auto; }
.donut .donut-num { font-size: 26px; font-weight: 800; fill: var(--text); }
.donut .donut-cap { font-size: 10px; fill: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.donut-legend { display: flex; flex-direction: column; gap: .5rem; }
.dl-row { display: flex; align-items: center; gap: .5rem; font-size: .82rem; }
.dl-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.dl-name { color: var(--text); font-weight: 500; }
.dl-val { margin-left: auto; color: var(--text-muted); }

/* Quick-actions list */
.list-actions { padding: .5rem; display: flex; flex-direction: column; gap: .25rem; }
.action-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .75rem; border-radius: 11px;
  text-decoration: none; color: var(--text);
  transition: background .15s;
}
.action-row:hover { background: var(--surface-2); color: var(--text); }
.ar-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 1.05rem; flex: 0 0 auto; }
.ar-icon.blue { background:#dbeafe; color:#2563eb; }
.ar-icon.green{ background:#d1fae5; color:#059669; }
.ar-icon.amber{ background:#fef3c7; color:#d97706; }
.ar-icon.slate{ background:#e2e8f0; color:#475569; }
.ar-body { flex: 1; min-width: 0; }
.ar-title { display: block; font-size: .86rem; font-weight: 600; }
.ar-sub { display: block; font-size: .74rem; color: var(--text-muted); }
.ar-chev { color: var(--text-muted); font-size: .85rem; }
[data-theme="dark"] .ar-icon.blue { background: rgba(37,99,235,.18); }
[data-theme="dark"] .ar-icon.green{ background: rgba(16,185,129,.18); }
[data-theme="dark"] .ar-icon.amber{ background: rgba(245,158,11,.18); }
[data-theme="dark"] .ar-icon.slate{ background: rgba(148,163,184,.18); color:#cbd5e1; }

/* Recent activity dots + subtle badges */
.row-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .5rem; vertical-align: middle; }

/* Activity timeline */
.tl-daylabel { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin: .9rem 0 .6rem; }
.tl-daylabel:first-child { margin-top: 0; }
.tl-item { position: relative; display: flex; gap: .7rem; padding-left: .2rem; padding-bottom: 1rem; }
.tl-item:not(:last-of-type)::before {
  content: ""; position: absolute; left: 5px; top: 16px; bottom: 0;
  width: 2px; background: var(--border-color);
}
.tl-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; margin-top: 3px; z-index: 1; box-shadow: 0 0 0 3px var(--surface); }
.tl-dot.green { background:#10b981; } .tl-dot.red { background:#ef4444; }
.tl-dot.violet{ background:#8b5cf6; } .tl-dot.amber{ background:#f59e0b; }
.tl-dot.blue  { background:#3b82f6; } .tl-dot.slate{ background:#94a3b8; }
.tl-action { font-size: .84rem; font-weight: 600; color: var(--text); line-height: 1.2; }
.tl-meta { font-size: .74rem; color: var(--text-muted); margin-top: .1rem; }
.tl-viewall { display: inline-block; margin-top: .3rem; font-size: .8rem; font-weight: 600; text-decoration: none; }

/* Subtle badge fallbacks (Bootstrap 5.3 provides -subtle/-emphasis) */
.action-badge { border: 1px solid transparent; }

/* Dark-mode misc surfaces */
[data-theme="dark"] .badge.bg-light { background: var(--surface-2) !important; color: var(--text-muted) !important; border-color: var(--border-color) !important; }
[data-theme="dark"] .bg-light { background: var(--surface-2) !important; }
[data-theme="dark"] .text-dark { color: var(--text) !important; }
[data-theme="dark"] .dropdown-menu { background: var(--surface); border: 1px solid var(--border-color); }
[data-theme="dark"] .dropdown-item { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover { background: var(--surface-2); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
  background: var(--surface-2); border-color: var(--border-color); color: var(--text);
}
[data-theme="dark"] .page-header h2 { color: var(--text); }
[data-theme="dark"] .empty { color: var(--text-muted); }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .breadcrumb-item.active,
[data-theme="dark"] .card-body { color: var(--text); }

/* Top navigation progress bar */
#progressbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #60a5fa, #22d3ee);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
  z-index: 2000;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(37,99,235,.6);
  transition: transform .3s ease, opacity .25s ease;
}

/* Section heading (dashboard groups) */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: .5rem 0 1rem; }
.section-head h5 { color: var(--text); }

/* KPI card as a link (IPTV monitoring tiles) */
.kpi-link { text-decoration: none; color: inherit; }
.kpi-link:hover { color: inherit; }
.kpi-goto { color: var(--text-muted); font-size: .95rem; opacity: .5; transition: opacity .15s, transform .15s; }
.kpi-link:hover .kpi-goto { opacity: 1; transform: translate(2px,-2px); }
.kpi-sub-muted { color: var(--text-muted) !important; font-weight: 500; }

/* Current host chip */
.host-chip {
  display: inline-flex; align-items: center; gap: .55rem;
  background: var(--surface-2); border: 1px solid var(--border-color);
  border-radius: 10px; padding: .6rem .85rem; font-size: .85rem; color: var(--text);
  max-width: 100%;
}
.host-chip i { color: #d97706; flex: 0 0 auto; }

/* Config field rows (App Configuration page) */
.cfg-field { display: flex; gap: .9rem; padding: 1rem 0; border-top: 1px solid var(--border-color); }
.cfg-field:first-of-type { border-top: none; padding-top: .25rem; }
.cfg-icon {
  width: 42px; height: 42px; border-radius: 11px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 1.15rem; margin-top: .1rem;
}
.cfg-icon.blue  { background:#dbeafe; color:#2563eb; }
.cfg-icon.amber { background:#fef3c7; color:#d97706; }
.cfg-icon.green { background:#d1fae5; color:#059669; }
[data-theme="dark"] .cfg-icon.blue  { background: rgba(37,99,235,.18); }
[data-theme="dark"] .cfg-icon.amber { background: rgba(245,158,11,.18); }
[data-theme="dark"] .cfg-icon.green { background: rgba(16,185,129,.18); }
.cfg-body { flex: 1; min-width: 0; }
.cfg-label { display: flex; align-items: baseline; gap: .5rem; font-size: .86rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.cfg-hint { font-size: .74rem; font-weight: 400; color: var(--text-muted); }
.cfg-stat { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--border-color); }
.cfg-stat:first-child { padding-top: 0; }
.cfg-stat-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--text-muted); }
.cfg-stat-val { font-size: .85rem; color: var(--text); }

/* Responsive: collapse sidebar to an off-canvas drawer */
@media (max-width: 991.98px) {
  .app-main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .topbar, .app-content { padding-left: 1rem; padding-right: 1rem; }
}

/* ── Responsive: phones ───────────────────────────────────
   The sidebar already becomes a drawer below 992px. Below 768px the
   remaining desktop assumptions break down: a fixed-width search box eats
   the top bar, page headers put their action button beside a long title, and
   16px-under inputs make iOS zoom the whole page on focus. */
@media (max-width: 767.98px) {

  /* Tighter gutters — 1.75rem of padding is a lot of a 360px screen. */
  .app-content { padding: 1rem .85rem 1.5rem; }
  .topbar { padding: .6rem .85rem; gap: .5rem; }

  /* The search box is the widest thing in the bar; the drawer toggle,
     project switcher and profile menu all matter more on a phone. */
  .topbar-search { display: none; }
  .topbar-actions { margin-left: auto; gap: .35rem; }
  /* Icon-only primary action on phones: its label is the widest thing in the
     bar, and dropping it makes room for the Firebase project switcher, which
     is the control an admin actually needs there. */
  .btn-quick { padding: .45rem .6rem; font-size: .82rem; box-shadow: none; }
  .btn-quick .quick-label { display: none; }
  .btn-quick .bi { margin-right: 0 !important; }

  /* Project switcher: keep it readable but narrow enough to fit. */
  .pill-btn { padding: .4rem .55rem; }
  .pill-btn .pill-text { max-width: 92px; font-size: .78rem; }

  /* Stack headers, and let the action row use the full width instead of
     being squeezed against the title. */
  .page-header,
  .dash-header {
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
  }
  .page-header h2 { font-size: 1.15rem; }
  .dash-title { font-size: 1.25rem; }
  .dash-header-actions,
  .page-header > .btn,
  .page-header > a.btn {
    display: flex; flex-wrap: wrap; gap: .5rem; width: 100%;
  }
  .dash-header-actions > * { flex: 1 1 auto; justify-content: center; }

  /* 16px is the threshold below which iOS zooms on focus — that zoom then
     leaves the layout scrolled sideways, which reads as a broken page. */
  .form-control, .form-select, textarea { font-size: 16px; }

  /* Long hosts, package names and Remote Config keys must wrap rather than
     push the page wider than the viewport. */
  code, .font-monospace { overflow-wrap: anywhere; word-break: break-word; }

  /* Card actions: full-width, stacked, primary action first. */
  .card-footer { flex-wrap: wrap; gap: .5rem; }
  .card-footer .btn { flex: 1 1 auto; }

  /* Sparklines are decorative and cost ~90px of a narrow KPI card. */
  .kpi-card .spark { display: none; }
  .kpi-value { font-size: 1.45rem; }

  /* Wide tables scroll inside their own container, never the page body. */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .table td, .table th { white-space: nowrap; }
  .table td.url, .table td.wrap { white-space: normal; }

  /* Drawer covers most of the screen but leaves a strip to tap-dismiss. */
  .sidebar { width: min(84vw, 300px); }

  /* Modals: edge-to-edge on a phone rather than a floating card. */
  .modal-dialog { margin: .5rem; }
}

/* Never let the document itself scroll sideways — a single wide element
   should scroll its own container instead. */
html, body { max-width: 100%; overflow-x: hidden; }
