/* ════════════════════════════════════════════════════
   NIGHTRIDER DESIGN SYSTEM

   Include AFTER style.css on every page.
   Docs: /docs/DESIGN_SYSTEM.md
   Preview: /admin/design-preview.php
   ════════════════════════════════════════════════════ */

:root {
    /* ── Colors ── */
    --ds-bg:             #000000;
    --ds-surface:        #111111;      /* Cards, panels, elevated surfaces */
    --ds-surface-hover:  #1a1a1a;
    --ds-input:          #1a1a1a;      /* Input field backgrounds */
    --ds-accent:         #E91E8C;
    --ds-accent-hover:   #ff4da6;
    --ds-accent-text:    #ffffff;      /* Auto: white on dark accents, black on light accents */
    --ds-text:           #ffffff;
    --ds-text-secondary: #999999;      /* Subtitles, labels, less important text */
    --ds-text-faint:     rgba(255,255,255,0.4); /* Disabled, placeholders */
    --ds-border:         #333333;
    --ds-border-subtle:  #222222;

    /* ── Accent derivatives (auto-overridden by brand_style.php) ── */
    --ds-accent-subtle:        rgba(233, 30, 140, 0.12);  /* tinted backgrounds (badges, highlights) */
    --ds-accent-subtle-border: rgba(233, 30, 140, 0.25);  /* borders on tinted elements */
    --ds-accent-glow:          rgba(233, 30, 140, 0.35);  /* shadows, focus rings, glows */
    --ds-accent-faint:         rgba(233, 30, 140, 0.06);  /* very subtle hover/active backgrounds */
    --ds-accent-gradient-end:  #9333ea;                    /* gradient endpoint */
    --ds-accent-readable:      #E91E8C;                    /* accent adjusted for text readability */

    /* ── Surface overlays (mode-safe: white on dark, black on light) ── */
    --ds-overlay-light:        rgba(255, 255, 255, 0.06);
    --ds-overlay-medium:       rgba(255, 255, 255, 0.10);
    --ds-overlay-heavy:        rgba(255, 255, 255, 0.15);

    /* Status — neon colors matching retro-futuristic brand */
    --ds-ok:             #00ff88;
    --ds-warn:           #ff9900;
    --ds-bad:            #ff3333;
    --ds-info:           #60a5fa;

    /* Status-color readable variants — dark mode defaults (overridden in light mode via generateThemePalette) */
    --ds-info-subtle:     rgba(96, 165, 250, 0.15);
    --ds-info-readable:   #60a5fa;
    --ds-ok-subtle:       rgba(0, 200, 100, 0.15);
    --ds-ok-readable:     #00cc6f;
    --ds-warn-subtle:     rgba(255, 153, 0, 0.15);
    --ds-warn-readable:   #ff9900;
    --ds-bad-subtle:      rgba(255, 51, 51, 0.15);
    --ds-bad-readable:    #ff3333;

    /* Destructive — outlined red for delete/remove actions */
    --color-destructive:          #ff4d4d;
    --color-destructive-hover-bg: #ff4d4d;

    /* Status badges — softer tones for status indicators */
    --color-status-success:        #5cb85c;
    --color-status-success-bg:     rgba(40, 167, 69, 0.15);
    --color-status-success-border: rgba(40, 167, 69, 0.3);
    --color-status-warning:        #e6a817;
    --color-status-warning-bg:     rgba(230, 168, 23, 0.15);
    --color-status-warning-border: rgba(230, 168, 23, 0.3);
    --color-status-danger:         #ff6b6b;
    --color-status-danger-bg:      rgba(220, 53, 69, 0.15);
    --color-status-danger-border:  rgba(220, 53, 69, 0.3);

    /* Schedule phase colors — fixed semantic, not affected by branding */
    --color-phase-loadin:  #4da6c9;
    --color-phase-show:    var(--ds-accent);
    --color-phase-loadout: #d4952a;

    /* ── Legacy Aliases ──
       The existing style.css uses these variable names. During migration, both
       old and new code must work. These aliases point to the design system tokens
       so changing a ds-* value updates everything. */
    --color-primary:       var(--ds-accent);
    --color-primary-hover: var(--ds-accent-hover);
    --color-primary-dark:  #c4147a;
    --color-bg:            var(--ds-bg);
    --color-bg-light:      #0a0a0a;
    --color-bg-card:       var(--ds-surface);
    --color-bg-input:      var(--ds-input);
    --color-bg-hover:      var(--ds-surface-hover);
    --color-bg-elevated:   #151515;
    --color-text:          var(--ds-text);
    --color-text-muted:    #888888;
    --color-text-light:    #cccccc;
    --color-border:        var(--ds-border);
    --color-border-light:  #444444;
    --color-success:       var(--ds-ok);
    --color-success-bg:    rgba(0, 255, 136, 0.15);
    --color-warning:       var(--ds-warn);
    --color-warning-bg:    rgba(255, 153, 0, 0.15);
    --color-danger:        var(--ds-bad);
    --color-danger-bg:     rgba(255, 51, 51, 0.15);
    --color-completed:     var(--ds-ok);
    --color-completed-bg:  rgba(0, 255, 136, 0.2);

    /* ── Typography ── */
    --ds-font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ds-text-xs:        10px;         /* Timestamps, bottom-nav labels */
    --ds-text-caption:   12px;         /* Secondary info, badge text */
    --ds-text-sm:        13px;         /* Labels, badges, captions, table data */
    --ds-text-base:      15px;         /* Body text, inputs, buttons */
    --ds-text-lg:        20px;         /* Section titles, card titles */
    --ds-text-display:   24px;         /* Page titles on mobile (scales to 32px desktop) */

    /* ── Spacing ── */
    --ds-xs:             4px;          /* Tight: between icon and text, badge padding */
    --ds-sm:             8px;          /* Compact: between related items */
    --ds-md:             16px;         /* Standard: card padding, form gaps */
    --ds-lg:             32px;         /* Generous: between sections, page padding */
    --ds-xl:             48px;         /* Spacious: large section gaps, mobile nav height */

    /* Legacy spacing aliases */
    --spacing-xs:        var(--ds-xs);
    --spacing-sm:        var(--ds-sm);
    --spacing-md:        var(--ds-md);
    --spacing-lg:        24px;         /* Keep existing value — legacy pages expect 1.5rem */
    --spacing-xl:        var(--ds-lg);
    --spacing-xxl:       48px;

    /* ── Radius (2 values only) ── */
    --ds-radius:         8px;          /* Buttons, inputs, cards */
    --ds-radius-full:    9999px;       /* Badges, pills */

    /* Legacy radius aliases */
    --radius-sm:         4px;
    --radius-md:         var(--ds-radius);
    --radius-lg:         12px;
    --radius-full:       var(--ds-radius-full);

    /* ── Fixed values ── */
    --ds-shadow:         0 1px 3px rgba(0,0,0,0.3);
    --ds-transition:     0.15s ease;
    --ds-tap-min:        44px;         /* Minimum touch target */

    /* Legacy transition/shadow aliases */
    --transition-fast:   var(--ds-transition);
    --transition-normal: 0.3s ease;
    --shadow-sm:         0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md:         0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg:         0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow:       0 0 20px var(--ds-accent-glow);

    /* ── Breakpoints (for reference — use in @media min-width queries) ── */
    --ds-bp-sm:          480px;
    --ds-bp-md:          768px;
    --ds-bp-lg:          1024px;
    --ds-bp-xl:          1280px;
}


/* ── Context overrides ── */

/* Admin: desktop-first, denser */
body.ctx-admin {
    --ds-text-base:  14px;
    --ds-md:         12px;
    --ds-lg:         24px;
    --ds-tap-min:    36px;
}

/* App: mobile-first, spacious (crew briefing, on-site mode) */
body.ctx-app {
    --ds-text-base:  16px;
    --ds-md:         16px;
    --ds-lg:         32px;
    --ds-tap-min:    48px;
}


/* ═══════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════ */

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--ds-accent);
    outline-offset: 2px;
}

/* Remove outline for mouse clicks, keep for keyboard */
:focus:not(:focus-visible) {
    outline: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}


/* ═══════════════════════════════════════════
   ICONS
   ═══════════════════════════════════════════ */

.icon {
    width: 18px; height: 18px;
    stroke: currentColor; fill: none;
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    vertical-align: middle; flex-shrink: 0; display: inline-block;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }


/* ═══════════════════════════════════════════
   BUTTONS
   NOTE: Existing style.css defines .btn, .btn-primary, .btn-outline, .btn-danger, .btn-small.
   The nr_button() PHP helper generates buttons with BOTH old and new classes.
   These styles add to/override existing when design-system.css is loaded.
   ═══════════════════════════════════════════ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-xs);
    padding: var(--ds-sm) var(--ds-md);
    font: 600 var(--ds-text-sm)/1.4 var(--ds-font);
    border: 1px solid transparent; border-radius: var(--ds-radius);
    cursor: pointer; transition: all var(--ds-transition);
    min-height: var(--ds-tap-min); text-decoration: none; white-space: nowrap;
}
.btn-primary   { background: var(--ds-accent); color: var(--ds-accent-text); border-color: transparent; }
.btn-primary:hover,
.btn-primary:focus-visible { background: var(--ds-accent-hover); color: var(--ds-accent-text); box-shadow: 0 0 20px var(--ds-accent-glow); transform: translateY(-1px); }
.btn-primary:active { background: var(--color-primary-dark); box-shadow: none; transform: translateY(0); }
.btn-outline,
.btn-secondary { background: transparent; color: var(--ds-text); border-color: var(--ds-border); }
.btn-outline:hover,
.btn-secondary:hover { background: var(--ds-surface); border-color: var(--ds-text-secondary); }
.btn-danger    { background: transparent; color: var(--color-destructive); border-color: var(--color-destructive); }
.btn-danger:hover { background: var(--color-destructive-hover-bg); color: var(--ds-text); }
/* Ghost buttons removed — use 'secondary' instead */
.btn:disabled  { opacity: 0.4; cursor: not-allowed; pointer-events: none; }


/* ═══════════════════════════════════════════
   CARDS
   NOTE: Existing pages use .project-card, .artist-card, etc. Those keep working.
   The design system adds a generic .card class for new components via nr_card_open().
   ═══════════════════════════════════════════ */

.card {
    background: var(--ds-surface); border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius); padding: var(--ds-md); box-shadow: var(--ds-shadow);
}
.card-title { font-size: var(--ds-text-lg); font-weight: 700; margin: 0 0 var(--ds-sm); }


/* ═══════════════════════════════════════════
   FORMS
   NOTE: Existing pages use .form-group, .form-row, .form-section. Those keep working.
   The design system adds .field, .field-label, .field-input for use with nr_field().
   ═══════════════════════════════════════════ */

.field       { margin-bottom: var(--ds-md); }
.field-label {
    display: block; font-size: var(--ds-text-sm); color: var(--ds-text-secondary);
    font-weight: 600; margin-bottom: var(--ds-xs);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.field-input, .field-select, .field-textarea {
    width: 100%; padding: var(--ds-sm) var(--ds-md);
    font: normal var(--ds-text-base) var(--ds-font); color: var(--ds-text);
    background: var(--ds-input); border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius); min-height: var(--ds-tap-min); box-sizing: border-box;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
    outline: none; border-color: var(--ds-accent);
}
.field-input::placeholder { color: var(--ds-text-faint); }
.field-hint  { font-size: var(--ds-text-sm); color: var(--ds-text-faint); margin-top: var(--ds-xs); }
.field-error { font-size: var(--ds-text-sm); color: var(--ds-bad); margin-top: var(--ds-xs); }

/* Password requirements live validator */
.pw-requirements {
    list-style: none;
    padding: 0;
    margin: var(--ds-sm) 0 0 0;
    font-size: var(--ds-text-sm);
}
.pw-requirements li {
    padding: 2px 0;
    color: var(--ds-bad);
    transition: color 0.15s ease;
}
.pw-requirements li::before {
    content: '✕';
    display: inline-block;
    width: 18px;
    font-size: 11px;
}
.pw-requirements li.met {
    color: var(--ds-ok);
}
.pw-requirements li.met::before {
    content: '✓';
}


/* ═══════════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════════ */

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-md);
    padding: var(--ds-sm) 0;
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.toggle-title {
    font-size: var(--ds-text-base, 15px);
    font-weight: 500;
    color: var(--ds-text);
}

.toggle-desc {
    font-size: var(--ds-text-sm, 13px);
    color: var(--ds-text-faint);
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--ds-input);
    border: 1px solid var(--ds-border);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--ds-transition), border-color var(--ds-transition);
}

.toggle-knob {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ds-text-faint);
    position: absolute;
    top: 1px;
    left: 2px;
    transition: left var(--ds-transition), background var(--ds-transition);
}

.toggle-input:checked + .toggle-switch {
    background: var(--ds-accent);
    border-color: var(--ds-accent);
}

.toggle-input:checked + .toggle-switch .toggle-knob {
    left: 21px;
    background: var(--ds-accent-text);
}

.toggle-input:focus-visible + .toggle-switch {
    outline: 2px solid var(--ds-accent);
    outline-offset: 2px;
}

/* ── Toggle Compact (no label, table use) ── */
.toggle-row.toggle-compact {
    padding: 0;
    justify-content: center;
}


/* ═══════════════════════════════════════════
   BADGES
   NOTE: Existing pages use .status-badge, .genre-tag, etc. Those keep working.
   The design system adds .badge for use with nr_badge().
   ═══════════════════════════════════════════ */

