/* Roboto — primary font for every Kuvrr UI component. Imported here so
   this stylesheet is self-sufficient (no reliance on layout.html <link>
   tags). MUST stay at the very top of the file — @import rules are only
   valid before any other CSS rule. */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════════════════════════════════
   KUVRR GLOBAL UI COMPONENTS
   ───────────────────────────────────────────────────────────────────────────
   Purpose:
     Single source of truth for shared, app-wide UI primitives (page headers,
     form controls, labels, values, etc). Edit a class here ONCE and the
     change propagates to every page that uses it.

   Loading order:
     This file is linked in shared/layout.html AFTER kuvrr-standard.css.
     It defines the design tokens (see section 0) and the canonical base
     components; rules here win the cascade against page-specific kv-*
     overrides in kuvrr-standard.css. Treat the kvgl-* design system as
     authoritative — when you spot a kv-* override in kuvrr-standard.css
     that conflicts with a kvgl-* rule, delete the override rather than
     boosting specificity here.

   How to add a component:
     1. Confirm CLAUDE.md / kuvrr-standard.css does not already define a class for it.
     2. Name it with the MANDATORY `kvgl-` prefix (e.g. .kvgl-form-label).
        Every class in THIS file must start with `kvgl-`; non-global/page-specific
        classes belong in kuvrr-standard.css under the `kv-` prefix instead.
     3. Add the class block under the matching SECTION below (or create a
        new SECTION with a banner comment).
     4. Document the intended markup, tokens used, and any required
        parent context directly above the rule.
     5. NEVER write inline <style> blocks in templates — extend this file.

   Sections (jump table):
     0. DESIGN TOKENS    (CSS custom properties used by every component below)
     1. PAGE HEADER      (.kvgl-page-header + .kvgl-ph-*)
     2. FORM SYSTEM      (.kvgl-form + .kvgl-form-section, .kvgl-form-grid, .kvgl-form-field, etc.)
     3. FORM UTILITIES   (.kvgl-form-row, .kvgl-w-*, .kvgl-form-check-label, .kvgl-form-value, ...)
     4. CUSTOM FIELDS    (.kvgl-cf-* — Add Custom Field UI)
     5. COMPLETION ALERTS(.kvgl-cmp-* — recipient picker rows / chips)
     6. CONFIRM MODAL    (.kv-modal-overlay / .kv-modal — legacy kv-* prefix, shared)
     ─ add future sections here: LABELS/VALUES, ...
   ═══════════════════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════════════════
   0. DESIGN TOKENS
   ───────────────────────────────────────────────────────────────────────────
   Self-contained palette + typography variables so every rule in this file
   resolves correctly even if kuvrr-standard.css is removed/reordered. Names
   and values mirror the canonical Kuvrr UI Style Guide (see CLAUDE.md).

   Convention: ALWAYS reference these tokens (var(--blue), var(--t1), ...)
   instead of hard-coding hex values. To rebrand the app, change the value
   here once.

   This is the SOLE :root token block for the application. Other
   stylesheets (e.g. kuvrr-standard.css) intentionally do NOT redefine
   these — they only consume them. Add new tokens here as new components
   need them.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* ── Brand ── */
  --navy:     #213142;   /* dark brand — top toolbar, primary text on light bg */
  --navy-d:   #182538;   /* navy hover                                         */
  --blue:     #22BAFF;   /* primary accent — links, active states, avatar tint */
  --blue-mid: #046BD4;   /* mid-tone blue — link hover                         */

  /* ── Sidebar (dark nav background) ── */
  --sb-bg:     #0C1520;
  --sb-border: rgba(255,255,255,.055);
  --sb-hover:  rgba(255,255,255,.048);
  --sb-active: rgba(34,186,255,.09);

  /* ── Surfaces & borders ── */
  --page:    #F3F5F8;    /* sidebar / app page background              */
  --white:   #FFFFFF;
  --border:  #E1E5EA;    /* primary 1px borders (cards, inputs)        */
  --border2: #ECEEF2;    /* secondary borders (separators)             */

  /* ── Text ── */
  --t1: #0F1923;         /* primary text (titles, table cells)        */
  --t2: #374151;         /* secondary text                             */
  --t3: #6B7280;         /* tertiary text (labels, subtitles, hints)  */
  --t4: #9CA3AF;         /* light text (disabled, placeholders)       */
  --t5: #D1D5DB;         /* faintest text / dividers                  */

  /* ── Status colors ── */
  --red:    #EF4444;     /* alerts, open status, danger actions        */
  --red-bg: #FEF2F2;     /* danger background tint                     */
  --amber:  #F59E0B;     /* monitoring, warnings, toggle icons         */
  --green:  #10B981;     /* closed status, success                     */
  --purple: #8B5CF6;     /* special indicators                         */
  --teal:   #06B6D4;
  --orange: #F97316;     /* alternative status                         */

  /* ── Typography ── */
  --f: 'Roboto', sans-serif;   /* primary font stack used by every component */

  /* ── Radius & shadow ── */
  --r:  8px;             /* large radius — cards, modals               */
  --r2: 5px;             /* small radius — inputs, buttons             */
  --sh: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);   /* card shadow */
}


