/* EMBER — Dark Workshop Design System */

/* ── VARIABLES ─────────────────────────────────────── */
:root {
  --black:       #0A0A0A;
  --surface:     #141414;
  --surface-1:   #141414;
  --surface-2:   #1C1C1C;
  --border:      #2A2A2A;
  --border-active:#444444;
  --text:        #E8E8E8;
  --text-primary:#E8E8E8;
  --text-dim:    #888888;
  --accent:      #FF6B35;
  --accent-dim:  #CC5529;
  --green:       #4ADE80;
  --red:         #EF4444;
  --blue:        #60A5FA;
  --gold:        #FBBF24;
  --yellow:      #FBBF24;
  --font-body:   'IBM Plex Sans', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --nav-w:       200px;
  --radius:      2px;
}

/* ── RESET ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 14px;
  /* iOS Safari: lock html to true viewport, not including browser chrome */
  height: -webkit-fill-available;
}
body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  /* Desktop: lock to viewport, no scroll at body level */
  height: 100vh;
  height: 100dvh; /* modern browsers — excludes iOS Safari chrome */
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ── APP SHELL ──────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  /* iOS Safari fallback */
  height: -webkit-fill-available;
}

/* ── SIDEBAR NAV ────────────────────────────────────── */
.sidebar-nav {
  width: var(--nav-w);
  min-width: var(--nav-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 18px; }
.brand-name { font-family: var(--font-mono); font-size: 16px; font-weight: 600; letter-spacing: 0.1em; color: var(--accent); }

.nav-list { list-style: none; padding: 8px 0; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  transition: color 0.1s, background 0.1s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-active { color: var(--text); border-left-color: var(--accent); background: var(--surface-2); }
.nav-icon { font-size: 14px; width: 16px; text-align: center; }

.nav-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.nav-cmd-btn {
  width: 100%;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-cmd-btn:hover { color: var(--text); border-color: var(--text-dim); }
.nav-auth-stack { display: grid; gap: 8px; margin-bottom: 8px; }
.nav-login-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
}
.nav-login-link:hover { color: var(--accent); border-color: var(--accent); }
.nav-logout-btn {
  width: 100%;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(239,68,68,.35);
  border-radius: var(--radius);
  color: #f87171;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
}
.nav-logout-btn:hover { background: rgba(239,68,68,.08); border-color: #ef4444; }

.mobile-topbar,
.mobile-bottom-nav { display: none; }

.login-body {
  min-height: 100vh;
  overflow: auto;
  background: var(--black);
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px;
}
.login-brand {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  margin-bottom: 24px;
}
.login-title {
  font-size: 24px;
  line-height: 1.1;
  margin-bottom: 18px;
}
.login-error {
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: var(--text);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}
.login-missing {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 6px;
  word-break: break-word;
}
.login-providers {
  display: grid;
  gap: 10px;
}
.oauth-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}
.oauth-btn:hover { border-color: var(--accent); }
.oauth-btn span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 10px;
}
.login-redirects {
  margin-top: 18px;
  display: grid;
  gap: 6px;
  color: var(--text-dim);
  font-size: 11px;
}
.login-redirects code {
  display: block;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  white-space: normal;
  word-break: break-all;
}

/* ── MAIN CONTENT ───────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;          /* prevent flex blowout */
  min-height: 0;         /* allow shrinking inside flex column */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;  /* iOS momentum scroll */
  padding: 24px 28px;
}

.mobile-bid-list { display: none; }

/* ── PAGE HEADER ────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text);
}
.back-link {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.back-link:hover { color: var(--accent); }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ── BUTTONS ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  background: var(--surface);
  transition: border-color 0.1s, color 0.1s, background 0.1s;
  white-space: nowrap;
}
.btn:hover { color: var(--text); border-color: var(--text-dim); background: var(--surface-2); }
.btn-primary { background: var(--surface-2); color: var(--text); border-color: var(--text-dim); }
.btn-primary:hover { border-color: var(--text); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-secondary { border-color: var(--text-dim); color: var(--text-dim); }
.btn-sm { padding: 4px 10px; font-size: 10px; }
.btn-full { width: 100%; justify-content: center; padding: 11px 14px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── DATA TABLE ─────────────────────────────────────── */
.data-table {
  width: 100%;
  font-size: 13px;
}
.data-table thead tr {
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 8px 12px;
  text-align: left;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-row {
  cursor: pointer;
  transition: background 0.1s;
}
.table-row:hover { background: var(--surface-2); }
.title-cell { font-weight: 500; max-width: 280px; }
.col-money { text-align: right; font-family: var(--font-mono); }
.col-num { text-align: right; font-family: var(--font-mono); }
.col-date { white-space: nowrap; color: var(--text-dim); }
.col-score { width: 60px; text-align: center; }
.col-actions { width: 120px; text-align: right; }
.empty-table { text-align: center; color: var(--text-dim); padding: 40px; font-style: italic; }

/* Score borders */
.score-border-green  { border-left: 3px solid var(--green); }
.score-border-yellow { border-left: 3px solid var(--yellow); }
.score-border-dim    { border-left: 3px solid var(--border); }

/* Score badges */
.score-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius);
}
.score-green  { color: var(--green); background: rgba(74,222,128,.1); }
.score-yellow { color: var(--yellow); background: rgba(251,191,36,.1); }
.score-dim    { color: var(--text-dim); background: var(--surface-2); }

/* ── FILTERS ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.filter-tabs { display: flex; gap: 2px; }
.filter-tab {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  transition: all 0.1s;
}
.filter-tab:hover { color: var(--text); border-color: var(--text-dim); }
.filter-tab.active { color: var(--accent); border-color: var(--accent); background: rgba(255,107,53,.08); }
.tab-count { color: var(--text-dim); margin-left: 4px; }
.filter-controls { display: flex; gap: 8px; }
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── INPUTS ─────────────────────────────────────────── */
.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.1s;
  font-size: 13px;
}
.input:focus { border-color: var(--accent); }
.input-sm { padding: 4px 8px; font-size: 12px; }
.input-with-hint { position: relative; }
.input-hint { display: block; font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ── PANELS ─────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.panel-link {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}
.panel-link:hover { color: var(--accent); }

/* ── COMMAND CENTER ─────────────────────────────────── */
.command-center { display: flex; flex-direction: column; height: calc(100vh - 48px); gap: 16px; }
.cc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 1; overflow: hidden; }

/* Feed */
.feed-list { overflow-y: auto; max-height: calc(100% - 44px); }
.feed-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.feed-item:hover { background: var(--surface-2); }
.feed-score { font-family: var(--font-mono); font-weight: 600; font-size: 14px; text-align: center; }
.feed-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.feed-due { font-family: var(--font-mono); font-size: 11px; text-align: right; white-space: nowrap; }

/* Proposal board */
.proposal-board { overflow-y: auto; max-height: calc(100% - 44px); }
.proposal-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.proposal-row:hover { background: var(--surface-2); }
.proposal-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proposal-value { font-family: var(--font-mono); font-size: 13px; }
.proposal-status { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* Stats bar */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  flex-shrink: 0;
}
.stat { display: flex; align-items: center; gap: 10px; padding: 0 20px; }
.stat:first-child { padding-left: 0; }
.stat-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; color: var(--text-dim); }
.stat-value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.stat-divider { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }

/* ── URGENCY COLORS ─────────────────────────────────── */
.urgency-critical { color: var(--red); font-weight: 600; }
.urgency-urgent   { color: var(--gold); }
.urgency-warning  { color: var(--yellow); }
.urgency-normal   { color: var(--text-dim); }
.urgency-expired  { color: var(--text-dim); text-decoration: line-through; }