.badge {
    display: inline-flex; align-items: center; gap: var(--ds-xs);
    padding: 2px 10px; font-size: var(--ds-text-sm); font-weight: 600;
    border-radius: var(--ds-radius-full); white-space: nowrap;
}
.badge-ok   { background: var(--ds-ok-subtle);   color: var(--ds-ok-readable); }
.badge-warn { background: var(--ds-warn-subtle);  color: var(--ds-warn-readable); }
.badge-bad  { background: var(--ds-bad-subtle);   color: var(--ds-bad-readable); }
.badge-info { background: var(--ds-info-subtle);  color: var(--ds-info-readable); }
.badge-muted { background: var(--ds-surface-hover); color: var(--ds-text-secondary); }

/* Category/label badges — neutral gray for non-status info (genres, types, roles) */
.badge-category {
    background: #2a2a2a; color: #b0b0b0;
    border: 1px solid #3a3a3a; border-radius: 4px;
    font-weight: 500;
}

/* Status badges — semantic colors with borders */
.badge-status-success {
    background: var(--color-status-success-bg); color: var(--color-status-success);
    border: 1px solid var(--color-status-success-border); border-radius: 4px;
    font-weight: 600;
}
.badge-status-warning {
    background: var(--color-status-warning-bg); color: var(--color-status-warning);
    border: 1px solid var(--color-status-warning-border); border-radius: 4px;
    font-weight: 600;
}
.badge-status-danger {
    background: var(--color-status-danger-bg); color: var(--color-status-danger);
    border: 1px solid var(--color-status-danger-border); border-radius: 4px;
    font-weight: 600;
}

/* Brand badge — magenta accent for highlights (TODAY, YOU, counts) */
.badge-brand {
    background: var(--ds-accent-subtle); color: var(--ds-accent);
    border: 1px solid var(--ds-accent-subtle-border); border-radius: 4px;
    font-weight: 600;
}

/* Crew/person pill containers — flex-wrap with gap */
.crew-pills { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* ═══════════════════════════════════════════
   TABLES
   NOTE: Existing pages use .data-table. That keeps working.
   The design system adds .ds-table for use in new pages or via nr_* helpers.
   ═══════════════════════════════════════════ */

.ds-table { width: 100%; border-collapse: collapse; font-size: var(--ds-text-sm); }
.ds-table th {
    text-align: left; padding: var(--ds-sm); font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ds-border);
}
.ds-table td { padding: var(--ds-sm); border-bottom: 1px solid rgba(255,255,255,0.05); vertical-align: top; }
.ds-table tr:hover td { background: var(--ds-surface-hover); }

/* Responsive table wrapper */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) {
    .table-responsive { margin: 0 calc(var(--ds-md) * -1); padding: 0 var(--ds-md); }
}


/* ═══════════════════════════════════════════
   SECTION TOOLBAR (detached title + actions)
   ═══════════════════════════════════════════ */

.nr-section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 var(--ds-sm) 0;
    margin-bottom: var(--ds-md);
    gap: var(--ds-sm);
}

.nr-section-toolbar .nr-section-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nr-section-toolbar .nr-section-left .icon {
    color: var(--ds-accent);
    flex-shrink: 0;
}

.nr-section-toolbar .nr-section-title {
    font-size: var(--ds-text-lg);
    font-weight: 700;
    color: var(--ds-accent);
    white-space: nowrap;
}

.nr-section-toolbar .nr-section-count {
    font-size: var(--ds-text-sm);
    font-weight: 600;
    color: var(--ds-text-secondary);
    white-space: nowrap;
}

.nr-section-toolbar .nr-section-right {
    display: flex;
    align-items: center;
    gap: var(--ds-sm);
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════
   COLLAPSIBLE SECTIONS
   Formalized from crew briefing pattern. Primary use: ctx-app mobile views.
   ═══════════════════════════════════════════ */

.nr-collapsible {
    border-radius: var(--ds-radius); overflow: visible;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
}
.nr-collapsible-header {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 14px var(--ds-md);
    background: var(--ds-surface); border: none;
    color: var(--ds-accent); font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none;
}
.nr-collapsible-header:hover { background: var(--ds-surface-hover); }
.nr-collapsible-header:active { background: var(--ds-surface-hover); }
.nr-collapsible-header .nr-chevron {
    display: inline-flex; align-items: center;
    color: var(--ds-accent);
    transition: transform 0.25s ease;
}
.nr-collapsible.collapsed .nr-chevron { transform: rotate(-90deg); }
.nr-collapsible-content {
    padding: 0 var(--ds-md) var(--ds-md);
    background: transparent;
    max-height: 10000px; opacity: 1; overflow: visible;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}
.nr-collapsible.collapsed .nr-collapsible-content {
    max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; overflow: hidden;
}
.nr-collapsible.all-done .nr-collapsible-header { opacity: 0.6; }
.nr-collapsible.all-done .category-progress { color: var(--ds-ok); }


/* ═══════════════════════════════════════════
   SCHEDULE STATES
   Used by on-site schedule and crew briefing. Phase border colors
   are applied per-page since item markup differs.
   ═══════════════════════════════════════════ */

.schedule-item-done { opacity: 0.45; }
.schedule-item-done .schedule-title {
    text-decoration: line-through; text-decoration-color: #555;
}
.schedule-item-now {
    background: var(--ds-accent-faint);
    box-shadow: 0 0 0 1px var(--ds-accent-subtle-border);
}
.schedule-item-upcoming { opacity: 0.7; }

/* NOW / NEXT badge pill */
.schedule-now-badge, .schedule-next-badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: var(--ds-radius-full);
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; margin-left: 6px;
    vertical-align: middle;
}
.schedule-now-badge {
    background: var(--ds-accent); color: var(--ds-accent-text);
    animation: ds-pulse 2s ease-in-out infinite;
}
.schedule-next-badge {
    background: var(--ds-surface-hover); color: var(--ds-text-secondary);
    border: 1px solid var(--ds-border);
}
@keyframes ds-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Done checkmark circle */
.schedule-done-check {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--color-status-success-bg); color: var(--color-status-success);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-right: 6px;
}
.schedule-done-check svg { width: 10px; height: 10px; }


/* ═══════════════════════════════════════════
   MODAL
   NOTE: Existing pages use .modal, .modal-content, .modal-header, .modal-close.
   Those keep working as-is. The nr_modal_open() helper generates markup using
   the EXISTING modal classes so it works with the existing modal CSS in style.css.
   These additions ensure design system variables are respected.
   ═══════════════════════════════════════════ */

.modal {
    padding: var(--ds-lg);
}
.modal-content {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
}
.modal-header {
    padding: var(--ds-md);
    border-bottom: 1px solid var(--ds-border);
}
.modal-close {
    background: none; border: none; color: var(--ds-text-secondary);
    font-size: 1.5rem; cursor: pointer; padding: var(--ds-xs); line-height: 1;
    min-width: var(--ds-tap-min); min-height: var(--ds-tap-min);
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--ds-text); }
.modal-content form { padding: var(--ds-md); }
.modal-footer {
    display: flex; gap: var(--ds-sm); justify-content: flex-end;
    padding: var(--ds-md); border-top: 1px solid var(--ds-border);
}

/* Large modal variant */
.modal-content.modal-large { max-width: 800px; }
.modal-content.modal-full  { max-width: 95vw; max-height: 95vh; }

/* Mobile modal: near-fullscreen */
@media (max-width: 768px) {
    .modal {
        padding: var(--ds-sm);
        padding-top: 10px;
        align-items: flex-start;
    }
    .modal-content {
        max-width: 100%;
        max-height: calc(100vh - 20px);
        margin: 0;
        border-radius: var(--ds-radius);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .modal-content.modal-large,
    .modal-content.modal-full { max-width: 100%; }
    .modal-content form {
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }
    .modal-header {
        flex-shrink: 0;
    }
    /* Sticky save/cancel buttons at bottom of modal on mobile */
    .modal-content .form-actions {
        position: sticky;
        bottom: 0;
        background: var(--ds-surface);
        padding: var(--ds-md);
        margin: 0 calc(-1 * var(--ds-md));
        border-top: 1px solid var(--ds-border);
        flex-shrink: 0;
        z-index: 2;
    }
}


/* ═══════════════════════════════════════════
   DETAIL LAYOUT
   Sidebar + main content grid for detail pages (artist, venue, crew).
   ═══════════════════════════════════════════ */

.detail-layout {
    display: grid;
    grid-template-columns: min(320px, 100%) 1fr;
    gap: var(--ds-lg);
    align-items: start;
    max-width: 100%;
    overflow: hidden;
}
.detail-sidebar .card {
    position: sticky;
    top: var(--ds-lg);
}
.detail-sidebar { min-width: 0; }
.detail-main { min-width: 0; }

@media (max-width: 768px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-sidebar .card { position: static; }
}


/* ═══════════════════════════════════════════
   TABS
   NOTE: Existing pages use .planning-tabs and .planning-tab. Those keep working.
   The design system adds a generic .tabs / .tab pattern for use in new contexts.
   ═══════════════════════════════════════════ */

.tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--ds-border);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: var(--ds-xs);
    padding: var(--ds-sm) var(--ds-md); font-size: var(--ds-text-sm); font-weight: 600;
    color: var(--ds-text-secondary); background: none; border: none; cursor: pointer;
    white-space: nowrap; border-bottom: 2px solid transparent;
    transition: all var(--ds-transition); min-height: var(--ds-tap-min);
}
.tab:hover { color: var(--ds-text); }
.tab.active { color: var(--ds-accent); border-bottom-color: var(--ds-accent); }
.tab .tab-count {
    font-size: 11px; background: var(--ds-surface); padding: 1px 6px;
    border-radius: var(--ds-radius-full); color: var(--ds-text-secondary);
}
.tab.active .tab-count { background: var(--ds-accent-subtle); color: var(--ds-accent); }


/* ═══════════════════════════════════════════
   AVATARS
   Standard avatar circle: gradient background, 2-letter initials, or image.
   Always use nr_avatar() helper — never raw HTML for avatar circles.
   ═══════════════════════════════════════════ */

.nr-avatar {
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; flex-shrink: 0; overflow: hidden;
    background: linear-gradient(135deg, var(--ds-accent), var(--ds-accent-gradient-end));
    color: var(--ds-accent-text); font-weight: 700;
}
.nr-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.nr-avatar-sm  { width: 32px; height: 32px; font-size: 0.7rem; }
.nr-avatar-md  { width: 44px; height: 44px; font-size: 0.9rem; }
.nr-avatar-lg  { width: 56px; height: 56px; font-size: 1rem; }


/* ═══════════════════════════════════════════
   CONTACT ACTIONS
   ═══════════════════════════════════════════ */

.contact-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 14px; font-size: var(--ds-text-sm); font-weight: 600;
    border: none; border-radius: var(--ds-radius); text-decoration: none; min-height: 36px;
    white-space: nowrap;
}
.contact-email    { background: rgba(255,255,255,0.08); color: var(--ds-text-secondary); }
.contact-email:hover { color: var(--ds-accent); background: rgba(255,255,255,0.12); }
.contact-call     { background: var(--ds-info-subtle); color: var(--ds-info-readable); }
.contact-whatsapp { background: var(--ds-ok-subtle);   color: var(--ds-ok-readable); }
.contact-btn:active { opacity: 0.7; }
.detail-contact-btns { display: flex; gap: var(--ds-sm); flex-wrap: wrap; }


/* ═══════════════════════════════════════════
   ALERTS (Flash Messages)
   The existing flash message system (setFlash/displayFlash) outputs .alert,
   .alert-success, .alert-error, .alert-warning classes. These styles update them
   to use design system variables while maintaining the same visual pattern.
   ═══════════════════════════════════════════ */

.alert {
    padding: var(--ds-sm) var(--ds-md);
    border-radius: var(--ds-radius);
    margin-bottom: var(--ds-md);
    font-size: var(--ds-text-sm);
    font-weight: 600;
}


/* ═══════════════════════════════════════════
   INTERACTION STATES
   ═══════════════════════════════════════════ */

/* Loading — add .is-loading to any button */
.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.is-loading::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 16px; height: 16px; margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: var(--ds-accent-text);
    border-radius: 50%; animation: ds-spin 0.6s linear infinite;
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* Success flash — add briefly after save */
.is-success { border-color: var(--ds-ok) !important; }

/* Error state on inputs */
.is-error { border-color: var(--ds-bad) !important; }

/* Toast notification — for AJAX/JS feedback (not page reloads, use flash for that) */
.toast {
    position: fixed; bottom: var(--ds-lg); left: 50%; transform: translateX(-50%);
    padding: var(--ds-sm) var(--ds-md); font-size: var(--ds-text-sm); font-weight: 600;
    background: var(--ds-surface); border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius); box-shadow: var(--ds-shadow);
    z-index: 9999; opacity: 0; transition: opacity var(--ds-transition);
    display: flex; align-items: center; gap: var(--ds-sm);
}
.toast.visible { opacity: 1; }
.toast-ok   { border-color: var(--ds-ok); color: var(--ds-ok); }
.toast-bad  { border-color: var(--ds-bad); color: var(--ds-bad); }

/* Empty state — when a section has no data */
.empty-state {
    text-align: center; padding: 48px 24px;
    color: var(--ds-text-secondary); font-size: var(--ds-text-sm);
    border: 1px dashed #333; border-radius: 12px;
}
.empty-state-icon {
    width: 48px; height: 48px; margin: 0 auto var(--ds-md);
    display: flex; align-items: center; justify-content: center;
    background: var(--ds-surface); border-radius: 50%;
    color: #555;
}
.empty-state-title {
    font-size: 15px; color: #aaa; margin: 0 0 4px; font-weight: 600;
}
.empty-state-desc {
    font-size: 13px; color: #666; margin: 0 0 var(--ds-md);
}
.empty-state .btn { margin-top: var(--ds-sm); }

