/* ============================================================
   Bid & Sales Operations Hub — design tokens + component styles
   Palette/typography per CLAUDESaaS.md. Tailwind handles utilities;
   this file holds the bits Tailwind CDN can't (tokens, base, a few
   composed components used across screens).
   ============================================================ */

:root {
  --navy: #0f3d35;
  --navy-700: #1a4e43;
  --amber: #E8A020;
  --amber-soft: #FBEFD6;
  --success: #2D7A4F;
  --success-soft: #E3F1E8;
  --teal: #0D7F6B;
  --teal-soft: #DFF4F0;
  --danger: #C0392B;
  --danger-soft: #F7E2DF;
  --surface: #F7F8FA;
  --card: #FFFFFF;
  --line: #E2E6EA;
  --ink: #1A1F2E;
  --ink-soft: #6B7280;
  --ink-muted: #9CA3AF;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-dropdown: 0 4px 16px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-modal: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

/* Default inline-icon size; specific contexts override below. */
svg { width: 18px; height: 18px; flex: none; vertical-align: middle; }
body { font-size: 15px; line-height: 1.6; color: var(--ink); }

h1, h2, h3, h4 { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; letter-spacing: -0.02em; margin: 0; }
.font-mono, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Only animate transform & opacity (per guardrails) */
button, a, .row, .nav-item, .card-hover, input, select, textarea {
  transition: transform .15s ease, opacity .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--navy);
  color: #C9D2E3;
  display: flex; flex-direction: column;
  width: var(--sidebar-w);
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: #AEB9CF; font-weight: 500; font-size: 14px;
  text-decoration: none; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--navy-700); color: #fff; box-shadow: inset 3px 0 0 var(--amber); }
.nav-item.active svg { color: var(--amber); }
.nav-item svg { width: 18px; height: 18px; flex: none; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 48px; background: var(--surface);
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
}
.main { min-width: 0; }
.page { max-width: 1200px; margin: 0 auto; padding: 32px 48px 80px; }
@media (max-width: 640px) { .topbar { padding: 14px 20px; } .page { padding: 20px 20px 64px; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-accent { background: var(--amber); color: #3a2a05; }
.btn-accent:hover { filter: brightness(1.04); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #fafbfc; border-color: #cfd5db; }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-card); }
.card-pad { padding: 24px; }
.card-hover:hover { box-shadow: var(--shadow-dropdown); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; letter-spacing: .01em;
  white-space: nowrap; line-height: 1.4; }
.badge svg { width: 13px; height: 13px; }
.badge-dot { width: 6px; height: 6px; border-radius: 999px; }
.badge-grey   { background: #EEF0F3; color: #5B6472; }
.badge-blue   { background: #E5EEFB; color: #2E5AAC; }
.badge-amber  { background: var(--amber-soft); color: #9A6A0B; }
.badge-green  { background: var(--success-soft); color: var(--success); }
.badge-red    { background: var(--danger-soft); color: var(--danger); }
.badge-slate  { background: #E7EAEE; color: #475063; }
.badge-teal   { background: #DFF4F0; color: #0D7F6B; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table thead th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-muted); padding: 0 16px 10px; white-space: nowrap; }
.table thead th.num { text-align: right; }
.table tbody td { padding: 14px 16px; border-top: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table tbody td.num { text-align: right; font-family: 'JetBrains Mono', monospace; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #FBFCFD; }
.row-actions { opacity: 0; }
.table tbody tr:hover .row-actions { opacity: 1; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink); }
.label .req { color: var(--danger); }
.hint { font-size: 12.5px; color: var(--ink-soft); }
.input, .select, .textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%;
}
.input:hover, .select:hover, .textarea:hover { border-color: #cfd5db; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.input.err, .textarea.err { border-color: var(--danger); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.prefilled { background: var(--amber-soft); border-color: #ECC97E; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }
.kpi { font-family: 'JetBrains Mono', monospace; font-weight: 600; letter-spacing: -0.01em; }
.skeleton { background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 37%, #eef1f4 63%); background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.empty { text-align: center; padding: 56px 24px; }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 16px; color: var(--ink-muted);
  background: #fff; border: 1px solid var(--line); border-radius: 14px; display: grid; place-items: center; box-shadow: var(--shadow-card); }
.empty-icon svg { width: 26px; height: 26px; }
.breadcrumb svg { width: 15px; height: 15px; }

/* Toasts */
.toast { display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff;
  padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-modal); font-size: 14px; font-weight: 500;
  animation: toast-in .2s ease; }
.toast.ok svg { color: #6ED39A; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,28,46,0.45); z-index: 50;
  display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-modal); width: 100%; max-width: 520px; animation: pop .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Progress bar (bid score) */
.meter { height: 10px; border-radius: 999px; background: #ECEFF3; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; transition: width .35s ease; }

/* Segmented control (Yes/Partial/No) */
.seg { display: inline-flex; background: #EEF1F4; border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  padding: 6px 14px; border-radius: 7px; cursor: pointer; }
.seg button.on-yes { background: #fff; color: var(--success); box-shadow: var(--shadow-card); }
.seg button.on-partial { background: #fff; color: #9A6A0B; box-shadow: var(--shadow-card); }
.seg button.on-no { background: #fff; color: var(--danger); box-shadow: var(--shadow-card); }

/* Sticky margin-summary panel (bid cost model) */
.cm-sticky { position: sticky; top: 84px; }

/* ---------- Tabs (Opportunity detail: Overview | Change requests) ---------- */
.rfc-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.rfc-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-size: 14px; font-weight: 600;
  color: var(--ink-soft); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.rfc-tab:hover { color: var(--ink); }
.rfc-tab.on { color: var(--navy); border-bottom-color: var(--amber); }
.rfc-tab-count { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; font-weight: 600;
  background: #EEF0F3; color: #5B6472; padding: 1px 7px; border-radius: 999px; }
.rfc-tab.on .rfc-tab-count { background: var(--amber-soft); color: #9A6A0B; }

a { color: inherit; }
.link { color: var(--navy); font-weight: 600; text-decoration: none; }
.link:hover { color: var(--amber); }
.breadcrumb { font-size: 13px; color: var(--ink-soft); display: flex; gap: 8px; align-items: center; }
.breadcrumb a:hover { color: var(--navy); }

/* ---------- Mobile: sidebar becomes a horizontal top nav ----------
   Placed last so it cleanly overrides the base .sidebar rules above. */
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; height: auto; width: 100%;
    flex-direction: row; align-items: center; gap: 6px;
    padding: 8px 12px; overflow-x: auto; z-index: 40;
  }
  .sidebar-brand { margin: 0 4px 0 0 !important; padding: 0 !important; flex: none; }
  .sidebar-brand > div:last-child { display: none; }   /* keep logo, drop wordmark */
  .sidebar nav { flex-direction: row !important; gap: 4px; flex: none; }
  .nav-item { white-space: nowrap; padding: 8px 11px; }
  .nav-item.active { box-shadow: inset 0 -3px 0 var(--amber); }
  .sidebar-user { display: none !important; }
  .topbar { position: static; }
  .topbar { flex-wrap: wrap; }
}
