/* Walprints OS — themed for Walprints by build-demo */

:root {
  /* Walprints brand overrides — injected by build-demo */
  --primary: #161616;
  --accent: #030302;
  --paper: #FDFCFB;
  --warm-surface: #EDEDED;
  --cool-surface: #CBDEE8;
  --primary-hover: #2A2A2A;
  --ink-100: #eaeaea;
  --ink-700: #4b5563;
  --ink-900: #030302;

  --font-display: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --card-radius: 4px;
  --sidebar-bg: #030302;

  /* density: generous */
  --sp-card-pad: 22px 24px;
  --sp-section-gap: 32px;

  /* Re-map seed design-system tokens to Walprints palette.
     The seed uses --navy-* for the sidebar/accent and --gold* as the brand
     primary. Overriding here so every existing rule picks up Walprints'
     plum + near-black without touching the rest of the file. */
  --navy-950: #030302;
  --navy-900: #030302;
  --navy-800: #1a1a1a;
  --navy-700: #2a2a2a;
  --navy-600: #444444;
  --navy-100: #ececec;
  --navy-50: #f5f5f5;

  --gold: #161616;
  --gold-soft: #2A2A2A;
  --gold-bg: #F5F5F5;

  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --blue: #2563eb;
  --blue-soft: #dbeafe;

  --gray-50: #fafbfc;
  --gray-100: #f4f5f7;
  --gray-200: #e8eaed;
  --gray-300: #d2d6dc;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --shadow-sm: 0 1px 2px rgba(15, 41, 66, 0.06), 0 1px 3px rgba(15, 41, 66, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 41, 66, 0.08), 0 2px 4px rgba(15, 41, 66, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 41, 66, 0.12), 0 4px 8px rgba(15, 41, 66, 0.06);
  --shadow-xl: 0 24px 48px rgba(15, 41, 66, 0.16), 0 8px 16px rgba(15, 41, 66, 0.08);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --sidebar-width: 240px;
  --topbar-height: 64px;
  --content-max: 1440px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Display family — used by .serif legacy class + any new k2a-* heading hooks */
.serif { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
.mono { font-family: var(--font-mono); }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; }

/* App shell */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--navy-950);
  color: white;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.10);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,0.20);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
}

.sidebar-brand .mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
  display: grid;
  place-items: center;
  color: var(--navy-900);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.sidebar-brand .mark-logo {
  height: 36px;
  width: auto;
  max-width: 64px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand .name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-brand .sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 0 12px 8px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.15s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.10);
  color: white;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* Building dropdown nav */
.bldg-nav {
  margin-bottom: 1px;
}

.bldg-nav-toggle {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.72);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
}

.bldg-nav-toggle:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}

.bldg-nav-toggle.active {
  background: rgba(201, 168, 106, 0.10);
  color: var(--gold);
}

.bldg-nav-marker {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  flex-shrink: 0;
  margin-left: 4px;
}

.bldg-nav-toggle.active .bldg-nav-marker {
  background: var(--gold);
}

.bldg-nav-chevron {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.4);
  transform: rotate(0deg);
  transition: transform 0.15s;
}

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

.bldg-nav-subitems {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  margin-left: 22px;
  border-left: 1px solid rgba(255,255,255,0.08);
  padding-left: 8px;
}

.bldg-nav.open .bldg-nav-subitems {
  max-height: 280px;
}

.nav-sublink {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  border-radius: 6px;
  margin: 1px 0;
  transition: all 0.12s;
}

.nav-sublink:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.9);
}

.nav-sublink.active {
  background: rgba(201, 168, 106, 0.14);
  color: var(--gold);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
  color: var(--navy-900);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
}

.user-name { font-size: 13px; font-weight: 600; color: white; line-height: 1.2; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); line-height: 1.2; margin-top: 2px; }

/* Main content */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
}

.crumbs strong {
  color: var(--gray-900);
  font-weight: 600;
}

.crumb-sep { color: var(--gray-300); }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  width: 320px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center;
}

.search-input:focus {
  outline: none;
  border-color: var(--navy-700);
  background-color: white;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-200);
  background: white;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--gray-600);
  position: relative;
}

.icon-btn:hover { background: var(--gray-50); }

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy-900);
  color: white;
}

.btn-primary:hover { background: var(--navy-800); }

.btn-secondary {
  background: white;
  color: var(--gray-800);
  border-color: var(--gray-200);
}

.btn-secondary:hover { background: var(--gray-50); }

.btn-gold {
  background: var(--gold);
  color: var(--navy-950);
}

.btn-gold:hover { background: var(--gold-soft); }

.content {
  padding: 32px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  color: var(--navy-900);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.page-subtitle {
  color: var(--gray-500);
  font-size: 14px;
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 20px; }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-900);
  margin: 0;
}

.card-subtitle {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.card-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-700);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-link:hover { color: var(--gold); }

/* KPI tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  font-weight: 600;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  margin: 6px 0 4px;
  line-height: 1.05;
}

.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }

.kpi-foot {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Sparkline mini */
.kpi.with-spark { padding-bottom: 8px; }
.kpi-spark {
  margin-top: 8px;
  margin-left: -20px;
  margin-right: -20px;
  margin-bottom: -8px;
  height: 36px;
  position: relative;
}
.kpi-spark canvas {
  width: 100% !important;
  height: 36px !important;
  display: block;
}

