/* ==========================================================================
   DealerStation Journal — UI layer on design system v3.0
   --------------------------------------------------------------------------
   Same tokens, type scale and components as frontend/dealer/ds-ui.css,
   mapped onto Journal's class names. Loaded LAST in index.html, on top of
   styles.css (the protected baseline layout, see ../BASELINE.md). This file
   restyles only: it keeps the baseline structure, navigation, element IDs and
   mobile behaviour (fixed bottom tab bar, scrolling lead list, sheet dialogs).

   CSP is `style-src 'self'` and `img-src 'self' data:`: everything lives here,
   icons are data-URI SVG masks, no inline styles.

   - Change colours/spacing through the tokens in :root, not per component.
   - `!important` only where styles.css already uses it for that property.
   - Sections: 1 tokens · 2 base · 3 sign-in · 4 shell · 5 components ·
     6 leads · 7 calendar · 8 activity · 9 dialogs · 10 toast · 11 mobile
   ========================================================================== */

@font-face{font-family:"Inter DS";src:url("fonts/inter-latin-var.woff2") format("woff2");font-weight:100 900;font-style:normal;font-display:swap}

/* 1 ─ Tokens ─────────────────────────────────────────────────────────────── */
:root{
  --ds-font:"Inter DS",Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;

  --ds-brand:#006bff;--ds-brand-hover:#005ee0;--ds-brand-press:#0052c4;  /* Journal keeps its own blue (styles.css --blue) */
  --ds-brand-soft:#ebf3ff;--ds-brand-soft-2:#d6e6ff;--ds-brand-ring:rgba(0,107,255,.2);
  --ds-accent:#20b486;--ds-accent-soft:#e5f6f0;

  --ds-nav:#152238;

  --ds-bg:#f5f6fa;--ds-surface:#fff;--ds-surface-2:#f8f9fb;--ds-surface-3:#f0f2f6;
  --ds-border:#e4e7ee;--ds-border-strong:#d3d8e2;--ds-divider:#eef0f4;
  --ds-text:#151c2c;--ds-text-2:#3e485c;--ds-muted:#667085;--ds-faint:#98a1b2;

  --ds-success:#11805a;--ds-success-soft:#e6f5ee;
  --ds-warning:#a86410;--ds-warning-soft:#fcf2e1;
  --ds-danger:#c0394a;--ds-danger-soft:#fdecee;
  --ds-info:#2563c9;--ds-info-soft:#e8f0fd;

  --ds-r-sm:6px;--ds-r:8px;--ds-r-lg:12px;--ds-r-xl:16px;
  --ds-sh-xs:0 1px 2px rgba(16,24,40,.05);
  --ds-sh-sm:0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.06);
  --ds-sh-md:0 6px 16px -4px rgba(16,24,40,.10),0 2px 4px -2px rgba(16,24,40,.05);
  --ds-sh-lg:0 24px 48px -12px rgba(16,24,40,.22);

  /* icons (data-URI SVG, used as masks so they take currentColor) */
  --ds-i-search:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  --ds-i-phone:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2z'/%3E%3C/svg%3E");
  --ds-i-leads:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8'/%3E%3C/svg%3E");
  --ds-i-calendar:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
  --ds-i-activity:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-4l-3 9L9 3l-3 9H2'/%3E%3C/svg%3E");
  --ds-i-signout:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/%3E%3C/svg%3E");

  /* legacy token bridge: styles.css reads these */
  --blue:var(--ds-brand);--navy:var(--ds-nav);--muted:var(--ds-muted);--line:var(--ds-border);--card:var(--ds-surface);--soft:var(--ds-surface-2);
  font-family:var(--ds-font);color:var(--ds-text);background:var(--ds-bg);
}

