/* ══════════════════════════════════════════════════════════════════════════
   Ganga Plumbers — Job Card Management
   Visual language adapted from Papini BI (soft shadows, single accent, quiet
   chrome) re-skinned into Ganga's navy + orange brand identity.
   ══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  /* Neutrals — cool-clean (industrial), a step off Papini's warm cream */
  --bg:        #eef1f7;
  --bg2:       #f7f9fc;
  --surface:   #ffffff;
  --surface2:  #f2f5fa;
  --line:      #dbe1ec;
  --line2:     #eaeef5;
  --text:      #14213a;
  --text2:     #4a5568;
  --text3:     #8b93a7;
  --ink:       #14357f;   /* Ganga navy — primary buttons / active nav */
  --ink-deep:  #0d2456;

  /* The single accent — Ganga orange */
  --accent:      #f47b20;
  --accent-deep: #d95f0e;
  --accent-soft: #fdeede;

  /* Functional */
  --blue:   #3b73c4;
  --green:  #2f9e6b;
  --red:    #d1493f;
  --purple: #7c6cc4;
  --teal:   #0ea5b7;

  --shadow-sm: 0 1px 2px rgba(20,33,58,.05), 0 1px 3px rgba(20,33,58,.07);
  --shadow:    0 4px 12px rgba(20,33,58,.07), 0 2px 4px rgba(20,33,58,.05);
  --shadow-lg: 0 18px 50px rgba(20,33,58,.16);

  --radius: 14px;
  --radius-sm: 9px;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;

  --sidebar-w: 236px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
@media (min-width: 1024px) { html { zoom: 0.95; } }

body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
svg.li { width: 16px; height: 16px; vertical-align: -3px; flex-shrink: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; top: 18px; right: 18px; z-index: 4000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; max-width: 340px;
  animation: toastIn .22s cubic-bezier(.22,1.2,.36,1);
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; align-items: center; justify-content: center; height: 240px; }

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN — the "arrival" screen (navy gradient + orange ember glow)
   ══════════════════════════════════════════════════════════════════════════ */
#login-screen { position: fixed; inset: 0; z-index: 2000; }
.auth-grid { display: grid; grid-template-columns: 1.1fr 1fr; height: 100%; }
.auth-visual {
  position: relative; overflow: hidden; padding: 54px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(145deg, #0b1c47 0%, #14357f 55%, #1e4fb8 100%);
  color: #fff;
}
.auth-visual::before {
  content: ''; position: absolute; top: -80px; right: -60px; width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(244,123,32,.30) 0%, transparent 70%);
  filter: blur(48px); pointer-events: none;
}
.a-logo { position: relative; align-self: flex-start; background: #fff; border-radius: 14px; padding: 16px 22px; box-shadow: 0 6px 24px rgba(0,0,0,.22); }
.a-logo img { display: block; height: 52px; }
.a-copy { position: relative; }
.a-copy h1 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 700; letter-spacing: -.02em; line-height: 1.08; }
.a-copy p { margin-top: 14px; max-width: 440px; color: rgba(255,255,255,.72); font-size: 16px; }
.a-foot { position: relative; color: rgba(255,255,255,.6); font-size: 13px; }

