/*
 * InTakt Suite design tokens + workspace strip styles.
 *
 * Loaded by consumers via:
 *   <link rel="stylesheet" href="/_content/InTakt.UI/css/intakt-tokens.css" />
 *
 * Provides:
 *   • CSS custom properties for the suite-wide brand palette
 *   • Workspace strip + tile + tooltip styles (mockup-aligned, see
 *     team-brain/wiki/mockups/suite-shell-navigation.html)
 *
 * The markup in _SuiteLayout.cshtml uses both Tailwind utilities (consumers
 * are expected to ship Tailwind — Admin, NabavaHub, and InTakt all do) and
 * the scoped /* ────────────────────────────────────────────────────────────────────────
 * Workspace strip — 64px vertical column on the left edge of the shell.
 * Mirrors team-brain/wiki/mockups/suite-shell-navigation.html structure.
 * ──────────────────────────────────────────────────────────────────────── */

/* Customer tile — display-only for regular admins; F.4b's super-admin
 * variant adds a purple ring + clickable cursor and opens the picker. */
/* Super-admin variant — purple ring around the icon, cursor stays a pointer
 * because the tile is now an interactive trigger. The ring also visually
 * separates "this is a customer scope you've picked" from "this is the
 * customer I belong to" for regular admins. When actively impersonating, the
 * ring glows brighter; when no customer is picked yet, it's a softer purple. */
/* ─── Tile ───
 * 44×44 centered square. Hover lifts; active gets a 3px accent bar at the
 * strip's left edge (positioned outside the tile via negative offset). */
/* Active accent bar — 4px column hugging the strip's left edge to the LEFT of
 * the active tile. Slightly bolder than mockup's 3px so it still reads as
 * "current workspace" against the darker gray-900 strip. */
/* Active tile gets a faint coloured outline matching the accent so the
 * current workspace also reads without depending solely on the side bar. */
/* Icon — 36×36, sits inside the tile. Background is per-tile (gradient or
 * solid) via inline style on the element. */
/* gray-700 — Settings tile face */
/* Workspace icons (app glyph) sit inside the 36px gradient face; size matches
 * the mockup's 20px SVGs. Settings cog and profile initials inherit the
 * smaller text-style sizing via /* ─── Hover tooltip ───
 * Floats out to the right of the tile, Slack-style. Two-line content (title +
 * sub) appears on workspaces and the profile tile; brand mark omits the
 * tooltip entirely. */
/* ────────────────────────────────────────────────────────────────────────
 * SC4 (settings consolidation): the left settings drawer was retired, and its
 * drawer / section / item / backdrop / form rules were removed with it — the
 * me-popover (styled in intakt-navbar.css as .intakt-me-*) replaces it. The
 * segmented-control rules below are RETAINED: the popover's theme + text-size
 * controls reuse .intakt-fs-segmented / .intakt-fs-opt.
 * ──────────────────────────────────────────────────────────────────────── */

/* Segmented control (theme + text-size). Text-size uses the -sm/-md/-lg size
 * modifiers for the A-A-A affordance; aria-pressed marks the active option.
 * Written through wwwroot/js/suite-prefs.js (the one preference writer). */
