/* main.css — mRRacle Flask export.
   Part 1: Funnel (Loki) design tokens + fonts.
   Part 2: mRRacle component classes.
   All colors/spacing/type flow through the CSS custom properties below. */

/* =============================================================================
   Funnel Design System — Tokens, Fonts, Type
   -----------------------------------------------------------------------------
   This file is the single source of design truth for HTML mockups in this
   project. Every preview, kit page, and prototype loads it.

   Source of truth: `loki/packages/theme` (pulled from @funnel-io/theme).
   Light + dark decision tokens, primitive palette, fonts, type scale.
   ========================================================================== */

/* ── Fonts ───────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Funnel Display";
  src: url("../fonts/FunnelDisplay-VariableFont_wght.ttf") format("truetype-variations");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Funnel Sans";
  src: url("../fonts/FunnelSans-VariableFont_wght.ttf") format("truetype-variations");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

/* ── Primitive palette + decision tokens (light) ─────────────────────────── */
:root {
  /* Brand */
  --f-colors-brand-900: #013f33;
  --f-colors-brand-700: #1b5248;
  --f-colors-brand-500: #34655c;
  --f-colors-brand-300: #99b2ad;
  --f-colors-brand-100: #e6eceb;
  --f-colors-brand-50:  #f2f5f5;

  /* Grey */
  --f-colors-grey-900: #121212;
  --f-colors-grey-800: #373737;
  --f-colors-grey-700: #555555;
  --f-colors-grey-600: #7f7f7f;
  --f-colors-grey-500: #9e9e9e;
  --f-colors-grey-400: #cccccc;
  --f-colors-grey-300: #b5bcc5;
  --f-colors-grey-200: #e9e9e9;
  --f-colors-grey-100: #f3f3f3;
  --f-colors-grey-50:  #f8f8f8;
  --f-colors-white:    #ffffff;
  --f-colors-black:    #000000;

  /* Red */
  --f-colors-red-700: #a30330;
  --f-colors-red-500: #d80438;
  --f-colors-red-300: #ff8797;
  --f-colors-red-100: #ffd7dc;
  --f-colors-red-50:  #ffebee;

  /* Yellow */
  --f-colors-yellow-700: #8c7900;
  --f-colors-yellow-500: #eac900;
  --f-colors-yellow-300: #f2df66;
  --f-colors-yellow-100: #fbf4cc;
  --f-colors-yellow-50:  #fdfae6;

  /* Green */
  --f-colors-green-700: #136728;
  --f-colors-green-500: #20ac43;
  --f-colors-green-300: #79cd8e;
  --f-colors-green-100: #d2eed9;
  --f-colors-green-50:  #e9f7ec;

  /* Blue — Funnel primary brand */
  --f-colors-blue-900: #0c4b68; /* clicked / active */
  --f-colors-blue-700: #146b94; /* hover */
  --f-colors-blue-500: #098dc4; /* primary brand */
  --f-colors-blue-300: #7cd3fd;
  --f-colors-blue-100: #e0f2fe;
  --f-colors-blue-50:  #f0f9ff;

  /* Decision tokens — foregrounds */
  --f-colors-default-foreground:  var(--f-colors-grey-900);
  --f-colors-muted-foreground:    var(--f-colors-grey-700);
  --f-colors-disabled-foreground: var(--f-colors-grey-500);
  --f-colors-inverse-foreground:  var(--f-colors-white);
  --f-colors-error-foreground:    var(--f-colors-red-700);
  --f-colors-warning-foreground:  var(--f-colors-yellow-700);
  --f-colors-success-foreground:  var(--f-colors-green-700);
  --f-colors-info-foreground:     var(--f-colors-blue-700);

  /* Decision tokens — backgrounds */
  --f-page-colors-default-background: var(--f-colors-white);
  --f-colors-surface-background:      var(--f-colors-white);
  --f-colors-accent-background:       var(--f-colors-grey-50);
  --f-colors-action-background:       var(--f-colors-blue-500);
  --f-colors-action-hover-background: var(--f-colors-blue-700);
  --f-colors-selected-background:     var(--f-colors-brand-50);
  --f-colors-hover-background:        var(--f-colors-grey-100);
  --f-colors-disabled-background:     var(--f-colors-grey-100);
  --f-colors-inverse-background:      var(--f-colors-grey-900);

  /* Decision tokens — borders */
  --f-colors-default-border:  var(--f-colors-grey-200);
  --f-colors-muted-border:    var(--f-colors-grey-100);
  --f-colors-disabled-border: var(--f-colors-grey-200);
  --f-colors-error-border:    var(--f-colors-red-500);
  --f-colors-focus-border:    var(--f-colors-blue-500);
  --f-colors-card-border:     #d1d6dc;

  /* Input tokens */
  --f-input-colors-default-background: var(--f-colors-white);
  --f-input-colors-default-border:     var(--f-colors-grey-300);
  --f-input-colors-default-text:       var(--f-colors-grey-900);
  --f-input-colors-placeholder-text:   var(--f-colors-grey-500);
  --f-input-colors-hover-border:       var(--f-colors-grey-500);
  --f-input-colors-active-border:      var(--f-colors-blue-500);

  /* Button tokens */
  --f-button-colors-primary-default-background: var(--f-colors-blue-500);
  --f-button-colors-primary-hover-background:   var(--f-colors-blue-700);
  --f-button-colors-primary-active-background:  var(--f-colors-blue-900);
  --f-button-colors-primary-default-text:       var(--f-colors-blue-500);
  --f-button-colors-primary-inverse-text:       var(--f-colors-white);

  --f-button-colors-secondary-default-background: var(--f-colors-white);
  --f-button-colors-secondary-default-border:     #b5bcc5;
  --f-button-colors-secondary-default-text:       #1a1f23;
  --f-button-colors-secondary-default-icon:       #5b5b5b;
  --f-button-colors-secondary-hover-background:   var(--f-colors-grey-100);
  --f-button-colors-secondary-hover-border:       var(--f-colors-grey-400);
  --f-button-colors-secondary-active-background:  var(--f-colors-grey-200);
  --f-button-colors-secondary-active-border:      var(--f-colors-grey-500);

  --f-button-colors-danger-default-background:    #d80438;
  --f-button-colors-danger-hover-background:      #a30330;
  --f-button-colors-danger-active-background:     #6e0220;
  --f-button-colors-danger-inverse-text:          #fff1f1;

  --f-link-colors-default-text: var(--f-colors-blue-500);
  --f-link-colors-hover-text:   var(--f-colors-blue-700);

  /* Selection (checkbox/radio) */
  --f-selection-colors-default-background:  var(--f-colors-white);
  --f-selection-colors-default-border:      var(--f-colors-grey-400);
  --f-selection-colors-hover-border:        var(--f-colors-grey-600);
  --f-selection-colors-selected-background: var(--f-colors-brand-900);
  --f-selection-colors-selected-border:     var(--f-colors-brand-900);
  --f-selection-colors-selected-icon:       var(--f-colors-white);

  /* Badge */
  --f-badge-colors-neutral-background: var(--f-colors-grey-100);
  --f-badge-colors-neutral-border:     var(--f-colors-grey-300);
  --f-badge-colors-neutral-text:       var(--f-colors-grey-800);
  --f-badge-colors-info-background:    var(--f-colors-blue-50);
  --f-badge-colors-info-border:        var(--f-colors-blue-300);
  --f-badge-colors-info-text:          var(--f-colors-blue-700);
  --f-badge-colors-success-background: var(--f-colors-green-50);
  --f-badge-colors-success-border:     var(--f-colors-green-300);
  --f-badge-colors-success-text:       var(--f-colors-green-700);
  --f-badge-colors-warning-background: var(--f-colors-yellow-50);
  --f-badge-colors-warning-border:     var(--f-colors-yellow-300);
  --f-badge-colors-warning-text:       var(--f-colors-yellow-700);
  --f-badge-colors-danger-background:  var(--f-colors-red-50);
  --f-badge-colors-danger-border:      var(--f-colors-red-300);
  --f-badge-colors-danger-text:        var(--f-colors-red-700);
  --f-badge-colors-upsell-background:  #efe7ff;
  --f-badge-colors-upsell-border:      #c5a8ff;
  --f-badge-colors-upsell-text:        #4d1f99;

  /* Dropdown */
  --f-dropdown-menu-colors-default-background:  var(--f-colors-white);
  --f-dropdown-menu-colors-default-border:      var(--f-colors-grey-200);
  --f-dropdown-menu-colors-default-text:        var(--f-colors-grey-900);
  --f-dropdown-menu-colors-hover-background:    var(--f-colors-grey-100);
  --f-dropdown-menu-colors-selected-background: var(--f-colors-brand-50);
  --f-dropdown-menu-sizes-corner:               3.5px;

  /* Fonts */
  --f-fonts-family-header-primary:   "Funnel Display";
  --f-fonts-family-header-secondary: "Funnel Sans";
  --f-fonts-family-body:             "Funnel Sans";
  --f-fonts-family-mono:             ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --f-fonts-base: 14px;

  /* Type scale (rem-relative to 14px base) */
  --f-fonts-size-xs:  10.5px;   /* 0.75rem  — labels, tags */
  --f-fonts-size-sm:  12.25px;  /* 0.875rem — chrome, helper, table */
  --f-fonts-size-md:  14px;     /* 1rem     — body */
  --f-fonts-size-lg:  16px;     /* 1.143rem — emphasised body */
  --f-fonts-size-xl:  20px;     /* heading 5/4 */
  --f-fonts-size-2xl: 24px;     /* heading 3 */
  --f-fonts-size-3xl: 32px;     /* heading 2 */
  --f-fonts-size-4xl: 44px;     /* heading 1 */

  --f-fonts-weight-header-primary:   500;
  --f-fonts-weight-header-secondary: 500;
  --f-fonts-weight-body:             400;
  --f-fonts-weight-highlight:        500;
  --f-fonts-weight-label:            400;

  --f-line-height-heading: 1.15;
  --f-line-height-body:    1.5;

  /* Sizes / spacing / radii */
  --f-sizes-sm-padding: 6px;
  --f-sizes-md-padding: 12px;
  --f-sizes-lg-padding: 16px;
  --f-sizes-sm-corner:  4px;
  --f-sizes-md-corner:  3.5px;
  --f-sizes-lg-corner:  8px;
  --f-sizes-xl-corner:  12px;

  --f-button-sizes-corner: 6px;
  --f-button-sizes-sm-height: 26px;
  --f-button-sizes-md-height: 36px;
  --f-button-sizes-lg-height: 40px;
  --f-button-sizes-sm-padding: 8px;
  --f-button-sizes-md-padding: 12px;
  --f-button-sizes-lg-padding: 16px;
  --f-button-sizes-sm-gap: 4px;
  --f-button-sizes-md-gap: 6px;
  --f-button-sizes-lg-gap: 8px;

  --f-input-sizes-sm-height: 26px;
  --f-input-sizes-md-height: 36px;
  --f-input-sizes-corner:    3.5px;
  --f-input-sizes-md-padding: 10px;

  --f-badge-sizes-corner: 100rem;
  --f-badge-sizes-height: 18px;

  /* Shadows */
  --f-shadow-sm:  0 1px 2px rgba(18, 18, 18, 0.06);
  --f-shadow-md:  0 4px 12px rgba(18, 18, 18, 0.08);
  --f-shadow-lg:  0 12px 32px rgba(18, 18, 18, 0.12);
  --f-shadow-pop: 0 16px 48px rgba(18, 18, 18, 0.18);
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
.dark {
  --f-colors-default-foreground:  #f3f3f3;
  --f-colors-muted-foreground:    #b3b3b3;
  --f-colors-disabled-foreground: #6a6a6a;
  --f-colors-inverse-foreground:  var(--f-colors-grey-900);

  --f-page-colors-default-background: #0c1311;
  --f-colors-surface-background:      #131a18;
  --f-colors-accent-background:       #1a2421;
  --f-colors-action-background:       #1cb1f3;
  --f-colors-action-hover-background: #4dc6ff;
  --f-colors-selected-background:     #1c3933;
  --f-colors-hover-background:        #1f2826;
  --f-colors-disabled-background:     #232a28;
  --f-colors-inverse-background:      var(--f-colors-grey-50);

  --f-colors-default-border:  #28302e;
  --f-colors-muted-border:    #1f2624;
  --f-colors-disabled-border: #2d3432;
  --f-colors-focus-border:    #4dc6ff;
  --f-colors-card-border:     #2a3331;

  --f-input-colors-default-background: #0f1715;
  --f-input-colors-default-border:     #2a3331;
  --f-input-colors-default-text:       #f3f3f3;
  --f-input-colors-placeholder-text:   #6a6a6a;
  --f-input-colors-hover-border:       #3b4744;
  --f-input-colors-active-border:      #4dc6ff;

  --f-button-colors-primary-default-background: #098dc4;
  --f-button-colors-primary-hover-background:   #1cb1f3;
  --f-button-colors-primary-active-background:  #146b94;
  --f-button-colors-primary-inverse-text:       #ffffff;

  --f-button-colors-secondary-default-background: var(--f-colors-surface-background);
  --f-button-colors-secondary-default-border:     #2a3331;
  --f-button-colors-secondary-default-text:       #f3f3f3;
  --f-button-colors-secondary-default-icon:       #b3b3b3;
  --f-button-colors-secondary-hover-background:   #1f2826;
  --f-button-colors-secondary-hover-border:       #3b4744;
  --f-button-colors-secondary-active-background:  #28302e;
  --f-button-colors-secondary-active-border:      #4d5a57;

  --f-link-colors-default-text: #4dc6ff;
  --f-link-colors-hover-text:   #7cd3fd;

  --f-selection-colors-default-background:  #0f1715;
  --f-selection-colors-default-border:      #3b4744;
  --f-selection-colors-hover-border:        #5a6764;
  --f-selection-colors-selected-background: #36997d;
  --f-selection-colors-selected-border:     #36997d;

  --f-badge-colors-neutral-background: #1f2826;
  --f-badge-colors-neutral-border:     #2a3331;
  --f-badge-colors-neutral-text:       #d6d6d6;
  --f-badge-colors-info-background:    rgba(28, 177, 243, 0.12);
  --f-badge-colors-info-border:        rgba(28, 177, 243, 0.4);
  --f-badge-colors-info-text:          #7cd3fd;
  --f-badge-colors-success-background: rgba(32, 172, 67, 0.12);
  --f-badge-colors-success-border:     rgba(32, 172, 67, 0.4);
  --f-badge-colors-success-text:       #79cd8e;
  --f-badge-colors-warning-background: rgba(234, 201, 0, 0.12);
  --f-badge-colors-warning-border:     rgba(234, 201, 0, 0.4);
  --f-badge-colors-warning-text:       #f2df66;
  --f-badge-colors-danger-background:  rgba(255, 55, 81, 0.12);
  --f-badge-colors-danger-border:      rgba(255, 55, 81, 0.4);
  --f-badge-colors-danger-text:        #ff8797;
  --f-badge-colors-upsell-background:  rgba(157, 116, 255, 0.12);
  --f-badge-colors-upsell-border:      rgba(157, 116, 255, 0.4);
  --f-badge-colors-upsell-text:        #c5a8ff;

  --f-dropdown-menu-colors-default-background:  #131a18;
  --f-dropdown-menu-colors-default-border:      #28302e;
  --f-dropdown-menu-colors-default-text:        #f3f3f3;
  --f-dropdown-menu-colors-hover-background:    #1f2826;
  --f-dropdown-menu-colors-selected-background: #1c3933;
}

/* ── Base elements ───────────────────────────────────────────────────────── */
html {
  font-size: var(--f-fonts-base);
  font-family: var(--f-fonts-family-body), system-ui, sans-serif;
  font-weight: var(--f-fonts-weight-body);
  color: var(--f-colors-default-foreground);
  background: var(--f-page-colors-default-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-size: var(--f-fonts-size-md);
  line-height: var(--f-line-height-body);
  background: var(--f-page-colors-default-background);
  color: var(--f-colors-default-foreground);
}

* { box-sizing: border-box; }

::selection { background: var(--f-colors-selected-background); color: var(--f-colors-default-foreground); }

/* ── Heading scale ───────────────────────────────────────────────────────── */
.text-fun-h1, h1.f { font-family: var(--f-fonts-family-header-primary); font-weight: var(--f-fonts-weight-header-primary); font-size: var(--f-fonts-size-4xl); line-height: var(--f-line-height-heading); letter-spacing: -0.02em; }
.text-fun-h2, h2.f { font-family: var(--f-fonts-family-header-primary); font-weight: var(--f-fonts-weight-header-primary); font-size: var(--f-fonts-size-3xl); line-height: var(--f-line-height-heading); letter-spacing: -0.015em; }
.text-fun-h3, h3.f { font-family: var(--f-fonts-family-header-secondary); font-weight: var(--f-fonts-weight-header-secondary); font-size: var(--f-fonts-size-2xl); line-height: 1.25; }
.text-fun-h4, h4.f { font-family: var(--f-fonts-family-header-secondary); font-weight: var(--f-fonts-weight-header-secondary); font-size: var(--f-fonts-size-xl); line-height: 1.3; }
.text-fun-h5, h5.f { font-family: var(--f-fonts-family-header-secondary); font-weight: var(--f-fonts-weight-header-secondary); font-size: var(--f-fonts-size-lg); line-height: 1.35; }

/* ── Color utilities ─────────────────────────────────────────────────────── */
.text-fun-default  { color: var(--f-colors-default-foreground); }
.text-fun-muted    { color: var(--f-colors-muted-foreground); }
.text-fun-disabled { color: var(--f-colors-disabled-foreground); }
.text-fun-inverse  { color: var(--f-colors-inverse-foreground); }
.text-fun-error    { color: var(--f-colors-error-foreground); }
.text-fun-warning  { color: var(--f-colors-warning-foreground); }
.text-fun-success  { color: var(--f-colors-success-foreground); }
.text-fun-info     { color: var(--f-colors-info-foreground); }

.bg-fun-page     { background: var(--f-page-colors-default-background); }
.bg-fun-surface  { background: var(--f-colors-surface-background); }
.bg-fun-accent   { background: var(--f-colors-accent-background); }
.bg-fun-action   { background: var(--f-colors-action-background); }
.bg-fun-selected { background: var(--f-colors-selected-background); }
.bg-fun-hover    { background: var(--f-colors-hover-background); }
.bg-fun-disabled { background: var(--f-colors-disabled-background); }
.bg-fun-inverse  { background: var(--f-colors-inverse-background); }

.border-fun-default  { border-color: var(--f-colors-default-border); }
.border-fun-muted    { border-color: var(--f-colors-muted-border); }
.border-fun-disabled { border-color: var(--f-colors-disabled-border); }
.border-fun-error    { border-color: var(--f-colors-error-border); }
.border-fun-focus    { border-color: var(--f-colors-focus-border); }

/* Mono / code */
code, kbd, samp, .font-mono { font-family: var(--f-fonts-family-mono); font-size: 0.92em; }
code:not(pre code) { background: var(--f-colors-hover-background); padding: 0.1em 0.35em; border-radius: 4px; }

/* Link */
.fun-link, a.fun-link { color: var(--f-link-colors-default-text); text-decoration: none; }
.fun-link:hover, a.fun-link:hover { color: var(--f-link-colors-hover-text); text-decoration: underline; }

/* Focus */
.fun-focus-ring:focus-visible, *:focus-visible.fun-focus { outline: 2px solid var(--f-colors-focus-border); outline-offset: 1px; border-radius: var(--f-sizes-sm-corner); }

/* ── mRRacle app supplement — component tokens mapped to Loki primitives ──── */
:root {
  --f-colors-green-600:  #17862f;
  --f-colors-red-600:    #bf0330;
  --f-colors-yellow-600: #b39e00;

  --f-alert-colors-success-background: var(--f-colors-green-50);
  --f-alert-colors-success-border:     var(--f-colors-green-300);
  --f-alert-colors-danger-background:  var(--f-colors-red-50);
  --f-alert-colors-danger-border:      var(--f-colors-red-300);
  --f-alert-colors-warning-background: var(--f-colors-yellow-50);
  --f-alert-colors-warning-border:     var(--f-colors-yellow-300);

  --f-table-colors-cell-header-default-background: var(--f-colors-grey-50);
  --f-table-colors-cell-header-text:               var(--f-colors-grey-600);
  --f-table-colors-row-hover-background:           var(--f-colors-grey-100);

  --f-nav-colors-active-icon:       var(--f-colors-brand-700);
  --f-nav-colors-default-icon:      var(--f-colors-grey-500);
  --f-nav-colors-active-background: var(--f-colors-grey-100);
  --f-nav-colors-hover-background:  var(--f-colors-grey-100);
  --f-nav-colors-default-text:      var(--f-colors-grey-800);

  --f-pane-colors-default-border: var(--f-colors-grey-200);
  --f-pane-sizes-corner:          8px;
  --f-pane-sizes-padding:         16px;

  --mrr-halo: #c2913a;
}
.dark {
  --f-colors-green-600: #2fae7d;

  --f-alert-colors-success-background: rgba(32, 172, 67, 0.12);
  --f-alert-colors-success-border:     rgba(32, 172, 67, 0.40);
  --f-alert-colors-danger-background:  rgba(255, 55, 81, 0.12);
  --f-alert-colors-danger-border:      rgba(255, 55, 81, 0.40);
  --f-alert-colors-warning-background: rgba(234, 201, 0, 0.12);
  --f-alert-colors-warning-border:     rgba(234, 201, 0, 0.40);

  --f-table-colors-cell-header-default-background: #131a18;
  --f-table-colors-cell-header-text:               #b3b3b3;
  --f-table-colors-row-hover-background:           #1f2826;

  --f-nav-colors-active-icon:       #4dc6ff;
  --f-nav-colors-default-icon:      #b3b3b3;
  --f-nav-colors-active-background: #1f2826;
  --f-nav-colors-hover-background:  #1f2826;
  --f-nav-colors-default-text:      #f3f3f3;

  --f-pane-colors-default-border: #28302e;

  --mrr-halo: #e6c167;
}


/* ═══════════════════════════════════════════════════════════════════════
   mRRacle — component styles
   Built on the Funnel (Loki) design tokens defined above.
   Style hooks are CLASSES only; JS behavior hooks are data-* attributes.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Base ──────────────────────────────────────────────────────────── */
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--f-fonts-family-body), system-ui, sans-serif;
  font-weight: var(--f-fonts-weight-body);
  background: var(--f-page-colors-default-background);
  color: var(--f-colors-default-foreground);
  font-size: var(--f-fonts-size-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
input::placeholder, textarea::placeholder { color: var(--f-input-colors-placeholder-text); }

.scroll-area::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-area::-webkit-scrollbar-thumb {
  background: var(--f-colors-grey-200);
  border-radius: 8px;
  border: 2px solid var(--f-colors-surface-background);
}

/* ── App shell ─────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; min-height: 0; }

.app-header {
  display: flex; align-items: center; gap: 20px;
  height: 60px; flex: none; padding: 0 20px;
  background: var(--f-colors-surface-background);
  border-bottom: 1px solid var(--f-colors-default-border);
  position: relative; z-index: 20;
}
.app-header__spacer { flex: 1; min-width: 8px; }

.wordmark {
  font-family: var(--f-fonts-family-header-primary), sans-serif;
  font-weight: 700; letter-spacing: -0.02em; font-size: 22px;
  color: var(--f-colors-default-foreground);
  text-decoration: none;
}
.wordmark__halo-target { position: relative; display: inline-block; }
.wordmark__halo {
  position: absolute; left: -0.04em; right: -0.04em; top: -0.30em; height: 0.23em;
  border: 0.05em solid var(--mrr-halo); border-radius: 50%; transform: rotate(-7deg);
}

.search-pill { position: relative; display: inline-flex; align-items: center; }
.search-pill svg {
  position: absolute; left: 12px; width: 14px; height: 14px;
  color: var(--f-colors-muted-foreground); pointer-events: none;
}
.search-pill input {
  height: 29px; padding: 0 12px 0 33px;
  border: 1px solid var(--f-colors-muted-border); border-radius: 100rem;
  background: transparent; color: var(--f-input-colors-default-text);
  font-family: inherit; font-size: var(--f-fonts-size-sm); outline: none;
  width: 221px;
}
.search-pill input:focus { border-color: var(--f-colors-focus-border); }
.search-pill--toolbar input {
  width: 240px; height: 32px;
  border-color: var(--f-button-colors-secondary-default-border);
  background: var(--f-button-colors-secondary-default-background);
}

.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--f-colors-brand-500), var(--f-colors-brand-900));
  color: var(--f-button-colors-primary-inverse-text);
  font-size: 13px; font-weight: var(--f-fonts-weight-highlight);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.app-body { display: flex; flex: 1; min-height: 0; }

.sidebar {
  flex: none; width: 155px; padding: 12px 8px;
  background: var(--f-colors-surface-background);
  border-right: 1px solid var(--f-colors-default-border);
  display: flex; flex-direction: column;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px; border: 0; border-radius: var(--f-sizes-sm-corner);
  background: transparent; color: var(--f-nav-colors-default-text);
  font-family: inherit; font-size: var(--f-fonts-size-md);
  text-align: left; cursor: pointer; text-decoration: none; box-sizing: border-box;
}
.nav-link:hover { background: var(--f-nav-colors-hover-background); }
.nav-link.is-active { background: var(--f-nav-colors-active-background); font-weight: var(--f-fonts-weight-highlight); }
.nav-link__icon { display: inline-flex; flex: none; color: var(--f-nav-colors-default-icon); }
.nav-link.is-active .nav-link__icon { color: var(--f-nav-colors-active-icon); }
.nav-link__label { flex: 1; min-width: 0; }
.nav-link__count {
  flex: none; min-width: 20px; padding: 0 7px; border-radius: 100rem;
  text-align: center; font-size: var(--f-fonts-size-xs);
  font-weight: var(--f-fonts-weight-highlight); line-height: 18px;
  background: var(--f-colors-accent-background); color: var(--f-colors-muted-foreground);
}

.app-main {
  flex: 1; min-width: 0; overflow-y: auto; padding: 20px;
  background: var(--f-colors-grey-50);
}
.dark .app-main { background: var(--f-page-colors-default-background); }
.container { max-width: 1440px; margin: 0 auto; }

/* ── Page headers ──────────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-title {
  margin: 4px 0 6px; flex: 1; min-width: 0;
  font-family: var(--f-fonts-family-header-primary);
  font-weight: var(--f-fonts-weight-header-primary);
  font-size: var(--f-fonts-size-3xl); line-height: 1.15; letter-spacing: -0.015em;
}
.page-title__sub {
  display: block; margin-top: 8px;
  font-size: var(--f-fonts-size-xl); font-weight: var(--f-fonts-weight-body);
  color: var(--f-colors-muted-foreground); letter-spacing: 0;
}
.page-header__side { flex: none; margin-top: 8px; display: flex; flex-direction: column; align-items: flex-end; }
.page-header__side-row { display: flex; align-items: center; gap: 10px; }
.page-header__updated { font-size: var(--f-fonts-size-xs); color: var(--f-colors-muted-foreground); margin-top: 9px; }

.section-heading { display: flex; align-items: center; gap: 12px; margin: 32px 0 14px; }
.section-heading h2 {
  margin: 0; font-family: var(--f-fonts-family-header-secondary);
  font-weight: var(--f-fonts-weight-highlight); font-size: var(--f-fonts-size-xl);
}
.section-heading__rule { flex: 1; height: 1px; background: var(--f-colors-default-border); }

.eyebrow {
  font-size: var(--f-fonts-size-xs); text-transform: uppercase; letter-spacing: .1em;
  color: var(--f-colors-muted-foreground); font-weight: var(--f-fonts-weight-highlight);
  font-family: var(--f-fonts-family-mono);
}
.count-chip {
  font-size: var(--f-fonts-size-xs); color: var(--f-colors-muted-foreground);
  background: var(--f-colors-accent-background); border-radius: 100rem;
  padding: 2px 8px; font-weight: var(--f-fonts-weight-highlight);
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: var(--f-button-sizes-md-height); padding: 0 12px;
  border-radius: var(--f-button-sizes-corner);
  font-family: inherit; font-size: var(--f-fonts-size-sm);
  font-weight: var(--f-fonts-weight-highlight);
  cursor: pointer; white-space: nowrap; text-decoration: none; box-sizing: border-box;
}
.btn:disabled { background: var(--f-colors-disabled-background); border-color: var(--f-colors-disabled-border); color: var(--f-colors-disabled-foreground); cursor: not-allowed; }

.btn--primary {
  padding: 0 14px;
  border: 1px solid var(--f-button-colors-primary-default-background);
  background: var(--f-button-colors-primary-default-background);
  color: var(--f-button-colors-primary-default-text);
}
.btn--primary:hover:not(:disabled) { background: var(--f-button-colors-primary-hover-background); }

.btn--secondary {
  border: 1px solid var(--f-button-colors-secondary-default-border);
  background: var(--f-button-colors-secondary-default-background);
  color: var(--f-button-colors-secondary-default-text);
}
.btn--secondary:hover:not(:disabled) {
  background: var(--f-button-colors-secondary-hover-background);
  border-color: var(--f-button-colors-secondary-hover-border);
}

.btn--quiet { border: 0; background: transparent; color: var(--f-colors-default-foreground); }
.btn--quiet:hover { background: var(--f-colors-hover-background); }

.btn--sm { height: 28px; padding: 0 10px; font-size: var(--f-fonts-size-xs); gap: 5px; }

.btn--link-blue { border: 0; background: transparent; color: var(--f-colors-blue-700); padding: 0 10px; height: 34px; }
.btn--link-blue:hover { background: var(--f-colors-hover-background); }

.btn--danger-quiet { border: 0; background: transparent; color: var(--f-colors-error-foreground); }
.btn--danger-quiet:hover { background: var(--f-colors-hover-background); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; border: 0; background: transparent;
  color: var(--f-colors-muted-foreground);
  border-radius: var(--f-button-sizes-corner); cursor: pointer;
  font-family: inherit;
}
.icon-btn:hover { background: var(--f-colors-hover-background); }
.icon-btn--sm { width: 28px; height: 28px; }
.icon-btn--close { font-size: 20px; line-height: 1; }

/* Select styled as a secondary button (with chevron) */
.select-pill { position: relative; display: inline-flex; align-items: center; }
.select-pill select {
  appearance: none; -webkit-appearance: none;
  height: 32px; padding: 0 30px 0 12px;
  border: 1px solid var(--f-button-colors-secondary-default-border);
  background: var(--f-button-colors-secondary-default-background);
  color: var(--f-colors-default-foreground);
  border-radius: var(--f-button-sizes-corner);
  font-family: inherit; font-size: var(--f-fonts-size-sm);
  font-weight: var(--f-fonts-weight-highlight); cursor: pointer;
}
.select-pill svg {
  position: absolute; right: 10px; width: 13px; height: 13px;
  color: var(--f-colors-muted-foreground); pointer-events: none;
}

/* ── Dropdown menus ────────────────────────────────────────────────── */
.menu-root { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); right: 0; width: 220px;
  background: var(--f-dropdown-menu-colors-default-background);
  border: 1px solid var(--f-dropdown-menu-colors-default-border);
  border-radius: var(--f-sizes-lg-corner);
  box-shadow: var(--f-shadow-pop);
  overflow: hidden; z-index: 25; padding: 4px;
}
.menu[hidden] { display: none; }
.menu--wide { width: 248px; padding: 0; }
.menu--filter { width: 230px; padding: 8px; }
.menu--compact { width: 180px; padding: 0; }
.menu__label {
  font-size: var(--f-fonts-size-xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--f-colors-muted-foreground); font-weight: var(--f-fonts-weight-highlight);
  padding: 4px 10px 6px;
}
.menu__sep { height: 1px; background: var(--f-colors-default-border); margin: 7px 6px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 14px; border: 0; background: transparent;
  color: var(--f-dropdown-menu-colors-default-text);
  font-family: inherit; font-size: var(--f-fonts-size-sm); text-align: left;
  cursor: pointer; text-decoration: none; box-sizing: border-box;
  border-radius: var(--f-sizes-sm-corner);
}
.menu-item:hover { background: var(--f-dropdown-menu-colors-hover-background); }
.menu-item.is-selected { background: var(--f-dropdown-menu-colors-selected-background); font-weight: var(--f-fonts-weight-highlight); }
.menu-item--danger { color: var(--f-colors-error-foreground); }
.menu-item__grow { flex: 1; }

/* ── Badges & type tags ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; height: var(--f-badge-sizes-height);
  padding: 0 9px; border-radius: var(--f-badge-sizes-corner);
  font-size: var(--f-fonts-size-xs); font-weight: var(--f-fonts-weight-highlight);
  white-space: nowrap;
}
.badge--success { background: var(--f-badge-colors-success-background); color: var(--f-badge-colors-success-text); border: 1px solid var(--f-badge-colors-success-border); }
.badge--neutral { background: var(--f-badge-colors-neutral-background); color: var(--f-badge-colors-neutral-text); border: 1px solid var(--f-badge-colors-neutral-border); }
.badge--danger  { background: var(--f-badge-colors-danger-background);  color: var(--f-badge-colors-danger-text);  border: 1px solid var(--f-badge-colors-danger-border); }
.badge--warning { background: var(--f-badge-colors-warning-background); color: var(--f-badge-colors-warning-text); border: 1px solid var(--f-badge-colors-warning-border); }
.badge--info    { background: var(--f-badge-colors-info-background);    color: var(--f-badge-colors-info-text);    border: 1px solid var(--f-badge-colors-info-border); }

.type-tag {
  display: inline-flex; align-items: center; height: 18px; padding: 0 8px;
  border-radius: 100rem; font-size: var(--f-fonts-size-xs);
  font-weight: var(--f-fonts-weight-highlight); white-space: nowrap;
}
.type-tag--new_biz      { background: #E8EEEC; color: #2C5750; border: 1px solid #34655C; }
.type-tag--expansion    { background: #EFEFEF; color: #6B6B6B; border: 1px solid #B6B6B6; }
.type-tag--contraction  { background: #FFEEE9; color: #BF4E35; border: 1px solid #FFAC9B; }
.type-tag--churn        { background: #FEEAE4; color: #C9432A; border: 1px solid #F86C54; }
.type-tag--reactivation { background: #E7F5FD; color: #0C6F9E; border: 1px solid #1CB1F3; }
.type-tag--adjustment   { background: var(--f-colors-grey-100); color: var(--f-colors-grey-600); border: 1px solid var(--f-colors-grey-300); }

/* ── Panels & cards ────────────────────────────────────────────────── */
.panel {
  background: var(--f-colors-surface-background);
  border: 1px solid var(--f-pane-colors-default-border);
  border-radius: var(--f-pane-sizes-corner);
  box-shadow: var(--f-shadow-sm);
  overflow: hidden; align-self: start;
}
.empty-state {
  margin-top: 24px; padding: 48px 18px; text-align: center;
  color: var(--f-colors-muted-foreground);
  background: var(--f-colors-surface-background);
  border: 1px solid var(--f-pane-colors-default-border);
  border-radius: var(--f-sizes-lg-corner);
}
.empty-state--bare { border: 0; background: transparent; padding: 36px 18px; font-size: var(--f-fonts-size-sm); margin-top: 0; }

.deal-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.deal-card {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 18px;
  background: var(--f-colors-surface-background);
  border: 1px solid var(--f-pane-colors-default-border);
  border-radius: var(--f-sizes-lg-corner);
  cursor: pointer; text-decoration: none; color: inherit;
}
.deal-card:hover { border-color: var(--f-colors-grey-300); box-shadow: var(--f-shadow-sm); }
.deal-card:focus-visible { outline: 2px solid var(--f-colors-focus-border); outline-offset: 1px; }
.deal-card__body { min-width: 0; }
.deal-card__title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deal-card__name { font-weight: var(--f-fonts-weight-highlight); font-size: var(--f-fonts-size-lg); }
.deal-card__meta { color: var(--f-colors-muted-foreground); font-size: var(--f-fonts-size-sm); margin-top: 3px; }
.deal-card__right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; transition: opacity .15s; }
.deal-card__amount { font-variant-numeric: tabular-nums; font-weight: var(--f-fonts-weight-highlight); text-align: right; font-family: var(--f-fonts-family-mono); }
.deal-card__amount.is-negative { color: var(--f-colors-error-foreground); }
.deal-card__actions {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 8px; padding: 0 18px 0 64px;
  background: linear-gradient(90deg, transparent, var(--f-colors-surface-background) 38%);
  border-radius: var(--f-sizes-lg-corner);
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.deal-card:hover .deal-card__actions,
.deal-card:focus-within .deal-card__actions { opacity: 1; pointer-events: auto; }
.deal-card:hover .deal-card__right.can-hide,
.deal-card:focus-within .deal-card__right.can-hide { opacity: 0; }

.attention {
  display: flex; flex-direction: column; gap: 6px; margin-top: 10px;
  padding: 10px 12px; border-radius: var(--f-sizes-md-corner);
  background: var(--f-colors-yellow-50); border: 1px solid var(--f-colors-yellow-300);
}
.attention__head {
  font-size: var(--f-fonts-size-xs); text-transform: uppercase; letter-spacing: .06em;
  color: var(--f-colors-muted-foreground); font-weight: var(--f-fonts-weight-highlight);
}
.attention__item { display: flex; gap: 7px; align-items: flex-start; font-size: var(--f-fonts-size-sm); color: var(--f-colors-muted-foreground); }

/* ── History list ──────────────────────────────────────────────────── */
.history-list {
  background: var(--f-colors-surface-background);
  border: 1px solid var(--f-pane-colors-default-border);
  border-radius: var(--f-sizes-lg-corner); overflow: hidden;
}
.history-row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--f-colors-muted-border); }
.history-row:last-child { border-bottom: 0; }
.history-row__dot { flex: none; width: 9px; height: 9px; border-radius: 50%; }
.history-row__dot--approved { background: var(--f-colors-success-foreground); }
.history-row__dot--rejected { background: var(--f-colors-error-foreground); }
.history-row__dot--needs_info { background: var(--f-colors-warning-foreground); }
.history-row__body { flex: 1; min-width: 0; }
.history-row__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.history-row__name { font-weight: var(--f-fonts-weight-highlight); }
.history-row__value { font-variant-numeric: tabular-nums; font-family: var(--f-fonts-family-mono); font-size: var(--f-fonts-size-sm); }
.history-row__value.is-negative { color: var(--f-colors-error-foreground); }
.history-row__meta { color: var(--f-colors-muted-foreground); font-size: var(--f-fonts-size-sm); margin-top: 2px; }