/* Confirm dialog overlay */
.dialog-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
}
.dialog {
    background: var(--ds-surface); border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius); padding: var(--ds-md);
    max-width: 400px; width: 90%;
}
.dialog-title { font-size: var(--ds-text-lg); font-weight: 700; margin-bottom: var(--ds-sm); }
.dialog-text { color: var(--ds-text-secondary); margin-bottom: var(--ds-md); }
.dialog-actions { display: flex; gap: var(--ds-sm); justify-content: flex-end; }


/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */

.page-content   { max-width: 1200px; margin: 0 auto; padding: var(--ds-md); }
.page-narrow    { max-width: 800px; }
.stack          { display: flex; flex-direction: column; gap: var(--ds-md); }
.row            { display: flex; gap: var(--ds-md); align-items: center; }
.row-between    { display: flex; justify-content: space-between; align-items: center; }
.grid-2         { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ds-md); }
.grid-3         { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--ds-md); }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }


/* ═══════════════════════════════════════════
   LINK UTILITIES
   ═══════════════════════════════════════════ */

a.link-accent, .link-accent a { color: var(--ds-accent); text-decoration: none; }
a.link-accent:hover, .link-accent a:hover { text-decoration: underline; }


/* ═══════════════════════════════════════════
   STATUS DOT
   Small colored circle for status indicators.
   ═══════════════════════════════════════════ */

.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: var(--ds-radius-full);
    flex-shrink: 0;
}
.status-dot-ok    { background: var(--ds-ok); }
.status-dot-warn  { background: var(--ds-warn); }
.status-dot-bad   { background: var(--ds-bad); }
.status-dot-muted { background: var(--ds-text-secondary); }
.status-dot-pulse { animation: ds-pulse 2s ease-in-out infinite; }
@keyframes ds-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}


/* ═══════════════════════════════════════════
   TASK CHECK
   Circle-based task completion indicator.
   Circles = task progress, Squares = form selection.
   ═══════════════════════════════════════════ */

.task-check {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px;
    border-radius: var(--ds-radius-full);
    border: 1.5px solid var(--ds-border);
    background: transparent;
    flex-shrink: 0;
    transition: all var(--ds-transition);
}
.task-check-done {
    background: var(--ds-ok);
    border-color: var(--ds-ok);
}
.task-check-done .icon { color: #000; width: 12px; height: 12px; }

/* Size variants */
.task-check-compact { width: 16px; height: 16px; }
.task-check-compact.task-check-done .icon { width: 10px; height: 10px; }

.task-check-mobile {
    width: 24px; height: 24px;
    /* Expand tap area without changing visual size */
    position: relative;
}
.task-check-mobile::before {
    content: ""; position: absolute;
    inset: -10px; /* 24 + 20 = 44px tap area */
}
.task-check-mobile.task-check-done .icon { width: 14px; height: 14px; }


/* ═══════════════════════════════════════════
   TASK ROW
   Unified task row layout for category-grouped task lists.
   Used in project-detail.php task section.
   ═══════════════════════════════════════════ */

/* Legacy .task-row flex layout (non-table contexts) */
div.task-row, li.task-row {
    display: flex;
    align-items: center;
    gap: var(--ds-md);
    padding: var(--ds-md) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}
div.task-row:last-child, li.task-row:last-child { border-bottom: none; }

/* All task rows (table + flex) — transitions for animations */
.task-row {
    transition: background var(--ds-transition), transform 0.3s ease, opacity 0.3s ease;
}

.task-row-clickable { cursor: pointer; border-radius: var(--ds-radius); padding: var(--ds-sm); margin: 0 calc(-1 * var(--ds-sm)); }
.task-row-clickable:hover { background: var(--ds-surface-hover); }
.task-row-clickable:active { background: rgba(255, 255, 255, 0.08); }

.task-row-subtask { padding-left: 32px; }
.task-row-subtask .task-title { font-size: var(--ds-text-sm); }

/* Task row inner layout */
.task-expand {
    background: none; border: none; cursor: pointer;
    padding: var(--ds-xs); color: var(--ds-text-secondary);
    transition: transform 0.2s ease;
    min-width: 24px; min-height: 24px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.task-expand:hover { color: var(--ds-text); }
.task-expand.is-open { transform: rotate(90deg); }

/* Legacy .task-checkbox flex layout (non-table contexts) */
div.task-checkbox, span.task-checkbox {
    flex-shrink: 0;
    cursor: pointer;
    min-width: 24px; min-height: 24px;
    display: flex; align-items: center; justify-content: center;
    margin-right: var(--ds-xs);
}
/* Table cell checkbox — keep table display, just center content */
td.task-checkbox { cursor: pointer; text-align: center; }
.task-checkbox:hover .task-check { border-color: var(--ds-accent); }

.task-content {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 1px;
}

.task-title {
    font-size: var(--ds-text-base); font-weight: 500;
    color: var(--ds-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-title.completed {
    text-decoration: line-through;
    text-decoration-color: var(--ds-text-secondary);
    color: var(--ds-text-secondary);
}

.task-notes-preview {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
}

.task-deadline {
    flex-shrink: 0;
    display: flex; flex-direction: column; align-items: flex-end;
    gap: 1px;
    font-size: var(--ds-text-sm);
}
.task-deadline .deadline-date { color: var(--ds-text-secondary); white-space: nowrap; }
.task-deadline .deadline-days { font-size: var(--ds-text-xs); color: var(--ds-text-faint); }

/* Legacy .task-meta flex layout (non-table contexts) */
div.task-meta, span.task-meta {
    display: flex; align-items: center; gap: var(--ds-sm);
    flex-shrink: 0;
    margin-right: var(--ds-xs);
}

/* File indicator */
.task-file-indicator { color: var(--ds-text-faint); display: flex; align-items: center; }
.task-file-indicator.has-files { color: var(--ds-accent); }

/* Dot menu (three-dot dropdown) */
.task-menu-wrap, .issue-menu-wrap { position: relative; flex-shrink: 0; }
.task-menu {
    background: none; border: none; cursor: pointer;
    color: var(--ds-text-secondary); padding: var(--ds-xs);
    min-width: 28px; min-height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--ds-radius);
}
.task-menu:hover { color: var(--ds-text); background: var(--ds-surface-hover); }

.task-menu-dropdown {
    display: none;
    position: absolute; right: 0; top: 100%; z-index: 100;
    background: var(--ds-surface); border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius); padding: var(--ds-xs) 0;
    min-width: 150px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.task-menu-dropdown.active { display: block; }
.task-menu-wrap:has(.task-menu-dropdown.active) { z-index: 200; }
.task-row:has(.task-menu-dropdown.active) { z-index: 200; }
.task-menu-dropdown button {
    display: flex; align-items: center; gap: var(--ds-sm);
    width: 100%; padding: var(--ds-sm) var(--ds-md);
    background: none; border: none; color: var(--ds-text);
    font-size: var(--ds-text-sm); cursor: pointer; text-align: left;
}
.task-menu-dropdown button:hover { background: var(--ds-surface-hover); }
.task-menu-dropdown button.menu-danger { color: var(--ds-bad); }
.task-menu-dropdown button.menu-danger:hover { background: rgba(255, 51, 51, 0.1); }

/* Mobile: show dot menu, hide desktop buttons. Desktop: vice versa. */
.mobile-dot-menu { display: none; }

/* Status classes on task rows — left border indicator + text colors */
.task-row.status-completed .task-expand,
.task-row.status-completed .task-checkbox,
.task-row.status-completed .task-content,
.task-row.status-completed .task-meta,
.task-row.status-completed .task-deadline {
    opacity: 0.6;
}
.task-row.status-overdue .deadline-date { color: var(--ds-bad); font-weight: 600; }
.task-row.status-urgent .deadline-date { color: var(--ds-warn); font-weight: 600; }

/* Task table — fixed layout so th widths control columns (auto = Task gets remaining space) */
.task-table { table-layout: fixed; }
.task-table .td-task { overflow: hidden; }

/* Task table rows — override old style.css display:flex + backgrounds + border-left */
.task-table tr.task-row,
.task-table tr.task-row.status-overdue,
.task-table tr.task-row.status-urgent,
.task-table tr.task-row.status-completed {
    display: table-row;
    background: none;
    border-left: none;
}

/* Left-side color indicator via box-shadow on first cell (works with border-collapse) */
.task-table tr.task-row td:first-child { box-shadow: inset 3px 0 0 transparent; }
.task-table tr.task-row.status-overdue td:first-child { box-shadow: inset 3px 0 0 var(--ds-bad); }
.task-table tr.task-row.status-urgent td:first-child { box-shadow: inset 3px 0 0 var(--ds-warn); }
.task-table tr.task-row.status-completed td:first-child { box-shadow: inset 3px 0 0 var(--ds-ok); }


/* Subtask container — expand/collapse */
.task-subtasks {
    max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 0;
}
.task-subtasks-open { max-height: 2000px; opacity: 1; }

/* Task completion animation (existing pattern, kept here) */
.task-check.check-animate {
    animation: ds-check-pop 0.3s ease;
}
@keyframes ds-check-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}
.task-row.completing { background: rgba(0, 255, 136, 0.05); }

/* Mobile: stack layout */
@media (max-width: 768px) {
    .task-row { flex-wrap: wrap; }
    .task-content { flex-basis: calc(100% - 80px); }
    .task-deadline { display: none; }
    .task-meta .badge { display: none; }
    .task-row-subtask { padding-left: 24px; }
}


/* ═══════════════════════════════════════════
   TASK DETAIL SLIDE PANEL
   Right-side panel for viewing/editing task details.
   Desktop: 420px side panel. Mobile: full-width bottom sheet.
   ═══════════════════════════════════════════ */

.task-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 420px; max-width: 100vw;
    background: var(--ds-surface);
    border-left: 1px solid var(--ds-border);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 200;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.task-panel-open { transform: translateX(0); }

.task-panel-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
/* Overlay visible on mobile only when panel is open */
.task-panel-overlay.active { opacity: 1; visibility: visible; }

.task-panel-header {
    display: flex; align-items: center; gap: var(--ds-sm);
    padding: var(--ds-md);
    border-bottom: 1px solid var(--ds-border);
    flex-shrink: 0;
}
.task-panel-title {
    flex: 1; min-width: 0;
    font-size: var(--ds-text-lg); font-weight: 600;
    color: var(--ds-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-panel-save-state {
    font-size: var(--ds-text-xs);
    color: var(--ds-text-secondary);
    white-space: nowrap; flex-shrink: 0;
    transition: color 0.2s ease;
}
.task-panel-save-state.saved { color: var(--ds-ok); }

.task-panel-body {
    flex: 1; overflow-y: auto;
    overflow-x: hidden;
    padding: var(--ds-md);
    -webkit-overflow-scrolling: touch;
}
.task-panel-body .field-input,
.task-panel-body .field-select,
.task-panel-body .field-textarea {
    max-width: 100%;
    box-sizing: border-box;
}

.task-panel-section {
    margin-bottom: var(--ds-md);
    padding-bottom: var(--ds-md);
    border-bottom: 1px solid var(--ds-border);
}
.task-panel-section:last-child { border-bottom: none; }

.task-panel-label {
    font-size: var(--ds-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ds-text-secondary);
    margin-bottom: var(--ds-xs);
    font-weight: 600;
}

/* Status button group inside panel */
.task-status-buttons {
    display: flex; gap: var(--ds-xs);
}
.task-status-buttons .btn { flex: 1; justify-content: center; }

/* File chips */
.task-file-list {
    display: flex; flex-wrap: wrap; gap: var(--ds-xs);
    margin-bottom: var(--ds-sm);
}

.task-file-chip {
    display: inline-flex; align-items: center; gap: var(--ds-xs);
    background: var(--ds-surface-hover);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    padding: var(--ds-xs) var(--ds-sm);
    font-size: var(--ds-text-sm);
    color: var(--ds-text);
    max-width: 200px;
}
.task-file-chip-name {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1; min-width: 0;
}

.task-file-ext {
    font-weight: 700;
    font-size: var(--ds-text-xs);
    text-transform: uppercase;
    flex-shrink: 0;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.2;
}
.task-file-ext-pdf  { color: var(--ds-bad); background: rgba(255, 51, 51, 0.15); }
.task-file-ext-doc  { color: var(--ds-info); background: rgba(96, 165, 250, 0.15); }
.task-file-ext-xls  { color: var(--ds-ok); background: rgba(0, 255, 136, 0.15); }
.task-file-ext-img  { color: #c084fc; background: rgba(192, 132, 252, 0.15); }
.task-file-ext-other { color: var(--ds-text-secondary); background: rgba(255, 255, 255, 0.08); }

.task-file-delete {
    background: none; border: none; cursor: pointer;
    color: var(--ds-text-faint); padding: 0; line-height: 1;
    display: flex; align-items: center;
    min-width: 18px; min-height: 18px;
}
.task-file-delete:hover { color: var(--ds-bad); }

.task-upload-btn {
    margin-top: var(--ds-xs);
}

/* Parent task link */
.task-parent-link {
    color: var(--ds-text-secondary);
    text-decoration: none;
    font-size: var(--ds-text-sm);
    display: inline-flex; align-items: center; gap: var(--ds-xs);
}
.task-parent-link:hover { color: var(--ds-accent); text-decoration: underline; }

/* Mobile: full-width bottom sheet behavior */
@media (max-width: 768px) {
    .task-panel {
        width: 100%; top: auto; bottom: 0; left: 0; right: 0;
        max-height: 90vh;
        border-left: none;
        border-top: 1px solid var(--ds-border);
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        transform: translateY(100%);
        overflow-x: hidden;
    }
    .task-panel-open { transform: translateY(0); }
    .task-panel-overlay.active { display: block; }
}

/* Print: hide panel */
@media print {
    .task-panel, .task-panel-overlay { display: none !important; }
}


/* ═══════════════════════════════════════════
   SKELETON LOADING
   Shimmer placeholders for loading states.
   ═══════════════════════════════════════════ */

.skeleton {
    background: var(--ds-surface);
    border-radius: var(--ds-radius);
    position: relative; overflow: hidden;
}
.skeleton::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.04) 50%,
        transparent 100%
    );
    animation: ds-shimmer 1.5s infinite;
}
@keyframes ds-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.skeleton-text   { height: 14px; width: 80%; margin-bottom: var(--ds-sm); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--ds-radius-full); }
.skeleton-card   { height: 80px; width: 100%; }


/* ═══════════════════════════════════════════
   MOBILE CARD
   Touch-optimized card for mobile list views.
   ═══════════════════════════════════════════ */

.card-mobile {
    display: flex; align-items: center; gap: var(--ds-sm);
    padding: var(--ds-sm) var(--ds-md);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    min-height: 56px;
    transition: background var(--ds-transition);
}
.card-mobile:active { background: var(--ds-surface-hover); }

.card-mobile-avatar {
    width: 40px; height: 40px; border-radius: var(--ds-radius-full);
    object-fit: cover; flex-shrink: 0;
    background: linear-gradient(135deg, var(--ds-accent), var(--ds-accent-gradient-end));
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: var(--ds-text-sm); color: var(--ds-accent-text);
}
.card-mobile-body { flex: 1; min-width: 0; }
.card-mobile-title {
    display: flex; align-items: center; gap: 6px;
    font-size: var(--ds-text-base); font-weight: 600;
    color: var(--ds-text); white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.card-mobile-subtitle {
    font-size: var(--ds-text-sm); color: var(--ds-text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-mobile-meta {
    display: flex; align-items: center; gap: var(--ds-xs);
    flex-shrink: 0;
}
.card-mobile-actions {
    display: flex; align-items: center; gap: var(--ds-xs);
    flex-shrink: 0;
}
.card-mobile-badges {
    display: inline-flex; align-items: center; gap: var(--ds-xs);
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════
   BOTTOM NAVIGATION
   Fixed bottom nav for on-site/briefing (ctx-app only).
   ═══════════════════════════════════════════ */

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--ds-surface);
    border-top: 1px solid var(--ds-border);
    display: flex; align-items: center; justify-content: space-around;
    z-index: 900;
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    min-width: 56px; height: 56px;
    padding: var(--ds-xs);
    color: var(--ds-text-secondary);
    text-decoration: none;
    font-size: var(--ds-text-xs);
    transition: color var(--ds-transition);
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item .icon { width: 24px; height: 24px; }
.bottom-nav-item-active {
    color: var(--ds-accent);
}
.bottom-nav-item-active::after {
    content: ""; display: block;
    width: 4px; height: 4px; border-radius: var(--ds-radius-full);
    background: var(--ds-accent);
    margin-top: 1px;
}

/* Only show in ctx-app, hide in ctx-admin */
body.ctx-admin .bottom-nav { display: none; }

/* Add bottom padding to page content when bottom-nav is present */
body.ctx-app .page-content { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + var(--ds-md)); }


/* ═══════════════════════════════════════════
   BOTTOM SHEET
   Slide-up panel replacing modals on mobile.
   ═══════════════════════════════════════════ */

.bottom-sheet-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.bottom-sheet-overlay.active { opacity: 1; visibility: visible; }

.bottom-sheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--ds-surface);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 90vh;
    display: flex; flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-sheet.active { transform: translateY(0); }

/* Size variants */
.bottom-sheet-sm { max-height: 30vh; }
.bottom-sheet-md { max-height: 50vh; }
.bottom-sheet-lg { max-height: 80vh; }

.bottom-sheet-handle {
    width: 36px; height: 4px;
    background: var(--ds-border);
    border-radius: var(--ds-radius-full);
    margin: var(--ds-sm) auto;
    flex-shrink: 0;
    cursor: grab;
}
.bottom-sheet-header {
    padding: 0 var(--ds-md) var(--ds-sm);
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--ds-border);
    flex-shrink: 0;
}
.bottom-sheet-title {
    font-size: var(--ds-text-lg); font-weight: 700;
    color: var(--ds-text);
}
.bottom-sheet-body {
    padding: var(--ds-md);
    overflow-y: auto; flex: 1;
    -webkit-overflow-scrolling: touch;
}


/* ═══════════════════════════════════════════
   FLOATING ACTION BUTTON (FAB)
   ═══════════════════════════════════════════ */

.fab {
    position: fixed;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px)); /* Above bottom nav */
    right: var(--ds-md);
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--ds-accent);
    color: var(--ds-accent-text);
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px var(--ds-accent-glow);
    z-index: 800;
    transition: transform var(--ds-transition), box-shadow var(--ds-transition);
    -webkit-tap-highlight-color: transparent;
}
.fab:hover { transform: scale(1.05); box-shadow: 0 6px 16px var(--ds-accent-glow); }
.fab:active { transform: scale(0.95); }
.fab .icon { width: 24px; height: 24px; }

