/* =====================================================================
   MANIFEST — MONOCHROME DESIGN SYSTEM
   Theme: Strict Black & White Monochrome
   Corner Radius: 6px Universal
   Typography: Ultra-Comfortable Modern Sans Typography (Inter & Plus Jakarta Sans)
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@700;800;900&family=IBM+Plex+Mono:wght@600;700&display=swap');

:root {
  /* Monochrome Ink Palette */
  --ink-950: #09090B;
  --ink-900: #18181B;
  --ink-800: #27272A;
  --ink-700: #3F3F46;
  --ink-600: #52525B;
  --ink-500: #71717A;
  --ink-400: #A1A1AA;
  --ink-300: #D4D4D8;
  --ink-200: #E4E4E7;
  --ink-100: #F4F4F5;
  --ink-50:  #FAFAFA;
  --paper:   #FAFAFA;
  --white:   #FFFFFF;
  --line:    #E4E4E7;

  /* Monochrome Semantic Status */
  --good:        #09090B;
  --good-bg:     #F4F4F5;
  --good-border: #09090B;
  --warn:        #27272A;
  --warn-bg:     #FFFFFF;
  --warn-border: #71717A;
  --bad:         #18181B;
  --bad-bg:      #F4F4F5;
  --bad-border:  #D4D4D8;

  /* Strict Universal 6px Radius */
  --radius:      6px;
  --r-sm:        6px;
  --r-md:        6px;
  --r-lg:        6px;
  --r-xl:        6px;
  --radius-full: 6px;

  /* Eye-Friendly Modern Sans Typography */
  --font-display: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Geometry & Elevation */
  --sidebar-w: 252px;
  --topbar-h:  60px;
  --shadow-sm: 0 1px 2px rgba(9,9,11,.05);
  --shadow-md: 0 4px 16px rgba(9,9,11,.08);
  --shadow-lg: 0 12px 40px rgba(9,9,11,.14);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 13.5px;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border-radius: var(--radius); }
ul { list-style: none; }
input, select, textarea { font-family: inherit; font-size: 13.5px; border-radius: var(--radius); }
.icon { width: 17px; height: 17px; flex: none; }
::selection { background: var(--ink-950); color: var(--white); }

/* ---------- Visibility utilities ---------- */
.mobile-only {
  display: none !important;
}

.desktop-only {
  display: inline-flex !important;
}

.mobile-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  background: var(--white);
  border: 1px solid var(--ink-300);
  border-radius: 6px;
  color: var(--ink-950);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}

.mobile-logout-btn:hover {
  background: var(--ink-100);
  border-color: var(--ink-950);
}

