/* MultiBlox Admin — App shell & page layouts (v2) */

:root {
  --shell-h: 0px;
  --shell-pad-x: 24px;
  --shell-gap: 12px;
  --shell-tab-h: 32px;
  --shell-radius: 12px;
  --shell-surface: var(--surface);
  --shell-border: var(--border);
  --shell-accent: var(--accent);
  --shell-accent-hover: var(--accent-hover);
  --shell-accent-soft: var(--accent-soft);
  --shell-accent-muted: var(--accent-muted);
}

/* ── Tokens override ─────────────────────────────────────── */
.app-shell {
  --accent: var(--shell-accent);
  --accent-hover: var(--shell-accent-hover);
  --accent-soft: var(--shell-accent-soft);
  --accent-muted: var(--shell-accent-muted);
  --bg: var(--bg);
  --bg-subtle: var(--bg-subtle);
  --surface: var(--shell-surface);
  --surface-hover: var(--surface-hover);
  --border: var(--shell-border);
  --border-muted: var(--border-muted);
  --text-secondary: var(--text-secondary);
  --text-tertiary: var(--text-tertiary);
  --topbar-h: 0px;
}

/* ── Viewport shell ────────────────────────────────────────── */
html:has(body.app-shell) {
  height: 100%;
  overflow: hidden;
}

body.app-shell.has-nav {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.app-shell.has-nav .main-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  max-width: calc(100% - var(--sidebar-w));
}

body.app-shell.has-nav .wrap {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box;
}

body.app-shell.has-nav .wrap:not(.wrap--overview):not(.wrap--export) {
  padding: 0 !important;
}

body.app-shell.has-nav .wrap.wrap--overview {
  padding: 12px var(--shell-pad-x) 16px !important;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

body.app-shell .wrap > .flash {
  flex-shrink: 0;
  margin: 12px var(--shell-pad-x) 0;
}

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--shell-border);
  border-radius: 10px;
  background-color: var(--bg-subtle);
  background-image: var(--gradient-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Top bar (timezone + actions) ─────────────────────────── */
.admin-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  justify-content: flex-end;
  padding: 10px var(--shell-pad-x, 16px) 6px;
  position: sticky;
  top: 0;
  z-index: 44;
  background: linear-gradient(180deg, rgba(9, 9, 11, 0.96) 0%, rgba(9, 9, 11, 0.88) 70%, rgba(9, 9, 11, 0) 100%);
}

.admin-topbar__spacer {
  flex: 1;
  min-width: 0;
}

.admin-topbar__brand {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

.admin-topbar__logo {
  flex-shrink: 0;
  display: block;
}

.admin-topbar__search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.admin-topbar__search:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.admin-timezone {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(320px, 42vw);
}

.admin-timezone__label {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.admin-timezone__wrap {
  flex: 1;
  min-width: 0;
}

.admin-timezone__select {
  width: 100%;
  min-width: 9rem;
  min-height: 34px;
  height: 34px;
  padding: 0 28px 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(255, 255, 255, 0.04);
  background-image: var(--gradient-input, none);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.3;
  cursor: pointer;
}

.admin-timezone__select:focus {
  outline: none;
  border-color: var(--accent-muted);
  box-shadow: var(--focus-ring);
}

.admin-timezone__wrap::after {
  right: 10px;
  pointer-events: none;
}

.mobile-only {
  display: none;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

/* ── Left sidebar ─────────────────────────────────────────── */
.shell-sidebar {
  background-color: var(--bg-subtle);
  background-image: var(--gradient-sidebar);
  border-right: 1px solid var(--shell-border);
  padding: 12px 10px 10px;
}

.shell-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 14px;
  margin-bottom: 4px;
  text-decoration: none;
}

.shell-sidebar .sidebar-brand:hover {
  text-decoration: none;
}

.shell-sidebar .brand-logo {
  flex-shrink: 0;
  display: block;
  width: 24px;
  height: 24px;
}

.shell-sidebar .brand-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
}

.shell-sidebar .sidebar-nav {
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 2px 8px 0;
  margin-right: -2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.shell-sidebar .sidebar-nav__group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.shell-sidebar .sidebar-nav__group + .sidebar-nav__group {
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.shell-sidebar .sidebar-nav__label {
  display: block;
  padding: 0 10px 5px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  opacity: 0.7;
  user-select: none;
}

.shell-sidebar .sidebar-nav a,
.shell-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  outline: none;
  color: var(--text-secondary);
  transition: background 0.12s ease, color 0.12s ease;
}

.shell-sidebar .nav-item__label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.shell-sidebar .nav-item__count {
  margin-left: auto;
  flex: 0 0 auto;
  min-width: 1.25rem;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-tertiary);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.55;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.shell-sidebar .nav-item__count--live {
  background: var(--warn);
  color: var(--zinc-950);
}

.shell-sidebar .sidebar-nav a.active .nav-item__count {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.shell-sidebar .sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
}

.shell-sidebar .sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--zinc-200);
  font-weight: 600;
}