/* Extended FAB with label */
.fab-extended {
    width: auto; padding: 0 var(--ds-md);
    gap: var(--ds-xs);
    font-size: var(--ds-text-sm); font-weight: 600;
}

/* Hide FAB when no bottom nav (desktop) */
body.ctx-admin .fab { display: none; }


/* ═══════════════════════════════════════════
   RESPONSIVE UTILITIES
   ═══════════════════════════════════════════ */

.mobile-only { display: none !important; }

@media (max-width: 768px) {
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }
}


/* ═══════════════════════════════════════════
   TABLE CARDS MOBILE
   Opt-in via .table-cards-mobile on .table-responsive wrapper.
   Transforms data-tables into stacked cards on mobile.
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {

    /* ── Base card transformation ── */

    /* Reset the wrapper: no scroll, no negative margins, contained width */
    .table-responsive.table-cards-mobile {
        margin: 0;
        padding: 0;
        overflow: visible;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Remove outer .card wrapper styling when it contains cards-mobile */
    .card:has(.table-cards-mobile) {
        background: none;
        border: none;
        padding: 0;
        box-shadow: none;
    }

    /* Kill ALL table display modes — force everything to block */
    .table-responsive.table-cards-mobile .data-table,
    .table-responsive.table-cards-mobile .data-table thead,
    .table-responsive.table-cards-mobile .data-table tbody,
    .table-responsive.table-cards-mobile .data-table tr,
    .table-responsive.table-cards-mobile .data-table th,
    .table-responsive.table-cards-mobile .data-table td {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0 !important;
        float: none;
        box-sizing: border-box;
    }

    /* Table itself */
    .table-responsive.table-cards-mobile .data-table {
        overflow: visible;
        background: none;
        border-radius: 0;
        border-collapse: separate;
        table-layout: fixed;
    }

    /* Hide table header entirely */
    .table-responsive.table-cards-mobile .data-table thead {
        display: none;
    }

    /* Each row = a card — height:auto is critical, browsers don't auto-size <tr> even with display:block */
    .table-responsive.table-cards-mobile .data-table tbody tr {
        display: block;
        height: auto !important;
        background: var(--color-bg-card, #1a1a1a);
        border: 1px solid var(--color-border, #333);
        border-radius: var(--ds-radius, 8px);
        padding: var(--ds-md, 16px);
        margin-bottom: var(--ds-md, 16px);
        overflow: hidden;
    }

    /* Every cell = a flex row with label::before on left + content on right */
    .table-responsive.table-cards-mobile .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--ds-xs, 4px) 0;
        border: none;
        border-bottom: none;
        font-size: var(--ds-text-sm, 13px);
        white-space: normal;
        text-align: left;
    }

    /* Label from data-label attribute */
    .table-responsive.table-cards-mobile .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ds-text-secondary, #999);
        font-size: var(--ds-text-caption, 12px);
        min-width: 100px;
        flex-shrink: 0;
    }

    /* No label for empty data-label or cells without data-label */
    .table-responsive.table-cards-mobile .data-table tbody td[data-label=""]::before,
    .table-responsive.table-cards-mobile .data-table tbody td:not([data-label])::before {
        display: none;
    }

    /* First cell = card title: bigger, bold, no label */
    .table-responsive.table-cards-mobile .data-table tbody td:first-child {
        font-weight: 700;
        font-size: var(--ds-text-base, 15px);
        color: var(--ds-text, #fff);
        padding-bottom: var(--ds-sm, 8px);
    }

    .table-responsive.table-cards-mobile .data-table tbody td:first-child::before {
        display: none;
    }

    /* Actions cell: centered buttons, top border separator */
    .table-responsive.table-cards-mobile .data-table tbody td.actions,
    .table-responsive.table-cards-mobile .data-table tbody td[data-label=""] {
        justify-content: center;
        gap: var(--ds-sm, 8px);
        padding-top: var(--ds-sm, 8px);
        margin-top: var(--ds-xs, 4px);
        border-top: 1px solid var(--color-border, #333);
    }

    .table-responsive.table-cards-mobile .data-table tbody td.actions::before,
    .table-responsive.table-cards-mobile .data-table tbody td[data-label=""]::before {
        display: none;
    }

    /* Progress bar: full width inside cards */
    .table-responsive.table-cards-mobile .progress-bar {
        width: 100%;
        flex: 1;
    }

    /* ── Venues compact cards ── */

    .venues-table td[data-label="City"],
    .venues-table td[data-label="Country"],
    .venues-table td[data-label="Type"],
    .venues-table td[data-label="Capacity"] {
        display: none !important;
    }
    .venues-table td[data-label="Name"] {
        display: block;
        font-weight: 600;
        font-size: var(--ds-text-base, 15px);
        padding-bottom: 0;
    }
    .venues-table td[data-label="Name"]::before { display: none; }
    .venues-table .venue-combined {
        display: block;
        font-size: var(--ds-text-sm, 13px);
        color: var(--ds-text-secondary, #999);
        padding: 2px 0;
    }
    .venues-table .venue-combined::before { display: none; }
    /* Actions: flow naturally at bottom, no border since card is compact */
    .venues-table td.actions {
        justify-content: flex-start;
        border-top: none;
        padding-top: var(--ds-xs, 4px);
        margin-top: 0;
    }

    /* ── Artists compact cards ── */

    .artists-table td[data-label="Genre"],
    .artists-table td[data-label="Country"],
    .artists-table td[data-label="Contact"] {
        display: none !important;
    }
    .artists-table td[data-label="Artist"] {
        display: flex;
        align-items: center;
        gap: var(--ds-sm, 8px);
        font-weight: 600;
        font-size: var(--ds-text-base, 15px);
        padding-bottom: 0;
    }
    .artists-table td[data-label="Artist"]::before { display: none; }
    .artists-table .artist-combined {
        display: block;
        font-size: var(--ds-text-sm, 13px);
        color: var(--ds-text-secondary, #999);
        padding: 2px 0 0 44px; /* indent past avatar */
    }
    .artists-table .artist-combined::before { display: none; }
    /* Actions: flow naturally at bottom */
    .artists-table td.actions {
        justify-content: flex-start;
        border-top: none;
        padding-top: var(--ds-xs, 4px);
        margin-top: 0;
        padding-left: 44px; /* align with name past avatar */
    }

    /* ── Projects compact cards ── */

    .projects-table tbody tr {
        border-left-width: 3px;
    }
    .projects-table td[data-label="Client"],
    .projects-table td[data-label="Show Date"] {
        display: none !important;
    }
    /* Project name: block, full width */
    .projects-table td[data-label="Project"] {
        display: block;
        font-weight: 600;
        font-size: var(--ds-text-base, 15px);
        padding-bottom: 0;
    }
    .projects-table td[data-label="Project"]::before { display: none; }
    /* Status badge: inline after name on same line */
    .projects-table td[data-label="Status"] {
        display: inline-block;
        border: none;
        padding: 0 0 var(--ds-xs, 4px) 0;
        margin: 0;
        width: auto;
    }
    .projects-table td[data-label="Status"]::before { display: none; }
    /* Combined info line */
    .projects-table .project-combined {
        display: block;
        font-size: var(--ds-text-sm, 13px);
        color: var(--ds-text-secondary, #999);
        padding: 2px 0;
    }
    .projects-table .project-combined::before { display: none; }
    /* Progress bar: full width, no label */
    .projects-table td[data-label="Progress"] {
        display: block;
        padding: var(--ds-xs, 4px) 0;
    }
    .projects-table td[data-label="Progress"]::before { display: none; }
    /* Deadline: block, no label */
    .projects-table td[data-label="Deadline"] {
        display: block;
        font-size: var(--ds-text-sm, 13px);
        border: none;
        padding: 0;
    }
    .projects-table td[data-label="Deadline"]::before { display: none; }
    /* Hide deadline if just a dash */
    .projects-table td[data-label="Deadline"].no-deadline {
        display: none !important;
    }
    /* Actions: flow at bottom, left-aligned */
    .projects-table td.actions {
        justify-content: flex-start;
        border-top: none;
        padding-top: var(--ds-xs, 4px);
        margin-top: 0;
    }
}


/* ═══════════════════════════════════════════
   FLIGHT CARD
   Shared flight card component used in admin planning & portal travel.
   Uses --ds-* tokens so it works in both contexts.
   ═══════════════════════════════════════════ */

/* Grid layout for multiple flight cards (admin) */
.ds-flight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--ds-md);
}

/* Card container */
.ds-flight-card {
    background: var(--ds-surface, #111);
    border-radius: var(--radius-lg, 12px);
    padding: 14px;
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--ds-accent);
}

.ds-flight-card.outbound {
    border-left-color: var(--ds-accent);
}

.ds-flight-card.return {
    border-left-color: var(--ds-info, #60a5fa);
}

/* Status shown via badge pill only — border always reflects flight direction (outbound/return) */

/* ── Type Line: direction badge + status + date ── */
.ds-flight-type-line {
    display: flex;
    align-items: center;
    gap: var(--ds-sm);
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ds-flight-type-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ds-accent);
}

.ds-flight-type-badge.return {
    color: var(--ds-info, #60a5fa);
}

.ds-flight-date {
    font-size: 0.8rem;
    color: var(--ds-text-secondary);
    margin-left: auto;
}

/* ── Passenger Names Row (PM view) ── */
.ds-flight-passengers {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    background: var(--color-bg-elevated, #151515);
    border-radius: var(--radius-sm, 4px);
    font-size: 0.8rem;
    color: var(--ds-text-secondary);
    margin-bottom: 12px;
}

.ds-flight-passengers .icon {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Passenger Badges (admin: individual name chips) ── */
.ds-flight-passenger-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.ds-flight-passenger-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-bg-elevated, #151515);
    border-radius: var(--ds-radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
    color: var(--ds-text-secondary);
}

/* ── Route Visualization: DEP ✈ ARR ── */
.ds-flight-route {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ds-sm);
    margin-bottom: 12px;
}

.ds-flight-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 60px;
}

.ds-flight-code {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1;
    color: var(--ds-text);
}

.ds-flight-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ds-text-secondary);
    font-variant-numeric: tabular-nums;
}

.ds-flight-time-struck {
    text-decoration: line-through;
    opacity: 0.5;
}

.ds-flight-time-actual {
    color: var(--ds-warn);
    font-weight: 600;
}

.ds-flight-terminal {
    font-size: 0.7rem;
    color: var(--ds-text-faint, rgba(255,255,255,0.4));
    text-align: center;
}

/* Flight line (horizontal line with plane icon) */
.ds-flight-line {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    min-width: 40px;
    margin-top: 10px;
}

.ds-flight-line-bar {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--ds-border);
}

