/* ==========================================================================
   IntelliDB Download Portal - Legacy Shared Primitives (style.css)
   Ownership: legacy shared primitives/safety-net styles used by both UIs.
   Do not add new page/components here unless needed for backward compatibility.
   ========================================================================= */
/* ========================================================= 
   IntelliDB Download Portal - Unified Brand Theme
   ---------------------------------------------------------
   - Consolidated from previous multiple "polish" passes
   - Shared palette: deep navy, teal, aqua, green
   - Covers:
       • Global & header
       • User portal (login + downloads)
       • Admin layout & tables
       • Downloads admin page & Secure File Manager
       • Admin tabs (Admin Users page)
   ========================================================= */

/* =========================================================
   BRAND TOKENS (Enterprise-safe palette normalization)
   - 1 brand accent (blue/sky) used consistently for:
       links, chips, selected rows, “subscription” tint, subtle highlights
   - success = green, warning = amber, danger = red
   - neutrals = slate/gray
   ========================================================= */
:root {
    /* Neutrals */
    --idb-bg: #f3f4f6;
    --idb-surface: #ffffff;
    --idb-text: #0f172a;
    --idb-muted: #6b7280;
    --idb-muted-2: #4b5563;
    --idb-border: #e5e7eb;
    --idb-border-strong: #d1d5db;

    /* Brand (primary accent) */
    --idb-brand-50: #eff6ff;
    --idb-brand-100: #e0f2fe;
    --idb-brand-200: #bae6fd;
    --idb-brand-600: #0284c7;
    --idb-brand-700: #0369a1;

    /* Semantic */
    --idb-success-50: #ecfdf3;
    --idb-success-600: #16a34a;
    --idb-success-700: #15803d;

    --idb-warn-50: #fffbeb;
    --idb-warn-600: #f59e0b;
    --idb-warn-text: #a16207; /* cleaner amber tone */

    --idb-danger-50: #fef2f2;
    --idb-danger-600: #dc2626;
    --idb-danger-text: #b91c1c;

    /* “Selected row” tint (replaces loud yellow) */
    --idb-selected-row: #f1f5ff; /* soft, neutral-brand selection */
}

/* ---------------------------
   Global reset-ish & base
   --------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--idb-bg);
    color: var(--idb-text);
}

/* Accessibility: hidden until keyboard focus */
.idb-skip-link {
    position: fixed;
    left: 12px;
    top: -64px;
    opacity: 0;
    pointer-events: none;
    z-index: 1200;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #1e3a8a;
    background: #0f172a;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.idb-skip-link:focus {
    top: 12px;
    opacity: 1;
    pointer-events: auto;
}

/* Links */
a {
    color: var(--idb-brand-600);
    text-decoration: none;
}
a:hover {
    color: var(--idb-brand-700);
    text-decoration: underline;
}
/* Prevent “visited purple” in portals */
a:visited {
    color: var(--idb-brand-600);
}

/* ---------------------------
   Header + Hero banner
   --------------------------- */
.idb-header {
    background: var(--idb-surface);
    border-bottom: 1px solid var(--idb-border);
}

.idb-header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.idb-logo-img {
    height: 52px;
    width: auto;
}

/* Styles the header brand text whether it is an <h1> (customer pages, where it is the
   page's only heading) or a demoted <p class="idb-title-text"> (admin pages, where the
   hero already supplies the page <h1>, so the brand must not be a second one). */
.idb-header-title h1,
.idb-header-title .idb-title-text {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
    color: var(--idb-text);
    text-align: center;
}

