/* ==========================================================================
   PharmaCorpo — Premium B2B design layer
   Loaded after app.css / dashboard.css / pharma.css. Overrides visuals only:
   no business logic, no markup contracts broken.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --ink: #0B1220;
    --ink-2: #121C2E;
    --ink-3: #1B2740;
    --ink-soft: #24314C;

    --ivory: #F7F4EE;
    --ivory-2: #FBF9F4;
    --paper: #FFFFFF;

    --line: #E6E0D3;
    --line-soft: #EFEAE0;
    --line-strong: #D8D0BE;

    --gold: #C0A062;
    --gold-2: #D9BC80;
    --gold-deep: #6E5323;
    --gold-soft: #F4ECDA;
    --gold-line: rgba(192, 160, 98, 0.38);

    --text: #141A26;
    --muted: #5E5A50;
    --muted-2: #6E6857;

    --ok: #256B52;
    --ok-soft: #E7F0EA;
    --warn: #8A6420;
    --warn-soft: #F7EEDC;
    --danger: #8E3B3B;
    --danger-soft: #F6E7E5;
    --info: #2E4A6B;
    --info-soft: #E8EDF3;

    --r-xs: 10px;
    --r-sm: 14px;
    --r-md: 18px;
    --r-lg: 24px;
    --r-xl: 30px;

    --sh-1: 0 1px 2px rgba(11, 18, 32, .04), 0 14px 34px -18px rgba(11, 18, 32, .18);
    --sh-2: 0 30px 70px -30px rgba(11, 18, 32, .28);
    --sh-gold: 0 18px 40px -22px rgba(168, 135, 74, .55);

    --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, 'Times New Roman', serif;

    --ease: cubic-bezier(.22, .61, .36, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-ui);
    color: var(--text);
    background: var(--ivory);
    font-feature-settings: "ss01" 1, "cv11" 1;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(192, 160, 98, .28); color: var(--ink); }

h1, h2, h3, h4 { letter-spacing: -0.01em; }

h1, .display {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -0.015em;
}

a { color: inherit; }

.dashboard-app {
    background:
        radial-gradient(1100px 520px at 84% -12%, rgba(192, 160, 98, .16), transparent 62%),
        radial-gradient(760px 420px at 4% 104%, rgba(27, 39, 64, .07), transparent 60%),
        var(--ivory);
    background-attachment: fixed;
}

/* --------------------------------------------------------------------------
   Sidebar — squared executive rail (v3)
   No rounded shapes: full-height ink rail, gold hairlines, 2px active marker.
   -------------------------------------------------------------------------- */

.sidebar {
    width: 276px;
    flex: 0 0 276px;
    padding: 0;
    height: 100vh;
    background: transparent;
}

.sidebar-inner {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0;
    border-radius: 0;
    background:
        radial-gradient(340px 220px at 110% -8%, rgba(192, 160, 98, .13), transparent 62%),
        linear-gradient(180deg, #0B1322 0%, #0A111E 52%, #070D18 100%);
    border: 0;
    border-right: 1px solid rgba(192, 160, 98, .22);
    box-shadow: none;
    color: #EDE8DE;
    overflow: hidden;
}

.sidebar-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px);
    background-size: 100% 44px;
    opacity: .55;
    pointer-events: none;
}

.sidebar-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-brand::after {
    content: "";
    position: absolute;
    left: 20px;
    bottom: -1px;
    width: 42px;
    height: 1px;
    background: var(--gold);
    opacity: .8;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 0;
    background: transparent;
    border: 1px solid rgba(192, 160, 98, .55);
    color: #E4CFA3;
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 400;
    line-height: 1;
    box-shadow: none;
}

.sidebar-logo-image {
    background: #fff;
    padding: 4px;
    border-color: rgba(192, 160, 98, .35);
    box-shadow: none;
}

.sidebar-brand strong {
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: .015em;
    color: #F6F1E7;
}

.sidebar-brand span {
    display: block;
    margin-top: 3px;
    color: rgba(237, 232, 222, .42);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.sidebar-nav {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 10px 0 18px;
    margin: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .14) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 0; }

.sidebar-section-caption {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 20px 8px;
    color: rgba(240, 235, 226, .40);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .26em;
    text-transform: uppercase;
}

.sidebar-section-caption::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: linear-gradient(90deg, rgba(192, 160, 98, .38), rgba(192, 160, 98, 0));
}

.sidebar-nav > .sidebar-section-caption:first-child { margin-top: 8px; }

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 10px 20px;
    border-radius: 0;
    border-left: 2px solid transparent;
    color: rgba(240, 235, 226, .74);
    font-size: 12.8px;
    line-height: 1.35;
    font-weight: 450;
    letter-spacing: .008em;
    transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}

.sidebar-link > span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 0;
    background: transparent;
    border: 0;
    color: rgba(237, 232, 222, .48);
    transition: color .2s var(--ease), transform .2s var(--ease);
}

.sidebar-link svg { width: 15px; height: 15px; stroke-width: 1.4; }

.sidebar-link:hover {
    background: rgba(255, 255, 255, .035);
    border-left-color: rgba(192, 160, 98, .5);
    color: #FBF7EE;
}

.sidebar-link:hover > span:first-child {
    color: var(--gold-2);
    border-color: transparent;
    background: transparent;
    transform: none;
}

.sidebar-link:focus-visible,
.sidebar-section-toggle:focus-visible {
    outline: 1px solid var(--gold);
    outline-offset: -3px;
}

.sidebar-link-active,
.sidebar-link-active:hover {
    background: linear-gradient(90deg, rgba(192, 160, 98, .15) 0%, rgba(192, 160, 98, .04) 62%, transparent 100%);
    border-left-color: var(--gold);
    color: #FFFDF7;
    font-weight: 600;
    box-shadow: none;
}

.sidebar-link-active::after {
    content: "";
    position: absolute;
    right: 20px;
    top: 50%;
    width: 4px;
    height: 4px;
    margin-top: -2px;
    background: var(--gold);
}

.sidebar-link-active > span:first-child {
    background: transparent;
    border-color: transparent;
    color: var(--gold-2);
}

.sidebar-collapse-group { display: block; }

.sidebar-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0;
    padding: 12px 20px;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: rgba(240, 235, 226, .56);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}

.sidebar-section-toggle:hover,
.sidebar-section-toggle-active {
    color: var(--gold-2);
    background: rgba(255, 255, 255, .03);
    border-left-color: rgba(192, 160, 98, .45);
}

.sidebar-section-toggle strong {
    font-size: 14px;
    font-weight: 300;
    line-height: 1;
    opacity: .75;
}

.sidebar-collapse-content {
    display: grid;
    gap: 0;
    margin: 2px 0 6px 20px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-collapse-content .sidebar-link {
    min-height: 38px;
    padding: 9px 12px;
    font-size: 12.2px;
}

.sidebar-collapse-content .sidebar-link-active::after { right: 12px; }

.sidebar-card {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 15px 20px 18px;
    border-radius: 0;
    background: rgba(255, 255, 255, .025);
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-card p {
    margin: 0;
    color: rgba(237, 232, 222, .38);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.sidebar-card strong {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 7px;
    color: #F3EEE4;
    font-size: 12.5px;
    font-weight: 500;
}

.sidebar-card strong::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 0;
    background: #5EC79B;
    box-shadow: 0 0 0 3px rgba(94, 199, 155, .14);
    animation: pc-pulse 2.6s var(--ease) infinite;
}

.sidebar-card span {
    display: block;
    margin-top: 4px;
    padding-left: 13px;
    color: rgba(237, 232, 222, .34);
    font-size: 10px;
    letter-spacing: .07em;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.dashboard-main { min-width: 0; }

.dashboard-header {
    min-height: 76px;
    padding: 16px 38px;
    gap: 20px;
    background: rgba(247, 244, 238, .82);
    backdrop-filter: saturate(140%) blur(16px);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    border-bottom: 1px solid rgba(230, 224, 211, .8);
}

.dashboard-header.is-scrolled {
    min-height: 66px;
    box-shadow: 0 18px 40px -34px rgba(11, 18, 32, .55);
}

.header-crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.header-crumbs i {
    width: 3px;
    height: 3px;
    border-radius: 99px;
    background: var(--gold);
    font-style: normal;
}

.header-page-title {
    margin: 5px 0 0;
    font-family: var(--font-display);
    font-size: 25px;
    line-height: 1;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.dashboard-header h3 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.mobile-menu-button {
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    width: 42px;
    height: 42px;
    box-shadow: var(--sh-1);
}

.mobile-menu-button span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--ink);
    border-radius: 99px;
    margin: 2px 0;
}

.language-select-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 11px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .7);
    border: 1px solid var(--line);
    transition: border-color .25s var(--ease), background .25s var(--ease);
}

.language-select-card:hover { border-color: var(--gold-line); background: #fff; }

.language-icon { font-size: 12px; opacity: .55; filter: grayscale(1); }

.language-current { display: flex; flex-direction: column; line-height: 1.05; }

.language-current strong {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--ink);
}

.language-current small { display: none; }

.language-select {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line);
    transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}

.user-menu-button:hover { border-color: var(--gold-line); box-shadow: var(--sh-1); }

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 999px;
    background: linear-gradient(150deg, #1B2740, #0B1220);
    color: #EBDCBB;
    font-family: var(--font-display);
    font-size: 15px;
    border: 1px solid rgba(192, 160, 98, .35);
}

.user-menu-info { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }

.user-menu-info strong { font-size: 12px; font-weight: 600; color: var(--ink); }

.user-menu-info span {
    max-width: 158px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted-2);
    font-size: 10.5px;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 40;
    min-width: 214px;
    padding: 7px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--sh-2);
}

.user-dropdown a {
    display: block;
    padding: 9px 11px;
    border-radius: 10px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 500;
    transition: background .18s var(--ease);
}

.user-dropdown a:hover { background: var(--ivory); }

.user-dropdown hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--line-soft); }

.dashboard-content { padding: 30px 38px 8px; max-width: 1420px; }

.page-section { display: grid; gap: 18px; }

/* --------------------------------------------------------------------------
   Page heading
   -------------------------------------------------------------------------- */

.page-heading { padding: 4px 2px 6px; }