.auth-form-side { display: flex; align-items: center; justify-content: center; background: var(--bg2); padding: 40px; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form .mobile-logo { display: none; margin-bottom: 20px; }
.auth-form h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.auth-form .sub { color: var(--text2); margin: 6px 0 26px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.auth-err { color: var(--red); font-size: 13px; font-weight: 500; margin: 12px 0; min-height: 18px; }
.auth-powered { margin-top: 34px; text-align: center; color: var(--text3); font-size: 12px; }
.auth-powered img { height: 26px; margin-top: 6px; opacity: .85; }

@media (max-width: 860px) {
  .auth-grid { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form .mobile-logo { display: block; }
}

/* ── Inputs & buttons ─────────────────────────────────────────────────────── */
.input, textarea.input, select.input {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; transition: border-color .12s;
}
.input:focus, textarea.input:focus, select.input:focus { outline: none; border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 74px; }
label.lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.req::after { content: ' *'; color: var(--accent-deep); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 15px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn:hover { border-color: var(--text3); }
.btn .li { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-deep); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-deep); }
.btn.danger { color: var(--red); border-color: #f0c9c5; }
.btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════════════════ */
#app { min-height: 100vh; }
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 900;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: var(--bg2); border-bottom: 1px solid var(--line);
}
#menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text2); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 30px; }
.brand .divider { width: 1px; height: 22px; background: var(--line); }
.brand .co-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
#topbar .spacer { flex: 1; }
#page-title { font-weight: 600; font-size: 15px; color: var(--text2); }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user .u-meta { text-align: right; line-height: 1.15; }
.topbar-user .u-name { font-size: 13px; font-weight: 600; }
.topbar-user .u-role { font-size: 11px; color: var(--text3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.logout-btn { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 11px; font-size: 12.5px; font-weight: 600; color: var(--text2); cursor: pointer; }
.logout-btn:hover { border-color: var(--red); color: var(--red); }
.logout-btn svg { width: 15px; height: 15px; }

#sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 800;
  background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px;
}
.sidebar-section { margin-bottom: 6px; }
.sidebar-section-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text3); padding: 12px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text2); cursor: pointer; transition: all .12s; margin-bottom: 2px;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item.active .nav-icon svg { stroke: #fff; }
.nav-icon { display: flex; }
.nav-icon svg { width: 18px; height: 18px; stroke: currentColor; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line2); }
.powered { color: var(--text3); font-size: 11px; text-align: center; }
.powered img { height: 22px; margin-top: 5px; opacity: .8; }

#sidebar-overlay { display: none; }

#main-wrap { margin-left: var(--sidebar-w); padding-top: var(--topbar-h); min-height: 100vh; }
#content { padding: 22px 26px 60px; max-width: 1500px; }

@media (max-width: 960px) {
  #menu-toggle { display: block; }
  #sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  #sidebar.open { transform: none; }
  #main-wrap { margin-left: 0; }
  #sidebar-overlay.open { display: block; position: fixed; inset: 0; top: var(--topbar-h); background: rgba(20,33,58,.35); z-index: 750; }
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head .ph-sub { color: var(--text2); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Panels / cards ───────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel.pad { padding: 18px; }

/* KPI stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat .ic svg { width: 22px; height: 22px; }
.stat .s-val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.stat .s-lbl { font-size: 12px; color: var(--text3); margin-top: 4px; font-weight: 500; }

/* ── Badges & pills ───────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .01em; }
.badge.grey { background: #eceef3; color: #5a6478; }
.badge.orange { background: var(--accent-soft); color: var(--accent-deep); }
.badge.navy { background: #e3e9f6; color: var(--ink); }
.badge.green { background: #e3f5ec; color: #1f7a52; }
.badge.red { background: #fbe6e4; color: #b23129; }
.status-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 700; color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); font-weight: 700; padding: 10px 12px; background: var(--surface2); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--surface2); }
.data-table tr:last-child td { border-bottom: none; }
.table-wrap { overflow: visible; min-height: 280px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.row-actions { display: flex; gap: 6px; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 7px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text2); }
.icon-btn:hover { border-color: var(--text3); color: var(--text); }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); }
.icon-btn svg { width: 15px; height: 15px; }

.empty { text-align: center; padding: 50px 20px; color: var(--text3); }
.empty svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 10px; }

/* ── Segmented control ────────────────────────────────────────────────────── */
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { background: none; border: none; padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--text2); border-radius: 7px; cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ── Modals ───────────────────────────────────────────────────────────────── */
#modal-host { position: fixed; inset: 0; z-index: 3000; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; background: rgba(20,33,58,.42); }
#modal-host.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: modalIn .2s cubic-bezier(.22,1.2,.36,1); }
.modal.wide { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 0; }
.modal-head h3 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.modal-sub { padding: 2px 22px 0; color: var(--text3); font-size: 12.5px; }
.modal-x { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 22px; line-height: 1; padding: 0 4px; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 18px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 4px 22px 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.fld { margin-bottom: 2px; }

/* ── Autocomplete ─────────────────────────────────────────────────────────── */
.ac-wrap { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; z-index: 20; margin-top: 4px; }
.ac-item { padding: 9px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line2); }
.ac-item:hover, .ac-item.active { background: var(--accent-soft); }
.ac-item .ac-name { font-weight: 600; }
.ac-item .ac-meta { font-size: 11.5px; color: var(--text3); }

/* ── Chips (assistant plumbers multiselect) ───────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 6px 4px 11px; font-size: 12px; font-weight: 500; }
.chip button { background: none; border: none; cursor: pointer; color: var(--text3); font-size: 15px; line-height: 1; }
.chip button:hover { color: var(--red); }

/* ══════════════════════════════════════════════════════════════════════════
   HOME LAUNCHER — dark brand panel + a card per workspace
   ══════════════════════════════════════════════════════════════════════════ */
#app.home-mode #sidebar, #app.home-mode #sidebar-overlay { display: none; }
#app.home-mode #main-wrap { margin-left: 0; }
#app.home-mode #content { padding: 0; max-width: none; }
#app.home-mode #topbar-brand, #app.home-mode .home-btn { display: none; }
#app:not(.home-mode) #topbar-powered { display: none; }

.topbar-powered { display: flex; align-items: center; gap: 8px; color: var(--text3); font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.topbar-powered img { height: 20px; }
.home-btn { display: inline-flex; align-items: center; gap: 7px; margin-right: 6px; }
.home-btn svg { width: 15px; height: 15px; }

.home-shell { display: grid; grid-template-columns: 380px 1fr; min-height: calc(100vh - var(--topbar-h)); }
.home-left {
  background: linear-gradient(145deg, #0b1c47 0%, #14357f 55%, #1e4fb8 100%);
  position: relative; overflow: hidden; padding: 44px 36px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
}
.home-left::before { content: ''; position: absolute; top: -80px; right: -50px; width: 380px; height: 380px; background: radial-gradient(circle, rgba(244,123,32,.30) 0%, transparent 70%); filter: blur(48px); }
.home-logo { position: relative; align-self: flex-start; background: #fff; border-radius: 14px; padding: 14px 20px; box-shadow: 0 6px 22px rgba(0,0,0,.2); animation: homeFade .5s ease both; }
.home-logo img { display: block; height: 46px; }
.home-welcome { position: relative; animation: homeFade .5s .08s ease both; }
.home-welcome h1 { font-size: clamp(30px, 3.4vw, 42px); font-weight: 700; letter-spacing: -.02em; line-height: 1.12; }
.home-welcome p { margin-top: 10px; color: rgba(255,255,255,.72); font-size: 15px; }
.home-foot { position: relative; color: rgba(255,255,255,.55); font-size: 12px; animation: homeFade .5s .14s ease both; }
@keyframes homeFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.home-right { padding: 40px; overflow-y: auto; }
.ws-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 22px; max-width: 1100px; }
.ws-card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow-sm); animation: swoopIn .45s cubic-bezier(.22,1.2,.36,1) both;
}
.ws-card-link { position: absolute; top: 20px; right: 20px; width: 30px; height: 30px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text2); transition: all .12s; }
.ws-card-link:hover { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.ws-card-link .li { width: 15px; height: 15px; }
.ws-ic { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.ws-ic svg { width: 26px; height: 26px; }
.ws-card h3 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.ws-card p { font-size: 13.5px; color: var(--text2); margin-top: 6px; line-height: 1.5; }
.ws-sub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.ws-sub { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--surface2); border: 1px solid var(--line2); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; transition: all .12s; }
.ws-sub:hover { background: var(--accent-soft); border-color: var(--accent); }
.ws-sub-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text2); }
.ws-sub-ic svg { width: 15px; height: 15px; }
.ws-sub-text { display: flex; flex-direction: column; min-width: 0; }
.ws-sub-text strong { font-size: 12.5px; font-weight: 700; }
.ws-sub-text small { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes swoopIn { from { opacity: 0; transform: scale(.9) translateY(16px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
  .home-shell { grid-template-columns: 1fr; }
  .home-left { padding: 30px 24px; }
  .home-right { padding: 24px; }
  .ws-sub-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════════
   LIVE DASHBOARD (crew board)
   ══════════════════════════════════════════════════════════════════════════ */
.crew-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.crew-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.crew-card .cc-top { padding: 14px 16px; color: #fff; display: flex; align-items: center; justify-content: space-between; }
.crew-card .cc-top h3 { font-size: 15px; font-weight: 700; }
.crew-card .cc-top .cc-lead { font-size: 12px; opacity: .9; }
.crew-card .cc-body { padding: 14px 16px; }
.cc-progress { height: 7px; border-radius: 99px; background: var(--surface2); overflow: hidden; margin: 10px 0 14px; }
.cc-progress > span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.cc-now { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; background: var(--surface2); margin-bottom: 10px; }
.cc-now .lab { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--text3); margin-bottom: 3px; }
.cc-now .job { font-weight: 600; font-size: 13.5px; }
.cc-now .meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.cc-timeleft { font-family: var(--mono); font-weight: 600; color: var(--accent-deep); }
.cc-mini { font-size: 12px; color: var(--text2); display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px dashed var(--line2); }

/* ══════════════════════════════════════════════════════════════════════════
   CALENDAR
   ══════════════════════════════════════════════════════════════════════════ */
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { font-size: 16px; font-weight: 700; min-width: 200px; }
.cal-grid-month { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.cal-dow { padding: 8px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); background: var(--surface2); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 116px; border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); padding: 6px; cursor: pointer; position: relative; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.out { background: var(--surface2); }
.cal-cell.today .cal-daynum { background: var(--accent); color: #fff; }
.cal-daynum { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 600; padding: 0 5px; }
.cal-chip { display: block; font-size: 11px; font-weight: 600; color: #fff; border-radius: 5px; padding: 2px 6px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-more { font-size: 10.5px; color: var(--text3); margin-top: 3px; font-weight: 600; }

/* Week/day time-grid */
.cal-timegrid { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); max-height: 72vh; overflow-y: auto; }
.ctg-head { display: contents; }
.ctg-col-head { padding: 8px; text-align: center; font-size: 12px; font-weight: 700; background: var(--surface2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.ctg-hour { font-size: 11px; color: var(--text3); text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--line2); border-right: 1px solid var(--line2); font-family: var(--mono); }
.ctg-slot { border-bottom: 1px solid var(--line2); border-right: 1px solid var(--line2); min-height: 46px; padding: 2px; }
.ctg-slot:last-child { border-right: none; }
.ctg-event { font-size: 11px; color: #fff; border-radius: 5px; padding: 3px 6px; margin-bottom: 2px; cursor: pointer; }
.ctg-event .ev-t { font-weight: 700; }
.allday-row { background: var(--accent-soft); }

/* Backlog / unscheduled strip */
.backlog { margin-top: 16px; }
.backlog h4 { font-size: 12.5px; font-weight: 700; color: var(--text2); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.backlog-items { display: flex; gap: 8px; flex-wrap: wrap; }
.backlog-chip { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12.5px; cursor: pointer; box-shadow: var(--shadow-sm); }
.backlog-chip .bc-no { font-family: var(--mono); font-weight: 600; color: var(--accent-deep); }

/* colour swatch grid (crew/status editors) */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }

.mini-note { font-size: 12px; color: var(--text3); margin-top: 6px; }
.inline-status { display: inline-flex; align-items: center; gap: 6px; }
.hr { height: 1px; background: var(--line2); margin: 16px 0; border: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .two-col, .form-grid { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════════════════════
   TICK MULTI-SELECT DROPDOWN (crew / case-manager filters)
   ══════════════════════════════════════════════════════════════════════════ */
.tick-dd { position: relative; display: inline-block; }
.tick-dd-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px;
  border: 1px dashed var(--line); border-radius: 99px; background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text2); cursor: pointer; transition: all .12s;
}
.tick-dd-btn:hover { border-color: var(--text3); }
.tick-dd-btn.active { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-deep); }
.tick-dd-btn .li { width: 14px; height: 14px; }
.tick-dd-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); min-width: 230px; max-height: 300px; overflow-y: auto; padding: 6px;
  animation: ddIn .14s cubic-bezier(.22,1.2,.36,1);
}
@keyframes ddIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tick-dd-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.tick-dd-item:hover { background: var(--surface2); }
.tick-dd-item input { accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.tick-dd-foot { display: flex; justify-content: space-between; padding: 6px 8px 2px; border-top: 1px solid var(--line2); margin-top: 4px; }
.tick-dd-foot button { background: none; border: none; color: var(--accent-deep); font-size: 11.5px; font-weight: 700; cursor: pointer; padding: 3px; }
.tick-dd-foot button:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════════════════
   JOB TABLE — division/crew grouping
   ══════════════════════════════════════════════════════════════════════════ */
.tbl-div-row td { background: var(--surface2); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 9px 12px; border-top: 3px solid var(--line); color: var(--text2); }
.tbl-div-row:first-child td { border-top: none; }
.tbl-crew-row td { font-weight: 700; font-size: 12.5px; padding: 6px 12px; color: var(--text); border-bottom: 1px solid var(--line2); }

/* ══════════════════════════════════════════════════════════════════════════
   LIVE DASHBOARD — divisions, click-through, live indicator, map, TV mode
   ══════════════════════════════════════════════════════════════════════════ */
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex-shrink: 0; animation: livePulse 1.8s infinite; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(47,158,107,.5); }
  70% { box-shadow: 0 0 0 8px rgba(47,158,107,0); }
  100% { box-shadow: 0 0 0 0 rgba(47,158,107,0); }
}

.clickable { cursor: pointer; transition: background .12s; }
.clickable:hover { background: var(--accent-soft) !important; }

.div-section { margin-bottom: 20px; }
.div-section-head {
  display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px;
  padding: 7px 0 7px 10px; border-left: 4px solid; margin-bottom: 10px;
}

.map-pop { min-width: 190px; font-size: 12.5px; }
.map-pop .mp-crew { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.map-pop .mp-lead { color: var(--text2); margin-top: 2px; }
.map-pop .mp-job { font-weight: 600; margin-top: 5px; }
.map-pop .mp-addr { color: var(--text3); margin-top: 3px; font-size: 11.5px; }

/* Leaflet popup restyle — rounded card + pop-in animation */
.leaflet-popup-content-wrapper { border-radius: 12px !important; box-shadow: var(--shadow-lg) !important; }
.leaflet-popup-content { margin: 12px 14px !important; }
.leaflet-popup-tip { box-shadow: none !important; }
.leaflet-popup { animation: popIn .16s cubic-bezier(.22,1.2,.36,1); }
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(4px); } to { opacity: 1; transform: none; } }

/* Fullscreen "TV mode" — hides chrome, enlarges the board for a wall display */
body.tv-mode,
body.tv-mode #main-wrap,
body.tv-mode #content,
body.tv-mode #dash-root {
  background: #ffffff !important;
  background-color: #ffffff !important;
}
body.tv-mode #topbar, body.tv-mode #sidebar, body.tv-mode #sidebar-overlay { display: none !important; }
body.tv-mode #main-wrap { margin-left: 0; padding-top: 0; }
body.tv-mode #content { padding: 16px 24px; max-width: none; }
body.tv-mode .page-head h1 { font-size: 26px; }
body.tv-mode .stat { padding: 12px 16px; }
body.tv-mode .stat .s-val { font-size: 26px; }
body.tv-mode .stat .s-lbl { font-size: 12px; }
body.tv-mode .crew-card .cc-top h3 { font-size: 16px; }
body.tv-mode .crew-card .job { font-size: 14px; }
body.tv-mode .crew-card .meta { font-size: 12px; }
body.tv-mode .div-section-head { font-size: 15px; }

.dash-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: stretch;
}
.dash-left {
  display: flex;
  flex-direction: column;
}
.dash-right {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.dash-right #crew-board-wrap {
  height: 100%;
}
@media (max-width: 1024px) {
  .dash-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Dynamic height fitting to screen */
body.tv-mode #dash-root {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 32px);
  box-sizing: border-box;
}
body.tv-mode #dash-root > .page-head,
body.tv-mode #dash-root > .stat-grid {
  flex-shrink: 0;
}
body.tv-mode .dash-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  min-height: 0;
  margin-bottom: 0;
  align-items: stretch;
}
body.tv-mode .dash-left,
body.tv-mode .dash-right {
  height: 100%;
  min-height: 0;
}
body.tv-mode .dash-left .panel {
  height: 100%;
  margin-bottom: 0 !important;
  display: flex;
  flex-direction: column;
}
body.tv-mode #crew-map {
  flex: 1 !important;
  height: auto !important;
}
body.tv-mode .dash-right #crew-board-wrap {
  overflow-y: auto;
  height: 100%;
  padding-right: 4px;
}

