/*
 * 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 .intakt-ws-* class hierarchy below. Once a token / class is
 * published, downstream consumers may depend on it — additive only.
 */

:root {
    /* Brand surface — dark navigation.
     *
     * Strip lives on top of whatever the vertical's own navbar is, so its
     * colour has to be visibly distinct from the navbar to avoid the two
     * surfaces fusing into one flat dark column. Most app navbars (InTakt's
     * sub-nav included) are around gray-800 (#1f2937); we sit one step darker
     * at gray-900 so the strip reads as a separate, slightly recessed layer.
     * The mockup specs gray-800 (lighter) over a gray-900 sub-nav, but since
     * we can't assume the sub-nav's tone, pick the safer darker side. */
    --intakt-surface-brand:           #111827;  /* gray-900 — recedes behind navbar */
    --intakt-surface-brand-elevated:  rgba(255, 255, 255, 0.07);
    --intakt-surface-brand-active:    rgba(255, 255, 255, 0.10);  /* was 0.05 — too subtle to read as "current" */
    --intakt-surface-tooltip:         #0b1220;  /* one step deeper than the strip for hover popups */

    /* Light surfaces. */
    --intakt-surface:        #ffffff;
    --intakt-surface-hover:  #f8fafc;  /* slate-50 */

    /* Text. */
    --intakt-text:             #1e293b;  /* slate-800 */
    --intakt-text-muted:       #94a3b8;  /* slate-400 */
    --intakt-text-on-dark:     #d1d5db;  /* gray-300 */
    --intakt-text-tooltip:     #ffffff;
    --intakt-text-tooltip-sub: #9ca3af;  /* gray-400 */

    /* Borders. */
    --intakt-border:        #e2e8f0;
    --intakt-border-muted:  #f1f5f9;
    --intakt-border-strip:  rgba(255, 255, 255, 0.05);

    /* Accent — sky. */
    --intakt-accent:         #0284c7;
    --intakt-accent-strong:  #0369a1;
    --intakt-accent-subtle:  #e0f2fe;

    /* Type — must match Accounting exactly so the two verticals read as one product.
     * 'Inter'/'IBM Plex Mono' are named first (loaded if present), then the system
     * fallback that actually renders on the Test box (Segoe UI on Windows). Without
     * these, app.css's `var(--intakt-font-sans)` resolved to nothing and the body fell
     * back to the browser default serif. */
    --intakt-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --intakt-font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ────────────────────────────────────────────────────────────────────────
 * Workspace strip — 64px vertical column on the left edge of the shell.
 * Mirrors team-brain/wiki/mockups/suite-shell-navigation.html structure.
 * ──────────────────────────────────────────────────────────────────────── */

.intakt-ws-strip {
    width: 64px;
    flex-shrink: 0;
    overflow: visible;              /* tooltips need to escape the right edge */
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--intakt-surface-brand);
    border-right: 1px solid var(--intakt-border-strip);
    color: var(--intakt-text-on-dark);
}

.intakt-ws-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    border-bottom: 1px solid var(--intakt-border-strip);
    color: inherit;
    text-decoration: none;
}
.intakt-ws-brand:hover { text-decoration: none; }
.intakt-ws-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: var(--intakt-accent);
    color: #fff;
    font-size: 0.875rem;
}