.page-heading p {
    color: var(--gold-deep);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.page-heading h2 {
    margin: 8px 0 0;
    font-family: var(--font-display);
    font-size: clamp(30px, 3vw, 40px);
    line-height: 1.02;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.015em;
}

.page-heading span {
    display: block;
    margin-top: 9px;
    color: var(--muted);
    font-size: 13.5px;
    max-width: 62ch;
}

.page-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.page-actions-row { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   Panels & cards
   -------------------------------------------------------------------------- */

.panel-card,
.filters-card,
.client-company-profile-card,
.client-recent-events-card,
.mini-form-card,
.event-participant-form-card,
.portal-form-card,
.rfp-form,
.danger-panel {
    position: relative;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: 24px;
    transition: box-shadow .35s var(--ease), border-color .35s var(--ease), transform .35s var(--ease);
}

.panel-card:hover,
.client-recent-events-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--sh-2);
}

.panel-card h2, .panel-card h3 {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--ink);
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}

.section-header h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.section-header p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; max-width: 70ch; }

.section-header-spaced { margin-top: 26px; }

.form-section-title {
    color: var(--gold-deep);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.stats-grid-small { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat-card {
    position: relative;
    min-height: 138px;
    padding: 20px 22px;
    border-radius: var(--r-lg);
    background: linear-gradient(166deg, #FFFFFF 0%, #FDFBF6 100%);
    border: 1px solid var(--line);
    box-shadow: var(--sh-1);
    overflow: hidden;
    transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s var(--ease);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -70px;
    width: 150px;
    height: 150px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(192, 160, 98, .10), transparent 66%);
    transition: transform .5s var(--ease);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--gold-line);
    box-shadow: 0 26px 60px -30px rgba(11, 18, 32, .3);
}

.stat-card:hover::after { transform: scale(1.18); }

.stat-label {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.stat-card strong {
    margin-top: 16px;
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 400;
    line-height: .95;
    color: var(--ink);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.stat-card small { margin-top: 10px; color: var(--muted-2); font-size: 11.5px; font-weight: 400; }

.stat-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--ivory);
    border: 1px solid var(--line-soft);
    color: var(--gold-deep);
}

.stat-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.stat-icon-blue, .stat-icon-green, .stat-icon-amber, .stat-icon-indigo { color: var(--gold-deep); background: var(--gold-soft); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-compact,
.btn-table,
.btn-table-primary,
.btn-light,
.mini-action-btn,
.mini-action-primary,
.danger-button,
button[type="submit"].btn-primary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 12px;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .01em;
    padding: 11px 18px;
    min-height: 42px;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(155deg, #16203A 0%, #0B1220 100%);
    color: #F7F2E6;
    box-shadow: 0 16px 34px -20px rgba(11, 18, 32, .85), inset 0 1px 0 rgba(255, 255, 255, .08);
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(232, 214, 172, .38) 48%, transparent 74%);
    transform: translateX(-120%);
    transition: transform .7s var(--ease);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 40px -20px rgba(11, 18, 32, .9), 0 0 0 1px rgba(192, 160, 98, .35) inset;
    color: #FFF9EC;
}

.btn-primary:hover::after { transform: translateX(120%); }

.btn-secondary,
.btn-light {
    background: #fff;
    color: var(--ink);
    border-color: var(--line-strong);
}

.btn-secondary:hover,
.btn-light:hover {
    border-color: var(--gold);
    color: var(--gold-deep);
    background: #FFFDF8;
    transform: translateY(-1px);
}

.btn-compact { min-height: 36px; padding: 8px 14px; font-size: 12px; }

.btn-table,
.btn-table-primary {
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 11.5px;
    background: var(--ivory);
    border-color: var(--line-soft);
    color: var(--ink);
    box-shadow: none;
}

.btn-table:hover { background: #fff; border-color: var(--gold-line); color: var(--gold-deep); }

.btn-table-primary { background: var(--ink); color: #F7F2E6; }
.btn-table-primary:hover { background: #16203A; color: #FFF9EC; }

.mini-action-btn, .mini-action-primary, .mini-action-danger {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 8px;
    background: var(--ivory);
    border: 1px solid var(--line-soft);
    color: var(--ink);
}

.mini-action-primary { background: var(--ink); color: #F7F2E6; }

.mini-action-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(142, 59, 59, .18); }

.danger-button { background: var(--danger-soft); color: var(--danger); border-color: rgba(142, 59, 59, .2); }

.danger-button:hover { background: var(--danger); color: #fff; }

button:disabled, .btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-group { gap: 7px; }

.form-group label,
.form-field label {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #FDFCF9;
    color: var(--text);
    font-size: 13px;
    font-weight: 450;
    transition: border-color .22s var(--ease), box-shadow .22s var(--ease), background .22s var(--ease);
}

.form-group textarea, .form-field textarea { padding: 11px 13px; min-height: 110px; }

.form-group input::placeholder,
.form-group textarea::placeholder { color: #B4AE9F; }

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--line-strong); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    background: #fff;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(192, 160, 98, .14);
}

.form-group input[type="checkbox"], .form-group input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--gold-deep); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-one { grid-template-columns: 1fr; }
.form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.compact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.muted-helper { color: var(--muted-2); font-size: 11.5px; }
.settings-note { padding: 12px 14px; border-radius: 12px; background: var(--ivory); border: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }

.toggle-switch input { accent-color: var(--gold-deep); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrapper {
    overflow-x: auto;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-soft);
    background: #fff;
}

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 11px 16px;
    background: #F8F5EE;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody td:first-child { white-space: normal; min-width: 170px; }

.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table tbody tr { transition: background .2s var(--ease); }

.data-table tbody tr:hover { background: #FCFAF5; }

.data-table strong { font-weight: 600; }

.data-table td > strong.block { display: inline; }
.data-table td > strong.block + span { display: inline; margin-left: 7px; color: var(--muted-2); }
.data-table td > strong.block + span::before { content: "→ "; opacity: .6; }

.table-actions { display: flex; flex-direction: row; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.table-actions-inline { display: inline-flex; gap: 6px; }

.data-table { min-width: 860px; }
.data-table thead th:first-child { border-top-left-radius: var(--r-sm); }
.data-table thead th:last-child { border-top-right-radius: var(--r-sm); }

.table-user { display: flex; align-items: center; gap: 10px; }

.table-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 10px;
    background: var(--ivory);
    border: 1px solid var(--line);
    color: var(--gold-deep);
    font-family: var(--font-display);
    font-size: 14px;
}

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }

.table-search input {
    min-width: 260px;
    min-height: 40px;
    padding: 0 13px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #FDFCF9;
    font-size: 12.5px;
}

/* --------------------------------------------------------------------------
   Badges / statuses
   -------------------------------------------------------------------------- */

.badge,
.event-status-badge,
.document-visibility {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.6;
    border: 1px solid transparent;
    white-space: nowrap;
}

.event-status-badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 99px;
    background: currentColor;
    opacity: .75;
}

.badge-green,
.event-status-confirmed,
.event-status-completed,
.event-status-published,
.event-status-available,
.document-visibility-client { background: var(--ok-soft); color: var(--ok); border-color: rgba(37, 107, 82, .14); }

.badge-blue,
.event-status-in_operation,
.event-status-travel_booked,
.event-status-ticket_issued { background: var(--info-soft); color: var(--info); border-color: rgba(46, 74, 107, .14); }

.badge-gray,
.event-status-created,
.event-status-pending,
.event-status-new_request,
.event-status-draft,
.document-visibility-internal { background: #F2EFE8; color: #6B6558; border-color: rgba(107, 101, 88, .12); }

.badge-red,
.event-status-cancelled,
.event-status-lost,
.event-status-rejected,
.document-visibility-private { background: var(--danger-soft); color: var(--danger); border-color: rgba(142, 59, 59, .14); }

.event-status-option_held,
.event-status-proposal_in_progress,
.event-status-proposal_sent,
.event-status-qualification,
.event-status-invited,
.event-status-pending_confirmation,
.event-status-hotel_confirmed,
.event-status-documents_pending,
.event-status-open_for_request { background: var(--warn-soft); color: var(--warn); border-color: rgba(138, 100, 32, .14); }

.status-dot-green, .status-dot-red {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 99px;
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(37, 107, 82, .14);
}

.status-dot-red { background: var(--danger); box-shadow: 0 0 0 3px rgba(142, 59, 59, .14); }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 16px;
    font-size: 12.5px;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(142, 59, 59, .16); }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: rgba(37, 107, 82, .16); }

/* --------------------------------------------------------------------------
   Pharma cards (congresses, packages, rfp, documents)
   -------------------------------------------------------------------------- */

.congress-card-grid,
.package-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(286px, 1fr));
    gap: 16px;
}

.congress-card,
.package-card,
.rfp-card,
.request-file-card,
.integration-provider-card,
.client-event-row {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .45s var(--ease);
}

.congress-card::before,
.package-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 0%), rgba(192, 160, 98, .14), transparent 60%);
    opacity: 0;
    transition: opacity .45s var(--ease);
    pointer-events: none;
    z-index: 3;
}

.congress-card:hover,
.package-card:hover,
.rfp-card:hover,
.integration-provider-card:hover {
    transform: translateY(-5px);
    border-color: var(--gold-line);
    box-shadow: 0 34px 70px -34px rgba(11, 18, 32, .38);
}

.congress-card:hover::before,
.package-card:hover::before { opacity: 1; }

.congress-card-image,
.congress-hero-image {
    position: relative;
    height: 168px;
    overflow: hidden;
    background: linear-gradient(150deg, #E9E2D3, #D9D0BB);
}

.congress-card-image img,
.congress-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.1s var(--ease);
}

.congress-card:hover .congress-card-image img { transform: scale(1.06); }

.congress-card-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11, 18, 32, 0) 40%, rgba(11, 18, 32, .34) 100%);
    pointer-events: none;
}

.congress-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(150deg, #1B2740, #0B1220);
    color: rgba(235, 220, 187, .8);
    font-family: var(--font-display);
    font-size: 46px;
}

.congress-card-body,
.package-card-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 19px 19px; }

