/* ─── Variables ──────────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --bg2: #0f1522;
  --panel: #121a2b;
  --panel2: #0f1627;
  --text: #e7ecf5;
  --muted: #aab5cc;
  --faint: #7f8aa3;
  --border: rgba(255, 255, 255, .08);
  --shadow: 0 12px 30px rgba(0, 0, 0, .35);
  --shadow2: 0 8px 18px rgba(0, 0, 0, .25);
  --primary: #7aa2ff;
  --danger: #ff5a7a;
  --warn: #ffcc66;
  --ok: #4be3a3;
  --purple: #bb86fc;
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg2: #edf0f8;
  --panel: #ffffff;
  --panel2: #fafbff;
  --text: #111826;
  --muted: #4d5b75;
  --faint: #6b7892;
  --border: rgba(10, 20, 40, .10);
  --shadow: 0 12px 30px rgba(10, 20, 40, .08);
  --shadow2: 0 8px 18px rgba(10, 20, 40, .06);
  --primary: #355dff;
  --danger: #d93b57;
  --warn: #b57800;
  --ok: #0aa66a;
  --purple: #7c3aed;
}

/* ─── Reset ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 800px at 15% 0%, rgba(122, 162, 255, .15), transparent 60%),
    radial-gradient(1200px 800px at 100% 0%, rgba(75, 227, 163, .08), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  background-attachment: fixed;
  color: var(--text);
  /* iOS safe area */
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ─── Touch optimization ─────────────────────────────────── */
button,
a,
label,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ─── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
}

/* ─── Focus ──────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(122, 162, 255, .6);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ─── Skip link ──────────────────────────────────────────── */
.skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip:focus {
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 12px;
  outline: 2px solid var(--primary);
  z-index: 9999;
}

/* ─── Layout ─────────────────────────────────────────────── */
.app {
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow2);
  position: sticky;
  top: 0;
  height: 100dvh;
  height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  padding-top: max(12px, var(--safe-top));
  flex-shrink: 0;
  overflow-y: auto;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ─── Brand ──────────────────────────────────────────────── */
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
  flex-shrink: 0;
}

.brandMark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(122, 162, 255, .10);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.brandName {
  font-weight: 800;
  letter-spacing: .2px;
  font-size: 14px;
}

.brandSub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

/* ─── Nav ────────────────────────────────────────────────── */
.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.navItem {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  min-height: 44px;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}

.navItem .ico {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.navItem svg {
  width: 18px;
  height: 18px;
}

.navItem:hover {
  background: rgba(122, 162, 255, .08);
  border-color: rgba(122, 162, 255, .18);
  color: var(--text);
}

.navItem:active {
  transform: translateY(1px);
}

.navItem[aria-current="page"] {
  background: rgba(122, 162, 255, .14);
  border-color: rgba(122, 162, 255, .28);
  color: var(--primary);
  font-weight: 600;
}

/* RBAC */
body[data-role="field"] .admin-nav {
  display: none;
}

.sidebarFooter {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  color: var(--faint);
  font-size: 11px;
  text-align: center;
  flex-shrink: 0;
  margin-bottom: var(--safe-bottom);
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, var(--safe-top));
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 22, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, .84);
}

.searchWrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  transition: border-color .15s, box-shadow .15s;
}

.searchWrap:focus-within {
  border-color: rgba(122, 162, 255, .45);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, .10);
}

.searchIco {
  width: 16px;
  height: 16px;
  opacity: .7;
  flex-shrink: 0;
}

.search {
  flex: 1;
  border: none;
  outline: none;
  min-width: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.search::placeholder {
  color: var(--faint);
}

.topActions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ─── Offline Indicator ──────────────────────────────────── */
.offlineIndicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
  transition: background .3s, box-shadow .3s;
}

.offlineIndicator--online {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(75, 227, 163, .2);
}

.offlineIndicator--offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 90, 122, .25);
  animation: offlinePulse 2s ease-in-out infinite;
}

