/* ==========================================================================
   TDB Properties — Business Suite
   Professional design system, branded to match tdbproperties.co.uk
   ========================================================================== */
:root {
  --bg: #f1f5fb;
  --bg-2: #e8eef9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #5b6b83;
  --accent: #16449e;
  --accent-2: #2563eb;
  --accent-3: #3b82f6;
  --accent-soft: #e6edfb;
  --navy-900: #0a1f4a;
  --navy-700: #0c2b66;
  --good: #16a34a;
  --good-soft: #e5f6ec;
  --warn: #d97706;
  --bad: #dc2626;
  --bad-soft: #fdecec;
  --line: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 3px 14px rgba(16, 38, 87, 0.08);
  --shadow-lg: 0 10px 30px rgba(16, 38, 87, 0.14);
  --radius: 16px;
  --radius-sm: 11px;
  --font-body: "DM Sans", "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Outfit", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--ink);
  font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Buttons ---------- */
.btn-primary {
  width: 100%; padding: 13px; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff; font-family: var(--font-body); font-size: 15px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(22, 68, 158, 0.28);
}
.btn-primary:active { transform: translateY(1px) scale(0.99); box-shadow: 0 2px 6px rgba(22, 68, 158, 0.25); }
.btn-ghost {
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  padding: 7px 13px; border-radius: 9px; font-size: 13px; font-family: var(--font-body); cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn-ghost:active { background: var(--bg); }
.btn-soft {
  background: var(--accent-soft); border: none; color: var(--accent);
  padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-soft:active { background: #d6e1fa; }
.btn-danger { background: var(--bad-soft); border: none; color: var(--bad); padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-danger:active { background: #fbd8d8; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ---------- Auth screen ---------- */
.screen {
  position: relative; min-height: 100vh; padding: 64px 22px 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 85% -10%, #2563eb55 0%, transparent 55%),
              radial-gradient(900px 500px at -10% 110%, #60a5fa44 0%, transparent 55%),
              linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 55%, #16449e 100%);
  overflow: hidden;
}
.screen::before, .screen::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.screen::before { width: 340px; height: 340px; right: -120px; top: -90px; background: radial-gradient(closest-side, #3b82f680, transparent); }
.screen::after { width: 420px; height: 420px; left: -180px; bottom: -160px; background: radial-gradient(closest-side, #1d4ed880, transparent); }
.auth-logo { position: relative; z-index: 1; }
.auth-logo img { width: 92px; height: 92px; background: #fff; padding: 7px; border-radius: 24px; box-shadow: 0 12px 34px rgba(0,0,0,0.35); border: 2px solid rgba(255,255,255,0.22); }
.auth-brand { position: relative; z-index: 1; margin-top: 20px; font-family: var(--font-display); font-size: 26px; font-weight: 700; color: #fff; text-align: center; letter-spacing: -0.3px; }
.auth-sub { position: relative; z-index: 1; color: #bcd0f2; margin-bottom: 30px; font-size: 14px; letter-spacing: 0.6px; text-transform: uppercase; font-weight: 500; }
.auth-box { position: relative; z-index: 1; width: 100%; max-width: 370px; background: var(--card); border-radius: 18px; padding: 26px; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,0.4); }
.auth-box h2 { font-size: 18px; font-family: var(--font-display); margin-bottom: 4px; }
.auth-hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.auth-box input {
  width: 100%; margin-bottom: 11px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px;
  font-size: 16px; background: #f8fafc; font-family: var(--font-body); color: var(--ink);
}
.auth-box input:focus { outline: none; border-color: var(--accent-3); box-shadow: 0 0 0 3px #2563eb2e; background: #fff; }
.auth-msg { position: relative; z-index: 1; margin-top: 16px; color: #ffd9d9; font-size: 14px; min-height: 20px; text-align: center; }
.remember-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin: 2px 0 14px; cursor: pointer; }
.remember-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-2); }

/* ---------- App shell ---------- */
.app { min-height: 100vh; padding-bottom: 82px; }
.layout { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(90deg, #0c2b66, #16449e 60%, #1d4ed8);
  padding: 10px 16px;
  box-shadow: 0 2px 14px rgba(10, 31, 74, 0.3);
}
.topbar-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo { width: 36px; height: 36px; background: #fff; border-radius: 10px; box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,0.25); }
.brand-name { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.1px; color: #bcd0f2; line-height: 1.1; }
.app-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: #ffffff; line-height: 1.15; letter-spacing: -0.2px; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.12); }
.topbar .btn-ghost:active { background: rgba(255,255,255,0.22); }
#main { padding: 18px 16px 10px; max-width: 760px; margin: 0 auto; width: 100%; }

/* Desktop sidebar */
.sidebar { display: none; }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 18px; }
.sb-brand .brand-logo { width: 42px; height: 42px; }
.sb-brand .brand-name { color: #fff; font-size: 12px; }
.sb-tag { font-size: 11px; color: #8fb0ee; margin-top: 1px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 0 4px; }
.sb-group { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: #6f8fc9; padding: 16px 10px 6px; }
.sb-nav .nav-btn {
  width: 100%; display: flex; flex-direction: row; align-items: center; gap: 12px;
  background: none; border: none; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 2px;
  color: rgba(255,255,255,0.72); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
}
.sb-nav .nav-btn::before { display: none; }
.sb-nav .nav-btn .nav-icon { height: 20px; }
.sb-nav .nav-btn .nav-icon svg { width: 20px; height: 20px; color: #9cb9f0; }
.sb-nav .nav-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sb-nav .nav-btn.active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #fff; }
.sb-nav .nav-btn.active .nav-icon svg { color: #fff; }
.sb-foot { border-top: 1px solid rgba(255,255,255,0.16); padding: 14px 6px 2px; }
.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(180deg,#3b82f6,#1d4ed8);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; letter-spacing: 0.5px;
}
.sb-username { font-size: 13px; color: #dbe6fb; font-weight: 600; }
.sb-logout { width: 100%; margin-top: 12px; color: #fff; border-color: rgba(255,255,255,0.35); background: rgba(255,255,255,0.1); }
.sb-logout:active { background: rgba(255,255,255,0.2); }

/* Desktop layout */
@media (min-width: 900px) {
  .layout { min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; width: 255px; flex-shrink: 0; height: 100vh; position: sticky; top: 0; background: linear-gradient(180deg, #0b2c66, #0a1f4a); color: #fff; padding: 18px 10px 14px; }
  #main { padding: 24px 28px 60px; max-width: 900px; }
  .bottomnav { display: none !important; }
  .app { padding-bottom: 0; }
  .topbar { border-radius: 0; }
}

/* ---------- Pull to refresh ---------- */
#ptr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 55;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 10px;
  pointer-events: none; opacity: 0; transform: translateY(0);
  will-change: transform, opacity; transition: opacity 0.18s ease;
}
.ptr-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: ptrspin 0.8s linear infinite;
  box-shadow: 0 4px 12px rgba(16,38,87,0.18); background: #fff;
}
@keyframes ptrspin { to { transform: rotate(360deg); } }
.ptr-text { font-size: 12px; font-weight: 600; color: var(--accent); background: #fff; padding: 2px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(16,38,87,0.14); }
.tb-refresh { font-size: 17px; line-height: 1; }
.tb-refresh.spinning { animation: ptrspin 0.7s linear infinite; }

/* ---------- Notifications ---------- */
.nf-bell { position: relative; font-size: 16px; line-height: 1; }
.nf-badge {
  position: absolute; top: -6px; right: -8px; min-width: 16px; height: 16px;
  line-height: 16px; padding: 0 4px; border-radius: 999px;
  background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.nf-unread { background: rgba(37,99,235,0.07); }
.nf-unread .li-title { color: #2563eb; }
.nf-toast {
  position: fixed; left: 12px; right: 12px; bottom: 76px; z-index: 1200;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  box-shadow: 0 10px 24px rgba(16,38,87,0.22);
  padding: 12px 14px; display: flex; gap: 12px; align-items: center;
  transform: translateY(16px); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.nf-toast.show { transform: none; opacity: 1; pointer-events: auto; }
.nf-toast-icon { font-size: 22px; line-height: 1; }
.nf-toast-body { flex: 1; min-width: 0; }

/* ---------- Screen headers ---------- */
.screen-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px;
  background: linear-gradient(90deg, #16449e, #2563eb); color: #fff;
  padding: 13px 16px; border-radius: 14px; box-shadow: 0 4px 14px rgba(22,68,158,0.22);
}
.screen-hd h2 { font-family: var(--font-display); font-size: 20px; letter-spacing: -0.3px; color: #fff; }
.screen-hd .btn-soft, .screen-hd .btn-primary { background: #fff; color: #16449e; width: auto; }
.screen-hd .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.1); }

/* Bottom nav */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: rgba(255,255,255,0.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(16,38,87,0.06);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav.admin-portal {
  overflow-x: auto; justify-content: flex-start; scrollbar-width: none;
}
.bottomnav.admin-portal::-webkit-scrollbar { display: none; }
.bottomnav.admin-portal .nav-btn { flex: 0 0 auto; min-width: 58px; }
.nav-btn {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; background: none; border: none; color: var(--muted);
  font-size: 11px; font-weight: 600; cursor: pointer;
}
.nav-btn::before {
  content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%) scale(0);
  width: 44px; height: 26px; border-radius: 999px; background: var(--accent-soft);
  transition: transform 0.16s ease; z-index: 0;
}
.nav-btn .nav-icon { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; height: 22px; }
.nav-btn .nav-icon svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--accent); }
.nav-btn.active::before { transform: translateX(-50%) scale(1); }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(226,232,240,0.7); padding: 16px; margin-bottom: 14px;
}
.card-title {
  font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.list-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 600; }
.li-sub { color: var(--muted); font-size: 13px; }
.li-right { text-align: right; flex-shrink: 0; }
.li-price { font-family: var(--font-display); font-weight: 700; }
.li-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Status pills */
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; vertical-align: middle; }
.pill.booked, .pill.draft, .pill.unpaid { background: #fef3c7; color: #92400e; }
.pill.confirmed, .pill.sent { background: #dbeafe; color: #1e40af; }
.pill.in-progress { background: #e0e7ff; color: #4338ca; }
.pill.completed, .pill.accepted, .pill.paid { background: #d1fae5; color: #065f46; }
.pill.cancelled, .pill.declined, .pill.expired { background: #fee2e2; color: #991b1b; }
.pill.invoiced, .pill.part-paid { background: #e2e8f0; color: #334155; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  position: relative; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(226,232,240,0.7); padding: 16px;
}
.stat::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(90deg, var(--accent-3), var(--accent)); }
.stat .stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.stat .stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; margin-top: 4px; letter-spacing: -0.5px; line-height: 1.1; }
.stat .stat-value.good { color: var(--good); }
.stat .stat-value.bad { color: var(--bad); }

/* Dashboard hero & quick actions */
.hero { background: linear-gradient(135deg, #0c2b66, #16449e 55%, #2563eb); color: #fff; border-radius: 18px; padding: 18px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(16,42,110,0.28); }
.hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.hero-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #bcd0f2; font-weight: 600; }
.hero-balance { font-family: var(--font-display); font-size: 34px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.05; }
.hero-month { font-size: 12px; color: #cdddf7; }
.hero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.hero-stat { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.16); border-radius: 12px; padding: 10px 12px; }
.hero-stat .hs-label { display: block; font-size: 11px; color: #c7d8f7; font-weight: 600; }
.hero-stat b { display: block; font-family: var(--font-display); font-size: 15px; margin-top: 2px; }
.hero-stat.in b { color: #86efac; }
.hero-stat.out b { color: #fca5a5; }
.hero-stat.net b { color: #ffffff; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.quick { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid rgba(226,232,240,0.7); border-radius: 14px; padding: 12px; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.08s ease; }
.quick:active { transform: scale(0.98); }
.quick-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.quick-label { font-weight: 600; font-size: 14px; }
@media (min-width: 700px) { .quick-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; }
.form label { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 4px; letter-spacing: 0.2px; }
.form input, .form select, .form textarea {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px;
  font-size: 16px; background: #f8fafc; font-family: var(--font-body); color: var(--ink);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent-3); box-shadow: 0 0 0 3px #2563eb2e; background: #fff; }
.form textarea { min-height: 70px; resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-row > div { flex: 1; min-width: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-actions .btn-primary { flex: 1; }

/* Line items */
.line-items { margin-top: 8px; }
.line-item { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.line-item input { padding: 9px; font-size: 15px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; font-family: var(--font-body); }
.line-item .li-desc { flex: 2; }
.line-item .li-qty { width: 56px; text-align: center; }
.line-item .li-price { width: 92px; text-align: right; }
.line-item .li-del { background: none; border: none; color: var(--bad); font-size: 18px; cursor: pointer; padding: 4px; }
.totals { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.totals .total-row { display: flex; justify-content: space-between; font-size: 14px; padding: 3px 0; }
.totals .total-row.grand { font-weight: 800; font-family: var(--font-display); font-size: 17px; color: var(--accent); }

/* Screen headers & empty */
.screen-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.screen-hd h2 { font-family: var(--font-display); font-size: 20px; letter-spacing: -0.3px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .empty-icon { font-size: 40px; margin-bottom: 8px; }

/* ---------- Modal (bottom sheet) ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 16, 40, 0.55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(2px); }
.modal { background: #fff; width: 100%; max-width: 680px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 22px 18px calc(28px + env(safe-area-inset-bottom)); animation: slideup 0.2s ease; position: relative; }
.modal::before { content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 40px; height: 5px; border-radius: 999px; background: var(--line); }
.modal-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-hd h3 { font-family: var(--font-display); font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 50%; }
.modal-close:active { background: var(--bg); }

/* Permission chips */
.perm-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.perm-chip { display: flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid rgba(226,232,240,0.8); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 500; cursor: pointer; }
.perm-chip input { accent-color: var(--accent); margin: 0; }
.perm-chip:has(input:checked) { background: var(--accent-soft); border-color: rgba(22,68,158,0.35); }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Settings rows & switch */
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: none; }
.set-row label { font-size: 15px; }
.switch { position: relative; width: 48px; height: 27px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: 0.2s; }
.switch .slider:before { content: ""; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(21px); }

/* Segmented control */
.seg { display: flex; background: #eef2f8; border-radius: 12px; padding: 3px; margin-bottom: 14px; gap: 3px; }
.seg-btn { flex: 1; border: none; background: transparent; padding: 9px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-btn.active { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }

/* Calendar / availability */
.cal-card { padding: 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav { background: #fff; border: 1px solid var(--line); border-radius: 9px; width: 36px; height: 36px; font-size: 18px; color: var(--accent); cursor: pointer; box-shadow: var(--shadow-sm); }
.cal-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--muted); text-transform: uppercase; font-weight: 600; padding-bottom: 4px; }
.cal-day { position: relative; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.cal-day.free { background: #fafcff; }
.cal-day.has { background: var(--accent-soft); border-color: var(--accent-3); }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-day.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.cal-blank { background: transparent; border: none; }
.cal-num { font-size: 14px; font-weight: 600; }
.cal-count { position: absolute; top: 3px; right: 5px; font-size: 10px; font-weight: 800; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 5px; }
.cal-free-dot { width: 5px; height: 5px; border-radius: 50%; background: #c3cbe0; }
.cal-day.has .cal-free-dot { display: none; }
.cal-legend { display: flex; gap: 14px; justify-content: center; margin-top: 12px; font-size: 11px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.cal-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cal-legend .d-has { background: var(--accent); }
.cal-legend .d-free { background: #c3cbe0; }
.cal-legend .d-today { background: #fff; border: 2px solid var(--accent); }

/* Transactions */
.txn { font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.txn.in { color: var(--good); }
.txn.out { color: var(--bad); }

/* ---------- Print ---------- */
@page { margin: 13mm; }
.print-doc { font-family: "DM Sans", "Helvetica Neue", Arial, sans-serif; color: #101828; font-size: 13px; }
.print-doc .pd-head { display: flex; justify-content: space-between; align-items: flex-start; background: linear-gradient(135deg, #0c2b66, #16449e); color: #fff; border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.print-doc .pd-brand img { height: 40px; border-radius: 8px; background: #fff; padding: 2px; }
.print-doc .pd-brand h1 { font-size: 19px; color: #fff; margin-top: 8px; font-weight: 700; }
.print-doc .pd-title { text-align: right; }
.print-doc .pd-title .pd-label { font-size: 11px; color: #bcd0f2; text-transform: uppercase; letter-spacing: 1.5px; }
.print-doc .pd-title .pd-number { font-size: 24px; font-weight: 800; font-family: Outfit, Arial, sans-serif; }
.print-doc .pd-meta { display: flex; gap: 24px; margin: 16px 0; }
.print-doc .pd-meta .block { flex: 1; }
.print-doc .pd-meta .b-label { font-size: 10px; color: #7c8aa5; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.print-doc .pd-meta .b-val { font-size: 14px; margin-top: 3px; white-space: pre-line; }
.print-doc table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.print-doc th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #fff; background: #16449e; padding: 8px 8px; }
.print-doc th:first-child { border-radius: 7px 0 0 0; }
.print-doc th:last-child { border-radius: 0 7px 0 0; }
.print-doc td { padding: 9px 8px; border-bottom: 1px solid #e5e9f2; }
.print-doc td.num, .print-doc th.num { text-align: right; }
.print-doc .pd-totals { width: auto; margin-left: auto; margin-top: 12px; border: 1px solid #dbe3f2; border-radius: 10px; overflow: hidden; }
.print-doc .pd-totals td { border-bottom: 1px solid #e5e9f2; padding: 6px 14px; }
.print-doc .pd-grand td { font-weight: 800; font-size: 16px; background: #eef3fc; color: #0c2b66; padding-top: 9px; padding-bottom: 9px; }
.print-doc .pd-notes { margin-top: 22px; border-top: 1px solid #e5e9f2; padding-top: 10px; font-size: 12px; color: #5b6b83; }
.print-doc .pd-section-hd { font-size: 11px; font-weight: 800; color: #0c2b66; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.print-doc .pd-pay { border-top: 1px solid #e5e9f2; font-size: 12px; color: #3c4b63; }
.print-doc .pd-foot { margin-top: 26px; font-size: 10px; color: #99a3b5; border-top: 1px solid #eef1f6; padding-top: 8px; }

@media print {
  body * { visibility: visible; }
  #screen-auth, #app, #bottomnav, .modal-overlay { display: none !important; }
  #print-root { display: block !important; position: absolute; top: 0; left: 0; width: 100%; }
  .print-doc { display: block !important; }
}

/* ---------- Tags ---------- */
.tag { display: inline-block; background: var(--accent-soft); color: var(--accent); border: 1px solid #c6d8f7; border-radius: 999px; font-size: 11px; font-weight: 600; padding: 2px 8px; margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.tag.ok { background: var(--good-soft); color: #1a7f4e; border-color: #b9e6cd; }

/* ---------- What's new banner ---------- */
.whatsnew { border: 1px solid #c6d8f7; background: linear-gradient(180deg, #eef4ff, #ffffff); }
.goodies { list-style: none; padding: 2px; }
.goodies li { padding: 5px 0 5px 24px; position: relative; font-size: 14px; }
.goodies li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 14px; height: 14px; border-radius: 50%; background: var(--good-soft); }
.goodies li::after { content: "✓"; position: absolute; left: 2px; top: 6px; width: 14px; text-align: center; font-size: 10px; color: var(--good); font-weight: 800; }

/* ---------- Money hub ---------- */
.hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.hub-tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; box-shadow: var(--shadow); transition: transform 0.08s ease, box-shadow 0.12s ease; }
.hub-tile:active { transform: scale(0.98); box-shadow: var(--shadow-sm); }
.hub-icon { font-size: 22px; margin-bottom: 6px; }
.hub-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.hub-value { font-family: var(--font-display); font-size: 19px; font-weight: 800; margin-top: 2px; letter-spacing: -0.3px; }
.hub-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Bar charts (reports / wages) ---------- */
.chart { padding-top: 4px; }
.chart-legend { display: flex; gap: 16px; justify-content: center; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .lg::before { content: ""; width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend .lg.in::before { background: var(--good); }
.chart-legend .lg.out::before { background: var(--bad); }
.chart-legend .lg.wage::before { background: var(--accent); }
.bc { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding: 8px 2px 0; overflow-x: auto; background: linear-gradient(180deg, #fbfcff, #f4f7fd); border-radius: 12px; }
.bc-col { flex: 0 0 8.333%; min-width: 34px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bc-bars { width: 100%; max-width: 42px; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar { width: 42%; border-radius: 6px 6px 0 0; transition: height 0.25s ease; }
.bar.in { background: linear-gradient(180deg, #22c55e, #16a34a); }
.bar.out { background: linear-gradient(180deg, #f87171, #dc2626); }
.bar.wage { background: linear-gradient(180deg, #3b82f6, #16449e); width: 62%; }
.bc-bars:hover .bar { filter: brightness(1.05); }
.bc-label { font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; font-weight: 600; }

/* ---------- Employee portal ---------- */
.viewas { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 12px; }
.viewas select { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-weight: 600; background: var(--accent-soft); color: var(--text); }

.portal-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 12px; margin-bottom: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-weight: 700; color: var(--text); text-align: left; cursor: pointer; }
.portal-btn:active { background: var(--accent-soft); border-color: var(--accent-3); }
.portal-btn .pb-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }
.portal-btn .pb-ct { flex: 1; }
.portal-btn .pb-ct small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.portal-btn .chev { color: var(--muted); font-size: 16px; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-grid + .photo-grid { margin-top: 8px; }
.ph { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; line-height: 18px; border-radius: 50%; border: none; background: rgba(0,0,0,0.55); color: #fff; font-size: 13px; cursor: pointer; padding: 0; }
.ph.large { width: 104px; height: 104px; border-radius: 12px; }
.issue-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }

/* ---------- Rota grid ---------- */
.rota-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rota-grid { min-width: 720px; display: grid; grid-template-columns: 96px repeat(7, 1fr); gap: 4px; }
.rg-hd, .rg-emp, .rg-cell { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px; }
.rg-emp { display: flex; align-items: center; font-weight: 700; font-size: 13px; line-height: 1.2; }
.rg-day { text-align: center; background: var(--accent-soft); border-color: var(--accent-3); }
.rg-dow { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--accent); letter-spacing: 0.3px; }
.rg-date { font-size: 12px; font-weight: 600; }
.rg-jobs { display: inline-block; margin-top: 3px; font-size: 10px; font-weight: 800; background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 7px; }
.rg-cell select { width: 100%; border: none; background: transparent; font-size: 12px; font-weight: 600; color: var(--ink); outline: none; -webkit-appearance: none; padding: 2px; text-align: center; }
.rg-cell.working { background: #d9f3e3; }
.rg-cell.half { background: #fdeecb; }
.rg-cell.holiday { background: #d8e6fd; }
.rg-cell.off { background: #eef1f6; color: var(--muted); }

.rota-pill { display: inline-block; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rota-pill.working { background: #d9f3e3; color: #0b682f; }
.rota-pill.half { background: #fdeecb; color: #8a5b00; }
.rota-pill.holiday { background: #d8e6fd; color: #1a56d6; }
.rota-pill.off { background: #eef1f6; color: #6b7280; }
.rota-pill.none { background: var(--accent-soft); color: var(--muted); }

/* ---------- Email ---------- */
.email-unread { font-weight: 800; }
.dot-unread { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; flex: none; }
.email-text { white-space: pre-wrap; word-break: break-word; }
.email-html { word-break: break-word; }
.email-html img { max-width: 100%; height: auto; }
.email-html a { color: var(--accent); }
.email-html table { max-width: 100%; }
.email-html p { margin: 0 0 10px; }

/* Scrollbars (webkit) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d3e6; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* Desktop polish */
@media (min-width: 700px) {
  .nav-btn:hover { color: var(--accent); }
  .card:hover { box-shadow: 0 6px 20px rgba(16,38,87,0.1); }
}

/* ---------- Waze-style tracking map ---------- */
.wz-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.wz-tools-label { font-size: 13px; color: var(--muted); }
.wz-chip {
  background: #fff; border: 1px solid var(--line); color: #334155;
  padding: 6px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-body); box-shadow: var(--shadow-sm);
}
.wz-chip:active { background: var(--bg); }
.wz-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.wz-pin {
  width: 26px; height: 26px; border-radius: 50%; background: #64748b; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.wz-cam { background: #111827; font-size: 13px; }
.wz-car { position: relative; width: 34px; height: 46px; }
.wz-car-svg { position: absolute; left: 2px; top: 3px; transform-origin: 50% 50%; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.wz-badge {
  position: absolute; left: 50%; top: -3px; transform: translateX(-50%);
  min-width: 18px; height: 18px; padding: 0 3px; border-radius: 999px;
  color: #fff; font: 700 10px/14px var(--font-body); text-align: center;
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.leaflet-wz-base-pane.wz-dark { filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9); }

/* ---------- Crew sidebar / profiles ---------- */
.wz-shell { display: flex; flex-direction: column; gap: 10px; }
.wz-mapwrap { min-width: 0; }
.wz-map { height: 420px; border-radius: 14px; overflow: hidden; border: 1px solid #e2e8f0; }
.wz-people { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch; }
.wz-person {
  display: flex; align-items: center; gap: 9px; flex: 0 0 auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 11px; cursor: pointer; box-shadow: var(--shadow-sm); min-width: 156px;
}
.wz-person:active { background: var(--bg); }
.wz-person.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.18); }
.wz-person-info { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.wz-person-info b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.wz-person-info small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.wz-avatar {
  position: relative; flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  color: #fff; font: 700 12px/34px var(--font-body); text-align: center; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.wz-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; background: #94a3b8; }
.wz-dot.moving { background: #16a34a; }
.wz-empty-people { font-size: 12.5px; color: var(--muted); padding: 6px 2px; }
@media (min-width: 860px) {
  .wz-shell { flex-direction: row; align-items: stretch; }
  .wz-people { flex-direction: column; overflow-x: visible; overflow-y: auto; max-height: 460px; width: 216px; flex: 0 0 216px; padding-right: 2px; }
  .wz-mapwrap { flex: 1; }
  .wz-map { height: 460px; }
  .wz-person { min-width: 0; }
}

/* ---------- Employee tracking notice ---------- */
.trk-notice { margin: 6px 0 2px; padding-left: 18px; }
.trk-notice li { font-size: 12.5px; color: var(--muted); margin: 3px 0; line-height: 1.45; }
.consent-row {
  display: flex; gap: 9px; align-items: flex-start; margin: 10px 0 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  font-size: 12.5px; line-height: 1.45; cursor: pointer;
}
.consent-row input { margin-top: 2px; flex: 0 0 auto; width: 18px; height: 18px; }
.trk-consented { font-size: 12px; color: var(--good); padding-top: 6px; }