/* ═══════════════════════════════════════════════════════════════════════════
   1. PAGE HEADER  (page sub-header strip)
   ───────────────────────────────────────────────────────────────────────────
   The compact white bar that sits at the top of every list / detail / edit
   page, BELOW the global navy top toolbar. It is the page's own title +
   action area (NOT the app-wide topbar).

   Standard markup (title ONLY — no leading icon avatar, no subtitle):
     <div class="kvgl-page-header">
       <div class="kvgl-ph-left">
         <div class="kvgl-ph-info">
           <h2>Page Title</h2>
         </div>
       </div>
       <div class="kvgl-ph-actions">
         <button class="kv-btn kv-btn-outline">Filter</button>
         <a class="kv-btn kv-btn-primary" href="...">Add</a>
       </div>
     </div>

   Tokens used:
     --t1     #0F1923   title color
     --f      Roboto    inherited via body

   Spec (per CLAUDE.md):
     - Container : white bg, 6px radius, 0 12px padding, 36px min-height,
                   8px margin-bottom (separates header from page body).
     - Title h2  : 14px / 700, --t1, line-height 1.2.
     - Actions   : right-aligned, 8px gap, vertically centered.
     - NO avatar / leading icon tile and NO subtitle <p> — page headers
       show the title and action buttons only. For back navigation, put a
       "Back" outline button in .kvgl-ph-actions instead of a clickable avatar.

   Reference: shipment list page — safetkuvrr/emc/templates/survey/manage_shipments_map.html
   ═══════════════════════════════════════════════════════════════════════════ */

/* Outer strip — flexes title block (left) against action buttons (right). */
.kvgl-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  background: #fff;
  border-radius: 6px;
  padding: 0 12px;
  min-height: 36px;
}

/* Left cluster: just the title wrapper. */
.kvgl-ph-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Title wrapper — holds only <h2>. No subtitle <p>, no leading icon. */
.kvgl-ph-info h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--t1);
  line-height: 1.2;
}

/* Right cluster: action buttons, status chips, inline legends. */
.kvgl-ph-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}


/* ═══════════════════════════════════════════════════════════════════════════
   2. FORM SYSTEM  (.kvgl-form + child components)
   ───────────────────────────────────────────────────────────────────────────
   Inline-label flat form layout based on the Kuvrr Form Type System
   reference (md/kuvrr_form_type_system - White Bg.html).

   Layout: 4-column visual grid → 160px label | flex input | 160px label | flex input
   Implemented as 2-col CSS grid where each cell is a flex row (label + input).

   Markup:
     <div class="kvgl-form">
       <div class="kvgl-form-section">
         <div class="kvgl-form-section-head">Section Title</div>
         <div class="kvgl-form-section-body">
           <div class="kvgl-form-grid">
             <div class="kvgl-form-field">
               <label>Label <span class="kvgl-req">*</span></label>
               <div class="kvgl-form-input"><input type="text" /></div>
             </div>
           </div>
         </div>
       </div>
     </div>

   Tokens used: --navy, --t1, --t3, --t4, --blue, --red, --border, --f, --r, --r2
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Form container ── */
.kvgl-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 28px 24px;
  font-family: var(--f);
}

