/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Theme tokens ─────────────────────────────────────────────────────────── */
:root, [data-theme="dark"] {
  --bg:        #0f1117;
  --surface:   #1a1f2e;
  --surface2:  #222840;
  --border:    #2d3348;
  --border2:   #3d4468;
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --accent:    #f59e0b;
  --accent2:   #fbbf24;
  --danger:    #ef4444;
  --success:   #22c55e;
  --warning:   #f59e0b;
  --info:      #3b82f6;
}

[data-theme="medium"] {
  --bg:        #1e2433;
  --surface:   #28304a;
  --surface2:  #323c5a;
  --border:    #3d4868;
  --border2:   #4d5880;
  --text:      #e8edf5;
  --text2:     #9dacc4;
  --text3:     #6b7fa0;
  --accent:    #f59e0b;
  --accent2:   #fbbf24;
}

[data-theme="light"] {
  --bg:        #f0f4f8;
  --surface:   #ffffff;
  --surface2:  #f8fafc;
  --border:    #e2e8f0;
  --border2:   #cbd5e1;
  --text:      #1e293b;
  --text2:     #475569;
  --text3:     #94a3b8;
  --accent:    #d97706;
  --accent2:   #f59e0b;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
code, .mono { font-family: 'JetBrains Mono', monospace; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 52px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 12px; flex-shrink: 0; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar-logo { padding: 20px 16px 12px; border-bottom: 1px solid var(--border); }
.sidebar-logo { flex-shrink: 0; }
.sidebar-header { flex-shrink: 0; }
.sidebar-footer { flex-shrink: 0; }
.sidebar-version { font-size: 10px; color: var(--text3); text-align: center; padding: 6px 8px 2px; letter-spacing: .03em; }
.sidebar-logo .product { font-weight: 700; font-size: 15px; color: var(--accent); letter-spacing: .02em; }
.sidebar-logo .sub { font-size: 11px; color: var(--text3); font-weight: 400; }
.nav-items { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text2); font-size: 13.5px; font-weight: 500; transition: background .12s, color .12s; user-select: none; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(245,158,11,.12); color: var(--accent); }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }
.user-pill { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.user-pill:hover { background: var(--surface2); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #000; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.user-role { font-size: 11px; color: var(--text3); }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; }
.barcode-input { background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 10px; font-size: 13px; width: 200px; font-family: 'JetBrains Mono', monospace; }
.barcode-input::placeholder { color: var(--text3); }
.barcode-input:focus { outline: none; border-color: var(--accent); }

/* ── Status badges (indicator lights) ─────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 100px; text-transform: uppercase; letter-spacing: .04em; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; display: block; flex-shrink: 0; }
.badge-open { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-open::before { background: #3b82f6; }
.badge-progress { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-progress::before { background: #f59e0b; animation: pulse-amber 1.8s infinite; }
.badge-hold { background: rgba(148,163,184,.1); color: #94a3b8; }
.badge-hold::before { background: #94a3b8; }
.badge-closed { background: rgba(34,197,94,.12); color: #4ade80; }
.badge-closed::before { background: #22c55e; }
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.5); }
  50% { box-shadow: 0 0 0 4px rgba(245,158,11,0); }
}

/* ── Cards + panels ───────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.card-body { padding: 18px; }

/* ── Stat tiles ───────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); }
.stat-value { font-size: 30px; font-weight: 700; color: var(--text); margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat-value.amber { color: var(--accent); }
.stat-value.red { color: var(--danger); }
.stat-sub { font-size: 11.5px; color: var(--text3); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text2); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); cursor: pointer; }
.data-table .id-cell { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text3); }
.data-table .title-cell { color: var(--text); font-weight: 500; }
.data-table .pt-name-cell { max-width: 25vw; white-space: normal; word-break: break-word; line-height: 1.35; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: opacity .12s; font-family: inherit; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--accent2); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border2); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,.25); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); }
.form-input, .form-select, .form-textarea {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 7px 10px; font-size: 13px; font-family: inherit; width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: min(520px, 92vw); max-height: 85vh; overflow-y: auto; }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-close { color: var(--text3); font-size: 18px; cursor: pointer; background: none; border: none; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
#fleet-form-modal .modal { width: min(1280px, 97vw) !important; max-width: 1280px !important; max-height: 95vh; box-sizing: border-box; }
#fleet-form-modal .modal-header { padding: 24px 36px; }
#fleet-form-modal .modal-title { font-size: 21px; font-weight: 800; }
#fleet-form-modal .modal-body { padding: 14px 36px 36px; box-sizing: border-box; overflow-x: hidden; }
#fleet-form-modal .modal-body > div { box-sizing: border-box; width: 100%; max-width: 100%; }
#fleet-form-modal .form-group { margin-bottom: 22px; min-width: 0; }
#fleet-form-modal .form-label { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 8px; letter-spacing: .01em; }
#fleet-form-modal input.form-control,
#fleet-form-modal select.form-control,
#fleet-form-modal textarea.form-control { width: 100% !important; box-sizing: border-box !important; height: 50px; font-size: 16px; padding: 0 14px; background: #1a2233 !important; border: 1px solid var(--border) !important; border-radius: 8px; color: var(--text) !important; }
#fleet-form-modal input.form-control:focus,
#fleet-form-modal select.form-control:focus { background: #222c40 !important; border-color: #4a90d9 !important; outline: none; }
#fleet-form-modal .fleet-section-title { font-size: 16px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--text); border-bottom: 2px solid var(--border); padding-bottom: 10px; margin: 30px 0 22px; grid-column: 1 / -1; }
#fleet-form-modal .modal-footer { padding: 20px 36px; }
#fleet-form-modal .btn { height: 46px; font-size: 15px; padding: 0 24px; }

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 40px; width: min(400px, 92vw); }
.login-logo { font-size: 22px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text3); margin-bottom: 28px; }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 8px; pointer-events: all; }
.toast.error { border-color: rgba(239,68,68,.4); color: #fca5a5; }
.toast.success { border-color: rgba(34,197,94,.3); color: #86efac; }

/* ── Detail section ───────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.detail-field { }
.detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); }
.detail-value { font-size: 14px; color: var(--text); margin-top: 3px; }
.detail-value.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text); }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text3); margin-bottom: 12px; }
.empty-state { padding: 48px 24px; text-align: center; color: var(--text3); font-size: 14px; }
.priority-critical { color: #f87171; }
.priority-high { color: #fbbf24; }
.priority-medium { color: #60a5fa; }
.priority-low { color: #64748b; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text3); cursor: pointer; margin-bottom: 16px; }
.back-link:hover { color: var(--accent); }
.theme-toggle { display: flex; gap: 4px; background: var(--surface2); border-radius: 6px; padding: 3px; }
.theme-btn { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; border: none; background: none; color: var(--text3); font-family: inherit; }
.theme-btn.active { background: var(--accent); color: #000; }
[x-cloak] { display: none !important; }

/* Searchable dropdown */
.ss-option { padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--text2); }
.ss-option:hover { background: var(--surface3); color: var(--text1); }

.tenant-card { transition: border-color .15s; }
.tenant-card:hover { border-color: var(--accent) !important; }

/* ── Kiosk / presentation mode (dashboard rotation full-screen) ───────────── */
body.kiosk-mode .sidebar { display: none !important; }
body.kiosk-mode .topbar  { display: none !important; }
body.kiosk-mode .main    { width: 100vw; }
body.kiosk-mode .content { padding-top: 8px; }

/* ── MOBILE LAYOUT ────────────────────────────────────────────────────────── */
.hamburger-btn { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; padding: 4px 10px 4px 0; line-height: 1; }
.mobile-backdrop { display: none; }

@media (max-width: 820px) {
  .app-shell { position: relative; }

  /* sidebar -> off-canvas drawer */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100%; width: 270px; max-width: 84vw;
    z-index: 999; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,.45); overflow-y: auto;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .mobile-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 998; }
  body.nav-open .mobile-backdrop { display: block; }

  .hamburger-btn { display: inline-block; }

  .main { width: 100%; }
  .content { padding: 14px; }
  .topbar { padding: 0 12px; height: 50px; }
  .topbar-title { font-size: 15px; }

  /* stack form/detail grids to one column */
  .form-grid, .detail-grid { grid-template-columns: 1fr !important; }
  /* 16px inputs prevent iOS auto-zoom on focus */
  .form-input, .form-select, .form-textarea { font-size: 16px; }

  .page-header { flex-wrap: wrap; gap: 8px; }
  .page-title { font-size: 20px; }
  .card { margin-bottom: 12px; }

  /* ── tables -> stacked cards (CSS-only) ────────────────────────────────── */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr {
    margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 12px; background: var(--surface);
  }
  .data-table tr:hover td { background: none; }
  .data-table td { border: none; padding: 4px 0; color: var(--text2); }
  .data-table td.id-cell { font-size: 11px; color: var(--text3); padding-bottom: 2px; }
  .data-table td.title-cell { font-size: 16px; font-weight: 600; color: var(--text); padding-bottom: 4px; }

  /* ── wo-table compact mobile rows (override the stacked-card rule) ─────── */
  .data-table.wo-table, .data-table.wo-table tbody { display: block; width: 100%; }
  .data-table.wo-table tr {
    display: flex; align-items: baseline; gap: 8px;
    margin-bottom: 0; border: none; border-bottom: 1px solid var(--border);
    border-radius: 0; padding: 10px 4px; background: none;
  }
  .data-table.wo-table td { display: none; padding: 0; line-height: 1.3; }
  .data-table.wo-table td.id-cell {
    display: block; flex: 0 0 auto; font-size: 12px; color: var(--text3);
    padding-bottom: 0; white-space: nowrap;
  }
  .data-table.wo-table td.title-cell {
    display: block; flex: 1 1 auto; font-size: 14px; font-weight: 600; color: var(--text);
    padding-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* priority cell = col 3, due = last col; show both as small trailing meta */
  .data-table.wo-table td:nth-child(3) {
    display: block; flex: 0 0 auto; font-size: 11px; font-weight: 700; text-transform: uppercase;
  }
  .data-table.wo-table td:last-child {
    display: block; flex: 0 0 auto; font-size: 11px; color: var(--text3); white-space: nowrap;
  }

  /* drawer nav: bigger tap targets */
  .nav-item { padding: 12px 16px; font-size: 15px; }
}