/* ── Toolbar (ledger / customers) ──────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; flex-wrap: wrap; }
.toolbar__spacer { flex: 1; min-width: 12px; }

/* ── Data tables ───────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--f-fonts-size-sm); }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: var(--f-fonts-size-xs); text-transform: uppercase; letter-spacing: .05em;
  color: var(--f-table-colors-cell-header-text);
  font-weight: var(--f-fonts-weight-highlight);
  background: var(--f-table-colors-cell-header-default-background);
  white-space: nowrap;
}
.data-table th.is-numeric, .data-table td.is-numeric { text-align: right; }
.data-table th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.data-table th .sort-arrow { width: 11px; height: 11px; opacity: .28; transition: transform .12s; }
.data-table th .sort-arrow.is-active { opacity: 1; }
.data-table th .sort-arrow.is-desc { transform: rotate(180deg); }
.data-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--f-colors-default-border);
  white-space: nowrap;
}
.data-table td.is-numeric { font-family: var(--f-fonts-family-mono); font-variant-numeric: tabular-nums; }
.data-table td.is-numeric.is-negative { color: var(--f-colors-error-foreground); }
.data-table td.is-strong { font-weight: var(--f-fonts-weight-highlight); }
.data-table tbody tr:hover { background: var(--f-table-colors-row-hover-background); }
.data-table .row-empty td { padding: 30px 14px; text-align: center; color: var(--f-colors-muted-foreground); }

tr.is-locked td { background: var(--f-colors-accent-background); color: var(--f-colors-muted-foreground); }
tr.is-selected td { background: var(--f-colors-selected-background); }
tr.is-clickable { cursor: pointer; }

.action-cell {
  text-align: right; padding: 6px 14px; white-space: nowrap;
  position: sticky; right: 0;
  background: var(--f-colors-surface-background);
  box-shadow: -8px 0 8px -8px rgba(0,0,0,0.12);
}
th.action-cell { background: var(--f-table-colors-cell-header-default-background); }
tr.is-locked .action-cell { background: var(--f-colors-accent-background); }

.row-view-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px;
  border: 0; background: transparent; color: var(--f-colors-blue-700);
  font-family: inherit; font-size: var(--f-fonts-size-sm);
  font-weight: var(--f-fonts-weight-highlight);
  border-radius: var(--f-button-sizes-corner); cursor: pointer; white-space: nowrap;
  text-decoration: none;
  opacity: .4; transition: opacity .12s;
}
tr:hover .row-view-btn, .row-view-btn:focus-visible { opacity: 1; }
.locked-label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--f-fonts-size-xs); color: var(--f-colors-muted-foreground); white-space: nowrap;
}

/* Copy-to-clipboard cell affordance */
.copy-cell__wrap { display: inline-flex; align-items: center; gap: 7px; }
.cell-copy-btn {
  width: 22px; height: 22px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--f-colors-muted-foreground);
  border-radius: var(--f-button-sizes-corner); cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