/* ── Section (replaces kv-edit-card) ── */
.kvgl-form-section {
  border: none; border-radius: 0; box-shadow: none;
  background: transparent; margin-bottom: 0;
}
.kvgl-form-section + .kvgl-form-section {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

/* ── Section heading — 13px/600, bottom rule ── */
.kvgl-form-section-head {
  display: flex; align-items: center;
  padding: 16px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  font-family: var(--f);
  font-size: 13px; font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  gap: 0;
}
.kvgl-form-section-head i { display: none; }
.kvgl-form-section-body { padding: 0 0 6px; }

/* ── Grid — 2-column layout ── */
.kvgl-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.kvgl-form-grid + .kvgl-form-grid { margin-top: 5px; }
.kvgl-form-grid-single { grid-template-columns: 140px 1fr; }

/* ── Field — inline [140px label] [flex input] ── */
.kvgl-form-field {
  display: flex; align-items: center; gap: 10px;
  padding: 0; border-bottom: none; min-width: 0;
}
.kvgl-form-field-full { grid-column: 1 / -1; }

/* ── Label ── */
.kvgl-form-field > label {
  flex: 0 0 140px; white-space: nowrap;
  font-family: var(--f);
  font-size: 9px; font-weight: 400;
  color: #6B7280;
  text-transform: none; letter-spacing: normal;
  margin: 0; display: block;
}
.kvgl-req { color: var(--red); margin-left: 1px; }

/* ── Input wrapper ── */
.kvgl-form-input { flex: 1; min-width: 0; }

/* ── Stack variant — label above input, both full width.
   Compound selectors here so flex-basis:140px (from .kvgl-form-field>label) and
   flex:1 (from .kvgl-form-input) don't apply on the column main axis and turn
   the label into a 140px-tall block or the input wrapper into a tall stretched
   box. Specificity (0,2,1) > (0,1,1) regardless of source order. ── */
.kvgl-form-field.kvgl-form-field-stack {
  flex-direction: column; align-items: stretch;
  gap: 4px;
}
.kvgl-form-field.kvgl-form-field-stack > label {
  flex: 0 0 auto;
  white-space: normal;
  margin-bottom: 2px;
}
.kvgl-form-field.kvgl-form-field-stack > .kvgl-form-input {
  flex: 0 0 auto;
  width: 100%;
}

/* ── Text input / select / textarea ── */
.kvgl-form-input input[type="text"],
.kvgl-form-input input[type="email"],
.kvgl-form-input input[type="password"],
.kvgl-form-input input[type="number"],
.kvgl-form-input input[type="tel"],
.kvgl-form-input select {
  width: 100%; height: 30px;
  padding: 0 9px;
  font-family: var(--f);
  font-size: 9px; font-weight: 500;
  color: var(--t1);
  border: 1px solid #E5E7EB; border-radius: var(--r2);
  background: #fff; outline: none;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.kvgl-form-input textarea {
  width: 100%;
  min-height: 52px; padding: 6px 9px;
  font-family: var(--f);
  font-size: 9px; font-weight: 500;
  color: var(--t1);
  border: 1px solid #E5E7EB; border-radius: var(--r2);
  background: #fff; outline: none;
  resize: vertical; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.kvgl-form-input input:focus,
.kvgl-form-input select:focus,
.kvgl-form-input textarea:focus {
  border-color: #9CA3AF;
  box-shadow: 0 0 0 2px rgba(156,163,175,.18);
}
.kvgl-form-input input::placeholder,
.kvgl-form-input textarea::placeholder {
  font-weight: 400; color: #C4C9D4;
}
.kvgl-form-input input:disabled,
.kvgl-form-input select:disabled,
.kvgl-form-input textarea:disabled {
  background: #F9FAFB; color: #C4C9D4;
  border-color: #F3F4F6; cursor: not-allowed;
}

/* ── Checkbox ── */
.kvgl-form-input input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--blue);
  cursor: pointer;
}

/* ── Radio group (native, no pill) ── */
.kvgl-form-radio-group {
  display: flex; gap: 20px; align-items: center;
  flex-wrap: wrap;
}
.kvgl-form-radio {
  display: flex; align-items: center; gap: 5px;
  cursor: pointer;
  font-family: var(--f);
  font-size: 9px; font-weight: 500;
  color: var(--t1);
  background: transparent; border: none; padding: 0;
}
.kvgl-form-radio:hover { background: transparent; }
.kvgl-form-radio input[type="radio"] {
  display: inline-block; width: auto;
  accent-color: var(--blue); margin: 0;
}
.kvgl-form-radio span { padding: 0; }

/* ── Driver type pill radios ── */
.kvgl-driver-group {
  display: flex; gap: 8px; margin-top: 0;
}
.kvgl-driver-option {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; background: #fff;
  color: var(--t3);
  font-family: var(--f);
  font-size: 9px; font-weight: 600;
  transition: all .12s ease; margin: 0;
}
.kvgl-driver-option i { font-size: 11px; color: var(--t4); }
.kvgl-driver-option input[type="radio"] { display: none; }
.kvgl-driver-option:hover { border-color: var(--blue); color: var(--t1); }
.kvgl-driver-option.selected {
  background: rgba(34,186,255,.08);
  border-color: var(--blue); color: var(--blue);
}
.kvgl-driver-option.selected i { color: var(--blue); }

