/* Inter + Plus Jakarta Sans are loaded via <link> in App.razor <head> (preconnected). */

/* ════════════════════════════════════════════════════════════════════════
   BEEVYL DESIGN LANGUAGE
   ────────────────────────────────────────────────────────────────────────
   Philosophy — a boutique enterprise system, not a colour swap:
   • Deep forest green is the ONE confident brand colour (primary actions,
     links, monogram avatars). Lime is a rare *jewel* accent — the logo, an
     active indicator, a live dot — never a large fill.
   • Neutrals are a warm greige with a faint green undertone, so every
     surface belongs to one family.
   • Semantics are muted & earthy (ochre / brick / slate-blue), never stock
     primaries — this is what reads "designed".
   • Depth is quiet: hairline borders, soft warm shadows, generous space.
   • Type: Plus Jakarta Sans for display/headings (echoes the geometric
     wordmark), Inter for UI, body and data.
   ════════════════════════════════════════════════════════════════════════ */
:root {
    /* ── Neutral gray ramp (true gray — the chrome carries no hue; green lives only in the brand) ── */
    --slate-50: #FAFAFA;  --slate-100: #F4F4F5; --slate-200: #E9E9EB;
    --slate-300: #DCDCDE; --slate-400: #B4B4B7; --slate-500: #8A8A8E;
    --slate-600: #5E5E63; --slate-700: #434347; --slate-800: #29292C;
    --slate-900: #191919;

    /* ── Brand: forest (primary) + lime (jewel accent) ── */
    --forest:       #1C4A2E;   /* primary — buttons, links, avatars (white text ~8.5:1) */
    --forest-hover: #163B25;
    --forest-deep:  #10301D;
    --forest-tint:  #E8EEE7;   /* soft green-grey — selected / active backgrounds */
    --pine:         #2E7D46;   /* mid green — success, secondary accents */
    --lime:         #A6CE3A;   /* jewel accent — logo, active bar, live dot */
    --lime-bright:  #BADB57;
    --lime-soft:    #EEF5D8;
    --grad-brand:   linear-gradient(158deg, #1C4A2E 0%, #3E8E3F 55%, #A6CE3A 100%);
    --glow-forest:  0 1px 2px rgba(16, 48, 29, 0.18), 0 4px 14px rgba(16, 48, 29, 0.14);
    --ring: 0 0 0 3px rgba(28, 74, 46, 0.16);

    /* ── Semantic — muted & earthy (text/icon + tint bg) ── */
    --success: #2E7D46; --success-bg: #E9F1E9;
    --warning: #A9741A; --warning-bg: #F6EEDA;
    --error:   #A8443A; --error-bg:   #F6E8E5;
    --info:    #3C6485; --info-bg:    #E9EEF4;

    /* ── Surfaces (neutral light gray) ── */
    --bg: #F4F4F5;
    --surface: #FFFFFF;
    --surface-sunken: #EFEFF1;
    --border: #E8E8EA;
    --border-strong: #D8D8DB;
    --text: #1A1A1C;
    --text-muted: #59595E;
    --text-subtle: #8A8A8E;

    /* ── Type ── */
    --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

    /* ── Radius ── */
    --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px;
    --radius-xl: 12px; --radius-2xl: 16px; --radius-pill: 9999px;

    /* ── Elevation (warm) ── */
    --shadow-xs: 0 1px 2px rgba(17, 17, 19, 0.05);
    --shadow-sm: 0 1px 2px rgba(17, 17, 19, 0.04), 0 2px 6px rgba(17, 17, 19, 0.05);
    --shadow-md: 0 2px 4px rgba(17, 17, 19, 0.04), 0 10px 24px rgba(17, 17, 19, 0.08);
    --shadow-lg: 0 16px 44px rgba(17, 17, 19, 0.14);
    --shadow-overlay: 0 24px 60px rgba(17, 17, 19, 0.28);

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

::selection { background: rgba(166, 206, 58, 0.35); color: var(--forest-deep); }

/* Display face for the brand's larger headings */
.logo-text, .auth-brand-text, .auth-title, .page-title, .workspace-title,
.empty-title, .empty-state-title, .panel-header-title, .settings-title {
    font-family: var(--font-display);
}

/* ════════════════════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════════════════════ */
.app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Sidebar shell (light, crisp) ── */
.sidebar {
    width: 264px;
    min-width: 264px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border);
    transition: width 0.22s var(--ease), min-width 0.22s var(--ease), transform 0.25s var(--ease);
}

.sidebar-backdrop { display: none; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 18px 18px;
    flex-shrink: 0;
}

.beevyl-logo { display: block; flex-shrink: 0; }

.logo-text {
    font-weight: 700; font-size: 17px; color: var(--text);
    white-space: nowrap; letter-spacing: -0.3px;
}

/* ── Sidebar scroll container ── */
.sidebar-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--slate-300) transparent;
}
.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 2px; }

/* ════════════════════════════════════════════════════════════
   WORKSPACE SWITCHER  (global, so NavLink anchors are styled too)
   ════════════════════════════════════════════════════════════ */
.ws-section {
    padding: 4px 12px 14px;
    position: relative;
    flex-shrink: 0;
}

.ws-btn {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 9px 11px;
    cursor: pointer;
    color: var(--text);
    transition: all 0.15s var(--ease);
    text-align: left;
}
.ws-btn:hover { background: var(--slate-50); border-color: var(--slate-400); }
.ws-btn--open { background: var(--slate-50); border-color: var(--forest); box-shadow: var(--ring); }

.ws-avatar {
    width: 34px; height: 34px;
    border-radius: var(--radius-md);
    background: var(--forest-tint);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: var(--forest);
    flex-shrink: 0; transition: all 0.15s var(--ease);
}
.ws-avatar--active {
    background: var(--forest);
    color: #F4F4EE; box-shadow: var(--glow-forest);
}

.ws-info { flex: 1; min-width: 0; }
.ws-label {
    display: block; font-size: 9.5px; font-weight: 700;
    color: var(--text-subtle); text-transform: uppercase;
    letter-spacing: 0.7px; line-height: 1; margin-bottom: 3px;
}
.ws-name {
    display: block; font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.ws-chevron { color: var(--text-subtle); flex-shrink: 0; transition: transform 0.2s var(--ease); }
.ws-chevron--open { transform: rotate(180deg); }

/* ── Dropdown ── */
.ws-overlay { position: fixed; inset: 0; z-index: 205; }
.ws-dropdown {
    position: absolute;
    top: calc(100% + 6px); left: 12px; right: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    z-index: 210;
    box-shadow: var(--shadow-overlay);
    overflow: hidden;
    max-height: min(60vh, 420px);
    display: flex; flex-direction: column;
    animation: dropdownIn 0.15s var(--ease);
}
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.ws-dropdown-header {
    padding: 12px 14px 8px; font-size: 10px; font-weight: 700;
    color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.7px;
    flex-shrink: 0;
}
.ws-loading, .ws-empty {
    display: flex; align-items: center; gap: 8px;
    padding: 16px 14px; font-size: 13px; color: var(--text-muted);
}
.ws-list { overflow-y: auto; padding: 0 6px 6px; scrollbar-width: thin; scrollbar-color: var(--slate-300) transparent; }

.ws-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; text-decoration: none; border-radius: var(--radius-md);
    color: var(--text-muted); font-size: 13px; cursor: pointer;
    transition: background 0.1s var(--ease);
}
.ws-item:hover { background: var(--slate-100); color: var(--text); text-decoration: none; }
.ws-item--current { background: var(--forest-tint); }
.ws-item-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--slate-400); }
.ws-dot--active  { background: var(--lime); box-shadow: 0 0 0 3px rgba(166, 206, 58, 0.22); }
.ws-dot--onhold  { background: var(--warning); }
.ws-dot--closing { background: var(--info); }
.ws-dot--closed  { background: var(--slate-400); }
.ws-dot--pendingapproval { background: var(--warning); }
.ws-item-body { flex: 1; min-width: 0; }
.ws-item-name {
    display: block; font-weight: 500; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; line-height: 1.3;
}
.ws-item--current .ws-item-name { color: var(--forest); font-weight: 600; }
.ws-item-companies {
    display: block; font-size: 11px; color: var(--text-subtle);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px;
}
.ws-item-check { color: var(--forest); flex-shrink: 0; }

