/* Simcha GovCon Dashboard — design tokens from context/design_handoff_govcon_dashboard/README.md
   Colors are oklch() verbatim from the handoff. Fonts are a system stack that
   prefers Inter / JetBrains Mono when installed locally; no CDN call is made,
   because an internal tool should not phone a third party on every page load. */

:root {
  --bg:            oklch(0.985 0.003 90);
  --surface:       #ffffff;
  --border:        oklch(0.91 0.006 90);
  --text:          oklch(0.22 0.01 90);
  --muted:         oklch(0.5 0.01 90);
  --faint:         oklch(0.6 0.01 90);
  --input-border:  oklch(0.88 0.006 90);
  --link:          oklch(0.4 0.1 250);

  --green-bg: oklch(0.94 0.05 145);
  --green-fg: oklch(0.32 0.1 145);
  --amber-bg: oklch(0.95 0.06 80);
  --amber-fg: oklch(0.4 0.12 80);
  --red-bg:   oklch(0.94 0.06 25);
  --red-fg:   oklch(0.42 0.18 25);
  --gray-bg:  oklch(0.94 0.005 90);
  --gray-fg:  oklch(0.45 0.01 90);
  --new-bg:   oklch(0.4 0.14 250);

  --radius-card:  10px;
  --radius-input: 6px;
  --radius-badge: 5px;
  --shadow-soft:  0 6px 20px oklch(0 0 0 / 0.1);

  --font-ui:   Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono",
               Consolas, "Liberation Mono", monospace;

  --sidebar-width: 220px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--font-mono); }

/* --- Layout -------------------------------------------------------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand-eyebrow {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px;
}
.sidebar .brand-title { font-size: 15px; font-weight: 700; margin-bottom: 28px; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: block; padding: 8px 10px; border-radius: var(--radius-input);
  color: var(--text); font-size: 13.5px; font-weight: 500;
}
.sidebar nav a:hover { background: var(--gray-bg); text-decoration: none; }
.sidebar nav a.active { background: var(--gray-bg); font-weight: 600; }

.sidebar .sidebar-foot { margin-top: auto; font-size: 12px; color: var(--muted); }
.sidebar .sidebar-foot .user { display: block; margin-bottom: 6px; }

.content { flex: 1; padding: 28px 32px; min-width: 0; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-sub { font-size: 12.5px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* --- Cards --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card.tight { padding: 12px 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-title { font-size: 14.5px; font-weight: 700; margin: 0; }
.card-note { font-size: 12.5px; color: var(--muted); }

.stack { display: flex; flex-direction: column; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* --- Buttons and inputs -------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius-input);
  border: 1px solid var(--input-border); background: var(--surface);
  color: var(--text); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--gray-bg); }
.btn-primary {
  background: var(--text); color: #fff; border-color: var(--text);
}
.btn-primary:hover { background: oklch(0.3 0.01 90); }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { color: var(--red-fg); border-color: var(--red-bg); }

input[type=text], input[type=password], input[type=number], input[type=time],
select, textarea {
  font-family: inherit; font-size: 13px; color: var(--text);
  padding: 7px 9px; border: 1px solid var(--input-border);
  border-radius: var(--radius-input); background: var(--surface);
  max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid oklch(0.4 0.1 250 / 0.35); outline-offset: 1px;
}
textarea { font-family: inherit; line-height: 1.5; resize: vertical; }
label { font-size: 12.5px; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 160px; }
.hint { font-size: 11.5px; color: var(--muted); }

/* --- Badges and chips ---------------------------------------------------- */

.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: var(--radius-badge);
  letter-spacing: 0.02em; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-red   { background: var(--red-bg);   color: var(--red-fg); }