/* Building grid */
.buildings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.building-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  display: block;
  color: inherit;
}

.building-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--gray-300);
}

.building-img {
  height: 160px;
  background: var(--gray-200) center/cover;
  position: relative;
}

.building-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(10, 25, 41, 0.7) 100%);
}

.building-img-overlay {
  position: absolute;
  inset: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1;
}

.building-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.95);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--navy-800);
  width: fit-content;
}

.building-flag.alert { background: var(--red); color: white; }
.building-flag.warn { background: var(--amber); color: white; }
.building-flag.info { background: var(--blue); color: white; }
.building-flag.dev { background: var(--gold); color: var(--navy-950); }

.building-region-tag {
  color: white;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.building-body { padding: 16px 18px; }

.building-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--navy-900);
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  line-height: 1.2;
}

.building-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.building-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
}

.building-stat {
  font-size: 11px;
  color: var(--gray-500);
}

.building-stat strong {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: var(--navy-900);
  font-weight: 600;
  margin-bottom: 1px;
}

/* Two-column layout */
.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .buildings-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Alert list */
.alert-row {
  display: flex;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  align-items: flex-start;
}

.alert-row:last-child { border-bottom: none; }

.alert-row:hover { background: var(--gray-50); }

.alert-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.alert-icon.high { background: var(--red-soft); color: var(--red); }
.alert-icon.medium { background: var(--amber-soft); color: var(--amber); }
.alert-icon.low { background: var(--blue-soft); color: var(--blue); }

.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 13px; font-weight: 600; color: var(--navy-900); margin-bottom: 2px; }
.alert-detail { font-size: 12px; color: var(--gray-500); }

/* Tables */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
  font-weight: 600;
  padding: 10px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

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

.table-num { font-family: 'IBM Plex Mono', monospace; text-align: right; }
.table-num-strong { color: var(--navy-900); font-weight: 600; }

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
}

.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-gold { background: var(--gold-bg); color: #8d6f3a; }
.pill-navy { background: var(--navy-100); color: var(--navy-800); }
.pill-gray { background: var(--gray-100); color: var(--gray-600); }

.pill-dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* Building hero (detail page) */
.bldg-hero {
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 280px;
  background: var(--gray-200) center/cover;
  position: relative;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
}

.bldg-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(5, 13, 26, 0.85) 100%);
}

.bldg-hero-content {
  position: absolute;
  bottom: 24px;
  left: 32px;
  right: 32px;
  z-index: 1;
  color: white;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.bldg-hero h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.bldg-hero-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
}

.bldg-hero-stats {
  display: flex;
  gap: 28px;
  margin-top: 8px;
}

.bldg-hero-stat {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bldg-hero-stat strong {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  color: white;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

/* Tab nav */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--navy-900);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

/* Pipeline */
.kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.kanban-col {
  background: var(--gray-100);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 360px;
}

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 12px;
}

.kanban-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-700);
}

.kanban-col-count {
  background: var(--gray-200);
  color: var(--gray-700);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.deal-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.deal-card:hover {
  border-color: var(--navy-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.deal-company {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 4px;
}

.deal-meta {
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.deal-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--gray-200);
}

.deal-value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-800);
}

.deal-prob {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--green-soft);
  color: var(--green);
}

/* Conversation card */
.convo-card {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.convo-card:last-child { border-bottom: none; }

.convo-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold-bg);
  color: var(--gold);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.convo-body { flex: 1; min-width: 0; }
.convo-title { font-size: 13px; font-weight: 600; color: var(--navy-900); margin-bottom: 2px; }
.convo-meta { font-size: 11px; color: var(--gray-500); margin-bottom: 8px; display: flex; gap: 12px; }
.convo-summary { font-size: 13px; color: var(--gray-700); line-height: 1.5; margin-bottom: 8px; }
.convo-actions {
  background: var(--navy-50);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--gray-700);
}

.convo-actions ul { margin: 0; padding-left: 18px; }
.convo-actions li { margin: 2px 0; }

/* Chat / assistant */
.chat-shell {
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  height: calc(100vh - var(--topbar-height) - 64px);
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.chat-stream {
  overflow-y: auto;
  padding: 32px 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 760px;
}

.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.chat-msg.assistant .chat-avatar {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
  color: var(--navy-900);
}

.chat-msg.user .chat-avatar {
  background: var(--navy-900);
  color: white;
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 720px;
}

.chat-msg.assistant .chat-bubble {
  background: var(--gray-50);
  color: var(--gray-800);
  border-top-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
  background: var(--navy-900);
  color: white;
  border-top-right-radius: 4px;
}

.chat-bubble strong { color: var(--navy-900); font-weight: 600; }
.chat-msg.user .chat-bubble strong { color: white; }

.chat-bubble table {
  width: 100%;
  font-size: 12.5px;
  margin-top: 10px;
  border-collapse: collapse;
}

.chat-bubble th, .chat-bubble td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.chat-bubble th {
  font-weight: 600;
  color: var(--navy-900);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-input-row {
  border-top: 1px solid var(--gray-200);
  padding: 12px 20px;
  background: white;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-input-row input {
  flex: 1;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  font-family: inherit;
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--navy-700);
}

.chat-suggested {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chat-chip {
  background: white;
  border: 1px solid var(--gray-200);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--gray-700);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.chat-chip:hover { background: var(--gray-50); border-color: var(--navy-700); }

/* Anomaly card */
.anomaly-card {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-100);
}

.anomaly-card:last-child { border-bottom: none; }

.anomaly-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.anomaly-amount {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--red);
}

.anomaly-section {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.anomaly-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.55;
  margin-bottom: 12px;
}

.anomaly-rec {
  background: var(--gold-bg);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--gray-800);
  line-height: 1.5;
}