td:hover .cell-copy-btn { opacity: .6; }
.cell-copy-btn:hover, .cell-copy-btn:focus-visible { opacity: 1; }

/* Hide-column affordance in header cells */
.col-hide-btn {
  margin-left: 6px; vertical-align: middle; width: 16px; height: 16px; padding: 0;
  border: 0; background: transparent; color: var(--f-colors-muted-foreground);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .12s;
}
th:hover .col-hide-btn { opacity: .55; }
th .col-hide-btn:hover { opacity: 1; }

/* Column-visibility checkbox row (edit columns menu) */
.col-check { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: transparent; color: var(--f-colors-default-foreground); font-family: inherit; font-size: var(--f-fonts-size-sm); text-align: left; border-radius: var(--f-sizes-sm-corner); cursor: pointer; }
.col-check:hover { background: var(--f-dropdown-menu-colors-hover-background); }
.col-check__box {
  width: 16px; height: 16px; flex: none; border-radius: var(--f-sizes-sm-corner);
  border: 1px solid var(--f-input-colors-default-border);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--f-input-colors-default-background);
}
.col-check.is-checked .col-check__box {
  background: var(--f-selection-colors-selected-background);
  border-color: var(--f-selection-colors-selected-border);
  color: var(--f-selection-colors-selected-icon);
}