/* ---------- Shell layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

.main-view {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--paper);
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.main-view:has(.table-panel) {
  overflow: hidden;
}

.content {
  padding: 20px 24px 60px;
  max-width: 1400px;
  width: 100%;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.content:has(.table-panel) {
  flex: 1;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  padding-bottom: 0;
}

/* ---------- Custom Scrollbars (Comfortable 10px, visible and grabable) ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: rgba(9, 9, 11, 0.05); }
::-webkit-scrollbar-thumb { background: var(--ink-400); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-600); border: 2px solid transparent; background-clip: padding-box; }
* { scrollbar-width: auto; scrollbar-color: var(--ink-400) rgba(9, 9, 11, 0.05); }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--ink-950);
  color: var(--ink-300);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--ink-900);
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  position: relative;
  flex: none;
}

.sidebar-brand .mark {
  width: 20px;
  height: 20px;
  position: relative;
  flex: none;
  background: var(--white);
  border-radius: 6px;
}

.sidebar-brand .mark::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1.5px solid var(--ink-950);
  border-radius: 3px;
}

.sidebar-brand span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .04em;
  color: var(--white);
}

.nav-scroll {
  flex: 1;
  min-height: 0;
  padding: 6px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-700) transparent;
}

.sidebar::-webkit-scrollbar, .nav-scroll::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb, .nav-scroll::-webkit-scrollbar-thumb { background: var(--ink-700); border-radius: 6px; }

.nav-group { display: flex; flex-direction: column; margin-bottom: 2px; }

.nav-item, .nav-entity-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-300);
  transition: all .15s ease;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover, .nav-entity-header:hover {
  background: var(--ink-900);
  color: var(--white);
}

.nav-item.active {
  background: var(--white);
  color: var(--ink-950);
  font-weight: 700;
}

.nav-item .count, .nav-sub-item .count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-400);
  background: rgba(255,255,255,.08);
  padding: 2px 7px;
  border-radius: 6px;
  min-width: 18px;
  text-align: center;
}

.nav-item.active .count {
  background: var(--ink-100);
  color: var(--ink-950);
  font-weight: 700;
}

.nav-divider {
  height: 1px;
  background: var(--ink-800);
  margin: 12px 10px 14px;
}

.nav-entity-group { margin-bottom: 2px; }

.nav-entity-header {
  font-weight: 600;
  color: var(--ink-200);
  font-family: var(--font-display);
  letter-spacing: -.01em;
  justify-content: space-between;
}

.nav-entity-header .chevron {
  transition: transform .18s ease;
  width: 15px;
  height: 15px;
}

.nav-entity-group.open .chevron { transform: rotate(90deg); }

.nav-entity-items {
  display: none;
  padding-left: 12px;
  margin-top: 2px;
  border-left: 1px solid var(--ink-800);
  margin-left: 14px;
}

.nav-entity-group.open .nav-entity-items {
  display: flex;
  flex-direction: column;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-400);
  transition: all .15s ease;
  margin-left: 2px;
}

.nav-sub-item:hover {
  background: var(--ink-900);
  color: var(--white);
}

.nav-sub-item.active {
  background: var(--white);
  color: var(--ink-950);
  font-weight: 700;
}

.sidebar-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--ink-900);
}

.sidebar-version {
  font-size: 11.5px;
  color: var(--ink-500);
  letter-spacing: .02em;
}

.sidebar-close { display: none; }

/* ---------- Topbar / header ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.menu-toggle { display: none; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ink-50);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  width: 100%;
  max-width: 340px;
  transition: all .15s ease;
}

.search-box.global-search { 
  max-width: 440px; 
  position: relative;
}

.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 360px;
  max-width: 520px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  max-height: 420px;
  overflow-y: auto;
  z-index: 10000;
  display: none;
}

.global-search-dropdown.show {
  display: block;
}

.global-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background-color .12s ease;
}

.global-search-item:last-child {
  border-bottom: none;
}

.global-search-item:hover,
.global-search-item.active {
  background: var(--ink-50);
}

.global-search-main {
  min-width: 0;
  flex: 1;
}

.global-search-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.global-search-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-950);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-sub {
  font-size: 11.5px;
  color: var(--ink-500);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--ink-100);
  color: var(--ink-700);
  border: 1px solid var(--ink-200);
  white-space: nowrap;
  flex: none;
  letter-spacing: 0.02em;
}

.global-search-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 10px;
  flex: none;
}

.global-search-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-500);
}

.global-search-loading {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-500);
}

.search-shortcut {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--white);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: auto;
  flex: none;
}

.search-box:focus-within {
  border-color: var(--ink-900);
  background: var(--white);
  box-shadow: 0 0 0 2px var(--ink-100);
}

.search-box input {
  border: none;
  outline: none;
  background: none;
  font-size: 13px;
  width: 100%;
  flex: 1;
  color: var(--ink-900);
  min-width: 0;
}

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-700);
  background: none;
  border: none;
  transition: all .15s ease;
}

.header-icon-btn:hover {
  background: var(--ink-100);
  color: var(--ink-950);
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--ink-950);
  border-radius: 6px;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--white);
  border-radius: 6px;
  border: 1.5px solid var(--ink-950);
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  transition: all .15s ease;
  position: relative;
  cursor: pointer;
}

.header-profile:hover {
  background: var(--ink-50);
  border-color: var(--line);
}

.header-profile .chevron { width: 14px; height: 14px; color: var(--ink-400); margin-left: 4px; }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--ink-950);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  flex: none;
  letter-spacing: .02em;
}

.header-user-info {
  display: none;
  flex-direction: column;
  line-height: 1.2;
  align-items: flex-start;
  text-align: left;
}

.header-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-950);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-email {
  font-size: 11.5px;
  color: var(--ink-500);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media(min-width: 860px) { .header-user-info { display: flex; } }

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 50;
}

.profile-menu.show { display: block; }

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  transition: all .15s ease;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
}

.profile-menu-item:hover { background: var(--ink-50); }
.profile-menu-item.danger { color: var(--ink-950); font-weight: 700; }
.profile-menu-item.danger:hover { background: var(--ink-100); }
.menu-divider { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- Page head ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.eyebrow {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  margin-bottom: 4px;
  font-weight: 600;
}

h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink-950);
}

h2 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink-950);
}

h3 {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-950);
}

.page-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Table mount container ---------- */
#table-mount {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ---------- Buttons (6px radius, monochrome) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  height: 36px;
  border-radius: 6px;
  background: var(--ink-950);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--ink-950);
  transition: all .15s ease;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
}