/* ── STATUS TAGS ────────────────────────────────────── */
.status-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: var(--radius);
}
.status-draft     { background: rgba(136,136,136,.15); color: var(--text-dim); }
.status-reviewed  { background: rgba(96,165,250,.15);  color: var(--blue); }
.status-submitted { background: rgba(251,191,36,.15);  color: var(--gold); }
.status-won       { background: rgba(74,222,128,.15);  color: var(--green); }
.status-lost      { background: rgba(239,68,68,.15);   color: var(--red); }

/* ── SLIDE PANEL ────────────────────────────────────── */
.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 100;
  overflow-y: auto;
  transform: translateX(0);
}
.slide-panel[hidden] { display: none; }
.slide-panel-inner { padding: 20px; }
.slide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.close-btn { color: var(--text-dim); font-size: 16px; line-height: 1; }
.close-btn:hover { color: var(--text); }

/* Panel form */
.panel-form { display: flex; flex-direction: column; gap: 14px; }
.panel-form label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-family: var(--font-mono); letter-spacing: 0.06em; color: var(--text-dim); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { padding-top: 8px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.form-label { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-dim); }

/* ── DETAIL LAYOUT ──────────────────────────────────── */
.detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; margin-top: 16px; }
.detail-title { font-size: 20px; font-weight: 600; line-height: 1.3; }
.detail-owner { color: var(--text-dim); margin-top: 4px; margin-bottom: 16px; }
.detail-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 16px; }
.meta-item { background: var(--surface); padding: 12px 14px; }
.meta-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-dim); display: block; margin-bottom: 4px; }
.meta-value { font-size: 13px; font-weight: 500; }
.detail-notes { margin-top: 16px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.notes-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); margin-bottom: 6px; }
.detail-sidebar .panel { padding: 0; }
.sidebar-item { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.sidebar-item:hover { background: var(--surface-2); }

/* ── PROPOSAL BUILDER ───────────────────────────────── */
.builder-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; }
.dropzone {
  border: 1px dashed var(--text-dim);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(255,107,53,.04);
}
.dropzone-icon { font-size: 32px; margin-bottom: 12px; color: var(--text-dim); }
.dropzone-title { font-family: var(--font-mono); font-size: 14px; font-weight: 600; letter-spacing: 0.08em; margin-bottom: 6px; }
.dropzone-sub { font-size: 12px; color: var(--text-dim); }
.file-list { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.file-list-header { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-dim); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.file-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.file-icon { color: var(--accent); font-family: var(--font-mono); font-size: 11px; }
.file-name { flex: 1; }
.file-size { color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; }
.generate-status { padding: 10px; font-size: 12px; color: var(--text-dim); text-align: center; font-family: var(--font-mono); }

/* ── PROPOSAL VIEWER ────────────────────────────────── */
.opp-context-bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; font-size: 12px; }
.opp-context-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

.proposal-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; margin-top: 16px; }
.proposal-sidebar { display: flex; flex-direction: column; gap: 12px; }
.sidebar-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.sidebar-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; color: var(--text-dim); margin-bottom: 10px; }
.meta-list { display: flex; flex-direction: column; gap: 6px; }
.meta-row { display: flex; justify-content: space-between; font-size: 12px; }
.meta-row span:first-child { color: var(--text-dim); }
.system-row { display: flex; justify-content: space-between; font-size: 12px; padding: 4px 0; }
.system-type { font-family: var(--font-mono); font-size: 10px; }
.rule-item { font-size: 11px; color: var(--green); padding: 2px 0; }

/* Pricing tiers */
.pricing-section { margin-bottom: 20px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pricing-tier { background: var(--surface); padding: 16px; text-align: center; }
.pricing-tier.tier-recommended { background: rgba(255,107,53,.08); }
.tier-header { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 8px; }
.tier-price { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--text); }
.tier-recommended .tier-price { color: var(--accent); }
.tier-per-dev { font-size: 11px; margin-top: 4px; }
.tier-markup { font-size: 11px; margin-top: 2px; }
.tier-rec-badge { display: inline-block; margin-top: 8px; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.08em; color: var(--accent); border: 1px solid var(--accent); padding: 2px 8px; border-radius: var(--radius); }
.rec-reason { font-size: 12px; color: var(--text-dim); margin-top: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* Sections */
.section-label { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 10px; margin-top: 20px; }
.section-label.collapsible { cursor: pointer; user-select: none; }
.section-label.collapsible:hover { color: var(--text); }

/* Flags */
.flags-section { margin-bottom: 16px; }
.flag-item { display: grid; grid-template-columns: 60px 180px 1fr; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; align-items: baseline; }
.flag-risk { font-family: var(--font-mono); font-size: 10px; font-weight: 600; }
.flag-high .flag-risk   { color: var(--red); }
.flag-medium .flag-risk { color: var(--gold); }
.flag-low .flag-risk    { color: var(--text-dim); }
.flag-name { font-weight: 500; }

/* Labor */
.labor-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.labor-row { display: flex; justify-content: space-between; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.labor-row:last-child { border-bottom: none; }
.total-row { background: var(--surface-2); font-weight: 600; }

/* Review notes */
.review-note { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.note-topic { font-family: var(--font-mono); font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.note-analysis { font-size: 12px; }

.assume-excl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.list-item { font-size: 12px; padding: 3px 0; color: var(--text-dim); }

/* ── RESULTS / WIN-LOSS ──────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; color: var(--text-dim); margin-bottom: 6px; }
.stat-card-value { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1; }
.stat-card-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.result-badge { display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: var(--radius); }
.result-won  { background: rgba(74,222,128,.15); color: var(--green); }
.result-lost { background: rgba(239,68,68,.15);  color: var(--red); }
.result-no_bid, .result-withdrawn { background: var(--surface-2); color: var(--text-dim); }

/* ── SETTINGS ───────────────────────────────────────── */
.settings-layout { max-width: 800px; }
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.settings-section-title { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 14px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid label { display: flex; flex-direction: column; gap: 5px; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.settings-note { font-size: 11px; color: var(--text-dim); margin-top: 10px; font-style: italic; }
.settings-actions { margin-top: 4px; margin-bottom: 16px; }
.danger-zone { border-color: rgba(239,68,68,.3); }
.system-info { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; gap: 16px; font-size: 12px; }
.info-row span:first-child { width: 100px; }

/* ── COMMAND PALETTE ────────────────────────────────── */
.cmd-palette { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 999; }
.cmd-palette[hidden] { display: none; }
.cmd-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.7); }
.cmd-modal {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.8);
}
.cmd-input-wrap { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmd-prefix { font-family: var(--font-mono); color: var(--accent); margin-right: 10px; }
.cmd-input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; }
.cmd-esc { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); border: 1px solid var(--border); padding: 2px 6px; border-radius: var(--radius); cursor: pointer; }
.cmd-results { max-height: 360px; overflow-y: auto; }
.cmd-result-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); }
.cmd-result-item:hover, .cmd-result-item.selected { background: var(--surface-2); }
.cmd-result-icon { color: var(--text-dim); width: 20px; text-align: center; }
.cmd-result-label { font-size: 13px; }
.cmd-result-sub { font-size: 11px; color: var(--text-dim); margin-left: auto; font-family: var(--font-mono); }

/* ── TOAST ──────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { padding: 10px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; animation: slideIn .2s ease; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast-inline { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; }
.toast-inline.success { background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.3); color: var(--green); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── UTILITIES ──────────────────────────────────────── */
.mono    { font-family: var(--font-mono); }
.dim     { color: var(--text-dim); }
.accent-text { color: var(--accent); }
.green-text  { color: var(--green); }
.red-text    { color: var(--red); }
.empty-state { padding: 20px; text-align: center; color: var(--text-dim); font-size: 12px; font-style: italic; }
.systems-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); letter-spacing: 0.04em; }
.due-label { font-family: var(--font-mono); font-size: 11px; }