.congress-card-body h3,
.package-card h3 {
    margin: 2px 0 0;
    font-family: var(--font-display);
    font-size: 21px;
    line-height: 1.14;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.congress-card-body p,
.package-card p { margin: 0; color: var(--muted); font-size: 12px; }

.congress-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    padding-top: 11px;
    border-top: 1px solid var(--line-soft);
    color: var(--muted-2);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: .04em;
}

.congress-price,
.package-price {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 400;
    color: #7E6229;
    letter-spacing: -0.01em;
}

.congress-card-body .table-actions { margin-top: 10px; justify-content: flex-start; }
.congress-card-body > .btn-primary,
.congress-card-body > .btn-secondary { margin-top: 8px; }

.congress-hero {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 26px;
    align-items: center;
    padding: 30px 32px;
    border-radius: var(--r-lg);
    background:
        radial-gradient(520px 320px at 92% -20%, rgba(192, 160, 98, .28), transparent 62%),
        linear-gradient(150deg, #0C1424, #16223A);
    border: 1px solid rgba(255, 255, 255, .07);
    box-shadow: var(--sh-2);
    overflow: hidden;
}

.congress-hero:not(:has(.congress-hero-image img)) { grid-template-columns: 1fr; }
.congress-hero:not(:has(.congress-hero-image img)) .congress-hero-image { display: none; }
.congress-hero:not(:has(.congress-hero-image img)) .congress-hero-content { max-width: 74ch; }

.congress-hero-content { color: #EDE8DE; }
.congress-hero-content h1, .congress-hero-content h2 { color: #FBF6EA; font-family: var(--font-display); font-weight: 400; }
.congress-hero-content p { color: rgba(237, 232, 222, .68); }
.congress-hero-image { height: 100%; min-height: 220px; border-radius: var(--r-md); }

.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.details-grid > :only-child { grid-column: 1 / -1; }

.details-list { display: grid; gap: 12px; }

.details-list > div,
.client-company-profile-grid > div {
    padding: 12px 14px;
    border-radius: 10px;
    background: #FBF9F4;
    border: 1px solid transparent;
    border-left: 2px solid var(--gold-line);
}

.details-list span,
.client-company-profile-grid span {
    display: block;
    color: var(--muted-2);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.details-list strong,
.client-company-profile-grid strong {
    display: block;
    margin-top: 5px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
}

.client-company-profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

/* --------------------------------------------------------------------------
   Client dashboard hero
   -------------------------------------------------------------------------- */

.client-dashboard-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 4px;
    padding: 30px 30px 28px;
    border-radius: var(--r-xl);
    color: #F4EFE4;
    background:
        radial-gradient(620px 300px at 88% -30%, rgba(192, 160, 98, .34), transparent 62%),
        linear-gradient(150deg, #0B1220 0%, #131E33 58%, #0E1729 100%);
    border: 1px solid rgba(255, 255, 255, .07);
    box-shadow: var(--sh-2);
}

.client-dashboard-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -120px;
    width: 340px;
    height: 340px;
    border-radius: 999px;
    border: 1px solid rgba(192, 160, 98, .22);
    pointer-events: none;
}

.client-dashboard-hero h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(26px, 2.6vw, 36px);
    font-weight: 400;
    line-height: 1.08;
    color: #FBF6EA;
    letter-spacing: -0.01em;
    max-width: 26ch;
}

.client-dashboard-hero-actions { display: flex; flex-wrap: wrap; gap: 9px; position: relative; z-index: 1; }

.dashboard-app .client-dashboard-hero-actions a,
.dashboard-app .client-dashboard-hero-actions .btn-primary,
.dashboard-app .client-dashboard-hero-actions .btn-secondary {
    border-radius: 999px;
    padding: 10px 17px;
    min-height: 40px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, .24) !important;
    background: rgba(255, 255, 255, .07) !important;
    color: #F7F2E4 !important;
    backdrop-filter: blur(6px);
}

.dashboard-app .client-dashboard-hero-actions a:hover {
    background: linear-gradient(120deg, #E8D6AC, #C0A062) !important;
    color: #10182A !important;
    border-color: transparent !important;
    transform: translateY(-1px);
}

/* first action reads as the primary route */
.dashboard-app .client-dashboard-hero-actions a:first-child {
    background: linear-gradient(120deg, #EBD9AF, #C0A062) !important;
    border-color: transparent !important;
    color: #10182A !important;
    font-weight: 700;
    box-shadow: 0 14px 30px -18px rgba(192, 160, 98, .9) !important;
}

.dashboard-app .client-dashboard-hero-actions a:first-child:hover {
    background: linear-gradient(120deg, #F4E6C6, #D3B273) !important;
}

.client-events-list { display: grid; gap: 9px; }

.client-event-row {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 13px 16px;
    border-radius: var(--r-md);
    box-shadow: none;
    background: #FDFCF9;
}

.client-event-row:hover { transform: translateX(2px); border-color: var(--gold-line); background: #fff; box-shadow: var(--sh-1); }

.client-event-main { display: flex; align-items: center; gap: 12px; flex: 1 1 34%; min-width: 0; }
.client-event-main strong { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.client-event-main span { color: var(--muted-2); font-size: 11px; }

.event-logo-thumb {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 11px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
}

.event-logo-thumb img { width: 100%; height: 100%; object-fit: contain; }

.client-event-meta { flex: 0 1 15%; min-width: 90px; }
.client-event-meta span { display: block; color: var(--muted-2); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; }
.client-event-meta strong { display: block; margin-top: 3px; font-size: 12px; font-weight: 500; color: var(--text); }

.client-event-actions { display: flex; gap: 6px; }
.client-event-actions a { border-radius: 9px !important; }

/* --------------------------------------------------------------------------
   Documents, files, misc lists
   -------------------------------------------------------------------------- */

.document-list { display: grid; gap: 8px; }

.document-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-soft);
    background: #FDFCF9;
    transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}

.document-row:hover { border-color: var(--gold-line); background: #fff; transform: translateY(-1px); }

.document-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    background: var(--gold-soft);
    color: var(--gold-deep);
    font-size: 13px;
}

.document-main { flex: 1; min-width: 0; }
.document-main strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.document-meta { color: var(--muted-2); font-size: 11px; }

.document-actions { display: flex; gap: 6px; align-items: center; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 30px 22px;
    border-radius: var(--r-md);
    border: 1px solid var(--line-soft);
    background: #FCFAF5;
    text-align: center;
}

.empty-state strong { font-family: var(--font-display); font-size: 18px; font-weight: 400; color: var(--ink); }
.empty-state span { color: var(--muted); font-size: 12px; max-width: 46ch; }

.compact-empty-state { padding: 24px; text-align: center; color: var(--muted); font-size: 12px; }

.activity-list { display: grid; gap: 8px; }

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #FDFCF9;
    border: 1px solid var(--line-soft);
}

.api-card-link, .api-module-item, .api-status-item, .integration-provider-card, .settings-toggle-card {
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: #fff;
    padding: 16px;
    box-shadow: var(--sh-1);
}

.integration-provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.prose-box { line-height: 1.75; color: var(--text); font-size: 13.5px; }
.prose-box p + p { margin-top: 12px; }

.dashboard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 26px 38px 0;
    padding: 16px 2px 22px;
    border-top: 1px solid var(--line-soft);
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Tailwind bridge — keeps the inline utility classes on the new palette
   -------------------------------------------------------------------------- */

.dashboard-app .bg-indigo-600,
.dashboard-app .bg-indigo-700 { background: var(--ink) !important; }

.dashboard-app .bg-indigo-50,
.dashboard-app .bg-indigo-100 { background: var(--gold-soft) !important; }

.dashboard-app .text-indigo-700,
.dashboard-app .text-indigo-600,
.dashboard-app .text-indigo-900 { color: var(--gold-deep) !important; }

.dashboard-app .border-indigo-200,
.dashboard-app .border-indigo-300 { border-color: var(--gold-line) !important; }

.dashboard-app .shadow-indigo-600\/20 { box-shadow: 0 16px 34px -22px rgba(11, 18, 32, .7) !important; }

.dashboard-app .bg-emerald-50 { background: var(--ok-soft) !important; }
.dashboard-app .text-emerald-700 { color: var(--ok) !important; }
.dashboard-app .border-emerald-100,
.dashboard-app .border-emerald-200 { border-color: rgba(37, 107, 82, .18) !important; }

.dashboard-app .bg-violet-50 { background: var(--info-soft) !important; }
.dashboard-app .text-violet-700 { color: var(--info) !important; }
.dashboard-app .border-violet-200 { border-color: rgba(46, 74, 107, .18) !important; }

.dashboard-app .bg-slate-900 { background: var(--ink) !important; }
.dashboard-app .bg-slate-800 { background: var(--ink-2) !important; }
.dashboard-app .text-slate-900 { color: var(--ink) !important; }
.dashboard-app .text-slate-700 { color: #3D4238 !important; }
.dashboard-app .text-slate-500,
.dashboard-app .text-slate-400 { color: var(--muted-2) !important; }
.dashboard-app .bg-slate-50,
.dashboard-app .bg-slate-100 { background: var(--ivory) !important; }
.dashboard-app .border-slate-200,
.dashboard-app .border-slate-100 { border-color: var(--line) !important; }
.dashboard-app .border-slate-300 { border-color: var(--line-strong) !important; }

.dashboard-app .bg-rose-50 { background: var(--danger-soft) !important; }
.dashboard-app .text-rose-700 { color: var(--danger) !important; }
.dashboard-app .bg-rose-600, .dashboard-app .bg-rose-700 { background: var(--danger) !important; }
.dashboard-app .border-rose-100 { border-color: rgba(142, 59, 59, .16) !important; }

.dashboard-app .bg-amber-50 { background: var(--warn-soft) !important; }
.dashboard-app .text-amber-700 { color: var(--warn) !important; }
.dashboard-app .border-amber-100 { border-color: rgba(138, 100, 32, .16) !important; }

.dashboard-app .rounded-2xl { border-radius: 13px !important; }
.dashboard-app .rounded-xl { border-radius: 10px !important; }
.dashboard-app .shadow-sm { box-shadow: var(--sh-1) !important; }
.dashboard-app .font-extrabold { font-weight: 600 !important; }

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

[data-pc-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
    transition-delay: var(--pc-delay, 0ms);
}

[data-pc-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    [data-pc-reveal] { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
    .stats-grid, .stats-grid-small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-content { padding: 24px 24px 8px; }
    .dashboard-header { padding: 14px 24px; }
    .dashboard-footer { margin: 22px 24px 0; }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        width: 288px;
        padding: 12px;
        transform: translateX(-102%);
        transition: transform .4s var(--ease-out);
        background: rgba(11, 18, 32, .45);
        backdrop-filter: blur(4px);
    }

    .sidebar-open { transform: none; }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(11, 18, 32, .4);
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s var(--ease);
    }

    .sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

    .sidebar-inner { height: 100%; border-radius: 0; }

    .mobile-menu-button { display: flex; flex-direction: column; justify-content: center; }

    .congress-hero { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .stats-grid, .stats-grid-small { grid-template-columns: 1fr; }
    .form-grid, .form-grid-two { grid-template-columns: 1fr; }
    .dashboard-content { padding: 18px 16px 6px; }
    .dashboard-header { padding: 12px 16px; min-height: 64px; }
    .dashboard-footer { margin: 18px 16px 0; flex-direction: column; align-items: flex-start; gap: 4px; }
    .user-menu-info { display: none; }
    .congress-card-grid, .package-card-grid { grid-template-columns: 1fr; }
    .client-event-row { flex-wrap: wrap; gap: 10px; }
    .client-event-meta { flex: 1 1 40%; }
    .page-heading h2 { font-size: 30px; }
}

/* Keep quoted panels readable on the dark hero */
.client-dashboard-hero .inline-flex { font-weight: 600; }

/* ==========================================================================
   Authentication — exclusive business entry
   ========================================================================== */

body:has(.auth-shell) {
    background: #070C16;
}

.auth-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background:
        radial-gradient(900px 600px at 12% -10%, rgba(192, 160, 98, .16), transparent 58%),
        radial-gradient(700px 500px at 92% 108%, rgba(38, 56, 92, .55), transparent 62%),
        #070C16;
    overflow: hidden;
}

.auth-aurora {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .55;
    will-change: transform;
}

.auth-orb-1 {
    width: 520px;
    height: 520px;
    top: -160px;
    left: -120px;
    background: radial-gradient(circle, rgba(192, 160, 98, .55), transparent 66%);
    animation: auth-float-a 22s ease-in-out infinite;
}

.auth-orb-2 {
    width: 620px;
    height: 620px;
    bottom: -260px;
    right: -180px;
    background: radial-gradient(circle, rgba(63, 92, 140, .55), transparent 66%);
    animation: auth-float-b 26s ease-in-out infinite;
}

.auth-orb-3 {
    width: 420px;
    height: 420px;
    top: 42%;
    left: 46%;
    background: radial-gradient(circle, rgba(216, 190, 134, .22), transparent 70%);
    animation: auth-float-c 20s ease-in-out infinite;
}

.auth-grain {
    position: absolute;
    inset: 0;
    opacity: .32;
    background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px);
    background-size: 3px 3px;
    mix-blend-mode: overlay;
}

@keyframes auth-float-a {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(60px, 40px, 0) scale(1.08); }
}

@keyframes auth-float-b {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(-70px, -50px, 0) scale(1.06); }
}