.btn:hover { background: var(--ink-800); border-color: var(--ink-800); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn.secondary {
  background: var(--white);
  color: var(--ink-900);
  border-color: var(--ink-300);
}

.btn.secondary:hover {
  background: var(--ink-50);
  border-color: var(--ink-950);
  color: var(--ink-950);
}

.btn.danger {
  background: var(--ink-950);
  border-color: var(--ink-950);
  color: var(--white);
}

.btn.danger:hover {
  background: #000000;
  border-color: #000000;
}

.btn.ghost {
  background: none;
  border-color: transparent;
  color: var(--ink-700);
}

.btn.ghost:hover {
  background: var(--ink-100);
  color: var(--ink-950);
}

.btn.sm {
  padding: 0 11px;
  height: 30px;
  font-size: 12px;
  border-radius: 6px;
}

.btn.icon-btn-square {
  padding: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  justify-content: center;
  border-radius: 6px;
}

.page-head-actions .btn { height: 36px; box-sizing: border-box; }
.gap-lg { gap: 10px; }

/* ---------- Stat cards (6px radius) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 14px; }
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.stat-label { font-size: 11.5px; color: var(--ink-500); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-val { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--ink-950); letter-spacing: -.02em; }
.stat-sub { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }

.dash-charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width: 960px) { .dash-charts-grid { grid-template-columns: 1fr; } }

.chart-panel-double, .chart-panel-single {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.chart-mount { padding-top: 6px; height: 220px; max-height: 220px; min-height: 220px; overflow: hidden; position: relative; box-sizing: border-box; }
.chart-mount svg { width: 100% !important; height: 100% !important; max-height: 220px !important; display: block; }
.chart-mount.scroll { max-height: 260px; overflow-y: auto; }
.chart-mount.column { display: flex; justify-content: center; align-items: center; }
.chart-legend.center { display: flex; justify-content: center; flex-wrap: wrap; }
.sd-legend-dot { width: 8px; height: 8px; border-radius: 6px; display: inline-block; margin-right: 5px; }
.empty-data-msg { color: var(--ink-500); font-size: 13px; text-align: center; padding: 24px 0; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
}

.panel-head.tight { padding-bottom: 8px; border-bottom: none; }
.panel-head.spaced { align-items: baseline; }
.panel-sub { font-size: 12px; color: var(--ink-500); }
.view-all { font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.view-all:hover { color: var(--ink-950); }

.timeline-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--ink-100);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.timeline-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-600);
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}

.timeline-btn:hover:not(.active) { color: var(--ink-950); background: var(--ink-200); }
.timeline-btn.active { background: var(--ink-950); color: var(--white); }

.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 120px 1fr 60px; gap: 12px; align-items: center; }
.hbar-label { font-size: 12.5px; color: var(--ink-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--ink-100); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--ink-950); border-radius: 6px; transition: width .4s ease; }
.hbar-fill.muted { background: var(--ink-400); }
.hbar-val { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-500); text-align: right; }

.donut-mount-wrap { position: relative; display: inline-block; }
.donut-mount-svg circle { transition: stroke-width .15s ease, opacity .15s ease; cursor: pointer; }
.donut-center-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.sd-num { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--ink-950); }
.sd-lbl { font-size: 11px; color: var(--ink-500); }

/* ---------- Table panel & toolbar ---------- */
.table-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  position: relative;
  flex-shrink: 0;
}

.header-search-wrap { flex: 1; min-width: 180px; max-width: 340px; }
.table-toolbar-divider { width: 1px; height: 24px; background: var(--line); }

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--ink-300);
  background: var(--white);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-700);
  transition: all .15s ease;
}

.filter-pill:hover, .filter-pill.active { border-color: var(--ink-950); color: var(--ink-950); background: var(--ink-50); }

.filter-select {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--ink-200);
  background: var(--white);
  font-size: 12.5px;
  color: var(--ink-800);
  font-weight: 500;
  width: auto;
  max-width: 200px;
}

.filter-btn-wrap { position: relative; display: inline-block; }
.filter-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  padding: 16px;
  min-width: 260px;
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 16px;
}

.filter-panel.show { display: flex; }
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-group label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-500); letter-spacing: 0.05em; }
.filter-group select, .filter-group input[type="date"] {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--ink-300);
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-900);
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.filter-panel .btn {
  height: 40px;
  width: 100%;
  justify-content: center;
  border-radius: 6px;
  box-sizing: border-box;
}

.toolbar-spacer { flex: 1; }

.bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--ink-950);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  z-index: 20;
  border-bottom: 1px solid var(--ink-900);
  animation: bulk-bar-in .15s ease;
}

@keyframes bulk-bar-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.bulk-bar.show { display: flex; flex-wrap: wrap; }
.bulk-bar span { white-space: nowrap; }

.bulk-bar .bulk-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px 3px 6px;
  border-radius: 6px;
  background: var(--ink-800);
  color: var(--white);
}

.bulk-bar .bulk-count .bulk-count-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--white);
  color: var(--ink-950);
  font-size: 11.5px;
  font-weight: 700;
}

.bulk-bar .btn, .bulk-bar select.btn {
  padding: 0 12px;
  height: 32px;
  font-size: 12.5px;
  white-space: nowrap;
  width: 150px;
  flex: none;
  text-align: center;
  justify-content: center;
  border-radius: 6px;
}