.intakt-ws-region {
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.intakt-ws-region-fill {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    /* Hide scrollbar visually but keep behavior. Per mockup. */
    scrollbar-width: none;
}
.intakt-ws-region-fill::-webkit-scrollbar { display: none; }
.intakt-ws-region-foot {
    border-top: 1px solid var(--intakt-border-strip);
}
.intakt-ws-region-customer {
    border-bottom: 1px solid var(--intakt-border-strip);
    padding: 12px 0;
}

/* Customer tile — display-only for regular admins; F.4b's super-admin
 * variant adds a purple ring + clickable cursor and opens the picker. */
.intakt-ws-customer-tile {
    /* Same .intakt-ws-tile geometry; the marker class is here so the picker
     * variant can target it without inheriting workspace-tile hover/active
     * behaviour we don't want for the Customer tile. */
}
.intakt-ws-customer-tile:hover {
    background: var(--intakt-surface-brand-elevated);
    cursor: default;
}

/* 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. */
.intakt-ws-customer-tile-superadmin {
    cursor: pointer;
}
.intakt-ws-customer-tile-superadmin .intakt-ws-icon {
    box-shadow: 0 0 0 2px #111827, 0 0 0 4px #a78bfa;  /* gray-800 gap, violet-400 ring */
}
.intakt-ws-customer-tile-superadmin.is-impersonating .intakt-ws-icon {
    box-shadow: 0 0 0 2px #111827, 0 0 0 4px #c026d3, 0 0 12px rgba(192, 38, 211, 0.35);  /* fuchsia-600, glow */
}
.intakt-ws-customer-tile-superadmin:hover .intakt-ws-icon {
    box-shadow: 0 0 0 2px #111827, 0 0 0 4px #d946ef;  /* fuchsia-500 — brighter on hover */
}

/* ─── 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). */
.intakt-ws-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0.75rem;
    background: transparent;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 150ms ease-out, transform 100ms ease-out;
}
.intakt-ws-tile:hover  { background: var(--intakt-surface-brand-elevated); text-decoration: none; }
.intakt-ws-tile:active { transform: scale(0.97); }
.intakt-ws-tile.is-active { background: var(--intakt-surface-brand-active); }

/* 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. */
.intakt-ws-tile.is-active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 6px;
    bottom: 6px;
    width: 4px;
    border-radius: 0 2px 2px 0;
    background: var(--intakt-ws-accent, var(--intakt-accent));
    box-shadow: 0 0 12px var(--intakt-ws-accent, var(--intakt-accent));
}
/* Active tile gets a faint coloured outline matching the accent so the
 * current workspace also reads without depending solely on the side bar. */
.intakt-ws-tile.is-active .intakt-ws-icon {
    box-shadow: 0 0 0 2px var(--intakt-surface-brand),
                0 0 0 3px var(--intakt-ws-accent, var(--intakt-accent));
}

/* Icon — 36×36, sits inside the tile. Background is per-tile (gradient or
 * solid) via inline style on the element. */
.intakt-ws-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}
.intakt-ws-icon-circle { border-radius: 9999px; font-size: 0.8125rem; }
.intakt-ws-icon-gray   { background: #374151; }   /* gray-700 — Settings tile face */
.intakt-ws-tile-profile .intakt-ws-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
/* 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 .intakt-ws-icon-gray / -circle overrides. */
.intakt-ws-icon i { font-size: 1.1rem; line-height: 1; }
.intakt-ws-icon-gray i,
.intakt-ws-icon-circle i { font-size: 0.95rem; }

/* ─── 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. */
.intakt-ws-tooltip {
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: var(--intakt-surface-tooltip);
    color: var(--intakt-text-tooltip);
    padding: 7px 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease-out, transform 120ms ease-out;
    z-index: 100;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.04);
    min-width: 140px;
    text-align: left;
    display: flex;
    flex-direction: column;
}
.intakt-ws-tile:hover .intakt-ws-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.intakt-ws-tooltip::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--intakt-surface-tooltip);
    border-radius: 1px;
}
.intakt-ws-tooltip-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--intakt-text-tooltip);
}
.intakt-ws-tooltip-sub {
    font-size: 0.6875rem;
    color: var(--intakt-text-tooltip-sub);
    margin-top: 1px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ────────────────────────────────────────────────────────────────────────
 * Settings drawer — slides in from the left over both the strip and the
 * consumer content. Backdrop fades in. Theme-aware via the .dark class on
 * <html> (consumers wanting dark mode set `darkMode: 'class'` in Tailwind).
 * ──────────────────────────────────────────────────────────────────────── */

.intakt-settings-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    background: var(--intakt-surface);
    color: var(--intakt-text);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    border-right: 1px solid var(--intakt-border);
    z-index: 60;
    display: flex;
    flex-direction: column;
    transform: translateX(-110%);
    transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
}
.intakt-settings-drawer.is-open { transform: translateX(0); }
:root.dark .intakt-settings-drawer { background: #1f2937; color: #e5e7eb; border-right-color: #374151; }

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

.intakt-settings-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 16px 20px;
}