@keyframes offlinePulse {

  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(255, 90, 122, .25);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(255, 90, 122, .1);
  }
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  transition: background .12s, border-color .12s, transform .06s;
  white-space: nowrap;
  min-height: 40px;
}

.btn:hover {
  background: rgba(122, 162, 255, .08);
  border-color: rgba(122, 162, 255, .25);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.primary {
  background: rgba(122, 162, 255, .18);
  border-color: rgba(122, 162, 255, .38);
  color: var(--primary);
}

.btn.primary:hover {
  background: rgba(122, 162, 255, .26);
  border-color: rgba(122, 162, 255, .5);
}

.btn.danger {
  background: rgba(255, 90, 122, .12);
  border-color: rgba(255, 90, 122, .30);
  color: var(--danger);
}

.btn.danger:hover {
  background: rgba(255, 90, 122, .20);
  border-color: rgba(255, 90, 122, .48);
}

.btn.ok {
  background: rgba(75, 227, 163, .12);
  border-color: rgba(75, 227, 163, .30);
  color: var(--ok);
}

.btnIco svg {
  width: 16px;
  height: 16px;
}

.iconBtn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, border-color .12s, transform .06s;
  font-family: inherit;
}

.iconBtn svg {
  width: 18px;
  height: 18px;
}

.iconBtn:hover {
  background: rgba(122, 162, 255, .08);
  border-color: rgba(122, 162, 255, .22);
}

.iconBtn:active {
  transform: translateY(1px);
}

.iconBtn.ghost {
  width: 32px;
  height: 32px;
  border-color: transparent;
  background: transparent;
  border-radius: 10px;
  opacity: .75;
}

.iconBtn.ghost:hover {
  background: rgba(255, 255, 255, .07);
  border-color: var(--border);
  opacity: 1;
}

/* RBAC */
body[data-role="field"] .admin-only {
  display: none !important;
}

/* ─── Content ────────────────────────────────────────────── */
.content {
  padding: 18px;
  flex: 1;
  padding-bottom: max(18px, var(--safe-bottom));
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .03);
  box-shadow: var(--shadow2);
  overflow: hidden;
}

[data-theme="light"] .card {
  background: var(--panel);
}

.cardHeader {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cardTitle {
  font-weight: 700;
  font-size: 14px;
}

.cardSub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.cardBody {
  padding: 16px;
}

/* ─── KPIs ───────────────────────────────────────────────── */
.kpiGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpiVal {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.5px;
  line-height: 1;
}

.kpiValSm {
  font-size: 18px !important;
  letter-spacing: -.3px;
}

.kpiLbl {
  color: var(--muted);
  font-size: 11px;
}

/* ─── Page structure ─────────────────────────────────────── */
.pageHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.pageTitle {
  font-size: 18px;
  font-weight: 800;
}

/* ─── Alert Banner ───────────────────────────────────────── */
.alertBanner {
  background: rgba(255, 90, 122, .10);
  border: 1px solid rgba(255, 90, 122, .28);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ─── Follow-up CRM Banner ───────────────────────────────── */
.followUpBanner {
  background: rgba(122, 162, 255, .09);
  border: 1px solid rgba(122, 162, 255, .30);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.followUpBannerTitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.followUpList { display: flex; flex-direction: column; gap: 8px; }

.followUpRow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 7px 10px;
  background: var(--panel2);
  border-radius: 8px;
  font-size: 13px;
}

.followUpClient { flex: 1; min-width: 140px; }

.followUpVal { color: var(--ok); font-weight: 600; min-width: 70px; text-align: right; }

.followUpCall {
  padding: 4px 12px !important;
  font-size: 12px !important;
  background: var(--ok) !important;
  color: #000 !important;
  border: none !important;
  text-decoration: none;
}

/* ─── Filter bar ─────────────────────────────────────────── */
.filterBar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  align-items: center;
}

.filterPill {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  min-height: 34px;
  transition: all .12s;
}

.filterPill:hover {
  border-color: rgba(122, 162, 255, .3);
  color: var(--text);
}

.filterPill.active {
  background: rgba(122, 162, 255, .14);
  border-color: rgba(122, 162, 255, .35);
  color: var(--primary);
}

/* Date range filter */
.dateFilterWrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.dateFilterIn {
  width: 140px;
  padding: 5px 10px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
  min-height: 34px;
}

/* ─── Table ──────────────────────────────────────────────── */
.tableWrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

.table th,
.table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table th {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, .04);
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  z-index: 1;
  white-space: nowrap;
}