.ds-flight-line-icon {
    position: relative;
    z-index: 1;
    margin: 0 auto;
    color: var(--ds-text-secondary);
    background: var(--ds-surface, #111);
    padding: 0 4px;
}

/* ── Delay Banner ── */
.ds-flight-delay {
    padding: 6px 12px;
    background: var(--color-warning-bg, rgba(255, 153, 0, 0.1));
    border-radius: var(--radius-sm, 4px);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ds-warn);
    margin-bottom: 10px;
}

/* ── Info Grid (flight details: key-value rows) ── */
.ds-flight-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.ds-flight-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ds-flight-info-row:last-child {
    border-bottom: none;
}

.ds-flight-info-label {
    font-size: 0.8rem;
    color: var(--ds-text-secondary);
    flex-shrink: 0;
    width: 90px;
}

.ds-flight-info-value {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: right;
    flex: 1;
    word-break: break-word;
    color: var(--ds-text);
}

.ds-flight-airline {
    color: var(--ds-text-secondary);
    font-weight: 400;
    font-size: 0.8rem;
}

/* ── Copyable Fields ── */
.ds-copyable {
    cursor: pointer;
    padding: 2px 6px;
    background: var(--color-bg-elevated, #151515);
    border-radius: 4px;
    font-family: 'SF Mono', SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    transition: background var(--ds-transition);
    position: relative;
    display: inline-block;
}

.ds-copyable:active {
    background: var(--ds-accent-subtle);
}

.ds-copyable.copied::after {
    content: 'Copied!';
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ds-accent);
    color: var(--ds-accent-text);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    animation: ds-fade-out-up 1s ease forwards;
}

@keyframes ds-fade-out-up {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
    70%  { opacity: 1; transform: translateX(-50%) translateY(-4px); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-12px); }
}

/* ── Notes ── */
.ds-flight-notes {
    padding: 8px 10px;
    background: var(--color-bg-elevated, #151515);
    border-radius: var(--radius-sm, 4px);
    font-size: 0.8rem;
    color: var(--ds-text-secondary);
    margin-top: 8px;
    line-height: 1.4;
}

/* ── Flight Actions / Footer ── */
.ds-flight-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ds-sm);
}

.ds-flight-track-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--ds-accent);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    min-height: var(--ds-tap-min, 44px);
    padding: 8px 0;
}

.ds-flight-track-link:hover {
    text-decoration: underline;
}

.ds-flight-track-link:active {
    opacity: 0.7;
}

.ds-flight-updated {
    font-size: 0.75rem;
    color: var(--ds-text-secondary);
}

.ds-flight-admin-actions {
    display: flex;
    gap: var(--ds-xs);
    align-items: center;
}

/* ── Flight Status Badge ── */
.ds-flight-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--ds-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ds-flight-status.status-arrived   { background: var(--ds-ok-subtle);   color: var(--ds-ok-readable); }
.ds-flight-status.status-enroute   { background: var(--ds-info-subtle); color: var(--ds-info-readable); }
.ds-flight-status.status-cancelled { background: var(--ds-bad-subtle);  color: var(--ds-bad-readable); }
.ds-flight-status.status-scheduled { background: var(--ds-overlay-light); color: var(--ds-text-secondary); }
.ds-flight-status.status-unknown   { background: var(--ds-overlay-light); color: var(--ds-text-secondary); }

/* ── Responsive: mobile ── */
@media (max-width: 768px) {
    .ds-flight-grid {
        grid-template-columns: 1fr;
        gap: var(--ds-sm);
    }

    .ds-flight-code {
        font-size: 1.2rem;
    }

    .ds-flight-point {
        min-width: 45px;
    }

    .ds-flight-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ds-flight-admin-actions {
        justify-content: flex-end;
    }
}


/* ═══════════════════════════════════════════
   PROJECT OVERVIEW — HERO
   ═══════════════════════════════════════════ */

.project-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--ds-lg);
    margin-bottom: var(--ds-lg);
}
@media (min-width: 768px) {
    .project-hero {
        grid-template-columns: 1fr auto;
        align-items: start;
    }
}

.project-hero-left {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hero-identity {
    display: flex;
    flex-direction: column;
    gap: var(--ds-xs);
    align-items: flex-start;
}
.hero-identity .project-title-row {
    align-self: stretch;
}

.project-title-row {
    display: flex;
    align-items: center;
    gap: var(--ds-sm);
    flex-wrap: wrap;
}

/* Inline edit pencil button */
.btn-edit-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--ds-radius);
    border: 1px solid var(--ds-border);
    background: transparent;
    color: var(--ds-text-secondary);
    cursor: pointer;
    transition: all var(--ds-transition);
    flex-shrink: 0;
}
.btn-edit-inline:hover {
    border-color: var(--ds-accent);
    color: var(--ds-accent);
}
.btn-edit-inline .icon { width: 14px; height: 14px; }

/* Countdown pill — mobile only */
.countdown-pill { display: none; }
@media (max-width: 767px) {
    .countdown-pill {
        display: inline-flex;
        align-items: baseline;
        gap: 3px;
        background: color-mix(in srgb, var(--ds-accent) 10%, transparent);
        border: 1px solid color-mix(in srgb, var(--ds-accent) 28%, transparent);
        border-radius: var(--ds-radius-full);
        padding: var(--ds-xs) 10px;
        white-space: nowrap;
        margin-left: auto;
        flex-shrink: 0;
    }
    .pill-num {
        font-size: var(--ds-text-base);
        font-weight: 800;
        color: var(--ds-accent);
    }
    .pill-lbl {
        font-size: 11px;
        font-weight: 600;
        color: var(--ds-accent);
        opacity: 0.8;
    }
    .pill-date {
        font-size: 11px;
        color: var(--ds-text-secondary);
        margin-left: 2px;
    }
}


/* ═══════════════════════════════════════════
   PROJECT OVERVIEW — HERO CHIPS
   ═══════════════════════════════════════════ */

.hero-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 14px;
}

.hero-link-chips {
    margin-top: 20px;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    padding: var(--ds-xs) 10px;
    border-radius: var(--ds-radius-full);
    text-decoration: none;
    white-space: nowrap;
    cursor: default;
    transition: border-color var(--ds-transition), color var(--ds-transition);
}
a.hero-chip:hover {
    border-color: var(--ds-accent);
    color: var(--ds-text);
    cursor: pointer;
}
.hero-chip .icon {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    opacity: 0.65;
}

.hero-chip-empty {
    color: var(--ds-text-secondary);
    font-style: italic;
    opacity: 0.6;
}

button.hero-chip-action {
    cursor: pointer;
    font-family: inherit;
    color: var(--ds-accent-readable);
    border-color: var(--ds-accent-subtle-border);
}
button.hero-chip-action:hover {
    border-color: var(--ds-accent);
    background: var(--ds-accent-faint);
}


/* ═══════════════════════════════════════════
   PROJECT OVERVIEW — QUICK INFO CARDS
   ═══════════════════════════════════════════ */

.quick-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ds-sm);
    margin-bottom: var(--ds-lg);
}
@media (min-width: 768px) {
    .quick-info-grid { grid-template-columns: repeat(4, 1fr); }
}

.qi-card {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    padding: var(--ds-md);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color var(--ds-transition);
}
.qi-card:hover { border-color: color-mix(in srgb, var(--ds-accent) 40%, transparent); }

.qi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--ds-sm);
}

.qi-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
}
.qi-header .icon { color: var(--ds-text-secondary); flex-shrink: 0; }

.qi-label {
    font-size: 10px;
    color: var(--ds-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.qi-edit-link {
    font-size: 10px;
    color: var(--ds-accent);
    text-decoration: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--ds-transition);
    white-space: nowrap;
}
.qi-card:hover .qi-edit-link { opacity: 1; }

.qi-value {
    font-size: var(--ds-text-lg);
    font-weight: 600;
    line-height: 1.2;
}

.qi-sub {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    line-height: 1.6;
}
.qi-sub .time-hl {
    color: var(--ds-accent);
    font-weight: 700;
    font-size: 14px;
}

.qi-accent {
    background: linear-gradient(135deg, var(--ds-accent), var(--ds-accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tasks mini progress bar */
.qi-tasks-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.qi-tasks-label {
    font-size: var(--ds-text-sm);
    font-weight: 400;
    color: var(--ds-text-secondary);
    white-space: nowrap;
}

.qi-mini-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.qi-mini-bar-row .qi-mini-bar { flex: 1; }

.qi-mini-bar {
    height: 3px;
    background: var(--ds-border);
    border-radius: var(--ds-radius-full);
    overflow: hidden;
    margin-top: 6px;
}

.qi-mini-fill {
    height: 100%;
    background: var(--ds-accent);
    border-radius: var(--ds-radius-full);
}

.qi-mini-pct {
    font-size: 10px;
    color: var(--ds-text-secondary);
    white-space: nowrap;
    font-weight: 600;
}


/* ═══════════════════════════════════════════
   PROJECT OVERVIEW — TAB WRAPPER + PANELS
   ═══════════════════════════════════════════ */

/* Scroll gradient fades for horizontal tab bar */
.tabs-wrap {
    position: relative;
    margin-bottom: 0;
}

.tabs-wrap::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 56px;
    background: linear-gradient(to right, transparent, var(--ds-bg));
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 2;
}

.tabs-wrap::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 56px;
    background: linear-gradient(to left, transparent, var(--ds-bg));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.tabs-wrap.show-left::before  { opacity: 1; }
.tabs-wrap.hide-right::after  { opacity: 0; }

/* Tab content panels */
.tab-panel {
    display: none;
    animation: panelIn 0.15s ease;
}
.tab-panel.active { display: block; }

@keyframes panelIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}


/* ═══════════════════════════════════════════
   PROJECT OVERVIEW — ISSUES
   ═══════════════════════════════════════════ */

.il-section { margin-bottom: var(--ds-lg); }
.il-section + .il-section {
    padding-top: var(--ds-sm);
    border-top: 1px solid var(--ds-border);
}

/* Issue cards */
.issue-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: var(--ds-sm) var(--ds-md);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    margin-bottom: var(--ds-sm);
}
.issue-card:last-child { margin-bottom: 0; }

.issue-priority-bar {
    width: 3px;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 36px;
}
.issue-priority-critical { background: var(--ds-bad); }
.issue-priority-high     { background: var(--ds-bad); }
.issue-priority-med      { background: var(--ds-warn); }
.issue-priority-low      { background: var(--ds-border); }

.issue-card-body { flex: 1; min-width: 0; }

.issue-card-top {
    display: flex;
    align-items: flex-start;
    gap: var(--ds-sm);
    margin-bottom: var(--ds-xs);
}

.issue-card-title {
    font-size: var(--ds-text-sm);
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
}

.issue-card-meta {
    font-size: 12px;
    color: var(--ds-text-secondary);
    line-height: 1.5;
}

.issue-card-detail {
    margin-top: var(--ds-sm);
    padding-top: var(--ds-sm);
    border-top: 1px solid var(--ds-border);
    font-size: 12px;
    color: var(--ds-text-secondary);
    line-height: 1.6;
}

.issue-card-thumbs {
    display: flex;
    gap: 6px;
    margin-top: var(--ds-sm);
    flex-wrap: wrap;
}

.issue-card-img {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    object-fit: cover;
    border: 1px solid var(--ds-border);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.issue-card-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--ds-sm);
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════
   PROJECT OVERVIEW — EVENT LOG
   ═══════════════════════════════════════════ */

.log-phase-group { margin-bottom: 20px; }

.log-phase-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ds-text-secondary);
    margin-bottom: 10px;
    padding: 3px var(--ds-sm);
    border-radius: var(--ds-radius-full);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ds-border);
}
.log-phase-chip.phase-live {
    color: var(--ds-ok);
    background: rgba(0, 255, 136, 0.07);
    border-color: rgba(0, 255, 136, 0.2);
}
.log-phase-chip.phase-post {
    color: var(--ds-text-secondary);
}

