:root {
  --bg: #141316;
  --panel: #1e1c22;
  --panel-2: #232128;
  --ink: #eae8e5;
  --dim: #9b98a1;
  --line: #322f38;
  --gold: #d9a62e;
  --gold-soft: rgba(217, 166, 46, 0.12);
  --gold-ink: #171512;
  --ok: #4ade80;
  --ok-bg: rgba(34, 197, 94, 0.14);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.13);
  --bad: #f87171;
  --bad-bg: rgba(248, 113, 113, 0.13);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.13);
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- top bar ---- */
.topbar { background: #191720; border-bottom: 2px solid var(--gold); }
.topbar-inner { display: flex; align-items: center; gap: 28px; padding: 13px 20px; flex-wrap: wrap; }
.brand { color: var(--gold); font-weight: 700; font-size: 16.5px; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { color: #b7b4bd; padding: 6px 13px; border-radius: 6px; }
.nav a:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, 0.07); }
.nav a.active { color: var(--gold); background: var(--gold-soft); }
.userbox { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 14px; color: #b7b4bd; }
.userbox a { color: var(--gold); }

main.wrap { padding-top: 26px; padding-bottom: 60px; }

h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 14px; color: var(--gold); font-weight: 600; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--dim); }
.head-actions { display: flex; gap: 8px; align-items: center; }

/* ---- panels & cards ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: block; color: var(--ink);
}
.card:hover { text-decoration: none; border-color: var(--gold); }
.card .num { font-size: 30px; font-weight: 700; }
.card .lbl { color: var(--dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.table-roomy th, .table-roomy td { padding: 13px 16px; }
td.nowrap { white-space: nowrap; }
td.strong { font-weight: 600; }
td.dim, .dim { color: var(--dim); }
.table-actions { white-space: nowrap; text-align: right; }
.empty { color: var(--dim); padding: 18px 12px; text-align: center; }

/* ---- forms ---- */
label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 5px; color: #c9c6cd; text-transform: uppercase; letter-spacing: .04em; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; background: #17151b; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 22px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.divider { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---- buttons ---- */
.btn {
  display: inline-block; padding: 9px 17px; border-radius: 6px; border: 1px solid transparent;
  background: var(--gold); color: var(--gold-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(248, 113, 113, 0.5); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-row { margin-top: 18px; display: flex; gap: 10px; align-items: center; }
form.inline { display: inline; }

/* ---- flash ---- */
.flash { padding: 11px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(34, 197, 94, 0.3); }
.flash-err { background: var(--bad-bg); color: var(--bad); border-color: rgba(248, 113, 113, 0.3); }
.flash-warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }

/* ---- status badges (color set per status on the Statuses page) ---- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge-c-blue   { background: var(--info-bg); color: var(--info); }
.badge-c-amber  { background: var(--warn-bg); color: var(--warn); }
.badge-c-green  { background: var(--ok-bg); color: var(--ok); }
.badge-c-red    { background: var(--bad-bg); color: var(--bad); }
.badge-c-purple { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.badge-c-gray   { background: rgba(156, 163, 175, 0.15); color: #9ca3af; }
/* legacy aliases */
.badge-in_process { background: var(--info-bg); color: var(--info); }
.badge-in_review { background: var(--warn-bg); color: var(--warn); }
.badge-want { background: var(--ok-bg); color: var(--ok); }
.badge-dont_want { background: var(--bad-bg); color: var(--bad); }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-not_active { background: var(--bad-bg); color: var(--bad); }
select.badge { padding-right: 22px; }

/* ---- dashboard quick search ---- */
.search-panel { padding: 16px 22px; }
.search-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-form input[type=text] { flex: 1; min-width: 240px; font-size: 15.5px; padding: 10px 14px; }
.search-hint { margin: 12px 0 10px; font-size: 13.5px; }
.search-panel table { margin-top: 4px; }

/* ---- activity log ---- */
.log-action { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(156,163,175,.15); color: #b9b6bf; }
.log-create { background: var(--ok-bg); color: var(--ok); }
.log-update { background: var(--info-bg); color: var(--info); }
.log-delete { background: var(--bad-bg); color: var(--bad); }
.log-login, .log-unlock_private, .log-lock_private { background: var(--warn-bg); color: var(--warn); }

/* ---- filters ---- */
.filters { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.filters label { margin: 0 0 5px; }
.filters .field { min-width: 180px; }

/* ---- login ---- */
.login-box { max-width: 400px; margin: 60px auto; }
.login-box .panel { padding: 30px; border-top: 2px solid var(--gold); }
.login-box h1 { text-align: center; margin-bottom: 18px; }
.login-box .btn { width: 100%; padding: 11px; }

/* ---- agency detail: compact info grid ---- */
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px; }
.info-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.info-item.wide { grid-column: 1 / -1; }
.info-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); font-weight: 600; }
.info-value { white-space: pre-line; overflow-wrap: anywhere; }
@media (max-width: 600px) { .info-grid { grid-template-columns: 1fr; } }