/* 2 ─ Base ───────────────────────────────────────────────────────────────── */
html,body{background:var(--ds-bg)}
body{font-family:var(--ds-font);font-size:14px;line-height:1.5;color:var(--ds-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv11","ss01"}
body button,body input,body select,body textarea{font-family:inherit}
body ::selection{background:var(--ds-brand-soft-2)}
body :focus-visible{outline:2px solid var(--ds-brand);outline-offset:2px}
body h1,body h2,body h3{color:var(--ds-text);letter-spacing:-.011em}
body strong,body b{font-weight:600}
body .muted{color:var(--ds-muted);font-size:12.5px}
body .eyebrow{color:var(--ds-brand);font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase}
body .error{color:var(--ds-danger);font-size:13px;line-height:1.4;min-height:18px}

/* Form controls */
body label{gap:6px;font-size:12.5px;font-weight:500;color:var(--ds-text-2);letter-spacing:0}
body input:not([type=checkbox]):not([type=radio]),body select,body textarea{border:1px solid var(--ds-border-strong);border-radius:var(--ds-r);background-color:#fff;color:var(--ds-text);font-size:14px;font-weight:400;line-height:1.4;padding:8px 11px;box-shadow:var(--ds-sh-xs);transition:border-color .12s,box-shadow .12s}
body input:not([type=checkbox]):not([type=radio]),body select{min-height:36px}
body textarea{min-height:76px}
body input::placeholder,body textarea::placeholder{color:var(--ds-faint);font-weight:400}
body input:hover,body select:hover,body textarea:hover{border-color:#bfc6d3}
body input:focus,body select:focus,body textarea:focus{border-color:var(--ds-brand);box-shadow:0 0 0 3px var(--ds-brand-ring);outline:none}
body select{appearance:none;-webkit-appearance:none;padding-right:32px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 11px center}
body input[type=checkbox],body input[type=radio]{accent-color:var(--ds-brand)}
body input[type=datetime-local]{font-variant-numeric:tabular-nums}

/* Buttons: primary · ghost (secondary) · danger · icon */
body .primary,body .ghost,body .danger{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:36px;padding:0 14px;border-radius:var(--ds-r);font-size:13.5px;font-weight:600;letter-spacing:-.003em;line-height:1;white-space:nowrap;transition:background .12s,border-color .12s,box-shadow .12s,color .12s}
body .primary{background:var(--ds-brand);color:#fff;border:1px solid var(--ds-brand);box-shadow:var(--ds-sh-xs),inset 0 1px 0 rgba(255,255,255,.12)}
body .primary:hover{background:var(--ds-brand-hover);border-color:var(--ds-brand-hover)}
body .primary:active{background:var(--ds-brand-press)}
body .primary:disabled{opacity:.55;cursor:not-allowed}
body .ghost{background:var(--ds-surface);color:var(--ds-text-2);border:1px solid var(--ds-border-strong);box-shadow:var(--ds-sh-xs)}
body .ghost:hover{background:var(--ds-surface-2);border-color:#c2c8d4}
body .danger{background:var(--ds-surface);color:var(--ds-danger);border:1px solid #efc6cc;box-shadow:var(--ds-sh-xs)}
body .danger:hover{background:var(--ds-danger-soft);border-color:#e6a9b2}
body .iconbtn{display:inline-grid;place-items:center;width:36px;min-height:36px;height:36px;padding:0 0 2px;border-radius:var(--ds-r);background:var(--ds-surface);border:1px solid var(--ds-border-strong);color:var(--ds-text-2);font-size:20px;font-weight:400;line-height:1;box-shadow:var(--ds-sh-xs)}
body .iconbtn:hover{background:var(--ds-surface-2);border-color:#c2c8d4}

/* 3 ─ Sign-in & password setup ─────────────────────────────────────────── */
body .login-shell{background:var(--ds-bg);background-image:radial-gradient(60% 45% at 85% 0,rgba(0,107,255,.10),transparent 70%),radial-gradient(45% 40% at 0 100%,rgba(32,180,134,.07),transparent 70%)}
body .login-card{width:min(400px,100%);border:1px solid var(--ds-border);border-radius:var(--ds-r-xl);padding:32px;box-shadow:var(--ds-sh-md);text-align:left}
body .login-logo{display:block;width:auto;max-width:78%;height:30px;margin:0 auto 22px;border-radius:0;box-shadow:none;background:none}
body .login-card>.eyebrow{display:block;text-align:center}
body .login-copy{text-align:center}
body .login-copy h1{font-size:24px;line-height:1.25;font-weight:650;letter-spacing:-.022em;margin:8px 0 6px}
body .login-copy p,body .dialog-copy{font-size:14px;line-height:1.55;color:var(--ds-muted);margin:0 0 24px}
body .login-card label{margin-bottom:14px}
body .login-card input:not([type=checkbox]){min-height:40px}
body .login-card .primary{width:100%;min-height:40px;margin-top:4px}
body .remember-row{font-size:13px;font-weight:400;color:var(--ds-text-2);margin:2px 0 16px}
body .remember-row input{width:16px!important;height:16px!important}
body .setup-link{display:block;min-height:40px;margin-top:8px;padding:10px 4px;border-radius:var(--ds-r);color:var(--ds-brand);font-size:13px;font-weight:550}
body .setup-link:hover{background:var(--ds-brand-soft);color:var(--ds-brand-hover)}
body .login-card .error{text-align:center;margin-top:6px}

/* 4 ─ App shell ──────────────────────────────────────────────────────────── */
body .app{background:var(--ds-bg)}
body header{background:rgba(255,255,255,.94);backdrop-filter:saturate(1.4) blur(10px);-webkit-backdrop-filter:saturate(1.4) blur(10px);border-bottom:1px solid var(--ds-border);padding-left:max(24px,calc((100vw - 1220px)/2),env(safe-area-inset-left));padding-right:max(24px,calc((100vw - 1220px)/2),env(safe-area-inset-right))}
body .brand{gap:10px}
body .brand img{display:block;width:auto;height:24px;border-radius:0;box-shadow:none;background:none}
body .brand span{margin-left:12px;border-left:1px solid var(--ds-border);padding:2px 0 2px 10px;font-size:13px;font-weight:500;color:var(--ds-muted)}
body .header-actions{gap:10px;font-size:13px;color:var(--ds-muted)}
body .header-actions .ghost{min-height:34px;padding:0 12px;font-size:13px}
body .avatar-btn{position:relative;width:36px;height:36px;min-height:36px;padding:0;border:1px solid var(--ds-border-strong);border-radius:var(--ds-r);background:var(--ds-surface);color:transparent;font-size:0;box-shadow:var(--ds-sh-xs)}
body .avatar-btn:before{content:"";position:absolute;inset:0;margin:auto;width:16px;height:16px;background:var(--ds-text-2);-webkit-mask:var(--ds-i-signout) center/contain no-repeat;mask:var(--ds-i-signout) center/contain no-repeat}
body .avatar-btn:hover{background:var(--ds-surface-2);border-color:#c2c8d4}

body main{padding:24px 24px 12px}
body .topline{align-items:flex-end}
body .topline h1{font-size:24px;line-height:1.25;font-weight:650;letter-spacing:-.022em;margin:4px 0 0}

/* Page tabs (desktop underline; becomes the bottom tab bar on phones) */
body .nav-tabs{gap:24px;margin-top:16px;border-bottom:1px solid var(--ds-border)}
body .nav{position:relative;padding:10px 0 11px;margin-bottom:-1px;color:var(--ds-muted);font-size:13.5px;font-weight:550;border-bottom:2px solid transparent;transition:color .12s,border-color .12s}
body .nav:hover{color:var(--ds-text)}
body .nav.active{color:var(--ds-brand);border-color:var(--ds-brand)}

/* 5 ─ Components ─────────────────────────────────────────────────────────── */
/* KPI tiles */
body .metrics{gap:12px;margin:20px 0 16px}
body .metric{background:var(--ds-surface);border:1px solid var(--ds-border);border-radius:var(--ds-r-lg);box-shadow:var(--ds-sh-xs);padding:14px 16px}
body .metric span{font-size:12.5px;font-weight:500;color:var(--ds-muted);letter-spacing:0}
body .metric strong{font-size:24px;line-height:1.15;font-weight:650;letter-spacing:-.025em;color:var(--ds-text);font-variant-numeric:tabular-nums;margin-top:6px}

/* Search + stage filter */
body .workbar{grid-template-columns:minmax(0,1fr) 200px;gap:10px}
body .searchbox{position:relative;gap:0;padding:0 0 0 34px;border:1px solid var(--ds-border-strong);border-radius:var(--ds-r);background:var(--ds-surface);box-shadow:var(--ds-sh-xs);font-size:0;color:transparent;transition:border-color .12s,box-shadow .12s}
body .searchbox:before{content:"";position:absolute;left:12px;top:50%;width:15px;height:15px;transform:translateY(-50%);background:var(--ds-faint);-webkit-mask:var(--ds-i-search) center/contain no-repeat;mask:var(--ds-i-search) center/contain no-repeat}
body .searchbox:hover{border-color:#bfc6d3}
body .searchbox:focus-within{border-color:var(--ds-brand);box-shadow:0 0 0 3px var(--ds-brand-ring)}
body .searchbox input[type=search],body .searchbox input[type=search]:hover,body .searchbox input[type=search]:focus{border:0;box-shadow:none;background:transparent;min-height:34px;padding:0 10px 0 2px;font-size:14px;color:var(--ds-text)}
body .workbar select{min-height:36px;height:36px;padding-top:0;padding-bottom:0;font-size:14px}

/* Segmented control */
body .segmented{gap:2px;padding:3px;margin:12px 0;background:var(--ds-surface-3);border:1px solid var(--ds-border);border-radius:var(--ds-r)}
body .segment{min-height:30px;padding:0 12px;border-radius:var(--ds-r-sm);color:var(--ds-muted);font-size:13px;font-weight:550;transition:color .12s,background .12s}
body .segment:hover{color:var(--ds-text)}
body .segment.active{background:var(--ds-surface);color:var(--ds-text);box-shadow:var(--ds-sh-sm)}

/* Status pills */
body .pill{align-items:center;gap:6px;height:22px;padding:0 9px 0 8px;border-radius:999px;background:var(--ds-info-soft);color:var(--ds-info);font-size:12px;font-weight:550;line-height:1;letter-spacing:0}
body .pill:before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.8;flex:0 0 auto}
body .pill.hot_lead,body .pill.interested{background:var(--ds-warning-soft);color:var(--ds-warning)}
body .pill.demo_booked{background:var(--ds-brand-soft);color:var(--ds-brand-hover)}
body .pill.signed{background:var(--ds-success-soft);color:var(--ds-success)}
body .pill.not_interested,body .pill.has_system,body .pill.no_answer{background:var(--ds-surface-3);color:var(--ds-muted)}

/* Empty states */
body .empty{padding:40px 16px;border:1px dashed var(--ds-border-strong);border-radius:var(--ds-r-lg);background:var(--ds-surface-2);color:var(--ds-muted);font-size:13px}
body .empty h2{font-size:15px;font-weight:600;margin:0 0 4px;color:var(--ds-text)}
body .empty p{font-size:13px;margin:0;color:var(--ds-muted)}

/* 6 ─ Leads list ─────────────────────────────────────────────────────────── */
body .dealer-list,body .activity-list{gap:8px}
body .dealer{gap:16px;padding:14px 16px;border:1px solid var(--ds-border);border-radius:var(--ds-r-lg);background:var(--ds-surface);box-shadow:var(--ds-sh-xs);transition:border-color .12s,box-shadow .12s}
body .dealer:hover{border-color:var(--ds-border-strong);box-shadow:var(--ds-sh-md)}
body .dealer h3{font-size:14px;line-height:1.35;font-weight:600;margin:0 0 2px;color:var(--ds-text)}
body .dealer .contact>div:first-child{font-size:13.5px;font-weight:500;color:var(--ds-text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body .followup{font-size:12.5px;color:var(--ds-muted);line-height:1.35}
body .chev{font-size:18px;line-height:1;color:var(--ds-faint);text-align:center}
body .call-btn{position:relative;width:36px;height:36px;border:1px solid #c8eadb;border-radius:var(--ds-r);background:var(--ds-accent-soft);color:var(--ds-success);font-size:0;transition:background .12s,border-color .12s}
body .call-btn:before{content:"";width:16px;height:16px;background:currentColor;-webkit-mask:var(--ds-i-phone) center/contain no-repeat;mask:var(--ds-i-phone) center/contain no-repeat}
body .call-btn:hover{background:#d3efe4;border-color:#a9dcc6}
/* Desktop row: fixed column per cell, so rows with and without a phone
   number line up (styles.css has 5 tracks for up to 6 cells). */
@media (min-width:761px){
  body .dealer{grid-template-columns:minmax(0,1.5fr) minmax(0,1fr) 128px minmax(0,1fr) 36px 14px}
  body .dealer>*{grid-row:1}
  body .dealer>div:first-child{grid-column:1;min-width:0}
  body .dealer>.contact{grid-column:2;min-width:0}
  body .dealer>.stage{grid-column:3}
  body .dealer>.followup{grid-column:4;min-width:0}
  body .dealer>.call-btn{grid-column:5}
  body .dealer>.chev{grid-column:6}
}
@media (min-width:761px) and (max-width:1000px){body .dealer{gap:12px}body .dealer .chev{visibility:hidden}}

/* 7 ─ Calendar ───────────────────────────────────────────────────────────── */
body .calendar-head{gap:8px;padding:20px 0 12px}
body .calendar-head h2{font-size:17px;font-weight:650;letter-spacing:-.015em;color:var(--ds-text);padding:0 6px}
body .calendar-wrap{border:1px solid var(--ds-border);border-radius:var(--ds-r-lg);box-shadow:var(--ds-sh-xs)}
body .weekdays{background:var(--ds-surface-2);border-bottom:1px solid var(--ds-border)}
body .weekdays span{padding:8px;font-size:12px;font-weight:550;color:var(--ds-muted);text-transform:none;letter-spacing:0}
body .day{border-right:1px solid var(--ds-divider);border-bottom:1px solid var(--ds-divider);padding:6px;cursor:pointer;transition:background .1s}
body .day:nth-child(7n){border-right:0}
body .day:hover{background:var(--ds-surface-2)}
body .day.other{background:#fbfbfd;color:var(--ds-faint)}
body .daynum{display:inline-grid;place-items:center;min-width:22px;height:22px;border-radius:999px;font-size:12.5px;font-weight:550;color:var(--ds-text-2);font-variant-numeric:tabular-nums}
body .day.other .daynum{color:var(--ds-faint)}
body .event-chip{margin-top:2px;padding:1px 6px;border-radius:4px;background:var(--ds-info-soft);color:var(--ds-info);font-size:11.5px;font-weight:500;line-height:1.4;transition:filter .1s}
body .event-chip:hover{filter:brightness(.97)}
body .event-chip.demo{background:var(--ds-brand-soft);color:var(--ds-brand-hover)}
body .event-chip.appointment{background:var(--ds-success-soft);color:var(--ds-success)}
body .event-chip.task{background:var(--ds-warning-soft);color:var(--ds-warning)}

/* 8 ─ Activity ───────────────────────────────────────────────────────────── */
body .section-head{padding:20px 0 12px}
body .section-head h2{font-size:17px;font-weight:650;letter-spacing:-.015em}
body .section-head p{font-size:13px;color:var(--ds-muted);margin-top:2px}
body .activity-row{grid-template-columns:36px minmax(0,1fr);gap:12px;padding:14px 16px;border:1px solid var(--ds-border);border-radius:var(--ds-r-lg);background:var(--ds-surface);box-shadow:var(--ds-sh-xs)}
body .activity-icon{width:36px;height:36px;border-radius:var(--ds-r);background:var(--ds-brand-soft);color:var(--ds-brand);font-size:14px;font-weight:600}
body .activity-row p{font-size:13.5px;line-height:1.5;color:var(--ds-text-2)}
body .activity-row p b{color:var(--ds-text)}
body .activity-row small{display:block;margin-top:2px;font-size:12px;color:var(--ds-muted)}
body .activity-row small:first-letter{text-transform:uppercase}

/* 9 ─ Dialogs ────────────────────────────────────────────────────────────── */
body dialog{border:1px solid var(--ds-border);border-radius:var(--ds-r-xl);box-shadow:var(--ds-sh-lg);color:var(--ds-text);background:var(--ds-surface)}
body dialog::backdrop{background:rgba(15,20,32,.48);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
body #inviteDialog,body #eventDialog{width:min(520px,calc(100% - 20px))}
body dialog form{padding:20px 24px}
body .dialog-head{align-items:flex-start;margin:-20px -24px 20px;padding:18px 20px 16px 24px;border-bottom:1px solid var(--ds-border);background:var(--ds-surface)}
body .dialog-head .eyebrow{display:block}
body .dialog-head h2{font-size:18px;line-height:1.3;font-weight:650;letter-spacing:-.015em;margin:2px 0 0}
body .dialog-head.sticky{top:-20px;padding-top:18px}
body .dialog-copy{margin:-4px 0 18px}
body .icon{display:grid;place-items:center;flex:0 0 auto;width:32px;height:32px;padding:0 0 2px;border-radius:var(--ds-r-sm);color:var(--ds-muted);font-size:22px;font-weight:400;line-height:1}
body .icon:hover{background:var(--ds-surface-3);color:var(--ds-text)}
body .icon:focus-visible{outline:0;box-shadow:0 0 0 3px var(--ds-brand-ring)}
body .grid{gap:0 12px}
body .grid>label,body .grid input,body .grid select{min-width:0}
body .lead-form-grid{gap:24px}
body .lead-form-grid h3{font-size:13px;font-weight:600;color:var(--ds-text);margin:0 0 12px;letter-spacing:0}
body .lead-form-grid h3:not(:first-child){margin-top:12px;padding-top:16px;border-top:1px solid var(--ds-divider)}
body .timeline-panel{border-left:1px solid var(--ds-border);padding-left:24px}
body .activity-compose{gap:8px}
body .activity-compose textarea{min-height:96px}
body .notes{margin-top:0}
body .note-item{border-top:1px solid var(--ds-divider);padding:12px 0;font-size:13.5px;line-height:1.5;color:var(--ds-text-2)}
body .note-item:first-child{border-top:0;padding-top:4px}
body .note-meta{align-items:center;gap:8px;margin-bottom:4px;font-size:12px;color:var(--ds-muted);font-variant-numeric:tabular-nums}
body .note-meta b{display:inline-flex;align-items:center;height:20px;padding:0 7px;border-radius:999px;background:var(--ds-surface-3);color:var(--ds-text-2);font-size:11.5px;font-weight:550;text-transform:capitalize}
body #noteHistory:empty:before{content:"No activity logged yet.";display:block;padding:14px;border:1px dashed var(--ds-border-strong);border-radius:var(--ds-r);background:var(--ds-surface-2);color:var(--ds-muted);font-size:13px;text-align:center}
body .quick-actions{gap:6px;margin-top:2px}
body .quick-actions button{min-height:30px;padding:0 10px;border:1px solid var(--ds-border-strong);border-radius:var(--ds-r-sm);background:var(--ds-surface);color:var(--ds-text-2);font-size:12.5px;font-weight:550;box-shadow:var(--ds-sh-xs);transition:background .12s,border-color .12s,color .12s}
body .quick-actions button:hover{border-color:var(--ds-brand);color:var(--ds-brand);background:var(--ds-brand-soft)}
body .dialog-actions{gap:8px;margin:20px -24px -20px;padding:14px 24px;border-top:1px solid var(--ds-border);background:var(--ds-surface-2)}
body .dialog-actions>span{flex:1}
body .sticky-bottom{bottom:-20px;background:var(--ds-surface-2)}

/* 10 ─ Toast ─────────────────────────────────────────────────────────────── */
body .toast{background:var(--ds-nav);color:#fff;border-radius:var(--ds-r);padding:11px 16px;font-size:13.5px;font-weight:500;box-shadow:var(--ds-sh-lg)}

/* 11 ─ Phones (matches the styles.css 760px breakpoint) ─────────────────── */
@media (max-width:760px){
  /* 44px tap targets; 16px inputs stop iOS zoom-on-focus */
  body input:not([type=checkbox]):not([type=radio]),body select{min-height:44px;font-size:16px}
  body textarea{font-size:16px}
  body .primary,body .ghost,body .danger{min-height:44px;padding:0 16px;font-size:14px}
  body .setup-link{min-height:44px}

  body .login-card{padding:28px 20px 20px;border-radius:var(--ds-r-xl)}
  body .login-copy h1{font-size:22px;margin:8px 0 4px}
  body .login-copy p{font-size:14px;margin-bottom:20px}
  body .login-card input:not([type=checkbox]){min-height:44px}
  body .login-card .primary{min-height:44px}
  body .remember-row{min-height:32px;font-size:14px}

  body .app header{padding:0 max(8px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left))}
  body .brand img{height:21px}
  /* visual 36px, tap area 44px */
  body .avatar-btn{width:44px;height:44px;min-height:44px;border:4px solid transparent;background-clip:padding-box;box-shadow:inset 0 0 0 1px var(--ds-border-strong)}

  body main{padding:16px max(16px,env(safe-area-inset-right)) 76px max(16px,env(safe-area-inset-left))}
  body .topline h1{font-size:22px;margin:0}
  body .topline .primary{min-height:44px;padding:0 14px;font-size:14px;border-radius:var(--ds-r)}

  /* bottom tab bar */
  body .nav-tabs{left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));height:58px;padding:4px;gap:4px;background:rgba(255,255,255,.96);backdrop-filter:saturate(1.4) blur(12px);-webkit-backdrop-filter:saturate(1.4) blur(12px);border:1px solid var(--ds-border);border-radius:var(--ds-r-xl);box-shadow:var(--ds-sh-lg)}
  body .nav{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:48px;margin:0;border-radius:var(--ds-r-lg);font-size:11px;font-weight:550;color:var(--ds-muted)}
  body .nav:before{content:"";flex:0 0 auto;width:20px;height:20px;background:currentColor;-webkit-mask:var(--ds-i-leads) center/contain no-repeat;mask:var(--ds-i-leads) center/contain no-repeat}
  body .nav[data-page=calendar]:before{-webkit-mask-image:var(--ds-i-calendar);mask-image:var(--ds-i-calendar)}
  body .nav[data-page=activity]:before{-webkit-mask-image:var(--ds-i-activity);mask-image:var(--ds-i-activity)}
  body .nav.active{background:var(--ds-brand-soft);color:var(--ds-brand)}

  body .metrics{gap:8px;margin:14px 0 12px}
  body .metric{min-height:0;padding:10px 10px 9px;border-radius:var(--ds-r-lg)}
  body .metric span{font-size:11px;line-height:1.25;font-weight:500}
  body .metric strong{font-size:20px;margin-top:4px}

  body .workbar{grid-template-columns:minmax(0,1fr) 124px;gap:8px}
  body .searchbox{height:44px}
  body .searchbox input[type=search],body .searchbox input[type=search]:hover,body .searchbox input[type=search]:focus{min-height:42px;font-size:16px}
  body .workbar select{height:44px;min-height:44px;font-size:15px}
  body .segmented{margin:10px 0}
  body .segment{min-height:38px;padding:0 6px;font-size:13px}

  body .dealer{grid-template-columns:minmax(0,1fr) auto 44px!important;gap:4px 10px;padding:12px 12px 12px 14px}
  body .dealer h3{font-size:14.5px}
  body .dealer .muted,body .dealer .followup{font-size:12.5px}
  body .call-btn{width:44px;height:44px}
  body .call-btn:before{width:18px;height:18px}

  body .calendar-head{padding:12px 0 10px}
  body .calendar-head h2{font-size:16px;padding:0 4px}
  body .iconbtn{width:44px;height:44px;min-height:44px}
  body .calendar-head .primary{padding:0 14px;font-size:14px}
  body .weekdays span{padding:6px 0;font-size:11px}
  body .day{padding:3px 2px}
  body .daynum{min-width:22px;height:22px;font-size:12px}
  body .event-chip{margin-top:2px;padding:1px 3px;font-size:11px;line-height:1.4;border-radius:3px}

  body .section-head{padding:16px 0 12px}
  body .activity-row{padding:12px 14px}

  body dialog{border-radius:var(--ds-r-xl)}
  body dialog form{padding:16px}
  body .dialog-head{margin:-16px -16px 16px;padding:14px 8px 12px 16px}
  body .dialog-head.sticky{top:-16px;padding-top:14px}
  body .icon{width:44px;height:44px;font-size:26px}
  body .lead-form-grid h3{margin-bottom:10px}
  body .timeline-panel{border-left:0;border-top:1px solid var(--ds-divider);padding:16px 0 0;margin-top:16px}
  body .activity-compose{grid-template-columns:104px minmax(0,1fr)}
  body .quick-actions{gap:6px}
  body .quick-actions button{min-height:44px;padding:0 4px;font-size:12.5px;line-height:1.2;white-space:normal}
  body .dialog-actions{margin:16px -16px -16px;padding:12px 16px max(12px,env(safe-area-inset-bottom))}
  body .sticky-bottom{bottom:-16px}
  body .dialog-actions .danger{padding:0 12px}

  body .toast{bottom:calc(max(8px,env(safe-area-inset-bottom)) + 70px);font-size:14px}
}
@media (max-width:390px){
  body .workbar{grid-template-columns:minmax(0,1fr) 112px}
  body .segment{font-size:12.5px}
}
