/* ==========================================================================
   GSS theme for Bootstrap 5.3
   --------------------------------------------------------------------------
   Load AFTER bootstrap.min.css. This is an override layer, never a fork:

     <link rel="stylesheet" href="bootstrap.min.css">
     <link rel="stylesheet" href="gss-bootstrap.css">

   Two sources feed it:
     - COLOUR comes from the official GSS brand pack (docs/brand/BRAND.md).
     - STRUCTURE comes from the existing sales CRM, so the rebuild reads as the
       same product: 52px nav, 10px card radius, 13px tables, its badge system.

   The gotcha this file exists to solve: Bootstrap 5.3 compiles component
   colours in. `.btn-primary` hardcodes `--bs-btn-bg: #0d6efd` and never reads
   `--bs-primary`, so overriding the root variable alone leaves every button
   Bootstrap blue. Utilities that use `rgba(var(--bs-primary-rgb), ...)`
   (.bg-primary, .text-bg-primary, .link-primary) DO follow the variable.
   Both paths are handled below.
   ========================================================================== */

/* --------------------------------------------------------------- 1. Palette */
:root {
  /* Official brand pack. Exact values -- do not substitute near ones. */
  --gss-red:        #C3151C;   /* Hot Red     - accent + destructive only */
  --gss-carbon:     #2B2B2B;   /* Carbon Grey - the default "black" */
  --gss-white:      #FFFFFF;

  /* Interface colours.
     These match Nick's CRM exactly rather than the print guide, by decision:
     the two systems sit side by side during the migration and Sales has to
     recognise this as the same application. His --blue and --dark, verbatim
     from client/css/style.css. The print pack still governs documents; it
     never defined a UI palette. */
  --gss-action:     #1a56db;   /* Nick's --blue */
  --gss-action-h:   #1849c6;   /* shade 7.5% */
  --gss-action-a:   #1745b9;   /* shade 10%  */
  --gss-nav-bg:     #1e2535;   /* Nick's --dark */
  --gss-red-h:      #B4131A;
  --gss-red-a:      #B01319;
  --gss-red-dim:    #E8565E;   /* red text on dark surfaces, large only */
  --gss-focus:      #1a56db;   /* focus ring - lifts on dark, see §3 */

  /* Semantic, deliberately clear of Hot Red so it keeps meaning "destructive" */
  --gss-success:    #157347;
  --gss-warning:    #A8690A;

  /* Structure, lifted from the existing CRM */
  --gss-nav-h:      52px;
  --gss-card-radius: 10px;
  --gss-surface:    #f9fafb;
  --gss-line:       #e5e7eb;
  --gss-line-soft:  #f3f4f6;
}

/* ------------------------------------------------- 2. Bootstrap root tokens */
:root,
[data-bs-theme="light"] {
  --bs-primary:       #1a56db;
  --bs-primary-rgb:   26, 86, 219;
  --bs-danger:        #C3151C;
  --bs-danger-rgb:    195, 21, 28;
  --bs-success:       #157347;
  --bs-success-rgb:   21, 115, 71;
  --bs-warning:       #A8690A;
  --bs-warning-rgb:   168, 105, 10;

  --bs-body-color:     #2B2B2B;
  --bs-body-color-rgb: 43, 43, 43;
  --bs-body-bg:        #f9fafb;
  --bs-emphasis-color: #111111;
  --bs-border-color:   #e5e7eb;

  --bs-link-color:            #1a56db;
  --bs-link-color-rgb:        26, 86, 219;
  --bs-link-hover-color:      #1849c6;
  --bs-link-hover-color-rgb:  24, 73, 198;

  /* Matches the existing CRM rather than Bootstrap's 16px/1rem default */
  --bs-body-font-family: 'Segoe UI', system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: 0.875rem;   /* 14px */
  --bs-border-radius: 0.375rem;    /* 6px, as the CRM's buttons and inputs use */
  --bs-border-radius-lg: 0.625rem; /* 10px, as its cards use */
}

/* ------------------------------------------------------------ 3. Dark mode */
/* The brand is dark-friendly by construction: Carbon Grey is already a brand
   surface. Only the two brand colours need lifting, because neither passes
   contrast as text on a dark ground (Hot Red is 2.32:1 on Carbon Grey). */
[data-bs-theme="dark"] {
  --bs-primary:       #6697C3;
  --bs-primary-rgb:   102, 151, 195;
  --bs-danger:        #DB7377;
  --bs-danger-rgb:    219, 115, 119;

  --bs-body-color:     #e8e8e8;
  --bs-body-color-rgb: 232, 232, 232;
  --bs-body-bg:        #1c1c1c;
  --bs-emphasis-color: #ffffff;
  --bs-border-color:   #3d3d3d;

  --bs-link-color:       #6697C3;
  --bs-link-color-rgb:   102, 151, 195;
  --bs-link-hover-color: #8FB3D6;

  --gss-surface:   #1c1c1c;
  --gss-line:      #3d3d3d;
  --gss-line-soft: #2f2f2f;

  /* 7.62:1 on #1c1c1c. The brand blue measures 2.18:1 there, so a focus ring
     drawn in it is invisible to a keyboard user on a dark screen. */
  --gss-focus:     #7FB3DC;
}