.ws-footer {
    border-top: 1px solid var(--border); padding: 8px;
    display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.ws-footer-link {
    display: flex; align-items: center; padding: 7px 8px; text-decoration: none;
    color: var(--text-muted); font-size: 12px; font-weight: 500;
    border-radius: var(--radius-sm); transition: all 0.1s var(--ease);
}
.ws-footer-link:hover { color: var(--text); background: var(--slate-100); text-decoration: none; }
.ws-new-btn {
    display: flex; align-items: center; justify-content: center; width: 100%;
    padding: 9px 12px; background: var(--forest); color: #fff; border: none;
    border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s var(--ease); letter-spacing: -0.1px;
    box-shadow: var(--shadow-xs);
}
.ws-new-btn:hover { background: var(--forest-hover); transform: translateY(-1px); box-shadow: var(--glow-forest); }
.ws-new-btn:active { transform: translateY(0); }

/* ════════════════════════════════════════════════════════════
   SIDEBAR NAV ITEMS  (global selectors reach NavLink <a> + <button>)
   ════════════════════════════════════════════════════════════ */
.nav-group { padding: 10px 12px 4px; flex-shrink: 0; }
.nav-group-label {
    display: block; font-size: 10px; font-weight: 700;
    color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.8px;
    padding: 0 10px; margin-bottom: 6px;
}
.nav-divider { height: 1px; background: var(--border); margin: 6px 18px; }

.sidebar .nav-item {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: var(--radius-md);
    color: var(--text-muted); font-size: 13.5px; font-weight: 500;
    text-decoration: none; cursor: pointer; width: 100%; text-align: left;
    background: none; border: none; margin-bottom: 1px;
    line-height: 1.4;
    transition: all 0.1s var(--ease);
}
.sidebar .nav-item:hover { background: var(--slate-100); color: var(--text); text-decoration: none; }
.sidebar .nav-item.nav-item--active {
    background: var(--forest-tint);
    color: var(--forest);
    font-weight: 600;
}
/* Lime jewel indicator on the active item */
.sidebar .nav-item.nav-item--active::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--lime);
}
.sidebar .nav-item--sm { font-size: 12.5px; }

.nav-item-icon {
    width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; color: var(--text-subtle); transition: color 0.1s var(--ease);
}
.sidebar .nav-item:hover .nav-item-icon { color: var(--text-muted); }
.sidebar .nav-item.nav-item--active .nav-item-icon { color: var(--forest); }
.nav-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-bottom { margin-top: auto; padding: 8px 12px 14px; border-top: 1px solid var(--border); }

/* ── Focus-visible rings (a11y) ── */
.sidebar .nav-item:focus-visible,
.ws-btn:focus-visible,
.ws-item:focus-visible,
.ws-footer-link:focus-visible,
.ws-new-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--forest);
    border-radius: var(--radius-md);
}

/* ════════════════════════════════════════════════════════════
   TOP BAR
   ════════════════════════════════════════════════════════════ */
.topbar {
    height: 56px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 20px 0 16px; gap: 12px;
    flex-shrink: 0; z-index: 50;
}
.topbar-toggle {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: var(--radius-sm);
    color: var(--text-subtle); cursor: pointer; flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.topbar-toggle:hover { background: var(--slate-100); color: var(--slate-700); }
.topbar-toggle:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

.topbar-breadcrumb {
    flex: 1; display: flex; align-items: center; gap: 7px;
    font-size: 13.5px; min-width: 0; overflow: hidden;
}
.bc-link { color: var(--text-subtle); text-decoration: none; font-weight: 500; white-space: nowrap; flex-shrink: 0; transition: color 0.1s; }
.bc-link:hover { color: var(--text-muted); }
.bc-sep { color: var(--slate-300); font-size: 12px; flex-shrink: 0; }
.bc-current { color: var(--slate-800); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 2ch; }
.bc-panel { color: var(--forest); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 2ch; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.user-chip {
    display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 5px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
    cursor: pointer; transition: all 0.12s var(--ease); font-size: 13px; font-weight: 500; color: var(--text);
}
.user-chip:hover { background: var(--slate-50); border-color: var(--slate-400); }
.user-chip:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.user-chip-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--forest);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #F4F4EE; flex-shrink: 0;
}
.user-chip-name { max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Account menu (MudMenu popover — PopoverClass="user-menu") ──
   MudBlazor's stock list is Roboto/24px-icon/tall; these rules pull it back
   into the app's language: Inter, 18px hairline icons, nav-item row geometry. */
.user-menu.mud-popover {
    min-width: 244px; max-width: 292px;
    margin-top: 6px;                       /* same detach as the sidebar's ws-dropdown */
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-overlay);
    overflow: hidden;
}
/* MudBlazor sets overflow-y:auto on .mud-list, which forces overflow-x:auto too —
   so nothing here may exceed the list box or it earns a horizontal scrollbar.
   The 6px gutter therefore lives on the rows, not as list padding, letting the
   header reach the panel edges without negative margins. */
.user-menu .mud-menu-list { padding: 0 0 6px; }

/* Identity header — full-bleed, carries the address the chip has to truncate */
.user-menu-head {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 12px; margin: 0 0 6px;
    background: var(--slate-50); border-bottom: 1px solid var(--border);
}
.user-menu-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--forest); color: #F4F4EE;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.user-menu-id { min-width: 0; display: flex; flex-direction: column; }
.user-menu-label {
    font-size: 9.5px; font-weight: 700; color: var(--text-subtle);
    text-transform: uppercase; letter-spacing: 0.7px; line-height: 1; margin-bottom: 3px;
}
.user-menu-email {
    font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Rows — same geometry as the sidebar .nav-item so the two chrome menus rhyme */
.user-menu .mud-menu-item,
.user-menu .mud-menu-item.mud-menu-item-dense {
    width: auto; margin-inline: 6px;       /* width:auto — MudBlazor's 100% + margin would overflow */
    gap: 10px; padding: 8px 10px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans); font-size: 13.5px; font-weight: 500;
    color: var(--text-muted); line-height: 1.4;
    transition: background 0.1s var(--ease), color 0.1s var(--ease);
}
/* text-decoration:none beats the global a:hover underline — Href rows are <a> */
.user-menu .mud-menu-item:hover { background: var(--slate-100); color: var(--text); text-decoration: none; }
.user-menu .mud-menu-item:focus-visible { outline: none; background: var(--slate-100); box-shadow: inset 0 0 0 2px var(--forest); }
.user-menu .mud-menu-item .mud-menu-item-icon {
    width: 18px; height: 18px; align-items: center; justify-content: center;
    margin-inline-end: 0; color: var(--text-subtle); transition: color 0.1s var(--ease);
}
.user-menu .mud-menu-item:hover .mud-menu-item-icon { color: var(--text-muted); }
.user-menu .mud-menu-item .mud-icon-root { width: 18px; height: 18px; font-size: 18px; color: inherit; }
/* MudBlazor indents icon-less rows by 36px to align them with icon rows — our
   sign-out row carries its icon inside the form button, so cancel the indent. */
.user-menu .mud-menu-item .mud-menu-item-text { margin: 0; margin-inline-start: 0 !important; }
/* width:auto for the same reason — MudDivider ships .mud-divider-fullwidth (width:100%) */
.user-menu .mud-menu-list > .mud-divider { width: auto; margin: 5px 14px; border-color: var(--border); }

/* Sign out — the terminal action, tinted only on hover */
.user-menu .user-menu-item--danger:hover { background: var(--error-bg); color: var(--error); }
.user-menu .logout-form { margin: 0; width: 100%; }
/* justify-content:flex-start is required — UA styles centre <button> flex content,
   which is what pushed "Sign out" out of line with the rows above it. */
.logout-form-btn {
    display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%;
    background: none; border: none; padding: 0;
    font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.user-menu-icon { width: 18px; height: 18px; font-size: 18px; flex-shrink: 0; color: inherit; }

/* Task board card meta */
.task-card-meta { min-width: 0; overflow: hidden; }
.task-card-chip { max-width: 140px; }
.task-card-chip .mud-chip-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
.task-card-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--forest);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; color: #F4F4EE; flex-shrink: 0;
    line-height: 1; cursor: default; user-select: none;
}

/* ════════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════════ */
.main-content { flex: 1; overflow-y: auto; background: var(--bg); }
.content-rail { max-width: 1240px; margin-inline: auto; padding: 28px 32px 56px; }

/* ── Workspace header (sticky context) ── */
.workspace-header {
    position: sticky; top: 0; z-index: 10;
    background: var(--bg);
    padding: 8px 0 18px;
    margin-bottom: 8px;
}
.workspace-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.workspace-title-group { min-width: 0; }
.workspace-title { font-size: 24px; font-weight: 700; color: var(--text); margin: 0 0 4px; line-height: 1.2; letter-spacing: -0.4px; }
.workspace-companies { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.workspace-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.workspace-dates { font-size: 12.5px; color: var(--text-subtle); white-space: nowrap; }

/* ── Status pill ── */
.status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 11px 3px 9px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 600; line-height: 1.4;
    border: 1px solid transparent;
}
.status-pill .status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill--active  { color: var(--forest); background: var(--forest-tint); }
.status-pill--active .status-dot { background: var(--lime); }
.status-pill--onhold  { color: var(--warning); background: var(--warning-bg); }
.status-pill--closing { color: var(--info);    background: var(--info-bg); }
.status-pill--closed  { color: var(--slate-600); background: var(--slate-100); }
.status-pill--pendingapproval { color: var(--warning); background: var(--warning-bg); }

