/* Shared design tokens: the single source for the signed-in dashboard (index.html) and the
   public access page (access.html). Holds the self-hosted font faces, the dark and light colour
   tokens, font stacks, page gutters, the type scale and the header height. Link this file before
   any page styles; do not redefine these names elsewhere. */
/* Self-hosted variable fonts (SIL OFL) — served same-origin from /static/fonts; no external CDN. */
@font-face {
  font-family: "Familjen Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: local("Familjen Grotesk"), url("/dashboard/fonts/FamiljenGrotesk-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Spline Sans Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: local("Spline Sans Mono"), url("/dashboard/fonts/SplineSansMono-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/dashboard/fonts/InstrumentSans-Variable.ttf") format("truetype");
}
/* Inter — the body/reading face. Self-hosted, subsetted (latin + latin-ext, weights 400/600)
   from the same repo assets the landing uses; no external CDN. Kept as the working voice so
   body text reads better on the dark theme; Instrument Sans is the heading face so
   headlines read as distinct. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/dashboard/fonts/inter-400.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/dashboard/fonts/inter-600.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/dashboard/fonts/inter-ext-400.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/dashboard/fonts/inter-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
/* Metric-matched local fallback: Inter swaps in without moving text (CLS). */
@font-face {
  font-family: "Inter Fallback"; src: local("Arial"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 107.4%; ascent-override: 90.2%; descent-override: 22.5%; line-gap-override: 0%;
}
:root {
  --bg: #0f1213; --bg2: #181c1e; --bg3: #1f2426;
  --fg: #eef1f1; --fg2: #aab3b6; --fg3: #868f93;
  --accent: #4fc1de; --accent2: #4fc1de; --accent-ink: #07191e;
  /* Skip link: ink on --accent, 8.58:1. */
  --skip-link-bg: #4fc1de; --skip-link-fg: #07191e;
  --green: #4cb38a; --red: #d97070; --yellow: #d2a24e; --orange: #d2924e;
  --border: #363d40; --border-subtle: #2a3033; --radius: 6px;
  /* Onboarding progress fill: 8.18:1 vs --bg2 and 7.48:1 vs the --bg3 track (non-text >= 3:1). */
  --onboarding-progress-fill: #4fc1de;
  --backlog-divider: #565f64;
  --inbox-message-canvas: var(--bg);
  --sent-bg: var(--bg2); --sent-fg: var(--fg);
  --font: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-head: "Instrument Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "Spline Sans Mono", "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
  --header-height: 56px;
  --touch-target: 44px;
  /* All page-level content stays clear of viewport edges and device cutouts. */
  --page-gutter-left: max(16px, env(safe-area-inset-left, 0px));
  --page-gutter-right: max(16px, env(safe-area-inset-right, 0px));
  /* Proportional dashboard scale: figure 16px, title 18px, reading 14px,
     body and button 14px, metadata and label 12px. The authentication input is currently
     16px to prevent iOS focus zoom. */
  --type-figure: 16px; --type-title: 18px; --type-read: 14px; --type-body: 14px; --type-meta: 12px; --type-label: 12px; --type-button: 14px;
  /* Badge text ink: dark theme fills are light, so badge text is the dark ink. */
  --badge-fg: #07191e;
  /* CRM record name ink: 16.56:1 on --bg, 15.11:1 on --bg2, 13.81:1 on --bg3. */
  --record-name-fg: #eef1f1;
  /* State badges are tinted fills (15% of the state colour) with coloured text; text >= 4.5:1 on the tint over every surface. */
  --badge-green-fg: #4cb38a; --badge-red-fg: #eb9a9a; --badge-yellow-fg: #d2a24e;
  /* Measured, worst case over --bg/--bg2/--bg3: green 4.72, red 5.88, yellow 5.12, gray (--fg2) 5.64, primary (ink on --accent2) 8.58. FinOps values on --bg: green 7.28, red 5.82, yellow 8.08. */
}
[data-theme="light"] {
  --bg: #f4f6f7; --bg2: #ffffff; --bg3: #f1f4f5;
  --fg: #131516; --fg2: #4f585c; --fg3: #666e72;
  /* --accent is the TEXT accent (links, nav, wordmark); darkened for AA on the light
     background (4.67:1 on #f4f6f7 / 5.06:1 on #ffffff). --accent2 is the primary-button
     FILL, darkened from #4fc1de to #33afce so the dark button ink #07191e reads AA on it
     (7.00:1) — matches the typography reference v2.4 tuning. */
  --accent: #187893; --accent2: #33afce; --accent-ink: #07191e;
  /* Skip link: white on a dark teal, 9.76:1. */
  --skip-link-bg: #0d4a5c; --skip-link-fg: #ffffff;
  /* Light status ink — more vivid, all >=5.0:1 on --bg2 (white): green 5.38 / yellow 5.09
     / red 5.16 — matches typography reference v2.4. */
  --green: #0a7a4e; --red: #cc3328; --yellow: #9c6100; --orange: #955719;
  --border: #d3d9dc; --border-subtle: #e4e8ea;
  /* Darker cyan for light theme: 5.04:1 on white, 4.56:1 vs the --bg3 track (accent #4fc1de would fail at 2.10:1). */
  --onboarding-progress-fill: #17798f;
  /* Light-theme fills are dark, so badge text is white. */
  --badge-fg: #ffffff;
  /* CRM record name ink: 16.90:1 on --bg, 18.32:1 on --bg2, 16.57:1 on --bg3. */
  --record-name-fg: #131516;
  --badge-green-fg: #06603c; --badge-red-fg: #a8261b; --badge-yellow-fg: #7a4b00;
  /* Measured, worst case over --bg/--bg2/--bg3: green 5.66, red 5.15, yellow 5.53, gray (--fg2) 5.27, primary 7.00. FinOps values on --bg: green 4.96, red 4.76, yellow 4.70. Hover fill --bg3: --fg 16.57, --fg2 6.59. */
  --backlog-divider: #b7c0c4;
  --inbox-message-canvas: #ffffff;
  --sent-bg: #f1f4f5; --sent-fg: #131516;
}
/* Mobile keeps the same scale (figure 16px, title 18px); no tier is reduced. */
@media (max-width: 768px) {
  :root { --type-figure: 16px; --type-title: 18px; }
}

.crm-record-workspace {
  display: grid;
  gap: 12px;
}

.crm-detail-backdrop {
  display: none;
}

.crm-detail-panel {
  min-width: 0;
}

.crm-detail-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.crm-detail-sheet-header h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.crm-detail-close {
  flex: 0 0 auto;
  min-height: 34px;
}

@media (min-width: 769px) {
  .crm-record-workspace {
    grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
    align-items: start;
  }

  .crm-record-workspace > [data-crm-record-list="true"],
  .crm-record-workspace > [data-crm-detail-state] {
    min-width: 0;
  }

  .crm-detail-close {
    display: none;
  }
}

@media (max-width: 768px) {
  .crm-detail-shell[data-crm-detail-sheet="true"] {
    display: contents;
  }

  .crm-detail-shell[data-crm-detail-sheet="true"][data-crm-sheet-open="false"] .crm-detail-backdrop,
  .crm-detail-shell[data-crm-detail-sheet="true"][data-crm-sheet-open="false"] .crm-detail-panel {
    display: none;
  }

  .crm-detail-shell[data-crm-detail-sheet="true"][data-crm-sheet-open="true"] .crm-detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 180;
    display: block;
    width: 100%;
    min-height: 100dvh;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(8, 12, 14, 0.58);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }

  .crm-detail-shell[data-crm-detail-sheet="true"][data-crm-sheet-open="true"] .crm-detail-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: none;
    z-index: 181;
    display: flex;
    flex-direction: column;
    max-height: min(82dvh, 660px);
    padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    border: 1px solid var(--border-subtle);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: var(--bg2);
    box-shadow: 0 -18px 60px rgba(8, 12, 14, 0.44);
    overflow: hidden;
  }

  .crm-detail-sheet-header {
    flex: 0 0 auto;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .crm-detail-close {
    min-width: 68px;
    min-height: 36px;
    padding: 6px 12px;
  }

  .crm-detail-sheet-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-bottom: 4px;
  }

  .crm-detail-panel :is(button, select, input, textarea, summary, a) {
    min-height: 34px;
  }

  .crm-detail-panel a {
    align-items: center;
    display: inline-flex;
  }

  .crm-detail-panel summary {
    align-items: center;
    display: flex;
  }

  .crm-detail-panel a {
    display: inline-flex !important;
    align-items: center;
    min-height: 34px !important;
  }
}