@keyframes auth-float-c {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .5; }
    50% { transform: translate3d(-40px, 30px, 0) scale(1.14); opacity: .8; }
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, 100%);
    min-height: 660px;
    display: grid;
    grid-template-columns: 1.06fr .94fr;
    border-radius: 30px;
    overflow: hidden;
    background: #FAF7F1;
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 60px 140px -60px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .04);
    animation: auth-shell-in .9s var(--ease-out) both;
}

@keyframes auth-shell-in {
    from { opacity: 0; transform: translateY(18px) scale(.994); }
    to { opacity: 1; transform: none; }
}

.auth-brand-panel {
    position: relative;
    padding: 52px 52px 46px;
    color: #EFE9DC;
    background:
        radial-gradient(620px 420px at 100% 0%, rgba(192, 160, 98, .28), transparent 60%),
        linear-gradient(158deg, #0B1220 0%, #101A2C 52%, #0A101C 100%);
    overflow: hidden;
}

.auth-brand-panel::before {
    content: "";
    position: absolute;
    width: 620px;
    height: 620px;
    right: -300px;
    bottom: -340px;
    border-radius: 50%;
    border: 1px solid rgba(192, 160, 98, .22);
    box-shadow: 0 0 0 60px rgba(192, 160, 98, .04), 0 0 0 140px rgba(192, 160, 98, .025);
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 3px 3px;
    opacity: .5;
    pointer-events: none;
}

.auth-brand-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 34px;
    height: 100%;
}

.auth-brand-top { display: flex; align-items: center; gap: 13px; }

.auth-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(150deg, #EBD9AF, #C0A062 58%, #9E7E42);
    border: 1px solid rgba(255, 255, 255, .28);
    box-shadow: 0 14px 30px -14px rgba(192, 160, 98, .85), inset 0 1px 0 rgba(255, 255, 255, .5);
    color: #10182A;
}

.auth-logo span {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 400;
}

.auth-logo-image { background: #fff; padding: 6px; }
.auth-logo-image img { width: 100%; height: 100%; object-fit: contain; }

.auth-brand-word {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: rgba(239, 233, 220, .82);
}

.auth-brand-copy { margin-top: auto; }

.auth-kicker {
    margin: 0 0 16px;
    color: var(--gold-2);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .26em;
    text-transform: uppercase;
}

.auth-brand-panel h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(44px, 4.6vw, 64px);
    line-height: .96;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: #FBF6EA;
}

.auth-brand-panel h1 em {
    font-style: italic;
    color: #E2C68C;
}

.auth-description {
    max-width: 42ch;
    margin: 22px 0 0;
    color: rgba(239, 233, 220, .62);
    font-size: 14px;
    line-height: 1.75;
    font-weight: 300;
}

.auth-features {
    display: grid;
    gap: 0;
    margin-top: 34px;
    border-top: 1px solid rgba(255, 255, 255, .09);
}

.auth-features div {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    color: rgba(239, 233, 220, .74);
    font-size: 12.5px;
    font-weight: 400;
}

.auth-features span {
    width: auto;
    height: auto;
    flex: 0 0 26px;
    background: none;
    box-shadow: none;
    border-radius: 0;
    color: var(--gold-2);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .16em;
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 44px;
    background:
        radial-gradient(520px 360px at 110% -10%, rgba(192, 160, 98, .12), transparent 62%),
        #FAF7F1;
    border-left: 1px solid rgba(11, 18, 32, .06);
}

.auth-form-wrapper {
    width: min(392px, 100%);
    animation: auth-fade-up .8s var(--ease-out) .15s both;
}

@keyframes auth-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.login-card { width: 100%; }

.login-heading { margin-bottom: 26px; }

.login-heading p {
    margin: 0;
    color: #7E6229;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.login-heading h2 {
    margin: 10px 0 0;
    font-family: var(--font-display);
    font-size: 40px;
    line-height: 1;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.015em;
}