/* ── Panel container ── */
.panel-container { animation: panelFadeIn 0.2s var(--ease); }
@keyframes panelFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.panel-loading { display: flex; align-items: center; justify-content: center; height: 240px; }

/* ════════════════════════════════════════════════════════════
   PAGE HEADER + WORKSPACE GRID
   ════════════════════════════════════════════════════════════ */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 700; color: var(--text); margin: 0 0 3px; letter-spacing: -0.4px; }
.page-subtitle { font-size: 13.5px; color: var(--text-muted); margin: 0; }

.workspaces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 288px), 1fr));
    gap: 16px;
}
.workspace-card {
    position: relative;
    display: flex; flex-direction: column; gap: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
    padding: 20px; text-decoration: none; color: inherit; cursor: pointer;
    transition: all 0.18s var(--ease);
    overflow: hidden;
}
/* Brand gradient edge, revealed on hover — the one place the full logo gradient reappears. */
.workspace-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--grad-brand); opacity: 0; transition: opacity 0.18s var(--ease);
}
.workspace-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}
.workspace-card:hover::before { opacity: 1; }
.workspace-card-top { display: flex; align-items: center; justify-content: space-between; }
.workspace-card-avatar {
    width: 42px; height: 42px; border-radius: var(--radius-lg);
    background: var(--forest);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: #F4F4EE; box-shadow: var(--glow-forest);
    font-family: var(--font-display);
}
.workspace-card-body { flex: 1; min-width: 0; }
.workspace-card-name { font-size: 15.5px; font-weight: 700; color: var(--text); margin: 0 0 4px; letter-spacing: -0.2px; font-family: var(--font-display); }
.workspace-card-companies { font-size: 12.5px; color: var(--text-muted); margin: 0; }
.workspace-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.workspace-card-dates { font-size: 11.5px; color: var(--text-subtle); }
.workspace-card-role { font-size: 11px; font-weight: 600; color: var(--forest); background: var(--forest-tint); padding: 3px 9px; border-radius: var(--radius-pill); white-space: nowrap; }
.workspace-card-skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; height: 148px; }

/* ── Empty state ── */
.workspaces-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 72px 24px; text-align: center; }
.empty-icon { margin-bottom: 16px; color: var(--slate-400); }
.empty-title { font-size: 19px; font-weight: 700; color: var(--slate-800); margin: 0 0 8px; letter-spacing: -0.3px; }
.empty-body { font-size: 14px; color: var(--text-muted); margin: 0 0 24px; }

/* ════════════════════════════════════════════════════════════
   KPI CARDS  (reusable; OverviewPanel and any panel can use these)
   ════════════════════════════════════════════════════════════ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 14px; }
.kpi-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
    padding: 18px; display: flex; flex-direction: column; gap: 12px;
    transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.kpi-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.kpi-icon { width: 34px; height: 34px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-value { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -0.03em; line-height: 1; font-feature-settings: 'tnum'; }
.kpi-icon--brand   { background: var(--forest-tint); color: var(--forest); }
.kpi-icon--slate   { background: var(--slate-100);  color: var(--slate-600); }
.kpi-icon--success { background: var(--success-bg); color: var(--success); }
.kpi-icon--warning { background: var(--warning-bg); color: var(--warning); }
.kpi-icon--error   { background: var(--error-bg);   color: var(--error); }
.kpi-icon--info    { background: var(--info-bg);    color: var(--info); }

/* ════════════════════════════════════════════════════════════
   SHARED PANEL KIT  (PanelHeader / SectionCard / EmptyState)
   ════════════════════════════════════════════════════════════ */
.panel-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.panel-header-text { min-width: 0; }
.panel-header-title { font-size: 18px; font-weight: 700; color: var(--text); margin: 0; letter-spacing: -0.3px; line-height: 1.3; }
.panel-header-subtitle { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }
.panel-header-meta { font-size: 12.5px; color: var(--text-subtle); white-space: nowrap; }
.panel-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Standing explainer under a panel header — what this page records and how it differs from its
   neighbour. Neutral on purpose: the coloured .overview-banner vocabulary means "act on this",
   and this text never goes away. */
.panel-note {
    display: flex; align-items: flex-start; gap: 9px;
    margin: -6px 0 18px; padding: 11px 14px;
    background: var(--surface-sunken); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.panel-note > .mud-icon-root { color: var(--text-subtle); flex-shrink: 0; margin-top: 1px; }
.panel-note-text { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-muted); max-width: 92ch; }
.panel-note-title { color: var(--text); font-weight: 700; }
.panel-note-dash { color: var(--text-subtle); }
.panel-note-text a {
    margin-left: 4px; font-weight: 600; color: var(--forest);
    text-decoration: underline; text-underline-offset: 2px; white-space: nowrap;
}

.section-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); padding: 22px;
}
.section-card + .section-card { margin-top: 16px; }
.section-card--flush { padding: 0; overflow: hidden; }
.section-card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-card--flush .section-card-header { padding: 18px 22px 0; margin-bottom: 0; }
.section-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; letter-spacing: -0.2px; }
.section-card-actions { display: flex; align-items: center; gap: 8px; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 52px 24px; text-align: center; }
.empty-state-icon { color: var(--slate-400); margin-bottom: 14px; line-height: 0; }
.empty-state-icon--positive { color: var(--pine); opacity: 0.85; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--slate-800); margin: 0 0 6px; letter-spacing: -0.2px; }
.empty-state-body { font-size: 13.5px; color: var(--text-muted); margin: 0 0 20px; max-width: 420px; line-height: 1.55; }
.empty-state-actions { display: flex; gap: 8px; }

/* ════════════════════════════════════════════════════════════
   MUDBLAZOR GLOBAL OVERRIDES (modernize all panels at once)
   ════════════════════════════════════════════════════════════ */
.mud-button-root { text-transform: none; font-weight: 600; border-radius: var(--radius-md); letter-spacing: -0.1px; }
.mud-button-filled { box-shadow: none; }
.mud-button-filled:hover { box-shadow: var(--shadow-sm); }
/* Primary filled buttons — deep forest, the brand's single confident action colour. */
.mud-button-filled.mud-button-filled-primary {
    background: var(--forest); color: #fff; border: none;
    box-shadow: var(--shadow-xs);
}
.mud-button-filled.mud-button-filled-primary:hover { background: var(--forest-hover); box-shadow: var(--glow-forest); }
.mud-button-filled.mud-button-filled-primary .mud-button-label { color: #fff; }
.mud-button-outlined.mud-button-outlined-primary { border-color: var(--border-strong); color: var(--text); }
.mud-button-outlined.mud-button-outlined-primary:hover { background: var(--slate-50); border-color: var(--slate-400); }

.mud-paper { border-radius: var(--radius-xl); }
.mud-paper.mud-paper-outlined { border-color: var(--border); box-shadow: none; }
.mud-card { border-radius: var(--radius-xl); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }

.mud-table-root { font-size: 13px; }
.mud-table-cell { border-color: var(--border); padding: 11px 16px; }
.mud-table-head .mud-table-cell {
    color: var(--text-muted); font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.05em; background: var(--slate-50);
}
.mud-chip { font-weight: 600; border-radius: var(--radius-sm); }
.mud-popover, .mud-menu-popover { box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); border: 1px solid var(--border); }

/* ════════════════════════════════════════════════════════════
   FORMS, VALIDATION, ERROR UI
   ════════════════════════════════════════════════════════════ */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--error); }
.validation-message { color: var(--error); font-size: 12px; }

.blazor-error-boundary {
    background: var(--error-bg); border: 1px solid #E4C4BF; border-radius: var(--radius-md);
    padding: 12px 16px; color: var(--error); font-size: 13px;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

#blazor-error-ui {
    background: var(--error-bg); border-top: 1px solid #E4C4BF; color: var(--error);
    padding: 10px 16px; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    display: none; font-size: 13px;
}
#blazor-error-ui .reload { color: var(--error); font-weight: 600; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; opacity: 0.6; }

.darker-border-checkbox.form-check-input { border-color: var(--slate-400); }
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder { color: var(--bs-secondary-color); text-align: end; }
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder { text-align: start; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {
    .app-shell:not(.nav-open) .sidebar { width: 0; min-width: 0; }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed; top: 0; left: 0;
        height: 100vh; height: 100dvh;
        width: 284px; min-width: 284px;
        transform: translateX(-100%);
        z-index: 200;
    }
    .app-shell.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .sidebar-backdrop {
        display: block; position: fixed; inset: 0;
        background: rgba(17, 17, 19, 0.4); z-index: 190;
        animation: fadeIn 0.2s var(--ease);
    }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    .content-rail { padding: 22px 20px 44px; }
}