[data-theme="light"] .table th {
  background: rgba(10, 20, 40, .03);
}

.table tbody tr {
  transition: background .1s;
}

.table tbody tr:hover td {
  background: rgba(122, 162, 255, .05);
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--text);
}

.sort-inactive {
  opacity: .3;
  font-size: .8em;
}

.deadlineCell {
  font-size: 13px;
}

.deadlineCell.overdue {
  color: var(--danger);
  font-weight: 600;
}

/* ─── Job rows (dashboard) ───────────────────────────────── */
.jobRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.jobRow:last-child {
  border-bottom: none;
}

.jobRow:hover {
  background: rgba(122, 162, 255, .05);
}

.jobRowMain {
  flex: 1;
  min-width: 0;
}

.jobRowClient {
  color: var(--muted);
}

.jobRowDeadline {
  font-size: 11px;
  color: var(--faint);
  margin-left: 8px;
}

.jobRowDeadline.overdue {
  color: var(--danger);
  font-weight: 600;
}

.jobRowMeta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.badge.ok {
  background: rgba(75, 227, 163, .12);
  border-color: rgba(75, 227, 163, .28);
  color: var(--ok);
}

.badge.warn {
  background: rgba(255, 204, 102, .12);
  border-color: rgba(255, 204, 102, .28);
  color: var(--warn);
}

.badge.bad {
  background: rgba(255, 90, 122, .12);
  border-color: rgba(255, 90, 122, .28);
  color: var(--danger);
}

.badge.status-draft {
  background: rgba(170, 181, 204, .08);
  border-color: rgba(170, 181, 204, .22);
  color: var(--muted);
}

.badge.status-active {
  background: rgba(122, 162, 255, .12);
  border-color: rgba(122, 162, 255, .28);
  color: var(--primary);
}

.badge.status-completed {
  background: rgba(75, 227, 163, .12);
  border-color: rgba(75, 227, 163, .28);
  color: var(--ok);
}

.badge.status-invoiced {
  background: rgba(187, 134, 252, .12);
  border-color: rgba(187, 134, 252, .28);
  color: var(--purple);
}

/* ─── Forms ──────────────────────────────────────────────── */
.fieldGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}

.help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  outline: none;
  font-size: 14px;
  /* 16px minimum prevents iOS zoom */
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}

/* Hardcoded colors required — CSS variables don't work in native OS dropdown popups */
option {
  background-color: #121a2b !important;
  color: #e7ecf5 !important;
}

select {
  color-scheme: dark;
}

[data-theme="light"] select {
  color-scheme: light;
}

[data-theme="light"] option {
  background-color: #ffffff !important;
  color: #111826 !important;
}

/* On mobile prevent iOS auto-zoom (font-size < 16px triggers zoom) */
@media (max-width: 768px) {

  .input,
  select,
  textarea {
    font-size: 16px;
  }
}

[data-theme="light"] .input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--panel);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.input:focus,
select:focus,
textarea:focus {
  border-color: rgba(122, 162, 255, .5);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, .10);
}

.input.invalid,
select.invalid,
textarea.invalid {
  border-color: rgba(255, 90, 122, .6);
  box-shadow: 0 0 0 3px rgba(255, 90, 122, .10);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(.5);
  cursor: pointer;
}

[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0);
}

/* Select arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237f8aa3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ─── Info value (read-only display) ─────────────────────── */
.infoVal {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  font-size: 13px;
}