/* ---- private data ---- */
.private-heading { display: flex; align-items: center; gap: 8px; }
.lock-icon { font-size: 15px; }
.masked { color: var(--dim); letter-spacing: 2px; }
.rate-cell { font-variant-numeric: tabular-nums; }
.unlock-panel { padding: 14px 20px; }
.unlock-toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 500; margin: 0; cursor: pointer; }
.unlock-toggle input { width: 16px; height: 16px; accent-color: var(--gold); }
.unlock-form { display: flex; gap: 10px; align-items: end; margin-top: 14px; flex-wrap: wrap; }
.unlock-form input { max-width: 280px; }
.unlock-pass-label { margin: 0 0 5px; }
.private-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---- legacy meta list (kept for compatibility) ---- */
.meta { display: grid; grid-template-columns: 200px 1fr; gap: 6px 18px; margin: 0; }
.meta dt { color: var(--dim); font-size: 13.5px; }
.meta dd { margin: 0; white-space: pre-line; }

.footer { color: var(--dim); font-size: 12.5px; padding-bottom: 30px; }

/* ---- v1.4 workflow additions ---- */
.field-help { margin-top: 5px; color: var(--dim); font-size: 12.5px; line-height: 1.4; }
.field-help-warn { color: var(--warn); }
.subtext { font-size: 12.5px; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; }
.check-row input { width: 16px; height: 16px; accent-color: var(--gold); }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check-card {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2);
  color: var(--ink); text-transform: none; letter-spacing: 0; cursor: pointer;
}
.check-card:hover { border-color: var(--gold); }
.check-card input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--gold); flex: 0 0 auto; }
.check-card span { display: flex; flex-direction: column; gap: 3px; }
.check-card strong { font-size: 14px; }
.check-card small { color: var(--dim); font-size: 12px; line-height: 1.4; }
.radio-row { display: flex; gap: 18px; align-items: center; min-height: 39px; }
.radio-row label { display: inline-flex; align-items: center; gap: 7px; margin: 0; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: 14px; font-weight: 500; }
.radio-row input { accent-color: var(--gold); }
.inline-alert { margin-top: 18px; padding: 12px 15px; border-radius: 7px; font-size: 14px; border: 1px solid transparent; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: rgba(96, 165, 250, 0.3); }
@media (max-width: 820px) { .choice-grid { grid-template-columns: 1fr; } }