/* Hero / banner (standardized, fixed height) */
.idb-hero-banner,
.idb-hero,
.idb-header-hero {
    background: linear-gradient(90deg, #0E7490 0%, #0EA5E9 45%, #38BDF8 100%);
    color: #ffffff;
    padding: 20px 26px;
    border-radius: 18px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    min-height: 130px;
    display: flex;
    align-items: center;
}

/* Right-side meta text in hero (RBAC, “Portal root”, etc.) */
.idb-hero-meta {
    margin-left: auto;
    text-align: right;
    font-size: 0.84rem;
    color: #f9fafb;
}
.idb-hero-meta code {
    font-size: 0.78rem;
    color: #e0f2fe;
}

/* ---------------------------
   Main container
   --------------------------- */
.idb-main {
    padding: 14px 20px 24px;
    background: var(--idb-bg);
    width: 100%;
    max-width: 100%;
}

/* ---------------------------
   Card, form, buttons, alerts
   --------------------------- */

/* ==========================================================================
   Card primitive (legacy fallback)
   Neutral structural card shell. Customer/admin branded card visuals should be
   owned by portal-user.css / portal-admin.css.
   ========================================================================== */
.idb-card {
    background: var(--idb-surface, #ffffff);
    border-radius: 18px;
    padding: 20px 22px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.10);
    border: 1px solid var(--idb-border, #e5e7eb);
}

/* Centered card (login, small flows) */
.idb-card-login {
    max-width: 460px;
    margin: 0 auto;
}

/* Page title + subtitle */
.idb-page-title {
    margin-bottom: 4px;
}
.idb-page-title h1,
.idb-page-title h2 {
    margin: 0 0 6px 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--idb-text);
}
.idb-subtitle {
    margin: 0 0 14px 0;
    font-size: 0.9rem;
    color: var(--idb-muted);
}

/* Form layout */
.idb-page-center {
    max-width: 960px;
    margin: 0 auto;
}
.idb-form,
.idb-edit-form,
.idb-add-form,
.idb-form-narrow {
    max-width: 960px;
    margin: 0 auto;
}

/* ==========================================================================
   Form primitive (legacy fallback)
   Structural/neutral form control shell for pages that do not load portal-user.css
   or portal-admin.css. Branded form visuals belong in portal-user.css /
   portal-admin.css.
   ========================================================================== */
.idb-form-group {
    margin-bottom: 12px;
}
.idb-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: #374151;
}

.idb-input,
.idb-select {
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid var(--idb-border-strong, #d1d5db);
    font-size: 0.9rem;
    background-color: #f9fafb;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.idb-input:focus,
.idb-select:focus {
    outline: none;
    border-color: var(--idb-border-strong, #d1d5db);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.22);
    border-color: #6366f1;
}

/* ==========================================================================
   Button primitive (legacy fallback)
   Structure-only shell for pages that do not load portal-user.css / portal-admin.css.
   Branded button visuals and variants live in portal-user.css / portal-admin.css.
   ========================================================================== */
.idb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    line-height: 1.2;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 500;
    user-select: none;
}

/* ==========================================================================
   Alert primitive (legacy fallback)
   Structure-only shell; branded/status visuals should come from portal-user.css
   and portal-admin.css.
   ========================================================================== */
.idb-alert {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    margin-bottom: 10px;
    border: 1px solid transparent;
}

.idb-helper-text {
    font-size: 0.8rem;
    color: var(--idb-muted);
}

/* ---------------------------
   Login tabs (OTP vs Password)
   Enterprise segmented control
   --------------------------- */
.idb-tabs {
    display: flex;
    gap: 6px;
    margin: 12px 0 16px 0;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 14px;
    border: 1px solid var(--idb-border);
}

/* Base tab */
.idb-tab {
    flex: 1 1 0;
    text-align: center;
    padding: 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;

    border-radius: 10px;
    border: none;

    background: transparent;
    color: var(--idb-muted-2);
    text-decoration: none;

    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.08s ease;
}

/* Kill browser link colors explicitly */
.idb-tab:link,
.idb-tab:visited {
    color: var(--idb-muted-2);
}

/* Hover - ALWAYS readable */
.idb-tab:hover {
    background: #e0f2fe;
    color: var(--idb-brand-700);
    text-decoration: none;
}

/* Keyboard focus */
.idb-tab:focus-visible {
    outline: 2px solid rgba(2,132,199,0.45);
    outline-offset: 2px;
}

/* Active tab */
.idb-tab-active {
    background: #4f46e5;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
}

/* Active tab must stay white even on hover */
.idb-tab-active:hover,
.idb-tab-active:link,
.idb-tab-active:visited {
    color: #ffffff;
    background: #4f46e5;
}

/* ---------------------------
   User Portal (downloads side)
   --------------------------- */
.idb-user-portal,
.idb-page-center.idb-user-portal {
    max-width: 1100px;
    margin: 0 auto 32px auto;
    padding: 18px 18px 28px 18px;
}
.idb-user-portal .idb-card {
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Company / account summary */
.idb-company-box {
    background: var(--idb-surface);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border: 1px solid var(--idb-border);
}
.idb-company-box dl {
    display: grid;
    grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
    gap: 6px 16px;
    margin: 0;
}
.idb-company-box dt {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--idb-muted-2);
}
.idb-company-box dd {
    margin: 0;
    font-size: 0.88rem;
    color: #111827;
}

/* User portal headings */
.idb-user-section-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}
.idb-user-section-subtitle,
.idb-page-container p {
    font-size: 0.88rem;
    color: var(--idb-muted-2);
}

/* Download header */
.idb-download-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}
.idb-download-header h2 {
    font-size: 1.25rem;
    margin: 0;
}
.idb-download-header p {
    font-size: 0.9rem;
    color: var(--idb-muted);
    margin: 0;
}