/* ── Selectize / ui-select overrides ── */
.kvgl-form-input .selectize-input {
  padding: 0 8px !important; min-height: 28px !important;
  display: flex !important; align-items: center !important; flex-wrap: wrap !important;
  font-size: 9px !important; font-family: var(--f) !important;
  border: 1px solid #E5E7EB !important; border-radius: var(--r2) !important;
  box-shadow: none !important;
  line-height: 28px !important;
}
.kvgl-form-input .selectize-input:focus,
.kvgl-form-input .selectize-input.focus {
  border-color: #9CA3AF !important;
  box-shadow: 0 0 0 2px rgba(156,163,175,.18) !important;
}
.kvgl-form-input .selectize-input .item {
  font-size: 9px !important; font-family: var(--f) !important;
}
.kvgl-form-input .selectize-dropdown {
  font-size: 9px !important; font-family: var(--f) !important;
}
.kvgl-form-input .selectize-dropdown .option {
  padding: 5px 8px !important;
}
.kvgl-form-input .ui-select-match-item {
  font-size: 9px !important; padding: 1px 6px !important;
}
.kvgl-form-input .ui-select-container,
.kvgl-form-input .form-control {
  width: 100% !important; height: auto !important;
  min-height: 0 !important;
}

/* ── Searchable multi-select (Alert Triggers) — standalone, no .kvgl-form parent required ── */
.kvgl-form-input .searchable-multi-select,
.searchable-multi-select.kvgl-multi-select {
  border: 1px solid #E5E7EB; border-radius: var(--r2);
  padding: 0 8px; min-height: 28px;
  font-family: var(--f);
  display: flex; flex-wrap: wrap; align-items: center;
}
.kvgl-form-input .selected-item,
.kvgl-multi-select .selected-item {
  font-size: 9px; padding: 1px 7px; border-radius: 3px;
  font-family: var(--f);
}
.kvgl-form-input .selected-item .remove-btn,
.kvgl-multi-select .selected-item .remove-btn { font-size: 9px; }
.kvgl-form-input .search-input,
.kvgl-multi-select .search-input {
  font-size: 9px !important; padding: 3px 5px !important;
  font-family: var(--f) !important;
}

/* ── Toggle link (Enter manually / Select from available) ── */
.kvgl-form-toggle {
  margin-bottom: 4px;
}
.kvgl-form-toggle span {
  font-family: var(--f);
  font-size: 9px; font-weight: 500;
  color: var(--blue); cursor: pointer;
}
.kvgl-form-toggle span:hover { text-decoration: underline; }

/* ── Field error message ── */
.kvgl-form-error {
  display: block;
  margin: 4px 0 0;
  font-family: var(--f);
  font-size: 9px; font-weight: 500;
  color: #EF4444;
}

/* ── Validation — highlight after submit ── */
form.ng-submitted .kvgl-form-input input.ng-invalid,
form.ng-submitted .kvgl-form-input select.ng-invalid,
form.ng-submitted .kvgl-form-input textarea.ng-invalid,
form.ng-submitted .kvgl-form-input .ui-select-container.ng-invalid .selectize-input {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.08);
}
form.ng-submitted .kvgl-form-field:has(.ng-invalid) > label {
  color: #EF4444 !important;
}
.kvgl-select-error .selectize-input {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,.08);
}