@media (max-width: 640px) {
    .content-rail { padding: 18px 16px 36px; }
    .workspaces-grid { grid-template-columns: 1fr; gap: 12px; }
    .user-chip-name { display: none; }
    .bc-link, .topbar-breadcrumb .bc-sep:first-of-type { display: none; }
    .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
}

/* ════════════════════════════════════════════════════════════
   AUTH PAGES  (login / register / password reset — AuthLayout)
   ════════════════════════════════════════════════════════════ */
.auth-shell {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 32px 16px;
    background:
        radial-gradient(1200px 720px at 50% -25%, rgba(28, 74, 46, 0.05), transparent 60%),
        radial-gradient(720px 520px at 100% 118%, rgba(166, 206, 58, 0.09), transparent 55%),
        var(--bg);
}
.auth-container { width: 100%; max-width: 424px; display: flex; flex-direction: column; align-items: center; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; text-decoration: none; }
.auth-brand:hover { text-decoration: none; }
.auth-brand-text { font-weight: 700; font-size: 20px; color: var(--text); letter-spacing: -0.4px; }
.auth-card {
    width: 100%; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-2xl); box-shadow: var(--shadow-lg); padding: 34px 30px;
}
.auth-footnote { margin-top: 22px; font-size: 12px; color: var(--text-subtle); text-align: center; }
.auth-head { margin-bottom: 24px; text-align: center; }
.auth-title { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 5px; letter-spacing: -0.4px; }
h1:focus, [tabindex="-1"]:focus { outline: none; }
.auth-subtitle { font-size: 13.5px; color: var(--text-muted); margin: 0; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.auth-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin: 0; cursor: pointer; }
.auth-inline-link { font-size: 13px; font-weight: 600; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-subtle); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-external { margin-top: 4px; }
.auth-alt { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; text-align: center; font-size: 13px; color: var(--text-muted); }

.auth-icon {
    width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.auth-icon svg { width: 26px; height: 26px; }
.auth-icon-info { background: var(--forest-tint); color: var(--forest); }
.auth-icon-success { background: var(--success-bg); color: var(--success); }
.auth-icon-error { background: var(--error-bg); color: var(--error); }
.auth-icon-warning { background: var(--warning-bg); color: var(--warning); }
.auth-body { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; text-align: center; }
.auth-body a { font-weight: 600; }

/* Organization setup — plan chooser */
.auth-container:has(.setup-org) { max-width: 640px; }
.plan-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.plan-option {
    display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 0;
    border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    padding: 15px 16px; background: var(--surface);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.plan-option:hover { border-color: var(--slate-400); }
.plan-option:has(input:checked) {
    border-color: var(--forest);
    box-shadow: var(--ring);
}
.plan-option input[type="radio"] { margin-top: 4px; accent-color: var(--forest); flex-shrink: 0; }
.plan-option-disabled { opacity: 0.55; cursor: not-allowed; }
.plan-option-disabled:hover { border-color: var(--border-strong); }
.plan-body { display: flex; flex-direction: column; gap: 2px; }
.plan-name { font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.plan-price { font-size: 12.5px; font-weight: 600; color: var(--forest); }
.plan-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }

/* ════════════════════════════════════════════════════════════
   BOOTSTRAP FORM CONTROLS  (Identity pages keep their EditForms)
   ════════════════════════════════════════════════════════════ */
.form-control {
    font-family: inherit; font-size: 14px; color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    padding: 11px 13px; transition: border-color 0.12s, box-shadow 0.12s;
    background: var(--surface);
}
.form-control:focus {
    border-color: var(--forest);
    box-shadow: var(--ring);
    outline: none;
}
.form-floating > label { color: var(--text-subtle); font-size: 14px; }
.form-label { font-weight: 500; color: var(--text); font-size: 13px; }

.btn { font-family: inherit; font-weight: 600; border-radius: var(--radius-md); transition: all 0.15s var(--ease); letter-spacing: -0.1px; }
.btn-lg { padding: 12px 18px; font-size: 14.5px; }
.btn-primary {
    /* Override Bootstrap's blue --bs-btn-* tokens so :active / :focus stay on-brand. */
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--forest);
    --bs-btn-border-color: var(--forest);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--forest-hover);
    --bs-btn-hover-border-color: var(--forest-hover);
    --bs-btn-focus-shadow-rgb: 28, 74, 46;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--forest-deep);
    --bs-btn-active-border-color: var(--forest-deep);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--forest);
    --bs-btn-disabled-border-color: var(--forest);
    background: var(--forest); border: none; color: #fff; box-shadow: var(--shadow-xs);
}
.btn-primary:hover, .btn-primary:focus { background: var(--forest-hover); color: #fff; box-shadow: var(--glow-forest); transform: translateY(-1px); }
.btn-primary:active, .btn-primary.active { background: var(--forest-deep); color: #fff; box-shadow: var(--shadow-xs); transform: translateY(0); }
.btn-outline {
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
}
.btn-outline:hover { background: var(--slate-50); border-color: var(--slate-400); }
.btn-link { color: var(--forest); font-weight: 600; text-decoration: none; }
.btn-link:hover { color: var(--forest-hover); text-decoration: underline; }
.btn:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

.text-danger { color: var(--error) !important; font-size: 13px; }

.alert { border-radius: var(--radius-md); border: 1px solid transparent; font-size: 13.5px; padding: 12px 14px; }
.alert-danger { background: var(--error-bg); border-color: #E4C4BF; color: var(--error); }
.alert-success { background: var(--success-bg); border-color: #C3DDC5; color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: #E7D3A6; color: var(--warning); }
.alert-info { background: var(--info-bg); border-color: #C3D2E0; color: var(--info); }

/* ════════════════════════════════════════════════════════════
   ACCOUNT SETTINGS SHELL  (ManageLayout / ManageNavMenu)
   ════════════════════════════════════════════════════════════ */
.settings-header { margin-bottom: 26px; }
.settings-grid { display: grid; grid-template-columns: 224px 1fr; gap: 30px; align-items: start; }
.settings-nav { position: sticky; top: 8px; }
.settings-nav-list { display: flex; flex-direction: column; gap: 2px; }
.settings-nav-link {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-md);
    color: var(--text-muted); font-size: 13.5px; font-weight: 500;
    text-decoration: none; transition: all 0.1s var(--ease);
}
.settings-nav-link:hover { background: var(--slate-100); color: var(--text); text-decoration: none; }
.settings-nav-link.active { background: var(--forest-tint); color: var(--forest); font-weight: 600; }
.settings-nav-link.active::before {
    content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 16px; border-radius: 0 3px 3px 0; background: var(--lime);
}
.settings-nav-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; color: var(--text-subtle); }
.settings-nav-link.active .settings-nav-icon { color: var(--forest); }
.settings-content {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); padding: 26px;
    max-width: 640px;
}
.settings-content h1, .settings-content h2, .settings-content h3 { font-weight: 700; letter-spacing: -0.2px; font-family: var(--font-display); }
.settings-content h1 { font-size: 18px; }
.settings-content h2 { font-size: 16px; }
.settings-content h3 { font-size: 15px; }

.settings-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; margin: 0 0 5px; }
.settings-intro { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin: 0 0 22px; max-width: 56ch; }
.settings-subhead { font-size: 14px; font-weight: 600; color: var(--text); margin: 26px 0 12px; }
.settings-content hr { border: none; border-top: 1px solid var(--border); margin: 22px 0; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }

.settings-hint { font-size: 12.5px; color: var(--text-muted); margin: 0 0 16px; display: flex; align-items: center; gap: 6px; }
.settings-hint-ok { color: var(--success); font-weight: 600; }
.settings-hint .btn-link { font-size: 12.5px; padding: 0; vertical-align: baseline; }

.settings-content .table { width: 100%; border-collapse: collapse; margin: 4px 0 20px; font-size: 13.5px; }
.settings-content .table td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.settings-content .table td:first-child { padding-left: 0; font-weight: 500; }
.settings-content .table td:last-child { padding-right: 0; text-align: right; }
.settings-content .table tr:last-child td { border-bottom: none; }
.settings-content .table .settings-actions { justify-content: flex-end; }

.settings-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.settings-steps > li { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; }
.settings-steps > li p { margin: 0 0 8px; }
.settings-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--slate-100); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 7px; color: var(--text); }
.qr-frame { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

.recovery-code-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0; }
.recovery-code {
    display: block; text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; letter-spacing: 0.5px;
    background: var(--slate-100); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 9px 10px; color: var(--text);
}