.infoVal.bigVal {
  font-size: 18px;
  font-weight: 800;
  border: none;
  background: none;
  padding: 2px 0;
}

.infoVal.deadlineWarn {
  color: var(--danger);
}

.notesBox {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ─── Add cost grid ──────────────────────────────────────── */
.addCostGrid {
  display: grid;
  grid-template-columns: 2fr 1fr 80px 130px auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 16px;
}

.addCostBtn {
  display: flex;
  align-items: flex-end;
}

/* ─── Summary rows ───────────────────────────────────────── */
.summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summaryRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
}

.summaryRow.total {
  background: rgba(122, 162, 255, .08);
  border-color: rgba(122, 162, 255, .22);
}

.summaryRow .k {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  white-space: nowrap;
  min-height: 40px;
  transition: color .15s, border-color .15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── History block ──────────────────────────────────────── */
.historyBlock {
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.historyTitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.historyList {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.historyRow {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ─── Misc helpers ───────────────────────────────────────── */
.hr {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row.space {
  justify-content: space-between;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

.cardList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty {
  padding: 32px 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, .02);
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.loading {
  padding: 20px 16px;
  color: var(--muted);
  text-align: center;
}

/* ─── Spinner ────────────────────────────────────────────── */
.loadingPage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 260px;
  color: var(--muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Overlay & Modal ────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 50;
}

.modalRoot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.modalOverlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .52);
  pointer-events: auto;
}

.modal {
  pointer-events: auto;
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--panel) 0%, var(--panel2) 100%);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.modalSm {
  width: min(500px, calc(100vw - 24px));
}

.modalHd {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: linear-gradient(160deg, var(--panel) 0%, var(--panel2) 100%);
  z-index: 2;
}

.modalHd h2 {
  font-size: 16px;
  font-weight: 800;
}

.modalHd p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.modalBd {
  padding: 16px;
}

.modalFt {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: linear-gradient(160deg, var(--panel) 0%, var(--panel2) 100%);
  padding-bottom: max(12px, var(--safe-bottom));
}

.closeX {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  transition: background .12s, border-color .12s;
  font-family: inherit;
}

.closeX:hover {
  background: rgba(255, 90, 122, .10);
  border-color: rgba(255, 90, 122, .28);
}

.closeX svg {
  width: 16px;
  height: 16px;
}

/* ─── Toasts ─────────────────────────────────────────────── */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toasts {
  position: fixed;
  right: max(14px, var(--safe-right));
  bottom: max(14px, var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}

.toast {
  width: min(380px, calc(100vw - 28px));
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--panel), var(--panel2));
  border-radius: 14px;
  box-shadow: var(--shadow2);
  padding: 12px;
  display: flex;
  gap: 10px;
  animation: toastIn .18s ease forwards;
  transition: opacity .18s ease, transform .18s ease;
}

.toast .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.toast .tMain {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toast .tTitle {
  font-weight: 700;
  font-size: 13px;
}

.toast .tMsg {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.toast .tX {
  margin-left: auto;
  align-self: flex-start;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}

.toast .tX svg {
  width: 14px;
  height: 14px;
}

.toast.success .dot {
  background: var(--ok);
}

.toast.error .dot {
  background: var(--danger);
}

.toast.warn .dot {
  background: var(--warn);
}

.toast.info .dot {
  background: var(--primary);
}

/* ─── Field App ──────────────────────────────────────────── */
.fieldLayout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fieldAppWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 36px 20px;
  text-align: center;
}

.clockBtn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: none;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .30);
  transition: transform .12s, box-shadow .12s;
  background: linear-gradient(135deg, var(--primary), #3a6bff);
  font-family: inherit;
  touch-action: manipulation;
}

.clockBtn:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .35);
}

.clockBtn:active {
  transform: scale(.96);
}