.intakt-fs-segmented {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    border: 1px solid var(--intakt-border);
    border-radius: 0.375rem;
    overflow: hidden;
    flex-shrink: 0;
}
:root.dark .intakt-fs-segmented { border-color: #4b5563; }

.intakt-fs-opt {
    appearance: none;
    background: transparent;
    color: var(--intakt-text-muted);
    border: 0;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.12s ease, color 0.12s ease;
}
.intakt-fs-opt + .intakt-fs-opt { border-left: 1px solid var(--intakt-border); }
:root.dark .intakt-fs-opt + .intakt-fs-opt { border-left-color: #4b5563; }
.intakt-fs-opt-sm { font-size: 0.75rem; }
.intakt-fs-opt-md { font-size: 0.875rem; }
.intakt-fs-opt-lg { font-size: 1rem; }
.intakt-fs-opt:hover { background: var(--intakt-surface-hover); color: var(--intakt-text); }
:root.dark .intakt-fs-opt:hover { background: #374151; color: var(--intakt-text-on-dark); }
/* Fallback colors are load-bearing: --intakt-accent only exists inside
   .intakt-shell[data-family=...] — in contexts without a family (the me-popover
   on chrome pages) the var is unresolved, the background computes to nothing,
   and the selected chip renders white-on-white in the light theme. */
.intakt-fs-opt[aria-pressed="true"] {
    background: var(--intakt-accent, #2563eb);
    color: #ffffff;
}
.intakt-fs-opt[aria-pressed="true"]:hover { background: var(--intakt-accent-strong, #1d4ed8); color: #ffffff; }

/* Root font-size scale. suite-prefs.js writes one of three values to the
 * intakt_font_size cookie; the anti-flash preflight in the layouts mirrors that
 * onto <html> as intakt-fs-{sm|lg} (md is the default and carries no class).
 * Scaling html font-size rescales every rem-based size in the chrome and in any
 * consumer content that uses rem. */
html.intakt-fs-sm { font-size: 87.5%; }   /* ~14px when default is 16px */
html.intakt-fs-lg { font-size: 112.5%; }  /* ~18px */

/* ────────────────────────────────────────────────────────────────────────
 * Super-admin Customer picker (F.4b) — anchored to the right of the
 * workspace strip, similar to a Slack-style flyout. Sits above the content
 * area but below the Settings drawer (which uses z-index: 60).
 * ──────────────────────────────────────────────────────────────────────── */

.intakt-customer-picker {
    position: fixed;
    top: 12px;
    left: 68px;                /* 64px strip + 12px gap */
    width: 320px;
    max-height: calc(100vh - 24px);
    background: var(--intakt-surface);
    color: var(--intakt-text);
    border: 1px solid var(--intakt-border);
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04);
    z-index: 58;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 160ms ease-out, transform 160ms ease-out;
    pointer-events: none;
}
.intakt-customer-picker.is-open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
:root.dark .intakt-customer-picker {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #374151;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.intakt-customer-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--intakt-border);
}
:root.dark .intakt-customer-picker-head { border-bottom-color: #374151; }
.intakt-customer-picker-head h2 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--intakt-text);
}
:root.dark .intakt-customer-picker-head h2 { color: #f9fafb; }
.intakt-customer-picker-close {
    background: transparent;
    border: 0;
    color: var(--intakt-text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    line-height: 1;
}
.intakt-customer-picker-close:hover {
    background: var(--intakt-surface-hover);
    color: var(--intakt-text);
}
:root.dark .intakt-customer-picker-close:hover { background: #374151; color: #f9fafb; }

.intakt-customer-picker-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 8px;
}
.intakt-customer-picker-loading,
.intakt-customer-picker-empty,
.intakt-customer-picker-error {
    padding: 16px 12px;
    font-size: 0.8125rem;
    color: var(--intakt-text-muted);
    text-align: center;
}
.intakt-customer-picker-error { color: #b91c1c; }
:root.dark .intakt-customer-picker-error { color: #fca5a5; }

.intakt-customer-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
}
.intakt-customer-picker-item + .intakt-customer-picker-item { margin-top: 2px; }
.intakt-customer-picker-item:hover { background: var(--intakt-surface-hover); }
:root.dark .intakt-customer-picker-item:hover { background: #374151; }
.intakt-customer-picker-item.is-current {
    background: var(--intakt-accent-subtle);
    color: var(--intakt-accent-strong);
    font-weight: 600;
}
:root.dark .intakt-customer-picker-item.is-current {
    background: rgba(2, 132, 199, 0.15);
    color: #7dd3fc;
}
.intakt-customer-picker-item-name { flex: 1 1 auto; min-width: 0; }
.intakt-customer-picker-item-sub {
    font-size: 0.6875rem;
    color: var(--intakt-text-muted);
    margin-left: auto;
}
.intakt-customer-picker-item.is-current .intakt-customer-picker-item-sub { color: inherit; }
.intakt-customer-picker-item-meta {
    flex-shrink: 0;
    color: var(--intakt-accent-strong);
}

.intakt-customer-picker-foot {
    border-top: 1px solid var(--intakt-border);
    padding: 8px 8px;
}
:root.dark .intakt-customer-picker-foot { border-top-color: #374151; }
.intakt-customer-picker-end {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: #b91c1c;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8125rem;
}
.intakt-customer-picker-end:hover { background: #fef2f2; }
:root.dark .intakt-customer-picker-end { color: #fca5a5; }
:root.dark .intakt-customer-picker-end:hover { background: rgba(220, 38, 38, 0.15); }

/* ────────────────────────────────────────────────────────────────────────
 * Select chevron clearance — systematic fix (BugReporter #413/#411/#410).
 *
 * The bundled @tailwindcss/forms plugin gives every bare <select> an
 * `appearance: none` background chevron anchored at the right edge and
 * reserves space for it with `padding-right: 2.5rem`. Most of our views,
 * however, set their own `px-2`/`px-3` utility on the <select>, which
 * overrides that right padding — so long option text (and even short values
 * like a year, e.g. "2026") renders underneath the chevron.
 *
 * Re-assert the right padding here. `select:not([multiple]):not([size])`
 * has specificity (0,1,1), which outranks a single `.px-*` utility (0,1,0),
 * so this wins without needing `!important`. Single-line selects only —
 * native multi-selects and size>1 list boxes have no chevron, so we leave
 * their padding alone. Applies suite-wide (Common + WMS load this file). */
select:not([multiple]):not([size]) {
    padding-right: 2.5rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   App-shell page-height fix (suite-wide).

   ~400 page views wrap their content in Tailwind's `.min-h-screen`
   (min-height: 100vh) so a short page still paints a full-height background.
   But every page renders inside a scrolling <main> whose own height is already
   the viewport MINUS the top chrome (search/company bar, ~56-66px). So 100vh
   overshoots the scroll viewport by the header height — producing, on EVERY
   page, a spurious vertical scrollbar; and on short pages / large monitors, a
   tall empty whitespace band below the content (it grows with screen height).
   With real OS scrollbars (not headless overlay ones) that vertical scrollbar
   can also knock a ~17px horizontal scrollbar into view.

   The <body> already carries the page background (bg-slate-50 / dark:bg-gray-900,
   which is exactly what these wrappers use), so the 100vh floor is unnecessary
   inside the shell. Scope the override to <main> so pages size to the scroll
   viewport instead — login / standalone centered pages (which have no <main>)
   keep their min-h-screen centering. Specificity (0,1,1) beats the (0,1,0)
   utility, so no !important. Loaded by Common, WMS and JavnaNabava layouts. */
main .min-h-screen {
    min-height: 100%;
}


/* ============================================================
   Domain-family accent tokens (chrome-scale plan CH-D3 / CH1b).
   Hue = family, glyph + label = identity: every vertical inherits its
   family's pair via [data-family] in intakt-navbar.css — a new vertical
   needs ZERO css edits, its module descriptor names the family.
   Sky is reserved for platform chrome; no vertical may claim it.
   ============================================================ */
:root {
  --intakt-fam-platform:              #3DB7FF;  /* sky — Common + chrome itself */
  --intakt-fam-platform-tone:         #0B2A45;
  --intakt-fam-operations:            #F59E4A;  /* amber — WMS anchors */
  --intakt-fam-operations-tone:       #3A220A;
  --intakt-fam-finance:               #34D399;  /* emerald — POS/accounting */
  --intakt-fam-finance-tone:          #0B3326;
  --intakt-fam-relationship:          #A78BFA;  /* violet — CRM/marketing */
  --intakt-fam-relationship-tone:     #241B45;
  --intakt-fam-compliancepublic:      #2DD4A4;  /* teal — JN anchors */
  --intakt-fam-compliancepublic-tone: #0B3329;
  --intakt-fam-people:                #FB7185;  /* rose — HR */
  --intakt-fam-people-tone:           #451420;

  /* Chrome stacking scale (2026-07-19 critique fix). ONE ordering for every
     chrome layer; docs/z-index-hierarchy.md's 100000-class values are the
     legacy content-area scale and do not apply to chrome. Order:
     header < sticky-footer(50, web-ui.md §3) < drawer < modal < toast. */
  --intakt-z-header: 20;
  --intakt-z-drawer: 10000;
  --intakt-z-modal:  12000;
  --intakt-z-toast:  50000;
}

/* Family tint plumbing for non-shell surfaces (apps catalog, future
   family-tinted chips): the element carries data-family and .intakt-fam-chip;
   hue rides the SAME token as the shell — no second hex ladder anywhere.
   (The .intakt-shell/[data-family] accent rules in intakt-navbar.css serve the
   chrome accent; this generic mapping serves tinted chips on any element.) */
[data-family="platform"]         { --intakt-fam: var(--intakt-fam-platform); }
[data-family="operations"]       { --intakt-fam: var(--intakt-fam-operations); }
[data-family="finance"]          { --intakt-fam: var(--intakt-fam-finance); }
[data-family="relationship"]     { --intakt-fam: var(--intakt-fam-relationship); }
[data-family="compliancepublic"] { --intakt-fam: var(--intakt-fam-compliancepublic); }
[data-family="people"]           { --intakt-fam: var(--intakt-fam-people); }

.intakt-fam-chip {
  background: color-mix(in srgb, var(--intakt-fam, var(--intakt-fam-platform)) 15%, transparent);
  color: color-mix(in srgb, var(--intakt-fam, var(--intakt-fam-platform)) 55%, #1e293b);
}
.dark .intakt-fam-chip {
  color: color-mix(in srgb, var(--intakt-fam, var(--intakt-fam-platform)) 70%, #f8fafc);
}

/* #2910 turned on cross-document view transitions here (navigation: auto). Removed
 * 6. 11. 2026.: in Chrome the first click after such a navigation was swallowed - a record, then a
 * list, then a row link took two clicks on mandrak, and it went away with the transition turned off
 * (prefers-reduced-motion). The 120 ms fade is not worth a dead click. Do not bring it back. */

/* ============================================================
   Motion (PLAN_MOTION M1, MO1-MO12). The ONE definition of every
   duration and curve; components read these and never a literal.
   ============================================================ */
:root {
  --intakt-motion-fast: 120ms;   /* colour, opacity, hover, tooltips, exits */
  --intakt-motion-base: 200ms;   /* opening and closing: menus, dialogs, drawers, accordions, toasts */
  --intakt-motion-slow: 320ms;   /* the longest anything may take (section panel width) */
  --intakt-ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* entering; the curve the code already uses */
  --intakt-ease-in:  cubic-bezier(0.4, 0, 1, 1);     /* leaving */
  --intakt-ease: var(--intakt-ease-out);             /* existing name, kept as an alias */
}

/* The ONE reduced-motion rule (M1, DS Surfaces SF8). No component repeats it; a local
   block exists only where it does more than drop the travel (e.g. a static fallback). */
@media (prefers-reduced-motion: reduce) {
  :root { --intakt-motion-fast: 1ms; --intakt-motion-base: 1ms; --intakt-motion-slow: 1ms; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important;
                           animation-delay: 0s !important;
                           transition-duration: 1ms !important; transition-delay: 0s !important;
                           scroll-behavior: auto !important; }
}