.log-entry {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: var(--ds-sm) var(--ds-md);
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    margin-bottom: var(--ds-sm);
}
.log-entry:last-child { margin-bottom: 0; }

.log-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ds-accent), var(--ds-accent-gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--ds-accent-text);
    flex-shrink: 0;
    margin-top: 1px;
}
.log-avatar-green { background: linear-gradient(135deg, #00b894, #00cec9); }
.log-avatar-blue  { background: linear-gradient(135deg, #0984e3, #6c5ce7); }

.log-entry-content { flex: 1; min-width: 0; }

.log-entry-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: var(--ds-xs);
    flex-wrap: wrap;
}

.log-entry-author {
    font-size: var(--ds-text-sm);
    font-weight: 600;
}

.log-entry-time {
    font-size: 12px;
    color: var(--ds-text-secondary);
}

.log-entry-text {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    line-height: 1.6;
}

.log-entry-thumbs {
    display: flex;
    gap: 6px;
    margin-top: var(--ds-sm);
    flex-wrap: wrap;
}

.log-thumb {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--ds-border);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.log-thumb .icon { opacity: 0.25; }

.log-photo {
    flex-shrink: 0;
}
.log-photo .log-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
}

.log-entry-tags {
    display: flex;
    gap: var(--ds-xs);
    flex-wrap: wrap;
    margin-top: 6px;
}

.log-entry-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}


/* ═══════════════════════════════════════════
   UNIVERSAL TABLE (.nr-table)
   Replaces .data-table on pages that adopt it.
   ═══════════════════════════════════════════ */

.nr-table-wrap {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    overflow: hidden;
}

.nr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ds-text-sm);
}

.nr-table thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 10px;
    font-weight: 700;
    color: var(--ds-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    border-bottom: 2px solid var(--ds-accent);
    background: linear-gradient(to top, var(--ds-accent-subtle), var(--ds-accent-faint));
    white-space: nowrap;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 2;
}

.nr-table tbody tr {
    transition: background var(--ds-transition);
}

.nr-table tbody tr:hover {
    background: var(--ds-surface-alt);
}

.nr-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--ds-border-subtle);
    vertical-align: middle;
}

.nr-table tbody tr:last-child td {
    border-bottom: none;
}

/* Row actions — hover-only on desktop */
.nr-row-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity var(--ds-transition);
}

.nr-table tbody tr:hover .nr-row-actions {
    opacity: 1;
}

/* Avatar + clickable name column */
.nr-col-avatar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nr-col-avatar .nr-name {
    font-weight: 600;
    color: var(--ds-accent);
    cursor: pointer;
    transition: color var(--ds-transition);
}

.nr-col-avatar .nr-name:hover {
    color: var(--ds-accent-hover);
    text-decoration: underline;
}

/* Mobile-only function subtitle inside name cell — hidden on desktop */
.nr-function-mobile { display: none; }

/* B2B overlapping avatar group */
.nr-avatar-group {
    display: flex;
    align-items: center;
}

.nr-avatar-group .nr-avatar {
    border: 2px solid var(--ds-surface);
}

.nr-avatar-group .nr-avatar + .nr-avatar {
    margin-left: -12px;
}

.nr-b2b-label {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    font-size: 9px;
    font-weight: 700;
    background: var(--ds-accent-subtle);
    color: var(--ds-accent);
    border-radius: var(--ds-radius-pill);
    margin-left: 6px;
    letter-spacing: 0.5px;
}

/* ── Stage Block — continuous left lane ── */
.nr-stage-block {
    margin-bottom: 32px;
    border-left: 3px solid var(--ds-accent);
    padding-left: 16px;
}

.nr-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--ds-text);
    background: transparent;
}

.nr-stage-header .nr-stage-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--ds-text-muted);
}