/* ---- condensed Temps table ---- */
.table-compact th, .table-compact td { padding: 8px 10px; }
.table-compact td { vertical-align: middle; }
.temps-table { min-width: 900px; }
.temp-cell { min-width: 190px; }
.temp-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.temp-name-line .strong { display: inline-block; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-xs { max-width: 135px; padding: 2px 7px; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.agency-line { max-width: 205px; margin-top: 2px; color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.received-status-cell { min-width: 135px; }
.date-line { margin-bottom: 4px; white-space: nowrap; }
.status-select { min-width: 118px; max-width: 145px; margin: 0; padding-right: 24px; font-size: 12px; }
.pm-cell { min-width: 140px; }
.primary-line { max-width: 175px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-cell { min-width: 150px; }
.rates-cell { min-width: 92px; font-variant-numeric: tabular-nums; }
.rate-line { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; line-height: 1.45; }
.rate-line > span:first-child { min-width: 27px; color: var(--dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.outcome-cell { min-width: 215px; }
.outcome-row { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
.outcome-row .badge { white-space: nowrap; }
.outcome-row .btn { white-space: nowrap; flex: none; }
.reason-line { max-width: 240px; margin-top: 3px; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- condensed Project Managers table ---- */
.managers-table { min-width: 720px; }
.manager-cell { min-width: 175px; }
.contact-cell { min-width: 165px; }
.contact-cell .agency-line a { color: var(--dim); }
.status-cell { min-width: 125px; }
.assign-cell { min-width: 92px; }
.managers-table .table-actions { white-space: nowrap; }

@media (max-width: 760px) {
  .temps-table { min-width: 820px; }
  .managers-table { min-width: 640px; }
  .table-compact th, .table-compact td { padding: 7px 8px; }
}

/* ---- v1.7.0: white calendar picker icon on date inputs (dark theme) ---- */
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .85; cursor: pointer; }

/* ---- v1.7.0: HR reports ---- */
.report-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.report-tab { padding: 8px 16px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 14px;
  background: rgba(156, 163, 175, 0.12); color: var(--dim); }
.report-tab.active { background: var(--gold); color: var(--gold-ink); }
.report-panel { padding: 16px 22px; }
.report-meta { margin: 0 0 12px; color: var(--dim); font-size: 13.5px; }
.report-table th a { color: inherit; text-decoration: none; white-space: nowrap; }
.report-table th a:hover { text-decoration: underline; }
.details-cell { min-width: 220px; max-width: 420px; white-space: normal; line-height: 1.45; }
.filter-actions { display: flex; gap: 8px; align-items: end; }

@media print {
  .topbar, .no-print, .filters, .report-tabs, .page-head .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { border: none; box-shadow: none; padding: 0; }
  .report-table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .report-table th, .report-table td { border: 1px solid #999; padding: 5px 7px; color: #000; }
  .report-table a { color: #000; text-decoration: none; }
  .badge { background: none !important; color: #000 !important; border: 1px solid #666; }
  .page-head h1 { color: #000; }
  .report-meta { color: #333; }
}
.req-star { color: var(--bad); }

/* ---- v1.8.0: left sidebar layout ---- */
.topbar-inner { max-width: none; padding: 13px 22px; }
.shell { display: flex; align-items: flex-start; }
.sidebar {
  flex: 0 0 208px; position: sticky; top: 0; align-self: flex-start;
  min-height: calc(100vh - 54px); padding: 18px 12px;
  background: #191720; border-right: 1px solid var(--line);
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-group {
  margin: 14px 10px 5px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--dim);
}
.side-group:first-child { margin-top: 0; }
.side-nav a {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: #b7b4bd; font-size: 14.5px;
}
.side-nav a:hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, 0.07); }
.side-nav a.active { color: var(--gold); background: var(--gold-soft); font-weight: 600; }
main.content { flex: 1 1 auto; min-width: 0; max-width: none; }
.footer { max-width: none; padding-left: 240px; }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { flex: none; width: 100%; min-height: 0; position: static; border-right: none; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side-group { margin: 4px 8px 4px 4px; }
  .footer { padding-left: 20px; }
}

/* ---- v1.8.0: import wizard + verification badge ---- */
.import-steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.import-step { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(156,163,175,.12); color: var(--dim); }
.import-step.active { background: var(--gold); color: var(--gold-ink); }
.import-err { color: var(--bad); font-size: 12.5px; line-height: 1.45; }
.import-warn { color: var(--warn); font-size: 12.5px; }
.import-ok { color: var(--ok); font-size: 12.5px; font-weight: 600; }
.paste-csv { width: 100%; min-height: 140px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.badge-verify { background: var(--info-bg); color: var(--info); }

@media print {
  .sidebar { display: none !important; }
  main.content { max-width: none; }
}