.bulk-bar .btn.secondary { background: var(--white); color: var(--ink-950); border-color: var(--white); }
.bulk-bar .btn.secondary:hover { background: var(--ink-100); }

.bulk-bar .bulk-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--ink-300);
  transition: all .15s ease;
  margin-left: 8px;
}

.bulk-bar .bulk-close-btn:hover { background: var(--ink-800); color: var(--white); }
.bulk-bar .bulk-close-btn svg { width: 16px; height: 16px; }

.table-wrap {
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

table { width: 100%; border-collapse: collapse; min-width: 640px; position: relative; }
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--ink-500);
  text-transform: uppercase;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-50);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--line);
}

tbody td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--ink-800);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--ink-50); }
tbody tr.selected { background: var(--ink-100); }

.cell-primary { font-weight: 600; color: var(--ink-950); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cell-sub { font-size: 12px; color: var(--ink-500); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cell-mono { font-family: var(--font-mono); font-size: 12px; }

/* ---------- Monochrome Badges (6px radius) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .01em;
}

.badge.good {
  background: var(--ink-950);
  color: var(--white);
  border: 1px solid var(--ink-950);
}

.badge.warn {
  background: var(--white);
  color: var(--ink-950);
  border: 1px solid var(--ink-800);
}

.badge.bad {
  background: var(--ink-100);
  color: var(--ink-600);
  border: 1px solid var(--ink-300);
}

.badge.neutral {
  background: var(--ink-100);
  color: var(--ink-700);
  border: 1px solid var(--line);
}

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 6px;
  background: currentColor;
  position: static;
}

select.badge-select {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  padding: 4px 22px 4px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background-color: var(--white);
  color: var(--ink-950);
  border: 1px solid var(--ink-300);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 11px;
  transition: all .15s ease;
}

select.badge-select:hover { border-color: var(--ink-950); background-color: var(--ink-50); }
select.badge-select:focus { outline: none; border-color: var(--ink-950); box-shadow: 0 0 0 2px var(--ink-100); }

.row-actions { position: relative; display: flex; justify-content: center; }
.row-actions-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink-500);
  transition: all .15s ease;
}

.row-actions-btn:hover { background: var(--ink-100); color: var(--ink-950); }

.row-actions-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  width: 150px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  padding: 5px;
  z-index: 60;
  display: none;
}

.row-actions-menu.show { display: block; }
.row-actions-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-800);
  background: none;
  border: none;
  text-align: left;
}

.row-actions-menu button:hover { background: var(--ink-50); color: var(--ink-950); }
.row-actions-menu button.danger { color: var(--ink-950); font-weight: 700; }
.row-actions-menu button.danger:hover { background: var(--ink-100); }

/* ---------- Pagination bar & controls ---------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  flex-wrap: nowrap;
  gap: 10px;
  background: var(--white);
  flex-shrink: 0;
  min-height: 40px;
}

.pagination-left { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.pagination-info { font-size: 12px; color: var(--ink-500); white-space: nowrap; line-height: 1; }
.pagination-info b { color: var(--ink-950); font-weight: 700; }
.page-size-selector { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-600); white-space: nowrap; line-height: 1; }

.page-size-select {
  padding: 2px 6px;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  background: var(--white);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-900);
  cursor: pointer;
  outline: none;
  height: 26px;
}

.page-size-select:focus { border-color: var(--ink-950); }

.pagination-controls { display: flex; align-items: center; gap: 4px; }
.page-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-700);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
  line-height: 1;
}

.page-btn:hover:not(:disabled):not(.active) {
  background: var(--ink-50);
  border-color: var(--ink-400);
  color: var(--ink-950);
}

.page-btn.active {
  background: var(--ink-950);
  border-color: var(--ink-950);
  color: var(--white);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--ink-100);
}

.page-ellipsis {
  min-width: 18px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-400);
  font-weight: 600;
  font-size: 12px;
  user-select: none;
}

/* ---------- Empty state ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; color: var(--ink-500); gap: 8px; }
.empty-state svg { width: 40px; height: 40px; color: var(--ink-300); margin-bottom: 6px; }
.empty-state b { color: var(--ink-900); font-size: 14px; }

/* ---------- Modal / drawer form ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 10, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  background: var(--white);
  border-radius: 6px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.wide {
  max-width: 900px;
}

.modal-card-handle {
  display: none;
  width: 36px;
  height: 4px;
  background: var(--ink-300);
  border-radius: 6px;
  margin: 8px auto 4px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header.compact h2 {
  font-size: 16px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-body.flush {
  padding: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.modal-footer.modal-footer-5050 {
  justify-content: flex-end;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--ink-500);
  cursor: pointer;
  transition: all .15s ease;
}

.modal-close-btn:hover {
  background: var(--ink-50);
  color: var(--ink-950);
}

.modal-template-shell {
  display: block;
  min-height: 320px;
}

.main.flush {
  padding: 20px 22px;
  overflow-y: auto;
}

.form-section {
  margin-bottom: 26px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 12px;
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.form-section-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-950);
  margin-bottom: 16px;
}

.form-section-desc {
  font-size: 12px;
  color: var(--ink-500);
  margin-bottom: 14px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

@media(max-width: 640px) {
  .grid2, .grid3 {
    grid-template-columns: 1fr;
  }
}

.span2 {
  grid-column: span 2;
}

.span3 {
  grid-column: span 3;
}

@media(max-width: 640px) {
  .span2, .span3 {
    grid-column: span 1;
  }
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group.spaced {
  margin-bottom: 10px;
}

.field-group.tight-top {
  margin-top: 8px;
}

.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-700);
}

.field-group label .req {
  color: var(--bad);
  font-weight: 700;
  margin-left: 2px;
}

.field-hint {
  font-size: 11px;
  color: var(--ink-400);
  margin-top: -2px;
}

input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=password], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink-900);
  outline: none;
  transition: all .15s ease;
  font-size: 13.5px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--ink-900);
  box-shadow: 0 0 0 3px var(--ink-100);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--ink-50);
  color: var(--ink-500);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.mono-input {
  font-family: var(--font-mono);
}

.select-narrow {
  max-width: 260px;
}

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

.chip-option {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid var(--ink-200);
  background: var(--white);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-600);
  transition: all .15s ease;
  cursor: pointer;
}

.chip-option:hover {
  border-color: var(--ink-400);
}

.chip-option.selected {
  background: var(--ink-950);
  border-color: var(--ink-950);
  color: var(--white);
}

.radio-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-800);
}

.view-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.view-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.view-field .val {
  font-size: 13.5px;
  color: var(--ink-900);
  font-weight: 500;
}

.view-field .val.empty {
  color: var(--ink-300);
  font-style: italic;
  font-weight: 400;
}

.spacer-sm {
  height: 10px;
}

/* ---------- Customer Lookup Dropdown (6px radius) ---------- */
.customer-lookup-container {
  position: relative;
}

.customer-lookup-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.customer-lookup-item {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .12s ease;
}

.customer-lookup-item:last-child {
  border-bottom: none;
}

.customer-lookup-item:hover {
  background: var(--ink-50);
}

/* ---------- Multi-Product Quantity Selector ---------- */
.multi-product-select-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  padding: 12px;
}

.multi-product-select-container:focus-within {
  border-color: var(--ink-900);
  box-shadow: 0 0 0 3px var(--ink-100);
}

.multi-product-search-wrapper {
  position: relative;
}

.multi-product-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-400);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.multi-product-search {
  width: 100%;
  padding: 8px 12px 8px 32px !important;
  font-size: 13px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: var(--paper) !important;
  transition: all .15s ease;
}