/* Voice memo capture flow */
.capture-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.capture-step {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.capture-step::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -16px;
  width: 16px;
  height: 2px;
  background: var(--gray-200);
  z-index: 1;
}

.capture-step:last-child::after { display: none; }

.capture-num {
  position: absolute;
  top: -12px;
  left: 20px;
  background: var(--navy-900);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

.capture-step.active { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-bg); }
.capture-step.active .capture-num { background: var(--gold); color: var(--navy-950); }

.capture-step.done .capture-num { background: var(--green); }

.capture-step h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--navy-900);
  margin: 8px 0 6px;
}

.capture-step p {
  font-size: 12.5px;
  color: var(--gray-600);
  line-height: 1.5;
  margin: 0;
}

.waveform {
  height: 80px;
  background: linear-gradient(180deg, var(--navy-50), white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 12px;
  margin: 16px 0;
  border: 1px solid var(--gray-200);
}

.waveform-bar {
  flex: 1;
  background: var(--navy-700);
  border-radius: 1px;
  transition: all 0.2s;
}

.transcript-block {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--gray-700);
  font-family: var(--font-display);
  font-style: italic;
  border-left: 3px solid var(--gold);
}

.extract-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.extract-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.extract-list li:last-child { border-bottom: none; }
.extract-list .label { color: var(--gray-500); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.extract-list .value { color: var(--navy-900); font-weight: 600; }

.action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid var(--green-soft);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--gray-800);
}

.action-item.done { background: var(--green-soft); }

.check-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* Stacking plan */
.stacking-plan {
  background: var(--gray-50);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.stack-floor {
  display: flex;
  align-items: center;
  height: 32px;
  background: white;
  border-radius: 4px;
  padding: 0 12px;
  font-size: 12px;
  gap: 12px;
  border-left: 4px solid var(--gray-300);
}

.stack-floor.occupied { border-left-color: var(--navy-700); }
.stack-floor.vacant { border-left-color: var(--amber); background: var(--amber-soft); }
.stack-floor.risk { border-left-color: var(--red); }

.stack-floor-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  width: 28px;
  flex-shrink: 0;
}

.stack-floor-tenant {
  flex: 1;
  font-weight: 500;
  color: var(--navy-900);
}

.stack-floor-sf {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--gray-500);
}

/* Local Law 97 gauge */
.ll97-gauge {
  background: var(--gray-50);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.ll97-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.ll97-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
}

.ll97-fill.green { background: var(--green); }
.ll97-fill.yellow { background: var(--amber); }
.ll97-fill.red { background: var(--red); }

/* Badges and accent decoration */
/* Floating chat dock — entire pill is a single button; clicking
   navigates to the AI Agent page where the user actually chats. */
.chat-dock {
  position: fixed;
  bottom: 20px;
  left: calc(var(--sidebar-width) + 32px);
  right: 32px;
  max-width: 720px;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  padding: 8px 8px 8px 18px;
  gap: 10px;
  z-index: 100;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
}

.chat-dock:hover {
  border-color: var(--navy-700);
  box-shadow: 0 16px 40px rgba(0,0,0,0.14);
}

.chat-dock:active {
  transform: translateY(1px);
}

.chat-dock-icon {
  width: 22px;
  height: 22px;
  color: var(--gold);
  flex-shrink: 0;
}

.chat-dock-placeholder {
  flex: 1;
  font-size: 13.5px;
  color: var(--gray-500);
  padding: 6px 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-dock-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy-900);
  color: white;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.chat-dock:hover .chat-dock-send {
  background: var(--gold);
  color: var(--navy-950);
}

.chat-dock-send svg {
  width: 14px;
  height: 14px;
}

/* Add bottom padding to .content so dock doesn't overlap content */
.content { padding-bottom: 96px; }

/* Pages that don't need the dock (assistant page has its own chat) */
body.no-chat-dock .chat-dock { display: none; }
body.no-chat-dock .content { padding-bottom: 32px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--navy-900);
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.section-title .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  font-size: 12px;
  background: white;
  color: var(--gray-700);
  font-weight: 500;
}

.filter-pill.active {
  background: var(--navy-900);
  color: white;
  border-color: var(--navy-900);
}

/* ─── Mobile-only chrome (hamburger + drawer + brand strip) ───
   Hidden on desktop, revealed at <=768px via media queries below. */
.topbar-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--gray-700);
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.topbar-hamburger:hover { background: var(--gray-100); }
.topbar-hamburger svg { width: 22px; height: 22px; }

.topbar-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.topbar-mobile-brand img {
  height: 22px;
  width: auto;
  flex-shrink: 0;
}
.topbar-mobile-brand span {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 199;
  opacity: 0;
  transition: opacity 0.2s;
}
.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-close:hover { background: rgba(255,255,255,0.12); color: white; }
.sidebar-close svg { width: 18px; height: 18px; }

