/*
  Bid App — main.css
  Dark-first theme matching Aerodesk's brand palette. View accent is the
  unused Breeze warm-navy/cream combo so the bid app reads visually
  distinct from Aerodesk's existing views when they later merge.
*/

:root {
  --bg: #060a1b;
  --panel: #0d142f;
  --panel-soft: #111c3c;
  --panel-deep: #0b1330;
  --line: #1a2852;
  --text: #e8f0ff;
  --muted: #8fa4c8;
  --green: #1dd4a1;
  --red: #ff6b7b;
  --amber: #f5b942;
  --field-bg: #0e1736;
  --chip-bg: #0f1a3b;
  --surface-2: #0a1029;

  /* Breeze brand palette */
  --breeze-warm:  #001633;
  --breeze-blue:  #1F74DF;
  --breeze-cool:  #C1DDFF;
  --breeze-pink:  #FF527B;
  --breeze-tan:   #FFD4AA;
  --breeze-cream: #FFF5ED;

  /* Bid App uses tan as its primary view accent so it reads as a
     distinct surface from Aerodesk's blue/pink/tan/cool view system. */
  --view-accent: var(--breeze-tan);
  --view-accent-soft: rgba(255, 212, 170, 0.18);
  --blue: var(--breeze-blue);
}

html[data-theme="light"] {
  --bg: #f4f4f6;
  --panel: #ffffff;
  --panel-soft: #f6f6f9;
  --panel-deep: #ffffff;
  --line: #e6e6ec;
  --text: #1c1c26;
  --muted: #6c6c78;
  --field-bg: #f6f6f9;
  --chip-bg: #f1f1f4;
  --surface-2: #ececef;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}
html[data-theme="dark"] body,
html:not([data-theme]) body {
  background:
    radial-gradient(1200px 800px at 0% 0%, #1a2348 0%, transparent 55%),
    radial-gradient(1000px 800px at 100% 100%, #121f4c 0%, transparent 60%),
    var(--bg);
}

/* ---------- Top nav ---------- */
.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 20, 47, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topnav .brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 14px;
  color: var(--view-accent);
  text-transform: uppercase;
}
.topnav .brand .sub {
  color: var(--muted);
  font-weight: 500;
  margin-left: 8px;
  letter-spacing: 0.02em;
  text-transform: none;
}
.topnav nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s ease;
}
.nav-btn:hover {
  color: var(--text);
  background: var(--chip-bg);
}
.nav-btn.active {
  color: var(--text);
  background: var(--view-accent-soft);
  border-color: var(--view-accent);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
  color: var(--muted);
  font-size: 12px;
  margin-left: 8px;
}
.user-chip select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

/* ---------- Main layout ---------- */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.view-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.view-header .subtitle {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--view-accent);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ---------- Form bits ---------- */
label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
input[type="text"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--field-bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--view-accent);
  box-shadow: 0 0 0 2px var(--view-accent-soft);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

button.primary, button.secondary, button.danger {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
}
button.primary {
  background: var(--view-accent);
  color: var(--breeze-warm);
}
button.primary:hover { filter: brightness(1.1); }
button.secondary {
  background: var(--chip-bg);
  color: var(--text);
  border-color: var(--line);
}
button.secondary:hover { background: var(--panel-soft); }
button.danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
button.danger:hover { background: rgba(255, 107, 123, 0.12); }
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
th {
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Chips & badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  border: 1px solid var(--line);
  letter-spacing: 0.02em;
}
.chip.state-draft   { color: var(--muted); }
.chip.state-posted  { color: var(--breeze-blue); border-color: var(--breeze-blue); }
.chip.state-closed  { color: var(--amber); border-color: var(--amber); }
.chip.state-awarded { color: var(--green); border-color: var(--green); }
.chip.state-active  { color: var(--view-accent); border-color: var(--view-accent); }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--view-accent-soft);
  color: var(--view-accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- Cycle list ---------- */
.cycle-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.cycle-card:hover {
  border-color: var(--view-accent);
  transform: translateY(-1px);
}
.cycle-card .ccard-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cycle-card .ccard-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- Coverage chart ---------- */
.coverage-chart {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.coverage-row { display: contents; }
.coverage-label { color: var(--muted); }
.coverage-bar-track {
  position: relative;
  height: 18px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.coverage-bar-demand {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--view-accent-soft);
}
.coverage-bar-cov {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--green);
  opacity: 0.85;
  mix-blend-mode: screen;
}
.coverage-bar-short {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--red);
  opacity: 0.5;
}
.coverage-cell-num {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text);
  font-weight: 600;
}

/* ---------- Headcount grid ---------- */
.headcount-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.headcount-grid th, .headcount-grid td {
  padding: 6px 8px;
  border: 1px solid var(--line);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.headcount-grid th {
  background: var(--surface-2);
  color: var(--muted);
}
.headcount-grid input {
  width: 50px;
  padding: 4px 6px;
  text-align: center;
}
.headcount-grid td.total {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--view-accent);
}

/* ---------- Bid packet (preference picker) ---------- */
.pref-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.pref-list {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
}
.pref-list h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.pref-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.pref-item:hover {
  border-color: var(--view-accent);
}
.pref-item .rank-badge {
  background: var(--view-accent);
  color: var(--breeze-warm);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  margin-right: 8px;
}
.pref-item button {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

/* ---------- Footer / status ---------- */
.app-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
}