@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; gap: 16px; }
    .settings-nav { position: static; }
    .settings-nav-list { flex-direction: row; flex-wrap: wrap; gap: 4px; }
}

/* ════════════════════════════════════════════════════════════
   OVERVIEW DASHBOARD  (OverviewPanel)
   ════════════════════════════════════════════════════════════ */

/* ── Health strip: exactly four doors on wide screens ── */
.kpi-grid--overview { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* KPI cards that navigate — quiet at rest, unmistakable on hover */
a.kpi-card { color: inherit; text-decoration: none; }
.kpi-card--link { position: relative; cursor: pointer; }
.kpi-card--link:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
    text-decoration: none;
}
.kpi-card--link:active { transform: translateY(0); }
.kpi-card--link:focus-visible { outline: none; box-shadow: var(--ring); }
.kpi-sub { font-size: 12px; color: var(--text-subtle); margin-top: -4px; line-height: 1.4; }
.kpi-icon { transition: opacity 0.16s var(--ease); }
.kpi-go {
    position: absolute; top: 18px; right: 18px;
    width: 34px; height: 34px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    background: var(--forest-tint); color: var(--forest);
    opacity: 0; transform: translateX(-4px);
    transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
}
.kpi-card--link:hover .kpi-icon { opacity: 0; }
.kpi-card--link:hover .kpi-go { opacity: 1; transform: translateX(0); }

/* ── Contextual lifecycle banner ── */
.overview-banner {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; margin-bottom: 16px;
    border-radius: var(--radius-lg); border: 1px solid transparent;
}
.overview-banner > .mud-icon-root { flex-shrink: 0; }
.overview-banner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.overview-banner-title { font-size: 13px; font-weight: 700; }
.overview-banner-text { font-size: 12.5px; opacity: 0.9; }
.overview-banner-link {
    font-size: 12.5px; font-weight: 600; color: inherit; white-space: nowrap;
    text-decoration: underline; text-underline-offset: 2px;
}
.overview-banner-link:hover { color: inherit; }
.overview-banner--warning { background: var(--warning-bg); border-color: #E7D3A6; color: var(--warning); }
.overview-banner--info    { background: var(--info-bg);    border-color: #C3D2E0; color: var(--info); }
.overview-banner--neutral { background: var(--slate-100);  border-color: var(--border-strong); color: var(--slate-600); }

/* ── Progress hero meters ── */
.overview-hero { display: flex; flex-direction: column; gap: 20px; }
.overview-meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.overview-meter-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted);
}
.overview-meter-value { font-size: 12.5px; font-weight: 600; color: var(--text); font-feature-settings: 'tnum'; }
.overview-meter-value--warn { color: var(--error); }
.overview-bar { height: 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.overview-bar-fill { height: 100%; border-radius: inherit; transition: width 0.5s var(--ease); }
.overview-bar-fill--brand { background: var(--grad-brand); }
.overview-bar-fill--success { background: var(--pine); }
.overview-meter-foot {
    display: flex; justify-content: space-between; gap: 12px;
    margin-top: 6px; font-size: 12px; color: var(--text-subtle);
}
.overview-foot-overdue { color: var(--error); font-weight: 600; }
.overview-meter-next { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }

/* ── Full-width body rows: Up next, then Recent activity ── */
.overview-list { display: flex; flex-direction: column; }
.overview-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; min-width: 0; font-size: 13px; }
.overview-list-item + .overview-list-item { border-top: 1px solid var(--border); }
.overview-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate-400); flex-shrink: 0; }
/* Milestone statuses */
.overview-dot--overdue  { background: var(--error); }
.overview-dot--duesoon  { background: var(--warning); }
.overview-dot--upcoming { background: var(--info); }
.overview-dot--complete { background: var(--success); }
.overview-item-title {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500; color: var(--text);
}
.overview-item-meta { font-size: 12px; color: var(--text-subtle); white-space: nowrap; font-feature-settings: 'tnum'; }
.overview-item-meta--overdue { color: var(--error); font-weight: 600; }
.overview-empty { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }
.overview-empty--positive { display: flex; align-items: center; gap: 7px; color: var(--success); font-weight: 500; }
/* Empty/error note inside the flush Recent-activity card, which has no built-in padding */
.overview-empty--flush { margin: 14px 22px 20px; }
.overview-skeleton { display: flex; flex-direction: column; gap: 10px; }

/* "View all"-style link in a SectionCard header */
.section-link { font-size: 12.5px; font-weight: 600; color: var(--forest); white-space: nowrap; }

/* ── Partnership & team strip ── */
.overview-team { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.overview-companies { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-width: 0; }
.overview-company { display: flex; align-items: center; gap: 10px; min-width: 0; }
.overview-company-avatar {
    width: 38px; height: 38px; border-radius: var(--radius-md);
    background: var(--forest-tint); color: var(--forest);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; font-family: var(--font-display);
    flex-shrink: 0;
}
.overview-company-text { min-width: 0; }
.overview-company-name {
    display: block; font-size: 13.5px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.overview-company-meta { display: block; font-size: 12px; color: var(--text-subtle); }
.overview-swap { color: var(--text-subtle); flex-shrink: 0; }
.overview-avatar-stack { display: flex; align-items: center; padding-left: 8px; }
.overview-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--forest); color: #F4F4EE;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    border: 2px solid var(--surface); margin-left: -8px;
    cursor: default; user-select: none;
}
.overview-avatar:first-child { margin-left: 0; }
.overview-avatar--more { background: var(--slate-200); color: var(--slate-700); }

/* ════════════════════════════════════════════════════════════
   WORKSPACE ADMINISTRATION  (AdministrationPanel)
   ════════════════════════════════════════════════════════════ */
.admin-rows { display: flex; flex-direction: column; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; flex-wrap: wrap; }
.admin-rows > .admin-row:first-child { padding-top: 0; }
.admin-rows > .admin-row:last-child { padding-bottom: 0; }
.admin-row + .admin-row { border-top: 1px solid var(--border); }
.admin-row-text { flex: 1 1 320px; min-width: 0; }
.admin-row-title { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.admin-row-desc { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; max-width: 58ch; line-height: 1.5; }
.admin-row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.admin-note {
    display: flex; align-items: center; gap: 7px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
    font-size: 12.5px; color: var(--text-subtle);
}
.admin-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 10px; }
.admin-stat-value {
    display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
    color: var(--text); font-feature-settings: 'tnum';
}
.admin-stat-value--ok { color: var(--success); }
.admin-stat-value--warn { color: var(--warning); }
.admin-stat-label { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.admin-dates {
    font-size: 12.5px; color: var(--text-subtle);
    margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.admin-dates + .admin-rows > .admin-row:first-child { padding-top: 14px; }
/* GitHub-style danger zone: the card itself warns before the buttons do */
.section-card--danger { border-color: #E4C4BF; }
.section-card--danger .section-card-title { color: var(--error); }

/* ════════════════════════════════════════════════════════════
   ACTIVITY FEED  (ActivityPanel)
   ════════════════════════════════════════════════════════════ */

/* ── Filter toolbar: type chips + company segmented control ── */
.activity-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.activity-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.activity-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-radius: var(--radius-pill);
    background: var(--surface); border: 1px solid var(--border-strong);
    font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-muted);
    line-height: 1.4; cursor: pointer;
    transition: background 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease);
}
.activity-chip:hover { background: var(--slate-50); border-color: var(--slate-400); color: var(--text); }
.activity-chip--active,
.activity-chip--active:hover {
    background: var(--forest-tint); border-color: transparent;
    color: var(--forest); font-weight: 600;
}
.activity-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.activity-chip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--slate-400); }

/* Type dot vocabulary for the filter chips — matches the feed's icon tile tints */
.activity-dot--handoff   { background: var(--forest); }
.activity-dot--blocker   { background: var(--error); }
.activity-dot--decision  { background: var(--info); }
.activity-dot--task      { background: var(--pine); }
.activity-dot--member    { background: var(--warning); }
.activity-dot--workspace { background: var(--slate-600); }

.activity-seg {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--surface-sunken); border: 1px solid var(--border);
    border-radius: var(--radius-pill); padding: 3px;
}
.activity-seg-btn {
    border: none; background: none;
    font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-muted);
    line-height: 1.4; padding: 4px 12px; border-radius: var(--radius-pill); cursor: pointer;
    max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background 0.12s var(--ease), color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.activity-seg-btn:hover { color: var(--text); }
.activity-seg-btn--active,
.activity-seg-btn--active:hover {
    background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-xs);
}
.activity-seg-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ── Feed ── */
.activity-feed { padding: 4px 0 8px; transition: opacity 0.15s var(--ease); }
.activity-feed--loading { opacity: 0.55; pointer-events: none; }