/* ── SCROLLBARS ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── TOP TABS (Bid Feed / Pipeline) ─────────────────── */
.top-tabs { display: flex; align-items: center; gap: 0; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.top-tab { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; padding: 10px 18px; color: var(--text-dim); border-bottom: 2px solid transparent; transition: all .1s; }
.top-tab:hover { color: var(--text); }
.top-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.scanner-status { margin-left: auto; font-family: var(--font-mono); font-size: 10px; padding-right: 4px; }

/* ── STAGE FILTER STRIP ──────────────────────────────── */
.stage-filter-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.stage-pill { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; padding: 5px 10px; border: 1px solid var(--border); border-radius: 12px; color: var(--text-dim); transition: all .1s; white-space: nowrap; }
.stage-pill:hover { color: var(--text); border-color: var(--text-dim); }
.stage-pill.active { color: var(--accent); border-color: var(--accent); background: rgba(255,107,53,.08); }
.pill-count { color: var(--text-dim); margin-left: 4px; }

/* ── PIPELINE CARDS ──────────────────────────────────── */
.pipeline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.pipeline-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: border-color .1s, background .1s; }
.pipeline-card:hover { border-color: var(--text-dim); background: var(--surface-2); }
.pipeline-card.priority-high   { border-left: 3px solid var(--red); }
.pipeline-card.priority-medium { border-left: 3px solid var(--yellow); }
.pipeline-card.priority-low    { border-left: 3px solid var(--border); }
.pipeline-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; gap: 10px; }
.pipeline-card-name { font-weight: 600; font-size: 13px; flex: 1; }
.pipeline-card-value { font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.pipeline-card-owner { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; }
.pipeline-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.pipeline-card-meta { font-size: 11px; color: var(--text-dim); }
.stage-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 8px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); }

/* Progress bar */
.pipeline-progress { margin: 10px 0; }
.progress-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s ease; }
.progress-stages { display: flex; justify-content: space-between; }
.progress-dot { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); transition: all .2s; }
.progress-dot.done    { background: var(--accent); border-color: var(--accent); }
.progress-dot.current { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,107,53,.2); }
.progress-dot.pending { background: var(--surface); border-color: var(--border); }

/* Coach tip preview on card */
.coach-tip-preview { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 10px; background: rgba(96,165,250,.06); border: 1px solid rgba(96,165,250,.15); border-radius: var(--radius); }
.coach-tip-icon { font-size: 12px; flex-shrink: 0; }
.coach-tip-text { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

/* ── PIPELINE STAGE TRACKER ──────────────────────────── */
.stage-tracker { display: flex; gap: 0; overflow-x: auto; margin: 16px 0 20px; padding-bottom: 4px; }
.stage-track-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 72px; flex-shrink: 0; position: relative; }
.stage-track-item:not(:last-child)::after { content: ''; position: absolute; top: 12px; left: calc(50% + 12px); width: calc(100% - 24px); height: 1px; background: var(--border); z-index: 0; }
.stage-track-item.done::after   { background: var(--accent); }
.stage-track-dot { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 11px; z-index: 1; position: relative; }
.stage-track-item.done .stage-track-dot    { background: var(--accent); border-color: var(--accent); color: white; font-size: 10px; }
.stage-track-item.current .stage-track-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px rgba(255,107,53,.15); }
.stage-track-item.pending .stage-track-dot { color: var(--text-dim); }
.stage-track-label { font-family: var(--font-mono); font-size: 8px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-dim); text-align: center; }
.stage-track-item.current .stage-track-label { color: var(--accent); }
.stage-track-item.done .stage-track-label   { color: var(--text-dim); }
.stage-track-date { font-family: var(--font-mono); font-size: 8px; color: var(--text-dim); }

/* ── PIPELINE DETAIL LAYOUT ──────────────────────────── */
.pipeline-detail-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; margin-top: 4px; }
.pipeline-detail-left { display: flex; flex-direction: column; gap: 12px; }
.pipeline-detail-right { position: sticky; top: 0; height: calc(100vh - 200px); display: flex; flex-direction: column; }

/* Checklist */
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.checklist-item:hover { background: var(--surface-2); }
.checklist-item.checked .check-label { color: var(--text-dim); text-decoration: line-through; }
.checklist-item.checked .check-btn { color: var(--green); }
.check-btn { font-family: var(--font-mono); font-size: 14px; color: var(--text-dim); flex-shrink: 0; width: 20px; text-align: center; }
.check-label { font-size: 13px; }
.checklist-footer { padding: 10px 14px; }
.stage-ready-banner { font-family: var(--font-mono); font-size: 11px; color: var(--green); background: rgba(74,222,128,.08); border: 1px solid rgba(74,222,128,.2); border-radius: var(--radius); padding: 8px 12px; text-align: center; }

/* ── AI COACH PANEL ──────────────────────────────────── */
.coach-panel { display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.coach-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.coach-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.coach-msg { padding: 10px 12px; border-radius: var(--radius); font-size: 12px; line-height: 1.5; max-width: 96%; }
.coach-msg-user      { background: var(--surface-2); border: 1px solid var(--border); align-self: flex-end; }
.coach-msg-assistant { background: rgba(96,165,250,.06); border: 1px solid rgba(96,165,250,.15); align-self: flex-start; }
.coach-loading       { opacity: .6; animation: pulse 1.2s ease-in-out infinite; }
.coach-msg-role { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 4px; }
.coach-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); flex-shrink: 0; }
@keyframes pulse { 0%,100% { opacity:.4; } 50% { opacity:.8; } }

/* ── TAGS / INDUSTRY PROFILE ─────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; padding: 3px 8px; background: rgba(255,107,53,.1); border: 1px solid rgba(255,107,53,.3); border-radius: 10px; color: var(--accent); }
.tag-chip button { color: var(--text-dim); font-size: 12px; line-height: 1; }
.tag-chip button:hover { color: var(--red); }
.tag-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.tag-input-wrap { flex: 1; position: relative; }
.tag-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); z-index: 50; max-height: 200px; overflow-y: auto; }
.tag-suggestion-item { padding: 8px 12px; font-size: 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.tag-suggestion-item:hover { background: var(--surface-2); color: var(--accent); }
.tag-quick-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.tag-quick-btn { font-family: var(--font-mono); font-size: 10px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-dim); background: var(--surface); transition: all .1s; }
.tag-quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.state-check-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.state-check { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; cursor: pointer; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.state-check:has(input:checked) { border-color: var(--accent); color: var(--accent); background: rgba(255,107,53,.06); }

/* ── RESPONSIVE PATCHES ──────────────────────────────── */
@media (max-width: 768px) {
  .pipeline-detail-layout { grid-template-columns: 1fr; }
  .pipeline-detail-right { height: 400px; position: static; }
  .stage-tracker { padding-bottom: 8px; }
}