/* ── Custom Single-Select Dropdowns ────────────────────────────────────────── */
.select-dd { position: relative; display: block; width: 100%; }
.select-dd-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 7px;
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px; text-align: left; cursor: pointer; transition: border-color .12s;
  color: var(--text); box-sizing: border-box;
}
.select-dd-btn:hover { border-color: var(--text3); }
.select-dd-btn .chevron { color: var(--text3); display: flex; align-items: center; transform: rotate(90deg); margin-left: auto; }
.select-dd-btn .chevron svg { width: 12px; height: 12px; }
.select-dd-btn .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; }

.select-dd-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 70;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 220px; overflow-y: auto; padding: 4px;
  animation: ddIn .14s cubic-bezier(.22,1.2,.36,1); box-sizing: border-box;
}
.select-dd-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 5px;
  cursor: pointer; font-size: 13.5px; color: var(--text); box-sizing: border-box;
}
.select-dd-item:hover { background: var(--surface2); }
.select-dd-item.active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
.select-dd-item .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.select-dd-search-wrap {
  padding: 4px;
  border-bottom: 1px solid var(--line2);
  margin-bottom: 4px;
}
.select-dd-search-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  background: var(--surface2);
  color: var(--text);
  box-sizing: border-box;
}
.select-dd-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.select-dd-item.hidden {
  display: none !important;
}

/* ── Pulsing animations for active dashboard division and pins ───────────── */
@keyframes pulseTile {
  0% { transform: scale(1); box-shadow: 0 0 0 0 var(--pulse-color, rgba(0,0,0,0.3)); }
  55% { transform: scale(1.015); box-shadow: 0 0 0 10px rgba(0,0,0,0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}
.crew-card.pulse {
  animation: pulseTile 2s infinite ease-in-out;
  border: 2px solid var(--border-color) !important;
}

@keyframes pulsePin {
  0% { box-shadow: 0 0 0 0 var(--pulse-color); transform: scale(1); }
  55% { box-shadow: 0 0 0 16px rgba(0,0,0,0); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); transform: scale(1); }
}
.pulse-pin {
  animation: pulsePin 1.6s infinite ease-in-out;
}