.activity-group-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px 8px; }
.activity-group-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted); margin: 0; white-space: nowrap;
}
.activity-group-rule { flex: 1; height: 1px; background: var(--border); }
.activity-group-count { font-size: 11.5px; color: var(--text-subtle); white-space: nowrap; font-feature-settings: 'tnum'; }

/* Hairline rail threading the day's icons together — a quiet timeline */
.activity-group-items { position: relative; }
.activity-group-items::before {
    content: ""; position: absolute; left: 38px; top: 24px; bottom: 24px;
    width: 2px; border-radius: 1px; background: var(--slate-200);
}

.activity-row {
    display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 4px 14px; align-items: center;
    padding: 9px 22px;
}
.activity-icon {
    position: relative; /* paints above the rail */
    width: 34px; height: 34px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: var(--slate-100); color: var(--slate-600);
    box-shadow: 0 0 0 3px var(--surface); /* clean gap where the rail passes behind */
}
.activity-icon--handoff   { background: var(--forest-tint); color: var(--forest); }
.activity-icon--blocker   { background: var(--error-bg);    color: var(--error); }
.activity-icon--decision  { background: var(--info-bg);     color: var(--info); }
.activity-icon--task      { background: var(--success-bg);  color: var(--pine); }
.activity-icon--member    { background: var(--warning-bg);  color: var(--warning); }
.activity-icon--workspace { background: var(--slate-100);   color: var(--slate-600); }

.activity-text { margin: 0; min-width: 0; font-size: 13px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.activity-text-muted { color: var(--text-muted); }
.activity-text-strong { font-weight: 600; color: var(--text); }
.activity-text-plain { font-weight: 500; }

.activity-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.activity-company {
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    background: var(--slate-100); border-radius: var(--radius-pill); padding: 2px 9px;
    max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.activity-time { font-size: 12px; color: var(--text-subtle); white-space: nowrap; font-feature-settings: 'tnum'; }
/* Lime is the jewel: a single live dot marks something that just happened */
.activity-live {
    width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
    background: var(--lime); box-shadow: 0 0 0 3px rgba(166, 206, 58, 0.22);
}

/* ── Footer: progressive reveal + cap note ── */
.activity-more-btn {
    display: block; width: 100%; margin-top: 6px; padding: 12px 22px;
    background: none; border: none; border-top: 1px solid var(--border);
    font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--forest);
    cursor: pointer; transition: background 0.12s var(--ease);
}
.activity-more-btn:hover { background: var(--slate-50); }
.activity-more-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.activity-cap-note { font-size: 12px; color: var(--text-subtle); margin: 10px 2px 0; }

/* ── Loading & error ── */
.activity-skeleton { display: flex; flex-direction: column; gap: 20px; padding: 20px 22px; }
.activity-skeleton-row { display: flex; align-items: center; gap: 14px; }
.activity-error {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 36px 24px; text-align: center; color: var(--text-muted);
}
.activity-error p { margin: 6px 0 12px; font-size: 13.5px; }
.activity-error .mud-icon-root { color: var(--slate-400); }
.activity-error .btn { padding: 7px 14px; font-size: 13px; }

/* ── Activity responsive ── */
@media (max-width: 720px) {
    .activity-row { grid-template-columns: 34px minmax(0, 1fr); }
    .activity-meta { grid-column: 2; }
    .activity-seg-btn { max-width: 120px; }
}

/* ════════════════════════════════════════════════════════════
   AUDIT DETAILS  (AuditPanel)
   ────────────────────────────────────────────────────────────
   An audit row names the action and the actor; what was actually
   submitted lives behind a per-row disclosure so the list still
   scans, and the values are laid out as a definition list rather
   than as the raw JSON they are stored as.
   ════════════════════════════════════════════════════════════ */
.audit-toggle {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 4px 8px 4px 6px; border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill); background: var(--surface);
    font-family: inherit; font-size: 11.5px; font-weight: 600; color: var(--text-muted);
    cursor: pointer; white-space: nowrap; transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.audit-toggle:hover { background: var(--slate-50); color: var(--text); }
.audit-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.audit-toggle .mud-icon-root { font-size: 15px; }

.audit-detail {
    padding: 11px 14px; border-radius: var(--radius-md);
    background: var(--surface-sunken); border: 1px solid var(--border);
}
.audit-fields {
    display: grid; grid-template-columns: max-content minmax(0, 1fr);
    gap: 5px 16px; margin: 0; font-size: 12px; line-height: 1.5;
}
.audit-fields dt { color: var(--text-subtle); font-weight: 600; }
.audit-fields dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.audit-detail-note { margin: 0; font-size: 11.5px; color: var(--text-subtle); }
.audit-fields + .audit-detail-note, .audit-fields + .audit-detail-error { margin-top: 9px; }
.audit-detail-error { margin: 0; font-size: 12px; line-height: 1.5; color: var(--error); overflow-wrap: anywhere; }
.audit-raw {
    margin: 5px 0 0; padding: 8px 10px; max-height: 220px; overflow: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
    color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .audit-fields { grid-template-columns: minmax(0, 1fr); gap: 1px; }
    .audit-fields dd { margin-bottom: 6px; }
}

/* ── Overview / administration responsive ── */
@media (max-width: 1024px) {
    .kpi-grid--overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .overview-meter-next { max-width: 100%; }
}
@media (max-width: 520px) {
    .kpi-grid--overview { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   ENTITY ROWS  (shared row primitive — replaces the panel tables)
   ────────────────────────────────────────────────────────────
   One row = a lead tile (icon or initials), a title with an optional
   badge, a muted sub-line, then right-aligned meta and actions.
   Every row must read on its own: dropping MudTable also drops its
   DataLabel card-stacking, so there are no column headers to lean on.
   The 3px transparent left border is always present and the left
   padding compensates, so an accented row does not shift its content
   and the 22px flush-card rhythm holds either way.
   ════════════════════════════════════════════════════════════ */
.entity-list { display: flex; flex-direction: column; }

.entity-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 22px 12px 19px;
    border-left: 3px solid transparent;
}
.entity-row + .entity-row { border-top: 1px solid var(--border); }

/* The row edge carries urgency, so the whole row reads as urgent rather
   than relying on one small chip in the first column. */
.entity-row--error   { border-left-color: var(--error); }
.entity-row--warning { border-left-color: var(--warning); }
.entity-row--info    { border-left-color: var(--info); }
.entity-row--success { border-left-color: var(--success); }
.entity-row--slate   { border-left-color: var(--slate-300); }

a.entity-row { color: inherit; text-decoration: none; }
.entity-row--link { cursor: pointer; transition: background 0.14s var(--ease); }
.entity-row--link:hover { background: var(--slate-50); text-decoration: none; }
.entity-row--link:focus-visible { outline: none; box-shadow: var(--ring); }

.entity-lead {
    width: 34px; height: 34px; border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    background: var(--slate-100); color: var(--slate-600);
}
.entity-lead--brand   { background: var(--forest-tint); color: var(--forest); }
.entity-lead--success { background: var(--success-bg);  color: var(--success); }
.entity-lead--warning { background: var(--warning-bg);  color: var(--warning); }
.entity-lead--error   { background: var(--error-bg);    color: var(--error); }
.entity-lead--info    { background: var(--info-bg);     color: var(--info); }

/* People get a circle with initials rather than an icon tile. Kept separate from
   .overview-avatar, which carries a negative margin for overlapping stacks. */
.entity-lead--avatar {
    border-radius: 50%; background: var(--forest-tint); color: var(--forest);
    font-size: 12.5px; font-weight: 700;
}

.entity-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.entity-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.entity-title {
    font-size: 13px; font-weight: 600; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.entity-sub { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* Open disclosure under the sub-line. It makes the row tall, so the lead tile, meta and actions
   pin to the first line instead of floating in the middle of it. */
.entity-detail { margin-top: 10px; }
.entity-row--expanded { align-items: flex-start; }

.entity-meta {
    display: flex; align-items: center; gap: 10px; flex-shrink: 0;
    font-size: 12px; color: var(--text-subtle); font-feature-settings: 'tnum';
}
.entity-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Group header — mirrors .activity-group-head so grouped lists read alike. */
.entity-group-head { display: flex; align-items: center; gap: 10px; padding: 15px 22px 7px; }
.entity-group-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted);
}
.entity-group-rule { flex: 1; height: 1px; background: var(--border); }
.entity-group-count { font-size: 11px; font-weight: 600; color: var(--text-subtle); font-feature-settings: 'tnum'; }

/* Generic tint pill, keyed on semantic tint rather than domain value.
   Deliberately NOT .status-pill: that is the workspace lifecycle vocabulary,
   whose colours encode what those particular values mean. */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: var(--radius-pill);
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: var(--slate-100); color: var(--slate-700);
}
.pill--brand   { background: var(--forest-tint); color: var(--forest); }
.pill--success { background: var(--success-bg);  color: var(--success); }
.pill--warning { background: var(--warning-bg);  color: var(--warning); }
.pill--error   { background: var(--error-bg);    color: var(--error); }
.pill--info    { background: var(--info-bg);     color: var(--info); }

.confirm-button { display: inline-flex; align-items: center; gap: 4px; }
.empty-state-illustration { width: 100%; max-width: 720px; margin: 20px 0 4px; }
.handoff-attach { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 10px; align-items: center; }
@media (max-width: 640px) { .handoff-attach { grid-template-columns: 1fr; } }
.search-field { max-width: 260px; }

/* Copyable accept link, shown after re-sending an invitation. */
.invite-link-field {
    width: 100%; margin-top: 8px; padding: 7px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-md); color: var(--text);
}
.invite-link-field:focus { outline: none; border-color: var(--forest); box-shadow: var(--ring); }