/* Anything drawn directly ON the dark page has to lift; anything that carries
   its own fill must not. A solid .btn-primary keeps the brand blue in both
   themes because white-on-#00529B is 7.84:1 whatever the page behind it does.
   Outline buttons have no fill, so their text sits on the page ground and
   fails there (2.18:1 blue, 2.80:1 red) unless lifted. */
[data-bs-theme="dark"] .btn-outline-primary {
  --bs-btn-color: #6697C3;
  --bs-btn-border-color: #6697C3;
  --bs-btn-hover-color: #11212e;
  --bs-btn-hover-bg: #6697C3;
  --bs-btn-hover-border-color: #6697C3;
  --bs-btn-active-color: #11212e;
  --bs-btn-active-bg: #8FB3D6;
  --bs-btn-active-border-color: #8FB3D6;
}
[data-bs-theme="dark"] .btn-outline-danger {
  --bs-btn-color: #DB7377;
  --bs-btn-border-color: #DB7377;
  --bs-btn-hover-color: #2b1113;
  --bs-btn-hover-bg: #DB7377;
  --bs-btn-hover-border-color: #DB7377;
  --bs-btn-active-color: #2b1113;
  --bs-btn-active-bg: #E8969A;
  --bs-btn-active-border-color: #E8969A;
}

/* ------------------------------------------------------------- 4. Buttons */
/* Component variables, because Bootstrap compiles these colours in. */
.btn-primary {
  --bs-btn-bg: var(--gss-action);
  --bs-btn-border-color: var(--gss-action);
  --bs-btn-hover-bg: var(--gss-action-h);
  --bs-btn-hover-border-color: var(--gss-action-h);
  --bs-btn-active-bg: var(--gss-action-a);
  --bs-btn-active-border-color: var(--gss-action-a);
  --bs-btn-disabled-bg: var(--gss-action);
  --bs-btn-disabled-border-color: var(--gss-action);
  --bs-btn-focus-shadow-rgb: 0, 82, 155;
}

/* Hot Red lives here and nowhere else in the action vocabulary. If Save and
   Delete look alike, the interface has lost its one stop signal. */
.btn-danger {
  --bs-btn-bg: var(--gss-red);
  --bs-btn-border-color: var(--gss-red);
  --bs-btn-hover-bg: var(--gss-red-h);
  --bs-btn-hover-border-color: var(--gss-red-h);
  --bs-btn-active-bg: var(--gss-red-a);
  --bs-btn-active-border-color: var(--gss-red-a);
  --bs-btn-disabled-bg: var(--gss-red);
  --bs-btn-disabled-border-color: var(--gss-red);
  --bs-btn-focus-shadow-rgb: 195, 21, 28;
}

.btn-outline-primary {
  --bs-btn-color: var(--gss-action);
  --bs-btn-border-color: var(--gss-action);
  --bs-btn-hover-bg: var(--gss-action);
  --bs-btn-hover-border-color: var(--gss-action);
  --bs-btn-active-bg: var(--gss-action-a);
  --bs-btn-active-border-color: var(--gss-action-a);
  --bs-btn-focus-shadow-rgb: 0, 82, 155;
}

.btn-outline-danger {
  --bs-btn-color: var(--gss-red);
  --bs-btn-border-color: var(--gss-red);
  --bs-btn-hover-bg: var(--gss-red);
  --bs-btn-hover-border-color: var(--gss-red);
  --bs-btn-active-bg: var(--gss-red-a);
  --bs-btn-active-border-color: var(--gss-red-a);
  --bs-btn-focus-shadow-rgb: 195, 21, 28;
}

.btn-success { --bs-btn-bg: var(--gss-success); --bs-btn-border-color: var(--gss-success); }

/* The CRM's button metrics, so density carries over */
.btn { --bs-btn-padding-y: .4375rem; --bs-btn-padding-x: 1rem;
       --bs-btn-font-size: .8125rem; --bs-btn-font-weight: 600; }
.btn-sm { --bs-btn-padding-y: .25rem; --bs-btn-padding-x: .625rem; --bs-btn-font-size: .75rem; }

/* ------------------------------------------------------------- 5. Navbar */
/* Carbon Grey, which is the dark ground the wordmark needs.
   NOTE: the reversed wordmark is not yet an official asset - see BRAND.md §3. */