/* ── FACILITY MAP MOBILE ──────────────────────────────────────────────────── */
.map-layers-toggle { display: none; }
@media (max-width: 820px) {
  .map-layers-toggle { display: inline-block; }
  /* stack: layers panel on top (collapsible), map full-width below */
  .map-row { flex-direction: column !important; }
  #map-layers { flex: 1 1 auto !important; width: 100%; display: none; }  /* collapsed by default; toggle shows it */
  #leaflet-map { flex: none !important; width: 100% !important; height: 70vh !important; min-height: 380px !important; }
}

.pt-subtotal-row td{background:var(--surface2);padding-top:2px;padding-bottom:6px}

.ss-list { display:none; position:absolute; top:100%; left:0; right:0; max-height:240px; overflow-y:auto; background:var(--surface2); border:1px solid var(--border); border-radius:8px; z-index:1000; margin-top:2px; box-shadow:0 8px 24px rgba(0,0,0,.4); }
.ss-item { padding:8px 12px; cursor:pointer; font-size:13.5px; color:var(--text); }
.ss-item:hover { background:var(--surface3); }
/* ===== Janitorial / QC restroom dashboard ===== */
.rr-head{display:flex;justify-content:space-between;align-items:flex-start;flex-wrap:wrap;gap:12px}
.rr-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:13px;color:#555}
.rr-key{display:inline-flex;align-items:center;gap:6px}
.rr-sw{width:14px;height:14px;border-radius:3px;display:inline-block}
.rr-sw-hb{background:linear-gradient(90deg,#111 0 50%,#d64545 50% 100%)}
.rr-summary{display:flex;gap:18px;align-items:center;flex-wrap:wrap;margin:14px 0}
.rr-stat{font-size:14px;color:#444}
.rr-stat.rr-ok b{color:#1f9d55}
.rr-stat.rr-bad b{color:#d64545}
.rr-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:14px}
.rr-tile{border:1px solid #e2e2e2;border-radius:12px;padding:14px;display:flex;flex-direction:column;align-items:center;gap:6px;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.06)}
.rr-tile.rr-green{border-top:4px solid #1f9d55}
.rr-tile.rr-red{border-top:4px solid #d64545}
.rr-icon{line-height:0}
.rr-name{font-weight:600;text-align:center;font-size:14px}
.rr-age{font-size:12px;color:#777}
.rr-mwo{font-size:12px;color:#111;background:#f1d4d4;border-radius:6px;padding:2px 8px}
.rr-actions{display:flex;gap:6px;margin-top:6px;flex-wrap:wrap;justify-content:center}
.btn-sm{font-size:12px;padding:4px 10px}
/* ===== Dashboard Tuning ===== */
.dt-presets{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.dt-custom{display:flex;gap:10px;align-items:center;margin-top:8px}
.dt-bf-preview{margin-top:12px;padding:10px;background:#f7f7f7;border-radius:8px}
.dt-bf-preview ul{margin:6px 0 10px 18px;max-height:220px;overflow:auto}


/* STICKY_TABLE_HEADERS_V1 -- column headers stay pinned while the list scrolls.
   Sticks against the .content scroller. Opaque background hides rows sliding
   under; box-shadow replaces the border-bottom that sticky cells lose under
   border-collapse: collapse. */
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 5;
  box-shadow: 0 1px 0 var(--border);
}


/* STICKY_PAGE_HEADER_V1 -- page title + action buttons stay pinned while the
   page scrolls. Opaque page background hides content sliding under; min-height
   keeps the pinned height predictable so the table-header offset below lines up. */
.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 8px 0 10px;
  min-height: 36px;
}
/* Column headers now pin just below the pinned page header (54px covers the
   header box; small overlap hides behind the header's opaque background).
   Scoped to .content so tables inside modals keep pinning at their own top. */
.content .data-table thead th {
  top: 54px;
}

/* CITY_PHOTOS_TOP_V1 -------------------------------------------------------
   The photo control sits at the top of the asset card because adding a photo
   is the most common reason a crew opens one. The empty state is a tap target
   in its own right, not just a label. */
.cm-photos{margin:0 0 18px;}
.cm-photo-bar{display:flex;align-items:center;gap:12px;margin-bottom:10px;}
.cm-photo-btn{display:inline-flex;align-items:center;gap:8px;font-weight:600;}
.cm-photo-btn svg{flex:0 0 auto;}
.cm-photo-count{color:var(--text2);font-size:13px;}
.cm-photo-strip{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px;}
.cm-photo{position:relative;flex:0 0 auto;}
.cm-photo img{width:104px;height:104px;object-fit:cover;border-radius:8px;display:block;}
.cm-photo-del{position:absolute;top:4px;right:4px;width:22px;height:22px;border:0;
  border-radius:11px;background:rgba(0,0,0,.65);color:#fff;font-size:13px;line-height:1;
  cursor:pointer;opacity:0;transition:opacity .12s;}
.cm-photo:hover .cm-photo-del,.cm-photo:focus-within .cm-photo-del{opacity:1;}
.cm-photo-empty{border:2px dashed var(--border,#3a4a63);border-radius:8px;
  padding:22px;text-align:center;color:var(--text2);font-size:13px;cursor:pointer;}
.cm-photo-empty:hover{border-color:var(--primary,#f0a500);color:var(--text);}
.cm-sub{font-weight:600;margin:14px 0 6px;color:var(--text2);font-size:13px;
  text-transform:uppercase;letter-spacing:.04em;}
.cm-hint{font-size:12px;color:var(--text2);margin-top:4px;}
.cm-autoid{display:flex;align-items:center;gap:6px;margin-top:6px;
  font-size:13px;color:var(--text2);}

/* NAV_LAUNCHER_V1 ----------------------------------------------------------
   Right-side panel. Full height, fixed width on desktop, full width on a
   phone. The backdrop is click-to-close, which is the behaviour people expect
   from a slide-in and costs nothing. */
.nl-launch{display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;margin-left:6px;border:1px solid var(--border,#3a4a63);
  border-radius:8px;background:transparent;color:var(--text,#e8eef7);cursor:pointer;}
.nl-launch:hover{border-color:var(--primary,#f0a500);color:var(--primary,#f0a500);}
.nl-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:2147483000;}
.nl-panel{position:fixed;top:0;right:0;bottom:0;width:min(520px,100vw);
  background:var(--surface,#1a1f2e);border-left:1px solid var(--border,#3a4a63);
  z-index:2147483001;display:flex;flex-direction:column;
  box-shadow:-12px 0 40px rgba(0,0,0,.45);}
.nl-head{display:flex;align-items:center;justify-content:space-between;
  padding:16px 18px 10px;border-bottom:1px solid var(--border,#3a4a63);}
.nl-title{font-size:17px;font-weight:700;color:var(--text,#e8eef7);}
.nl-x{background:none;border:0;color:var(--text2,#9aa8bd);font-size:18px;cursor:pointer;
  padding:4px 8px;border-radius:6px;}
.nl-x:hover{background:rgba(255,255,255,.08);color:var(--text,#e8eef7);}
.nl-search-row{display:flex;gap:8px;padding:12px 18px;}
.nl-search{flex:1;padding:9px 12px;border-radius:8px;font-size:14px;
  border:1px solid var(--border,#3a4a63);background:var(--surface2,#232a3a);
  color:var(--text,#e8eef7);}
.nl-search:focus{outline:none;border-color:var(--primary,#f0a500);}
.nl-organize{padding:9px 14px;border-radius:8px;font-size:13px;font-weight:600;
  border:1px solid var(--border,#3a4a63);background:transparent;
  color:var(--text2,#9aa8bd);cursor:pointer;white-space:nowrap;}
.nl-organize:hover{color:var(--text,#e8eef7);border-color:var(--text2,#9aa8bd);}
.nl-organize-on{background:var(--primary,#f0a500);border-color:var(--primary,#f0a500);
  color:#1a1f2e;}
.nl-note{margin:0 18px 8px;padding:9px 12px;border-radius:8px;font-size:12px;
  line-height:1.5;color:var(--text2,#9aa8bd);background:rgba(255,255,255,.04);}
.nl-body{flex:1;overflow-y:auto;padding:4px 18px 24px;}
.nl-group{margin-bottom:20px;}
.nl-group-head{display:flex;align-items:center;gap:7px;font-size:12px;font-weight:700;
  text-transform:uppercase;letter-spacing:.05em;color:var(--text2,#9aa8bd);
  margin:0 0 10px;}
.nl-group-ico{font-size:14px;}
.nl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:10px;}
.nl-tile{position:relative;display:flex;flex-direction:column;align-items:center;
  justify-content:center;gap:7px;min-height:92px;padding:12px 8px;cursor:pointer;
  border:1px solid var(--border,#3a4a63);border-radius:10px;
  background:var(--surface2,#232a3a);color:var(--text,#e8eef7);
  font-size:12px;line-height:1.3;text-align:center;transition:border-color .12s,transform .06s;}
.nl-tile:hover{border-color:var(--primary,#f0a500);}
.nl-tile:active{transform:scale(.97);}
.nl-ico{font-size:24px;line-height:1;}
.nl-label{word-break:break-word;}
.nl-off{opacity:.42;}
.nl-off .nl-ico{filter:grayscale(1);}
.nl-switch{position:absolute;top:5px;right:6px;font-size:9px;font-weight:700;
  text-transform:uppercase;letter-spacing:.05em;padding:2px 5px;border-radius:4px;
  background:var(--primary,#f0a500);color:#1a1f2e;}
.nl-off .nl-switch{background:var(--border,#3a4a63);color:var(--text2,#9aa8bd);}
.nl-pro{position:absolute;top:5px;left:6px;font-size:9px;font-weight:700;
  padding:2px 5px;border-radius:4px;background:#7c3aed;color:#fff;}
.nl-locked{opacity:.6;}
.nl-empty{padding:36px 12px;text-align:center;color:var(--text2,#9aa8bd);font-size:13px;}
@media (max-width:640px){
  .nl-panel{width:100vw;}
  .nl-grid{grid-template-columns:repeat(auto-fill,minmax(88px,1fr));}
}

/* CMMS_VISUAL_NAV_V1 -------------------------------------------------------
   A visual sidebar mode for users who identify modules faster by icon, color,
   and a short description than by a long text-only list. */
.cmms-visual-sidebar{width:294px;background:linear-gradient(180deg,var(--surface),rgba(20,27,42,.98));}
.cmms-visual-brand{padding:12px 14px 14px!important;border-bottom:1px solid var(--border);}
.cmms-visual-logo{width:100%;height:auto;max-height:72px;object-fit:contain;display:block;margin:0 auto 5px;}
.cmms-visual-subtitle{font-size:11px;color:var(--text2);text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.cmms-visual-hint{margin-top:8px;text-align:center;font-size:11px;color:var(--text3);}
.cmms-visual-search-wrap{padding:10px 12px 4px!important;}
.cmms-visual-search-wrap input{height:34px;border-radius:9px!important;background:var(--surface2)!important;}
.cmms-visual-nav{padding:10px 12px 18px!important;gap:18px!important;}
.cmms-visual-section{display:flex;flex-direction:column;gap:7px;min-width:0;}
.cmms-visual-section-title{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 3px 2px;color:var(--text2);font-size:10.5px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;}
.cmms-visual-section-title>span:first-child{display:flex;align-items:center;gap:6px;min-width:0;}
.cmms-visual-section-icon{font-size:14px;line-height:1;}
.cmms-visual-count{min-width:18px;text-align:center;border:1px solid var(--border);border-radius:999px;padding:1px 5px;color:var(--text3);font-size:10px;font-weight:700;letter-spacing:0;}
.cmms-visual-card{position:relative;width:100%;min-height:58px;box-sizing:border-box;padding:9px 10px;border:1px solid var(--border);border-radius:11px;background:linear-gradient(135deg,rgba(255,255,255,.045),rgba(255,255,255,.015));color:var(--text);font-family:inherit;text-align:left;gap:10px;cursor:pointer;transition:transform .12s ease,border-color .12s ease,background .12s ease,box-shadow .12s ease;}
.cmms-visual-card:hover{transform:translateY(-1px);border-color:var(--visual-accent,var(--accent));background:linear-gradient(135deg,var(--visual-soft,rgba(255,255,255,.08)),rgba(255,255,255,.025));box-shadow:0 5px 14px rgba(0,0,0,.18);}
.cmms-visual-card.active{border-color:var(--visual-accent,var(--accent));background:linear-gradient(135deg,var(--visual-soft,rgba(245,158,11,.15)),rgba(255,255,255,.035));box-shadow:inset 3px 0 0 var(--visual-accent,var(--accent));}
.cmms-visual-icon{display:flex;align-items:center;justify-content:center;flex:0 0 37px;width:37px;height:37px;border-radius:10px;background:var(--visual-soft,rgba(255,255,255,.1));color:var(--visual-accent,var(--accent));font-size:20px;line-height:1;}
.cmms-visual-copy{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center;gap:2px;}
.cmms-visual-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:700;color:var(--text);}
.cmms-visual-desc{display:-webkit-box;overflow:hidden;color:var(--text3);font-size:10.5px;line-height:1.25;-webkit-box-orient:vertical;-webkit-line-clamp:2;}
.cmms-visual-arrow{flex:0 0 auto;color:var(--text3);font-size:21px;line-height:1;}
.cmms-visual-card:hover .cmms-visual-arrow,.cmms-visual-card.active .cmms-visual-arrow{color:var(--visual-accent,var(--accent));}
.cmms-visual-pro{position:absolute;top:6px;right:7px;border:1px solid #a78bfa;border-radius:4px;padding:1px 4px;color:#c4b5fd;font-size:8px;font-weight:800;letter-spacing:.04em;}
.cmms-visual-card.nav-lite-lock{opacity:.64;}
.cmms-visual-card.nav-lite-lock:hover{opacity:.9;}
.cmms-visual-start{padding:10px;border:1px solid rgba(245,158,11,.22);border-radius:13px;background:linear-gradient(135deg,rgba(245,158,11,.09),rgba(255,255,255,.02));}
.cmms-visual-start .cmms-visual-card{min-height:70px;border-color:rgba(245,158,11,.2);}
.cmms-visual-start .cmms-visual-label{font-size:12px;}
.cmms-visual-start .cmms-visual-desc{font-size:10px;}
.nav-mode-toggle{white-space:nowrap;}
.nav-mode-icon{font-size:15px;line-height:1;}
.nav-mode-text{font-size:11px;}
@media (max-width:900px){
  .nav-mode-text{display:none;}
  .nav-mode-toggle{padding-left:8px;padding-right:8px;}
}

/* CITY_TABLE_HEADER_LAYOUT_FIX_V1 */
body:has(#cm-search) .data-table thead,
body:has([data-cm-family]) .data-table thead { position: static !important; }
body:has(#cm-search) .data-table thead th,
body:has([data-cm-family]) .data-table thead th {
  position: static !important;
  top: auto !important;
  inset-block-start: auto !important;
  z-index: 1 !important;
  transform: none !important;
}

/* CITY_TRAFFIC_SIGNAL_DETAILS_V2 */
.cm-traffic-v2 { margin-top:16px; border:1px solid var(--border); border-radius:8px; overflow:hidden; background:var(--bg2); }
.cm-traffic-v2-head, .cm-traffic-section-head, .cm-traffic-edit-title { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.cm-traffic-v2-head { padding:14px 16px; border-bottom:1px solid var(--border); }
.cm-traffic-stats { display:flex; flex-wrap:wrap; gap:8px; padding:10px 16px; border-bottom:1px solid var(--border); color:var(--text3); font-size:12px; }
.cm-traffic-stats span { padding-right:12px; border-right:1px solid var(--border); }
.cm-traffic-stats span:last-child { border-right:0; }
.cm-traffic-stats b { color:var(--text); }
.cm-traffic-section { padding:12px 16px 4px; }
.cm-traffic-section-head { margin-bottom:8px; }
.cm-traffic-table { margin:0; }
.cm-traffic-empty { color:var(--text3); font-size:12px; padding:8px 0 12px; }
.cm-traffic-edit-section { border:1px solid var(--border); border-radius:7px; margin:0 0 12px; padding:10px; }
.cm-traffic-edit-rows { display:grid; gap:9px; margin-top:10px; }
.cm-traffic-edit-row { display:grid; grid-template-columns:repeat(4,minmax(120px,1fr)) auto; gap:8px; align-items:end; padding:9px; background:var(--bg2); border-radius:6px; }
.cm-traffic-edit-row label span { display:block; color:var(--text3); font-size:11px; margin-bottom:4px; }
.cm-traffic-edit-row .form-input { min-width:0; }
.cm-traffic-remove { color:var(--danger); }
@media (max-width:900px){ .cm-traffic-edit-row { grid-template-columns:repeat(2,minmax(120px,1fr)); } }
@media (max-width:560px){ .cm-traffic-edit-row { grid-template-columns:1fr; } }
.cm-traffic-v2-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.cm-traffic-scan-intro{padding:12px 14px;border:1px solid var(--border);border-radius:8px;background:var(--bg2);line-height:1.45}
.cm-traffic-scan-intro p{margin:6px 0 0;color:var(--text3)}
.cm-traffic-scan-readings{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0;font-size:12px;color:var(--text3)}
.cm-traffic-scan-readings>div{padding:10px;border:1px solid var(--border);border-radius:7px;background:var(--bg2)}
.cm-traffic-scan-status.warn{color:#f5b942}
.cm-traffic-scan-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:12px 0}
.cm-traffic-scan-grid label span{display:block;font-size:11px;color:var(--text3);margin-bottom:5px}
.cm-traffic-ai-review{margin-bottom:12px;padding:11px 13px;border:1px solid #c58b23;border-left:4px solid #f5a400;border-radius:7px;background:rgba(245,164,0,.09);color:var(--text)}
.cm-traffic-ai-review ul{margin:6px 0 0 18px;padding:0;color:var(--text3)}
.cm-traffic-ai-review>div{margin-top:5px;color:var(--text3)}
.cm-traffic-mock-wrap{margin:12px 0;padding:10px;border:1px solid var(--border);border-radius:8px;background:var(--bg2)}
.cm-traffic-mock-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:4px}
#cm-traffic-mock-map{height:190px;margin-top:9px;border:1px solid var(--border);border-radius:7px;overflow:hidden}
@media (max-width:900px){.cm-traffic-scan-readings{grid-template-columns:1fr}.cm-traffic-scan-grid{grid-template-columns:1fr}}

/* CMMS_HEADER_RECOVERY_V1
   DASH_QL_TOPBAR_V1 places an eight-button wrapping quick-link bar inside
   the fixed 52px topbar. The wrapped bar overflows vertically and clips the
   header. Quick links remain available through the sidebar and All Modules. */
.topbar .ml-qlwrap {
  display: none !important;
}
.topbar {
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}

/* CMMS_FONT_VISIBILITY_V1 â€” readable text in dark navigation/search controls */
input[type="search"],
input[placeholder*="Search"],
input[placeholder*="search"],
aside input:not([type="checkbox"]):not([type="radio"]),
[class*="sidebar"] input:not([type="checkbox"]):not([type="radio"]),
[class*="side-nav"] input:not([type="checkbox"]):not([type="radio"]),
[class*="navigation"] input:not([type="checkbox"]):not([type="radio"]),
[class*="nav-search"] input:not([type="checkbox"]):not([type="radio"]),
[class*="search"] input:not([type="checkbox"]):not([type="radio"]),
input.cmms-search,
select.cmms-search,
textarea.cmms-search {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff !important;
}

input[type="search"]::placeholder,
input[placeholder*="Search"]::placeholder,
input[placeholder*="search"]::placeholder,
aside input::placeholder,
[class*="sidebar"] input::placeholder,
[class*="side-nav"] input::placeholder,
[class*="navigation"] input::placeholder,
[class*="nav-search"] input::placeholder,
[class*="search"] input::placeholder {
  color: #dbe7ff !important;
  -webkit-text-fill-color: #dbe7ff !important;
  opacity: 1 !important;
}

/* Ensures browser autofill does not reapply an unreadable dark text color. */
input[type="search"]:-webkit-autofill,
[class*="sidebar"] input:-webkit-autofill,
[class*="search"] input:-webkit-autofill {
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #ffffff !important;
}