.clockBtn.clocked-in {
  background: linear-gradient(135deg, var(--danger), #e0203a);
}

.timerDisplay {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

#liveTimer {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  line-height: 1;
  font-family: ui-monospace, "Courier New", monospace;
}

.timerLabel {
  font-size: 12px;
  color: var(--muted);
}

.geoData {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  max-width: 360px;
  line-height: 1.7;
}

.weatherLine {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0;
}

/* ─── Photos ─────────────────────────────────────────────── */
.photosHeader {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.photoAddBtn {
  cursor: pointer;
}

.photoGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.photoThumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1;
  background: rgba(255, 255, 255, .03);
}

.photoThumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
  transition: transform .2s;
}

.photoThumb:hover img {
  transform: scale(1.04);
}

.photoDelBtn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
  opacity: 0;
  transition: opacity .15s;
}

.photoTypeRow {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s;
}

.photoThumb:hover .photoTypeRow,
.photoThumb:hover .photoDelBtn {
  opacity: 1;
}

.photoTypeBtn {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .4);
  background: rgba(0, 0, 0, .6);
  color: rgba(255, 255, 255, .8);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.photoTypeBtn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.photoThumb:hover .photoDelBtn {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
}

.lightboxBg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .88);
}

.lightboxImg {
  position: relative;
  z-index: 1;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 80px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.lightboxClose {
  position: absolute;
  top: max(16px, var(--safe-top));
  right: max(16px, var(--safe-right));
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
}

/* Lightbox annotation */
.lightboxImgWrap {
  position: relative;
  z-index: 1;
  display: inline-flex;
  line-height: 0;
}

.lightboxImgWrap .lightboxImg {
  position: static;
  display: block;
}

.annotateCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  z-index: 2;
  border-radius: 12px;
}

.lightboxToolbar {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

/* ─── Analytics ──────────────────────────────────────────── */
.biGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.chartWrap {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow2);
  min-width: 0;
}

[data-theme="light"] .chartWrap {
  background: var(--panel);
}

.chartWrap h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ─── Misc ───────────────────────────────────────────────── */
.noscript {
  position: fixed;
  inset: 14px;
  border-radius: 18px;
  padding: 20px;
  background: rgba(0, 0, 0, .85);
  color: #fff;
  z-index: 99999;
  text-align: center;
}

code.kbd {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

/* ─── Mobile-only toggle ─────────────────────────────────── */
.mobileOnly {
  display: none;
}

/* ─── Responsive: Tablet ─────────────────────────────────── */
@media (max-width: 900px) {
  .mobileOnly {
    display: grid;
  }

  .desktopOnly {
    display: none !important;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100dvh;
    height: -webkit-fill-available;
    z-index: 70;
    transition: left .22s ease;
    width: 270px;
    padding-top: max(12px, var(--safe-top));
    padding-bottom: max(12px, var(--safe-bottom));
    padding-left: max(12px, var(--safe-left));
  }

  .sidebar.open {
    left: 0;
    box-shadow: var(--shadow);
  }

  .content {
    padding: 12px;
    padding-bottom: max(12px, var(--safe-bottom));
  }

  .kpiGrid {
    grid-template-columns: repeat(2, 1fr);
  }

  .biGrid {
    grid-template-columns: 1fr;
  }

  .biGrid .chartWrap[style*="grid-column"] {
    grid-column: 1;
  }

  .addCostGrid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .addCostGrid .field:first-child {
    grid-column: 1 / -1;
  }

  .addCostBtn {
    grid-column: 1 / -1;
  }
}

/* ─── Responsive: iPhone / Small ────────────────────────── */
@media (max-width: 600px) {
  .topActions .btn span:not(.btnIco) {
    display: none;
  }

  .kpiGrid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .fieldGrid {
    grid-template-columns: 1fr;
  }

  .modalRoot {
    align-items: flex-end;
  }

  .modal {
    width: 100vw;
    max-height: calc(100dvh - env(safe-area-inset-top, 20px) - 10px);
    border-radius: 22px 22px 0 0;
    border-bottom: none;
  }

  .modalFt {
    padding-bottom: max(16px, var(--safe-bottom));
    justify-content: stretch;
  }

  .modalFt .btn {
    flex: 1;
    justify-content: center;
  }

  .clockBtn {
    width: 140px;
    height: 140px;
    font-size: 18px;
  }

  #liveTimer {
    font-size: 28px;
  }

  .dateFilterWrap {
    margin-left: 0;
    width: 100%;
  }

  .dateFilterIn {
    flex: 1;
    width: auto;
  }

  .photoGrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .photoDelBtn {
    opacity: 1;
  }

  /* always visible on touch */

  .tabs {
    gap: 0;
  }

  .tab {
    padding: 9px 12px;
    font-size: 12px;
  }

  .pageTitle {
    font-size: 16px;
  }
}