.login-heading span {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.login-form { display: grid; gap: 15px; }

.login-form .form-group { gap: 8px; }

.login-form .form-group input {
    min-height: 50px;
    border-radius: 12px;
    background: #fff;
    font-size: 13.5px;
}

.password-field { position: relative; }

.password-field input { padding-right: 74px; }

.password-field button {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    padding: 0 11px;
    border-radius: 9px;
    background: #fff;
    border: 1px solid var(--line-strong);
    color: #6B5218;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: background .2s var(--ease), border-color .2s var(--ease);
}

.password-field button:hover { background: #fff; border-color: var(--gold-line); }

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12.5px;
}

.login-options label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.login-options input { width: 16px; height: 16px; accent-color: var(--gold-deep); }

.login-options a {
    color: #6B5218;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(107, 82, 24, .3);
}
.login-options a:hover { text-decoration: underline; text-underline-offset: 3px; }

.login-submit {
    width: 100%;
    min-height: 50px;
    margin-top: 4px;
    border-radius: 12px;
    font-size: 12.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.login-footer-note {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    background: none;
    border-radius: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: left;
}

.login-footer-note strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }

.auth-trust {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-trust-dot {
    width: 5px;
    height: 5px;
    border-radius: 99px;
    background: #3E9B77;
    box-shadow: 0 0 0 3px rgba(62, 155, 119, .15);
}

@media (max-width: 1000px) {
    .auth-shell { grid-template-columns: 1fr; min-height: 0; }
    .auth-brand-panel { padding: 34px 32px 30px; }
    .auth-brand-copy { margin-top: 12px; }
    .auth-features { margin-top: 22px; }
    .auth-brand-panel h1 { font-size: 42px; }
    .auth-form-panel { padding: 34px 32px 38px; }
    .auth-brand-panel::before { display: none; }
}

@media (max-width: 560px) {
    .auth-page { padding: 14px; }
    .auth-shell { border-radius: 22px; }
    .auth-brand-panel { display: none; }
    .auth-form-panel { padding: 30px 22px 32px; }
    .login-heading h2 { font-size: 34px; }
}

/* ------------------------------------------------------------------
   Auth – language switcher (EN / FR)
   ------------------------------------------------------------------ */
.auth-form-panel { position: relative; }

.auth-locale {
    position: absolute;
    top: 20px;
    right: 22px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(11, 18, 32, .05);
    border: 1px solid rgba(11, 18, 32, .09);
    backdrop-filter: blur(8px);
}

.auth-locale-option {
    min-width: 42px;
    padding: 7px 11px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-align: center;
    text-decoration: none;
    transition: background .25s var(--ease-out), color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}

.auth-locale-option:hover { color: var(--ink); background: rgba(255, 255, 255, .75); }

.auth-locale-option.is-active,
.auth-locale-option[aria-current="true"] {
    background: var(--ink);
    color: #F5F0E6;
    box-shadow: 0 6px 16px rgba(11, 18, 32, .22);
}

@media (max-width: 560px) {
    .auth-locale { top: 14px; right: 14px; }
    .auth-locale-option { min-width: 38px; padding: 6px 9px; }
    .auth-form-wrapper { padding-top: 26px; }
}

/* ==========================================================================
   Layout integrity — no page may scroll horizontally
   The single-column grid tracks of .page-section were sized to max-content,
   so any wide table or long action row pushed the whole shell sideways.
   ========================================================================== */

.dashboard-app,
.dashboard-main,
.dashboard-content,
.dashboard-header,
.page-section,
.panel-card,
.dashboard-grid,
.client-portal,
.client-portal > * {
    min-width: 0;
    max-width: 100%;
}

.dashboard-content { width: 100%; }

.page-section { grid-template-columns: minmax(0, 1fr); }
.dashboard-grid { grid-template-columns: minmax(0, 1fr); }

.page-section > *,
.dashboard-grid > *,
.stats-grid > *,
.panel-card > * { min-width: 0; }

.page-heading,
.page-heading-row,
.page-actions-row,
.portal-action-row {
    flex-wrap: wrap;
    min-width: 0;
}

.page-heading > *,
.page-heading-row > *,
.page-actions-row > *,
.portal-action-row > * { min-width: 0; }

.page-heading h2,
.header-page-title,
h1, h2, h3 {
    overflow-wrap: break-word;
}

.table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tables rendered without a .table-wrapper must scroll inside their card,
   not drag the page. */
.panel-card:has(table) {
    overflow-x: auto;
}

.panel-card table:not(.no-min) {
    min-width: 720px;
}

/* Mobile header: the language pill and the user chip used to push the
   header 118–145px past the viewport edge. */
@media (max-width: 760px) {
    .dashboard-header {
        gap: 10px;
        padding: 10px 14px;
        min-height: 60px;
        flex-wrap: nowrap;
    }

    .header-left {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-crumbs { display: none; }

    .header-page-title {
        margin-top: 0;
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-right {
        flex: 0 0 auto;
        gap: 6px;
    }

    .language-select-card {
        padding: 6px 8px;
        gap: 0;
        border-radius: 0;
    }

    .language-icon { display: none; }

    .language-current strong { font-size: 10px; letter-spacing: .08em; }

    .user-menu-button { padding: 4px; gap: 0; border-radius: 0; }

    .mobile-menu-button {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        border-radius: 0;
    }

    .page-actions-row { justify-content: flex-start; }
}

@media (max-width: 420px) {
    .header-page-title { font-size: 16px; }
    .dashboard-content { padding: 14px 12px 6px; }
    .stat-card { padding: 16px; }
}

/* Squared chrome where the shell meets the content (matches the rail). */
.mobile-menu-button,
.language-select-card,
.user-menu-button,
.user-dropdown,
.btn-primary,
.btn-light,
.badge { border-radius: 0; }

/* Keep the focus ring visible and square on the new chrome */
.sidebar-link:focus-visible,
.sidebar-section-toggle:focus-visible,
.mobile-menu-button:focus-visible,
.language-select-card:focus-within {
    outline: 1px solid var(--gold);
    outline-offset: -3px;
}

/* --------------------------------------------------------------------------
   Authentication chrome — squared, hairline, gold marker
   -------------------------------------------------------------------------- */

.auth-shell {
    border-radius: 0;
    border: 1px solid rgba(192, 160, 98, .28);
    box-shadow: 0 70px 150px -70px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .03);
}

.auth-form-panel::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold) 0%, rgba(192, 160, 98, .35) 34%, transparent 72%);
}

.auth-locale,
.auth-locale-option,
.password-field button { border-radius: 0; }

.login-form input,
.login-form select { border-radius: 2px; }

.auth-back-link {
    color: #6B5218;
    font-weight: 600;
    letter-spacing: .01em;
}

.auth-back-link:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 560px) {
    .auth-shell { border-radius: 0; border-left: 0; border-right: 0; }
}

/* --------------------------------------------------------------------------
   Rail polish — wider label lane, readable microcopy, chevron toggles
   -------------------------------------------------------------------------- */

.sidebar { width: 292px; flex: 0 0 292px; }

.sidebar-link,
.sidebar-section-toggle { padding-left: 18px; padding-right: 18px; }

.sidebar-section-caption {
    margin-left: 18px;
    margin-right: 18px;
    font-size: 9.5px;
    color: rgba(240, 235, 226, .55);
}

.sidebar-brand span { color: rgba(237, 232, 222, .52); }
.sidebar-card p { color: rgba(237, 232, 222, .48); }
.sidebar-card span { color: rgba(237, 232, 222, .44); }

.sidebar-link { font-size: 12.7px; line-height: 1.3; }

/* the floating gold square read as a stray dot — the 2px gold bar is enough */
.sidebar-link-active::after { display: none; }

.sidebar-toggle-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: inherit;
    transition: transform .25s var(--ease), color .25s var(--ease);
}

.sidebar-toggle-mark svg { width: 12px; height: 12px; stroke-width: 1.6; }

.sidebar-toggle-mark.is-open { transform: rotate(90deg); color: var(--gold-2); }

/* --------------------------------------------------------------------------
   Login refinement — aligned switcher, integrated controls, anchored trust
   -------------------------------------------------------------------------- */

.auth-form-panel {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 54px 48px 32px;
}

.auth-form-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    justify-content: center;
    min-height: 0;
}

.auth-locale {
    top: 26px;
    right: 48px;
    padding: 0;
    gap: 0;
    border-radius: 0;
    background: transparent;
    border: 1px solid rgba(11, 18, 32, .16);
    overflow: hidden;
    backdrop-filter: none;
}

.auth-locale-option {
    min-width: 44px;
    padding: 8px 12px;
    border-radius: 0;
    color: #6B6455;
    font-size: 10px;
    letter-spacing: .14em;
    box-shadow: none;
}

.auth-locale-option + .auth-locale-option { border-left: 1px solid rgba(11, 18, 32, .12); }

.auth-locale-option.is-active {
    background: #0E1626;
    color: #F6F1E7;
    box-shadow: none;
}

.login-form .form-group input { border-radius: 2px; }

.login-form .form-group input:focus {
    border-color: #B99A5C;
    box-shadow: inset 2px 0 0 #C0A062;
}

.password-field button {
    right: 0;
    height: 30px;
    padding: 0 0 0 13px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: none;
    color: #6B5218;
    font-size: 9.5px;
    letter-spacing: .14em;
}

.password-field button:hover { background: none; border-color: var(--line); color: #0E1626; }

.login-options input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    display: inline-grid;
    place-content: center;
    border: 1px solid #C3BAA5;
    border-radius: 0;
    background: #fff;
    accent-color: transparent;
}

.login-options input[type="checkbox"]:checked {
    background: #0E1626;
    border-color: #0E1626;
}

.login-options input[type="checkbox"]:checked::after {
    content: "";
    width: 7px;
    height: 4px;
    border-left: 1.5px solid #E4CFA3;
    border-bottom: 1.5px solid #E4CFA3;
    transform: rotate(-45deg) translateY(-1px);
}

.login-options label { gap: 9px; }

.auth-trust {
    margin-top: auto;
    padding-top: 26px;
    color: #6F6A5E;
    font-size: 10px;
    letter-spacing: .1em;
}

.auth-features div { color: rgba(239, 233, 220, .82); }

@media (max-width: 760px) {
    .auth-form-panel { padding: 42px 24px 26px; }
    .auth-locale { top: 18px; right: 24px; }
}

@media (max-width: 420px) {
    .auth-form-panel { padding: 38px 18px 22px; }
    .auth-locale { right: 18px; }
}

/* Filter bars inside cards: Tailwind action pairs must wrap instead of
   pushing the last button past the card edge (30px at 1024px). */
.panel-card form.grid .flex,
.panel-card .page-actions-row {
    flex-wrap: wrap;
    min-width: 0;
}

.panel-card form.grid .flex > * {
    min-width: 0;
    max-width: 100%;
}

/* Impersonation banner — squared, hairline, same language as the rail */
.impersonation-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(192, 160, 98, .35);
    border-left: 2px solid var(--gold);
    background: linear-gradient(90deg, rgba(192, 160, 98, .14), rgba(192, 160, 98, .035));
    color: #3F3527;
    border-radius: 0;
}

.impersonation-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.impersonation-copy strong {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: #6B5218;
}

.impersonation-copy span { font-size: 12.5px; line-height: 1.45; color: #5A5245; }
.impersonation-copy span strong { font-size: 12.5px; font-weight: 600; letter-spacing: 0; text-transform: none; color: #221B10; }

.impersonation-banner form { margin: 0; flex: 0 0 auto; max-width: 100%; }

.impersonation-stop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border: 1px solid #0E1626;
    border-radius: 0;
    background: #0E1626;
    color: #F4EFE4;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    max-width: 100%;
}

.impersonation-stop:hover { background: #17253C; border-color: #17253C; }

@media (max-width: 560px) {
    .impersonation-banner { padding: 11px 14px; }
    .impersonation-copy span { font-size: 12px; }
    .impersonation-stop { height: 34px; padding: 0 12px; letter-spacing: .1em; }
}

/* Final alignment pass — form column, switcher and trust share one edge */
.auth-form-panel { align-items: center; }

.auth-locale { right: max(24px, calc(50% - 196px)); }

.auth-trust {
    width: 100%;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.login-options label { font-size: 12.5px; }

.login-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.sidebar-toggle-mark { opacity: .9; }
.sidebar-toggle-mark svg { width: 14px; height: 14px; }
.sidebar-logo img { border-radius: 0; display: block; width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 560px) {
    .auth-locale { right: 20px; }
    .auth-trust { width: 100%; }
}

/* Rail micro-fixes: neutral caption rule (the gold rule collided with the
   active marker), a top breath, and drawer depth on mobile. */
.sidebar-section-caption::after {
    background: linear-gradient(90deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
}

.sidebar-brand { padding-top: 26px; }

@media (max-width: 1024px) {
    .sidebar {
        box-shadow: 40px 0 90px -50px rgba(3, 8, 16, .75);
        padding: 0;
    }
    .sidebar-inner { border-right: 1px solid rgba(192, 160, 98, .22); }
}

/* ==========================================================================
   v4 — audit remediation layer
   Accessibility, validation states, detail pages, HCP portal, pagination.
   ========================================================================== */

/* --- Skip link + visible focus ring (D10) --------------------------------- */
.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 9999;
    padding: 12px 18px;
    background: var(--ink);
    color: var(--ivory);
    font: 500 12.5px/1 'Inter', system-ui, sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--gold);
    transition: top .18s ease;
}

.skip-link:focus,
.skip-link:focus-visible { top: 0; text-decoration: none; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--gold-deep);
    outline-offset: 2px;
}

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* --- Validation states (D11) --------------------------------------------- */
.field-error {
    margin: 6px 0 0;
    font: 500 12px/1.45 'Inter', system-ui, sans-serif;
    color: var(--danger);
    display: flex;
    gap: 6px;
}

.field-error::before {
    content: "!";
    flex: 0 0 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}

.is-invalid,
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--danger) !important;
    box-shadow: inset 2px 0 0 var(--danger);
}