.multi-product-search:focus {
  background: var(--white) !important;
  border-color: var(--ink-900) !important;
  box-shadow: none !important;
}

.multi-product-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.multi-product-option {
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.12s ease;
  user-select: none;
}

.multi-product-option:last-child {
  border-bottom: none;
}

.multi-product-option:hover {
  background: var(--ink-50);
}

.multi-product-option.selected {
  background: var(--ink-50);
}

.multi-product-option.unavailable {
  opacity: 0.5;
  background: var(--paper);
  cursor: not-allowed;
}

.multi-product-items-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.multi-product-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  gap: 10px;
}

.multi-product-item-info {
  flex: 1;
  min-width: 0;
}

.multi-product-item-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-950);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi-product-item-meta {
  font-size: 11.5px;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  gap: 8px;
}

.multi-product-item-meta .sku-tag {
  color: var(--ink-400);
}

.multi-product-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.qty-btn {
  background: var(--ink-50);
  border: none;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-700);
  cursor: pointer;
  transition: background 0.1s;
}

.qty-btn:hover {
  background: var(--ink-200);
  color: var(--ink-950);
}

.qty-input {
  width: 36px !important;
  height: 26px !important;
  padding: 0 !important;
  text-align: center !important;
  border: none !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  background: var(--white) !important;
  color: var(--ink-950) !important;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.item-line-price {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-950);
  min-width: 60px;
  text-align: right;
  font-family: var(--font-display);
}

.remove-product-btn {
  background: none;
  border: none;
  color: var(--ink-400);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all .12s ease;
}

.remove-product-btn:hover {
  background: var(--bad-bg);
  color: var(--bad);
}

.multi-product-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 2px 4px;
  font-size: 12.5px;
  color: var(--ink-600);
  border-top: 1px dashed var(--line);
  margin-top: 2px;
}

.multi-product-summary-bar .total-label {
  font-weight: 500;
}

.multi-product-summary-bar .total-amount {
  font-weight: 700;
  color: var(--ink-950);
  font-size: 14px;
  font-family: var(--font-display);
}

.multi-product-view-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.multi-product-view-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
}