/* ── Forms ─────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field--full { grid-column: 1 / -1; }
.field > span {
  font-size: var(--f-fonts-size-sm); color: var(--f-colors-muted-foreground);
  font-weight: var(--f-fonts-weight-highlight);
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }

.input, .select, .textarea {
  border: 1px solid var(--f-input-colors-default-border);
  border-radius: var(--f-input-sizes-corner);
  padding: 0 10px; height: var(--f-input-sizes-md-height);
  font-size: var(--f-fonts-size-sm); font-family: inherit;
  background: var(--f-input-colors-default-background);
  color: var(--f-input-colors-default-text);
  box-sizing: border-box; width: 100%;
}
.textarea { padding: 8px 10px; height: auto; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--f-input-colors-hover-border); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--f-input-colors-active-border); }
.input.is-invalid, .select.is-invalid { border-color: var(--f-colors-error-border); }
.input[readonly], .input:disabled, .select:disabled, .textarea:disabled {
  background: var(--f-colors-accent-background);
  color: var(--f-colors-muted-foreground); cursor: default;
}

.title-input {
  font-family: var(--f-fonts-family-header-primary);
  font-weight: var(--f-fonts-weight-highlight);
  font-size: var(--f-fonts-size-2xl); letter-spacing: -0.02em;
  border: 1px solid var(--f-input-colors-active-border);
  border-radius: var(--f-input-sizes-corner);
  padding: 2px 8px; background: var(--f-input-colors-default-background);
  color: var(--f-input-colors-default-text); min-width: 0; width: 320px;
}

/* ── Drawer (review deal / movement detail) ────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(26,23,20,.42); z-index: 40; border: 0; padding: 0; }
@keyframes drawer-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 94vw);
  background: var(--f-colors-surface-background);
  border-left: 1px solid var(--f-colors-default-border);
  box-shadow: var(--f-shadow-pop); z-index: 41; overflow-y: auto;
  animation: drawer-slide-in .28s cubic-bezier(.4,0,.2,1);
}
.drawer__header {
  display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 16px;
  border-bottom: 1px solid var(--f-colors-default-border);
  position: sticky; top: 0; background: var(--f-colors-surface-background); z-index: 1;
}
.drawer__header-main { flex: 1; min-width: 0; }
.drawer__header-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.drawer__title-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.drawer__title {
  font-family: var(--f-fonts-family-header-primary);
  font-weight: var(--f-fonts-weight-highlight);
  font-size: var(--f-fonts-size-2xl); letter-spacing: -0.02em;
}
.drawer__title--sm { font-family: var(--f-fonts-family-header-secondary); font-size: var(--f-fonts-size-lg); letter-spacing: 0; }
.drawer__ids { color: var(--f-colors-muted-foreground); font-size: var(--f-fonts-size-sm); margin-top: 4px; }
.drawer__body { padding: 20px 22px; }

.amount-label { font-size: var(--f-fonts-size-sm); color: var(--f-colors-muted-foreground); }
.amount-big {
  font-family: var(--f-fonts-family-mono); font-size: 32px; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.25;
}
.amount-big.is-negative { color: var(--f-colors-error-foreground); }
.amount-big--md { font-size: 24px; }

.section-label {
  font-family: var(--f-fonts-family-mono);
  font-size: var(--f-fonts-size-xs); text-transform: uppercase; letter-spacing: .1em;
  color: var(--f-colors-muted-foreground); font-weight: var(--f-fonts-weight-highlight);
}

/* Collapsible section header (button) */
.collapse-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 2px 0; border: 0; background: transparent;
  cursor: pointer; font-family: inherit; text-align: left; color: inherit;
}
.collapse-toggle__grow { flex: 1; }
.collapse-toggle .chevron { display: inline-flex; transition: transform .15s; color: var(--f-colors-muted-foreground); }
.collapse-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.subhead-row {
  display: flex; align-items: center; gap: 16px;
  border-top: 1px solid var(--f-colors-default-border);
  border-bottom: 1px solid var(--f-colors-default-border);
  padding: 6px 0 5px; margin-top: 20px;
}
.subhead-row__title {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--f-fonts-size-sm); font-weight: var(--f-fonts-weight-highlight);
}
.subhead-row__grow { flex: 1; }