.intakt-settings-section + .intakt-settings-section { margin-top: 12px; }
.intakt-settings-section-label {
    padding: 8px 8px 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--intakt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.intakt-settings-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 8px 8px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
}
/* Items without a -main wrapper (bare icon + label, e.g. Account & profile,
 * Manage users, Sign out) cluster on the left thanks to flex-start above.
 * Items WITH a -main wrapper rely on the flex-grow on .intakt-settings-item-main
 * (below) plus margin-left: auto on the trailing meta span to push it to the
 * right edge. */
.intakt-settings-item:hover { background: var(--intakt-surface-hover); }
:root.dark .intakt-settings-item:hover { background: #374151; }

.intakt-settings-item > i,
.intakt-settings-item-main > i {
    width: 1rem;
    text-align: center;
    color: var(--intakt-text-muted);
    flex-shrink: 0;
}

.intakt-settings-item-main {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}
.intakt-settings-item-title { display: block; }
.intakt-settings-item-sub {
    display: block;
    font-size: 0.6875rem;
    color: var(--intakt-text-muted);
    margin-top: 2px;
}
.intakt-settings-item-meta {
    font-size: 0.75rem;
    color: var(--intakt-text-muted);
    flex-shrink: 0;
    margin-left: auto;
}

.intakt-settings-item-danger { color: #dc2626; }
.intakt-settings-item-danger > i { color: #dc2626; }
.intakt-settings-item-danger:hover { background: #fef2f2; }
:root.dark .intakt-settings-item-danger { color: #f87171; }
:root.dark .intakt-settings-item-danger > i { color: #f87171; }
:root.dark .intakt-settings-item-danger:hover { background: rgba(220, 38, 38, 0.15); }

/* Static settings rows (non-button containers — e.g. the text-size segmented
 * control). Same padding + hit area as a real item but no hover affordance. */
.intakt-settings-item-static { cursor: default; }
.intakt-settings-item-static:hover { background: transparent; }
:root.dark .intakt-settings-item-static:hover { background: transparent; }

/* Text-size segmented control. Three discrete options (sm/md/lg) shown as
 * A-A-A in increasing size; aria-pressed marks the active one. Cookie
 * persistence lives in _SuiteLayout.cshtml. */
.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); }
.intakt-fs-opt[aria-pressed="true"] {
    background: var(--intakt-accent);
    color: #ffffff;
}
.intakt-fs-opt[aria-pressed="true"]:hover { background: var(--intakt-accent-strong); color: #ffffff; }

/* Root font-size scale. The picker writes one of three values to the
 * intakt_font_size cookie; the bootstrap script in _SuiteLayout.cshtml
 * 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 strip 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 */

/* Backdrop. */
.intakt-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    z-index: 55;
    opacity: 0;
    transition: opacity 220ms ease-out;
}
.intakt-drawer-backdrop.is-open { opacity: 1; }

/* Form wrapper inside the settings drawer — used for the Sign out form so
 * the submit button still looks like a flat menu row. */
.intakt-settings-form { margin: 0; }
.intakt-settings-form .intakt-settings-item {
    width: 100%;
    font-family: inherit;
    font-size: 0.875rem;
}

/* ────────────────────────────────────────────────────────────────────────
 * 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: 76px;                /* 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;
}

