:root {
  --navy: #14213d;
  --slate: #2b3a55;
  --accent: #2f80ed;
  --accent-d: #1f5fc0;
  --ok: #2e7d4f;
  --warn: #b8531a;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e2e7f0;
  --ink: #1d2533;
  --muted: #6b7585;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 14px rgba(20, 33, 61, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px;
  background: var(--navy); color: #fff;
  padding: 8px 22px; min-height: 58px;
}
.topbar__brand a { color: #fff; font-weight: 700; font-size: 18px; }
.topbar__brand a span { color: var(--accent); }
.topbar__org { margin-left: 10px; font-size: 12px; color: #aeb9d0; }
.topbar__nav { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; }
.topbar__nav a { color: #cdd6ea; padding: 8px 12px; border-radius: 7px; font-weight: 500; }
.topbar__nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.topbar__nav a.is-active { background: var(--accent); color: #fff; }
.topbar__user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar__user label { font-size: 12px; color: #aeb9d0; margin-right: 4px; }
.topbar__user select { padding: 6px 8px; border-radius: 7px; border: 0; font-size: 13px; }
.impersonate { display: flex; align-items: center; }
.topbar__who { font-size: 13px; color: #e8eef7; }
.topbar__who strong { color: #fff; }
.topbar__link { color: #cdd6ea; font-size: 13px; }
.topbar__link:hover { color: #fff; }

/* Login page */
.login-body { background: var(--navy); height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 14px; padding: 34px 32px; width: 360px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.login-brand { font-size: 24px; font-weight: 800; color: var(--navy); }
.login-brand span { color: var(--accent); }
.login-sub { color: var(--muted); margin: 2px 0 20px; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .field span { font-size: 13px; font-weight: 600; color: var(--slate); }
.login-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

.content { max-width: 1120px; margin: 0 auto; padding: 26px 22px 60px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.back { font-size: 13px; color: var(--muted); display: inline-block; margin-bottom: 4px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow);
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card__num { font-size: 30px; font-weight: 700; color: var(--navy); }
.card__label { font-size: 12px; color: var(--muted); }

/* Panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel__head h2 { margin: 0; }

.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 820px) { .detail { grid-template-columns: 1fr; } }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #f7f9fe; }
.table .num { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--slate); }

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge--lg { padding: 6px 14px; font-size: 13px; }
.badge--open { background: #e7f0ff; color: var(--accent-d); }
.badge--ok { background: #e3f3e9; color: var(--ok); }
.badge--warn { background: #fceae0; color: var(--warn); }
.badge--muted { background: #eceef2; color: var(--muted); }

/* Buttons */
.btn { display: inline-block; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn--ghost { background: transparent; }
.btn--small { padding: 6px 11px; font-size: 13px; }

/* Filters */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* Forms */
.form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.form__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 720px) { .form__grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--slate); }
.field--wide { margin-top: 16px; }
.field input, .field select, .field textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.form__group { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 18px; }
.form__group legend { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: right; }

.inline-form { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.inline-form label { font-size: 13px; color: var(--slate); font-weight: 600; }
.inline-form input, .inline-form select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }
.charge-form { border-top: 1px solid var(--line); padding-top: 14px; }
.check { display: flex; align-items: center; gap: 5px; font-weight: 500; }

/* KV + checklist */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }
.notes { margin-top: 14px; padding: 12px; background: #f7f9fe; border-radius: 8px; font-size: 14px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 130px 1fr 100px; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.checklist__section { color: var(--muted); font-size: 12px; }
.checklist__value { color: var(--slate); text-align: right; }

/* Approval stepper */
.stepper { list-style: none; display: flex; gap: 0; margin: 0 0 16px; padding: 0; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 14px; left: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.step__dot { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 2px solid var(--line); color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; position: relative; z-index: 1; }
.step__label { font-size: 12px; color: var(--muted); text-align: center; }
.step--done .step__dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step--done:not(:last-child)::after { background: var(--ok); }
.step--current .step__dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step--current .step__label { color: var(--accent-d); font-weight: 700; }

.actions-row { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.panel--accent { border-color: var(--accent); background: #f4f8ff; }

/* Flash messages */
.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 11px 14px; border-radius: 8px; font-size: 14px; border: 1px solid; }
.flash--error { background: #fdecea; border-color: #f3c9c2; color: #9a3326; }
.flash--warn { background: #fceae0; border-color: #f3d4c2; color: var(--warn); }
.flash--ok { background: #e3f3e9; border-color: #c2e6cf; color: var(--ok); }
.flash--info { background: #e7f0ff; border-color: #cfe0ff; color: var(--accent-d); }

.chips { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; }

/* Assignment chips (heterogeneous: user / vendor / label) */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 10px; border-radius: 16px; font-size: 13px; margin: 0 5px 5px 0; background: #eef2f6; border: 1px solid var(--line); }
.chip--user { background: #e7f0ff; border-color: #cfe0ff; }
.chip--vendor { background: #fceae0; border-color: #f3d4c2; }
.chip--label { background: #e9f6ee; border-color: #cfead9; }
.chip__kind { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chip form { display: inline; margin: 0; }
.chip__x { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); padding: 0 2px; }
.chip__x:hover { color: var(--warn); }
.assign-form select, .assign-form input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }

/* Photo gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.shot { margin: 0; }
.shot img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: #eef2f6; }
.shot figcaption { font-size: 12px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 6px; }

.pay-select { padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.pay-select--owed { background: #fceae0; color: var(--warn); }
.pay-select--paid { background: #e3f3e9; color: var(--ok); }
.pay-select--waived { background: #eceef2; color: var(--muted); }

.total { font-size: 14px; color: var(--muted); }
.count, .empty, .hint { color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; gap: 10px; }
.pager__nav { display: flex; align-items: center; gap: 10px; }
.pager__pos { font-size: 13px; color: var(--muted); }
.empty { padding: 20px; text-align: center; background: #f7f9fe; border-radius: 8px; }
.muted { color: var(--muted); font-weight: 400; }

/* ── Price-book + shared utility bits ───────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eceef2; color: var(--muted); }
.pill--ok { background: #e3f3e9; color: var(--ok); }
.row--muted td { opacity: .55; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ── Mobile responsiveness (inspectors work on phones) ──────────── */
.nav-burger { display: none; margin-left: auto; font-size: 22px; line-height: 1; color: #fff; cursor: pointer; padding: 6px 10px; border-radius: 7px; }
.nav-burger:hover { background: rgba(255,255,255,.1); }

@media (max-width: 880px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px; }
  .nav-burger { display: block; }
  /* Collapse nav + user menu behind the hamburger. */
  .topbar__nav, .topbar__user {
    display: none; flex-basis: 100%; flex-direction: column; align-items: stretch;
    margin-left: 0; gap: 2px;
  }
  .nav-toggle:checked ~ .topbar__nav,
  .nav-toggle:checked ~ .topbar__user { display: flex; }
  .topbar__nav a, .topbar__link { padding: 11px 12px; border-radius: 7px; }
  .topbar__user { margin-top: 4px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 8px; }
  .impersonate { width: 100%; }
  .topbar__user select { width: 100%; }

  /* Content + layout reflow */
  .content { padding: 18px 14px 50px; }
  .page-head { flex-wrap: wrap; }
  .detail { grid-template-columns: 1fr; }
  .form__grid { grid-template-columns: 1fr; }

  /* Touch-friendly tap targets (≥44px) */
  .btn { min-height: 40px; padding: 9px 14px; }
  .btn--small { min-height: 36px; }
  input, select, textarea { font-size: 16px; } /* avoids iOS zoom-on-focus */

  /* Inline forms (charges, filters) stack on narrow screens */
  .inline-form, .filters { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select, .filters input, .filters select { width: 100% !important; }
}

/* ── Make-Ready Board (kanban) ──────────────────────────────────── */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 26px; }
.board__col { background: #f7f9fe; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.board__head { font-weight: 700; font-size: 13px; color: var(--slate); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.board__count { background: #e3e8f3; color: var(--muted); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.board__card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); }
.board__card:hover { text-decoration: none; border-color: var(--accent); }
.board__card-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.board__card-prop { font-size: 13px; color: var(--slate); margin-top: 3px; }
.board__card-assign { font-size: 12px; color: var(--muted); margin-top: 3px; }
.board__empty { color: var(--muted); text-align: center; font-size: 13px; padding: 8px 0; }
@media (max-width: 880px) { .board { grid-template-columns: 1fr; } }

.pill--warn { background: #fde8e3; color: var(--warn, #c0392b); }

/* ── On-Call Calendar ───────────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cal__day { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; min-height: 70px; }
.cal__day--today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal__date { font-size: 12px; font-weight: 700; color: var(--slate); margin-bottom: 6px; }
.cal__entry { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; padding: 4px 0; border-top: 1px solid #f0f2f7; }
.cal__empty { color: var(--muted); font-size: 13px; }
@media (max-width: 880px) { .cal { grid-template-columns: 1fr; } }

/* ── Notifications ──────────────────────────────────────────────── */
.topbar__bell { position: relative; font-size: 16px; }
.bell__badge { position: absolute; top: -6px; right: -8px; background: var(--warn, #c0392b); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 5px; min-width: 16px; text-align: center; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.notif--unread { background: #f3f7ff; }
.notif__title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notif__dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); display: inline-block; }
.notif__text { font-size: 13px; color: var(--slate); margin-top: 3px; }
.notif__meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