.rule { border-bottom: 1px solid var(--f-colors-default-border); margin: 0 0 18px; }

/* Key/value rows (MRR breakdown, deal details) */
.kv-list { border: 1px solid var(--f-colors-default-border); border-radius: var(--f-sizes-lg-corner); overflow: hidden; margin-top: 10px; }
.kv-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--f-colors-muted-border); }
.kv-row:last-child { border-bottom: 0; }
.kv-row__label { flex: none; width: 150px; font-size: var(--f-fonts-size-sm); color: var(--f-colors-muted-foreground); font-weight: var(--f-fonts-weight-highlight); }
.kv-row__value { font-size: var(--f-fonts-size-sm); }
.kv-row__value--mono { font-family: var(--f-fonts-family-mono); font-variant-numeric: tabular-nums; }

.mrr-breakdown { margin-top: 10px; padding-top: 2px; }
.mrr-breakdown__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 0; font-size: var(--f-fonts-size-sm); color: var(--f-colors-muted-foreground);
}
.mrr-breakdown__val { font-variant-numeric: tabular-nums; font-family: var(--f-fonts-family-mono); color: var(--f-colors-default-foreground); }

/* Checks summary */
.check-list { display: flex; flex-direction: column; gap: 12px; padding: 14px 0 2px; }
.check-item { display: flex; gap: 10px; align-items: center; }
.check-item__icon { font-weight: var(--f-fonts-weight-highlight); line-height: 1.4; }
.check-item__icon.is-pass { color: var(--f-colors-success-foreground); }
.check-item__icon.is-warning { color: var(--f-colors-warning-foreground); }
.check-item__icon.is-fail { color: var(--f-colors-error-foreground); }
.check-item__icon.is-pending { color: var(--f-colors-text-subtle, #8a8f98); }
.check-item[data-contract-loading] .check-item__text { color: var(--f-colors-text-subtle, #8a8f98); }
.check-item__text { flex: 1; min-width: 0; font-weight: var(--f-fonts-weight-highlight); font-size: var(--f-fonts-size-sm); }
.attention-count {
  flex: none; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 100rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--f-badge-colors-warning-background);
  color: var(--f-badge-colors-warning-text);
  border: 1px solid var(--f-badge-colors-warning-border);
  font-size: var(--f-fonts-size-xs); font-weight: var(--f-fonts-weight-highlight);
}

/* Audit trail */
.audit { position: relative; padding-left: 4px; margin-top: 14px; }
.audit__line { position: absolute; left: 9px; top: 4px; bottom: 10px; width: 2px; background: var(--f-colors-default-border); }
.audit-entry { display: flex; gap: 14px; padding: 0 0 18px; position: relative; }
.audit-entry__dot {
  flex: none; width: 11px; height: 11px; border-radius: 50%; margin-top: 3px;
  background: var(--f-colors-brand-700);
  box-shadow: 0 0 0 3px var(--f-colors-surface-background); z-index: 1;
}
.audit-entry__body { flex: 1; min-width: 0; }
.audit-entry__what { font-weight: var(--f-fonts-weight-highlight); }
.audit-entry__when { font-size: var(--f-fonts-size-xs); color: var(--f-colors-muted-foreground); margin-top: 2px; }
.audit-entry__reason { font-size: var(--f-fonts-size-sm); margin-top: 6px; }

/* Static (read-only) value boxes in customer detail */
.static-box {
  height: var(--f-input-sizes-md-height); display: flex; align-items: center;
  padding: 0 10px; border: 1px solid var(--f-colors-default-border);
  border-radius: var(--f-input-sizes-corner);
  background: var(--f-colors-accent-background);
  color: var(--f-colors-muted-foreground);
  font-variant-numeric: tabular-nums;
}
.static-chip {
  font-size: var(--f-fonts-size-xs); font-weight: var(--f-fonts-weight-highlight);
  color: var(--f-colors-muted-foreground); background: var(--f-colors-accent-background);
  border-radius: var(--f-sizes-sm-corner); padding: 1px 6px;
}
.help-text { font-size: var(--f-fonts-size-xs); color: var(--f-colors-muted-foreground); }

/* Two-pane grid (customers list + detail) */
.split-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.split-grid.has-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .split-grid.has-detail { grid-template-columns: 1fr; } }

/* ── Toast ─────────────────────────────────────────────────────────── */
@keyframes toast-pop {
  0% { transform: translateX(-50%) translateY(10px) scale(.96); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: var(--f-sizes-lg-corner);
  background: var(--f-colors-inverse-background); color: var(--f-colors-inverse-foreground);
  font-size: var(--f-fonts-size-sm); font-weight: var(--f-fonts-weight-highlight);
  box-shadow: var(--f-shadow-pop); z-index: 60;
  animation: toast-pop .18s ease-out;
}
.toast[hidden] { display: none; }

/* ── Utilities ─────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ── Profile menu internals ────────────────────────────────────────── */
.profile-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--f-colors-default-border);
}
.avatar-btn--lg { width: 44px; height: 44px; font-size: 17px; cursor: default; }
.profile-card__text { min-width: 0; }
.profile-card__name { font-weight: var(--f-fonts-weight-highlight); }
.profile-card__role { font-size: var(--f-fonts-size-sm); color: var(--f-colors-muted-foreground); }
.profile-appearance { padding: 12px 16px; border-bottom: 1px solid var(--f-colors-default-border); }
.profile-appearance__label { margin-bottom: 8px; display: block; }
.theme-switch {
  display: flex; gap: 4px; padding: 3px;
  background: var(--f-colors-accent-background); border-radius: 8px;
}
.theme-switch__btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center;
  height: 28px; border: 0; border-radius: 6px; background: transparent;
  color: var(--f-colors-default-foreground);
  font-family: inherit; font-size: var(--f-fonts-size-sm);
  font-weight: var(--f-fonts-weight-highlight); cursor: pointer;
}
.theme-switch__btn:hover { background: var(--f-colors-surface-background); }