/* Collapsible stage block */
.nr-stage-header-toggle {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.nr-stage-header-toggle:hover {
    color: var(--ds-accent);
}

.nr-stage-header-toggle .nr-chevron {
    display: inline-flex; align-items: center;
    color: var(--ds-accent);
    transition: transform 0.25s ease;
}

.nr-stage-block.collapsed .nr-chevron {
    transform: rotate(-90deg);
}

.nr-stage-content {
    max-height: 10000px;
    opacity: 1;
    overflow: visible;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

.nr-stage-block.collapsed .nr-stage-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.nr-stage-block.all-done .nr-stage-header {
    opacity: 0.5;
    text-decoration: line-through;
}
.nr-stage-block.all-done .nr-stage-header .nr-chevron .icon {
    color: var(--ds-ok);
}

/* Stage manager row — compact, always visible */
.nr-stage-manager {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    background: transparent;
    font-size: 12px;
    color: var(--ds-text-muted);
}

.nr-stage-manager .nr-sm-label {
    font-weight: 600;
    color: var(--ds-text-faint);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.nr-stage-manager .nr-sm-name {
    font-weight: 600;
    color: var(--ds-text);
}

.nr-stage-manager .nr-sm-phone {
    color: var(--ds-accent);
    text-decoration: none;
    font-size: 12px;
}

.nr-stage-manager .nr-sm-phone:hover {
    text-decoration: underline;
}

.nr-stage-manager .nr-sm-remove {
    color: var(--ds-text-faint);
    cursor: pointer;
    font-size: 14px;
    margin-left: auto;
    opacity: 0;
    transition: opacity var(--ds-transition);
    background: none;
    border: none;
    padding: 4px;
}

.nr-stage-manager:hover .nr-sm-remove {
    opacity: 1;
}

.nr-stage-manager .nr-sm-add {
    color: var(--ds-accent);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    background: none;
    border: none;
    padding: 0;
}

.nr-stage-manager .nr-sm-add:hover {
    text-decoration: underline;
}

/* ── Hotel table layout helpers ── */
.hotel-info-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hotel-info-cell .hotel-name-link {
    color: var(--ds-accent);
    text-decoration: none;
}

.hotel-info-cell .hotel-name-link:hover {
    text-decoration: underline;
}

.stay-cell .stay-line {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.6;
}

/* ── Issue table layout helpers ── */
.issue-info-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.issue-table-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--ds-radius);
    object-fit: cover;
    cursor: pointer;
    margin-top: 4px;
}

.issue-resolved {
    opacity: 0.5;
}

/* ── Section toolbar responsive ── */
@media (max-width: 768px) {
    .nr-section-toolbar {
        flex-wrap: wrap;
    }
    .nr-section-toolbar .nr-section-right {
        width: 100%;
        justify-content: flex-start;
    }
    .nr-section-toolbar .nr-section-right .btn {
        flex: 1;
        justify-content: center;
    }
}

/* ── Crew card: desktop defaults (show text, hide mobile icons & PM label) ── */
.crew-contact-icons { display: none; }
a.crew-contact-text { color: var(--ds-accent); font-size: var(--ds-text-sm); text-decoration: none; }
a.crew-contact-text:hover { text-decoration: underline; }
.pm-label { display: none; }

/* PM chip — hidden on desktop (toggle column handles it), shown on mobile next to name */
.pm-chip { display: none; }

@media (max-width: 768px) {
    .pm-chip {
        display: inline-block;
        font-size: 10px;
        font-weight: 700;
        color: var(--ds-accent-readable);
        background: var(--ds-accent-subtle);
        padding: 1px 6px;
        border-radius: 4px;
        margin-left: 6px;
        vertical-align: middle;
        letter-spacing: 0.5px;
    }
}

/* ── nr-table mobile: table → cards ── */
@media (max-width: 768px) {
    .nr-table-wrap.nr-table-cards-mobile {
        border: none;
        background: none;
        border-radius: 0;
        overflow: visible;
        width: 100%;
    }

    .nr-table-cards-mobile .nr-table,
    .nr-table-cards-mobile .nr-table thead,
    .nr-table-cards-mobile .nr-table tbody,
    .nr-table-cards-mobile .nr-table th,
    .nr-table-cards-mobile .nr-table td,
    .nr-table-cards-mobile .nr-table tr {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box;
    }

    .nr-table-cards-mobile .nr-table thead {
        display: none;
    }

    .nr-table-cards-mobile .nr-table tbody tr {
        background: var(--ds-surface);
        border: 1px solid var(--ds-border);
        border-radius: var(--ds-radius);
        padding: 10px 12px;
        margin-bottom: 6px;
        position: relative;
    }

    .nr-table-cards-mobile .nr-table tbody td {
        padding: 0;
        border: none;
        width: 100% !important;
    }

    .nr-table-cards-mobile .nr-row-actions {
        opacity: 1;
        justify-content: flex-start;
        gap: var(--ds-sm);
        padding-top: var(--ds-sm);
        border-top: 1px solid var(--ds-border);
        margin-top: var(--ds-sm);
    }

    /* ── Global: ⋮ dot menu on mobile card tables ── */

    /* Hide desktop Edit/Delete buttons (replaced by dot menu) */
    .nr-table-cards-mobile .nr-row-actions.desktop-actions {
        display: none !important;
    }

    /* Dot menu: visible on mobile, right-aligned inside the td-actions area */
    .nr-table-cards-mobile .mobile-dot-menu {
        display: flex;
        justify-content: flex-end;
    }

    /* 44px tap target */
    .nr-table-cards-mobile .mobile-dot-menu .task-menu {
        min-width: 44px;
        min-height: 44px;
    }

    /* When dot menu replaces actions, remove the heavy separator */
    .nr-table-cards-mobile td:has(.mobile-dot-menu) {
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    /* ── Hide action buttons on mobile for sections that don't need them ──
       Users tap the row/card to edit. Actions are accessible from the edit modal.
       Keep dot menu only for Tasks (frequent use) and Issues (3-dot added). */
    .timetable-table .td-actions,
    .crew-table .td-actions,
    .contact-table .td-actions,
    .rundown-table .td-actions,
    .badge-table .td-actions,
    .hotel-table .td-actions,
    .guestlist-table .td-actions {
        display: none !important;
    }

    /* ── Timetable card: compact layout ──
       Row 1: Time ..................... ⋮
       Row 2: Avatar(s) + Artist name
       Row 3: Genre · Status (inline badges)
       Row 4: Notes (only if present, muted)
    */
    .timetable-table tbody tr {
        padding: 10px 12px !important;
        position: relative;
    }

    /* Time — top line, muted, small */
    .timetable-table .td-time {
        font-size: var(--ds-text-sm);
        font-weight: 600;
        color: var(--ds-text-secondary);
        margin-bottom: 4px;
        padding-right: 36px; /* room for ⋮ dots */
    }

    /* Artist — primary content, bold */
    .timetable-table .td-artist {
        margin-bottom: 6px;
    }

    .timetable-table .td-artist .nr-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .timetable-table .td-artist .nr-name {
        font-size: 15px;
        font-weight: 600;
    }

    /* Genre + Status — force inline on same row (override generic block/width:100%) */
    .nr-table-cards-mobile .timetable-table .td-genre,
    .nr-table-cards-mobile .timetable-table .td-status {
        display: inline !important;
        width: auto !important;
    }

    .timetable-table .td-status {
        margin-left: 4px;
    }

    .timetable-table .td-genre .badge,
    .timetable-table .td-status .badge {
        font-size: 11px;
    }

    /* Notes — only visible when filled */
    .timetable-table .td-notes {
        margin-top: 4px;
        font-size: var(--ds-text-sm);
        color: var(--ds-text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide empty dashes on mobile cards */
    .nr-table-cards-mobile .td-empty {
        display: none;
    }
    .nr-table-cards-mobile td:has(> .td-empty:only-child) {
        display: none;
    }

    /* Actions — ⋮ dot menu, top-right corner */
    .timetable-table .td-actions {
        position: absolute !important;
        top: 4px;
        right: 0;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    .timetable-table .td-actions .nr-row-actions {
        opacity: 1;
    }

    /* ── Crew card: single-row layout ──
       [Avatar + Name/Function]   [📞] [✉️] [⋮]
       Function shown inside name cell via .nr-function-mobile
    */
    .crew-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto auto auto;
        align-items: center;
        gap: 0 2px;
        padding: 8px 12px !important;
    }

    /* Reset generic width:100% on all td */
    .crew-table tbody tr td {
        width: auto !important;
    }

    /* Col 1: Avatar + Name + Function stacked */
    .crew-table .td-name {
        grid-column: 1;
        min-width: 0;
        margin: 0;
    }
    .crew-table .td-name .nr-col-avatar { gap: 10px; }
    .crew-table .td-name .nr-avatar { width: 40px; height: 40px; font-size: 13px; }
    .crew-table .td-name .nr-name {
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .crew-table .td-name .nr-function-mobile {
        display: block;
        font-size: var(--ds-text-sm);
        color: var(--ds-text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 1px;
    }

    /* Hide separate function td on mobile */
    .crew-table .td-function {
        display: none !important;
    }

    /* Col 2: Phone icon */
    .crew-table .td-phone {
        grid-column: 2;
    }
    .crew-table .td-phone .crew-contact-text,
    .crew-table .td-email .crew-contact-text { display: none; }
    .crew-table .td-phone .crew-contact-icons,
    .crew-table .td-email .crew-contact-icons { display: inline-block; }
    .crew-table .contact-btn {
        padding: 4px;
        min-height: 32px;
        min-width: 32px;
        border-radius: var(--ds-radius);
    }

    /* Col 3: Email icon */
    .crew-table .td-email {
        grid-column: 3;
    }

    /* Col 4: ⋮ dots */
    .crew-table .td-actions {
        grid-column: 4;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    .crew-table .td-actions .nr-row-actions { opacity: 1; }

    /* Hide PM toggle td on mobile (PM shown as chip on name) */
    .crew-table .td-pm {
        display: none !important;
    }

    /* ── Task table mobile card layout ──
       Override table-layout:fixed, display:table-row, and the generic
       width:100%!important on td so flex children can size properly.
       Layout: [✓] Task name          [Edit][Delete]
                   Mar 15  In Progress                          */

    .nr-table-cards-mobile.nr-table-wrap .task-table {
        table-layout: auto;
        display: block;
        width: 100%;
    }

    .nr-table-cards-mobile .task-table tr.task-row,
    .nr-table-cards-mobile .task-table tr.task-row.status-overdue,
    .nr-table-cards-mobile .task-table tr.task-row.status-urgent,
    .nr-table-cards-mobile .task-table tr.task-row.status-completed {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        width: 100% !important;
        background: var(--ds-surface);
        border: 1px solid var(--ds-border);
        border-radius: var(--ds-radius);
        border-left: 3px solid transparent;
        padding: 8px 12px;
        margin-bottom: 6px;
        gap: 0;
    }

    /* Status color bar on the card left edge */
    .nr-table-cards-mobile .task-table tr.task-row.status-overdue {
        border-left-color: var(--ds-bad);
    }
    .nr-table-cards-mobile .task-table tr.task-row.status-urgent {
        border-left-color: var(--ds-warn);
    }
    .nr-table-cards-mobile .task-table tr.task-row.status-completed {
        border-left-color: var(--ds-ok);
    }

    /* Reset ALL td inside task cards — override generic width:100%!important */
    .nr-table-cards-mobile .task-table tr.task-row td {
        display: block;
        width: auto !important;
        min-width: 0 !important;
        border: none;
        padding: 0;
        box-shadow: none !important;
    }

    /* Checkbox — left, with spacing from card edge for the color bar */
    .nr-table-cards-mobile .task-table .td-check {
        order: 0;
        flex: 0 0 36px;
        padding-left: 4px;
        position: static;
    }

    /* Task name + description — fills middle, wraps naturally */
    .nr-table-cards-mobile .task-table .td-task {
        order: 1;
        flex: 1 1 0%;
        min-width: 0;
        font-size: 14px;
        overflow: hidden;
    }

    /* Title truncates on one line */
    .nr-table-cards-mobile .task-table .td-task .nr-name {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Description visible — second line, muted */
    .nr-table-cards-mobile .task-table .td-task .task-description {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 2px;
    }

    /* Deadline — row 2, indented under task name */
    .nr-table-cards-mobile .task-table .td-deadline {
        order: 2;
        flex: 0 0 auto;
        margin-left: 36px;
        margin-top: 2px;
        font-size: 12px;
        color: var(--ds-text-secondary);
    }

    /* Status badge — inline after deadline */
    .nr-table-cards-mobile .task-table .td-status {
        order: 3;
        flex: 0 0 auto;
        margin-left: 6px;
        margin-top: 2px;
    }

    /* Dot menu — end of row 2, pushed to far right (task table uses flex, not absolute) */
    .nr-table-cards-mobile .task-table .td-actions {
        order: 4;
        flex: 0 0 auto;
        margin-left: auto;
        padding: 0;
        border-top: none;
        display: block !important;
    }
    .nr-table-cards-mobile .task-table .task-menu {
        margin: -8px -12px -8px 0;
    }

    /* Contact table card layout */
    /* ── Contact/Supplier card: compact grid ──
       Row 1: [Supplier]            [📞] [✉️] [⋮]
       Row 2: [Contact · Area]
       Row 3: [Subject] (if present)
    */
    .contact-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto auto auto;
        grid-template-rows: auto;
        align-items: center;
        gap: 0 2px;
        padding: 10px 12px !important;
    }

    .contact-table tbody tr td {
        width: auto !important;
    }

    /* Row 1, col 1: Supplier name */
    .contact-table .td-supplier {
        grid-column: 1;
        grid-row: 1;
        font-size: 14px;
        font-weight: 600;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Row 1, col 2: Phone icon */
    .contact-table .td-phone {
        grid-column: 2;
        grid-row: 1;
    }
    .contact-table .td-phone .crew-contact-text,
    .contact-table .td-email .crew-contact-text { display: none; }
    .contact-table .td-phone .crew-contact-icons,
    .contact-table .td-email .crew-contact-icons { display: inline-block; }
    .contact-table .contact-btn {
        padding: 4px;
        min-height: 32px;
        min-width: 32px;
        border-radius: var(--ds-radius);
    }
    .contact-table .td-phone::after { content: none; }

    /* Row 1, col 3: Email icon */
    .contact-table .td-email {
        grid-column: 3;
        grid-row: 1;
    }

    /* Row 1, col 4: ⋮ dots */
    .contact-table .td-actions {
        grid-column: 4;
        grid-row: 1;
        width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    .contact-table .td-actions .nr-row-actions { opacity: 1; }

    /* Row 2: Contact person (left) + Area badge (right) */
    .contact-table .td-contact {
        grid-column: 1 / 3;
        grid-row: 2;
        font-size: var(--ds-text-sm);
        color: var(--ds-text-muted);
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .contact-table .td-area {
        grid-column: 3 / 5;
        grid-row: 2;
        justify-self: end;
    }
    .contact-table .td-area .badge { font-size: 11px; }

    /* Row 3: Subject (only if filled) */
    .contact-table .td-subject {
        grid-column: 1 / -1;
        grid-row: 3;
        font-size: var(--ds-text-sm);
        color: var(--ds-text-secondary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide internal contact on mobile card (available in edit) */
    .contact-table .td-internal {
        display: none !important;
    }

    /* ── Badge table card layout (artist + crew badges) ── */
    .badge-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 0 4px;
        padding: 10px 12px !important;
    }
    .badge-table tbody tr td { width: auto !important; padding: 0 !important; border: none !important; }
    .badge-table .td-name {
        grid-column: 1; grid-row: 1;
        min-width: 0;
    }
    .badge-table .td-name .nr-col-avatar { gap: 10px; }
    .badge-table .td-name .nr-avatar { width: 40px; height: 40px; font-size: 13px; flex-shrink: 0; }
    .badge-table .td-name .nr-name {
        font-size: 14px; font-weight: 600;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .badge-table .td-access {
        grid-column: 2; grid-row: 1;
    }
    .badge-table .td-actions {
        grid-column: 3; grid-row: 1;
        width: auto !important; padding: 0 !important; margin: 0 !important; border: none !important;
    }
    .badge-table .td-function {
        grid-column: 1; grid-row: 2;
        font-size: var(--ds-text-sm); color: var(--ds-text-muted);
        padding-left: 50px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    /* Artist name or department on row 2, right side */
    .badge-table .td-artist,
    .badge-table .td-dept {
        grid-column: 2 / 4; grid-row: 2;
        font-size: var(--ds-text-sm); color: var(--ds-text-secondary);
        justify-self: end;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    /* ── Rundown table card layout ── */
    .rundown-table tbody tr {
        display: grid !important;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto auto;
        align-items: center;
        gap: 0 8px;
        padding: 10px 12px !important;
    }
    .rundown-table tbody tr td { width: auto !important; }
    .rundown-table .td-time {
        grid-column: 1; grid-row: 1;
        font-size: var(--ds-text-sm); font-weight: 600;
        color: var(--ds-text-secondary);
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }
    .rundown-table .td-what {
        grid-column: 2; grid-row: 1;
        font-size: 14px; font-weight: 600;
        min-width: 0;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .rundown-table .td-actions {
        grid-column: 3; grid-row: 1;
        width: auto !important; padding: 0 !important; margin: 0 !important; border: none !important;
    }
    .rundown-table .td-crew {
        grid-column: 1 / 3; grid-row: 2;
        padding-top: 2px;
    }
    .rundown-table .td-crew .rundown-crew-names {
        font-size: var(--ds-text-sm); color: var(--ds-text-secondary);
    }
    .rundown-table .td-where {
        grid-column: 3; grid-row: 2;
        justify-self: end;
    }
    .rundown-table .td-where .badge { font-size: 11px; }
    .rundown-table .td-notes {
        grid-column: 1 / -1; grid-row: 3;
        font-size: var(--ds-text-sm); color: var(--ds-text-muted);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        padding-top: 2px;
    }

    /* ── Guestlist table card layout ── */
    .guestlist-table tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 0 6px;
        padding: 10px 12px !important;
    }
    .guestlist-table tbody tr td { width: auto !important; }
    .guestlist-table .td-name {
        grid-column: 1; grid-row: 1;
        font-size: 14px; min-width: 0;
    }
    .guestlist-table .td-name .nr-name {
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .guestlist-table .td-status {
        grid-column: 2; grid-row: 1;
    }
    .guestlist-table .td-status .badge { font-size: 11px; }
    .guestlist-table .td-actions {
        grid-column: 3; grid-row: 1;
        width: auto !important; padding: 0 !important; margin: 0 !important; border: none !important;
    }
    .guestlist-table .td-type {
        grid-column: 1; grid-row: 2;
    }
    .guestlist-table .td-type .badge { font-size: 11px; }
    .guestlist-table .td-plus { display: none !important; }
    .guestlist-table .td-company {
        grid-column: 2 / 4; grid-row: 2;
        font-size: var(--ds-text-sm); color: var(--ds-text-muted);
        justify-self: end;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .guestlist-table .td-invited { display: none !important; }

    /* Hotel table card layout */
    .hotel-table .td-hotel {
        font-size: 15px;
        margin-bottom: 2px;
    }

    .hotel-table .td-hotel .hotel-info-cell {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .hotel-table .td-stay {
        margin-bottom: var(--ds-sm);
    }

    .hotel-table .td-stay .stay-cell {
        white-space: normal !important;
    }

    .hotel-table .td-rooms {
        margin-bottom: var(--ds-sm);
    }

    .hotel-table .td-actions {
        padding-top: var(--ds-sm);
        border-top: 1px solid var(--ds-border);
    }

    .hotel-table .td-actions .nr-row-actions {
        opacity: 1;
        justify-content: flex-start;
        gap: var(--ds-sm);
    }

    /* ── Issue table card layout ── */
    .issue-table tbody tr {
        display: grid !important;
        grid-template-columns: auto 1fr auto auto;
        grid-template-rows: auto auto auto auto;
        align-items: start;
        gap: 0 10px;
        padding: 10px 12px !important;
    }
    .issue-table tbody tr td { width: auto !important; }

    /* Photo — left column, spans all rows */
    .issue-table .td-photo {
        grid-column: 1; grid-row: 1 / 5;
        align-self: start;
    }
    .issue-table .td-photo .issue-table-thumb {
        width: 56px; height: 56px;
        border-radius: 6px;
        object-fit: cover;
    }
    /* When no photo, collapse the left column */
    .issue-table .td-photo:empty {
        display: none;
    }
    .issue-table tbody tr:has(.td-photo:empty) {
        grid-template-columns: 1fr auto auto;
    }

    /* Priority dot — hidden as standalone, shown inline with title */
    .issue-table .td-priority { display: none !important; }

    /* Row 1: Title + dot menu */
    .issue-table .td-issue {
        grid-column: 2 / 4; grid-row: 1;
        font-size: 14px; font-weight: 600;
        min-width: 0;
    }
    .issue-table .td-actions {
        grid-column: 4; grid-row: 1;
        padding: 0 !important; border: none !important;
    }
    .issue-table .td-issue .issue-info-cell {
        gap: 1px;
    }
    .issue-table .td-issue strong {
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        display: block;
    }
    .issue-table .td-issue .text-small {
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        display: block;
    }

    /* Row 2: Status badge — left-aligned */
    .issue-table .td-status {
        grid-column: 2; grid-row: 2;
        padding-top: 4px;
    }
    .issue-table .td-status .badge { font-size: 11px; }

    /* Row 3: Location + reporter */
    .issue-table .td-location {
        grid-column: 2; grid-row: 3;
        font-size: var(--ds-text-sm); color: var(--ds-text-muted);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .issue-table .td-reporter {
        grid-column: 3 / 5; grid-row: 3;
        font-size: 11px; color: var(--ds-text-muted);
        text-align: right;
        white-space: nowrap;
    }
    .issue-table .td-reporter .text-small { display: block; }

    /* Row 4: Assigned to */
    .issue-table .td-assigned {
        grid-column: 2 / 5; grid-row: 4;
        padding-top: 2px;
    }
    .issue-table .td-assigned .nr-avatar { width: 20px; height: 20px; font-size: 9px; }
    .issue-table .td-assigned .nr-col-avatar { gap: 6px; }
    .issue-table .td-assigned span { font-size: var(--ds-text-sm); }

    /* Stage blocks on mobile */
    .nr-stage-block {
        padding-left: 12px;
        border-left-width: 3px;
    }

    .nr-stage-header {
        padding: 10px 0;
        font-size: 15px;
    }

    .nr-stage-manager .nr-sm-remove {
        opacity: 1;
    }

    /* ── Event log entries on mobile ── */
    .log-entry {
        padding: 10px 12px;
        gap: 10px;
    }
    .log-photo .log-thumb {
        width: 52px; height: 52px;
    }
    .log-entry-side {
        flex-direction: row;
        gap: 4px;
    }
    .log-entry-side .btn-edit-inline {
        min-width: 32px; min-height: 32px;
        padding: 4px;
    }
    .log-entry-text {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}


/* ════════════════════════════════════════
   TASK CATEGORY (collapsible with progress)
   Tree-view disclosure: chevron + title + progress bar
   ════════════════════════════════════════ */
.nr-task-category {
    border-left: 3px solid var(--ds-accent);
    margin-bottom: var(--ds-sm);
    transition: margin-bottom 0.2s ease;
}

/* Header trigger — whole row is clickable */
.nr-task-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0 12px 16px;
    cursor: pointer;
    user-select: none;
    background: none;
    border: none;
    width: 100%;
    font-family: inherit;
    color: inherit;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.nr-task-category-header:hover .nr-task-cat-title {
    color: var(--ds-accent);
}

/* Chevron — rotates when collapsed */
.nr-task-category-header .nr-chevron-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--ds-text-secondary);
    transition: transform 0.2s ease;
}
.nr-task-category.collapsed .nr-task-category-header .nr-chevron-icon {
    transform: rotate(-90deg);
}

/* Title */
.nr-task-cat-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ds-text);
    transition: color 0.15s;
    white-space: nowrap;
}

/* Count (· 6/7 tasks done) */
.nr-task-cat-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--ds-text-secondary);
    white-space: nowrap;
}

/* Mini progress bar */
.nr-task-progress-bar {
    width: 48px;
    height: 4px;
    background: var(--ds-border);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}
.nr-task-progress-fill {
    height: 100%;
    background: #22c55e;
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* Content area — slides open/closed */
.nr-task-category-content {
    padding-left: 16px;
    max-height: 5000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}
.nr-task-category.collapsed .nr-task-category-content {
    max-height: 0;
    opacity: 0;
}

/* Table card inside — match lane edge */
.nr-task-category-content .table-card,
.nr-task-category-content .nr-table-wrap {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* ── All-done state ── */
.nr-task-category.all-done .nr-task-cat-title {
    color: var(--ds-text-secondary);
}
.nr-task-category.all-done .nr-task-progress-fill {
    background: #22c55e;
}

/* Done check icon — hidden by default, shown when all-done */
.nr-task-cat-done-check {
    display: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #22c55e;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nr-task-cat-done-check svg {
    width: 10px;
    height: 10px;
    color: var(--ds-text);
}
.nr-task-category.all-done .nr-task-cat-done-check {
    display: inline-flex;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    /* Remove border-left — put accent line under the category header */
    .nr-task-category {
        border-left: none;
        border-radius: 0;
    }
    .nr-task-category-header {
        padding: 14px 0;
        gap: 6px;
        border-bottom: 3px solid var(--ds-accent);
    }
    .nr-task-category-content {
        padding-left: 0;
    }
    .nr-task-progress-bar {
        width: 36px;
    }
    /* Ensure 48px tap area */
    .nr-task-category-header {
        min-height: 48px;
    }
}


/* ═══════════════════════════════════════════
   STAGE DESIGNS
   ═══════════════════════════════════════════ */

/* ── Toolbar ── */
.sd-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-sm);
    margin-bottom: var(--ds-md);
    flex-wrap: wrap;
}
.sd-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--ds-sm);
}
.sd-toolbar-pills {
    display: flex;
    gap: 6px;
}
.sd-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    font-size: var(--ds-text-sm);
    font-weight: 600;
    color: var(--ds-text-secondary);
    background: transparent;
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}
.sd-pill-btn:hover {
    color: var(--ds-text);
    border-color: var(--ds-text-secondary);
}
.sd-pill-btn.active {
    background: var(--ds-accent);
    border-color: var(--ds-accent);
    color: var(--ds-accent-text);
}

/* ── Collapsible stage section ── */
.sd-section {
    margin-bottom: var(--ds-sm);
}
.sd-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-sm);
    padding: 10px 0;
}
.sd-section-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
}
.sd-section-left:hover h3 {
    color: var(--ds-accent);
}
.sd-section-left .icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--ds-text-secondary);
    transition: transform 0.2s ease;
}
.sd-accent-bar {
    width: 3px;
    height: 22px;
    background: var(--ds-accent);
    border-radius: 2px;
    flex-shrink: 0;
}
.sd-section-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--ds-text);
    margin: 0;
    transition: color 0.15s;
    white-space: nowrap;
}

/* Chevron rotation when collapsed */
.sd-section.collapsed .sd-section-left .icon {
    transform: rotate(-90deg);
}

/* Content slide */
.sd-section-content {
    max-height: 10000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.2s ease;
}
.sd-section.collapsed .sd-section-content {
    max-height: 0;
    opacity: 0;
}

/* ── Upload zone ── */
.sd-upload-wrap {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.sd-upload-wrap.active {
    max-height: 300px;
}
.sd-upload-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ds-sm);
    padding: var(--ds-lg);
    margin-bottom: var(--ds-md);
    border: 2px dashed var(--ds-border);
    border-radius: var(--ds-radius);
    background: var(--ds-surface);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}
.sd-upload-dropzone:hover {
    border-color: var(--ds-text-secondary);
}
.sd-upload-dropzone.dragover {
    border-color: var(--ds-accent);
    background: var(--ds-accent-faint);
}
.sd-upload-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--ds-accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-upload-icon .icon {
    width: 24px;
    height: 24px;
    color: var(--ds-accent);
}
.sd-upload-text {
    font-size: var(--ds-text-base);
    font-weight: 600;
    color: var(--ds-text);
}
.sd-upload-hint {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
}
.sd-upload-target {
    display: flex;
    align-items: center;
    gap: var(--ds-sm);
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
}
.sd-upload-target select {
    background: var(--ds-surface-hover);
    color: var(--ds-text);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    padding: 4px 8px;
    font-size: var(--ds-text-sm);
    font-family: inherit;
}
.sd-upload-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--ds-text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.sd-upload-close:hover {
    color: var(--ds-text);
}

/* Upload progress bar */
.sd-upload-progress {
    width: 100%;
    max-width: 300px;
    margin: var(--ds-sm) auto;
}
.sd-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--ds-border);
    border-radius: 3px;
    overflow: hidden;
}
.sd-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--ds-accent);
    border-radius: 3px;
    transition: width 0.2s ease;
}
.sd-progress-text {
    text-align: center;
    font-size: var(--ds-text-sm);
    color: var(--ds-text-muted);
    margin-top: var(--ds-xs);
}