.navbar-gss {
  --bs-navbar-padding-y: 0;
  --bs-navbar-color: #9ca3af;
  --bs-navbar-hover-color: #ffffff;
  --bs-navbar-active-color: #ffffff;
  --bs-navbar-brand-color: #ffffff;
  --bs-navbar-brand-hover-color: #ffffff;
  background-color: var(--gss-nav-bg);
  min-height: var(--gss-nav-h);
}
.navbar-gss .navbar-nav { gap: .25rem; }
.navbar-gss .nav-link {
  padding: .375rem .875rem;
  border-radius: var(--bs-border-radius);
  font-size: .8125rem;
  font-weight: 500;
}
.navbar-gss .nav-link:hover { background-color: rgba(255, 255, 255, .08); }
.navbar-gss .nav-link.active { background-color: var(--gss-action); color: #fff; }
.navbar-gss .navbar-brand img { height: 22px; width: auto; display: block; }

/* ------------------------------------------------------- 6. Cards & tables */
.card {
  --bs-card-border-color: var(--gss-line);
  --bs-card-border-radius: var(--gss-card-radius);
  --bs-card-inner-border-radius: calc(var(--gss-card-radius) - 1px);
  --bs-card-spacer-y: 1.25rem;
  --bs-card-spacer-x: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.card-header { font-weight: 700; font-size: .9375rem; color: var(--bs-secondary-color); }

.table {
  --bs-table-border-color: var(--gss-line-soft);
  font-size: .8125rem;
}
.table > thead > tr > th {
  background-color: var(--gss-line-soft);
  padding: .5rem .75rem;
  font-weight: 600;
  border-bottom-color: var(--gss-line);
  white-space: nowrap;
}
.table > tbody > tr > td { padding: .625rem .75rem; }
/* Currency and percentages must line up; this is what makes a forecast scannable. */
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* A row needing attention - a unit back for the third time, a deal at risk.
   Hot Red as a rule, never as the row's text colour. */
.table > tbody > tr.gss-flagged > td { background-color: #fef6f6; }
.table > tbody > tr.gss-flagged > td:first-child { box-shadow: inset 3px 0 0 var(--gss-red); }
[data-bs-theme="dark"] .table > tbody > tr.gss-flagged > td { background-color: #341f20; }

/* ------------------------------------------------------------- 7. Badges */
.badge { --bs-badge-padding-y: .125rem; --bs-badge-padding-x: .5rem;
         --bs-badge-font-size: .6875rem; --bs-badge-font-weight: 600;
         border-radius: 999px; }

/* Ticket and deal status. Carried over from the existing CRM unchanged - it is
   a working vocabulary and the brand guide does not govern status colour. */
.gss-status-open      { background: #dbeafe; color: #1e40af; }
.gss-status-progress  { background: #fff3cd; color: #92400e; }
.gss-status-awaiting  { background: #f3f4f6; color: #374151; }
.gss-status-resolved  { background: #dcfce7; color: #166534; }
.gss-status-escalated { background: #fee2e2; color: #991b1b; }
.gss-status-won       { background: #dcfce7; color: #166534; }
.gss-status-lost      { background: #fee2e2; color: #991b1b; }
.gss-type-commercial  { background: #f3e8ff; color: #6b21a8; }
.gss-type-industrial  { background: #fff3cd; color: #92400e; }

/* Contact roles - the field that lets one contact list serve both teams */
.gss-role-primary   { background: #dbeafe; color: #1e40af; }
.gss-role-billing   { background: #fff3cd; color: #92400e; }
.gss-role-shipping  { background: #dcfce7; color: #166534; }
.gss-role-finance   { background: #e0f2fe; color: #075985; }
.gss-role-technical { background: #ede9fe; color: #5b21b6; }
.gss-role-other     { background: #f3f4f6; color: #374151; }

[data-bs-theme="dark"] {
  .gss-status-open,      .gss-role-primary   { background: #1e3a5f; color: #bfdbfe; }
  .gss-status-progress,  .gss-role-billing,
  .gss-type-industrial                       { background: #4a3a12; color: #fde68a; }
  .gss-status-awaiting,  .gss-role-other     { background: #343434; color: #d1d5db; }
  .gss-status-resolved,  .gss-status-won,
  .gss-role-shipping                         { background: #14351f; color: #bbf7d0; }
  .gss-status-escalated, .gss-status-lost    { background: #451a1a; color: #fecaca; }
  .gss-type-commercial,  .gss-role-technical { background: #3b2a52; color: #e5d0fb; }
  .gss-role-finance                          { background: #10344a; color: #bae6fd; }
}

/* ------------------------------------------------- 8. Forms, focus, links */
.form-control, .form-select {
  font-size: .8125rem;
  padding: .4375rem .75rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--gss-focus);
  box-shadow: 0 0 0 .2rem rgba(0, 82, 155, .2);
}
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  box-shadow: 0 0 0 .2rem rgba(127, 179, 220, .25);
}
/* Keyboard focus must stay visible everywhere, not only on form controls -- and
   in both themes, which is why it uses the lifting token rather than the brand blue. */
:focus-visible { outline: 2px solid var(--gss-focus); outline-offset: 2px; }
.form-label { font-size: .78125rem; font-weight: 600; color: var(--bs-secondary-color); }

/* ------------------------------------------------------- 9. Brand accents */
/* Hot Red as a rule or marker. Never as words on a dark ground - it measures
   2.32:1 on Carbon Grey, well under the 4.5:1 floor. */
.gss-accent-rule { border-left: 3px solid var(--gss-red); }
.gss-text-accent { color: var(--gss-red); }
[data-bs-theme="dark"] .gss-text-accent { color: var(--gss-red-dim); }

@media (prefers-reduced-motion: reduce) {
  .btn, .nav-link, .form-control, .form-select { transition: none; }
}

/* ========================================================================== */
/* 10. Charts                                                                 */
/* -------------------------------------------------------------------------- */
/* Every chart here plots ONE measure, so marks use one hue rather than a      */
/* categorical palette — eight colours across eight failure types would imply  */
/* the colours carry meaning they do not. Hot Red stays reserved for the       */
/* attention case, which is the only place a mark means "look at this".        */
/*                                                                            */
/* The brand blue fails contrast on a dark surface (2.18:1), so the mark hue   */
/* lifts in dark mode exactly as the outline buttons do.                       */
:root {
  --gss-chart:       #00529B;
  --gss-chart-track: #eceef1;
  --gss-chart-alert: #C3151C;
}
[data-bs-theme="dark"] {
  --gss-chart:       #6697C3;
  --gss-chart-track: #2b2b2b;
  --gss-chart-alert: #DB7377;
}

/* --- horizontal bars: magnitude across named categories --- */
.gss-bars { display: flex; flex-direction: column; gap: .375rem; }
.gss-bar-row {
  display: grid;
  grid-template-columns: minmax(6rem, 11rem) 1fr 2.75rem;
  gap: .75rem;
  align-items: center;
}
.gss-bar-label {
  font-size: .8125rem; text-align: right; color: var(--bs-secondary-color);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gss-bar-track {
  display: block;                 /* a percentage width means nothing on an inline box */
  background: var(--gss-chart-track); border-radius: 3px; height: 1.25rem;
}
.gss-bar-fill {
  display: block;
  height: 100%; background: var(--gss-chart);
  /* Rounded only at the data end; the baseline end stays square so the bar
     reads as anchored rather than floating. */
  border-radius: 0 4px 4px 0;
  min-width: 3px;
}
.gss-bar-fill.is-alert { background: var(--gss-chart-alert); }
/* Values wear an ink token, never the series colour. */
.gss-bar-value {
  font-size: .8125rem; font-variant-numeric: tabular-nums; font-weight: 600;
  color: var(--bs-body-color);
}

/* --- columns: one measure over time --- */
.gss-columns { display: flex; align-items: flex-end; gap: 2px; height: 8rem; }
.gss-column {
  flex: 1 1 0; min-width: 0;
  /* Full height, or the bar's percentage height has no containing block to
     resolve against and every column collapses to its minimum. */
  height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  gap: 2px;
}
.gss-column-bar {
  display: block;
  width: 100%; max-width: 2.25rem; background: var(--gss-chart);
  border-radius: 4px 4px 0 0; min-height: 2px;
}
.gss-column-bar.is-empty { background: var(--gss-chart-track); }
.gss-column-label {
  display: block;
  font-size: .625rem; color: var(--bs-secondary-color); white-space: nowrap;
}
.gss-column-value {
  display: block; min-height: .9rem;
  font-size: .6875rem; font-variant-numeric: tabular-nums;
  color: var(--bs-body-color); font-weight: 600;
}

/* A recessive baseline: present enough to anchor the columns, quiet enough not
   to compete with them. */
.gss-axis { border-top: 1px solid var(--bs-border-color); padding-top: .375rem; }

.gss-stat .n {
  /* A figure must never break across lines -- "$2,440," above "000" reads as
     two numbers for the half-second before it doesn't. */
  white-space: nowrap;
  font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.gss-stat .k { font-size: .75rem; color: var(--bs-secondary-color); }
.gss-stat .n.is-alert { color: var(--gss-chart-alert); }

/* ===========================================================================
   §9  Sales
   The forecast dashboard and the build schedule. Same vocabulary as §8's
   charts; these are the pieces those screens need that nothing else does.
   ======================================================================== */

/* The one genuinely large number on the site. Everything else is 14px, which
   makes this the thing the eye lands on when the page opens -- which is the
   job the headline box does on the existing dashboard. */
.gss-headline {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--bs-emphasis-color);
}

.gss-subnav .nav-link {
  padding: .25rem .75rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
}
.gss-subnav .nav-link.active { background-color: var(--gss-action); color: #fff; }

/* "2 of 3" -- a deal whose units land in more than one year. Quiet, because it
   is a fact about the row rather than a warning about it. */
.gss-split {
  background: var(--gss-line-soft);
  color: var(--bs-secondary-color);
  font-weight: 600;
  cursor: help;
}
.gss-hint { cursor: help; }

.gss-forecast-table input.gss-tinker { width: 7rem; display: inline-block; }
.gss-forecast-table tr.is-tinkered { background-color: rgba(168, 105, 10, .07); }
.gss-forecast-table tr.is-tinkered td:first-child { box-shadow: inset 3px 0 0 var(--gss-warning); }

/* ------------------------------------------------------------------ print */

@media print {
  .navbar, .nav, .btn, .alert, form { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #ccc !important; break-inside: avoid; }
  a { text-decoration: none; color: inherit; }
  .gss-print-only { display: block !important; }
}
.gss-print-only { display: none; }

/* The navbar search. Wide enough for a company name, not so wide it crowds
   the navigation; full width once the navbar collapses on a phone. */
.gss-search { width: 15rem; }
.gss-search .form-control {
  background-color: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
  color: #fff;
}
.gss-search .form-control::placeholder { color: rgba(255, 255, 255, .55); }
.gss-search .form-control:focus {
  background-color: rgba(255, 255, 255, .16);
  color: #fff;
  border-color: rgba(255, 255, 255, .5);
  box-shadow: none;
}
@media (max-width: 991.98px) {
  .gss-search { width: 100%; margin: .5rem 0; }
}

/* Imported data we are not sure about. Grey, not red: it is an invitation to
   confirm, not a failure -- and half the contact list carries it. */
.gss-unverified {
  background: var(--gss-line-soft);
  color: var(--bs-secondary-color);
  font-weight: 600;
  cursor: help;
}

/* --------------------------------------------------------- attachments */

.gss-attachments { display: flex; flex-wrap: wrap; gap: .75rem; }

.gss-attachment {
  margin: 0;
  width: 9rem;
  font-size: .75rem;
  line-height: 1.3;
}
.gss-attachment a {
  display: block;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  overflow: hidden;
  background: var(--gss-line-soft);
}
/* Fixed box with object-fit, so a portrait phone photo and a landscape scan
   sit in the same grid instead of one of them being three times as tall. */
.gss-attachment img {
  display: block;
  width: 100%;
  height: 6rem;
  object-fit: cover;
}
.gss-attachment-file {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 6rem;
  font-weight: 700;
  color: var(--bs-secondary-color);
  letter-spacing: .04em;
}
.gss-attachment figcaption {
  padding-top: .25rem;
  word-break: break-word;
}


/* ===========================================================================
   §10  Nick's CRM, verbatim
   ---------------------------------------------------------------------------
   Decided 23 September 2026: the whole application takes the look of the CRM
   Sales already uses (bitbucket.org:stabilized/crm-system, client/css/
   style.css). Every value below is his. Where his class name would collide
   with Bootstrap (.card, .btn, .badge, table) the Bootstrap component is
   restyled to his values instead, so every screen -- Service included -- reads
   as the same product.
   ======================================================================== */

:root {
  --n-blue:   #1a56db;
  --n-dark:   #1e2535;
  --n-mid:    #374151;
  --n-light:  #f3f4f6;
  --n-border: #e5e7eb;
  --n-green:  #16a34a;
  --n-red:    #dc2626;
  --n-amber:  #d97706;
  --n-shadow: 0 1px 3px rgba(0,0,0,.12);
  --bs-body-color: #111827;
  --bs-body-color-rgb: 17, 24, 39;
  /* His page never sets a line height, so it runs at the browser's normal
     (about 1.3) -- Bootstrap's 1.5 made every row and card visibly taller. */
  --bs-body-line-height: normal;
}

/* ------------------------------------------------------------ page shell */
.gss-main { padding: 28px 32px; max-width: 1400px; width: 100%; }
@media (max-width: 640px) { .gss-main { padding: 16px; } }

main h1, main h1.h5, main h1.h4 { font-size: 20px; font-weight: 700; color: var(--n-dark); margin-bottom: 20px; }
main h2.gss-h2 { font-size: 15px; font-weight: 700; color: var(--n-mid); margin-bottom: 12px; }

/* Nav: his is 52px, links 13px/500, 6px 14px, a blue pill when active. */
.navbar-gss { padding: 0 24px; min-height: 52px; }
.navbar-gss .container-fluid { padding: 0 !important; }
.navbar-gss .navbar-brand { font-size: 15px; font-weight: 700; margin-right: 24px; }
.navbar-gss .navbar-brand img { height: 26px; }
.navbar-gss .navbar-nav { gap: 4px; }
.navbar-gss .nav-link { padding: 6px 14px !important; border-radius: 6px; font-size: 13px; font-weight: 500; color: #9ca3af; }
.navbar-gss .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.navbar-gss .nav-link.active { background: var(--n-blue); color: #fff; }

/* ----------------------------------------------------------------- cards */
.card {
  --bs-card-border-color: var(--n-border);
  --bs-card-border-radius: 10px;
  --bs-card-spacer-y: 20px;
  --bs-card-spacer-x: 24px;
  box-shadow: var(--n-shadow);
  margin-bottom: 20px;
}
/* His cards carry a heading, not a header bar. */
.card > .card-header {
  background: transparent;
  border-bottom: 0;
  padding: 20px 24px 0;
  font-size: 15px; font-weight: 700; color: var(--n-mid);
}

/* ---------------------------------------------------------------- tables */
.table { --bs-table-border-color: var(--n-border); --bs-table-hover-bg: #f0f4ff; font-size: 13px; }
.table > thead > tr > th { background: var(--n-light); padding: 8px 12px; font-weight: 600; border-bottom: 1px solid var(--n-border); }
.table > tbody > tr > td { padding: 7px 12px; border-bottom: 1px solid var(--n-border); }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f0f4ff; }

/* --------------------------------------------------------------- buttons */
.btn {
  --bs-btn-padding-y: 7px; --bs-btn-padding-x: 16px;
  --bs-btn-font-size: 13px; --bs-btn-font-weight: 600;
  --bs-btn-border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm { --bs-btn-padding-y: 4px; --bs-btn-padding-x: 10px; --bs-btn-font-size: 12px; }
.btn:hover { opacity: .88; }
.btn-primary { --bs-btn-bg: var(--n-blue); --bs-btn-border-color: var(--n-blue); --bs-btn-hover-bg: var(--n-blue); --bs-btn-hover-border-color: var(--n-blue); }
.btn-success { --bs-btn-bg: var(--n-green); --bs-btn-border-color: var(--n-green); --bs-btn-hover-bg: var(--n-green); --bs-btn-hover-border-color: var(--n-green); --bs-btn-active-bg: #15803d; }
.btn-danger  { --bs-btn-bg: var(--n-red); --bs-btn-border-color: var(--n-red); --bs-btn-hover-bg: var(--n-red); --bs-btn-hover-border-color: var(--n-red); --bs-btn-active-bg: #b91c1c; }
.btn-amber   { --bs-btn-color: #fff; --bs-btn-bg: var(--n-amber); --bs-btn-border-color: var(--n-amber); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--n-amber); --bs-btn-hover-border-color: var(--n-amber); --bs-btn-active-bg: #b45309; --bs-btn-active-color: #fff; }
.btn-secondary, .btn-outline-secondary {
  --bs-btn-color: var(--n-mid); --bs-btn-bg: var(--n-light); --bs-btn-border-color: var(--n-border);
  --bs-btn-hover-color: var(--n-mid); --bs-btn-hover-bg: var(--n-light); --bs-btn-hover-border-color: var(--n-border);
  --bs-btn-active-color: var(--n-mid); --bs-btn-active-bg: #e5e7eb;
}
/* A toggle that is on, as his are. */
.btn.is-active { box-shadow: 0 0 0 3px rgba(17,24,39,.32); }

/* ---------------------------------------------------------------- alerts */
.alert { padding: 10px 16px; border-radius: 6px; font-size: 13px; border: 0; margin-bottom: 14px; }
.alert-success { --bs-alert-bg: #dcfce7; --bs-alert-color: #166534; }
.alert-error, .alert-danger { --bs-alert-bg: #fee2e2; --bs-alert-color: #991b1b; }

/* ---------------------------------------------------------------- forms */
.form-control, .form-select { padding: 8px 10px; font-size: 13px; border-color: var(--n-border); border-radius: 6px; }
.form-control-sm, .form-select-sm { padding: 4px 8px; font-size: 12px; }
.form-control:focus, .form-select:focus { box-shadow: none; outline: 2px solid var(--n-blue); border-color: transparent; }
.form-label, label.form-label { font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }

/* ------------------------------------------------------------- stat row */
.stat-row { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.stat {
  background: #fff; border: 1px solid var(--n-border); border-radius: 10px;
  padding: 16px 22px; min-width: 180px; box-shadow: var(--n-shadow);
}
.stat .label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 22px; font-weight: 700; color: var(--n-dark); margin-top: 4px; white-space: nowrap; }
.stat .stat-sub { font-size: 11px; color: #6b7280; margin-top: 4px; }
.stat.highlight .value { color: var(--n-blue); }
.stat.highlight .stat-sub { color: #4b5563; }
.stat.risk { background: #fee2e2; border-color: #fecaca; }
.stat.risk .label, .stat.risk .value { color: #991b1b; }
.stat.reward { background: #ecfdf5; border-color: #6ee7b7; }
.stat.reward .label { color: #065f46; }
.stat.reward .value { color: #047857; }

/* ------------------------------------------------------- forecast tables */
.year-group { margin-bottom: 24px; }
.year-header {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--n-dark); color: #fff; border-radius: 8px 8px 0 0;
  font-weight: 700; font-size: 14px;
}
.year-header span { font-size: 12px; font-weight: 400; opacity: .75; }
.year-group .table-wrap { overflow-x: auto; background: #fff; }
.year-group table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0; }
.year-group thead th { background: var(--n-light); padding: 8px 12px; text-align: left; font-weight: 600; border-bottom: 1px solid var(--n-border); white-space: nowrap; }
.year-group tbody tr:hover { background: #f0f4ff; }
.year-group tbody td { padding: 7px 12px; border-bottom: 1px solid var(--n-border); vertical-align: middle; }
.year-group .num { text-align: right; }
.year-group a.plain { color: inherit; text-decoration: none; }
.year-group a.plain:hover { color: var(--n-blue); text-decoration: underline; }
tr.subtotal td { background: var(--n-light); font-weight: 700; border-top: 2px solid var(--n-border); border-bottom: 2px solid var(--n-border); }
.qty-split { font-size: 11px; color: #6b7280; font-weight: 400; white-space: nowrap; }
.shipped-no { color: #9ca3af; font-size: 12px; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #e8edf5; }
th.sortable.sorted { background: #dbeafe; color: #1e40af; }
.sort-ind { margin-left: 4px; font-size: 9px; vertical-align: middle; }
.sort-ind sup { font-size: 9px; font-weight: 700; margin-left: 1px; }

tr.risk-row td { background: #fee2e2; }
tbody tr.risk-row:hover td { background: #fecaca; }

.tinker-active table { outline: 2px dashed var(--n-amber); border-radius: 6px; }
.tinker-active thead th { background: #fef3c7; }
input.tinker-input {
  width: 64px; border: 1px solid var(--n-amber); border-radius: 4px;
  padding: 2px 6px; font-size: 13px; text-align: right; background: #fffbeb;
}
input.tinker-input.wide { width: 96px; }
tr.is-tinkered td:first-child { box-shadow: inset 3px 0 0 var(--n-amber); }

/* ---------------------------------------------------- end-market breakdown */
.market-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
@media (max-width: 700px) { .market-groups { grid-template-columns: 1fr; } }
.market-group { border-radius: 10px; padding: 16px; }
.market-group.industrial { background: #fffbeb; border: 2px solid #fcd34d; }
.market-group.commercial { background: #faf5ff; border: 2px solid #d8b4fe; }
.market-group-label {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 10px; padding-bottom: 8px;
}
.market-group.industrial .market-group-label { color: #92400e; border-bottom: 1px solid #fcd34d; }
.market-group.commercial .market-group-label { color: #6b21a8; border-bottom: 1px solid #d8b4fe; }
.group-totals { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; opacity: .85; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.market-card { background: rgba(255,255,255,.8); border-radius: 8px; padding: 12px 14px; border: 1px solid var(--n-border); }
.market-card .mkt-name { font-weight: 700; font-size: 13px; color: var(--n-dark); margin-bottom: 4px; }
.market-card .mkt-val { font-size: 12px; color: #6b7280; }

/* ------------------------------------------------ monthly shipping schedule */
.schedule-summary {
  display: flex; align-items: center; background: #f8fafc; border: 1px solid var(--n-border);
  border-radius: 8px; padding: 12px 18px; margin-bottom: 16px; flex-wrap: wrap;
}
.schedule-summary-stat { min-width: 120px; padding-right: 20px; }
.schedule-summary-sep { width: 1px; align-self: stretch; background: var(--n-border); margin: 0 20px; }
.schedule-summary-slots { flex: 1; }
.ss-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #6b7280; margin-bottom: 5px; }
.ss-value { font-size: 20px; font-weight: 700; color: var(--n-dark); }
.ss-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ss-chip { background: #e0f2fe; color: #0369a1; border-radius: 999px; padding: 3px 10px; font-size: 12px; white-space: nowrap; }
.ss-chip strong { color: #075985; }
.ss-none { color: #6b7280; font-style: italic; font-size: 12px; }
.ss-hint { font-size: 12px; color: #6b7280; font-style: italic; align-self: center; max-width: 220px; }

.schedule-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.schedule-grid[hidden] { display: none; }
.schedule-month {
  background: var(--mc-bg); border: 2px solid var(--mc-border); border-radius: 10px;
  min-width: 210px; flex: 1 1 210px; max-width: 320px; overflow: hidden;
}
.schedule-month-header {
  background: var(--mc-border); color: var(--mc-text); font-weight: 700; font-size: 13px;
  padding: 8px 14px; display: flex; justify-content: space-between; align-items: center;
  width: 100%; border: 0; text-align: left;
}
.slot-count { font-weight: 500; font-size: 11px; opacity: .85; }
.slot-count.over { background: #fee2e2; color: #b91c1c; opacity: 1; border-radius: 999px; padding: 2px 8px; font-weight: 700; }
.schedule-month.over-capacity { border-color: #fca5a5; }
.schedule-slot {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border-top: 1px solid var(--mc-border); font-size: 12px;
}
.slot-num { font-weight: 700; font-size: 11px; min-width: 14px; text-align: right; }
.slot-deal { flex: 1; color: var(--n-dark); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-system { font-weight: 400; color: #6b7280; }
.slot-empty .slot-empty-label { flex: 1; color: #b0b7c3; font-style: italic; font-size: 12px; }
.slot-qty { color: #6b7280; font-weight: 600; font-size: 11px; }

.schedule-slot[draggable="true"] { cursor: grab; }
.schedule-slot[draggable="true"]:active { cursor: grabbing; }
.gss-unit.is-dragging { opacity: .4; }
.schedule-month.is-target { outline: 3px dashed #2563eb; outline-offset: 2px; filter: brightness(1.03); }

.unscheduled-card { --mc-bg: #f3f4f6; --mc-border: #d1d5db; --mc-text: #374151; border-style: dashed; }
.unscheduled-card.collapsed { align-self: flex-start; max-width: 240px; }
.unscheduled-toggle { cursor: pointer; user-select: none; }
.unscheduled-toggle:hover { filter: brightness(.97); }
.unscheduled-note { font-size: 11px; color: #6b7280; font-style: italic; padding: 8px 12px; }

.upside-card { --mc-bg: #ecfdf5; --mc-border: #6ee7b7; --mc-text: #065f46; }
.upside-body { padding: 14px; text-align: center; }
.upside-value { font-size: 26px; font-weight: 800; color: #047857; line-height: 1.1; }
.upside-sub { font-size: 12px; color: #059669; font-weight: 600; margin-top: 2px; }
.upside-detail { font-size: 12px; color: #374151; margin-top: 10px; }
.upside-note { font-size: 11px; color: #6b7280; margin-top: 8px; font-style: italic; }

.schedule-future-divider {
  display: flex; align-items: center; gap: 12px; margin: 22px 0 14px; width: 100%;
  color: #9ca3af; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  background: none; border: 0; padding: 0;
}
.schedule-future-divider::before, .schedule-future-divider::after { content: ''; flex: 1; height: 1px; background: #e5e7eb; }
.schedule-future-divider.year-toggle { cursor: pointer; user-select: none; }
.schedule-future-divider.year-toggle:hover { color: #4b5563; }
.schedule-future-divider.year-toggle:hover::before,
.schedule-future-divider.year-toggle:hover::after { background: #cbd5e1; }

/* Numbers that must line up. */
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.gss-split { background: #e0e7ff; color: #3730a3; font-weight: 600; cursor: help; }
.empty-state { text-align: center; padding: 40px; color: #6b7280; font-size: 14px; }

/* His customer-status badges, and his search-and-filter row. */
.gss-cust-new      { background: #e0f2fe; color: #075985; }
.gss-cust-existing { background: #f0fdf4; color: #14532d; }
.search-bar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.search-bar .form-control, .search-bar .form-select { width: auto; flex: 1; min-width: 160px; max-width: 280px; }

/* His probability bar, and table headings that sort without looking like links. */
.prob-bar-wrap { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.prob-bar { height: 6px; border-radius: 3px; background: #dbeafe; flex: 1; max-width: 80px; overflow: hidden; }
.prob-bar-fill { height: 100%; border-radius: 3px; background: var(--n-blue); }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.th-sort:hover { color: var(--n-blue); }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { color: var(--n-blue); text-decoration: underline; }

/* His Leads page: the total beside the title, and converted rows faded. */
.gss-total { font-size: 12px; font-weight: 400; color: #6b7280; background: #f3f4f6; border-radius: 4px; padding: 2px 8px; margin-left: 8px; vertical-align: middle; }
tr.is-converted { opacity: .55; }

/* His Import page. */
.import-section { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .import-section { grid-template-columns: 1fr; } }
.gss-lede { color: #6b7280; margin-bottom: 20px; font-size: 13px; }
.gss-note { font-size: 12px; color: #6b7280; margin-bottom: 14px; }
.gss-tips { font-size: 13px; line-height: 1.8; color: #374151; padding-left: 20px; margin: 0; }
/* His code snippets are the page's own colour; Bootstrap makes them pink. */
code { color: inherit; }

/* His modal: 10px radius, 28px 32px padding, a 16px heading. The form page's
   own card is flattened inside it, so a form does not sit in a box in a box. */
.gss-modal { border: 0; border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
.gss-modal .modal-header { border: 0; padding: 28px 32px 0; }
.gss-modal .modal-title { font-size: 16px; font-weight: 700; color: var(--n-mid); }
.gss-modal .modal-body { padding: 16px 32px 28px; }
.gss-modal .card { border: 0; box-shadow: none; margin: 0; }
.gss-modal .card-body { padding: 0; }
.gss-modal form .d-flex.gap-2:last-child { justify-content: flex-end; margin-top: 20px; }