/* ─── Tablet breakpoint ─── */
@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
  .buildings-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar .search-input { width: 220px; }
  .content { padding: 24px; }
}

/* ─── Mobile breakpoint ─── */
@media (max-width: 768px) {
  /* App layout: single column, sidebar slides in */
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 84vw;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    padding: 20px 14px;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-close { display: inline-flex; }

  /* Topbar: black on mobile to match sidebar; hamburger + brand replace crumbs/search */
  .topbar {
    padding: 0 14px;
    gap: 10px;
    height: 56px;
    background: var(--navy-950);
    border-bottom-color: rgba(255,255,255,0.08);
  }
  .topbar-hamburger {
    display: inline-flex;
    color: white;
  }
  .topbar-hamburger:hover { background: rgba(255,255,255,0.08); }
  .topbar-mobile-brand { display: flex; }
  .topbar .crumbs { display: none; }
  .topbar .search-input { display: none; }
  .topbar-actions {
    margin-left: 0;
    gap: 6px;
    flex-shrink: 0;
  }
  .topbar-actions .icon-btn {
    background: transparent;
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
  }
  .topbar-actions .icon-btn:hover { background: rgba(255,255,255,0.08); }
  .topbar-actions .icon-btn:nth-child(2) {
    /* Hide the settings icon to save space; bell stays */
    display: none;
  }

  /* Content padding */
  .content {
    padding: 20px 14px 100px;
  }

  /* Page header — stack title + actions vertically */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 22px;
  }
  .page-title { font-size: 22px; }
  .page-subtitle { font-size: 13px; }
  .page-header > div:last-child {
    /* The action button row — let it wrap */
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-header .btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  /* KPI grid — 2 columns at small tablet, 1 at phone */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 22px; }
  .kpi-label { font-size: 10px; }
  .kpi-foot { font-size: 10px; }

  /* Buildings grid — single column */
  .buildings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .building-img { height: 140px; }

  /* Two-column splits */
  .two-col {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  /* Pipeline Kanban — vertical stack */
  .kanban {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Capture flow — stack the 4 steps */
  .capture-flow {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .capture-step::after { display: none; }

  /* Building hero — shorter, smaller text */
  .bldg-hero {
    height: 200px;
    margin-bottom: 20px;
  }
  .bldg-hero-content {
    bottom: 16px;
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .bldg-hero h1 { font-size: 22px; }
  .bldg-hero-sub { font-size: 12px; }
  .bldg-hero-stats {
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
  }
  .bldg-hero-stat strong { font-size: 14px; }
  .bldg-hero-content > div:last-child {
    display: none; /* hide secondary action buttons in hero on mobile */
  }

  /* Tab nav — horizontal scroll */
  .tab-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -14px 18px;
    padding: 0 14px;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab { padding: 10px 14px; font-size: 12px; flex-shrink: 0; }

  /* Section title — smaller */
  .section-title {
    font-size: 18px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .section-title .actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Tables remain in scroll wrappers — already handled.
     Make table-wrap visually hint scrollability via subtle right shadow. */
  .table-wrap {
    margin: 0 -14px;
    padding: 0 14px;
  }

  /* Toolbar pills wrap */
  .toolbar { gap: 6px; }
  .filter-pill { padding: 6px 10px; font-size: 11px; }

  /* Building dropdown subtitles fit nicely */
  .bldg-nav-toggle { padding: 9px 12px; font-size: 13px; }
  .nav-sublink { padding: 8px 12px; font-size: 13px; }

  /* Anomaly card spacing */
  .anomaly-head { flex-wrap: wrap; gap: 8px; }
  .anomaly-amount { font-size: 16px; }

  /* Chat assistant — mobile layout */
  .chat-shell {
    /* topbar(56) + content-pad-top(20) + stacked page-header(~140) + bottom-pad(~32) ≈ 248 */
    height: calc(100vh - 248px);
    min-height: 460px;
    overflow: hidden;
  }
  .chat-stream {
    padding: 18px 14px 10px;
    gap: 14px;
    overflow-x: hidden;
  }
  /* Assistant messages fill the row so the bubble can shrink to fit */
  .chat-msg {
    gap: 8px;
    max-width: 100%;
  }
  .chat-msg.assistant {
    width: 100%;
  }
  .chat-msg.user {
    max-width: 88%;
  }
  .chat-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
  /* min-width:0 + flex:1 lets the bubble shrink below its intrinsic content width */
  .chat-bubble {
    padding: 11px 14px;
    font-size: 13px;
    line-height: 1.5;
    min-width: 0;
    overflow: hidden;
  }
  .chat-msg.assistant .chat-bubble {
    flex: 1 1 0;
    max-width: 100%;
  }
  .chat-msg.user .chat-bubble {
    max-width: 100%;
  }
  /* Tables in bubbles: scroll horizontally inside the bubble */
  .chat-bubble table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    white-space: nowrap;
    font-size: 11.5px;
  }
  .chat-bubble th,
  .chat-bubble td {
    padding: 5px 8px;
  }
  /* Suggested chips — horizontal scroll instead of wrap so input row stays in view */
  .chat-suggested {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-bottom: 0;
  }
  .chat-suggested::-webkit-scrollbar { display: none; }
  .chat-chip {
    padding: 7px 12px;
    font-size: 11.5px;
    flex-shrink: 0;
  }
  .chat-input-row {
    padding: 10px 12px;
    gap: 8px;
  }
  .chat-input-row input {
    padding: 9px 14px;
    font-size: 13px;
    min-width: 0;
  }
  .chat-input-row .btn {
    padding: 9px 14px;
    font-size: 12.5px;
    flex-shrink: 0;
  }

  /* Chat dock — full-width pill at the bottom */
  .chat-dock {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
    padding: 6px 6px 6px 14px;
  }
  .chat-dock-placeholder { font-size: 13px; }
  .chat-dock-send { width: 30px; height: 30px; }
}

/* ─── Phone breakpoint ─── */
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .capture-flow { grid-template-columns: 1fr; }
  .page-title { font-size: 20px; }
  .topbar-mobile-brand span { font-size: 13px; }
  .building-stats { gap: 6px; }
  .building-stats .building-stat strong { font-size: 12px; }
}

/* ============================================================
   Walprints brand overrides — appended by build-demo
   ============================================================ */

/* card_treatment: hairline-no-shadow */
.k2a-card,
.card {
  border: 1px solid var(--ink-100);
  box-shadow: none;
  border-radius: var(--card-radius);
}

/* Walprints signature: wide-tracked uppercase eyebrow labels —
   lifted from walprints.com section headers */
.k2a-eyebrow,
.k2a-section-eyebrow,
.k2a-page-head-eyebrow,
[data-eyebrow] {
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-700);
}

/* Headings get a subtle tracking lift to match the gallery-store feel */
.k2a-card h2,
.k2a-card h3,
h2.k2a-heading,
h3.k2a-heading {
  letter-spacing: -0.01em;
}

/* Warm cream surface for secondary panels (Walprints scheme_2) */
.k2a-surface-warm {
  background-color: var(--warm-surface);
  border-color: #D3CEC5;
}

/* Cool sky surface for tertiary accents (Walprints scheme_4) */
.k2a-surface-cool {
  background-color: var(--cool-surface);
}

/* Plum CTA hover state mirrors the brand's signature hover */
.k2a-btn-primary:hover,
.k2a-pill-primary:hover {
  background-color: var(--primary-hover);
}

/* === Chart primitives (added by dashboard enhancement) === */

/* Chart card — extends .card with extra padding + a head/body split so
   charts have breathing room without bloating other card uses. */
.k2a-chart-card {
  padding: 22px 24px 18px;
  display: flex;
  flex-direction: column;
}

.k2a-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.k2a-chart-head .k2a-chart-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.01em;
}