/* ── Deal card cover link ──────────────────────────────────────────── */
/* The whole card is clickable via an absolutely-positioned link so the
   Approve form can live inside the card without invalid <form>-in-<a>
   nesting. Non-interactive layers let clicks fall through to the link. */
.deal-card__link-cover { position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.deal-card__body, .deal-card__right { position: relative; z-index: 1; pointer-events: none; }
.deal-card__actions { z-index: 1; }

/* ── Drawer spacing helpers ────────────────────────────────────────── */
.drawer__tag-row { margin-bottom: 7px; }
.drawer__field-grid { margin: 16px 0 18px; }
.drawer__section-label { display: block; margin: 20px 0 12px; }
.drawer__reason-field { margin-top: 18px; }
.drawer__collapse { margin-top: 20px; }
.drawer__ids-inline {
  color: var(--f-colors-muted-foreground);
  font-weight: var(--f-fonts-weight-body); font-size: var(--f-fonts-size-sm);
}
.ledger-header { margin: 2px 0 20px; }

/* ── Panel header/body (customers detail) ──────────────────────────── */
.panel-header {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid var(--f-colors-default-border);
}
.panel-header__main { flex: 1; min-width: 0; }
.panel-body { padding: 18px; }
.panel-body--muted { padding: 18px; color: var(--f-colors-muted-foreground); }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.current-flag {
  font-size: var(--f-fonts-size-xs); font-weight: var(--f-fonts-weight-highlight);
  color: var(--f-colors-success-foreground);
}
.is-numeric-inline { font-variant-numeric: tabular-nums; }

/* ── Column visibility ─────────────────────────────────────────────── */
/* Checkmark only shows when the column is visible (menu item checked). */
.col-check__box svg { visibility: hidden; }
.col-check.is-checked .col-check__box svg { visibility: visible; }
[data-col][hidden] { display: none; }

/* ── Comments to finance (read-only, sourced from HubSpot) ─────────── */
.rule--spaced { margin: 18px 0; }
.comment-list { display: flex; flex-direction: column; gap: 12px; padding: 14px 0 2px; }
.comment-list__empty { margin: 0; color: var(--f-colors-muted-foreground); font-size: var(--f-fonts-size-sm); }
.comment-card {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px;
  background: var(--f-colors-accent-background);
  border-radius: var(--f-sizes-md-corner);
}
.comment-card__head { display: flex; align-items: baseline; gap: 8px; }
.comment-card__author { font-weight: var(--f-fonts-weight-highlight); font-size: var(--f-fonts-size-sm); }
.comment-card__when { font-size: var(--f-fonts-size-xs); color: var(--f-colors-muted-foreground); }
.comment-card__text { font-size: var(--f-fonts-size-sm); }

/* Smaller title input (movement drawer inline name edit) */
.title-input--sm {
  font-family: var(--f-fonts-family-header-secondary);
  font-size: var(--f-fonts-size-lg); letter-spacing: 0;
  width: 260px;
}

/* ── Juro contract preview panel ─────────────────────────────────── */
/* Opens as a left-side panel alongside the deal drawer so both are
   visible at once. z-index 39 keeps the panel below drawer overlays.
   The panel's right edge aligns exactly with the drawer's left edge. */
.contract-modal {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: min(680px, 94vw);
  z-index: 39;
  display: flex;
  flex-direction: column;
  background: var(--f-colors-surface-background);
  border-right: 1px solid var(--f-colors-default-border);
  box-shadow: 8px 0 32px rgba(0,0,0,.1);
  animation: contract-panel-in .25s cubic-bezier(.4,0,.2,1);
}

@keyframes contract-panel-in {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.contract-modal[hidden] {
  display: none;
}

/* Backdrop not needed for side-panel layout. */
.contract-modal__backdrop { display: none; }

.contract-modal__panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: var(--f-colors-surface-background);
}

.contract-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--f-colors-default-border);
  flex-shrink: 0;
  background: var(--f-colors-surface-background);
}

.contract-modal__title {
  font-weight: var(--f-fonts-weight-highlight);
  font-size: var(--f-fonts-size-sm);
  flex: 1;
}

.contract-modal__body {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.contract-modal__iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.contract-modal__blocked {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  color: var(--f-colors-muted-foreground);
  font-size: var(--f-fonts-size-sm);
}

.contract-modal__blocked.is-visible {
  display: flex;
}