/* ── Stop card (shipment legs) ── */
.kvgl-stop-card {
  border: none; border-radius: 0; margin-bottom: 20px;
}
.kvgl-stop-head {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 0 12px;
}
.kvgl-stop-head-left {
  display: flex; align-items: center;
}
.kvgl-stop-body { padding: 0; }
.kvgl-stop-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-family: var(--f);
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.kvgl-stop-title {
  font-family: var(--f);
  font-size: 11px; font-weight: 600;
  color: var(--navy); margin-left: 7px;
}
.kvgl-stop-remove {
  font-family: var(--f);
  font-size: 9px; font-weight: 700;
  color: #EF4444; background: none; border: none;
  cursor: pointer; padding: 0;
}
.kvgl-stop-remove:hover { color: #DC2626; }

/* ── Add stop button ── */
.kvgl-stop-add {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f);
  font-size: 9px; font-weight: 700;
  color: var(--blue); background: #fff;
  border: 1px dashed var(--blue); border-radius: var(--r2);
  padding: 6px 14px; margin-top: 8px;
  cursor: pointer; text-decoration: none;
}
.kvgl-stop-add:hover { background: #F0F7FF; }

/* ── Form actions footer ── */
.kvgl-form-actions {
  display: flex; justify-content: flex-end;
  align-items: center; gap: 8px;
  padding-top: 18px; border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ── Hint text below field ── */
.kvgl-form-hint {
  font-family: var(--f);
  font-size: 9px; font-weight: 400;
  color: var(--t4); margin-top: 3px;
}

/* ── Description / helper text ── */
.kvgl-form-desc {
  font-family: var(--f);
  font-size: 9px; color: var(--t3);
  margin: 0 0 10px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   3. FORM UTILITY HELPERS  (replace common inline styles)
   ───────────────────────────────────────────────────────────────────────────
   Drop-in utility classes for layout/sizing patterns that show up across
   every form. Use these instead of style="..." on inputs / wrappers so
   form geometry stays consistent and editable from one place.

   Pairs / inline rows (date+time, lat+long, etc.):
     <div class="kvgl-form-input">
       <div class="kvgl-form-row">
         <input class="kvgl-w-date" ...>
         <input class="kvgl-w-time" ...>
       </div>
     </div>

   Checkbox cell (when the input wrapper is just a single checkbox):
     <div class="kvgl-form-input kvgl-form-input-check">
       <input type="checkbox" ...>
     </div>

   Inline label-with-checkbox (stacked field where the LABEL contains the
   checkbox, like "Shipment completion alert to"):
     <label class="kvgl-form-check-label">
       <input type="checkbox" ...> Label text
     </label>

   Stacked grid (one field per row, wider value column):
     <div class="kvgl-form-grid kvgl-form-grid-stack">

   Read-only value (audit info — "Created By: ..."):
     <div class="kvgl-form-input"><span class="kvgl-form-value">[{ ... }]</span></div>

   Misc width helpers (input only — never apply to wrappers):
     .kvgl-w-floor (100px)  .kvgl-w-date (130px)  .kvgl-w-time (100px)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Inline row for "date + time" / "lat + long" style pairs. */
.kvgl-form-row {
  display: flex; gap: 7px; align-items: center;
}

/* Width helpers for individual narrow inputs inside .kvgl-form-input. */
.kvgl-w-floor { max-width: 100px !important; }
.kvgl-w-date  { max-width: 130px !important; }
.kvgl-w-time  { max-width: 100px !important; }

/* Checkbox-only input cell — vertically centers the lone checkbox. */
.kvgl-form-input.kvgl-form-input-check {
  display: flex; align-items: center;
}

/* Inline checkbox-label combo (checkbox sits inside the label text). */
.kvgl-form-check-label {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 6px;
  font-family: var(--f);
  font-size: 9px; font-weight: 600;
  color: var(--t1);
  white-space: normal;
  flex: none;
}
.kvgl-form-check-label input[type="checkbox"] {
  accent-color: var(--blue);
  width: 14px; height: 14px;
}

/* Stacked single-column grid (label above input, full width). */
.kvgl-form-grid-stack { grid-template-columns: 1fr; }

/* Read-only audit value (Created By / Last Modified By). */
.kvgl-form-value {
  font-family: var(--f);
  font-size: 9px; font-weight: 500;
  color: var(--t1);
}

/* Stop-count hint shown next to "Shipment Stops" heading. */
.kvgl-form-section-count {
  font-family: var(--f);
  font-size: 9px; font-weight: 400;
  color: var(--t3);
  margin-left: 6px;
}

/* Width: 100% utility for ui-select / form-control that we used to set inline. */
.kvgl-form-input .ui-select-container,
.kvgl-form-input .form-control { width: 100%; }


/* ═══════════════════════════════════════════════════════════════════════════
   4. CUSTOM FIELDS  (.kvgl-cf-*)
   ───────────────────────────────────────────────────────────────────────────
   "Add Custom Field" UI used on shipments (and reusable on any entity that
   supports user-defined key/value pairs). Two-step add flow:
     1. Pick a field type (Text / File)
     2. Enter a field name
   Then a list of added fields with rename + remove controls.

   Markup:
     <div class="kvgl-cf-item">
       <div class="kvgl-cf-label-row">
         <span class="kvgl-cf-field-name">FieldKey</span>
         <span class="kvgl-cf-required">(Required)</span>
         <button class="kvgl-cf-edit-btn"><i class="fa fa-pencil"></i></button>
       </div>
       <div class="kvgl-cf-value-row">
         <input class="kvgl-cf-value-input" />
         <button class="kvgl-cf-remove-btn"><i class="fa fa-minus-circle"></i></button>
       </div>
     </div>
     <div class="kvgl-cf-step">
       <div class="kvgl-cf-step-label">Field Type <span class="kvgl-cf-required">(Required)</span></div>
       <div class="kvgl-cf-type-row">
         <div class="kvgl-cf-type-card kvgl-cf-type-active">Text</div>
         <div class="kvgl-cf-type-card kvgl-cf-type-disabled">File</div>
       </div>
     </div>
     <a class="kvgl-cf-add-link">Add Custom Field</a>
   ═══════════════════════════════════════════════════════════════════════════ */

.kvgl-cf-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border2);
}
.kvgl-cf-item:last-child { border-bottom: none; }

.kvgl-cf-label-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
}
.kvgl-cf-field-name {
  font-family: var(--f);
  font-size: 10px; font-weight: 700;
  color: var(--t1);
}
.kvgl-cf-required {
  font-family: var(--f);
  font-size: 9px; font-weight: 400;
  color: var(--t3);
}
.kvgl-cf-edit-btn {
  background: none; border: none;
  color: var(--blue); cursor: pointer;
  font-size: 12px; padding: 0 2px; line-height: 1;
}
.kvgl-cf-edit-btn:hover { color: #4AC8FF; }

.kvgl-cf-value-row {
  display: flex; align-items: center; gap: 8px;
}
.kvgl-cf-value-input {
  flex: 1;
  font-family: var(--f);
  font-size: 9px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  height: auto;
}
.kvgl-cf-value-input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(34,186,255,.1);
}