/* Two-company split — mirrors the Overview partnership strip, so Team reads as two sides
   rather than one flat list with a company column. */
.company-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.company-col-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 10px; }
.company-col-name { font-size: 13.5px; font-weight: 700; color: var(--text); flex: 1; min-width: 0;
                    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-col-count { font-size: 11.5px; color: var(--text-subtle); font-feature-settings: 'tnum'; }

/* Escalation as a filled ladder rather than prose: "Counterpart notified" tells you a level
   was reached but not how far it can go. Two pips make the remaining headroom visible. */
.escalation-pips { display: inline-flex; align-items: center; gap: 3px; }
.escalation-pip {
    width: 5px; height: 12px; border-radius: 2px;
    background: var(--slate-300);
}
.escalation-pip--on { background: var(--warning); }
.escalation-pip--max { background: var(--error); }

/* ════════════════════════════════════════════════════════════
   TASK BOARD  (TasksPanel)
   ────────────────────────────────────────────────────────────
   Sunken lanes holding raised cards, so the column reads as a
   container and the card as the thing you move. Reuses the existing
   .task-card-meta / -chip / -avatar rules for the card's meta row.
   ════════════════════════════════════════════════════════════ */
.task-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.task-lane {
    background: var(--surface-sunken); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 14px;
    display: flex; flex-direction: column; gap: 10px; min-height: 140px;
    /* Positioned so a card's offsetTop is measured against the lane, and so the drop slot
       below can be drawn at that offset. */
    position: relative;
    transition: padding-bottom 0.19s var(--ease), background-color 0.19s var(--ease),
                border-color 0.19s var(--ease);
}
.task-lane-head { display: flex; align-items: center; gap: 8px; }
.task-lane-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted); flex: 1;
}
.task-lane-count {
    font-size: 11px; font-weight: 600; color: var(--text-subtle);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-pill); padding: 1px 8px; font-feature-settings: 'tnum';
}
.task-lane-empty {
    font-size: 12px; color: var(--text-subtle); padding: 6px 2px;
    transition: opacity 0.15s var(--ease);
}
.task-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow-xs);
    display: flex; flex-direction: column; gap: 9px;
    transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.task-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.task-card--clickable { cursor: pointer; }
.task-card-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
/* The card title as the card's real (keyboard-reachable) open control. Resets only what the
   UA button style adds — the .task-card-title class it shares supplies size and weight. */
.task-card-title-btn {
    background: none; border: none; padding: 0; font-family: inherit;
    text-align: left; cursor: pointer; border-radius: var(--radius-sm);
}
.task-card-title-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.task-card--clickable:focus-within { border-color: var(--border-strong); }
.task-card-desc {
    font-size: 12px; color: var(--text-muted); line-height: 1.45; margin: -4px 0 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task-card-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding-top: 8px; border-top: 1px solid var(--border);
}
.task-card-comments {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11.5px; font-weight: 600; color: var(--text-subtle); font-feature-settings: 'tnum';
}

/* ── Dragging a card between lanes ──────────────────────────────────────
   The gesture itself lives in TasksPanel.razor.js; everything here is the
   vocabulary that module toggles. It is not allowed to put a node inside
   the board — that DOM is Blazor's — so the slot the card will drop into
   is drawn as the lane's own ::after, placed from two custom properties,
   and the space for it is made by shifting the cards below it.

   No grab cursor: the card is a click target first — .task-card--clickable
   above already says pointer, and claiming the hand back would undersell the
   thing you do most. The grabbing cursor arrives once a drag actually starts. */
.task-card--draggable:focus-visible {
    outline: none; border-color: var(--forest); box-shadow: var(--ring);
}

/* Hover lift is the board saying "this one" — during a drag it is noise. */
.task-board--dragging .task-card { transition: transform 0.19s var(--ease); }
.task-board--dragging .task-card:hover { border-color: var(--border); box-shadow: var(--shadow-xs); }
.task-card--shifted { pointer-events: none; }

/* Where the card came from. It keeps its box rather than collapsing, so nothing
   below it reflows while the pointer is still deciding. */
.task-card--source {
    background: transparent; box-shadow: none;
    border-style: dashed; border-color: var(--border-strong);
}
.task-card--source > * { opacity: 0; }

/* Picked up by keyboard: no floating copy, the card itself rises. */
.task-card--lifted {
    border-color: var(--forest); box-shadow: var(--glow-forest); transform: scale(1.02);
}

/* The copy that follows the pointer. Outside the board, so it can cross lanes
   and page edges without being clipped by either. */
.task-drag-ghost {
    position: fixed; z-index: 1250; pointer-events: none; will-change: transform;
}
.task-drag-ghost .task-card {
    width: 100%; height: 100%; margin: 0; cursor: grabbing;
    background: var(--surface); border-color: var(--forest); box-shadow: var(--shadow-lg);
    transform: scale(1.03) rotate(1.4deg);
    transition: transform 0.17s var(--ease), box-shadow 0.17s var(--ease);
}

/* The lane being aimed at, and the slot inside it. */
.task-lane--over { border-color: var(--pine); background: var(--forest-tint); }
.task-lane--over::after {
    content: ''; position: absolute; left: 14px; right: 14px;
    top: var(--drop-top, 0); height: var(--drop-height, 64px);
    border: 2px dashed var(--pine); border-radius: var(--radius-lg);
    background: rgba(46, 125, 70, 0.07); pointer-events: none;
    animation: task-drop-open 0.18s var(--ease) both;
}
.task-lane--over .task-lane-empty { opacity: 0; }
/* Aiming back at the lane it started in: acknowledged, but nothing is going to happen. */
.task-lane--return { border-color: var(--border-strong); }

@keyframes task-drop-open {
    from { opacity: 0; transform: scale(0.98); }
    to   { opacity: 1; transform: scale(1); }
}

/* One pulse where the card came to rest, so the eye follows it into a lane it may
   have been sorted into the middle of. */
.task-card--landed { animation: task-card-landed 0.85s var(--ease) both; }
@keyframes task-card-landed {
    0%   { border-color: var(--pine); box-shadow: 0 0 0 0 rgba(46, 125, 70, 0.4), var(--shadow-md); }
    45%  { border-color: var(--pine); box-shadow: 0 0 0 7px rgba(46, 125, 70, 0), var(--shadow-sm); }
    100% { border-color: var(--border); box-shadow: var(--shadow-xs); }
}

/* Nothing on the page is a text selection while a card is in the air. */
body.is-task-dragging { user-select: none; -webkit-user-select: none; }
body.is-task-dragging, body.is-task-dragging * { cursor: grabbing !important; }

/* Read-only detail text — still used by HandoffDetailDialog. */
.task-detail-meta { font-size: 12.5px; color: var(--text-muted); margin: 0 0 12px; }
.task-detail-desc { font-size: 13px; color: var(--text); line-height: 1.55; margin: 0 0 16px; white-space: pre-wrap; }

/* ════════════════════════════════════════════════════════════
   TASK EDITOR  (TaskDetailDialog / TaskDialog)
   ────────────────────────────────────────────────────────────
   One surface instead of detail + edit dialogs: the title and
   description are borderless fields that read as text until
   hovered, and the sidebar properties save as they change.
   ════════════════════════════════════════════════════════════ */
/* The header row lives in MudBlazor's title slot (keeps the dialog's aria-labelledby),
   so the slot's own padding provides the spacing below it. */
.task-editor-head { display: flex; align-items: center; gap: 8px; }
.task-editor-title { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; margin: 0; }
.task-editor-save { flex: 1; text-align: right; font-size: 11.5px; color: var(--text-subtle); }
.task-editor-save--error { color: var(--error); font-weight: 600; }