/* Download table */
.idb-user-table-scroll,
.idb-page-center.idb-user-portal .idb-user-table-scroll {
    display: block;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
}
.idb-download-table,
.idb-page-center.idb-user-portal table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.idb-download-table thead,
.idb-page-center.idb-user-portal thead {
    background: #f3f4f6;
}
.idb-download-table th,
.idb-download-table td,
.idb-page-center.idb-user-portal th,
.idb-page-center.idb-user-portal td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--idb-border);
}
.idb-download-table th,
.idb-page-center.idb-user-portal th {
    text-align: left;
    font-size: 0.8rem;
    color: var(--idb-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Status pills (user side) */
.idb-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.idb-status-active,
.idb-status-pill-active {
    background: rgba(22,163,74,0.12);
    color: #047857;
}
.idb-status-expired,
.idb-status-pill-expired {
    background: rgba(220,38,38,0.12);
    color: var(--idb-danger-text);
}

/* Small chips for download metadata */
.idb-download-meta {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.idb-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.4;
    border: 1px solid rgba(0,0,0,0.12);
    background: var(--idb-brand-50); /* normalized brand tint */
    color: #111827;
    white-space: nowrap;
}

/* ==========================================================================
   Badge primitive (legacy fallback)
   Structure-only shell for pages that do not load portal-user/admin CSS.
   Branded/status badge visuals live in portal-user.css / portal-admin.css.
   ========================================================================== */
.idb-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid transparent;
}

/* Primary/selected row highlight (global fallback) */
.idb-license-row-primary {
    background-color: var(--idb-selected-row);
}

/* User info box (download header) */
.idb-user-info-box {
    background: var(--idb-surface);
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    margin-bottom: 16px;
}

/* Footer */
.idb-footer {
    border-top: 1px solid #e2e8f0;
    background: var(--idb-surface);
}
.idb-footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 16px 12px 16px;
    font-size: 0.75rem;
    color: var(--idb-muted);
    text-align: center;
}
.idb-footer-text {
    margin-top: 16px;
    font-size: 0.78rem;
    color: #9ca3af;
}


/* =========================================================
   HELP PAGES - LAYOUT SHELL
   ========================================================= */

.idb-admin-page-help {
    margin: 8px 8px 16px;
    padding: 0 10px 18px;
    border-radius: 20px;
    background: radial-gradient(circle at top left, #eef2ff 0, #f9fafb 35%, #ffffff 100%);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
}

/* Layout framing: TOC + content (mobile: stacked) */
.idb-help-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Help-page card override (scoped): avoid globally overriding .idb-card */
.idb-help-layout .idb-card {
    background: var(--idb-surface);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
    padding: 14px 16px;
}

/* Muted helper text */
.idb-admin-muted {
    color: var(--idb-muted);
}

/* Small heading chip style (for section labels inside help cards) */
.idb-help-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(2, 132, 199, 0.08);
    color: var(--idb-brand-700);
    border: 1px solid rgba(2, 132, 199, 0.30);
    margin-bottom: 4px;
}

/* =========================================================
   HELP HERO BAR - HEADER
   ========================================================= */