/* ── RESPONSIVE (phone check only) ─────────────────── */
@media (max-width: 768px) {
  html { font-size: 13px; }
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
    padding: 56px 0 74px;
  }
  .app-shell {
    display: block;
    min-height: 100vh;
    height: auto;
  }
  .sidebar-nav { display: none; }
  .mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: rgba(10,10,10,.96);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }
  .mobile-brand {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .14em;
  }
  .mobile-top-actions { display: flex; align-items: center; gap: 8px; }
  .mobile-icon-link,
  .mobile-icon-button {
    min-width: 42px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    background: var(--surface);
  }
  .mobile-icon-link.active,
  .mobile-icon-link:hover,
  .mobile-icon-button:hover {
    color: var(--accent);
    border-color: var(--accent);
  }
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(10,10,10,.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 14px;
    min-width: 0;
  }
  .mobile-nav-item small {
    font-size: 9px;
    line-height: 1;
    letter-spacing: .02em;
  }
  .mobile-nav-item.active {
    color: var(--accent);
    background: rgba(255,107,53,.08);
  }
  .main-content {
    height: auto;
    min-height: calc(100vh - 130px);
    overflow: visible;
    padding: 14px;
  }
  .page-header {
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }
  .page-title { font-size: 12px; }
  .page-actions,
  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .page-actions .btn,
  .header-actions .btn-primary,
  .header-actions .btn-ghost,
  .page-actions a,
  .page-actions button {
    width: 100%;
    justify-content: center;
    min-height: 38px;
    padding-left: 8px;
    padding-right: 8px;
    white-space: normal;
  }
  .cc-grid, .detail-layout, .proposal-layout, .builder-layout,
  .pipeline-detail-layout, .analytics-grid-2, .settings-layout {
    grid-template-columns: 1fr !important;
  }
  .command-center {
    height: auto;
    min-height: 0;
  }
  .cc-grid { overflow: visible; }
  .panel { min-width: 0; }
  .stats-bar,
  .proposal-kpi-strip,
  .analytics-kpi-row,
  .sources-stats-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .stat,
  .proposal-kpi,
  .kpi-card,
  .stat-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    min-width: 0;
  }
  .stat-divider { display: none; }
  .detail-meta-grid { grid-template-columns: 1fr 1fr; }
  .assume-excl-grid, .pricing-grid, .editor-notes-grid,
  .filter-panel-inner { grid-template-columns: 1fr !important; }
  .filter-group-wide { grid-column: auto; }
  .filter-bar,
  .top-tabs,
  .sources-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .filter-tabs,
  .cat-filter-chips,
  .source-chips {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .filter-tab,
  .cat-chip,
  .source-chip {
    flex: 0 0 auto;
    min-height: 34px;
    white-space: nowrap;
  }
  #opp-table-wrap { display: none; }
  .mobile-bid-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
  }
  .mobile-bid-card {
    display: grid;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 8px;
    padding: 12px;
    min-width: 0;
  }
  .mobile-bid-head,
  .mobile-bid-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .mobile-bid-card h2 {
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    overflow-wrap: anywhere;
  }
  .mobile-bid-meta {
    display: grid;
    gap: 2px;
    color: var(--text-dim);
    font-size: 11px;
    min-width: 0;
  }
  .mobile-bid-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-bid-foot .btn {
    min-width: 58px;
    justify-content: center;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table { min-width: 640px; }
  .settings-grid,
  .form-row,
  .margin-controls-bar,
  .source-cards,
  .model-grid {
    grid-template-columns: 1fr !important;
  }
  .source-cards { display: grid; }
  .source-card,
  .model-card {
    border-radius: 8px;
    padding: 12px;
  }
  .source-card-actions .btn-xs,
  .modal-actions .btn-primary,
  .modal-actions .btn-ghost {
    flex: 1 1 calc(50% - 5px);
    min-height: 34px;
    text-align: center;
  }
  .slide-panel {
    inset: 56px 0 66px 0;
    width: 100%;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .modal-box {
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 120px);
    overflow: auto;
    padding: 18px;
  }
  .login-shell { min-height: calc(100vh - 130px); }
  .login-panel {
    padding: 20px;
    border-radius: 8px;
  }
}

@media (max-width: 420px) {
  .main-content { padding: 12px; }
  .page-actions,
  .header-actions,
  .analytics-kpi-row,
  .stats-bar,
  .proposal-kpi-strip,
  .sources-stats-bar {
    grid-template-columns: 1fr;
  }
  .detail-meta-grid { grid-template-columns: 1fr; }
  .mobile-bid-foot {
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .mobile-bid-foot .btn {
    grid-column: 1 / -1;
  }
}

/* ── TUNNEL BANNER ───────────────────────────────────────────────────────── */
.tunnel-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 107, 53, 0.08);
  border: 1px solid rgba(255, 107, 53, 0.25);
  border-radius: 6px;
  padding: 9px 16px;
  margin-bottom: 18px;
  font-size: 12px;
  font-family: var(--font-mono);
}
.tunnel-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.tunnel-label { color: var(--accent); font-weight: 600; letter-spacing: .08em; }
.tunnel-url { color: var(--green); text-decoration: none; }
.tunnel-url:hover { text-decoration: underline; }
.tunnel-note { font-size: 11px; }

/* ── FILTER PANEL ────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0; padding: 0 0 10px; gap: 12px; flex-wrap: wrap; }
.filter-bar-right { display: flex; align-items: center; gap: 10px; }
.results-count { font-family: var(--font-mono); font-size: 11px; }

.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  transition: all .2s;
}
.filter-panel-inner {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1.4fr 1fr 1.8fr 1fr 1fr auto;
  gap: 0;
  padding: 0;
  align-items: start;
}
.filter-group {
  padding: 14px 14px 14px;
  border-right: 1px solid var(--border);
}
.filter-group:last-child { border-right: none; }
.filter-group-wide { grid-column: span 2; }
.filter-group-actions { display: flex; flex-direction: column; gap: 8px; justify-content: center; padding: 14px; }

.filter-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.search-input-wrap { position: relative; }
.search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 14px; pointer-events: none; }
.filter-search { padding-left: 28px !important; }

.range-wrap { display: flex; align-items: center; gap: 8px; }
.range-input { flex: 1; -webkit-appearance: none; appearance: none; height: 3px; background: var(--border); border-radius: 2px; outline: none; }
.range-input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.range-display { font-family: var(--font-mono); font-size: 11px; color: var(--accent); min-width: 28px; }

.value-range-row { display: flex; align-items: center; gap: 6px; }
.input-sm { padding: 5px 8px; font-size: 12px; }
.score-range-labels { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); margin-top: 4px; }

/* Source chips */
.source-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.source-chip {
  font-family: var(--font-mono); font-size: 10px; padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-dim); background: var(--surface-2);
  cursor: pointer; transition: all .1s;
}
.source-chip:hover { border-color: var(--accent); color: var(--accent); }
.source-chip.active { border-color: var(--accent); color: var(--accent); background: rgba(255,107,53,.1); }