/* ── Design card (full-width stacked) ── */
.sd-card {
    display: flex;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    overflow: hidden;
    margin-bottom: var(--ds-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sd-card:hover {
    border-color: var(--ds-border-hover, var(--ds-text-secondary));
}
.sd-card.sd-dragging {
    opacity: 0.5;
    border-color: var(--ds-accent);
}
.sd-card.sd-drag-over {
    border-top: 2px solid var(--ds-accent);
}

/* Left rail (drag handle) */
.sd-card-rail {
    width: 36px;
    min-height: 60px;
    background: var(--ds-surface-hover, rgba(255,255,255,0.04));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
    cursor: grab;
}
.sd-card-rail:active {
    cursor: grabbing;
}
.sd-card-rail .icon {
    width: 16px;
    height: 16px;
    color: var(--ds-text-secondary);
}
.sd-card-rail .sd-grip {
    display: flex;
}
.sd-reorder-arrows {
    display: none;
    flex-direction: column;
    gap: 2px;
}
.sd-reorder-arrows button {
    background: none;
    border: none;
    color: var(--ds-text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: var(--ds-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-reorder-arrows button:hover {
    color: var(--ds-accent);
    background: rgba(255,255,255,0.06);
}
.sd-reorder-arrows button .icon {
    width: 14px;
    height: 14px;
}

/* ── Stage section header: grip + arrows ── */
.sd-section-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.sd-stage-grip {
    display: none;
    cursor: grab;
    color: var(--ds-text-secondary);
    padding: 4px;
}
.sd-stage-grip:active { cursor: grabbing; }
.sd-stage-grip .icon { width: 16px; height: 16px; }
.sd-stage-arrows {
    display: none;
    align-items: center;
    gap: 2px;
}
.sd-stage-arrows button {
    background: none;
    border: none;
    color: var(--ds-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--ds-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-stage-arrows button:hover {
    color: var(--ds-accent);
    background: rgba(255,255,255,0.06);
}
.sd-stage-arrows button .icon { width: 16px; height: 16px; }

/* Stage drag feedback */
.sd-section.sd-dragging { opacity: 0.5; }
.sd-section.sd-drag-over { border-top: 2px solid var(--ds-accent); }

/* Reorder mode active — show stage grip/arrows + compact cards */
#panel-designs.sd-reorder-active .sd-stage-grip {
    display: flex;
}
#panel-designs.sd-reorder-active .sd-stage-arrows {
    display: flex;
}
#panel-designs.sd-reorder-active .sd-card-rail .sd-grip {
    display: none;
}
#panel-designs.sd-reorder-active .sd-reorder-arrows {
    display: flex;
}
#panel-designs.sd-reorder-active .sd-card-rail {
    cursor: default;
}

/* Compact card view in reorder mode: hide preview, show thumbnail strip */
#panel-designs.sd-reorder-active .sd-card-preview,
#panel-designs.sd-reorder-active .sd-pdf-grid,
#panel-designs.sd-reorder-active .sd-pdf-viewer-btn {
    display: none;
}
#panel-designs.sd-reorder-active .sd-card {
    flex-direction: row;
}
#panel-designs.sd-reorder-active .sd-card-rail {
    width: 36px;
    min-height: auto;
    height: auto;
    flex-direction: column;
}
#panel-designs.sd-reorder-active .sd-card-body {
    flex-direction: row;
    align-items: center;
}
#panel-designs.sd-reorder-active .sd-card-info {
    border-top: none;
    flex: 1;
}

/* Card body */
.sd-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Image preview */
.sd-card-preview {
    position: relative;
    background: var(--ds-bg, #0a0a0a);
    cursor: pointer;
    overflow: hidden;
}
.sd-card-preview img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}
.sd-card-hover {
    position: absolute;
    top: var(--ds-sm);
    right: var(--ds-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--ds-radius-sm);
    font-size: var(--ds-text-sm);
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.sd-card-hover .icon {
    width: 14px;
    height: 14px;
}
.sd-card-preview:hover .sd-card-hover {
    opacity: 1;
}

/* PDF grid */
.sd-pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: var(--ds-md);
    background: var(--ds-bg, #0a0a0a);
}
.sd-pdf-page {
    aspect-ratio: 210 / 297;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--ds-sm);
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
    font-weight: 600;
    overflow: hidden;
}
.sd-pdf-page .icon {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}
/* Rendered PDF page (canvas-based) */
.sd-pdf-page.sd-pdf-rendered {
    aspect-ratio: auto;
    padding: 0;
    gap: 0;
    background: #fff;
    position: relative;
}
.sd-pdf-page.sd-pdf-rendered canvas {
    width: 100%;
    height: auto;
    display: block;
}
.sd-pdf-page-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}
.sd-pdf-page.sd-pdf-loading {
    animation: sd-pulse 1.5s ease-in-out infinite;
}
@keyframes sd-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.sd-pdf-page.sd-pdf-more {
    background: var(--ds-surface-hover, rgba(255,255,255,0.04));
    cursor: default;
}
.sd-pdf-viewer-btn {
    padding: var(--ds-sm) var(--ds-md);
    display: flex;
    justify-content: center;
    background: var(--ds-bg, #0a0a0a);
}

/* Info bar */
.sd-card-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-sm);
    padding: 10px var(--ds-md);
    border-top: 1px solid var(--ds-border);
    flex-wrap: wrap;
}
.sd-card-meta {
    display: flex;
    align-items: center;
    gap: var(--ds-sm);
    font-size: var(--ds-text-sm);
    color: var(--ds-text-secondary);
    min-width: 0;
}
.sd-card-meta span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.sd-card-actions button,
.sd-card-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--ds-radius-sm);
    background: none;
    border: none;
    color: var(--ds-text-secondary);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
}
.sd-card-actions button:hover,
.sd-card-actions a:hover {
    color: var(--ds-text);
    background: rgba(255,255,255,0.06);
}
.sd-card-actions .sd-action-delete:hover {
    color: var(--ds-danger, #ef4444);
}
.sd-card-actions .icon {
    width: 16px;
    height: 16px;
}

/* Lightbox info pill */
.lb-info {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--ds-radius-full);
    font-size: var(--ds-text-sm);
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
    pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sd-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--ds-sm);
    }
    .sd-toolbar-right {
        width: 100%;
        flex-wrap: wrap;
    }
    .sd-card {
        flex-direction: column;
    }
    .sd-card-rail {
        width: 100%;
        min-height: auto;
        height: 32px;
        flex-direction: row;
        justify-content: center;
    }
    .sd-reorder-arrows {
        flex-direction: row;
    }
    .sd-stage-arrows {
        flex-direction: row;
    }
    .sd-upload-dropzone {
        padding: var(--ds-md);
    }
    .sd-pdf-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        padding: var(--ds-sm);
    }
    .sd-card-info {
        flex-direction: column;
        align-items: flex-start;
    }
    .sd-section-header {
        flex-wrap: wrap;
    }
    /* Compact reorder on mobile — force row layout */
    #panel-designs.sd-reorder-active .sd-card {
        flex-direction: row;
    }
    #panel-designs.sd-reorder-active .sd-card-rail {
        width: 36px;
        height: auto;
        flex-direction: column;
    }
}


/* ═══════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════ */

@media print {
    .main-header, .main-nav, .header-user, .mobile-menu-toggle,
    .btn, .toast, .dialog-overlay, .modal,
    .bottom-nav, .bottom-sheet-overlay, .bottom-sheet, .fab { display: none !important; }
    body { background: white; color: black; }
    .card { border: 1px solid #ccc; box-shadow: none; background: white; }
    .badge { border: 1px solid currentColor; }
}