.kvgl-cf-remove-btn {
  background: none; border: none; cursor: pointer;
  color: var(--t4);
  font-size: 18px; padding: 0; line-height: 1;
  flex-shrink: 0;
  transition: color .12s ease;
}
.kvgl-cf-remove-btn:hover { color: #EF4444; }

.kvgl-cf-rename-input {
  width: 200px;
  font-family: var(--f);
  font-size: 9px;
  padding: 6px 9px;
}

.kvgl-cf-edit-actions {
  display: inline-flex; align-items: center; gap: 6px;
}
.kvgl-cf-edit-actions .kv-btn { padding: 3px 10px; font-size: 9px; }

/* Step panels (add custom field flow) */
.kvgl-cf-step { margin-bottom: 16px; }
.kvgl-cf-step-label {
  font-family: var(--f);
  font-size: 10px; font-weight: 700;
  color: var(--t1);
  margin-bottom: 8px;
}
.kvgl-cf-type-row {
  display: flex; align-items: center; gap: 8px;
}
.kvgl-cf-type-card {
  flex: 1; max-width: 260px;
  text-align: center;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--f);
  font-size: 10px; font-weight: 500;
  color: var(--t1);
  cursor: pointer;
  transition: all .12s ease;
  background: #fff;
}
.kvgl-cf-type-card:hover {
  border-color: var(--blue); color: var(--blue);
}
.kvgl-cf-type-active {
  border-color: var(--blue);
  background: rgba(34,186,255,.06);
  color: var(--blue);
  font-weight: 600;
}
.kvgl-cf-type-disabled {
  opacity: .4;
  cursor: not-allowed !important;
  pointer-events: none;
}

.kvgl-cf-name-row {
  display: flex; align-items: center; gap: 8px;
}
.kvgl-cf-name-input {
  flex: 1; max-width: 400px;
  font-family: var(--f);
  font-size: 9px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  height: auto;
}
.kvgl-cf-name-input:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(34,186,255,.1);
}

.kvgl-cf-input-error {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.1) !important;
}
.kvgl-cf-error {
  font-family: var(--f);
  font-size: 9px;
  color: #EF4444;
  margin-top: 4px;
}
.kvgl-cf-add-btn-confirm {
  background: rgba(16,185,129,.12);
  color: #10B981;
  border: 1px solid rgba(16,185,129,.3);
  border-radius: 5px;
  padding: 5px 16px;
  font-family: var(--f);
  font-size: 9px; font-weight: 700;
  cursor: pointer;
  transition: all .12s ease;
}
.kvgl-cf-add-btn-confirm:hover { background: rgba(16,185,129,.2); }