.task-editor { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; }
.task-editor-main { min-width: 0; }
.task-editor-side {
    border-left: 1px solid var(--border); padding-left: 24px;
    display: flex; flex-direction: column; gap: 18px; align-content: start;
}
@media (max-width: 719px) {
    .task-editor { grid-template-columns: 1fr; }
    .task-editor-side { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
}

/* The bleed below overhangs the dialog's content edge by 8px. That sits well inside the 24px
   padding so it never looks clipped, but the scroll container still counts it as overflow and
   grows a horizontal scrollbar for it — hence hiding that axis. Vertical scrolling is untouched.
   MudBlazor sets overflow with a shorthand at .mud-dialog .mud-dialog-content, so the override
   has to out-specify that pair rather than just name the class. */
.mud-dialog .mud-dialog-content.task-dialog-content { overflow-x: hidden; }

/* Borderless in-place fields: text until you hover, a field once you focus. The negative margin
   lets the hover surface bleed past the text column so the text itself never shifts. */
.task-title-input, .task-desc-input {
    display: block; width: calc(100% + 16px); margin-left: -8px; padding: 5px 8px;
    border: none; background: transparent; border-radius: var(--radius-md);
    font-family: inherit; color: var(--text);
    transition: background 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.task-title-input { font-size: 18px; font-weight: 700; line-height: 1.35; }
.task-desc-input {
    font-size: 13px; line-height: 1.55; resize: none; margin-top: 2px;
    min-height: 68px; max-height: 320px; overflow-y: auto; field-sizing: content;
}
.task-title-input:hover, .task-desc-input:hover { background: var(--surface-sunken); }
.task-title-input:focus, .task-desc-input:focus {
    outline: none; background: var(--surface-sunken); box-shadow: var(--ring);
}
.task-title-input::placeholder, .task-desc-input::placeholder { color: var(--text-subtle); }

/* Viewer (read-only) rendering — plain text, nothing tabbable or editable-looking. */
.task-title-static { font-size: 18px; font-weight: 700; line-height: 1.35; color: var(--text); margin: 0; padding: 5px 0; }
.task-desc-static { font-size: 13px; color: var(--text); line-height: 1.55; margin: 2px 0 0; padding: 6px 0; white-space: pre-wrap; }
.task-desc-static--empty { color: var(--text-subtle); font-style: italic; }

/* Sidebar properties — label above control, mirroring .entity-group-label's vocabulary. */
.task-prop { display: flex; flex-direction: column; gap: 3px; }
.task-prop-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted);
}
.task-prop-value { font-size: 12.5px; color: var(--text); }
.task-prop-hint { font-size: 11.5px; color: var(--text-subtle); line-height: 1.45; }
.task-prop-hint--overdue { color: var(--error); font-weight: 600; }
.task-prop .mud-input-control { margin-top: 0; }
/* MudMenu ships align-self:center, which centres its trigger inside the column-flex .task-prop
   instead of lining it up under the label like every other property control. */
.task-prop > .mud-menu { align-self: flex-start; }
.task-status-btn {
    display: inline-flex; align-items: center; gap: 2px; align-self: flex-start;
    background: none; border: none; padding: 0; cursor: pointer; color: var(--text-muted);
}
.task-status-btn:focus-visible { outline: none; border-radius: var(--radius-pill); box-shadow: var(--ring); }
.task-status-btn:disabled { cursor: default; opacity: 0.6; }

/* Create dialog property strip */
.task-create-props {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px;
    margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border);
}
@media (max-width: 599px) { .task-create-props { grid-template-columns: 1fr; } }

/* Comment thread */
.task-editor-comments-label { display: block; margin: 22px 0 6px; }
.task-comment {
    display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px;
    padding: 12px 0; border-top: 1px solid var(--border);
}
.task-comment-avatar { width: 26px; height: 26px; font-size: 10px; margin-top: 1px; }
.task-comment-content { min-width: 0; }
.task-comment-head { font-size: 11.5px; color: var(--text-subtle); margin: 0 0 3px; }
.task-comment-head b { color: var(--text); font-weight: 600; }
.task-comment-body { font-size: 12.5px; color: var(--text); line-height: 1.55; margin: 0; white-space: pre-wrap; }
.task-comment-mentions { font-size: 11.5px; color: var(--forest); margin: 5px 0 0; }

/* Composer — one bordered surface holding the text, the mention picker and the post button,
   so the pieces read as a single control rather than three stacked fields. */
.task-composer {
    margin-top: 4px; padding: 10px 12px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
    transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.task-composer:focus-within { border-color: var(--forest); box-shadow: var(--ring); }
.task-composer-input {
    display: block; width: 100%; padding: 0; border: none; background: transparent; resize: none;
    font-family: inherit; font-size: 12.5px; line-height: 1.55; color: var(--text);
    min-height: 38px; max-height: 200px; overflow-y: auto; field-sizing: content;
}
.task-composer-input:focus { outline: none; }
.task-composer-input::placeholder { color: var(--text-subtle); }
/* Wraps rather than squeezing: the mention field shrinking under its text is what clipped the
   placeholder on narrow dialogs. */
.task-composer-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.task-composer-mention { flex: 0 1 220px; min-width: 160px; }
.task-composer-mention.mud-input-control { margin-top: 0; }
.task-composer-mention input { text-overflow: ellipsis; }
.task-composer-hint { margin-left: auto; font-size: 11px; color: var(--text-subtle); white-space: nowrap; }

/* ════════════════════════════════════════════════════════════
   DECISION ENTRIES  (DecisionsPanel)
   ────────────────────────────────────────────────────────────
   A decision carries more than a row can: the question, the outcome,
   why, what it links to, and who signed it. So it gets its own block
   rather than stretching EntityRow with optional slots. Day grouping
   and the pill vocabulary are still shared.
   ════════════════════════════════════════════════════════════ */
.decision-entry { padding: 16px 22px 16px 19px; border-left: 3px solid transparent; }
.decision-entry + .decision-entry { border-top: 1px solid var(--border); }
.decision-entry--pending { border-left-color: var(--warning); }
.decision-entry--superseded { opacity: 0.72; }
.decision-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.decision-question { font-size: 13.5px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; }
.decision-outcome { font-size: 13px; color: var(--text); margin: 0; line-height: 1.5; }
.decision-rationale { font-size: 12.5px; color: var(--text-muted); margin: 5px 0 0; line-height: 1.55; }
.decision-links { display: flex; gap: 6px; flex-wrap: wrap; margin: 9px 0 0; }
.decision-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--border);
    font-size: 11.5px; color: var(--text-subtle);
}

/* Dim in place while refetching, rather than flashing a skeleton over content
   the reader is already looking at. */
.is-refetching { opacity: 0.55; transition: opacity 0.14s var(--ease); }

/* Knowledge page body, revealed under its row. */
.kb-page-body {
    margin: 0; padding: 0 22px 16px 67px;
    font-size: 12.5px; line-height: 1.6; color: var(--text-muted);
    white-space: pre-wrap;
}
.kb-page-body--empty { font-style: italic; color: var(--text-subtle); }

/* ════════════════════════════════════════════════════════════
   SCHEDULE TRACK  (SchedulePanel)
   ────────────────────────────────────────────────────────────
   The milestone plan laid on the calendar range. Positioning is
   inherently computed, so `left` stays inline — everything else
   is a class, and the colours come from app tokens rather than
   MudBlazor palette variables.
   ════════════════════════════════════════════════════════════ */
.schedule-track { position: relative; height: 46px; margin: 26px 10px 8px; }
.schedule-line {
    position: absolute; top: 50%; left: 0; right: 0; height: 2px;
    background: var(--border-strong); border-radius: 1px;
}
.schedule-bound {
    position: absolute; top: calc(50% + 10px);
    font-size: 11px; color: var(--text-subtle); font-feature-settings: 'tnum';
}
.schedule-bound--start { left: 0; }
.schedule-bound--end { right: 0; }
.schedule-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--forest); opacity: 0.55; }
.schedule-today-label {
    position: absolute; top: -19px; transform: translateX(-50%);
    font-size: 10.5px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--forest);
}
.schedule-marker {
    position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
    transform: translate(-50%, -50%); border: 2px solid var(--surface);
    background: var(--slate-400);
}
.schedule-marker--complete { background: var(--success); }
.schedule-marker--overdue  { background: var(--error); }
.schedule-marker--duesoon  { background: var(--warning); }
.schedule-marker--upcoming { background: var(--info); }
.schedule-empty { font-size: 12.5px; color: var(--text-subtle); margin: 0; padding: 6px 0; }

/* ── Entity rows responsive ── */
@media (max-width: 900px) {
    .company-split { grid-template-columns: 1fr; }
    .task-board { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .entity-row { flex-wrap: wrap; }
    .entity-meta { width: 100%; }
    .entity-meta, .entity-actions { padding-left: 48px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