.multi-product-view-badge {
  background: var(--ink-950);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  margin-right: 6px;
}

/* ---------- Custom Duration Picker ---------- */
.duration-input-wrap {
  display: flex;
  gap: 8px;
}
.duration-input-wrap input {
  flex: 1;
}

/* ---------- Variants container ---------- */
.variants-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.variant-row {
  display: flex;
  gap: 8px;
}
.variant-row input {
  flex: 1;
}
.variant-row .remove-variant-btn {
  padding: 0 12px;
  border-radius: 6px;
  background: var(--white);
  border: 1px solid var(--ink-300);
  color: var(--ink-700);
}
.variant-row .remove-variant-btn:hover {
  background: var(--ink-950);
  color: var(--white);
  border-color: var(--ink-950);
}



/* ---------- Settings Cards (6px radius) ---------- */
.settings-stack { display: flex; flex-direction: column; gap: 16px; }
.settings-stack.lg { gap: 20px; }
.settings-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.settings-card h3 { margin-bottom: 12px; }

/* ---------- Auth / Login (6px radius, monochrome) ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
@media(max-width: 860px) { .auth-shell { grid-template-columns: 1fr; } }
.auth-visual {
  background: var(--ink-950);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  position: relative;
  overflow: hidden;
}

@media(max-width: 860px) { .auth-visual { display: none; } }
.auth-visual-brand { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.auth-visual-brand .mark { width: 22px; height: 22px; background: var(--white); border-radius: 6px; }
.auth-visual-brand span { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: .04em; }

.auth-visual-copy { position: relative; z-index: 1; max-width: 420px; }
.auth-visual-copy h2 { color: var(--white); font-size: 28px; margin-bottom: 12px; letter-spacing: -.02em; }
.auth-visual-copy p { color: var(--ink-300); font-size: 14px; line-height: 1.6; }

.auth-visual-props { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; }
.auth-visual-props .prop { font-size: 12.5px; color: var(--ink-400); display: flex; gap: 10px; align-items: center; }
.auth-visual-props .prop::before { content: ""; width: 6px; height: 6px; border-radius: 6px; background: var(--white); }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--paper); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .eyebrow { margin-bottom: 4px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card p.lead { color: var(--ink-500); font-size: 13.5px; margin-bottom: 28px; }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }

.auth-error {
  background: var(--ink-950);
  color: var(--white);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}
.auth-error.show { display: block; }
.auth-submit { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; height: 42px; }
.auth-foot { margin-top: 22px; font-size: 12px; color: var(--ink-400); text-align: center; }

/* ---------- Toast Notifications (6px radius, monochrome) ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 20000; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
@media(max-width: 640px) { .toast-stack { left: 16px; right: 16px; bottom: 16px; max-width: none; } }
.toast {
  background: var(--ink-950);
  color: var(--white);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in .2s ease;
  border: 1px solid var(--ink-800);
}

.toast.error { background: var(--ink-950); border: 1px solid var(--ink-700); color: var(--white); }
.toast.success { background: var(--ink-950); border: 1px solid var(--ink-700); color: var(--white); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Loading ---------- */
.loading-row { text-align: center; padding: 40px; color: var(--ink-400); font-size: 13px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--ink-200); border-top-color: var(--ink-950); border-radius: 6px; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Overlay backdrop for mobile sidebar ---------- */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(9,9,11,.6); backdrop-filter: blur(3px); z-index: 99; }
.sidebar-backdrop.show { display: block; }

/* ---------- Mobile Brand Header & Bottom Navigation ---------- */
.mobile-brand-logo { display: none !important; align-items: center; gap: 8px; text-decoration: none; }
.mobile-topbar-right { display: none !important; }
.mobile-brand-logo .mark { width: 16px; height: 16px; background: var(--ink-950); border-radius: 6px; display: inline-block; }
.mobile-brand-logo .brand-text { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: 0.05em; color: var(--ink-950); }

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--white);
  border-top: 1px solid var(--line);
  z-index: 990;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-500);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  flex: 1;
  height: 100%;
  transition: color 0.15s;
}

.mobile-nav-item.active { color: var(--ink-950); font-weight: 700; }
.mobile-nav-item .icon { width: 22px; height: 22px; }

.mobile-fab-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
}

.mobile-fab-btn {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: var(--ink-950);
  color: var(--white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s;
  outline: none;
}

.mobile-fab-btn.open { transform: rotate(45deg); background: var(--ink-800); }
.mobile-fab-btn .fab-icon { width: 20px; height: 20px; }

/* Mobile Entity Popup Modal */
.mobile-entity-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9,9,11,.65);
  z-index: 985;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: 78px;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mobile-entity-modal-overlay.show { display: flex; opacity: 1; }
.mobile-entity-modal {
  background: var(--ink-950);
  color: var(--white);
  border-radius: 6px;
  padding: 22px;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--ink-800);
}