.k2a-chart-head .k2a-chart-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gray-500);
  font-weight: 600;
}

.k2a-chart-head .k2a-chart-callout {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-700);
  text-align: right;
  line-height: 1.4;
}

.k2a-chart-head .k2a-chart-callout strong {
  color: var(--primary);
  font-weight: 600;
  display: block;
  font-size: 14px;
}

.k2a-chart-body { position: relative; }

.k2a-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.k2a-chart-axis-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--gray-400);
  letter-spacing: 0.04em;
}

.k2a-chart-grid {
  stroke: var(--gray-200);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

/* Stacked area — one layer per channel; subtle stroke on top edge */
.k2a-stacked-area path {
  transition: opacity 0.15s ease;
}

.k2a-stacked-area:hover path:not(:hover) {
  opacity: 0.55;
}

/* Channel mix donut */
.k2a-donut {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.k2a-donut-svg { transform: rotate(-90deg); }

.k2a-donut-arc {
  fill: none;
  stroke-width: 22;
  transition: stroke-width 0.15s ease;
}

.k2a-donut-arc:hover { stroke-width: 26; }

.k2a-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 0 32px;
}

.k2a-donut-center .k2a-donut-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.02em;
  line-height: 1;
}

.k2a-donut-center .k2a-donut-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gray-500);
  font-weight: 600;
  margin-top: 6px;
}

/* Donut legend — vertical list with color dot + name + amount */
.k2a-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.k2a-chart-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.k2a-chart-legend-row .k2a-chart-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.k2a-chart-legend-row .k2a-chart-legend-name {
  color: var(--gray-700);
  font-weight: 500;
}

.k2a-chart-legend-row .k2a-chart-legend-name small {
  color: var(--gray-400);
  font-weight: 400;
  margin-left: 4px;
}

.k2a-chart-legend-row .k2a-chart-legend-num {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--navy-900);
  font-weight: 600;
  text-align: right;
}

/* Top prints leaderboard */
.k2a-leaderboard-row {
  display: grid;
  grid-template-columns: 44px 1fr 84px 96px 88px;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--gray-100);
}

.k2a-leaderboard-row:last-child { border-bottom: none; }
.k2a-leaderboard-row:hover { background: var(--gray-50); }

.k2a-leaderboard-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray-500);
  font-weight: 600;
  background: var(--gray-50);
  padding: 10px 24px;
  display: grid;
  grid-template-columns: 44px 1fr 84px 96px 88px;
  gap: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.k2a-leaderboard-thumb {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--gray-100);
}

.k2a-leaderboard-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-900);
  line-height: 1.25;
}

.k2a-leaderboard-artist {
  font-size: 11.5px;
  color: var(--gray-500);
  font-style: italic;
  margin-top: 2px;
}