.alert-summary ul {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 12.5px;
}

.alert-summary li { margin: 2px 0; }

/* --- Detail pages, long URLs and table cells (D5) ------------------------ */
.details-grid dd a,
.details-grid strong a,
.cell-wrap,
.details-prose,
.panel-card a[href^="http"] {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.link-break { overflow-wrap: anywhere; }

.cell-wrap { white-space: normal; }
.cell-nowrap { white-space: nowrap; }

.table-wrapper { max-width: 100%; }

.data-table td, .data-table th { min-width: 0; }

/* Old markup (span/strong) and new markup (dt/dd) share one visual language. */
.details-grid > div {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--line-soft);
    background: var(--ivory-2);
}

.details-grid dt,
.details-grid > div > span {
    display: block;
    font: 500 10.5px/1 'Inter', system-ui, sans-serif;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #5F5A4E;
    margin-bottom: 8px;
}

.details-grid dd,
.details-grid > div > strong {
    margin: 0;
    font: 500 13.5px/1.5 'Inter', system-ui, sans-serif;
    color: var(--text);
}

.details-grid .details-span { grid-column: 1 / -1; }
.details-prose { font-weight: 400; color: var(--muted); }

/* --- Congress detail (D6) ------------------------------------------------ */
.congress-detail .page-actions-group { display: flex; gap: 10px; flex-wrap: wrap; }

.congress-hero {
    position: relative;
    overflow: hidden;
    min-height: 220px;
    display: grid;
    align-items: end;
    border: 1px solid var(--line);
}

.congress-hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.6s cubic-bezier(.22, 1, .36, 1);
}

.congress-hero:hover .congress-hero-image { transform: scale(1.04); }

.congress-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11, 18, 32, .15) 0%, rgba(11, 18, 32, .82) 78%);
}

.congress-hero-content {
    position: relative;
    z-index: 2;
    padding: 28px 30px;
    color: var(--ivory);
    max-width: 100%;
}

.congress-hero-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.congress-logo { width: 46px; height: 46px; object-fit: contain; background: #fff; padding: 4px; border-radius: 0; }

.congress-hero-content h2 {
    margin: 0 0 6px;
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(26px, 3.1vw, 40px);
    line-height: 1.08;
    color: #fff;
    overflow-wrap: anywhere;
}

.congress-hero-meta,
.congress-hero-dates {
    margin: 0;
    font: 500 12.5px/1.6 'Inter', system-ui, sans-serif;
    letter-spacing: .04em;
    color: rgba(247, 244, 238, .82);
}

.congress-hero-dates { margin-top: 4px; color: var(--gold-soft); }

.congress-hero-noimage { min-height: 200px; background: linear-gradient(135deg, #0B1220 0%, #17233A 62%, #23324C 100%); }
.congress-hero-noimage::after { background: linear-gradient(180deg, rgba(11,18,32,0) 0%, rgba(11,18,32,.35) 100%); }

.congress-hero-fallback {
    position: absolute;
    right: 24px;
    top: 12px;
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 150px;
    line-height: 1;
    color: rgba(192, 160, 98, .16);
    user-select: none;
}

.congress-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .congress-detail-grid { grid-template-columns: minmax(0, 1fr); }
}

.deadline-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.deadline-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 11px 0;
    border-bottom: 1px solid var(--line-soft);
}

.deadline-item:last-child { border-bottom: 0; }

.deadline-dot {
    flex: 0 0 7px;
    width: 7px; height: 7px;
    margin-top: 6px;
    background: var(--gold);
    transform: rotate(45deg);
}

.deadline-label {
    display: block;
    font: 500 10.5px/1.2 'Inter', system-ui, sans-serif;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #5F5A4E;
    margin-bottom: 3px;
}

.deadline-item strong { font: 500 13px/1.4 'Inter', system-ui, sans-serif; color: var(--text); }
.deadline-item.is-past .deadline-dot { background: var(--line-strong); }
.deadline-item.is-past strong { color: var(--muted-2); }

.package-mini-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    background: var(--paper);
    transition: translate .35s ease, box-shadow .35s ease;
}

.package-mini-card img { width: 100%; height: 132px; object-fit: cover; display: block; }
.package-mini-body { padding: 16px 18px; display: grid; gap: 8px; }
.package-mini-type { margin: 0; font: 600 10px/1 'Inter', sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); }
.package-mini-body h4 { margin: 0; font: 500 15px/1.3 'Inter', sans-serif; color: var(--text); }
.package-mini-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.package-mini-foot strong { font-family: 'Instrument Serif', Georgia, serif; font-size: 20px; color: var(--ink); }

/* --- Package chooser (D18) ---------------------------------------------- */
.select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.select-card {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    transition: translate .35s ease, box-shadow .35s ease, border-color .35s ease;
}

.select-card:hover {
    translate: 0 -5px;
    border-color: var(--gold-line);
    box-shadow: 0 26px 60px -40px rgba(11, 18, 32, .55);
}

.select-card-media { position: relative; height: 156px; overflow: hidden; background: var(--ivory); }
.select-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 1.2s ease; }
.select-card:hover .select-card-media img { transform: scale(1.05); }

.select-card-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0B1220, #22314B);
}

.select-card-placeholder span {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 62px;
    color: rgba(192, 160, 98, .55);
}