/* Source type badges in table */
.src-badge { font-family: var(--font-mono); font-size: 9px; font-weight: 600; padding: 2px 6px; border-radius: 2px; letter-spacing: .06em; }
.src-gov     { background: rgba(96,165,250,.15);  color: #60A5FA; }
.src-permit  { background: rgba(167,139,250,.15); color: #A78BFA; }
.src-web     { background: rgba(52,211,153,.15);  color: #34D399; }
.src-chamber { background: rgba(244,114,182,.15); color: #F472B6; }
.src-manual  { background: rgba(148,163,184,.15); color: #94A3B8; }

/* Opportunity table enhancements */
.opp-title { font-weight: 500; line-height: 1.3; }
.opp-location { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.industry-tag { font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 2px; margin-top: 3px; display: inline-block; }
.col-tag { width: 80px; }

/* AI Bid Advisor panel */
.ai-advisor-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.ai-advisor-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ai-advisor-title { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.advisor-output { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.advisor-text { font-size: 13px; line-height: 1.6; color: var(--text); }

/* ── MAP PAGE ────────────────────────────────────────────────────────────── */
.map-page { display: flex; height: 100%; gap: 0; overflow: hidden; }

.map-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
.map-sidebar-head { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.map-sidebar-title { font-family: var(--font-mono); font-size: 13px; font-weight: 600; letter-spacing: .1em; }
.map-badges { display: flex; gap: 6px; }
.map-badge { font-family: var(--font-mono); font-size: 10px; padding: 2px 7px; border-radius: 10px; }
.map-badge-green { background: rgba(74,222,128,.15); color: var(--green); }
.map-badge-dim   { background: var(--surface-2); color: var(--text-dim); }

.map-control-section { padding: 12px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.map-control-label { display: block; font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .12em; color: var(--text-dim); margin-bottom: 8px; }

.radius-control { display: flex; align-items: center; gap: 10px; }
.radius-input { flex: 1; -webkit-appearance: none; appearance: none; height: 3px; background: var(--border); border-radius: 2px; }
.radius-input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; }
.radius-value { font-family: var(--font-mono); font-size: 12px; color: var(--accent); min-width: 44px; text-align: right; }

.office-input-row { display: flex; gap: 6px; }
.office-input-row .input { flex: 1; }

/* Layer toggles */
.layer-toggles { display: flex; flex-direction: column; gap: 6px; }
.layer-toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; user-select: none; }
.layer-toggle input { display: none; }
.layer-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.layer-dot.government { background: #60A5FA; }
.layer-dot.permit     { background: #A78BFA; }
.layer-dot.web        { background: #34D399; }
.layer-dot.chamber    { background: #F472B6; }
.layer-dot.manual     { background: #94A3B8; }
.layer-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }
.layer-toggle input:not(:checked) ~ .layer-dot { opacity: .3; }

/* Score slider labels */
.score-range-labels { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9px; color: var(--text-dim); margin-top: 4px; }

/* Opportunity list in sidebar */
.map-opp-list { flex: 1; overflow-y: auto; }
.map-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.map-list-item:hover { background: var(--surface-2); }
.map-list-score { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: #000; flex-shrink: 0; }
.map-list-body { flex: 1; min-width: 0; }
.map-list-title { font-size: 11px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-list-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.map-list-loading { padding: 16px; font-size: 12px; color: var(--text-dim); text-align: center; }
.map-empty { padding: 16px; font-size: 12px; color: var(--text-dim); text-align: center; }

.geocode-prompt { padding: 10px 14px; border-top: 1px solid var(--border); }

/* Map container */
.map-container { flex: 1; position: relative; }
#ember-map { width: 100%; height: 100%; }

/* Override Leaflet defaults for dark theme */
.leaflet-container { background: #1C1C1C; }
.leaflet-control-zoom a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 4px 20px rgba(0,0,0,.6); }
.leaflet-popup-tip { background: var(--surface); }

/* Map detail panel */
.map-detail-panel {
  position: absolute;
  bottom: 24px;
  right: 16px;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0,0,0,.7);
}
.map-detail-close { position: absolute; top: 12px; right: 12px; color: var(--text-dim); font-size: 16px; }
.map-detail-close:hover { color: var(--text); }
.map-detail-score { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1; }
.map-detail-score span { font-size: 14px; color: var(--text-dim); }
.map-detail-title { font-size: 14px; font-weight: 500; line-height: 1.4; margin: 8px 0; }
.map-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.map-detail-owner { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; }
.map-detail-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Map legend */
.map-legend {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(20,20,20,.92);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  z-index: 999;
  min-width: 120px;
}
.legend-title { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .1em; color: var(--text-dim); margin-bottom: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-bottom: 4px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-dot.score-green  { background: #4ADE80; }
.legend-dot.score-gold   { background: #FBBF24; }
.legend-dot.score-orange { background: #FF6B35; }
.legend-dot.score-red    { background: #EF4444; }

/* Scanner status styles */
.scanner-running { color: var(--green); animation: pulse 1.5s infinite; }

/* Main content full height for map page */
body:has(.map-page) .main-content { padding: 0; overflow: hidden; }

@media (max-width: 768px) {
  .filter-panel-inner { grid-template-columns: 1fr 1fr; }
  .filter-group-wide { grid-column: span 2; }
  .map-sidebar { width: 220px; min-width: 220px; }
  .map-detail-panel { width: calc(100vw - 240px); }
}

/* ── PROPOSAL KPI STRIP ──────────────────────────────────────────────────── */
.proposal-kpi-strip {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  overflow: hidden;
}
.proposal-kpi {
  flex: 1;
  padding: 12px 16px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.proposal-kpi:last-child { border-right: none; }
.kpi-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .12em; color: var(--text-dim); text-transform: uppercase; }
.kpi-value { font-size: 16px; font-weight: 600; }

/* ── LINE ITEM CATEGORY DOTS ─────────────────────────────────────────────── */
.li-cat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.li-cat-materials  { background: #60A5FA; }
.li-cat-labor      { background: #4ADE80; }
.li-cat-subcontract{ background: #A78BFA; }
.li-cat-overhead   { background: #94A3B8; }

/* ── MARGIN INPUT INLINE ─────────────────────────────────────────────────── */
.margin-input-row { display: flex; align-items: center; gap: 4px; }
.margin-symbol { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

/* ── MARGIN CONTROLS BAR ─────────────────────────────────────────────────── */
.margin-controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.margin-ctrl { display: flex; flex-direction: column; gap: 5px; }
.margin-ctrl-label { font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: .1em; color: var(--text-dim); text-transform: uppercase; }
.margin-ctrl-input { display: flex; align-items: center; gap: 4px; }
.margin-ctrl-input .input { width: 72px; text-align: right; }
.mcb-divider { width: 1px; background: var(--border); align-self: stretch; margin: 0 4px; }

.margin-kpi-group { display: flex; gap: 20px; align-items: center; }
.margin-kpi { display: flex; flex-direction: column; gap: 3px; }
.margin-kpi-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; color: var(--text-dim); text-transform: uppercase; }

/* ── EDITOR TABLE ────────────────────────────────────────────────────────── */
.editor-table-wrap { overflow-x: auto; margin-bottom: 12px; }
.editor-table { font-size: 12px; }
.editor-table th { font-size: 9px; }

.editor-row td { padding: 4px 6px; vertical-align: middle; }
.editor-row:hover { background: rgba(255,255,255,.02); }

.col-drag { width: 24px; color: var(--text-dim); cursor: grab; text-align: center; user-select: none; font-size: 14px; }
.col-unit { width: 64px; }
.col-margin { width: 90px; }

.editor-desc-cell { display: flex; align-items: center; gap: 0; min-width: 200px; }
.editor-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 3px 6px;
  border-radius: var(--radius);
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  transition: border-color .1s, background .1s;
}
.editor-input:hover  { border-color: var(--border); }
.editor-input:focus  { border-color: var(--accent); background: var(--surface-2); outline: none; }
.desc-input  { min-width: 180px; }
.num-input   { width: 60px; text-align: right; font-family: var(--font-mono); }
.money-input { width: 80px; text-align: right; font-family: var(--font-mono); }
.margin-input{ width: 50px; text-align: right; font-family: var(--font-mono); }
.unit-select { width: 58px; font-size: 11px; cursor: pointer; }

.editor-total-row td { background: var(--surface); border-top: 2px solid var(--border); padding: 8px 6px; }

.btn-icon-del {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, color .1s;
}
.btn-icon-del:hover { background: rgba(239,68,68,.15); color: var(--red); }

/* ── ADD ROW / NOTES ─────────────────────────────────────────────────────── */
.editor-add-row { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.editor-notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.editor-notes-col { display: flex; flex-direction: column; gap: 8px; }

/* ── ITEMS SUMMARY SECTION ───────────────────────────────────────────────── */
.items-summary-section { margin-bottom: 20px; }
.section-link { color: var(--accent); font-size: 11px; }

/* Row category color coding in summary */
.row-labor   { background: rgba(74,222,128,.03); }
.row-overhead{ background: rgba(148,163,184,.03); }

/* ── BID SOURCES PAGE ─────────────────────────────────────────────────────── */
.sources-stats-bar { display:flex; gap:12px; margin-bottom:20px; flex-wrap:wrap; }
.stat-chip { display:flex; flex-direction:column; align-items:center; padding:10px 18px; border-radius:6px; border:1px solid var(--border); min-width:90px; }
.stat-chip-green  { border-color:#4ADE8055; }
.stat-chip-blue   { border-color:#60A5FA55; }
.stat-chip-gold   { border-color:#FBBF2455; }
.stat-chip-dim    { border-color:var(--border); }
.chip-num { font-size:22px; font-weight:700; font-family:var(--font-mono); color:var(--text-primary); }
.chip-lbl { font-size:9px; color:var(--text-dim); letter-spacing:.08em; margin-top:2px; }

.sources-toolbar { display:flex; gap:12px; align-items:flex-start; margin-bottom:24px; flex-wrap:wrap; }
.cat-filter-chips { display:flex; gap:6px; flex-wrap:wrap; }
.cat-chip { padding:4px 10px; border-radius:3px; border:1px solid var(--border); font-size:11px; color:var(--text-dim); text-decoration:none; cursor:pointer; transition:all .15s; }
.cat-chip:hover, .cat-chip.active { background:var(--surface-2); color:var(--text-primary); }

.source-group { margin-bottom:28px; }
.source-group-header { display:flex; align-items:center; gap:8px; margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid var(--border); }
.source-group-icon { font-size:16px; }
.source-group-label { font-size:11px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; }
.source-group-count { font-size:11px; color:var(--text-dim); margin-left:auto; }

.source-cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:10px; }
.source-card { background:var(--surface-1); border:1px solid var(--border); border-radius:6px; padding:14px; transition:border-color .15s; }
.source-card:hover { border-color:var(--border-active); }
.source-card-top { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:6px; }
.source-card-name { font-size:13px; font-weight:600; color:var(--text-primary); line-height:1.3; }
.source-priority-badge { font-size:9px; font-weight:700; letter-spacing:.06em; flex-shrink:0; margin-left:8px; }
.source-card-meta { display:flex; gap:5px; align-items:center; flex-wrap:wrap; margin-bottom:6px; }
.source-cost { padding:2px 6px; border-radius:2px; font-size:9px; font-weight:700; letter-spacing:.05em; }
.source-cost.free     { background:#4ADE8022; color:#4ADE80; }
.source-cost.freemium { background:#FBBF2422; color:#FBBF24; }
.source-cost.paid     { background:#EF444422; color:#EF4444; }
.source-api-badge  { padding:2px 5px; border-radius:2px; background:#60A5FA22; color:#60A5FA; font-size:9px; font-weight:700; }
.source-auto-badge { padding:2px 5px; border-radius:2px; background:#A78BFA22; color:#A78BFA; font-size:9px; font-weight:700; }
.source-opp-count  { font-size:10px; color:var(--text-dim); margin-left:auto; }
.source-status-row { display:flex; align-items:center; gap:6px; margin-bottom:6px; }
.status-dot        { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.dot-active        { background:#4ADE80; box-shadow:0 0 6px #4ADE8088; }
.dot-configured    { background:#FBBF24; }
.dot-error         { background:#EF4444; }
.dot-empty         { background:var(--border); border:1px solid var(--border-active); }
.source-status-label { font-size:10px; font-weight:600; letter-spacing:.04em; color:var(--text-dim); }
.source-last-test  { font-size:9px; color:var(--text-dim); margin-left:auto; }
.source-notes      { font-size:10px; line-height:1.4; margin-bottom:8px; }
.source-card-actions { display:flex; gap:5px; flex-wrap:wrap; margin-top:8px; }
.btn-xs            { padding:3px 8px; font-size:10px; font-weight:600; letter-spacing:.04em; border-radius:3px; cursor:pointer; border:1px solid var(--border); background:transparent; color:var(--text-dim); text-decoration:none; transition:all .15s; }
.btn-xs:hover      { background:var(--surface-2); color:var(--text-primary); }
.btn-xs.btn-primary{ background:#FF6B35; border-color:#FF6B35; color:#fff; }
.btn-xs.btn-primary:hover { background:#e55a24; }

/* Modal */
.modal-backdrop    { position:fixed; inset:0; background:#00000099; display:flex; align-items:center; justify-content:center; z-index:1000; }
.modal-box         { background:var(--surface-1); border:1px solid var(--border-active); border-radius:8px; width:100%; max-width:480px; padding:24px; }
.modal-header      { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; font-size:14px; font-weight:600; }
.modal-close       { background:none; border:none; color:var(--text-dim); font-size:16px; cursor:pointer; padding:4px 8px; }
.modal-close:hover { color:var(--text-primary); }
.modal-actions     { display:flex; gap:8px; margin-top:16px; }
.form-hint         { font-size:11px; color:var(--text-dim); margin-top:6px; }
.form-hint.success { color:#4ADE80; }
.form-hint.error   { color:#EF4444; }
.link              { color:var(--accent); text-decoration:none; }

/* Scrape toast */
.scrape-progress-toast { position:fixed; bottom:24px; right:24px; background:var(--surface-1); border:1px solid var(--border-active); border-radius:6px; padding:12px 18px; display:flex; align-items:center; gap:10px; font-size:13px; z-index:999; }
.scrape-spinner    { animation:spin 1s linear infinite; display:inline-block; }

/* Model grid */
.model-grid        { display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:8px; margin-bottom:24px; }
.model-card        { background:var(--surface-1); border:1px solid var(--border); border-radius:6px; padding:12px; }
.model-name        { font-size:12px; font-weight:600; margin-bottom:2px; }
.model-id          { font-size:10px; font-family:var(--font-mono); margin-bottom:6px; }
.model-cost        { font-size:11px; color:#4ADE80; font-weight:600; }

/* ── OAUTH + PUSH NOTIFICATION STYLES ───────────────────────────────────────── */
.btn-connected         { background:#4ADE8022 !important; border-color:#4ADE80 !important; color:#4ADE80 !important; }
.btn-platform-connected{ background:#60A5FA11; border-color:#60A5FA55; color:#60A5FA; padding:3px 8px; border-radius:2px; font-size:9px; font-weight:700; }
.nav-notif-btn         { background:none; border:none; cursor:pointer; font-size:16px; padding:6px; border-radius:4px; transition:all .15s; line-height:1; }
.nav-notif-btn:hover   { background:var(--surface-2); }

/* Notification panel */
.notif-panel           { position:fixed; bottom:70px; left:16px; width:280px; background:var(--surface-1); border:1px solid var(--border-active); border-radius:8px; z-index:998; box-shadow:0 8px 32px #00000088; }
.notif-panel-header    { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; border-bottom:1px solid var(--border); font-size:13px; font-weight:600; }
.notif-panel-body      { padding:14px; }
.notif-opt             { margin-bottom:12px; }
.notif-opt label       { display:block; font-size:11px; color:var(--text-dim); margin-bottom:4px; }
.notif-opt input[type=range] { width:100%; }

/* Usage cap banner */
.cap-warning-banner    { background:#FBBF2411; border:1px solid #FBBF2444; border-radius:6px; padding:10px 14px; font-size:12px; color:#FBBF24; display:flex; align-items:center; gap:8px; margin-bottom:16px; }
.cap-bar               { height:4px; background:var(--surface-2); border-radius:2px; overflow:hidden; margin-top:4px; }
.cap-bar-fill          { height:100%; border-radius:2px; transition:width .3s; }

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE + TABLET RESPONSIVE SYSTEM
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── BOTTOM NAV (mobile only) ─────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Height: 56px nav + safe area (iPhone home indicator) */
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 500;
  /* Pad left/right for notch in landscape */
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  /* Prevent content underneath from showing through */
  backdrop-filter: none;
}
.bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 56px;
  max-width: 600px;
  margin: 0 auto;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: var(--radius);
  transition: color 0.15s;
  min-width: 52px;
  text-align: center;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-icon { font-size: 18px; line-height: 1; }

/* Scan indicator dot in bottom nav */
.scan-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}
.scan-dot.scanning {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 1.5s infinite;
}
.scan-dot.idle { background: var(--text-dim); }

/* Scan status in sidebar footer */
.scan-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.scan-last-time { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-trigger-btn {
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  transition: all 0.1s;
  white-space: nowrap;
}
.scan-trigger-btn:hover { color: var(--accent); border-color: var(--accent); }
.scan-trigger-btn.spinning { color: var(--green); border-color: var(--green); }

/* ── TABLET — 1024px ──────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --nav-w: 52px; }

  .sidebar-nav {
    width: var(--nav-w);
    min-width: var(--nav-w);
    overflow: visible;
  }

  .nav-label { display: none; }
  .nav-brand .brand-name { display: none; }
  .nav-brand { justify-content: center; padding: 16px 0; }
  .brand-icon { font-size: 20px; }

  .nav-item {
    justify-content: center;
    padding: 10px 0;
    border-left: 3px solid transparent;
  }
  .nav-active { border-left-color: var(--accent); }
  .nav-icon { width: 20px; font-size: 16px; }

  .nav-footer { display: none; }

  .main-content { padding: 18px 20px; }

  /* Grids narrow */
  .cc-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr 240px; gap: 16px; }
  .pipeline-detail-layout { grid-template-columns: 1fr 300px; }
  .filter-panel-inner { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; gap: 8px; }

  .slide-panel { width: 380px; }
}

/* ── PHONE (portrait + landscape) — 768px ────────────────────────────────── */
@media (max-width: 768px) {
  /* Unlock body — page scrolls naturally on phone */
  html, body {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible !important;
  }

  /* App shell: full-height column, scrolls via body */
  .app-shell {
    flex-direction: column;
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .sidebar-nav { display: none !important; }

  .bottom-nav { display: block; }

  /* Main content: natural flow, no overflow trap */
  .main-content {
    flex: none;
    width: 100%;
    padding: 16px;
    /* Space above fixed bottom nav: 60px nav + safe area */
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    height: auto !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: auto;
  }

  /* Page header stacks */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-actions { flex-wrap: wrap; gap: 6px; }

  /* Filter bar stacks */
  .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-bar-right { flex-wrap: wrap; }
  .filter-panel-inner { grid-template-columns: 1fr 1fr; }
  .filter-group-wide { grid-column: span 2; }

  /* Tables → cards */
  .data-table, .data-table thead, .data-table tbody,
  .data-table th, .data-table td, .data-table tr { display: block; }
  .data-table thead tr { position: absolute; top: -9999px; left: -9999px; }
  .data-table tr { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; background: var(--surface); }
  .data-table td {
    position: relative;
    padding: 8px 12px 8px 40%;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: normal;
    min-height: 36px;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    top: 8px;
    width: 35%;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Columns that don't need labels */
  .col-score::before, .col-actions::before { content: ''; }
  .col-score { text-align: left; padding-left: 12px; }
  .col-actions { text-align: left; padding-left: 12px; }
  .title-cell { padding-left: 12px; padding-top: 12px; text-align: left; font-weight: 600; font-size: 13px; }
  .title-cell::before { display: none; }

  /* Buttons touch-friendly */
  .btn { min-height: 44px; padding: 10px 16px; font-size: 12px; }
  .btn-sm { min-height: 36px; padding: 7px 12px; font-size: 11px; }
  .btn-full { padding: 14px; }

  /* Slide panel full-width on mobile */
  .slide-panel { width: 100%; left: 0; right: 0; top: auto; bottom: 0; height: 85vh; border-left: none; border-top: 1px solid var(--border); border-radius: 12px 12px 0 0; }

  /* Stats bar wraps */
  .stats-bar { flex-wrap: wrap; gap: 8px; padding: 12px; }
  .stat { padding: 0 10px; }
  .stat-divider { display: none; }
  .stats-row { grid-template-columns: 1fr 1fr; }

  /* Pipeline cards single column */
  .pipeline-grid { grid-template-columns: 1fr; }
  .pipeline-detail-layout { grid-template-columns: 1fr; }
  .pipeline-detail-right { height: 50vh; position: static; }

  /* Detail layout single column */
  .detail-layout { grid-template-columns: 1fr; }
  .detail-meta-grid { grid-template-columns: 1fr 1fr; }
  .builder-layout { grid-template-columns: 1fr; }
  .proposal-layout { grid-template-columns: 1fr; }

  /* Command center grid */
  .cc-grid { grid-template-columns: 1fr; gap: 12px; height: auto; }
  .command-center { height: auto; }
  .feed-list, .proposal-board { max-height: 320px; }

  /* Map → stack layout */
  .map-page { flex-direction: column; height: auto; overflow: visible; }
  .map-sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .map-container { height: 60vw; min-height: 300px; position: relative; }
  #ember-map { height: 100%; }
  body:has(.map-page) .main-content { padding: 0 0 calc(72px + env(safe-area-inset-bottom, 0px)); overflow: auto; }

  /* Map detail panel: full width bottom */
  .map-detail-panel { width: calc(100% - 24px); bottom: 12px; right: 12px; left: 12px; }

  /* Settings full width */
  .settings-layout { max-width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }

  /* Proposals single col */
  .pricing-grid { grid-template-columns: 1fr; }
  .assume-excl-grid { grid-template-columns: 1fr; }
  .editor-notes-grid { grid-template-columns: 1fr; }

  /* Command palette full width */
  .cmd-modal { width: calc(100% - 24px); top: 5%; left: 12px; transform: none; }

  /* Toast bottom-center on mobile — sits above bottom nav */
  .toast-container { left: 12px; right: 12px; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); align-items: center; }

  /* Form rows single column */
  .form-row { grid-template-columns: 1fr; }
  .state-check-grid { grid-template-columns: repeat(4, 1fr); }

  /* Stage tracker: smaller */
  .stage-track-label { font-size: 7px; }
  .stage-track-item { min-width: 52px; }

  /* Source cards single column */
  .source-cards { grid-template-columns: 1fr; }

  /* Analytics rows */
  .model-grid { grid-template-columns: 1fr 1fr; }
}

/* ── PHONE PORTRAIT — 480px ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .main-content { padding: 12px; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

  .page-title { font-size: 12px; }
  .btn { min-height: 46px; padding: 11px 14px; }
  .btn-sm { min-height: 38px; }

  .stats-row { grid-template-columns: 1fr; }
  .stat-card-value { font-size: 22px; }

  .detail-meta-grid { grid-template-columns: 1fr; }

  .filter-controls { flex-direction: column; width: 100%; }
  .filter-select { width: 100%; }

  .state-check-grid { grid-template-columns: repeat(3, 1fr); }

  /* Map sidebar hidden, use toggle button instead */
  .map-sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    cursor: pointer;
    width: 100%;
    justify-content: space-between;
  }
  .map-sidebar.collapsed { max-height: 0; overflow: hidden; border-bottom: none; }

  .pricing-tier { padding: 12px; }
  .tier-price { font-size: 18px; }

  .proposal-kpi-strip { flex-wrap: wrap; }
  .proposal-kpi { min-width: 45%; flex: 1; }

  .model-grid { grid-template-columns: 1fr; }

  /* Margin controls wrap tighter */
  .margin-controls-bar { gap: 8px; }
  .margin-ctrl-input .input { width: 60px; }
  .mcb-divider { display: none; }
}

/* ── PWA: iOS safe area (redundant to bottom-nav calc, kept for older Safari) */
/* Already handled inline with env(safe-area-inset-bottom, 0px) fallbacks above */

/* ── MAP ZONE DRAW UI ─────────────────────────────────────────────────────── */
.zone-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.zone-toolbar-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--text-dim);
  flex: 1;
}
.zone-list { padding: 8px 14px; flex-shrink: 0; max-height: 120px; overflow-y: auto; }
.zone-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.zone-item:last-child { border-bottom: none; }
.zone-color { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.zone-label-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-del { color: var(--text-dim); font-size: 12px; padding: 2px 4px; }
.zone-del:hover { color: var(--red); }
.leaflet-draw-toolbar a { background-color: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-draw-toolbar .leaflet-draw-draw-polygon { background-image: none !important; font-size: 14px; display: flex; align-items: center; justify-content: center; }

/* ── LANDING PAGE ─────────────────────────────────────────────────────────── */
.landing-body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
}
.landing-brand { display: flex; align-items: center; gap: 10px; }
.landing-brand-icon { font-size: 22px; }
.landing-brand-name {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent);
}
.landing-nav-actions { display: flex; align-items: center; gap: 12px; }

.landing-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 60px;
}
.hero-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 700px;
  margin-bottom: 20px;
}
.hero-title span { color: var(--accent); }
.hero-sub {
  font-size: 16px;
  color: var(--text-dim);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 40px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-hero-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn-hero-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color .15s, color .15s;
  text-decoration: none;
}
.btn-hero-secondary:hover { border-color: var(--text-dim); color: var(--text); }

/* Feature grid */
.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.feature-card {
  background: var(--black);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feature-icon { font-size: 24px; }
.feature-title { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.feature-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* Auth forms */
.auth-page {
  min-height: 100vh;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-family: var(--font-body);
}
.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 36px 32px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.auth-logo-name {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--accent);
  display: block;
}
.auth-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--text-dim);
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 24px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.auth-form input {
  padding: 10px 12px;
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .15s;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-submit {
  margin-top: 6px;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  width: 100%;
}
.auth-submit:hover { background: var(--accent-dim); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.oauth-buttons { display: flex; flex-direction: column; gap: 8px; }
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.oauth-btn:hover { border-color: var(--text-dim); background: var(--surface); }
.oauth-icon { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-dim);
}
.auth-footer a { color: var(--accent); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
.auth-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--red);
  margin-bottom: 4px;
}

/* Onboarding */
.onboard-page {
  min-height: 100vh;
  background: var(--black);
  font-family: var(--font-body);
  padding: 40px 24px;
}
.onboard-inner { max-width: 680px; margin: 0 auto; }
.onboard-progress {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 40px;
}
.onboard-step {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  transition: background .3s;
}
.onboard-step.done    { background: var(--accent); }
.onboard-step.current { background: var(--accent); opacity: 0.5; }
.onboard-header { margin-bottom: 32px; }
.onboard-step-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.onboard-title { font-size: 28px; font-weight: 700; line-height: 1.2; margin-bottom: 10px; }
.onboard-sub { font-size: 14px; color: var(--text-dim); line-height: 1.5; }
.onboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 20px;
}
.onboard-form { display: flex; flex-direction: column; gap: 16px; }
.onboard-form label { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.onboard-form input, .onboard-form textarea, .onboard-form select {
  padding: 10px 12px;
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.onboard-form input:focus, .onboard-form textarea:focus, .onboard-form select:focus { border-color: var(--accent); }

/* Pricing tiers on onboarding */
.pricing-tier-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.pricing-tier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  cursor: pointer;
  transition: border-color .15s;
  text-align: center;
  position: relative;
}
.pricing-tier-card:hover { border-color: var(--text-dim); }
.pricing-tier-card.selected { border-color: var(--accent); background: rgba(255,107,53,.06); }
.pricing-tier-card input[type=radio] { display: none; }
.ptc-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  margin-bottom: 12px;
}
.pricing-tier-card.selected .ptc-badge { background: var(--accent); border-color: var(--accent); color: #fff; }
.ptc-price {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.ptc-price sub { font-size: 12px; font-weight: 400; color: var(--text-dim); }
.ptc-name { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: .1em; color: var(--text-dim); margin-bottom: 12px; text-transform: uppercase; }
.ptc-features { list-style: none; text-align: left; }
.ptc-features li { font-size: 12px; color: var(--text-dim); padding: 4px 0; display: flex; gap: 6px; align-items: flex-start; }
.ptc-features li::before { content: '✓'; color: var(--green); font-size: 11px; flex-shrink: 0; margin-top: 1px; }
.ptc-popular {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 10px;
  border-radius: 0 0 4px 4px;
}
.onboard-skip { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); text-decoration: none; }
.onboard-skip:hover { color: var(--text); }
.onboard-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }

@media (max-width: 600px) {
  .landing-nav { padding: 16px 20px; }
  .landing-hero { padding: 50px 20px 40px; }
  .hero-title { font-size: 32px; }
  .landing-features { grid-template-columns: 1fr; }
  .auth-box { padding: 28px 20px; }
  .pricing-tier-cards { grid-template-columns: 1fr; }
  .onboard-page { padding: 24px 16px; }
  .onboard-title { font-size: 22px; }
}

/* ── FILE MANAGEMENT ─────────────────────────────────── */
.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  background: var(--surface);
  transition: border-color .2s, background .2s;
  cursor: pointer;
}
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(255,107,53,.05);
}
.upload-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.upload-icon { font-size: 32px; }
.upload-label { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.upload-browse-btn { position: relative; cursor: pointer; }
.upload-hint { font-size: 11px; color: var(--text-dim); }
.upload-progress { margin-top: 16px; }
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .3s ease; width: 0; }
.progress-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-top: 6px; }

.file-row { transition: background .1s; }
.file-row:hover { background: var(--surface-2); }
.file-name { font-family: var(--font-mono); font-size: 12px; }
.file-analyzed { color: var(--green); font-size: 11px; font-family: var(--font-mono); }
.file-actions { display: flex; gap: 6px; align-items: center; }

.btn-xs {
  padding: 3px 8px;
  font-size: 10px;
  letter-spacing: .04em;
  height: auto;
}
.btn-danger {
  background: transparent;
  border: 1px solid rgba(239,68,68,.4);
  color: var(--red);
}
.btn-danger:hover { background: rgba(239,68,68,.1); }

.ai-summary-card {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
}
.ai-summary-card:first-child { border-top: none; }
.ai-summary-file { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); margin-bottom: 8px; }
.ai-summary-text { font-size: 13px; line-height: 1.6; color: var(--text); margin-bottom: 12px; }
.ai-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--accent);
  margin: 12px 0 6px;
}
.ai-win-themes, .ai-eval-criteria { font-size: 12px; line-height: 1.7; color: var(--text-dim); white-space: pre-wrap; }
.ai-bid-strategy { font-size: 13px; line-height: 1.6; color: var(--text); padding: 12px; background: var(--surface-2); border-left: 3px solid var(--accent); }

@media (max-width: 768px) {
  .upload-zone { padding: 20px 16px; }
  .file-actions { flex-wrap: wrap; }
  .ai-summary-card { padding: 12px 16px; }
}
