/* Shared workspace presentation for the owner, crew, entry, and office screens. */
html:not([data-theme="dark"]) { --text-muted:#65748a; --border:#dfe5ed; --border-light:#edf1f6; }
html[data-theme="dark"] { --text-muted:#9aa9be; --text-secondary:#b7c3d4; --border-light:#2a374b; }
:is(.crm-admin,.crm-portal) { line-height:1.6; }
:is(.crm-admin,.crm-portal) :is(button,input,select,textarea) { font-family:inherit; }
:is(.crm-admin,.crm-portal) :is(button,a,input,select,textarea,summary):focus-visible { outline:3px solid var(--primary); outline-offset:3px; }
:is(.crm-admin,.crm-portal) :is(button,a) { touch-action:manipulation; }
:is(.crm-admin,.crm-portal) :is(.stat-card,.card,.sec-card,.job-card,.list-item,.modal,.sheet-card) { min-width:0; }
:is(.crm-admin,.crm-portal) :is(.sc-value,.sc-val,.job-price,.owed-amt,td,.pay-amount) { font-variant-numeric:tabular-nums; }
:is(.crm-admin,.crm-portal) :is(.form-control,textarea,select) { border-radius:10px; min-height:44px; box-shadow:none; }
:is(.crm-admin,.crm-portal) textarea { line-height:1.6; }
:is(.crm-admin,.crm-portal) :is(.form-label,.ad-label) { text-transform:none; letter-spacing:0; font-weight:600; color:var(--text-secondary); }
:is(.crm-admin,.crm-portal) :is(.btn,.contact-btn,.seg-btn,.submit-btn,.logout-btn) { border-radius:10px; font-weight:600; }
:is(.crm-admin,.crm-portal) :is(.empty-state,.empty) { padding:36px 20px; background:var(--card); border:1px dashed var(--border); border-radius:14px; color:var(--text-muted); }
:is(.crm-admin,.crm-portal) .table-wrap { overflow-x:auto; overscroll-behavior-x:contain; }
:is(.crm-admin,.crm-portal) table { font-size:.88rem; }
:is(.crm-admin,.crm-portal) th { padding:13px 16px; background:var(--bg); color:var(--text-secondary); font-size:.7rem; font-weight:600; letter-spacing:.04em; white-space:nowrap; }
:is(.crm-admin,.crm-portal) td { padding:15px 16px; line-height:1.5; }
:is(.crm-admin,.crm-portal) tbody tr:nth-child(even) td { background:color-mix(in srgb,var(--bg) 45%,transparent); }
/* Owner workspace */
.crm-admin #main-content > .section { max-width:1440px; margin-inline:auto; }
.crm-admin #utilbar { max-width:1440px; margin-inline:auto; margin-bottom:24px; }
.crm-admin .page-header { align-items:center; flex-wrap:wrap; gap:16px; padding-bottom:22px; margin-bottom:22px; border-bottom:1px solid var(--border); }
.crm-admin .page-header h1 { font-size:clamp(1.65rem,2.4vw,2rem); line-height:1.25; font-weight:700; letter-spacing:-.04em; }
.crm-admin .page-header .subtitle { margin-top:7px; max-width:680px; font-size:.9rem; line-height:1.6; }
.crm-admin :is(.card,.stat-card,.list-item) { border:1px solid var(--border); border-radius:14px; background:var(--card); box-shadow:none; }
.crm-admin .card { padding:22px; }
.crm-admin .card-header { gap:12px; flex-wrap:wrap; padding-bottom:14px; margin-bottom:14px; border-bottom:1px solid var(--border); }
.crm-admin .card-title { font-size:1rem; font-weight:650; letter-spacing:-.015em; }
.crm-admin .card-grid { gap:18px; }
.crm-admin .stats-grid { gap:14px; margin-bottom:22px; }
.crm-admin .stat-card { display:flex; flex-direction:column; gap:10px; padding:20px 22px; }
.crm-admin .stat-card::after,.crm-admin .stat-card::before,.crm-admin .stat-card .sc-icon { display:none; }
.crm-admin .stat-card .sc-label { order:-1; text-transform:none; letter-spacing:0; font-size:.8rem; line-height:1.5; color:var(--text-secondary); }
.crm-admin .stat-card .sc-value { font-size:clamp(1.45rem,2.1vw,2rem); letter-spacing:-.04em; line-height:1.25; color:var(--text); overflow-wrap:anywhere; }
.crm-admin .tabs { padding:6px; gap:4px; border:1px solid var(--border); border-radius:14px; background:var(--card); margin-bottom:20px; }
.crm-admin .tab-btn { padding:11px 16px; border-radius:9px; border:0; font-size:.84rem; }
.crm-admin .tab-btn.active { background:var(--primary-bg); color:var(--primary-dark); box-shadow:none; }
.crm-admin .tab-btn.active::after { display:none; }
.crm-admin .search-wrap { margin-bottom:20px; }
.crm-admin .search-wrap .form-control { background:var(--card); }
.crm-admin .list-item { padding:18px 20px; align-items:flex-start; gap:14px; }
.crm-admin .list-item-title { font-size:.98rem; line-height:1.5; letter-spacing:-.01em; }
.crm-admin .list-item-sub { font-size:.83rem; line-height:1.6; color:var(--text-secondary); margin-top:3px; }
.crm-admin .list-item-meta { row-gap:8px; flex-wrap:wrap; }
.crm-admin .list-item-actions { gap:8px; flex-wrap:wrap; }
.crm-admin .list-item-icon { width:36px; height:36px; border-radius:10px; font-size:1rem; flex-shrink:0; }
.crm-admin .section-label { font-size:.73rem; font-weight:650; letter-spacing:.07em; margin-top:24px; margin-bottom:12px; }
.crm-admin .badge { font-size:.72rem; font-weight:600; padding:4px 9px; line-height:1.4; }
.crm-admin .btn { min-height:40px; box-shadow:none; }
.crm-admin .btn-sm { min-height:36px; }
.crm-admin .modal { border:1px solid var(--border); border-radius:18px; }
.crm-admin .modal-header { padding:22px 24px; border-bottom:1px solid var(--border); }
.crm-admin .modal-body { padding:22px 24px; }
.crm-admin .modal-footer { padding:18px 24px; gap:10px; }
.crm-admin #sidebar nav a { padding:11px 13px; margin-bottom:4px; border-radius:10px; }
.crm-admin .sidebar-logo { padding:24px 22px; }
.crm-admin .sidebar-logo .logo-sub { letter-spacing:.12em; font-size:.65rem; }
.crm-admin :is(.wk-grid,.cal-grid,.week-grid) { font-variant-numeric:tabular-nums; }
.crm-admin .cal-day { min-height:105px; }
.crm-admin .cal-chip { padding:5px 7px; line-height:1.4; }
.crm-admin .wk-gjob { box-shadow:none; }
.crm-admin :is(.note-box,.report-alert) { border-radius:10px; line-height:1.6; }
/* Crew workspace: technicians, salespeople, drivers, and owner previews. */
.crm-portal { --portal-header:76px; font-size:15px; }
.crm-portal > header { height:var(--portal-header); padding:12px max(16px,calc((100vw - 1000px)/2)); gap:12px; }
.crm-portal .header-name { font-size:.95rem; letter-spacing:-.02em; }
.crm-portal .header-sub { font-size:.76rem; }
.crm-portal .header-acts { gap:6px; }
.crm-portal > .tabs { top:var(--portal-header); padding:8px max(12px,calc((100vw - 1000px)/2)); gap:5px; overflow:visible; flex-wrap:wrap; }
.crm-portal .tab { display:inline-flex; justify-content:center; align-items:center; gap:7px; flex:1 1 auto; min-height:44px; padding:10px 12px; border:0; margin:0; border-radius:10px; color:var(--text-secondary); font-size:.84rem; }
.crm-portal .tab.active { background:var(--primary-bg); color:var(--primary-dark); }
.crm-portal .portal-heading { max-width:1032px; margin:0 auto; padding:26px 16px 0; }
.crm-portal .portal-kicker { font-size:.65rem; font-weight:700; letter-spacing:.14em; color:var(--primary-dark); margin-bottom:7px; }
.crm-portal .portal-heading h1 { font-size:1.65rem; line-height:1.3; letter-spacing:-.035em; margin:0 0 7px; }
.crm-portal .portal-heading p { font-size:.87rem; color:var(--text-secondary); line-height:1.6; }
.crm-portal main { max-width:1032px; padding:22px 16px 40px; }
.crm-portal :is(.job-card,.sec-card,.goal-card,.owed-card,.src-card,.split-mine) { border:1px solid var(--border); background:var(--card); border-radius:14px; box-shadow:none; }
/* A stat card with no tone gets the plain treatment. One that has been given
   a tone keeps it — this rule used to catch those too, which left four
   identical white cards and made the emoji the only thing telling them
   apart (and the emoji is hidden just below). */
.crm-portal .stat-card:not(.blue):not(.amber):not(.green):not(.purple) { border:1px solid var(--border); background:var(--card); border-radius:14px; box-shadow:none; }
.crm-portal .stat-card:is(.blue,.amber,.green,.purple) { border-radius:14px; box-shadow:none; }
.crm-portal :is(.job-card,.sec-card,.goal-card,.src-card) { padding:20px; margin-bottom:16px; }
.crm-portal .stat-card { padding:18px 20px; display:flex; flex-direction:column; gap:8px; }
.crm-portal .stat-card .sc-icon { display:none; }
/* These cards already carry a colour class. The label was told to forget it,
   which left four identical grey captions over four different numbers. */
.crm-portal .stat-card .sc-label { order:-1; font-size:.74rem; font-weight:700;
  text-transform:uppercase; letter-spacing:.05em; }
.crm-portal .stat-card .sc-val { font-size:1.8rem; letter-spacing:-.035em; color:var(--text); line-height:1.3; }
.crm-portal .owed-card { padding:24px; border-top:3px solid var(--primary); }
.crm-portal .owed-label { text-transform:none; font-size:.85rem; letter-spacing:0; }
.crm-portal .owed-amt { font-size:2.5rem; letter-spacing:-.04em; line-height:1.4; }
.crm-portal .job-customer { font-size:1.05rem; line-height:1.5; }
.crm-portal .job-addr { white-space:normal; overflow:visible; font-size:.88rem; line-height:1.5; color:var(--text-secondary); }
.crm-portal .job-date { color:var(--primary-dark); font-size:.87rem; margin-top:4px; }
.crm-portal .job-price { color:var(--text); font-size:.96rem; }
.crm-portal .job-icon { width:36px; height:36px; border-radius:10px; }
.crm-portal .contact-row { margin-top:14px; gap:8px; }
.crm-portal .contact-btn { min-height:44px; padding:11px 15px; }
.crm-portal .job-actions { gap:8px; margin-top:14px; }
.crm-portal .job-actions button { min-height:44px; }
.crm-portal .job-notes-section { margin-top:16px; padding-top:16px; }
.crm-portal .job-notes-section textarea { font-size:1rem; min-height:76px; }
.crm-portal .save-note-btn { min-height:40px; padding:9px 14px; border-radius:9px; }
.crm-portal .section-label { font-size:.73rem; color:var(--text-secondary); margin:24px 0 12px; }
.crm-portal .seg { padding:5px; background:var(--card); border:1px solid var(--border); border-radius:12px; margin-bottom:20px; gap:4px; }
.crm-portal .seg-btn { padding:10px 12px; font-size:.83rem; }
.crm-portal .seg-btn.on { background:var(--primary-bg); color:var(--primary-dark); box-shadow:none; }
/* Sizing only. The weather card's colour lives with the component in
   employee.html, where its icon and sub-text can be kept in agreement. */
.crm-portal .weather-card { border-radius:14px; }
.crm-portal .weather-temp { font-weight:650; font-size:1.8rem; }
/* Sizing only — see employee.html for why this one is amber. */
.crm-portal .countdown-banner { border-radius:14px; }
.crm-portal .goal-bar-fill { background:var(--primary); }
.crm-portal .viewas-bar { font-size:.8rem; padding:10px 16px; line-height:1.5; }
.crm-portal .viewas-bar button { min-height:36px; }
.crm-portal :is(.submit-btn,.sheet-go,.sheet-cancel) { min-height:46px; border-radius:10px; }
.crm-portal .sheet-card { border:1px solid var(--border); padding:24px 20px calc(24px + env(safe-area-inset-bottom,0px)); }
/* Entry screen */
.crm-login { background:#f3f6fa; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
.crm-login .card { max-width:420px; border:1px solid #dfe5ed; border-radius:18px; box-shadow:0 12px 36px #1723380a; padding:36px; }
.crm-login .logo-name { font-size:1.35rem; letter-spacing:-.035em; font-weight:700; }
.crm-login .logo-sub { line-height:1.6; margin-top:8px; }
.crm-login input { min-height:48px; border-width:1px; border-radius:10px; }
.crm-login button { min-height:48px; border-radius:10px; }
.crm-login :is(input,button):focus-visible { outline:3px solid #93c5fd; outline-offset:3px; }
/* Office display retains its large-screen layout. */
.crm-wall .tile { background:var(--panel); border:1px solid var(--line); border-radius:14px; box-shadow:none; }
.crm-wall .tile .v { color:var(--text); letter-spacing:-.035em; }
.crm-wall .panel h2 { text-transform:none; letter-spacing:0; font-weight:600; }
.crm-wall .panel { border-radius:14px; }
@media (min-width:768px) {
  .crm-admin #main-content { padding:30px 32px 48px; }
  .crm-portal .stat-row { gap:16px; }
  .crm-portal .sheet-card { max-width:620px; margin-inline:auto; }
}
@media (max-width:767px) {
  .crm-admin .page-header { align-items:flex-start; padding-bottom:18px; }
  .crm-admin .page-header > div:last-child { flex-wrap:wrap; gap:8px; }
  .crm-admin .card,.crm-admin .stat-card { padding:16px; }
  .crm-admin .list-item { padding:16px; gap:10px; }
  .crm-admin :is(.btn,.btn-sm) { min-height:44px; }
  .crm-admin .tab-btn { padding:11px 12px; min-height:44px; }
  .crm-admin .tabs { gap:4px; }
  .crm-admin :is(.form-control,select,textarea) { font-size:16px; }
  .crm-admin .modal-body { padding:18px; }
  .crm-admin .modal-header,.crm-admin .modal-footer { padding:16px 18px; }
  .crm-admin .cal-day { min-height:82px; }
  .crm-admin .cal-chip { padding:3px; }
  .crm-portal > .tabs { gap:3px; padding-inline:8px; }
  .crm-portal .tab { flex:1 1 0; min-width:0; flex-direction:column; gap:4px; padding:9px 3px; font-size:.72rem; }
  .crm-portal .tab svg { width:17px; height:17px; }
  .crm-portal .header-name { font-size:.86rem; }
  .crm-portal .header-brand { gap:8px; min-width:0; }
  .crm-portal .logout-btn { padding:8px 10px; font-size:.75rem; min-height:40px; }
  .crm-portal .portal-heading { padding-top:22px; }
  .crm-portal :is(.job-card,.sec-card,.goal-card,.src-card) { padding:16px; }
  .crm-portal .job-card-top { gap:10px; }
  .crm-portal :is(.form-control,input,select,textarea) { font-size:16px; }
  .crm-login .card { padding:28px 24px; }
}
@media (prefers-reduced-motion:reduce) {
  :is(.crm-admin,.crm-portal) *, :is(.crm-admin,.crm-portal) *::before, :is(.crm-admin,.crm-portal) *::after { scroll-behavior:auto !important; transition-duration:.01ms !important; animation-duration:.01ms !important; }
}
/* Keep diagnostic controls and finished work available without competing with today's work. */
:is(.crm-admin,.crm-portal) .notification-details { background:var(--card); border:1px solid var(--border); border-radius:10px; margin-bottom:18px; }
:is(.crm-admin,.crm-portal) .notification-details > summary { padding:11px 16px; color:var(--text-secondary); cursor:pointer; font-size:.8rem; }
:is(.crm-admin,.crm-portal) .notification-details .nf-row { margin:0; border:0; background:var(--card); color:var(--text-secondary); }
.crm-portal > .tabs { border-radius:0; }
.crm-portal .crew-greet { text-align:left; padding:0 0 16px; }
.crm-portal .crew-hello { color:var(--text); }
/* The tiles keep this file's sizing and spacing, but the colour comes from
   employee.html — a wall of identical white cards gives "nothing on" the same
   weight as "you are owed $4,795", which is the one thing the screen is for.
   Only the tone of a tile is left to say which is which. */
.crm-portal .ctile { border-radius:14px; padding:18px; }
.crm-portal .ctile-label { font-size:.72rem; font-weight:700; letter-spacing:.05em;
  text-transform:uppercase; }
.crm-portal .ctile-value { color:var(--text); font-size:1.65rem; font-weight:700; margin-top:8px; line-height:1.4; }
.crm-portal .ctile-sub { white-space:normal; font-size:.78rem; margin-top:6px; }
.crm-portal .portal-history { border:1px solid var(--border); border-radius:14px; padding:0 16px; margin:24px 0; background:var(--card); }
.crm-portal .portal-history > summary { padding:18px 0; cursor:pointer; font-weight:600; }
.crm-portal .portal-history > summary span { float:right; font-weight:400; color:var(--text-muted); font-size:.8rem; }
.crm-portal input:not([type=checkbox]):not([type=radio]),.crm-portal select { border-radius:10px; }
@media (min-width:900px) { .crm-portal .ctiles { grid-template-columns:repeat(4,minmax(0,1fr)); } }

/* Phone controls, safe areas, and keyboard-friendly dialogs. */
@media (max-width:767px) {
  .crm-admin #topbar { padding-inline:12px; gap:8px; }
  .crm-admin #topbar .tb-brand { min-width:0; gap:7px; }
  .crm-admin #topbar .tb-brand img { height:26px !important; max-width:42px; object-fit:contain; }
  .crm-admin #topbar .tb-name { font-size:.8rem; line-height:1.25; }
  .crm-admin #topbar > div:last-child { gap:2px !important; flex-shrink:0; }
  .crm-admin :is(#hamburger-btn,#search-btn-mobile,#dark-toggle-mobile,#drawer-close,#modal-close) { width:44px; height:44px; flex-shrink:0; }
  .crm-admin #drawer { max-width:calc(100vw - 32px); padding-bottom:env(safe-area-inset-bottom,0px); }
  .crm-admin #drawer nav a { min-height:48px; }
  .crm-admin #bottom-nav { height:calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px)); }
  .crm-admin #bottom-nav a { min-height:48px; font-size:.7rem; }
  .crm-admin #main-content { min-width:0; padding-bottom:calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px) + 88px); }
  .crm-admin :is(#quick-add-btn,#ai-btn) { bottom:calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px) + 14px); }
  .crm-admin .list-item { flex-wrap:wrap; }
  .crm-admin .list-item-content { min-width:0; overflow-wrap:anywhere; }
  .crm-admin .list-item-actions { width:100%; justify-content:flex-start; }
  .crm-admin .page-header > div { min-width:0; max-width:100%; }
  .crm-admin #modal-overlay { padding:8px; }
  .crm-admin #modal { max-height:calc(100dvh - 16px); display:flex; flex-direction:column; margin:auto; }
  .crm-admin #modal-header { padding:12px 16px; gap:8px; flex-shrink:0; }
  .crm-admin #modal-body { padding:16px; overflow-y:auto; overscroll-behavior:contain; min-height:0; }
  .crm-admin #modal-footer { padding:12px 16px max(12px,env(safe-area-inset-bottom,0px)); flex-wrap:wrap; flex-shrink:0; }
  .crm-admin #modal-footer .btn { flex:1 1 120px; white-space:normal; }
  .crm-admin .wk-grid { min-width:840px; }
  .crm-admin .wk-grid-wrap::before { content:'Swipe sideways to see every day, or choose List.'; display:block; margin-bottom:10px; color:var(--text-muted); font-size:.8rem; }
  .crm-admin .table-wrap { max-width:100%; }
  .crm-admin .form-row { grid-template-columns:minmax(0,1fr); }
  .crm-portal { --portal-header:80px; }
  .crm-portal > header { padding:10px 12px; gap:8px; }
  .crm-portal .header-brand { flex:1; min-width:0; }
  .crm-portal .header-brand img { height:28px !important; max-width:42px; object-fit:contain; }
  .crm-portal .header-brand > div { min-width:0; }
  .crm-portal .header-name { font-size:.78rem; line-height:1.3; }
  .crm-portal .header-sub { font-size:.7rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .crm-portal .header-acts { flex-shrink:0; gap:2px; }
  .crm-portal .theme-btn { width:44px; height:44px; }
  .crm-portal .logout-btn { min-height:44px; white-space:nowrap; padding-inline:8px; }
  .crm-portal > .tabs { padding-block:5px; }
  .crm-portal main { padding-bottom:calc(32px + env(safe-area-inset-bottom,0px)); }
  .crm-portal :is(.seg-btn,.dv-nav,.save-note-btn) { min-height:44px; }
  .crm-portal .contact-btn { flex:1 1 110px; justify-content:center; }
  .crm-portal .job-card-top > div { min-width:0; overflow-wrap:anywhere; }
  .crm-portal .slot-grid { grid-template-columns:repeat(3,minmax(0,1fr)); padding:12px; }
  .crm-portal .sheet-card { max-height:calc(100dvh - 16px); overscroll-behavior:contain; }
  .crm-portal .viewas-bar { display:flex; flex-wrap:wrap; align-items:center; gap:5px; padding:8px 12px; }
  .crm-portal .viewas-bar button { min-height:44px; margin-left:auto; }
  .crm-login { min-height:100dvh; padding:20px 16px; }
  .crm-login input { font-size:16px; }
  :is(.crm-admin,.crm-portal) :is(input,select,textarea) { scroll-margin-block:150px 100px; max-width:100%; }
}
@media (max-width:767px) and (max-height:500px) {
  .crm-portal > header { position:relative; }
  .crm-portal > .tabs { top:0; }
  .crm-admin #modal-header { padding-block:6px; }
  .crm-admin #modal-footer { padding-block:6px; }
}
@media (max-width:359px) {
  .crm-portal .header-brand img { display:none !important; }
  .crm-portal .slot-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .crm-admin .stats-grid { gap:8px; }
  .crm-admin .stat-card { padding:12px; }
}

html[data-theme="dark"] .crm-admin :is(.nf-row,.tab-btn.active,.report-tab.active) { color:#93c5fd; }
@media (max-width:767px) {
  .crm-admin .nf-row { color:var(--text); }
  .crm-admin .nf-row button { min-height:44px; }
}
@media (max-width:767px) {
  .crm-admin .top-seller { flex-wrap:wrap; }
  .crm-admin .top-seller > div { min-width:0; }
  .crm-admin .ts-action { flex-basis:100%; margin-left:0; text-align:left; }
  .crm-admin .ts-hint { max-width:none; }
  .crm-admin .list-item-body { overflow-wrap:anywhere; }
}

.cal-phone-count { display:none; }
@media (max-width:767px) {
  .crm-admin .cal-nav { flex-wrap:wrap; gap:10px; }
  .crm-admin .cal-nav > div { flex-wrap:wrap; }
  .crm-admin .cal-nav .cal-title { flex:1 1 100%; order:-1; text-align:left; }
  .crm-admin .cal-day { min-height:66px; padding:5px 2px; }
  .crm-admin .cal-day-top { justify-content:center; }
  .crm-admin .cal-day :is(.cal-chip,.cal-more,.cal-day-money), .crm-admin .cal-desktop-hint { display:none; }
  .crm-admin .cal-phone-count { display:block; font-size:.62rem; line-height:1.5; text-align:center; color:var(--text-secondary); margin-top:4px; }
  .crm-admin .cal-grid { gap:3px; }
  .crm-admin .cal-hdr { padding-inline:0; font-size:.65rem; }
}

/* Compact phone density, requested by the owner. Desktop spacing stays independent. */
@media (max-width:767px) {
  html { font-size:14px; }
  :is(.crm-admin,.crm-portal) { font-size:13px; line-height:1.4; }
  .crm-admin { --topbar-h:52px; --bottomnav-h:52px; }
  .crm-admin #main-content { padding-top:calc(var(--topbar-h) + 12px); padding-inline:10px; }
  .crm-admin .page-header { gap:8px; margin-bottom:12px; padding-bottom:12px; }
  .crm-admin .page-header h1 { font-size:1.5rem; }
  .crm-admin .page-header .subtitle { margin-top:4px; font-size:.85rem; line-height:1.4; }
  .crm-admin :is(.card,.stat-card,.list-item) { padding:10px 12px; border-radius:10px; }
  .crm-admin :is(.stats-grid,.card-grid) { gap:8px; margin-bottom:12px; }
  .crm-admin .stat-card { gap:5px; }
  .crm-admin .stat-card .sc-value { font-size:1.5rem; }
  .crm-admin .card-header { padding-bottom:8px; margin-bottom:8px; }
  .crm-admin .list-item { gap:8px; margin-bottom:8px; }
  .crm-admin .list-item-sub { margin-top:2px; line-height:1.4; }
  .crm-admin .list-item-icon { width:28px; height:28px; }
  .crm-admin .list-item-meta,.crm-admin .list-item-actions { gap:5px; }
  .crm-admin .tabs { padding:3px; gap:2px; margin-bottom:12px; border-radius:10px; }
  .crm-admin .tab-btn { min-height:38px; padding:7px 9px; font-size:.85rem; }
  .crm-admin :is(.btn,.btn-sm) { min-height:38px; padding:7px 10px; font-size:.85rem; }
  .crm-admin .badge { padding:3px 6px; }
  .crm-admin .search-wrap { margin-bottom:12px; }
  .crm-admin .section-label { margin:14px 0 8px; }
  .crm-admin #bottom-nav a { min-height:44px; padding:3px 2px; gap:2px; font-size:.72rem; }
  .crm-admin #drawer nav a { min-height:44px; padding-block:8px; }
  .crm-admin :is(#quick-add-btn,#ai-btn) { width:42px; height:42px; }
  .crm-admin .cal-day { min-height:52px; }
  .crm-admin .cal-nav { gap:6px; }
  .crm-admin #modal-header,.crm-admin #modal-footer { padding:8px 12px; }
  .crm-admin #modal-body { padding:12px; }
  .crm-admin .form-group { margin-bottom:10px; }
  .crm-admin .form-row { gap:8px; }
  :is(.crm-admin,.crm-portal) :is(th,td) { padding:8px 10px; line-height:1.4; }
  :is(.crm-admin,.crm-portal) .notification-details { margin-bottom:10px; }
  :is(.crm-admin,.crm-portal) .notification-details > summary { padding:7px 12px; min-height:36px; }
  :is(.crm-admin,.crm-portal) .nf-row { padding:10px 12px; margin-bottom:10px; font-size:.85rem; }
  .crm-admin #section-reports .reports-header { margin-bottom:12px; gap:8px; }
  .crm-admin #section-reports .reports-header h1 { font-size:1.6rem; }
  .crm-admin #section-reports .reports-eyebrow { margin-bottom:4px; }
  .crm-admin #section-reports .reports-tabs { margin-bottom:12px; padding:3px; }
  .crm-admin #section-reports .reports-tabs .tab-btn { min-height:36px; padding:7px 5px; }
  .crm-admin #section-reports .reports-intro { margin-bottom:12px; }
  .crm-admin #section-reports .report-period { margin:14px 0 8px; }
  .crm-admin #section-reports :is(.report-metric,.stat-card,.card,.report-action,.wk-row) { padding:10px 12px; }
  .crm-admin #section-reports :is(.report-metrics,.stats-grid,.report-columns) { gap:8px; margin-bottom:12px; }
  .crm-admin #section-reports .report-metric-label { margin-bottom:6px; }
  .crm-admin #section-reports .report-metric-note { margin-top:6px; }
  .crm-admin #section-reports .report-metric-value { font-size:1.5rem; }
  .crm-admin #section-reports :is(.pnl-row,.tax-line,.ped-row,.bar-row) { padding-block:8px; }
  .crm-admin #section-reports :is(th,td) { padding:8px 10px; }
  .crm-portal { --portal-header:58px; }
  .crm-portal > header { padding:5px 10px; }
  .crm-portal .header-name { font-size:.85rem; }
  .crm-portal .header-sub { font-size:.75rem; }
  .crm-portal > .tabs { padding:3px 6px; gap:2px; }
  .crm-portal .tab { flex-direction:row; min-height:40px; padding:6px 2px; gap:4px; font-size:.8rem; }
  .crm-portal .tab svg { width:14px; height:14px; }
  .crm-portal .portal-heading { padding:14px 12px 0; }
  .crm-portal .portal-kicker { display:none; }
  .crm-portal .portal-heading h1 { font-size:1.45rem; margin-bottom:4px; }
  .crm-portal .portal-heading p { font-size:.85rem; line-height:1.4; }
  .crm-portal main { padding:12px 12px calc(24px + env(safe-area-inset-bottom,0px)); }
  .crm-portal :is(.job-card,.sec-card,.goal-card,.src-card,.stat-card,.owed-card) { padding:12px; margin-bottom:10px; border-radius:10px; }
  .crm-portal .seg { padding:3px; gap:2px; margin-bottom:12px; }
  .crm-portal .seg-btn { min-height:38px; padding:7px 8px; font-size:.82rem; }
  .crm-portal .ctiles { gap:8px; margin-bottom:10px; }
  .crm-portal .ctile { padding:10px 12px; border-radius:10px; }
  .crm-portal .ctile-value { font-size:1.4rem; margin-top:4px; line-height:1.3; }
  .crm-portal .ctile-sub { margin-top:3px; }
  .crm-portal .crew-greet { padding-bottom:10px; }
  .crm-portal .job-card-top { gap:8px; }
  .crm-portal .job-icon { width:28px; height:28px; }
  .crm-portal .job-customer { font-size:1rem; }
  .crm-portal .job-addr { font-size:.88rem; line-height:1.4; }
  .crm-portal .contact-row,.crm-portal .job-actions { margin-top:8px; gap:6px; }
  .crm-portal .contact-btn { min-height:38px; padding:7px 10px; }
  .crm-portal .job-actions button { min-height:38px; }
  .crm-portal .job-notes-section { margin-top:10px; padding-top:10px; }
  .crm-portal .job-notes-section textarea { min-height:60px; }
  .crm-portal .section-label { margin:14px 0 8px; }
  .crm-portal .portal-history { margin:14px 0; padding-inline:12px; }
  .crm-portal .portal-history > summary { padding:10px 0; }
  .crm-portal .owed-amt { font-size:2rem; }
  .crm-portal .slot-grid { gap:6px; padding:8px; }
  .crm-portal .sheet-card { padding:16px 12px max(16px,env(safe-area-inset-bottom,0px)); }
  /* Keep input text large enough to prevent automatic iPhone focus zoom. */
  :is(.crm-admin,.crm-portal,.crm-login) :is(input,select,textarea) { font-size:16px; }
}
/* RevDek's sidebar: logo beside the name, one line per area, and the pages
   behind an area popping out beside the sidebar rather than unrolling in it. */
.crm-admin .sidebar-logo { display:flex; align-items:center; gap:11px; padding:20px 18px; border-bottom:0; }
.crm-admin .sidebar-logo img { width:40px; height:40px; object-fit:contain; border-radius:50%; flex:none; }
.crm-admin .sidebar-logo .logo-name { font-size:1rem; font-weight:700; }
.crm-admin .sidebar-logo .logo-sub { margin-top:0; font-size:.75rem; letter-spacing:0; text-transform:none; }
.crm-admin .nav-group { text-transform:uppercase; }
.nav-menu-btn { display:flex; align-items:center; gap:10px; width:100%; padding:11px 13px; margin-bottom:4px; border:0; border-radius:10px; background:transparent; color:var(--sidebar-fg); font:inherit; font-size:.88rem; font-weight:500; text-align:left; cursor:pointer; transition:background .15s, color .15s; }
#drawer .nav-menu-btn { gap:12px; padding:12px; font-size:.95rem; }
.nav-menu-btn .nav-icon { width:20px; height:20px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.nav-menu-btn:hover { background:var(--sidebar-hover); color:var(--text); }
.nav-menu.active > .nav-menu-btn, .nav-menu.open > .nav-menu-btn { background:var(--sidebar-active); color:var(--sidebar-fg-active); font-weight:600; }
.nav-menu-btn .nav-icon .icon { opacity:.78; }
.nav-menu.active > .nav-menu-btn .nav-icon .icon, .nav-menu-btn:hover .nav-icon .icon { opacity:1; }
.nav-arrow { margin-left:auto; font-size:.85rem; color:var(--sidebar-label); transition:transform .15s; }
.nav-menu.open .nav-arrow { transform:rotate(90deg); }
.nav-sub { display:none; }
.nav-menu.open > .nav-sub { display:block; }
.nav-sub-title { padding:4px 12px 8px; font-size:.68rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--sidebar-label); }
#sidebar .nav-sub { position:fixed; left:calc(var(--sidebar-w) - 10px); z-index:150; width:200px; padding:12px 8px 6px; background:var(--card); border:1px solid var(--border); border-radius:16px; box-shadow:0 12px 32px rgba(15,23,42,.14); }
#drawer .nav-sub { padding:2px 0 6px 18px; }
#drawer .nav-sub-title { display:none; }
.nav-logout { margin-top:8px; }
/* The gear opens a menu rather than a page, as RevDek's does. */
#util-settings-wrap { position:relative; }
#gear-menu { position:absolute; top:calc(100% + 8px); right:0; z-index:160; min-width:220px; padding:6px; background:var(--card); border:1px solid var(--border); border-radius:14px; box-shadow:0 12px 32px rgba(15,23,42,.14); }
#gear-menu[hidden] { display:none; }
#gear-menu button { display:flex; align-items:center; gap:12px; width:100%; padding:10px 12px; border:0; border-radius:9px; background:transparent; color:var(--text); font:inherit; font-size:.88rem; text-align:left; cursor:pointer; }
#gear-menu button:hover { background:var(--sidebar-hover); }
#gear-menu .gm-ico { display:flex; color:var(--text-secondary); }
.gm-sep { height:1px; margin:6px 4px; background:var(--border); }
/* A fifth tone, for counts that are bad news — RevDek's Declined. */
.stat-card.red { --tile-tint: #fdecea; --tile-edge: rgba(220,38,38,.18); --tile-ink: #c62828; }
/* Indicators: a coloured dot where space is tight, a named pill where it is not. */
.ind-dots { display:inline-flex; gap:3px; margin-left:5px; vertical-align:middle; }
.ind-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--ind, #64748b); flex:none; }
.ind-pill { display:inline-flex; align-items:center; gap:6px; padding:3px 9px; border-radius:999px; font-size:.72rem; font-weight:600; color:var(--text); background:color-mix(in srgb, var(--ind) 14%, transparent); border:1px solid color-mix(in srgb, var(--ind) 35%, transparent); }
.ind-badge { width:34px; height:34px; border-radius:50%; flex:none; background:var(--ind); box-shadow:inset 0 0 0 3px color-mix(in srgb, #fff 35%, transparent); }
.jobs-ind-wrap { margin:-8px 0 18px; max-width:260px; }
.ind-swatches { display:flex; flex-wrap:wrap; gap:10px; }
.ind-swatch input { position:absolute; opacity:0; pointer-events:none; }
.ind-swatch span { display:block; width:32px; height:32px; border-radius:50%; background:var(--ind); cursor:pointer; border:3px solid transparent; outline:2px solid transparent; }
.ind-swatch input:checked + span { border-color:var(--card); outline-color:var(--ind); }
.ind-swatch input:focus-visible + span { outline:3px solid var(--primary); }
.ind-toggle-list { display:flex; flex-direction:column; gap:6px; }
.ind-toggle { display:flex; align-items:center; gap:12px; padding:10px 12px; border:1px solid var(--border); border-radius:12px; cursor:pointer; font-weight:500; }
.ind-toggle .ind-badge { width:22px; height:22px; }
.ind-toggle input { width:18px; height:18px; flex:none; }
.ind-switch { position:relative; display:inline-block; width:40px; height:22px; flex:none; }
.ind-switch input { position:absolute; opacity:0; width:100%; height:100%; margin:0; cursor:pointer; z-index:1; }
.ind-switch span { position:absolute; inset:0; border-radius:999px; background:var(--border); transition:background .15s; }
.ind-switch span::after { content:''; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:#fff; transition:transform .15s; box-shadow:0 1px 2px rgba(0,0,0,.2); }
.ind-switch input:checked + span { background:var(--primary); }
.ind-switch input:checked + span::after { transform:translateX(18px); }
.ind-switch input:focus-visible + span { outline:3px solid var(--primary); outline-offset:2px; }
/* Automations: one line per email, the wording folded away under it. */
.auto-row { border-top:1px solid var(--border); }
.auto-line { display:flex; align-items:center; gap:14px; padding:14px 20px; }
.auto-edit { padding:4px 20px 20px; }
.auto-edit .checkbox-label { display:flex; gap:8px; margin-top:6px; }
.auto-tag { cursor:pointer; padding:2px 6px; border-radius:6px; background:var(--bg); border:1px solid var(--border); font-size:.76rem; }
.auto-tag:hover { border-color:var(--primary); }
/* Voice memos: a player per memo, and the record button under them. */
.vm-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); }
.vm-row audio { flex:1; min-width:0; height:36px; }
.vm-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-top:14px; }
/* Goals: a tile each, the bar in the goal's own colour. */
.goal-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:14px; margin-bottom:22px; }
.goal-tile { padding:18px 20px; border:1px solid var(--border); border-radius:14px; background:var(--card); border-top:4px solid var(--goal); }
.goal-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.goal-name { font-weight:700; }
.goal-figs { margin:12px 0 8px; font-variant-numeric:tabular-nums; display:flex; align-items:baseline; gap:4px; }
.goal-figs strong { font-size:1.35rem; letter-spacing:-.02em; }
.goal-pct { margin-left:auto; font-weight:700; color:var(--goal); }
.goal-track { height:10px; border-radius:999px; background:var(--border-light, #edf1f6); overflow:hidden; }
.goal-fill { height:100%; border-radius:999px; background:var(--goal); transition:width .5s; }
/* Team chat: conversations on the left, the thread on the right. */
.tc-wrap { display:grid; grid-template-columns:280px 1fr; padding:0; height:min(70vh, 640px); overflow:hidden; }
.tc-list { border-right:1px solid var(--border); overflow-y:auto; padding:8px; }
.tc-thread { display:flex; align-items:center; gap:10px; width:100%; padding:10px; border:0; border-radius:10px; background:transparent; color:var(--text); font:inherit; text-align:left; cursor:pointer; }
.tc-thread:hover { background:var(--sidebar-hover); }
.tc-thread.is-open { background:var(--primary-bg); }
.tc-avatar { width:36px; height:36px; border-radius:50%; flex:none; display:grid; place-items:center; background:var(--bg); border:1px solid var(--border); font-size:.8rem; font-weight:700; }
.tc-meta { flex:1; min-width:0; display:flex; flex-direction:column; }
.tc-name { font-weight:600; font-size:.9rem; }
.tc-last { font-size:.78rem; color:var(--text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tc-unread { min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:var(--primary); color:#fff; font-size:.72rem; font-weight:700; display:grid; place-items:center; }
.tc-main { display:flex; flex-direction:column; min-width:0; }
.tc-head { display:flex; flex-direction:column; padding:14px 18px; border-bottom:1px solid var(--border); font-weight:700; }
.tc-msgs { flex:1; overflow-y:auto; padding:16px 18px; display:flex; flex-direction:column; gap:10px; }
.tc-msg { max-width:72%; display:flex; flex-direction:column; }
.tc-msg.me { align-self:flex-end; align-items:flex-end; }
.tc-bubble { padding:9px 13px; border-radius:16px; background:var(--bg); border:1px solid var(--border); line-height:1.45; overflow-wrap:anywhere; }
.tc-msg.me .tc-bubble { background:var(--primary); border-color:var(--primary); color:#fff; }
.tc-by { font-size:.7rem; color:var(--text-muted); margin-top:3px; }
.tc-compose { display:flex; gap:8px; padding:12px; border-top:1px solid var(--border); }
.tc-compose textarea { resize:none; min-height:42px; }
@media (max-width: 760px) {
  .tc-wrap { grid-template-columns:1fr; height:auto; }
  .tc-list { border-right:0; border-bottom:1px solid var(--border); display:flex; overflow-x:auto; gap:4px; }
  .tc-thread { flex:none; width:auto; }
  .tc-thread .tc-last { display:none; }
  .tc-msgs { height:55vh; }
}
/* Customers: RevDek's two dropdowns over the list. */
.cust-toolbar { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.cust-select { display:flex; flex-direction:column; gap:4px; min-width:170px; }
.cust-select span { font-size:.72rem; font-weight:600; color:var(--text-muted); }
.cust-quo { margin-left:auto; display:flex; gap:8px; flex-wrap:wrap; }
.cust-name-link { font-weight:650; color:var(--text); text-decoration:none; }
.cust-name-link:hover { color:var(--primary); text-decoration:underline; }
/* Service plans: RevDek's row of plan types, each a count you can tap. */
.plan-types { display:grid; grid-template-columns:repeat(auto-fill, minmax(130px, 1fr)); gap:10px; margin-bottom:18px; }
.plan-type { display:flex; flex-direction:column; align-items:flex-start; gap:2px; padding:14px; border:1px solid var(--border); border-radius:14px; background:var(--card); color:var(--text); font:inherit; text-align:left; cursor:pointer; transition:border-color .13s, box-shadow .13s; }
.plan-type:hover { border-color:var(--primary); }
.plan-type.on { border-color:var(--primary); box-shadow:0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.plan-type-ico { color:#7c3aed; margin-bottom:4px; display:flex; }
.plan-type.pending .plan-type-ico { color:#d97706; }
.plan-type-name { font-weight:650; font-size:.85rem; }
.plan-type-n { font-size:1.4rem; font-weight:700; line-height:1.2; font-variant-numeric:tabular-nums; }
.plan-type-sub { font-size:.72rem; color:var(--text-muted); }
/* Report bars: label, bar, figure — one row each. */
.rd-bar-row { display:grid; grid-template-columns:minmax(90px, 160px) 1fr auto; align-items:center; gap:12px; padding:6px 0; }
.rd-bar-label { font-size:.86rem; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-bar-track { height:10px; border-radius:999px; background:var(--border-light, #edf1f6); overflow:hidden; }
.rd-bar-fill { display:block; height:100%; border-radius:999px; background:var(--primary); }
.rd-bar-val { font-size:.84rem; font-weight:650; font-variant-numeric:tabular-nums; white-space:nowrap; }
@media (max-width: 600px) { .rd-bar-row { grid-template-columns:90px 1fr; } .rd-bar-val { grid-column:2; } }
/* Scheduling: RevDek's left panel beside the calendar, on the Schedule tab only. */
.sched-layout.on { display:grid; grid-template-columns:250px minmax(0, 1fr); gap:18px; align-items:start; }
.sched-panel { display:none; }
.sched-layout.on .sched-panel { display:flex; flex-direction:column; gap:10px; padding:16px; border:1px solid var(--border); border-radius:16px; background:var(--card); position:sticky; top:16px; }
.sched-layout.on #jobs-list .cal-nav { display:none; }
.sp-field { display:flex; flex-direction:column; gap:4px; }
.sp-field span, .sp-label { font-size:.72rem; font-weight:600; color:var(--text-muted); }
.sp-label { margin-top:6px; }
.sp-wide { width:100%; justify-content:center; }
.sp-outline { border:1.5px solid var(--primary) !important; color:var(--primary) !important; }
.sp-clear { font-size:.8rem; color:var(--primary); }
.sp-date { display:flex; align-items:center; justify-content:space-between; gap:6px; margin-top:6px; padding:6px; border:1px solid var(--border); border-radius:12px; }
.sp-date-label { flex:1; border:0; background:transparent; color:var(--text); font:inherit; font-weight:700; text-align:center; cursor:pointer; }
.sp-rev { text-align:center; font-size:.84rem; line-height:1.6; }
.sp-rev-title { font-weight:600; }
.sp-rev-done { color:var(--success, #16a34a); }
.sp-rev-pend { color:var(--warning, #d97706); }
.sched-day .wk-grid { grid-template-columns:var(--rail, 54px) minmax(0, 1fr); }
@media (max-width: 900px) {
  .sched-layout.on { grid-template-columns:1fr; }
  .sched-layout.on .sched-panel { position:static; }
}
/* A grid item will not shrink below its content unless told to, and the week
   grid is wide on purpose (it scrolls inside its own wrapper). */
.sched-layout.on > * { min-width:0; }
/* The Map, RevDek's way: tabs under the title, the map filling the page,
   search top-left, buttons top-right, pin types in a bar along the bottom. */
.rdm-header { border-bottom:0 !important; margin-bottom:6px !important; padding-bottom:0 !important; }
.rdm-extra { display:flex; gap:8px; }
.rdm-tabs { display:flex; gap:22px; border-bottom:1px solid var(--border); margin-bottom:0; }
.rdm-tabs button { display:inline-flex; align-items:center; gap:6px; padding:10px 2px; border:0; border-bottom:2px solid transparent; background:none; color:var(--text-muted); font:inherit; font-size:.9rem; font-weight:600; cursor:pointer; }
.rdm-tabs button.on { color:var(--primary); border-bottom-color:var(--primary); }
.rdm-wrap { position:relative; height:calc(100vh - 210px); height: calc(100dvh - 210px); min-height:460px; border-radius:0 0 14px 14px; overflow:hidden; border:1px solid var(--border); border-top:0; }
#rdm-map { position:absolute; inset:0; background:#0f172a; }
#rdm-map.is-drawing { cursor:crosshair; }
.rdm-search { position:absolute; top:14px; left:14px; z-index:500; width:min(340px, calc(100% - 28px)); }
.rdm-search input { width:100%; height:42px; padding:0 14px 0 38px; border:0; border-radius:999px; background:#fff; color:#0f172a; font:inherit; box-shadow:0 2px 10px rgba(0,0,0,.2); }
.rdm-search-ico { position:absolute; left:14px; top:13px; color:#64748b; display:flex; }
.rdm-results { margin-top:6px; background:#fff; color:#0f172a; border-radius:14px; box-shadow:0 8px 24px rgba(0,0,0,.2); overflow:hidden; max-height:280px; overflow-y:auto; }
.rdm-results button { display:block; width:100%; padding:10px 14px; border:0; border-bottom:1px solid #eef2f7; background:#fff; color:#0f172a; font:inherit; font-size:.85rem; text-align:left; cursor:pointer; }
.rdm-results button:hover { background:#f1f5f9; }
.rdm-right { position:absolute; top:14px; right:14px; z-index:500; display:flex; flex-direction:column; align-items:flex-end; gap:10px; }
.rdm-pill { display:inline-flex; align-items:center; gap:6px; height:38px; padding:0 16px; border:0; border-radius:999px; background:#fff; color:#1d4ed8; font:inherit; font-size:.86rem; font-weight:700; box-shadow:0 2px 10px rgba(0,0,0,.2); cursor:pointer; }
.rdm-pill .icon { color:#0f172a; }
.rdm-round { width:42px; height:42px; display:grid; place-items:center; border:0; border-radius:50%; background:#fff; color:#0f172a; box-shadow:0 2px 10px rgba(0,0,0,.2); cursor:pointer; }
.rdm-toolbar { position:absolute; left:50%; bottom:16px; transform:translateX(-50%); z-index:500; max-width:calc(100% - 24px); padding:8px 12px 6px; background:#fff; color:#0f172a; border-radius:22px; box-shadow:0 4px 18px rgba(0,0,0,.25); }
.rdm-tools { display:flex; gap:4px; overflow-x:auto; scrollbar-width:none; }
.rdm-tools::-webkit-scrollbar { display:none; }
.rdm-tool { flex:none; width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:10px; background:transparent; color:var(--c); font-size:1.05rem; font-weight:800; cursor:pointer; }
.rdm-tool:hover { background:#f1f5f9; }
.rdm-tool.on { background:color-mix(in srgb, var(--c) 14%, #fff); box-shadow:inset 0 0 0 2px var(--c); }
.rdm-caption { text-align:center; font-size:.72rem; color:#475569; padding:4px 0 2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rdm-pin-wrap { background:none; border:0; }
.rdm-pin { display:grid; place-items:center; border-radius:50%; background:var(--c); color:#fff; font-size:.8rem; font-weight:800; line-height:1; border:2px solid #fff; box-shadow:0 1px 4px rgba(0,0,0,.45); }
.rdm-draw { position:absolute; top:14px; left:14px; z-index:600; width:min(340px, calc(100% - 28px)); padding:14px 16px; background:#fff; color:#0f172a; border-radius:18px; box-shadow:0 4px 18px rgba(0,0,0,.25); }
.rdm-draw .text-muted { color:#475569 !important; }
.rdm-draw-head { display:flex; align-items:center; gap:8px; margin-bottom:2px; }
.rdm-draw-acts { display:flex; gap:8px; margin-top:10px; }
.rdm-dot { width:14px; height:14px; border-radius:50%; flex:none; display:inline-block; }
.rdm-dot.big { width:26px; height:26px; }
.rdm-terr-head { display:flex; justify-content:space-between; align-items:center; margin:14px 0; }
.rdm-route { display:flex; align-items:center; gap:14px; margin-bottom:10px; border-left:4px solid var(--c) !important; }
.rdm-route-body { flex:1; min-width:0; cursor:pointer; }
.rdm-chip { display:inline-block; padding:1px 8px; border-radius:999px; background:var(--bg); border:1px solid var(--border); font-size:.72rem; font-weight:600; margin-left:4px; }
.rdm-cust-results button { display:flex; flex-direction:column; width:100%; padding:8px 10px; border:0; border-bottom:1px solid var(--border); background:transparent; color:var(--text); font:inherit; text-align:left; cursor:pointer; }
.rdm-cust-results button:hover { background:var(--sidebar-hover); }
@media (max-width: 900px) {
  .rdm-wrap { height:calc(100vh - 230px); height: calc(100dvh - 230px); }
  .rdm-extra { width:100%; }
  .rdm-search { width:calc(100% - 140px); }
}
/* Leaflet's controls carry z-index 1000; keep them inside the map so a
   pop-up opened over it covers them like everything else. */
.rdm-wrap { isolation:isolate; height:calc(100vh - 250px); height: calc(100dvh - 250px); }
.rdm-pin-head { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
/* The map page is only the map now: no tabs under the title. */
.rdm-wrap { height:calc(100vh - 205px); height: calc(100dvh - 205px); border-top:1px solid var(--border); border-radius:14px; }
/* Territories, as RevDek lays them out. */
.rdt-header { border-bottom:0 !important; padding:18px 20px !important; background:var(--card); border:1px solid var(--border) !important; border-radius:16px; }
.rdt-header .subtitle { margin-top:2px !important; }
.rdt-list { display:flex; flex-direction:column; gap:12px; }
.rdt-row { display:flex; align-items:center; gap:14px; padding:14px 16px; background:var(--card); border:1px solid var(--border); border-left:4px solid var(--c); border-radius:16px; }
.rdt-dot { width:26px; height:26px; border-radius:50%; flex:none; }
.rdt-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; border:0; background:none; padding:0; color:var(--text); font:inherit; text-align:left; cursor:pointer; }
.rdt-line { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.rdt-chip { padding:1px 9px; border-radius:999px; background:var(--bg); border:1px solid var(--border); font-size:.72rem; font-weight:600; }
.rdt-sub { font-size:.82rem; color:var(--text-muted); }
.rdt-icon { width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:50%; background:transparent; color:var(--text-muted); font-size:1.3rem; cursor:pointer; }
.rdt-icon:hover { background:var(--sidebar-hover); color:var(--text); }
/* Performance: a ranked table, a bar of how each person's doors went. */
.perf-table th { cursor:pointer; user-select:none; }
.perf-table th.on { color:var(--primary); }
.perf-table .num { text-align:right; font-variant-numeric:tabular-nums; }
.perf-table td.top { font-weight:800; color:var(--success, #16a34a); }
.perf-who { display:flex; align-items:center; gap:8px; }
.perf-live { font-size:.7rem; font-weight:700; color:var(--success, #16a34a); }
.perf-bar { display:flex; height:6px; border-radius:999px; overflow:hidden; margin-top:6px; min-width:120px; background:var(--border-light); }
.perf-legend { display:flex; flex-wrap:wrap; gap:6px 14px; margin-top:12px; font-size:.75rem; color:var(--text-muted); }
.perf-legend i { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:5px; vertical-align:-1px; }
.gw-preview { white-space:pre-wrap; font:inherit; font-size:.85rem; line-height:1.6; padding:12px 14px; background:var(--bg); border:1px solid var(--border); border-radius:10px; margin:6px 0 0; }

/* ══ iPhone ═══════════════════════════════════════════════════════════════
   One set of rules for both the office app and the crew app on a phone.
   ═════════════════════════════════════════════════════════════════════════ */

/* Safari zooms the whole page in on any text box under 16px the moment it is
   tapped, and does not zoom back out. Sixteen everywhere on a phone stops it. */
@media (max-width: 900px), (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
  select, textarea { font-size: 16px !important; }
}

/* Clear of the notch and the status bar at the top, now that the page is
   allowed to use the whole screen (viewport-fit=cover). Zero everywhere else. */
/* The office top bar is pinned at a fixed height and the page is spaced to
   match, so both grow by the same amount. */
@media (max-width: 900px) {
  .crm-admin #topbar { height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); }
  .crm-admin #main-content { padding-top: calc(var(--topbar-h) + 12px + env(safe-area-inset-top, 0px)); }
}
.crm-admin #drawer, .pdrawer { padding-top: env(safe-area-inset-top, 0px); }
.crm-portal > header { padding-top: max(12px, env(safe-area-inset-top, 0px)); }
.viewas-bar { padding-top: max(8px, env(safe-area-inset-top, 0px)) !important; }
/* …and the rounded corners and notch when the phone is turned sideways. */
@media (orientation: landscape) and (max-width: 1000px) {
  .crm-admin #main-content, .crm-portal main, .crm-portal .portal-heading {
    padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
}

/* Thumb-sized targets. Small links get invisible padding, so the place you
   can tap grows to about 40px without moving anything on the page. */
@media (pointer: coarse), (max-width: 900px) {
  a[href^="tel:"], a[href^="sms:"], a[href^="mailto:"], .job-phone, .job-addr a,
  .list-item-sub a, .cust-name-link, .sp-clear { padding: 11px 0; }
  .ai-hdr-btn, .pdrawer-close, #drawer-close { min-width: 40px; min-height: 40px; }
  .sp-date button, .ps-date button, .rdt-icon, .wk-bar .btn { min-width: 40px; min-height: 40px; }
  .auto-line .btn, .auto-line .ind-switch { min-height: 40px; }
  .ind-switch { width: 48px; height: 28px; }
  .ind-switch span::after { width: 22px; height: 22px; }
  .ind-switch input:checked + span::after { transform: translateX(20px); }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
  .ptc-tab { min-height: 40px; }
  .pay-row > button { min-width: 40px; min-height: 40px; }
  .row-menu button { min-height: 44px; }
  /* A tap on a button should feel like a tap, not a grey flash. */
  button, a, [onclick] { -webkit-tap-highlight-color: transparent; }
}

/* Pop-ups and sheets: never taller than what is actually on screen, and the
   last button clear of the home bar. */
.sheet-card { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* The crew header on a phone: the bar keeps the name on one line instead of
   wrapping beside a button, so Sign Out comes out of it.

   It then has to be somewhere else, and for a while it was nowhere: this rule
   used to say Sign Out lived in the ☰ menu, which was true of a drawer the
   portal no longer has. Under 900px — every phone, which is the only thing
   the crew use — there was no way to sign out at all. It now sits at the top
   of the Me tab, under the name of whoever is signed in. */
@media (max-width: 900px) {
  /* The words step aside, not the button. A text button beside the business
     name wrapped the header onto two lines, which is why this used to be
     display:none — and that left no way to sign out on a phone at all. The
     glyph costs 44px and the name still has room to truncate into. */
  .crm-portal > header .logout-btn { padding: 0; width: 44px; min-height: 44px; }
  .crm-portal > header .logout-word { display: none; }
  .crm-portal > header .header-brand { min-width: 0; flex: 1; }
  .crm-portal > header .header-name, .crm-portal > header .header-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .crm-portal > header .header-brand > div { min-width: 0; }
}

/* ── Easier to get around: every page visible in the menu ──
   Menus open in place under their line (sidebar and drawer alike) instead of
   popping out beside the sidebar, and the one holding the current page opens
   by itself. */
.crm-admin #sidebar .nav-sub { position:static; width:auto; padding:2px 0 6px 16px; background:none; border:0; border-radius:0; box-shadow:none; }
.crm-admin #sidebar .nav-sub-title, .crm-admin #drawer .nav-sub-title { display:none; }
.crm-admin .nav-sub a { padding-block:8px; font-size:.84rem; }
.crm-admin .nav-arrow { font-size:.7rem; }
.crm-admin #sidebar { overflow-y:auto; }

/* The phone's bottom bar: Home, Schedule, Customers, Inbox, More. */
.crm-admin #bottom-nav .bnav-icon { position:relative; }
.bnav-dot { position:absolute; top:-2px; right:-5px; width:9px; height:9px; border-radius:50%; background:#dc2626; border:2px solid var(--card); }
.bnav-dot[hidden] { display:none; }

/* On a phone the + and the ✨ were the same size in the same place, so the
   + was hidden underneath. The + stays at the thumb; the ✨ sits above it. */
@media (max-width: 767px) {
  .crm-admin #quick-add-btn { width:52px; height:52px; font-size:1.6rem; }
  .crm-admin #ai-btn { width:42px; height:42px; right:21px;
    bottom:calc(var(--bottomnav-h) + env(safe-area-inset-bottom,0px) + 78px); }
}
/* and they step aside while the menu is open */
body:has(#drawer.open) :is(#quick-add-btn, #ai-btn) { display:none; }
/* A quiet scrollbar for when several menus are open on a short screen. */
.crm-admin #sidebar { scrollbar-width:thin; scrollbar-color:var(--border) transparent; }
.crm-admin #sidebar::-webkit-scrollbar { width:6px; }
.crm-admin #sidebar::-webkit-scrollbar-track { background:transparent; }
.crm-admin #sidebar::-webkit-scrollbar-thumb { background:var(--border); border-radius:99px; }
