/* South Town Painting — STP Dashboard. Brand palette copied from the field app:
   Deep Navy #2D3282 (text/brush) · Teal #00AEEF (stripe) · Purple #7B2D8B (stripe).
   Desktop-first office app: wide scrollable data grid, but the phone hamburger stays. */
:root {
  --navy: #2d3282;
  --navy-dark: #232866;
  --teal: #00aeef;
  --purple: #7b2d8b;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1e2340;
  --muted: #5f6689;
  --line: #dde1ec;
  --danger: #b3261e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Brand stripe accent along the very top, echoing the logo pinstripes */
.topbar { border-top: 4px solid var(--purple); position: relative; }
.topbar::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0;
  border-top: 4px solid var(--teal);
  transform: translateY(4px);
  pointer-events: none;
}

.topbar {
  background: #fff;
  border-bottom: 2px solid var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.topbar nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: var(--navy); text-decoration: none; font-weight: 600; }
.topbar nav a:hover { color: var(--teal); }
.topbar .who { color: var(--muted); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 20px; color: var(--navy); padding: 4px 12px; cursor: pointer; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .topbar nav { display: none; }
  .topbar.nav-open nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-basis: 100%;
    gap: 0;
    border-top: 1px solid var(--line);
    margin-top: 8px;
    padding-top: 4px;
  }
  .topbar.nav-open nav a, .topbar.nav-open nav .who { padding: 12px 4px; border-bottom: 1px solid #f0f2f8; }
  .topbar.nav-open nav .inline { padding: 12px 4px; }
}

/* Desktop-first: the office runs this on 1080p+ monitors, so the shell is wide.
   .wrap-narrow keeps reading pages (detail, admin) comfortable. */
.wrap { max-width: 1800px; margin: 0 auto; padding: 20px 20px 60px; }
.wrap-narrow { max-width: 1080px; }

h1 { font-size: 24px; margin-bottom: 16px; color: var(--navy); }
h2 { font-size: 17px; color: var(--navy); }

.auth-card {
  max-width: 420px;
  margin: 7vh auto 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--navy);
  border-radius: 12px;
  padding: 28px 24px;
}
.auth-logo { display: block; width: 100%; max-width: 320px; margin: 0 auto 6px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 18px; }
.auth-help { margin-top: 16px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--teal); border-color: var(--teal); }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }

.btn {
  display: inline-block;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: #eef1f8; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-small { padding: 5px 9px; font-size: 13px; }
.btn-danger { color: var(--danger); border-color: #e3b8b5; }
.btn-ms { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.linklike { background: none; border: none; color: var(--navy); cursor: pointer; font-size: 15px; font-weight: 600; font-family: inherit; }
.linklike:hover { color: var(--teal); }
.inline { display: inline; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c3; }
.alert-ok { background: #e6f7fd; color: #045f82; border: 1px solid #b3e7fa; }
.alert-warn { background: #fff6e5; color: #8a5300; border: 1px solid #f3ddb2; }
.alert-temp { background: #f5ecf7; color: #4d1d57; border: 1px solid #dfc0e5; }
.alert-temp code { font-size: 16px; background: #fff; padding: 2px 6px; border-radius: 4px; }

/* Mirror-mode banner: the app is a read-only reflection until Drew flips the switch. */
.mode-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #eef0f9; border: 1px solid var(--line); border-left: 4px solid var(--purple);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 16px; font-size: 13px; color: var(--muted);
}
.mode-bar strong { color: var(--navy); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { margin-bottom: 0; }
.page-sub { color: var(--muted); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; text-decoration: none; color: var(--text); display: block;
}
.card:hover { border-color: var(--teal); }
.card-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.card-value { font-size: 28px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.card-note { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.panel h2 { margin-bottom: 12px; }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
th { background: #eef0f9; color: var(--navy); font-weight: 600; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-inactive { opacity: 0.55; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
code { background: #eef0f9; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); }
.empty { padding: 22px; color: var(--muted); text-align: center; }

/* ---- the wide project grid: sticky header row + sticky project-number column ---- */
.grid-scroll {
  overflow: auto;
  max-height: calc(100vh - 300px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.grid { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.grid th, .grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #eef0f6;
  padding: 7px 10px;
  white-space: nowrap;
  background: #fff;
}
.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: #eef0f9; color: var(--navy); font-weight: 600;
  box-shadow: 0 1px 0 var(--line);
}
.grid .col-key {
  position: sticky; left: 0; z-index: 1;
  font-weight: 700;
  box-shadow: 2px 0 0 var(--line);
}
.grid thead .col-key { z-index: 3; }
.grid .col-key a { color: var(--navy); text-decoration: none; }
.grid .col-key a:hover { color: var(--teal); text-decoration: underline; }
.grid tbody tr:hover td { background: #f7f9fe; }
.grid tbody tr:hover .col-key { background: #f7f9fe; }
.grid .cell-wide { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.grid-count { color: var(--muted); font-size: 13px; margin: 10px 2px; }

/* ---- status chips ---- */
.chip {
  display: inline-block; border-radius: 999px; padding: 2px 10px;
  font-size: 12px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
.chip-active { background: #e2f6e6; color: #1b5e20; }
.chip-not-started { background: #e6eaff; color: var(--navy); }
.chip-closeout { background: #fff3e0; color: #8a5300; }
.chip-on-hold { background: #eceef4; color: #4a5068; }
.chip-archive { background: #f2f3f7; color: #9aa0b8; }
.chip-other { background: #f5ecf7; color: #4d1d57; }
.chip-missing { background: #fdecea; color: var(--danger); }

/* ---- preset tabs + filter form ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--navy); text-decoration: none; font-size: 14px; font-weight: 600;
}
.tab:hover { border-color: var(--teal); }
.tab-on { background: var(--navy); border-color: var(--navy); color: #fff; }

.filters {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 14px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; align-items: end;
}
.filters label { margin-bottom: 10px; }
.filters .filter-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.filters select[multiple] { height: 96px; }
.check-row { display: flex; align-items: center; gap: 6px; font-weight: 400; font-size: 13px; }
.check-row input { width: auto; margin: 0; }

/* ---- detail page ---- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.field-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f3f9; font-size: 14px; }
.field-row:last-child { border-bottom: none; }
.field-label { flex: 0 0 46%; color: var(--muted); }
.field-value { flex: 1; word-break: break-word; white-space: pre-wrap; }
.field-empty { color: #b7bcd0; }