/* ─── Responsive: Narrow tables ─────────────────────────── */
@media (max-width: 480px) {
  .tableWrap {
    border-radius: 14px;
  }

  .table th,
  .table td {
    padding: 9px 10px;
    font-size: 12px;
  }

  .kpiVal {
    font-size: 22px;
  }

  .kpiValSm {
    font-size: 15px !important;
  }
}

/* ─── Tags ───────────────────────────────────────────────── */
.tagPill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  background: rgba(122, 162, 255, .15);
  color: var(--primary);
  font-size: 11px;
  font-weight: 500;
  margin: 1px 2px;
  border: 1px solid rgba(122, 162, 255, .25);
}

.tagsList {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0;
}

/* ─── Tag filter bar ─────────────────────────────────────── */
.tagFilterBar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 8px;
}

.tagFilterPill {
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.tagFilterPill:hover {
  background: var(--panel2);
  color: var(--text);
}

.tagFilterPill.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

/* ─── Payment badges ─────────────────────────────────────── */
.badge.payment-unpaid {
  background: rgba(255, 90, 122, .15);
  color: var(--danger);
}

.badge.payment-partial {
  background: rgba(255, 204, 102, .15);
  color: var(--warn);
}

.badge.payment-paid {
  background: rgba(75, 227, 163, .15);
  color: var(--ok);
}

/* ─── Markup hint ────────────────────────────────────────── */
.markupHint {
  font-size: 12px;
  font-weight: 500;
  margin-left: 6px;
}

/* ─── Section label ──────────────────────────────────────── */
.sectionLabel {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
  padding-top: 4px;
}

/* ─── Inline cost editing row ────────────────────────────── */
.editingRow td {
  background: rgba(122, 162, 255, .06);
}

.editingRow .input {
  padding: 4px 8px;
  font-size: 12px;
}

/* ─── Client list link ───────────────────────────────────── */
a.link {
  color: var(--primary);
  text-decoration: none;
}

a.link:hover {
  text-decoration: underline;
}

/* ─── Weather line ───────────────────────────────────────── */
.geoData {
  line-height: 1.7;
}

.weatherLine {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
}

/* ─── Hurricane banner ───────────────────────────────────── */
.hurricaneBanner {
  background: linear-gradient(90deg, rgba(255, 140, 0, .18), rgba(255, 90, 50, .18));
  border: 1px solid rgba(255, 140, 0, .45);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--warn);
  margin-bottom: 14px;
}

/* ─── Heat alert ─────────────────────────────────────────── */
.heatAlert {
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
}

.heatAlert.caution {
  background: rgba(255, 230, 100, .18);
  color: #c8a000;
}

.heatAlert.extreme-caution {
  background: rgba(255, 170, 0, .2);
  color: #d07800;
}

.heatAlert.danger {
  background: rgba(255, 80, 60, .18);
  color: var(--danger);
}

.heatAlert.extreme-danger {
  background: rgba(200, 0, 0, .2);
  color: #ff3333;
}