.k2a-leaderboard-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--navy-900);
  font-weight: 600;
  text-align: right;
}

.k2a-leaderboard-num small {
  display: block;
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 500;
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.k2a-sparkline {
  width: 60px;
  height: 24px;
  overflow: visible;
}

.k2a-sparkline path.line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.k2a-sparkline path.fill {
  fill: var(--primary);
  opacity: 0.08;
  stroke: none;
}

.k2a-sparkline circle {
  fill: var(--primary);
  stroke: white;
  stroke-width: 1.5;
}

/* Royalty progress ring */
.k2a-progress-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px auto 12px;
}

.k2a-progress-ring-svg {
  transform: rotate(-90deg);
}

.k2a-progress-ring-track {
  fill: none;
  stroke: var(--warm-surface);
  stroke-width: 14;
}

.k2a-progress-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.k2a-progress-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 16px;
}

.k2a-progress-ring-center .k2a-progress-amount {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: -0.01em;
  line-height: 1;
}

.k2a-progress-ring-center .k2a-progress-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gray-500);
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.4;
}

.k2a-progress-ring-foot {
  font-size: 11.5px;
  color: var(--gray-600);
  text-align: center;
  margin-top: 4px;
}

.k2a-progress-ring-foot strong {
  color: var(--primary);
  font-weight: 600;
}

/* Pipeline horizontal stacked bar */
.k2a-pipeline-bar {
  margin-top: 8px;
}

.k2a-pipeline-bar-track {
  display: flex;
  width: 100%;
  height: 36px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.k2a-pipeline-bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: white;
  border-right: 1px solid rgba(255,255,255,0.35);
  min-width: 24px;
  transition: filter 0.15s ease;
}

.k2a-pipeline-bar-seg:last-child { border-right: none; }
.k2a-pipeline-bar-seg:hover { filter: brightness(1.08); }

.k2a-pipeline-bar-labels {
  display: flex;
  width: 100%;
  margin-top: 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--gray-500);
}

.k2a-pipeline-bar-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 24px;
}

.k2a-pipeline-bar-label .num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--navy-900);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

/* Chart-row layout — same shape as .two-col but tuned for tall chart cards.
   Default: 2/3 + 1/3. Stacks to single column under 1100px. */
.k2a-chart-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  .k2a-chart-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .k2a-chart-card { padding: 18px 16px 14px; }
  .k2a-chart-head { flex-wrap: wrap; gap: 6px; }
  .k2a-chart-head .k2a-chart-callout { text-align: left; }
  .k2a-leaderboard-row,
  .k2a-leaderboard-head {
    grid-template-columns: 36px 1fr 60px 70px;
    gap: 10px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .k2a-leaderboard-row .k2a-sparkline,
  .k2a-leaderboard-head .k2a-sparkline-col {
    display: none;
  }
  .k2a-pipeline-bar-track { height: 32px; }
  .k2a-pipeline-bar-seg { font-size: 11px; }
}

/* === Chart.js host classes (added 2026-05-21 for line-graph dashboard) === */

/* Line chart host: flex-grows to fill card, Chart.js sizes to parent */
.k2a-chart-canvas-host {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  padding-top: 8px;
  width: 100%;
}
.k2a-chart-canvas-host canvas {
  position: absolute !important;
  inset: 8px 0 0 0;
  width: 100% !important;
  height: calc(100% - 8px) !important;
  display: block;
}

/* Donut host: a positioning context for the centered $ value over the canvas */
.k2a-donut-host {
  position: relative;
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}
.k2a-donut-host canvas { display: block; width: 100% !important; height: 100% !important; }