.shell-sidebar .sidebar-nav a:focus-visible {
  box-shadow: inset 2px 0 0 var(--zinc-200), 0 0 0 2px var(--accent-ring);
}

.shell-sidebar .nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.55;
  flex-shrink: 0;
}

.shell-sidebar .sidebar-nav a.active .nav-icon {
  opacity: 0.9;
  color: var(--text);
}

/* Sidebar footer */
.shell-sidebar .sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.shell-sidebar .sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  min-width: 0;
}

.shell-sidebar .sidebar-user__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 0.6875rem;
  font-weight: 600;
  flex-shrink: 0;
}

.shell-sidebar .sidebar-user__name {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-sidebar .sidebar-user__search,
.shell-sidebar .sidebar-user__exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.shell-sidebar .sidebar-user__search:hover,
.shell-sidebar .sidebar-user__exit:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.shell-sidebar .sidebar-user__exit:hover {
  color: var(--error);
}

.shell-sidebar .sidebar-user__logout {
  margin: 0;
}

.shell-bar__start {
  display: flex;
  align-items: center;
  gap: var(--shell-gap);
  flex-shrink: 0;
}

.shell-bar__center {
  display: flex;
  align-items: center;
  gap: var(--shell-gap);
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.shell-bar__end {
  display: flex;
  align-items: center;
  gap: var(--shell-gap);
  flex-shrink: 0;
  margin-left: auto;
}

/* Header period control (overview) */
.shell-period {
  display: inline-flex;
  padding: 3px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
}

.shell-period__btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.shell-period__btn:hover {
  color: var(--text-secondary);
}

.shell-period__btn.active {
  background: var(--gradient-accent);
  color: var(--accent-on);
}

/* Icon buttons in header */
.shell-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

.shell-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
  text-decoration: none;
}

.shell-icon-btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.shell-divider {
  width: 1px;
  height: 24px;
  background: var(--shell-border);
  flex-shrink: 0;
}

/* Tab navigation */
.shell-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--shell-tab-h);
  padding: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
}

.shell-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.12s ease, background 0.12s ease;
}

.shell-tab__icon {
  width: 14px;
  height: 14px;
  opacity: 0.5;
  flex-shrink: 0;
}

.shell-tab:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.shell-tab.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  box-shadow: none;
}

.shell-tab.active .shell-tab__icon {
  opacity: 1;
  color: var(--accent);
}

/* Segmented density control */
.shell-segment {
  display: inline-flex;
  padding: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
}

.shell-segment__btn {
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  white-space: nowrap;
  min-width: 4.5rem;
  transition: background 0.12s ease, color 0.12s ease;
}

.shell-segment__btn:hover {
  color: var(--text-secondary);
}

.shell-segment__btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Search trigger */
.shell-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-width: 200px;
  padding: 0 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.shell-search:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.shell-search kbd {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-tertiary);
}

/* User block */
.shell-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}

.shell-user__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: var(--elev-1);
}

.shell-user__name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-user__logout { margin: 0; }

.shell-user__exit {
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.12s ease;
}

.shell-user__exit:hover { color: var(--error); }

/* ── Page chrome ───────────────────────────────────────────── */
.page-chrome {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.page-chrome__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 16px);
  flex-shrink: 0;
  padding: var(--space-3, 16px) var(--shell-pad-x) var(--space-2, 12px);
}