/* ─── Kanban board ───────────────────────────────────────── */
.kanbanBoard {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kanbanCol {
  flex: 0 0 230px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.kanbanColHd {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanbanCount {
  background: rgba(255, 255, 255, .15);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
}

.kanbanTotal {
  margin-left: auto;
  font-size: 11px;
  opacity: .8;
}

.kanbanCards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanbanCard {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color .15s;
}

.kanbanCard:hover {
  border-color: var(--primary);
}

/* Low margin alert */
.low-margin {
  border-left: 3px solid var(--danger) !important;
}

.lowMarginBadge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--danger);
  background: rgba(255, 80, 100, .12);
  border: 1px solid rgba(255, 80, 100, .3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
  cursor: default;
}

.jobRow.low-margin {
  border-left: 3px solid var(--danger);
  padding-left: 9px;
}

.kanbanCardTitle {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.kanbanCardMeta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

.kanbanCardVal {
  font-size: 12px;
  font-weight: 700;
  color: var(--ok);
  margin-top: 6px;
}

.kanbanMoveBtn {
  margin-top: 8px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s;
}

.kanbanMoveBtn:hover {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

/* ─── Spec grid ──────────────────────────────────────────── */
.specGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 8px 0;
}

.specRow {
  display: contents;
}

.specLbl {
  font-size: 11px;
  color: var(--muted);
  align-self: center;
}

.specVal {
  font-size: 13px;
  font-weight: 600;
}

.codeBadge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.codeBadge.pass {
  background: rgba(75, 227, 163, .18);
  color: var(--ok);
}

.codeBadge.fail {
  background: rgba(255, 90, 122, .18);
  color: var(--danger);
}

/* ─── Checklist ──────────────────────────────────────────── */
.checklistSection {
  margin: 12px 0;
}

.checklistTitle {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}

.checkItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background .12s;
}

.checkItem:hover {
  background: var(--panel2);
}

.checkItem input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.checkItem label {
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

/* ─── Signature canvas ───────────────────────────────────── */
.sigWrap {
  margin: 12px 0;
}

.sigCanvas {
  display: block;
  width: 100%;
  max-width: 480px;
  height: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  cursor: crosshair;
  touch-action: none;
}

.sigActions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* Map pin link in time logs */
.mapPinLink {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  color: var(--primary);
  opacity: 0.75;
  transition: opacity .15s;
}

.mapPinLink:hover {
  opacity: 1;
}

/* ─── Inventory badges ───────────────────────────────────── */
.invBadge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.invBadge.instock {
  background: rgba(75, 227, 163, .15);
  color: var(--ok);
}

.invBadge.low {
  background: rgba(255, 204, 102, .18);
  color: var(--warn);
}

.invBadge.out {
  background: rgba(255, 90, 122, .15);
  color: var(--danger);
}

/* ─── Estimate status badges ─────────────────────────────── */
.badge.est-draft {
  background: rgba(120, 120, 140, .18);
  color: var(--muted);
}

.badge.est-sent {
  background: rgba(122, 162, 255, .18);
  color: var(--primary);
}

.badge.est-approved {
  background: rgba(75, 227, 163, .18);
  color: var(--ok);
}

.badge.est-declined {
  background: rgba(255, 90, 122, .15);
  color: var(--danger);
}

/* ─── Crew badges ────────────────────────────────────────── */
.badge.crew-active {
  background: rgba(75, 227, 163, .18);
  color: var(--ok);
}

.badge.crew-inactive {
  background: rgba(120, 120, 140, .18);
  color: var(--muted);
}

/* ─── Settings logo preview ──────────────────────────────── */
.logoPreview {
  height: 52px;
  max-width: 140px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--panel2);
}

/* ─── Compliance warning highlight ──────────────────────── */
.complianceRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.complianceRow.warn {
  background: rgba(255, 204, 102, .12);
  color: var(--warn);
}

.complianceRow.expired {
  background: rgba(255, 90, 122, .12);
  color: var(--danger);
}

/* ─── Comm log ───────────────────────────────────────────── */
.commLogEntry {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.commLogEntry:last-child {
  border-bottom: none;
}

.commLogIcon {
  font-size: 18px;
  line-height: 1;
}

.commLogBody {
  flex: 1;
}

.commLogMeta {
  font-size: 12px;
  color: var(--muted);
}

.commLogText {
  font-size: 13px;
  margin-top: 2px;
}

/* ─── Mileage log table ──────────────────────────────────── */
.mileageSummary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.mileageStat label {
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.mileageStat strong {
  font-size: 16px;
}


/* ─── Sprint 5 — Logo upload area ───────────────────────── */
.logoUploadArea {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--panel2);
}

.logoPreviewBox {
  width: 110px;
  height: 110px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}

.logoPreviewImg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logoPlaceholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 11px;
}

/* ─── Sprint 8 — Voice Input ─────────────────────────────── */
.voiceFieldWrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.voiceFieldWrap textarea {
  padding-right: 42px;
  /* room for the mic button */
}

.voiceMicBtn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, color .15s, border-color .15s;
  z-index: 2;
  flex-shrink: 0;
}

.voiceMicBtn:hover {
  background: rgba(122, 162, 255, .12);
  color: var(--primary);
  border-color: rgba(122, 162, 255, .3);
}

.voiceMicBtn--active {
  background: rgba(255, 90, 122, .15) !important;
  color: var(--danger) !important;
  border-color: rgba(255, 90, 122, .4) !important;
  animation: micPulse 1s ease-in-out infinite;
}

.voiceMicBtn--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: auto;
}