.select-card-type {
    position: absolute;
    left: 14px; top: 14px;
    padding: 5px 9px;
    background: rgba(11, 18, 32, .72);
    color: var(--gold-soft);
    font: 600 9.5px/1 'Inter', sans-serif;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.select-card-body { padding: 18px 20px 20px; display: grid; gap: 8px; }
.select-card-congress { margin: 0; font: 500 10.5px/1.3 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #5F5A4E; }
.select-card-body h3 { margin: 0; font: 500 17px/1.3 'Inter', sans-serif; color: var(--text); }
.select-card-meta { margin: 0; font-size: 12.5px; color: var(--muted); }
.select-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.select-card-price small { display: block; font: 500 9.5px/1 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }
.select-card-price strong { font-family: 'Instrument Serif', Georgia, serif; font-size: 21px; color: var(--ink); }
.select-card-price span { font-size: 11.5px; color: var(--muted-2); }

/* --- Empty states ------------------------------------------------------- */
.empty-state { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 20px; }
.empty-state h3, .empty-state strong { font: 500 17px/1.3 'Inter', sans-serif; color: var(--text); margin: 0; }
.empty-state p, .empty-state span { font-size: 12.8px; color: var(--muted); max-width: 46ch; margin: 0; }
.empty-state-icon { font-size: 26px; color: var(--gold); line-height: 1; }

/* --- HCP portal --------------------------------------------------------- */
.hcp-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.hcp-hero-copy h2 { margin: 4px 0 6px; font-family: 'Instrument Serif', Georgia, serif; font-size: clamp(26px, 3vw, 38px); line-height: 1.1; color: var(--ink); }
.hcp-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hcp-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 1024px) { .hcp-grid { grid-template-columns: minmax(0, 1fr); } }

.hcp-next-body { display: grid; gap: 14px; }
.hcp-next-name { margin: 0; font: 500 19px/1.3 'Inter', sans-serif; color: var(--text); }

.hcp-meta { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hcp-meta li { display: grid; gap: 3px; font-size: 13px; color: var(--text); }
.hcp-meta li > span { font: 500 9.5px/1 'Inter', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: #5F5A4E; }
.hcp-meta-inline { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.hcp-event-list { display: grid; gap: 16px; }
.hcp-event { display: flex; gap: 20px; align-items: stretch; padding: 0; overflow: hidden; }

.hcp-event-date {
    flex: 0 0 92px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 2px;
    background: linear-gradient(160deg, #0B1220, #1B2740);
    color: var(--gold-soft);
}

.hcp-event-date span { font: 500 9.5px/1 'Inter', sans-serif; letter-spacing: .2em; text-transform: uppercase; }
.hcp-event-date strong { font-family: 'Instrument Serif', Georgia, serif; font-size: 30px; line-height: 1; color: #fff; }
.hcp-event-date small { font-size: 10.5px; color: rgba(247, 244, 238, .6); }

.hcp-event-body { padding: 18px 22px 18px 0; display: grid; gap: 12px; flex: 1 1 auto; min-width: 0; }
.hcp-event-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.hcp-event-head h3 { margin: 0 0 4px; font: 500 16.5px/1.3 'Inter', sans-serif; color: var(--text); overflow-wrap: anywhere; }
.hcp-venue { margin: 0; font-size: 12.5px; color: var(--muted); }

.hcp-pending { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 48px 24px; }
.hcp-pending h2 { margin: 0; font-family: 'Instrument Serif', Georgia, serif; font-size: 30px; color: var(--ink); }
.hcp-pending-mark { font-size: 34px; color: var(--gold); }
.hcp-pending-contact { font-size: 13px; color: var(--muted); }

.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.doc-row:last-child { border-bottom: 0; }
.doc-row > div { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.doc-row strong { font: 500 13px/1.35 'Inter', sans-serif; color: var(--text); overflow-wrap: anywhere; }
.doc-row small { font-size: 11px; color: var(--muted-2); }
.doc-icon { color: var(--gold); font-size: 15px; }

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    font: 600 9.5px/1 'Inter', sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
    border: 1px solid var(--line-strong);
    background: var(--ivory-2);
    color: var(--muted);
    white-space: nowrap;
}

.status-chip.status-confirmed,
.status-chip.status-travel_booked,
.status-chip.status-ticket_issued,
.status-chip.status-hotel_confirmed,
.status-chip.status-completed { border-color: #BBD3C6; background: var(--ok-soft); color: var(--ok); }

.status-chip.status-declined,
.status-chip.status-cancelled { border-color: #E3C3BF; background: var(--danger-soft); color: var(--danger); }

.status-chip.status-documents_pending,
.status-chip.status-pending_confirmation,
.status-chip.status-invited { border-color: #E4D3AE; background: var(--warn-soft); color: var(--warn); }

/* --- Pagination (D4) ---------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-top: 1px solid var(--line-soft);
}

.pagination-summary { margin: 0; font-size: 12px; color: var(--muted); }
.pagination-pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.pagination-page,
.pagination-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    background: var(--paper);
    font: 500 12px/1 'Inter', sans-serif;
    color: var(--text);
    text-decoration: none;
}

.pagination-page:hover,
.pagination-step:hover { border-color: var(--gold); color: var(--ink); text-decoration: none; }
.pagination-page.is-current { background: var(--ink); border-color: var(--ink); color: var(--ivory); }

/* --- Error pages -------------------------------------------------------- */
.error-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 20px;
    background: var(--ivory);
}

.error-card {
    width: min(520px, 100%);
    padding: 44px 40px;
    background: var(--paper);
    border: 1px solid var(--line);
    text-align: center;
    display: grid;
    gap: 12px;
    justify-items: center;
}

.error-code { margin: 0; font-family: 'Instrument Serif', Georgia, serif; font-size: 74px; line-height: 1; color: #8C6E36; }
.error-code-sm { font-size: 54px; }
.error-card h1 { margin: 0; font-family: 'Instrument Serif', Georgia, serif; font-size: 30px; color: var(--ink); }
.error-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* --- Typography + contrast (D8, D9) ------------------------------------- */
.header-page-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(24px, 2.4vw, 34px);
    line-height: 1.1;
    color: var(--ink);
    margin: 0;
}

.stat-label,
.details-grid dt,
.section-caption {
    color: #5F5A4E;
    font-size: max(10.5px, 11px);
}

.text-muted, .muted, .muted-small { color: var(--muted); }

/* Links inherit their container's colour (set in the base `a { color: inherit }`).
   A blanket `main a { color: ink }` rule used to sit here and, at 0,7,1, beat every
   class-based colour: the dark sidebar rail, dark buttons (ink on ink) and the active
   language chip on the login screen. Never reintroduce a colour rule this broad. */

/* Solid dark surfaces always carry light type, whatever the markup says. */
.dashboard-app a[class*="bg-indigo-6"],
.dashboard-app button[class*="bg-indigo-6"],
.dashboard-app a[class*="bg-indigo-7"],
.dashboard-app button[class*="bg-indigo-7"],
.dashboard-app a[class*="bg-slate-9"],
.dashboard-app button[class*="bg-slate-9"],
.dashboard-app a[class*="bg-slate-8"],
.dashboard-app button[class*="bg-slate-8"],
.dashboard-app a[class*="bg-rose-6"],
.dashboard-app button[class*="bg-rose-6"],
.dashboard-app a[class*="bg-emerald-6"],
.dashboard-app button[class*="bg-emerald-6"] {
    color: #F7F4EE;
}

.details-grid a:not([class*="btn"]),
.panel-card a:not([class*="btn"]):not([class*="bg-"]):not([class*="text-"]) { color: #7A5A21; }
.details-grid a:not([class*="btn"]):hover,
.panel-card a:not([class*="btn"]):not([class*="bg-"]):not([class*="text-"]):hover { color: var(--ink); }

small, .small, .muted-small, .text-xs { font-size: max(11px, .72rem); }

/* --- Mobile menu (D14) -------------------------------------------------- */
.mobile-menu-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.mobile-menu-button span { width: 18px; height: 1.5px; background: var(--ink); display: block; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 10, 18, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 40;
}

.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

body.sidebar-locked { overflow: hidden; }

@media (max-width: 1024px) {
    .sidebar { z-index: 50; }
    .sidebar-inner { border-radius: 0 !important; }
}

/* --- Print ------------------------------------------------------------- */
@media print {
    .sidebar, .dashboard-header, .impersonation-banner, .skip-link, .pagination { display: none !important; }
    .dashboard-main { margin: 0 !important; }
    .panel-card { border-color: #ddd !important; box-shadow: none !important; }
}

/* --- RFP wizard --------------------------------------------------------- */
.wizard-steps {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--paper);
    font: 500 11.5px/1.3 'Inter', sans-serif;
    color: var(--muted);
    cursor: default;
    min-width: 0;
}

.wizard-step-index {
    flex: 0 0 22px;
    width: 22px; height: 22px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
}

.wizard-step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wizard-step.is-current { background: var(--ivory-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold); }
.wizard-step.is-current .wizard-step-index { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.wizard-step.is-done .wizard-step-index { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-deep); }
.wizard-step.is-done { cursor: pointer; }

.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.wizard-progress { margin: 0; font: 500 11px/1 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }

@media (max-width: 700px) {
    .wizard-step-label { display: none; }
    .wizard-step { justify-content: center; }
}

/* --- Portal permissions (D16) ------------------------------------------- */
.portal-permissions {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding-top: 6px;
    border-top: 1px solid var(--line-soft);
}

.portal-permissions-label {
    font: 500 10.5px/1 'Inter', sans-serif;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #5F5A4E;
}

.perm-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: 500 12px/1.3 'Inter', sans-serif;
    color: var(--text);
    cursor: pointer;
}

.perm-check input { accent-color: var(--ink); width: 15px; height: 15px; }

.perm-inline-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.perm-inline-form .perm-check span {
    max-width: 96px;
    font-size: 10.5px;
    line-height: 1.2;
    color: var(--muted);
}

.perm-inline-form .perm-check input:checked + span { color: var(--ink); font-weight: 600; }

/* --- Document rows (entity cards): never push the page sideways ---------- */
.document-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 100%;
    min-width: 0;
}

.document-row > * { min-width: 0; }
.document-main { flex: 1 1 220px; overflow-wrap: anywhere; }
.document-main strong { overflow-wrap: anywhere; }
.document-meta { flex: 0 0 auto; max-width: 100%; overflow-wrap: anywhere; }
.document-actions { flex: 0 0 auto; margin-left: auto; }

@media (max-width: 560px) {
    .document-actions { margin-left: 0; width: 100%; }
    .document-actions .btn-secondary { width: 100%; justify-content: center; }
}

/* --------------------------------------------------------------------------
   Legacy microtext — dashboard.css / pharma.css / client-*.css still paint
   secondary text in slate-400 (#94a3b8, 2.56:1 on ivory). Bring those
   selectors onto the muted ramp; no markup changes involved.
   -------------------------------------------------------------------------- */
.stat-card small,
.table-user span,
.dashboard-footer,
.permission-empty,
.details-grid span,
.details-list span,
.client-company-profile-grid span,
.client-event-meta span,
.pc-package-count,
.pc-congress-price span,
.pc-package-price span,
.pc-info-card dt,
.cr-empty,
.cr-empty-cell {
    color: var(--muted-2);
}

/* Client reports module still shipped an indigo eyebrow and an indigo→violet
   progress bar from the original palette. Bring both onto the gold ramp. */
.dashboard-app .cr-header p { color: var(--gold-deep); }
.dashboard-app .cr-bar-track { background: var(--gold-soft); }
.dashboard-app .cr-bar-track span { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); }

/* --------------------------------------------------------------------------
   Fluid & stacked tables — no horizontal scroll at any width (v5)

   A data table no longer forces a minimum track width: cells wrap, and below
   900px every row is rendered as a record card with its column names as
   labels (data-label is written by assets/js/table-responsive.js).
   -------------------------------------------------------------------------- */

.table-wrapper {
    overflow-x: visible;
    max-width: 100%;
}

.panel-card:has(table) {
    overflow-x: visible;
}

.data-table,
.panel-card table:not(.no-min),
.cr-table,
.dashboard-app .cr-table {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    table-layout: auto;
}

.data-table thead th {
    white-space: normal;
}

.data-table tbody td,
.data-table tbody td:first-child {
    white-space: normal;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: normal;
}

.data-table .table-actions,
.table-actions {
    flex-wrap: wrap;
    white-space: normal;
    row-gap: 6px;
}

.cr-table-wrap,
.dashboard-app .cr-table-wrap {
    overflow-x: visible;
    max-width: 100%;
}

.cr-table th,
.cr-table td {
    overflow-wrap: break-word;
}

.portal-permissions-label {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.4;
}

.portal-permissions {
    min-width: 0;
}

@media (max-width: 900px) {
    .table-wrapper {
        border: 0;
        background: transparent;
        border-radius: 0;
    }

    .panel-card:has(table) {
        overflow-x: visible;
    }

    .data-table,
    .panel-card table:not(.no-min),
    .cr-table {
        display: block;
        border-collapse: separate;
        border-spacing: 0;
        width: 100%;
    }

    .data-table thead,
    .cr-table thead {
        display: none;
    }

    .data-table tbody,
    .cr-table tbody {
        display: block;
    }

    .data-table tbody tr,
    .cr-table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: var(--r-md);
        background: #fff;
        box-shadow: 0 1px 2px rgba(11, 18, 32, .04);
        overflow: hidden;
    }

    .data-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .data-table tbody tr:hover {
        background: #fff;
    }

    .data-table tbody td,
    .data-table tbody td:first-child,
    .cr-table tbody td {
        display: grid;
        grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
        align-items: start;
        gap: 4px 14px;
        padding: 10px 16px;
        border-bottom: 1px solid var(--line-soft);
        text-align: left;
        white-space: normal;
    }

    .data-table tbody td:last-child,
    .cr-table tbody td:last-child {
        border-bottom: 0;
    }

    .data-table tbody td::before,
    .cr-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 700;
        letter-spacing: .14em;
        line-height: 1.5;
        text-transform: uppercase;
    }

    .data-table tbody td[data-label=""]::before,
    .data-table tbody td:not([data-label])::before,
    .cr-table tbody td[data-label=""]::before,
    .cr-table tbody td:not([data-label])::before {
        content: none;
    }

    .data-table tbody td[data-label=""],
    .data-table tbody td:not([data-label]),
    .cr-table tbody td[data-label=""],
    .cr-table tbody td:not([data-label]) {
        display: block;
    }

    .data-table tbody td[colspan],
    .cr-table tbody td[colspan] {
        display: block;
        text-align: center;
    }

    .data-table td.text-right,
    .cr-table td.text-right {
        text-align: left;
    }

    .data-table .table-actions,
    .data-table td .table-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .cr-table tbody td:first-child {
        background: #FBF9F4;
    }
}

/* Detail grids and permission rows: long emails and keys must break instead of
   widening their card. */
.details-grid > div,
.details-grid > div > strong,
.details-grid > div > span,
.details-grid > div > p,
.panel-card .portal-permissions,
.panel-card .portal-permissions-label,
.panel-card .perm-check,
.panel-card .perm-check > span {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.panel-card .perm-check {
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .panel-card .portal-permissions {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Values inside cards (emails, URLs, codes) wrap instead of pushing the card. */
.panel-card :is(p, strong, span, dd, dt, a, small, label) {
    overflow-wrap: break-word;
}

/* Only tokens that are genuinely unbreakable (URLs, keys, codes) may split
   mid-word; `anywhere` on every span/strong collapsed min-content to one
   character and the table squeezed "Biocare" to 41 px. */
.panel-card :is(a[href^="http"], code, .link-break, .mono) {
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Reports screens (v5b)

   views/reports/index.php prints its own <style> in the body, after this
   file, with `.reports-table { min-width: 900px }` and
   `.reports-table-card { overflow: auto }` — so the two report tables kept a
   936 px floor and scrolled sideways inside their card at every width below
   1024 px. Scoping with `.dashboard-app` (0,2,0) outranks the view rules
   regardless of source order, so the markup stays untouched.
   -------------------------------------------------------------------------- */

.dashboard-app .reports-table-card {
    overflow-x: visible;
    max-width: 100%;
    min-width: 0;
}

.dashboard-app .reports-table {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
}

.dashboard-app .reports-table th {
    white-space: normal;
}

.dashboard-app .reports-table td {
    white-space: normal;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: normal;
}

@media (max-width: 900px) {
    .dashboard-app .reports-table-card {
        padding: 16px;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .dashboard-app .reports-table-card > h3 {
        margin-bottom: 12px;
    }

    .dashboard-app .reports-table {
        display: block;
        border-collapse: separate;
        border-spacing: 0;
        width: 100%;
    }

    .dashboard-app .reports-table thead {
        display: none;
    }

    .dashboard-app .reports-table tbody {
        display: block;
    }

    .dashboard-app .reports-table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: var(--r-md);
        background: #fff;
        box-shadow: 0 1px 2px rgba(11, 18, 32, .04);
        overflow: hidden;
    }

    .dashboard-app .reports-table tbody td {
        display: grid;
        grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
        align-items: start;
        gap: 4px 14px;
        padding: 10px 16px;
        border-bottom: 1px solid var(--line-soft);
        font-size: 13px;
        text-align: left;
    }

    .dashboard-app .reports-table tbody td:last-child {
        border-bottom: 0;
    }

    .dashboard-app .reports-table tbody td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 700;
        letter-spacing: .14em;
        line-height: 1.5;
        text-transform: uppercase;
    }

    .dashboard-app .reports-table tbody td[colspan],
    .dashboard-app .reports-table tbody td:not([data-label]) {
        display: block;
        text-align: left;
    }

    .dashboard-app .reports-table tbody td[colspan]::before,
    .dashboard-app .reports-table tbody td:not([data-label])::before {
        content: none;
    }
}

/* --------------------------------------------------------------------------
   Header title (v5c)

   `.header-titles` had no flex basis, so a long French page title ("Demandes
   de voyages d'affaires") pushed the header 8 px past a 320 px viewport on the
   HCP portal. The later `.header-page-title` typography rule (clamp 24–34 px)
   also outranked the earlier mobile 16 px override by source order. Both are
   settled here, at the end of the cascade.
   -------------------------------------------------------------------------- */

.header-titles {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 760px) {
    .header-page-title {
        font-size: 17px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

/* --------------------------------------------------------------------------
   Filter toolbars (v5d)

   Every list filter ends with `<div class="flex gap-2">` holding the submit
   button, and the button carries Tailwind `flex-1` — flex: 1 1 0%. In a narrow
   card it squeezed the button to 37–53 px while padding stayed 32 px, so the
   label was clipped ("Appliquer" → "pplique"). The row now wraps instead of
   shrinking its buttons.
   -------------------------------------------------------------------------- */

form .flex.gap-2 { flex-wrap: wrap; }

form .flex.gap-2 > button,
form .flex.gap-2 > a,
form .flex.gap-2 > input[type="submit"] {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Table polish (v5f)
   -------------------------------------------------------------------------- */

/* Action buttons never break their own label ("Modifie / r" at 1024). */
.data-table .table-actions > *,
.table-actions > * {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* On a phone the two-column label/value grid leaves ~220 px for the value, so
   an email broke over three lines. Below 560 px the label sits above the
   value and the value gets the full card width. */
@media (max-width: 560px) {
    .data-table tbody td,
    .data-table tbody td:first-child,
    .cr-table tbody td,
    .dashboard-app .reports-table tbody td {
        display: block;
        padding: 10px 14px;
    }

    .data-table tbody td::before,
    .cr-table tbody td::before,
    .dashboard-app .reports-table tbody td::before {
        display: block;
        margin-bottom: 3px;
    }
}

/* --------------------------------------------------------------------------
   Remaining overflow sources (v5g)

   1. `.rfp-form` is a grid with no explicit track: the implicit track took the
      card's 328 px max-content width and pushed the client event form 45 px
      past a 320 px viewport. Force a shrinkable track.
   2. `.details-grid` uses auto-fit minmax(190px, 1fr); at 320 px two columns
      cannot fit and the row overhang 14 px.
   3. Tables sized at `width: 100%` can still land 1 px over on fractional
      widths (participants, 1280 FR). `clip` kills that rounding without
      creating a scroll container.
   -------------------------------------------------------------------------- */

.rfp-form,
form.rfp-form {
    grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 760px) {
    .details-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.table-wrapper {
    overflow-x: clip;
}

/* `.details-list` is a grid with an implicit auto track, so an unbreakable
   email set the track to 297 px inside a 248 px card (package-request detail,
   14 px over at 320). Same fix as the page shell: a shrinkable track. */
.details-list {
    grid-template-columns: minmax(0, 1fr);
}

.details-list > div {
    min-width: 0;
}

.details-list :is(a, strong, span, dd, p) {
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Reports screen — palette bridge (v6)

   views/reports/index.php prints its own legacy stylesheet in the body:
   #64748b labels, #2563eb→#38bdf8 gradient bars, 22 px radii, indigo charts.
   The page therefore looked like an older blue SaaS dashboard inside the
   premium shell. Scoped overrides only; no markup and no chart code touched.
   -------------------------------------------------------------------------- */

.dashboard-app .reports-title p {
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: .16em;
}

.dashboard-app .reports-title h1 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: -.01em;
}

.dashboard-app .reports-title span {
    color: var(--muted);
}

.dashboard-app .reports-filter-card,
.dashboard-app .reports-card {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: 0 1px 2px rgba(11, 18, 32, .04);
}

@media (min-width: 901px) {
    .dashboard-app .reports-table-card {
        border: 1px solid var(--line);
        border-radius: var(--r-md);
        box-shadow: 0 1px 2px rgba(11, 18, 32, .04);
    }
}

.dashboard-app .reports-card h3,
.dashboard-app .reports-table-card h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 19px;
    color: var(--ink);
}

.dashboard-app .reports-kpi {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    box-shadow: 0 1px 2px rgba(11, 18, 32, .03);
}

.dashboard-app .reports-kpi small {
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .14em;
}

.dashboard-app .reports-kpi strong {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 27px;
    color: var(--ink);
}

.dashboard-app .reports-bar-head {
    color: var(--muted);
    font-size: 12px;
}

.dashboard-app .reports-bar-head strong {
    color: var(--ink);
    font-weight: 600;
}

.dashboard-app .reports-bar-track {
    background: #F1ECE1;
    height: 7px;
}

.dashboard-app .reports-bar-track span {
    background: linear-gradient(90deg, var(--gold-deep), var(--gold-2));
}

.dashboard-app .reports-mini-stat {
    background: var(--ivory-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
}

.dashboard-app .reports-mini-stat small {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.dashboard-app .reports-mini-stat strong {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--ink);
}

.dashboard-app .reports-table th {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    border-bottom: 1px solid var(--line);
}

.dashboard-app .reports-table td {
    color: var(--text);
    font-size: 13px;
    border-bottom: 1px solid var(--line-soft);
}

.dashboard-app .reports-table td strong {
    color: var(--ink);
}

.dashboard-app .reports-field label,
.dashboard-app .reports-field input,
.dashboard-app .reports-field select {
    font-size: 12.5px;
}

.dashboard-app .reports-field label {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.dashboard-app .reports-empty {
    color: var(--muted);
}

/* Cells that hold a single unbreakable token (email, URL, key) may break
   mid-word — otherwise their min-content sets the column width and the table
   cannot fit (participants: 939 px table in an 890 px wrapper at 1280).
   The class is applied by table-responsive.js, only above 18 characters. */
.data-table td.cell-token,
.data-table td.cell-token *,
.cr-table td.cell-token,
.cr-table td.cell-token *,
.reports-table td.cell-token,
.reports-table td.cell-token * {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Eight-column tables (events) exceed the content column by ~24 px between
   900 and 1400 px because every header cell carries 32 px of horizontal
   padding and .15em tracking. Tighten both inside that range instead of
   stacking the table on a laptop. */
@media (max-width: 1400px) {
    .data-table thead th {
        padding-left: 12px;
        padding-right: 12px;
        letter-spacing: .10em;
    }

    .data-table tbody td {
        padding-left: 12px;
        padding-right: 12px;
    }
}