.page-chrome__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.page-chrome__title h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-chrome__sub {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.page-chrome__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid var(--accent-muted);
}

.page-chrome__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Filter strip ──────────────────────────────────────────── */
.filter-strip {
  flex-shrink: 0;
  padding: 0 var(--shell-pad-x) 8px;
}

.filter-strip__inner {
  padding: var(--space-3, 16px);
  background: var(--surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shadow-card);
}

.filter-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.6fr) repeat(4, minmax(0, 1fr)) minmax(140px, 1.1fr);
  gap: 8px 10px;
  align-items: end;
}

.filter-row--master {
  grid-template-columns: minmax(160px, 1.4fr) repeat(5, minmax(0, 1fr)) minmax(140px, 1fr);
}

.filter-row--secondary {
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1fr) auto;
  max-width: 480px;
}

.filter-strip .toolbar-filters {
  display: block;
}

.filter-strip .field-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.filter-strip .field {
  min-width: 0;
}

.filter-strip input[type="search"],
.filter-strip input[type="text"],
.filter-strip select,
.filter-strip .select-wrap select {
  height: 30px;
  padding: 0 10px;
  font-size: 0.8125rem;
  border-radius: 6px;
  border: 1px solid var(--shell-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  width: 100%;
  box-sizing: border-box;
}

.filter-strip .select-wrap {
  width: 100%;
}

.filter-strip .field-check {
  display: flex;
  align-items: flex-end;
}

.filter-strip .check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* ── Data viewport (logs, trash) ───────────────────────────── */
.data-viewport {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0 var(--shell-pad-x) 10px;
}

.data-viewport__table .logs-table tbody td {
  padding: 4px 10px;
  line-height: 1.3;
  height: 36px;
  max-height: 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8125rem;
  vertical-align: middle;
}

.data-viewport .col-actions .btn,
.data-viewport td.col-actions .btn {
  padding: 2px 7px;
  font-size: 0.6875rem;
  line-height: 1.2;
  min-height: 0;
}

.data-viewport .btn-icon-danger {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1;
}

/* ── Overview page ─────────────────────────────────────────── */

.data-viewport__bulk {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  margin-bottom: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-muted);
  border-radius: var(--shell-radius);
  font-size: 0.8125rem;
}

.data-viewport__bulk[hidden] {
  display: none !important;
}

.data-viewport__table {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  box-shadow: var(--shadow-card);
  background-image: var(--gradient-card);
  overflow: hidden;
}

.data-viewport__table .table-wrap,
.data-viewport__table .table-wrap-sticky {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 0;
}

.data-viewport__table .logs-table .col-check { width: 36px; }
.data-viewport__table .logs-table .col-country { width: 72px; }
.data-viewport__table .logs-table .col-ip { width: 14%; }
.data-viewport__table .logs-table .col-user { width: 10%; }
.data-viewport__table .logs-table .col-tag { width: 11%; }
.data-viewport__table .logs-table .col-metric { width: 56px; }
.data-viewport__table .logs-table .col-time { width: 130px; }
.data-viewport__table .logs-table .col-actions { width: 200px; }

.data-viewport__table .logs-table,
.data-viewport__table .data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-viewport__table .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--shell-border);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 7px 12px;
  white-space: nowrap;
  text-align: left;
}

.data-viewport__table .data-table tbody td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.8125rem;
  vertical-align: middle;
}

.data-viewport__table .logs-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--shell-border);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: var(--space-2, 12px) var(--space-3, 16px);
  height: 44px;
  white-space: nowrap;
}

.data-viewport__table .logs-table tbody tr {
  transition: background 0.12s ease;
}

.data-viewport__table .logs-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.data-viewport__table .logs-table tbody tr:hover {
  background: var(--accent-soft);
}

.data-viewport__table .logs-table tbody tr.is-selected {
  background: var(--accent-muted);
}

.data-viewport__table .logs-table tbody tr:last-child td {
  border-bottom: none;
}

/* Logs list — tags, metrics, actions */
.data-viewport__table .log-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  border: 1px solid var(--accent-muted);
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.data-viewport__table .log-tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-viewport__table .log-tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--text);
}