@keyframes micPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 90, 122, .4);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(255, 90, 122, .0);
  }
}

/* ─── Sprint 9 — Drag & Drop Kanban ─────────────────────── */
.kanbanCard[draggable="true"] {
  cursor: grab;
}

.kanbanCard[draggable="true"]:active {
  cursor: grabbing;
}

.kanbanCard--dragging {
  opacity: .35;
  transform: rotate(1.5deg) scale(.97);
}

.kanbanCards {
  min-height: 60px;
  transition: background .15s, box-shadow .15s;
  border-radius: 0 0 10px 10px;
}

.kanbanDrop--over {
  background: rgba(122, 162, 255, .08) !important;
  box-shadow: inset 0 0 0 2px rgba(122, 162, 255, .4);
}

/* ─── iOS Install Banner ─────────────────────────────────── */
/* ─── Estimate: Quick-Add Tags ───────────────────────────── */
.quickAddTags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.quickTag {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--primary);
  background: rgba(122, 162, 255, .1);
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.quickTag:hover {
  background: var(--primary);
  color: #fff;
}

/* ─── Estimate: Totals Footer ────────────────────────────── */
.estTotals {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--panel2);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.estTotalsRow {
  display: flex;
  gap: 24px;
  font-size: 13px;
  justify-content: flex-end;
  width: 100%;
  max-width: 280px;
}

.estTotalsRow span {
  flex: 1;
}

.estTotalsGrand {
  border-top: 1px solid var(--border);
  padding-top: 6px;
  font-size: 15px;
}

.iosBanner {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 420px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px 14px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 9999;
  animation: slideUp .3s ease;
}

.iosBanner__icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.iosBanner__body {
  flex: 1;
}

.iosBanner__title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.iosBanner__text {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.iosBanner__text span {
  color: var(--primary);
  font-weight: 600;
}

.iosBanner__close {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.iosBanner__close:hover {
  color: var(--text);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.kanbanEmpty {
  font-size: 11px;
  color: var(--faint);
  text-align: center;
  padding: 16px 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  margin: 4px;
  pointer-events: none;
}

/* ─── Address Autocomplete Dropdown ─────────────────────── */
.addressSuggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 2px;
}

.addressSuggestItem {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.4;
  transition: background 0.1s;
}

.addressSuggestItem:last-child { border-bottom: none; }

.addressSuggestItem:hover {
  background: var(--panel2);
  color: var(--primary);
}