/* Sparkline cell inside the leaderboard row */
.k2a-print-spark-wrap {
  width: 80px;
  height: 28px;
  margin-left: auto;
  position: relative;
}
.k2a-print-spark {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* === Page-load animations === */

/* Progress ring: draw the fill arc from empty → final */
@keyframes k2a-ring-draw {
  from { stroke-dashoffset: var(--ring-circ); }
  to   { stroke-dashoffset: var(--ring-final-offset); }
}
.k2a-progress-ring-fill {
  animation: k2a-ring-draw 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}

/* Pipeline segments: slide in from left, staggered via inline animation-delay */
@keyframes k2a-pipe-slide {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
.k2a-pipeline-bar-seg {
  animation: k2a-pipe-slide 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* ============================================================
   COMPREHENSIVE MOBILE RESPONSIVE PASS — added 2026-05-21
   Covers dashboard chart rows, KPI grids, tables, kanbans,
   entity-detail tabs, settings panel, and all new pages.
   Uses !important on .kpi-grid / .buildings-grid / .two-col /
   inline-style grids because ~17 pages set grid-template-columns
   inline (e.g. style="grid-template-columns: repeat(4, 1fr);")
   and inline styles beat normal media queries on specificity.
   Keep all rules inside @media blocks — desktop must not change.
   ============================================================ */

/* ─── Wide tablet (1024px–1100px) — light reflow of dashboard chart rows ─── */
@media (max-width: 1100px) {
  /* Inline-grid overrides that match patterns used across pages.
     Attribute selectors only trigger on elements with that inline style,
     so they cost nothing on the dashboard's clean .k2a-chart-row. */
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns:2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* P&L 6-month callouts: drop from 6→3 at this width */
  div[style*="grid-template-columns: repeat(6, 1fr)"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  /* Settings 1fr 320px split */
  div[style*="grid-template-columns: 1fr 320px"] {
    grid-template-columns: 1fr !important;
  }
}

/* ─── Mobile breakpoint (≤768px) — single column most things ─── */
@media (max-width: 768px) {
  /* === KPI grid — force 2-col regardless of inline style override ===
     Many pages set kpi-grid to repeat(3,1fr) or repeat(4,1fr) inline.
     We override with !important; the existing 480px rule below drops to 1-col. */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* === .two-col — kill inline 2fr 1fr / 1fr 1fr overrides === */
  .two-col {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }

  /* === Buildings grid — single column on mobile === */
  .buildings-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* === Inline-style grids that need to collapse on mobile === */
  /* Catch any inline repeat(N, 1fr) for N>=3 — collapse to single column. */
  div[style*="grid-template-columns: repeat(3, 1fr)"],
  div[style*="grid-template-columns:repeat(3, 1fr)"],
  div[style*="grid-template-columns: repeat(4, 1fr)"],
  div[style*="grid-template-columns:repeat(4, 1fr)"],
  div[style*="grid-template-columns: repeat(5, 1fr)"],
  div[style*="grid-template-columns: repeat(6, 1fr)"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr auto"] {
    grid-template-columns: 1fr !important;
  }
  /* Special: artist hero (240px headshot + 1fr prose) → stack vertically */
  div[style*="grid-template-columns: 240px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 20px 18px !important;
    text-align: center;
  }
  div[style*="grid-template-columns: 240px 1fr"] > div:first-child {
    margin: 0 auto !important;
  }

  /* === Dashboard chart row already stacks at 1100px (above) === */
  /* But also kill any leftover desktop callout text overflow */
  .k2a-chart-card { padding: 16px 14px 12px; }
  .k2a-chart-title { font-size: 16px; }
  .k2a-chart-eyebrow { font-size: 10px; }
  .k2a-chart-callout { font-size: 11px; }
  .k2a-chart-callout strong { font-size: 14px; }

  /* === Chart Chart.js host — reduce min-height === */
  .k2a-chart-canvas-host { min-height: 200px; }
  .k2a-chart-canvas-host[style*="min-height"] { min-height: 220px !important; }
  .k2a-chart-canvas-host[style*="height:300px"] { height: 220px !important; }

  /* === Donut hosts — tighter on mobile === */
  .k2a-donut-host { max-width: 180px; }

  /* === Leaderboard row already has a rule, but inline-styled num cells
       need text-align preserved. Already covered by existing 768px block. === */

  /* === Pipeline horizontal bar — keep bar full-width but allow labels to wrap === */
  .k2a-pipeline-bar-labels {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 9.5px;
  }
  .k2a-pipeline-bar-label {
    flex: 1 1 33%;
    min-width: 0;
  }
  .k2a-pipeline-bar-label .num { font-size: 12px; }

  /* === Page header inline action-button rows === */
  .page-header > div[style*="display:flex"][style*="gap"] {
    flex-wrap: wrap;
    gap: 6px !important;
  }

  /* === bldg-hero on entity-detail pages (print.html) — shorter === */
  .bldg-hero[style*="height:380px"] { height: 240px !important; }

  /* === Tables: when wrapped in .table-wrap they already scroll-x.
     For naked tables in scoped CSS (pnl-table, tax-table, cf-table, inf-table),
     wrap the parent if needed. Most pages already use .table-wrap. === */
  .pnl-table, .cf-table, .tax-table, .inf-table {
    font-size: 11.5px;
  }
  .pnl-table th, .pnl-table td,
  .cf-table th, .cf-table td,
  .tax-table th, .tax-table td,
  .inf-table th, .inf-table td {
    padding: 8px 8px !important;
  }

  /* === ORDERS kanban — horizontal scroll with min-width columns === */
  /* The existing 768px rule collapses to 1fr (vertical stack).
     That works but makes the page LONG. For orders.html specifically,
     we want a horizontal scroll experience. Override here. */
  body .kanban {
    display: flex !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  body .kanban-col {
    flex: 0 0 78vw;
    max-width: 320px;
    min-height: 300px;
    scroll-snap-align: start;
  }
  /* Build-requests kanban (.br-kanban) keeps its own stack rule from
     scoped CSS — let it ride. */

  /* === Tax filing row 4-col grid (taxes.html) === */
  .tax-filing-row {
    grid-template-columns: 60px 1fr !important;
    grid-template-areas:
      "date title"
      "date detail";
    gap: 10px !important;
  }
  .tax-filing-row > :nth-child(3),
  .tax-filing-row > :nth-child(4) {
    grid-column: 1 / -1;
  }
  /* Tax status chart — keep horizontal but tighter */
  .tax-status-chart { gap: 8px; height: 180px; padding: 10px 4px 4px; }
  .tax-status-bar-track { max-width: 36px; }
  .tax-status-count { font-size: 17px; }
  .tax-status-label { font-size: 9.5px; }

  /* === Channels bar-chart row (80px 1fr 100px) === */
  .ch-bar-chart {
    grid-template-columns: 70px 1fr 70px !important;
    gap: 8px !important;
    font-size: 11px;
  }

  /* === Royalties history chart row === */
  .rt-history-chart {
    grid-template-columns: 70px 1fr 80px !important;
    gap: 8px !important;
  }

  /* === Content week calendar — switch to 1-col list-like view === */
  .cd-week-head { display: none !important; }
  .cd-week-body { grid-template-columns: 1fr !important; min-height: 0 !important; }
  .cd-day-col {
    border-left: none !important;
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 14px !important;
    min-height: 0 !important;
  }
  .cd-day-col:last-child { border-bottom: none; }
  /* Synthetic day label by injecting a pseudo via class — fall back to
     keeping bars compact since we can't add markup. */

  /* === Roadmap card grid already collapses at 768px via scoped CSS === */

  /* === Decisions timeline already drops padding-left + dot at 768px via scoped CSS === */

  /* === Goals KR row already drops cols 3/4 at 768px via scoped CSS === */

  /* === Settings st-source-row already handled at 768px === */

  /* === Influencer camp-stats already drops to 2-col at 720px scoped === */

  /* === Reminders rem-row wraps at 720px scoped === */

  /* === Print/Artist tab-nav — already overflow-x in base 768px rule === */

  /* === Search input width is already hidden at 768px === */
}

/* ─── Phone breakpoint (≤480px) — tightest layout ─── */
@media (max-width: 480px) {
  /* === All KPI grids collapse to single column === */
  .kpi-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  /* === Smaller type === */
  .page-title { font-size: 19px; }
  .page-subtitle { font-size: 12px; }
  .section-title { font-size: 16px; }
  .kpi-value { font-size: 20px; }
  .kpi-label { font-size: 10px; }

  /* === Content padding tighter === */
  .content { padding: 16px 12px 100px; }

  /* === Cards tighter padding === */
  .card-header { padding: 14px 14px; }
  .card-pad { padding: 14px; }

  /* === Inline 4-col mini grids (e.g. build-requests rolling stats,
       settings billing strip) collapse → 2 col, not single, so the
       compact stats stay readable. === */
  div[style*="grid-template-columns: repeat(4, 1fr)"][style*="gap:16px"],
  div[style*="grid-template-columns: repeat(4, 1fr)"][style*="gap:18px"],
  div[style*="grid-template-columns: repeat(4, 1fr)"][style*="gap: 16px"],
  div[style*="grid-template-columns: repeat(4, 1fr)"][style*="gap: 18px"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* === Building hero stats wrap cleanly === */
  .bldg-hero h1 { font-size: 18px !important; }
  .bldg-hero[style*="height:380px"] { height: 200px !important; }

  /* === Kanban cards take more screen === */
  body .kanban-col { flex: 0 0 84vw; }

  /* === Chart callout right-side text moves below === */
  .k2a-chart-head { gap: 4px; }
  .k2a-chart-callout { text-align: left; }
  .k2a-chart-callout strong { display: block; margin-bottom: 2px; }

  /* === Charts get even smaller === */
  .k2a-chart-canvas-host { min-height: 180px; }
  .k2a-donut-host { max-width: 150px; }

  /* === Page header buttons shrink === */
  .page-header .btn { padding: 6px 10px; font-size: 11.5px; }

  /* === Tab nav padding tighter === */
  .tab { padding: 9px 12px !important; font-size: 11.5px !important; }

  /* === Tax filing rows tighter === */
  .tax-filing-row { padding: 10px 12px !important; }
  .tax-filing-title { font-size: 12px; }
  .tax-filing-detail { font-size: 10.5px; }

  /* === Channels / Royalties chart rows even tighter === */
  .ch-bar-chart, .rt-history-chart {
    grid-template-columns: 60px 1fr 60px !important;
    font-size: 10.5px;
  }

  /* === Cash-flow runway big number === */
  .cf-runway-big { font-size: 44px !important; }

  /* === Decisions card padding tighter === */
  .dec-card { padding: 16px 16px !important; }
  .dec-title { font-size: 16px !important; }

  /* === Goals card padding tighter === */
  .goal-card { padding: 16px 16px !important; }
  .goal-title { font-size: 15px !important; }
  .goal-progress-num { font-size: 22px !important; }

  /* === Roadmap cards === */
  .rm-col { padding: 12px; min-height: 0 !important; }
  .rm-card { padding: 12px; }

  /* === P&L month callout cards tighter === */
  .pnl-month-card { padding: 12px 14px; }
  .pnl-month-card-value { font-size: 17px; }

  /* === Build-request cards tighter === */
  .br-hero { padding: 20px 18px !important; }
  .br-hero-title { font-size: 18px !important; }
  .br-col { padding: 12px; }
  .br-card { padding: 12px 14px; }

  /* === Influencer table — hide one column to fit === */
  .inf-table th:nth-child(4),
  .inf-table td:nth-child(4) { display: none; }

  /* === Settings — tighter brand grid === */
  .st-conn-grid, .st-brand-grid {
    gap: 10px !important;
  }
}

/* ─── Very narrow phone (≤360px) — last-resort tighten ─── */
@media (max-width: 360px) {
  .content { padding: 14px 10px 90px; }
  .kpi-value { font-size: 18px; }
  .kpi { padding: 12px 14px !important; }
  .page-title { font-size: 17px; }
  .bldg-hero h1 { font-size: 16px !important; }
}