.idb-admin-page-help .idb-admin-page-header {
    position: relative;
    margin: 0 10px 18px;
    padding: 14px 20px 12px;
    min-height: 132px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 2px;
    border-radius: 18px;
    background: radial-gradient(circle at top left, var(--idb-brand-100) 0, #eff6ff 40%, #f9fafb 100%);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
    border: 1px solid rgba(148, 163, 184, 0.45);
}

/* Optional soft accent bar on left */
.idb-admin-page-help .idb-admin-page-header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    border-radius: 18px 0 0 18px;
    background: linear-gradient(to bottom, #22c55e, #0ea5e9);
    opacity: 0.85;
}

/* Title + text */
.idb-admin-page-help .idb-admin-page-header h1 {
    font-size: 1.34rem;
    margin-top: 0;
    margin-bottom: 2px;
    letter-spacing: 0.01em;
    color: var(--idb-text);
    line-height: 1.15;
    text-wrap: balance;
}

.idb-admin-page-help .idb-admin-page-header p {
    margin: 0;
    line-height: 1.3;
    min-width: 0;
    text-wrap: wrap;
    word-break: normal;
    hyphens: none;
    overflow-wrap: break-word;
}

/* Keep hero summaries visually consistent across help pages (overrides page-specific inline max-widths) */
.idb-admin-page-help .idb-admin-page-header > p.idb-admin-muted:first-of-type {
    max-width: 780px;
}

/* Tiny “breadcrumb-ish” helper links under header */
.idb-help-breadcrumb {
    font-size: 0.78rem;
    color: var(--idb-muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.idb-help-breadcrumb a {
    text-decoration: none;
}

.idb-help-breadcrumb a:hover {
    text-decoration: underline;
}

@media (max-width: 959px) {
    .idb-admin-page-help .idb-admin-page-header {
        min-height: 0;
        padding: 12px 16px 10px;
        gap: 4px;
    }

    .idb-admin-page-help .idb-admin-page-header h1 {
        text-wrap: wrap;
    }

    .idb-help-breadcrumb {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* =========================================================
   HELP CONTENT & TOC
   ========================================================= */

.idb-help-content {
    margin-top: 0;
}

/* Remove big top gap before the first section/card */
.idb-help-content > *:first-child {
    margin-top: 0;
}

/* Help cards hover polish */
.idb-help-content .idb-card {
    transition:
        box-shadow 0.18s ease,
        transform 0.16s ease,
        border-color 0.18s ease,
        background-color 0.18s ease;
}

.idb-help-content .idb-card:hover {
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
    transform: translateY(-1px);
    border-color: rgba(2, 132, 199, 0.35);
    background-color: #fefefe;
}

/* TOC container */
.idb-help-toc {
    font-size: 0.86rem;
}

/* TOC links style */
.idb-help-toc a {
    text-decoration: none;
    color: #1f2937;
}

.idb-help-toc a:hover {
    text-decoration: underline;
}

/* =========================================================
   FIX SIDEBAR / TOC OVERLAP - WIDE SCREEN GRID
   ========================================================= */
@media (min-width: 960px) {
    .idb-help-layout {
        display: grid;
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 22px;
        align-items: flex-start;
    }

    .idb-help-toc {
        position: sticky;
        top: 14px;
    }
}

/* =========================================================
   HELP SIDEBAR - QUICK NAV POLISH
   ========================================================= */

.idb-help-toc .idb-card {
    background: linear-gradient(145deg, #f9fafb 0, #eef2ff 45%, #ffffff 100%);
    border-radius: 16px;
    border-color: rgba(148, 163, 184, 0.55);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.idb-help-toc h2 {
    font-size: 0.96rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--idb-text);
}

.idb-help-toc ul {
    list-style: none;
    padding-left: 0;
    margin: 0 0 6px;
    font-size: 0.86rem;
}

.idb-help-toc li {
    margin-bottom: 3px;
}

.idb-help-toc li a {
    display: block;
    width: 100%;
    padding: 3px 6px;
    border-radius: 6px;
    line-height: 1.3;
    color: #111827;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.12s ease;
}

.idb-help-toc li a:hover {
    background: rgba(2, 132, 199, 0.09);
    color: var(--idb-brand-700);
    transform: translateX(1px);
}

.idb-help-toc .idb-admin-muted {
    font-size: 0.76rem;
    line-height: 1.4;
}


/* Admin tables (shared) */
/* ==========================================================================
   Table primitive (legacy fallback)
   Neutral table structure/resets. Customer/admin table visuals should be owned
   by portal-user.css / portal-admin.css.
   ========================================================================== */
.idb-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    font-size: 0.80rem;
}
.idb-table thead {
    background: transparent;
}
.idb-table th,
.idb-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--idb-border);
    vertical-align: top;
}
.idb-table th {
    font-weight: 600;
    color: #374151;
    text-align: left;
}

/* ==========================================================================
   Legacy scoped table overrides (compatibility)
   Do not add new table branding here; portal-user.css / portal-admin.css own
   table visuals. Keep only legacy utilities and context-scoped compatibility
   overrides until migrated.
   ========================================================================== */
/* Generic scroll helpers */
.idb-table-scroll-x {
    display: block;
    width: 100%;
    overflow-x: auto;
}
.idb-table-scroll-y {
    display: block;
    max-height: 220px;
    overflow-y: auto;
}
.idb-table-nowrap th,
.idb-table-nowrap td {
    white-space: nowrap;
}
.idb-cell-truncate {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Legacy compatibility: compact activity log table sizing */
.idb-activity-table th,
.idb-activity-table td {
    padding: 4px 8px;
    font-size: 0.82rem;
    vertical-align: top;
}
.idb-activity-table td:nth-child(3),
.idb-activity-table td:nth-child(4) {
    white-space: normal;
}
.idb-activity-table td:nth-child(6) {
    max-width: 260px;
    word-break: break-word;
}

.idb-table-wrap-scroll {
    display: block;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.idb-table-wide {
    min-width: 1200px;
}

/* =========================================================
   ADMIN SUMMARY CARDS (Backups & others)
   ========================================================= */







/* Backups page card compact mode overrides */





/* =========================================================
   USER PORTAL - ENTERPRISE SHELL + INTERACTIONS
   ========================================================= */

/* Base .idb-user-portal-shell frame removed — the shell is now a plain
   container (de-framed in portal-user.css); every user is idb-body-customer. */

/* Top row: welcome + logout */
.idb-user-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 8px;
}

.idb-user-header-email {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.96rem;
    color: var(--idb-text);
}
.idb-user-header-email span:first-child { font-weight: 600; }

.idb-user-header-logout {
    font-size: 0.86rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.9);
    background: rgba(255,255,255,0.85);
    color: #0b7285;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.10);
    transition: background 0.12s, box-shadow 0.12s, transform 0.08s;
}
.idb-user-header-logout:hover {
    background: var(--idb-brand-100);
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.18);
    transform: translateY(-1px);
}

/* Intro + headings */
.idb-user-intro { margin: 0 0 10px; font-size: 0.88rem; color: var(--idb-muted-2); }
.idb-user-section { margin-bottom: 18px; }
.idb-user-section-title { margin: 0 0 4px; font-size: 1.02rem; font-weight: 600; }
.idb-user-section-subtitle { margin: 0 0 10px; font-size: 0.86rem; color: var(--idb-muted); }

/* License alerts */
.idb-lic-alert {
    border-radius: 12px;
    padding: 10px 14px;
    margin: 10px 0 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.idb-lic-alert--expiring {
    background: var(--idb-warn-50);
    border: 1px solid #fed7aa;
    box-shadow: 0 6px 14px rgba(245,158,11,0.18);
    color: var(--idb-warn-text);
}
.idb-lic-alert--expired {
    background: var(--idb-danger-50);
    border: 1px solid #fecaca;
    box-shadow: 0 6px 16px rgba(239,68,68,0.22);
    color: var(--idb-danger-text);
}

/* Customer user-portal tables sit directly inside their section's padding;
   the section already provides the border/shadow, so the wrapper is unframed
   (was a redundant card-in-card frame). */
.idb-user-portal .idb-table-wrap {
    margin-top: 8px;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
}
.idb-user-portal .idb-user-table-scroll { max-height: 340px; }
.idb-user-portal .idb-table th {
    font-size: 0.8rem;
    color: var(--idb-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.idb-user-portal .idb-table td { font-size: 0.88rem; }
.idb-user-portal .idb-table tbody tr:hover { background: #f1f5f9; }

/* Truncate long names */
.idb-user-portal .idb-cell-truncate {
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action-buttons column — cap ONLY columns explicitly marked as actions, not
   every last column. A blanket td:last-child cap wrapped/starved data columns
   whose last cell holds real data (e.g. download_history's receipt number). */
.idb-user-portal table.idb-table th.idb-table-actions-col,
.idb-user-portal table.idb-table td.idb-table-actions-col {
    width: 220px;
    max-width: 220px;
}

/* Actions row */
.idb-user-portal .idb-user-actions {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    /* Wrap within the 220px actions column instead of overflowing/clipping on
       narrow screens; the gap supplies the vertical spacing between wrapped rows. */
    flex-wrap: wrap;
}

.idb-user-portal .idb-user-actions .idb-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
}

/* Wrap on very small screens */
@media (max-width: 640px) {
    .idb-user-portal table.idb-table th.idb-table-actions-col,
    .idb-user-portal table.idb-table td.idb-table-actions-col {
        width: auto;
        max-width: none;
    }
    .idb-user-portal .idb-user-actions {
        flex-wrap: wrap;
        row-gap: 4px;
    }
}

/* Legacy compatibility (customer user-portal): license table fitment */
.idb-licenses-table th,
.idb-licenses-table td {
    white-space: nowrap;
    font-size: 0.80rem;
    padding: 4px 8px;
}

.idb-licenses-col-name {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.idb-licenses-col-cores {
    width: 80px;
}
.idb-licenses-col-dates {
    width: 115px;
}
.idb-licenses-col-status {
    width: 90px;
}

.idb-licenses-table .idb-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
}

.idb-licenses-table-actions {
    width: 210px;
    max-width: 210px;
    white-space: nowrap;
}
.idb-licenses-table-actions .idb-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
    gap: 6px;
}

@media (max-width: 640px) {
    .idb-licenses-table th,
    .idb-licenses-table td {
        white-space: normal;
    }
    .idb-licenses-table-actions {
        width: auto;
        max-width: none;
    }
    .idb-licenses-table-actions .idb-btn {
        flex-wrap: wrap;
        row-gap: 4px;
    }
}

/* Company box margin */
.idb-user-portal .idb-company-box {
    margin-top: 8px;
}

/* Support note */
.idb-user-support-note {
    margin-top: 12px;
    font-size: 0.82rem;
    color: var(--idb-muted);
}

/* Primary license pill */
.idb-primary-license-pill {
    margin: 4px 0 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(148,163,184,0.8);
    box-shadow: 0 6px 16px rgba(15,23,42,0.10);
    display: flex;
    justify-content: space-between;
    gap: 8px 12px;
}
.idb-primary-license-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.idb-primary-license-label { font-size: 0.9rem; font-weight: 600; }
.idb-primary-license-detail { font-size: 0.8rem; color: var(--idb-muted); }
.idb-primary-license-pill .idb-badge { flex-shrink: 0; }

@media (max-width: 640px) {
    .idb-primary-license-pill {
        flex-direction: column;
        align-items: flex-start;
    }
}


.idb-pwa-install-banner {
    margin: 12px auto 0;
    max-width: 1180px;
    padding: 0 12px;
}

.idb-pwa-install-banner__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 18px;
    background: linear-gradient(135deg, #173a63 0%, #25528a 100%);
    color: #fff;
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 10px 24px rgba(12, 35, 64, 0.16);
}

.idb-pwa-install-banner__copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.idb-pwa-install-banner__copy strong {
    font-size: 1rem;
    font-weight: 700;
}

.idb-pwa-install-banner__copy span {
    font-size: 0.9rem;
    opacity: 0.92;
}

.idb-pwa-install-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.idb-pwa-install-banner .idb-btn {
    white-space: nowrap;
}

.idb-pwa-install-banner .idb-btn-ghost {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.idb-pwa-install-banner .idb-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 760px) {
    .idb-pwa-install-banner__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .idb-pwa-install-banner__actions {
        width: 100%;
        flex-wrap: wrap;
    }
}