.kvgl-cf-add-link {
  display: inline-block;
  font-family: var(--f);
  font-size: 10px; font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  margin-top: 4px;
  transition: color .12s ease;
}
.kvgl-cf-add-link:hover { color: #4AC8FF; }
.kvgl-cf-add-disabled {
  color: var(--t4) !important;
  cursor: default !important;
  pointer-events: none;
}
.kvgl-cf-limit-hint {
  font-family: var(--f);
  font-size: 9px; color: var(--t4);
  margin-top: 2px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   5. COMPLETION ALERTS  (.kvgl-cmp-*)
   ───────────────────────────────────────────────────────────────────────────
   Recipient-picker rows used inside ui-select dropdowns for "Shipment
   completion alert to ..." style fields. Each row shows a name + a small
   meta string (user type, email) and the chip view shows a tiny type tag.

   Markup (inside <ui-select-choices>):
     <div class="kvgl-cmp-recipient-row">
       <span ng-bind-html="...">Name</span>
       <small class="kvgl-cmp-recipient-meta">&middot; Driver &middot; foo@bar</small>
     </div>
   Markup (inside <ui-select-match>):
     <small class="kvgl-cmp-chip-type">[{type}]</small>
   ═══════════════════════════════════════════════════════════════════════════ */

.kvgl-cmp-recipient-row {
  display: flex; align-items: baseline; gap: 4px;
}
.kvgl-cmp-recipient-meta {
  color: var(--t3);
  font-family: var(--f);
  font-size: 9px;
  white-space: nowrap;
}
/* When selectize highlights the active option, flip meta to white so it
   stays legible on the blue active-row background. */
.selectize-dropdown .active .kvgl-cmp-recipient-meta,
.ui-select-choices-row.active .kvgl-cmp-recipient-meta,
.option.active .kvgl-cmp-recipient-meta {
  color: rgba(255,255,255,.85);
}
.kvgl-cmp-chip-type {
  font-family: var(--f);
  font-size: 8px; font-weight: 600;
  color: var(--t3);
  margin-left: 2px;
}
.kvgl-cmp-empty {
  font-family: var(--f);
  font-size: 9px;
  color: var(--t3);
}

/* ── ui-select empty-state messages (inside <ui-select-no-choice>) ── */
/* Red "no matches found" message. */
.kvgl-select-empty {
  font-family: var(--f);
  font-size: 9px;
  color: #EF4444;
}
/* Subtle gray placeholder (e.g. "No trackers matching your search"). */
.kvgl-select-empty-soft {
  font-family: var(--f);
  font-size: 9px;
  color: #cacaca;
}
/* Smaller secondary line under a dropdown choice (e.g. email under name). */
.kvgl-select-sub {
  font-family: var(--f);
  font-size: 10px;
  color: var(--t3);
}
/* Inline blue action link (underlined) shown inside dropdown empty states. */
.kvgl-link-inline {
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
}
.kvgl-link-inline:hover { color: #046BD4; }

/* Field-level error list shown inside .kv-form-alert / .kvgl-form-alert. */
.kvgl-form-alert-list {
  margin: 6px 0 0 18px;
  padding: 0;
}

/* ── Section-head variant — title left, action button right ───────────────── */
.kvgl-form-section-head.kvgl-form-section-head-split {
  justify-content: space-between;
}
.kvgl-form-section-head.kvgl-form-section-head-split .kv-btn {
  padding: 4px 10px;
}

/* ── Subsection (small labelled group inside a section body) ──────────────── */
.kvgl-form-subsection {
  margin-bottom: 16px;
}
.kvgl-form-subsection:last-child { margin-bottom: 0; }
.kvgl-form-subsection-head {
  font-family: var(--f);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--t3);
  margin-bottom: 8px;
}

/* ── Horizontal divider between sub-blocks inside a section ──────────────── */
.kvgl-form-divider {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Big checkbox-with-label (e.g. "Trigger Notification" toggle headers) ── */
.kvgl-form-check-label.kvgl-form-check-label-lg {
  font-size: 11px;
  color: var(--t1);
  gap: 8px;
}
.kvgl-form-check-label.kvgl-form-check-label-lg input[type="checkbox"] {
  width: 14px; height: 14px;
}

/* ── Inline row: checkbox-label + adjacent inline field on same line ──────── */
.kvgl-form-inline-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.kvgl-form-inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kvgl-form-inline-field > label {
  font-family: var(--f);
  font-size: 9px; font-weight: 400;
  color: var(--t3);
  white-space: nowrap;
  margin: 0;
}
.kvgl-form-inline-field > input[type="text"],
.kvgl-form-inline-field > input[type="number"] {
  height: 30px;
  padding: 0 9px;
  font-family: var(--f);
  font-size: 9px; font-weight: 500;
  color: var(--t1);
  border: 1px solid #E5E7EB; border-radius: var(--r2);
  background: #fff; outline: none;
  box-sizing: border-box;
}
.kvgl-form-inline-field > input:focus {
  border-color: #9CA3AF;
  box-shadow: 0 0 0 2px rgba(156,163,175,.18);
}

/* ── Inline "Add ..." button inside a form section (left-aligned) ─────────── */
.kvgl-form-add-btn {
  cursor: pointer;
  text-decoration: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   6. DECISION CONFIRMATION MODAL  — single canonical source for ALL popups
   ───────────────────────────────────────────────────────────────────────────
   Design: blue header (#22BAFF), white body, light footer. Matches shipments/list.
   Title pattern : "Confirm [Action] [Object]"
   Message pattern: Please press "Confirm" to [action] the [object] or "Cancel" to go back.

   Markup:
     <div class="kv-modal-overlay" [class.active]="show" (click)="close()">
       <div class="kv-modal" (click)="$event.stopPropagation()">
         <div class="kv-modal-head">
           <span>Confirm Controller Activation</span>
           <button class="kv-modal-close" (click)="close()">&times;</button>
         </div>
         <div class="kv-modal-body">
           <p class="kv-modal-msg">Please press "Confirm" to ... or "Cancel" to go back.</p>
         </div>
         <div class="kv-modal-foot">
           <button class="kv-btn kv-btn-outline">Cancel</button>
           <button class="kv-btn kv-btn-primary"><i class="fa fa-check"></i> Confirm</button>
         </div>
       </div>
     </div>

   AngularJS: use ng-class="{'active': vm.showConfirmModal}" and ng-click directives.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Backdrop overlay — hidden by default, shown via .active or ng-class */
.kv-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.kv-modal-overlay.active { display: flex; }

/* Modal container */
.kv-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
  width: 440px;
  max-width: 92vw;
  overflow: hidden;
  font-family: var(--f);
  display: flex;
  flex-direction: column;
  animation: kvModalIn .15s ease-out both;
}
@keyframes kvModalIn {
  from { transform: scale(.96) translateY(-6px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* Header — blue strip with white title and close button */
.kv-modal-head {
  background: var(--blue, #22BAFF);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-radius: 8px 8px 0 0;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  font-family: var(--f);
  gap: 10px;
  flex-shrink: 0;
}

/* Close button inside header */
.kv-modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color .12s ease;
}
.kv-modal-close:hover { color: #fff; }

/* Body — message area */
.kv-modal-body {
  padding: 20px 24px;
  background: #fff;
  flex: 1;
}

/* Standard message paragraph */
.kv-modal-msg {
  font-family: var(--f);
  font-size: 9px;
  font-weight: 400;
  color: var(--t2, #1F2937);
  line-height: 1.6;
  margin: 0;
}

/* Footer — right-aligned Cancel + Confirm buttons */
.kv-modal-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border2, #ECEEF2);
  background: var(--page, #F3F5F8);
  border-radius: 0 0 8px 8px;
  flex-shrink: 0;
}

/* ─── Filter modal variant ─────────────────────────────────────────────────
   Opens from the "Filter" button in .kvgl-page-header on list pages. Wider
   than the default .kv-modal (720px) to hold the 3-col .kv-filter-grid, and
   navy-headed (matching Make a Call / Send Invite popups) rather than blue.
   Body scrolls if the form is tall.

   Helpers in layout.html: toggleFilterModal(), closeFilterModal().
   Markup:
     <div id="filterPanel" class="kv-modal-overlay">
       <div class="kv-modal kv-filter-modal" onclick="event.stopPropagation();">
         <div class="kv-modal-head">
           <span><i class="fa fa-filter"></i> Filters</span>
           <button type="button" class="kv-modal-close" onclick="closeFilterModal()">&times;</button>
         </div>
         <form ng-submit="vm.pullRecords()" onsubmit="closeFilterModal()">
           <div class="kv-modal-body"><div class="kv-filter-grid"> ... </div></div>
           <div class="kv-modal-foot">
             <button type="button" class="kv-btn kv-btn-outline" ng-click="vm.clearFilter()"><i class="fa fa-times"></i> Clear</button>
             <span style="flex:1;"></span>
             <button type="button" class="kv-btn kv-btn-outline" onclick="closeFilterModal()">Cancel</button>
             <button type="submit" class="kv-btn kv-btn-primary"><i class="fa fa-search"></i> Apply</button>
           </div>
         </form>
       </div>
     </div>
   ─────────────────────────────────────────────────────────────────────── */
.kv-modal.kv-filter-modal {
  width: 720px;
  max-width: 92vw;
  max-height: 85vh;
}
.kv-modal.kv-filter-modal .kv-modal-head {
  background: var(--navy, #213142);
  cursor: move;
  user-select: none;
}
/* When the close button is hovered, restore default cursor so it doesn't
   look like a drag handle. */
.kv-modal.kv-filter-modal .kv-modal-close {
  cursor: pointer;
}
.kv-modal.kv-filter-modal > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.kv-modal.kv-filter-modal .kv-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.kv-modal.kv-filter-modal .kv-filter-grid {
  gap: 12px;
}
@media (max-width: 640px) {
  .kv-modal.kv-filter-modal .kv-filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 460px) {
  .kv-modal.kv-filter-modal .kv-filter-grid {
    grid-template-columns: 1fr;
  }
}