/* ---------- Status panel ---------- */
.status-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.stat-block {
  flex: 1;
  min-width: 140px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.stat-block .stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.stat-block .stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.stat-block .stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--view-accent);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 100;
  transition: opacity 0.25s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: absolute;
  z-index: 200;
  max-width: 280px;
  padding: 9px 12px;
  background: #1a2348;
  border: 1px solid var(--view-accent);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: opacity 0.15s;
}
.tooltip.hidden { opacity: 0; visibility: hidden; }

/* Labels and other items with data-tip get a subtle dotted underline so
   users know they're hoverable. */
[data-tip] {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted var(--muted);
}
label[data-tip], .user-chip[data-tip] {
  border-bottom: none; /* labels don't need the underline; the small "i" markers carry the cue */
}
strong[data-tip] {
  border-bottom: 1px dotted var(--view-accent);
  color: var(--view-accent);
}
.info-mark {
  display: inline-flex;
  width: 14px;
  height: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  cursor: help;
  font-style: normal;
  vertical-align: middle;
}
.info-mark:hover {
  background: var(--view-accent-soft);
  color: var(--view-accent);
  border-color: var(--view-accent);
}

/* ---------- Workflow card (used at top of views) ---------- */
.workflow-card {
  background: linear-gradient(135deg, var(--view-accent-soft), transparent);
  border: 1px solid var(--view-accent);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
}
.workflow-card.compact {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
}
.workflow-card.compact strong { color: var(--view-accent); }
.workflow-card em { font-style: normal; color: var(--view-accent); }
.workflow-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--view-accent);
  margin-bottom: 12px;
}
.workflow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}
.wf-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(13, 20, 47, 0.5);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.wf-num {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--view-accent);
  color: var(--breeze-warm);
  font-size: 12px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wf-step strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}
.wf-sub {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

/* ---------- Inline help text under section headers ---------- */
.card-help {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 14px;
}
.card-help strong {
  color: var(--text);
}

/* ---------- State progress (stepper across the cycle states) ---------- */
.state-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}
.sp-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sp-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sp-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}
.sp-bar {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin: 0 10px;
  min-width: 24px;
}
.sp-step.current .sp-dot {
  background: var(--view-accent);
  border-color: var(--view-accent);
  color: var(--breeze-warm);
}
.sp-step.current .sp-label {
  color: var(--view-accent);
  font-weight: 600;
}
.sp-step.done .sp-dot {
  background: var(--green);
  border-color: var(--green);
  color: var(--breeze-warm);
}
.sp-step.done .sp-label {
  color: var(--text);
}
.sp-step.done ~ .sp-bar,
.sp-step.current ~ .sp-bar { /* not used directly; CSS sibling combinator */ }
.sp-bar.done {
  background: var(--green);
}

/* ---------- Validation messages ---------- */
.validation-msg {
  font-size: 12px;
  color: var(--red);
  margin-top: 8px;
  line-height: 1.5;
}
.validation-msg.success {
  color: var(--green);
}
.validation-msg ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 36px 28px;
  max-width: 640px;
  margin: 12px auto;
}
.empty-state .empty-icon {
  font-size: 38px;
  margin-bottom: 8px;
  filter: grayscale(40%) opacity(0.85);
}
.empty-state h2 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 18px;
  color: var(--text);
}
.empty-state p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 6px 0;
}

/* ---------- Chart legend ---------- */
.chart-legend {
  display: flex;
  gap: 18px;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 12px;
  flex-wrap: wrap;
}
.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}
.legend-dot.demand { background: var(--view-accent-soft); border: 1px solid var(--view-accent); }
.legend-dot.cov    { background: var(--green); }
.legend-dot.short  { background: var(--red); opacity: 0.7; }

/* ---------- Help / Glossary view ---------- */
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.help-step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
}
.help-step-num {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--view-accent-soft);
  color: var(--view-accent);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--view-accent);
}
.help-step strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}
.help-step p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.g-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.g-term {
  font-size: 13px;
  font-weight: 600;
  color: var(--view-accent);
  margin-bottom: 6px;
}
.g-def {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.g-def em { color: var(--text); font-style: italic; }
.g-def strong { color: var(--text); }

.faq details {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}
.faq details[open] {
  border-color: var(--view-accent);
}
.faq summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq summary::after {
  content: "+";
  color: var(--view-accent);
  font-size: 18px;
  font-weight: 600;
  margin-left: 12px;
}
.faq details[open] summary::after {
  content: "−";
}
.faq p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ---------- Hint text ---------- */
.hint-text {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  padding: 12px 4px;
  text-align: center;
}

/* ---------- Award warnings list ---------- */
#awardWarnings {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.55;
}
#awardWarnings.has-warnings {
  padding: 10px 14px;
  background: rgba(245, 185, 66, 0.08);
  border: 1px solid var(--amber);
  border-radius: 6px;
  color: var(--amber);
}

/* ---------- Cycle state badge sizes on cards ---------- */
.cycle-card .chip {
  font-size: 10px;
  text-transform: uppercase;
}