.badge-gray  { background: var(--gray-bg);  color: var(--gray-fg); }
.badge-new   { background: var(--new-bg);   color: #fff; }

.chip {
  display: inline-block; font-size: 11px; padding: 2px 7px;
  border-radius: var(--radius-badge); background: var(--gray-bg);
  color: var(--gray-fg); margin: 1px 3px 1px 0; white-space: nowrap;
}
.chip-mono { font-family: var(--font-mono); }
.chip-removable { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; }
.chip-removable button {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  font-size: 12px; padding: 0; line-height: 1;
}
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* --- Banners ------------------------------------------------------------- */

.banner {
  border-radius: var(--radius-input); padding: 9px 12px;
  font-size: 12.5px; font-weight: 500; margin-bottom: 12px;
}
.banner-amber { background: var(--amber-bg); color: var(--amber-fg); }
.banner-red   { background: var(--red-bg);   color: var(--red-fg); }
.banner-gray  { background: var(--gray-bg);  color: var(--gray-fg); }
.banner-green { background: var(--green-bg); color: var(--green-fg); }

/* --- Login / setup ------------------------------------------------------- */

.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 380px; max-width: 100%; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft); padding: 28px;
}
.auth-eyebrow {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px;
}
.auth-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.auth-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.auth-card input[type=password] { width: 100%; }
.auth-card .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }
.auth-foot {
  font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 16px;
}
.auth-error {
  background: var(--red-bg); color: var(--red-fg); font-size: 12.5px;
  padding: 8px 10px; border-radius: var(--radius-input); margin-bottom: 14px;
}

/* --- Filter bar ---------------------------------------------------------- */

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.filter-bar input[type=text] { min-width: 220px; flex: 1 1 220px; }
.filter-bar select { min-width: 130px; }
.filter-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted);
}

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-input); box-shadow: var(--shadow-soft);
  padding: 8px; min-width: 190px; max-height: 340px; overflow-y: auto;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-menu label {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px;
  border-radius: 4px; cursor: pointer; font-weight: 400;
}
.dropdown-menu label:hover { background: var(--gray-bg); }

/* --- Table --------------------------------------------------------------- */

.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); overflow-x: auto;
}
table.opps {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  font-size: 13px;
}
table.opps th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  position: relative; white-space: nowrap; background: var(--surface);
}
table.opps td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top; overflow: hidden; text-overflow: ellipsis;
}
table.opps tr:last-child td { border-bottom: 0; }
table.opps tbody tr:hover { background: oklch(0.985 0.003 90); }

.col-resize {
  position: absolute; top: 0; right: -4px; width: 9px; height: 100%;
  cursor: col-resize; user-select: none;
}
th.dragging { background: var(--gray-bg); }

.cell-title { font-weight: 600; color: var(--text); display: block; }
.cell-title:hover { text-decoration: underline; }
.cell-sub { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.cell-flags { white-space: normal; }
.status-select { width: 100%; font-size: 12px; padding: 4px 6px; }
.status-won  { color: var(--green-fg); font-weight: 600; }
.status-lost { color: var(--red-fg); font-weight: 600; }

.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.row-count { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* --- Detail page --------------------------------------------------------- */

.detail-wrap { max-width: 980px; }
.back-link { font-size: 12.5px; display: inline-block; margin-bottom: 14px; }
.detail-title { font-size: 21px; font-weight: 700; margin: 8px 0 6px; }
.detail-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.detail-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.attachment-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12.5px; }
.attachment-list li { padding: 3px 0; }

.anchor-card {
  border: 1px solid var(--border); border-radius: var(--radius-input);
  padding: 14px 16px; margin-bottom: 12px;
}
.arithmetic {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  background: var(--gray-bg); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-input);
  white-space: pre-wrap; overflow-x: auto; margin: 10px 0;
}
.summary-strip {
  display: flex; gap: 24px; flex-wrap: wrap; align-items: baseline;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.summary-strip .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); display: block;
}
.summary-strip .value { font-size: 18px; font-weight: 700; }
.source-line { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

.candidate-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.candidate-card {
  border: 1px solid var(--border); border-radius: var(--radius-input);
  padding: 14px;
}
.candidate-card .company {
  font-weight: 700; font-size: 13.5px; display: flex; gap: 8px;
  align-items: center; justify-content: space-between;
}
.candidate-card .contact { font-size: 12.5px; margin-top: 8px; }
.contact-missing { color: var(--muted); font-style: italic; }
.draft-email {
  background: var(--gray-bg); border-radius: var(--radius-input);
  padding: 14px; font-size: 12.5px; white-space: pre-wrap;
  font-family: var(--font-ui); line-height: 1.55;
}

details.near-misses { margin-top: 12px; font-size: 12.5px; }
details.near-misses summary { cursor: pointer; font-weight: 600; }
details.near-misses ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }

/* --- Help & Guide -------------------------------------------------------- */

.help-wrap { max-width: 860px; }
.help-search-bar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding: 8px 0 12px; margin-bottom: 6px;
}
.help-search-bar input {
  width: 100%; font-size: 14px; padding: 10px 12px;
}
.help-search-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.help-toc { font-size: 13px; margin: 0 0 18px; padding: 14px 16px; }
.help-toc a { display: inline-block; margin: 2px 10px 2px 0; }
.help-section h2 { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
.help-section h3 { font-size: 14px; font-weight: 700; margin: 16px 0 6px; }
.help-section p, .help-section li { font-size: 13.5px; line-height: 1.6; }
.help-section ul { margin: 6px 0 6px; padding-left: 20px; }
.help-section[hidden] { display: none; }
.help-empty { padding: 30px; text-align: center; color: var(--muted); }
mark { background: oklch(0.9 0.12 95); color: inherit; padding: 0 1px; border-radius: 2px; }
.help-callout {
  border-left: 3px solid var(--red-fg); background: var(--red-bg);
  color: var(--red-fg); padding: 10px 14px; border-radius: var(--radius-input);
  font-size: 13px; margin: 12px 0;
}
.help-tip {
  border-left: 3px solid var(--green-fg); background: var(--green-bg);
  color: var(--green-fg); padding: 10px 14px; border-radius: var(--radius-input);
  font-size: 13px; margin: 12px 0;
}
/* --- Mobile / phones ----------------------------------------------------- */
/* The desktop layout is a fixed 220px sidebar beside the content. On a phone
   that eats half the screen, so below 720px the sidebar becomes a compact top
   bar and everything else relaxes to the narrow width. */
@media (max-width: 720px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--border);
    padding: 12px 16px;
  }
  .sidebar .brand-title { margin-bottom: 12px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar nav a { padding: 8px 12px; font-size: 13.5px; }
  .sidebar .sidebar-foot {
    margin-top: 12px; display: flex; gap: 16px; align-items: center;
  }
  .sidebar .sidebar-foot .user { margin-bottom: 0; }

  .content { padding: 16px 14px; }
  .page-title { font-size: 18px; }

  /* Filters: search full width, dropdowns two-up, all easy to tap. */
  .filter-bar input[type=text] { flex: 1 1 100%; min-width: 0; }
  .filter-bar select { flex: 1 1 calc(50% - 8px); min-width: 0; }

  /* 16px on form controls stops iOS Safari from zooming in on focus. */
  input[type=text], input[type=password], input[type=number], input[type=time],
  select, textarea { font-size: 16px; }

  /* Detail key/value pairs stack instead of squeezing a 190px label column. */
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 10px; }
  .kv dt:first-child { margin-top: 0; }

  /* Wide tables still scroll sideways — make it a smooth momentum scroll. */
  .table-card { -webkit-overflow-scrolling: touch; }
}

@media print {
  .sidebar, .help-search-bar, .page-actions, #toast { display: none !important; }
  .content { padding: 0; }
  .help-section[hidden] { display: block !important; }
  .card { border: none; padding: 0; }
}

/* --- Toast --------------------------------------------------------------- */

#toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  background: var(--text); color: #fff; font-size: 12.5px; font-weight: 500;
  padding: 10px 14px; border-radius: var(--radius-input);
  box-shadow: var(--shadow-soft); opacity: 0; transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