.mobile-entity-group { margin-bottom: 20px; }
.mobile-entity-group:last-child { margin-bottom: 0; }
.mobile-entity-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
  font-family: var(--font-display);
}

.mobile-entity-links { display: flex; flex-direction: column; gap: 6px; padding-left: 12px; }
.mobile-entity-link {
  color: var(--ink-200);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  padding: 3px 0;
}

.mobile-entity-link:hover, .mobile-entity-link:active { color: var(--white); }

/* Mobile Alert Banner */
.mobile-alert-banner {
  display: none;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--ink-300);
  border-radius: 6px;
  color: var(--ink-800);
  font-size: 12.5px;
  line-height: 1.45;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.mobile-cards-list { display: none; }
.mobile-record-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  cursor: pointer;
}

.mobile-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mobile-card-title { font-size: 15px; font-weight: 700; color: var(--ink-950); }
.mobile-card-sub { font-size: 12.5px; color: var(--ink-500); margin-top: 4px; }
.mobile-card-action-wrap { margin-top: 12px; }
.mobile-card-btn {
  width: 100%;
  height: 36px;
  border-radius: 6px;
  background: var(--ink-950);
  color: var(--white);
  border: 1px solid var(--ink-950);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Mobile Action Sheet Drawer (6px radius) */
.mobile-actions-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9,9,11,.6);
  z-index: 10000;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.mobile-actions-sheet-overlay.show { display: flex; opacity: 1; }
.mobile-actions-sheet {
  background: var(--white);
  width: 100%;
  max-width: 480px;
  border-radius: 6px 6px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}

.mobile-actions-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.mobile-actions-sheet-title { font-size: 15px; font-weight: 700; color: var(--ink-950); }
.mobile-actions-sheet-close { background: none; border: none; font-size: 22px; color: var(--ink-400); cursor: pointer; }

.mobile-actions-sheet-body { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.mobile-action-item {
  width: 100%;
  height: 44px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-950);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
}

.mobile-action-item:hover { background: var(--ink-100); }
.mobile-action-item.danger { color: var(--ink-950); font-weight: 700; border-color: var(--ink-300); }

/* ---------- Responsive Breakpoints ---------- */
@media(max-width: 768px) {
  html, body { width: 100%; max-width: 100vw; overflow-x: hidden; }
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }

  .app-shell {
    display: flex !important;
    flex-direction: column !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
    grid-template-columns: none !important;
  }

  .sidebar, .sidebar-backdrop, .menu-toggle, .global-search, .topbar-spacer, .topbar-actions, .topbar-divider {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .main-view {
    width: 100% !important;
    max-width: 100vw !important;
    flex: 1 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-width: 0 !important;
  }

  .mobile-brand-logo { display: flex !important; }
  .mobile-topbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-left: auto !important;
  }

  .mobile-topbar-divider { width: 1px !important; height: 18px !important; background: var(--line) !important; }
  .mobile-topbar-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 6px !important;
    background: var(--ink-950) !important;
    color: var(--white) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
  }

  .topbar {
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 16px !important;
    background: var(--white) !important;
    border-bottom: 1px solid var(--line) !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    flex: none !important;
  }

  .mobile-bottom-nav { display: flex !important; width: 100% !important; }

  .content {
    flex: 1 !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
  }

  .content:has(.table-panel) {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding-bottom: 0 !important;
    padding-top: 16px !important;
  }

  .content:has(.table-panel) .page-head {
    position: relative !important;
    flex-shrink: 0 !important;
    z-index: 5 !important;
    background: var(--paper) !important;
    padding: 4px 0 8px 0 !important;
    margin: 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
  }

  .page-head {
    position: sticky !important;
    top: -8px !important;
    z-index: 30 !important;
    background: var(--paper) !important;
    padding-top: 8px !important;
    padding-bottom: 4px !important;
    margin-top: -8px !important;
    margin-bottom: 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
  }

  .page-head h1 { font-size: 20px !important; font-weight: 700 !important; }
  .page-head-actions { display: flex !important; gap: 8px !important; }
  .page-head-actions #page-import-btn { display: none !important; }
  .page-head-actions .btn {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
    background: var(--ink-950) !important;
    color: var(--white) !important;
  }

  .content:has(.table-panel) #table-mount {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  .content:has(.table-panel) .table-panel {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
  }

  .content:has(.table-panel) .toolbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
    background: var(--paper) !important;
    flex-shrink: 0 !important;
    padding: 4px 0 6px 0 !important;
    border: none !important;
    width: 100% !important;
    display: flex !important;
  }

  .content:has(.table-panel) .toolbar .header-search-wrap { flex: 1 1 100% !important; width: 100% !important; }
  .toolbar .search-box { height: 36px !important; }
  .filter-btn-wrap { display: none !important; }

  .table-wrap table { display: none !important; }
  .mobile-cards-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 4px 0 12px !important;
  }

  .pagination-bar {
    padding: 14px 0 calc(84px + env(safe-area-inset-bottom, 0px)) !important;
    margin-top: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border-top: 1px solid var(--line) !important;
    width: 100% !important;
  }

  .pagination-left, .pagination-info, .page-size-selector { display: none !important; }
  .pagination-controls { display: flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important; }
  .page-btn {
    min-width: 38px !important;
    height: 38px !important;
    padding: 0 10px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: 1px solid var(--line) !important;
    background: var(--white) !important;
    color: var(--ink-950) !important;
  }

  .page-btn.active {
    background: var(--ink-950) !important;
    color: var(--white) !important;
    border-color: var(--ink-950) !important;
  }

  .mobile-alert-banner { display: flex !important; width: 100% !important; }
  .dash-charts-grid { display: none !important; }
  .dashboard-entity-grid { grid-template-columns: 1fr !important; gap: 12px !important; }

  /* Mobile Modals (6px top radius) */
  .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
  .modal-card {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 6px 6px 0 0 !important;
    max-height: 92vh !important;
    height: 92vh !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 -8px 36px rgba(0,0,0,0.3) !important;
  }

  .modal-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    padding: 16px !important;
  }

  .modal-footer {
    position: sticky !important;
    bottom: 0 !important;
    background: var(--white) !important;
    border-top: 1px solid var(--line) !important;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    display: flex !important;
    gap: 12px !important;
  }

  .modal-footer .btn {
    flex: 1 1 50% !important;
    width: 50% !important;
    height: 44px !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
  }

  .settings-api-section, #settings-api-card { display: none !important; }
}