.data-viewport__table .log-country-code {
  margin-left: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.data-viewport__table .log-metric-pwd {
  color: var(--warn);
  font-weight: 600;
  text-align: right;
}

.data-viewport__table .log-metric-ck {
  color: var(--ok);
  font-weight: 600;
  text-align: right;
}

.data-viewport__table .logs-table .col-metric {
  width: 64px;
  text-align: right;
}

.data-viewport__table .logs-table .col-actions {
  width: 210px;
}

.data-viewport .row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  padding: 2px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.data-viewport .row-actions .btn-creds {
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
}

.data-viewport .row-actions .btn-download {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok);
  font-weight: 600;
}

.data-viewport .row-actions .btn-download:hover {
  background: rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--ok);
  text-decoration: none;
}

.data-viewport__table .logs-table thead th.col-metric {
  text-align: right;
  padding-right: 14px;
}

.data-viewport__table .logs-table thead th {
  background: var(--table-head-bg);
  box-shadow: none;
}

.data-viewport__table .logs-table tbody td {
  padding: 14px var(--space-3, 16px);
  height: 48px;
  max-height: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.8125rem;
  vertical-align: middle;
}

.data-viewport__pagination {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--shell-border);
  border-radius: var(--shell-radius);
  font-size: 0.75rem;
}

.data-viewport__empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Compact row actions */
.data-viewport .col-actions {
  white-space: nowrap;
  text-align: right;
}

.data-viewport td.col-actions {
  text-align: right;
  vertical-align: middle;
}

/* ── Overview page ─────────────────────────────────────────── */
body.app-shell.has-nav .wrap.wrap--overview {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  overflow: hidden;
}

.wrap--overview .ov-page {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
}

.wrap--overview .ov-hero-actions {
  display: none;
}

.wrap--overview .ov-kpis {
  gap: 10px;
}

.wrap--overview .ov-kpi-value {
  font-size: 1.125rem;
}

.wrap--overview .ov-hero-title {
  font-size: 1.25rem;
}

.wrap--overview .ov-kpi {
  min-height: 60px;
  padding: 10px 12px;
  border-radius: var(--ov-card-radius, 10px);
  box-shadow: var(--shadow-card);
}

/* Export page layout lives in export.css */

/* ── Density compact ─────────────────────────────────────────── */
body.density-compact .data-viewport__table .logs-table tbody td {
  padding: 3px 10px;
  font-size: 0.75rem;
}

body.density-compact .data-viewport__table .logs-table thead th {
  padding: 5px 10px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .filter-row,
  .filter-row--master {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-row .field-search {
    grid-column: 1 / -1;
  }

  .filter-row--secondary {
    max-width: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  html:has(body.app-shell),
  html:has(body.app-shell.has-nav) {
    height: auto;
    overflow: auto;
  }

  body.app-shell.has-nav {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  body.app-shell.has-nav .main-column,
  body.has-nav .main-column {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100dvh;
  }

  body.app-shell.has-nav .wrap.wrap--runs,
  body.app-shell.has-nav .wrap.wrap--multiblox,
  body.app-shell.has-nav .wrap.wrap--telemetry {
    overflow-y: auto;
  }

  .filter-row,
  .filter-row--master,
  .filter-row--secondary {
    grid-template-columns: 1fr 1fr;
  }

  .filter-row .field-search {
    grid-column: 1 / -1;
  }

  .page-chrome__head {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
  }

  .data-viewport,
  .filter-strip {
    padding-left: 12px;
    padding-right: 12px;
  }
}

.wrap--logs .page-chrome,
.wrap--logs:not(.wrap--runs) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.app-shell.has-nav .wrap.wrap--runs,
body.app-shell.has-nav .wrap.wrap--multiblox,
body.app-shell.has-nav .wrap.wrap--telemetry {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1px 1px 2px;
}
body.app-shell.has-nav .wrap {
  flex: 1;
  min-height: 0;
}

body.app-shell.has-nav .wrap:has(.acct-dash),
body.app-shell.has-nav .wrap:has(.run-view) {
  overflow-y: auto !important;
  display: block !important;
}

body.app-shell.has-nav .acct-dash,
body.app-shell.has-nav .run-view {
  overflow: visible !important;
  min-height: auto;
}
