/* Aspetto Tactical Capture — UI styles
   Bootstrap 5 gives us layout primitives; this file adds the Aspetto polish. */

:root {
  --aspetto-navy: #0e1a2b;
  --aspetto-navy-2: #15273f;
  --aspetto-accent: #c8a25b;       /* warm brass — sales / federal contractor feel */
  --aspetto-accent-soft: #f0e3c8;
  --aspetto-bg: #f6f7f9;
  --aspetto-card: #ffffff;
  --aspetto-border: #e3e7ee;
  --aspetto-text: #1c2a3a;
  --aspetto-muted: #6b7588;
  --aspetto-success: #1f8a55;
  --aspetto-warning: #b6791f;
  --aspetto-danger: #b03a3a;
}

html, body {
  height: 100%;
}

body {
  background: var(--aspetto-bg);
  color: var(--aspetto-text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Crisp, slightly tightened headings */
h1, h2, h3, h4, .app-page-title { letter-spacing: -0.018em; }

/* Polished keyboard focus everywhere */
a:focus-visible, button:focus-visible, .btn:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--aspetto-accent);
  outline-offset: 2px;
  border-radius: 7px;
}

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.app-sidebar {
  background: var(--aspetto-navy);
  color: #d8dee8;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.app-brand-mark {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 5px;
  flex-shrink: 0;
}
.app-brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.app-brand-name { font-weight: 700; color: #fff; }
.app-brand-sub { font-size: 12px; color: #9ba8bf; letter-spacing: .04em; text-transform: uppercase; }

.app-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.nav-item {
  color: #cfd7e5;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 7px;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
  line-height: 1.2;
}
.nav-item i { font-size: 15px; opacity: .9; width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active {
  background: var(--aspetto-navy-2);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--aspetto-accent);
}
.nav-divider {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #7280a0;
  margin: 16px 12px 6px;
}

/* Collapsible nav group (Setup & sources) */
.nav-group { border: 0; }
.nav-group > summary.nav-group-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.nav-group > summary.nav-group-summary::-webkit-details-marker { display: none; }
.nav-group-caret { font-size: 10px; opacity: .6; transition: transform .15s ease; }
.nav-group[open] .nav-group-caret { transform: rotate(180deg); }

.app-sidebar-footer {
  margin-top: auto;
  display: flex; align-items: center; gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.badge-env {
  background: var(--aspetto-accent-soft);
  color: var(--aspetto-navy);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 11px;
}
.app-sidebar-footer .text-muted { color: #8b97ae !important; }

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

.app-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 32px 14px;
  background: transparent;
}
.app-page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--aspetto-text);
}
.app-page-subtitle {
  margin: 4px 0 0;
  color: var(--aspetto-muted);
  font-size: 13.5px;
}
.app-topbar-actions { display: flex; gap: 8px; }

.app-flash {
  margin: 0 32px 8px;
  border-radius: 8px;
}

.app-content {
  padding: 8px 32px 32px;
  flex: 1;
}

.app-footer {
  padding: 18px 32px 28px;
  color: var(--aspetto-muted);
  font-size: 12px;
  display: flex; gap: 10px;
}

/* ---------- Cards ---------- */
.card-soft {
  background: var(--aspetto-card);
  border: 1px solid var(--aspetto-border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(20,30,50,.04), 0 6px 18px rgba(20,30,50,.03);
}
.card-soft + .card-soft { margin-top: 14px; }

.stat-card { display: flex; flex-direction: column; gap: 4px; }
.stat-card .stat-label {
  font-size: 12px;
  color: var(--aspetto-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--aspetto-text);
  line-height: 1.1;
}
.stat-card .stat-hint {
  font-size: 12.5px;
  color: var(--aspetto-muted);
}
.stat-card.is-action { border-left: 3px solid var(--aspetto-accent); }

/* ---------- Buttons ---------- */
.btn-aspetto {
  background: var(--aspetto-navy);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 1px 2px rgba(14,26,43,.18);
  transition: background .15s ease, box-shadow .15s ease, transform .04s ease;
}
.btn-aspetto:hover { background: var(--aspetto-navy-2); color: #fff; box-shadow: 0 3px 10px rgba(14,26,43,.22); }
.btn-aspetto:active { transform: translateY(1px); }

.btn-outline-aspetto {
  background: #fff;
  color: var(--aspetto-navy);
  border: 1px solid var(--aspetto-border);
  border-radius: 9px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13.5px;
  transition: background .15s ease, border-color .15s ease;
}
.btn-outline-aspetto:hover { background: var(--aspetto-bg); border-color: #cdd5e2; }

/* ---------- Tables ---------- */
.table-soft {
  width: 100%;
  background: #fff;
  border: 1px solid var(--aspetto-border);
  border-radius: 12px;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
}
.table-soft th, .table-soft td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--aspetto-border);
  font-size: 13.5px;
}
.table-soft tr:last-child td { border-bottom: none; }
.table-soft th {
  background: #fafbfd;
  color: var(--aspetto-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: 11.5px;
}
.table-soft tr:hover td { background: #fbfcfe; }

/* ---------- Status pills ---------- */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #eef1f6;
  color: #45526a;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pill-new           { background: #e9eef7; color: #2e477a; }
.pill-quote         { background: #def4e4; color: #1f6c3c; }
.pill-rfi           { background: #fff1d6; color: #8a5a0c; }
.pill-proposal      { background: #e7e3fa; color: #4938a8; }
.pill-supplier      { background: #ffe2e2; color: #99312f; }
.pill-review        { background: #ffeac2; color: #7a4d0a; }
.pill-skipped       { background: #ecedf0; color: #5c6473; }
.pill-archived      { background: #e6e8ec; color: #4a5260; }
.pill-analyzed      { background: #def4e4; color: #1f6c3c; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--aspetto-muted);
}
.empty-state i { font-size: 36px; color: #c5cdda; }
.empty-state h3 {
  font-size: 16px;
  color: var(--aspetto-text);
  margin: 12px 0 4px;
}
.empty-state p { font-size: 14px; margin-bottom: 18px; }

/* ---------- Forms ---------- */
.form-section { margin-bottom: 18px; }
.form-label   { font-weight: 600; color: var(--aspetto-text); font-size: 13.5px; }
.form-hint    { font-size: 12.5px; color: var(--aspetto-muted); margin-top: 4px; }
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--aspetto-border);
  font-size: 14px;
  padding: 9px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--aspetto-accent);
  box-shadow: 0 0 0 3px rgba(200,162,91,.18);
}

/* ---------- Cost-meter widget (top bar) ---------- */
.cost-widget {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  border: 1px solid var(--aspetto-border);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: var(--aspetto-text);
  font-size: 13px;
  line-height: 1.1;
  white-space: nowrap;
}
.cost-widget:hover { background: var(--aspetto-bg); color: var(--aspetto-text); }
.cost-widget-row  { display: flex; flex-direction: column; align-items: flex-start; }
.cost-widget-label { font-size: 10.5px; color: var(--aspetto-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.cost-widget-value { font-weight: 700; font-size: 13.5px; }
.cost-widget-divider { width: 1px; height: 22px; background: var(--aspetto-border); }
.cost-widget-warn { color: var(--aspetto-warning); margin-left: 4px; }

/* ---------- Supplier-gap accordion cards ---------- */
.gap-card { padding: 0 !important; overflow: hidden; }
.gap-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  user-select: none;
}
.gap-summary::-webkit-details-marker { display: none; }
.gap-summary:hover { background: var(--aspetto-bg); }
.gap-card[open] .gap-summary { border-bottom: 1px solid var(--aspetto-border); }
.gap-body { padding: 14px 18px 18px; }
.gap-card .chevron { transition: transform .15s ease; }
.gap-card[open] .chevron { transform: rotate(180deg); }
.min-w-0 { min-width: 0; }

/* ---------- API-keys provider cards ---------- */
.provider-card { transition: box-shadow .25s ease, transform .25s ease; }
.provider-focus {
  box-shadow: 0 0 0 3px rgba(200,162,91,.35);
}

/* ---------- Wizard stepper ---------- */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.wizard-step { display: flex; align-items: center; gap: 8px; }
.wizard-step-bubble {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--aspetto-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--aspetto-muted);
  font-weight: 700; font-size: 12.5px;
  background: #fff;
}
.wizard-step.is-active .wizard-step-bubble {
  background: var(--aspetto-navy);
  color: #fff;
  border-color: var(--aspetto-navy);
}
.wizard-step.is-done .wizard-step-bubble {
  background: var(--aspetto-success);
  border-color: var(--aspetto-success);
  color: #fff;
}
.wizard-step-label {
  font-size: 13px;
  color: var(--aspetto-muted);
  font-weight: 600;
}
.wizard-step.is-active .wizard-step-label,
.wizard-step.is-done .wizard-step-label {
  color: var(--aspetto-text);
}
.wizard-step-bar {
  flex: 0 1 60px;
  height: 2px;
  background: var(--aspetto-border);
}

/* ---------- Pagination ---------- */
.pager {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--aspetto-muted);
}
.pager a, .pager span.current {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--aspetto-border);
  text-decoration: none;
  color: var(--aspetto-text);
  background: #fff;
}
.pager a:hover { background: var(--aspetto-bg); }
.pager span.current { background: var(--aspetto-navy); color: #fff; border-color: var(--aspetto-navy); }
.pager span.disabled { color: #b9c1cf; padding: 5px 10px; }

/* ---------- Search bar ---------- */
.search-bar {
  display: flex; gap: 8px;
  margin-bottom: 14px;
}
.search-bar input[type="search"] {
  flex: 1;
  max-width: 480px;
}

/* ---------- Grid helpers ---------- */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: relative; height: auto; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- Home: "Needs you now" work queue ---------- */
.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.queue-row:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(14,26,43,.12); }
.queue-row .queue-num {
  font-size: 1.9rem; font-weight: 700; line-height: 1;
  color: var(--aspetto-navy); min-width: 1.6ch; text-align: center;
}
.queue-row .queue-label { color: var(--aspetto-text); font-weight: 600; flex: 1; }
.queue-row .queue-arrow { color: var(--aspetto-muted); opacity: .5; }
.queue-row.is-empty { opacity: .55; }
.queue-row.is-empty .queue-num { color: var(--aspetto-muted); }

/* ---------- Home: source freshness rows ---------- */
.source-status { display: flex; flex-direction: column; }
.source-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center; gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--aspetto-border);
  font-size: .9rem;
}
.source-row:last-child { border-bottom: 0; }
.source-row .ss-label { font-weight: 600; }
.source-row .ss-when { font-size: .85rem; }
.source-row .ss-new { font-size: .82rem; color: var(--aspetto-muted); white-space: nowrap; text-align: right; }

/* ---------- Lightweight modal (no Bootstrap JS needed) ---------- */
.amodal-backdrop {
  position: fixed; inset: 0; z-index: 1050;
  background: rgba(14,26,43,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.amodal {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 460px;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.amodal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.btn-close-x {
  border: 0; background: transparent; font-size: 1.5rem; line-height: 1;
  color: var(--aspetto-muted); cursor: pointer; padding: 0 4px;
}
.ck-sources { border: 1px solid var(--aspetto-border); border-radius: 10px; overflow: hidden; }
.ck-src {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; font-size: .9rem;
  border-bottom: 1px solid var(--aspetto-border);
}
.ck-src:last-child { border-bottom: 0; }

/* spinner for the .spin icon */
.bi.spin { display: inline-block; animation: aspin 1s linear infinite; }
@keyframes aspin { to { transform: rotate(360deg); } }

/* Global "checking sources" pill in the top bar */
.bg-check-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--aspetto-navy); color: #fff;
  font-size: .82rem; font-weight: 600; text-decoration: none;
  white-space: nowrap;
}
.bg-check-pill:hover { color: #fff; opacity: .92; }
.bg-check-pill.done { background: var(--aspetto-success); }
.bg-check-pill.done .spinner-border { display: none; }

/* ---------- Guided wizard stepper (eBuy) ---------- */
.wiz-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.wiz-step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: #eef1f6; color: var(--aspetto-muted);
  font-size: .88rem; font-weight: 600;
}
.wiz-step .wiz-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: #cdd5e2; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem;
}
.wiz-step.active { background: var(--aspetto-navy); color: #fff; }
.wiz-step.active .wiz-dot { background: var(--aspetto-accent); }
.wiz-step.done { background: #e3f1e8; color: var(--aspetto-success); }
.wiz-step.done .wiz-dot { background: var(--aspetto-success); }
.wiz-action {
  border-left: 5px solid var(--aspetto-accent);
  background: linear-gradient(180deg, #fff, #fcfaf4);
}
.wiz-action .wiz-big { font-size: 1.4rem; font-weight: 700; color: var(--aspetto-navy); }

/* ---------- Native dropdown menu (no Bootstrap JS) ---------- */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--aspetto-border); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(14,26,43,.16);
  min-width: 260px; z-index: 60; padding: 6px;
}
.menu-panel form { margin: 0; }
.menu-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  text-align: left; padding: 10px 12px; border-radius: 9px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--aspetto-text); text-decoration: none; font-size: .9rem; font-weight: 600;
}
.menu-item i { margin-top: 2px; color: var(--aspetto-muted); }
.menu-item:hover { background: #f1f4f8; }
.menu-item .mi-sub { display: block; font-size: .75rem; font-weight: 400; color: var(--aspetto-muted); }
.menu-item.danger, .menu-item.danger i { color: var(--aspetto-danger); }
.menu-divider { height: 1px; background: var(--aspetto-border); margin: 6px 4px; }