@media print {
  @page { size: auto; margin: 10mm; }
  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    font-family: var(--font-body) !important;
  }
  .sidebar, .topbar, .mobile-bottom-nav, .page-head-actions, .toolbar, .pagination-bar, .row-actions, .modal-overlay, th:first-child, td:first-child {
    display: none !important;
  }
  .app-shell, .main-view, .content {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    height: auto !important;
  }
  table { width: 100% !important; border-collapse: collapse !important; }
  th, td { border: 1px solid #d4d4d8 !important; padding: 8px !important; font-size: 12px !important; }
}

/* =====================================================================
   MANIFEST BUFFERING ANIMATION (Seamless Light Theme)
   ===================================================================== */
.manifest-buffer-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  box-sizing: border-box;
}

.manifest-buffer-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  animation: manifestBreathe 3s ease-in-out 2s infinite;
}

.manifest-buffer-icon {
  width: 44px;
  height: 44px;
  border: 2.5px solid var(--ink-950);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: manifestIconIn 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s forwards;
  box-sizing: border-box;
  flex-shrink: 0;
}

.manifest-buffer-icon-inner {
  width: 22px;
  height: 22px;
  border: 2.2px solid var(--ink-950);
  border-radius: 5px;
  box-sizing: border-box;
}

@keyframes manifestIconIn {
  0% { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.manifest-buffer-wordmark {
  font-family: 'Exo 2', 'IBM Plex Mono', monospace;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--ink-950);
  display: flex;
  overflow: hidden;
}

.manifest-buffer-wordmark span {
  display: inline-block;
  opacity: 0;
  transform: translateY(100%);
  animation: manifestCharUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.manifest-buffer-wordmark span:nth-child(1) { animation-delay: 0.35s; }
.manifest-buffer-wordmark span:nth-child(2) { animation-delay: 0.42s; }
.manifest-buffer-wordmark span:nth-child(3) { animation-delay: 0.49s; }
.manifest-buffer-wordmark span:nth-child(4) { animation-delay: 0.56s; }
.manifest-buffer-wordmark span:nth-child(5) { animation-delay: 0.63s; }
.manifest-buffer-wordmark span:nth-child(6) { animation-delay: 0.70s; }
.manifest-buffer-wordmark span:nth-child(7) { animation-delay: 0.77s; }
.manifest-buffer-wordmark span:nth-child(8) { animation-delay: 0.84s; }

@keyframes manifestCharUp {
  0% { opacity: 0; transform: translateY(100%); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes manifestBreathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* Global full-screen buffering loader on initial load (Solid light theme) */
.manifest-global-loader {
  position: fixed;
  inset: 0;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s cubic-bezier(0.2, 0, 0, 1), visibility 0.25s;
}

.manifest-global-loader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Content area buffering loader centered under header and beside sidebar (100% solid opaque) */
.manifest-content-loader {
  position: absolute;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  display: none !important;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
}

.manifest-content-loader.active {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 600px) {
  .manifest-buffer-icon {
    width: 36px;
    height: 36px;
  }
  .manifest-buffer-icon-inner {
    width: 17px;
    height: 17px;
  }
  .manifest-buffer-wordmark {
    font-size: 20px;
    letter-spacing: 0.18em;
  }
}

