:root {
    /* Luxurious Caramel & Gold Theme - Aurea Frost */
    --brand: #c9a227;
    --brand-strong: #e8b923;
    --brand-dark: #8b6914;
    --brand-darker: #3d2e0a;
    --brand-muted: rgba(201, 162, 39, 0.22);
    --brand-contrast: #1a1408;
    --surface: rgba(255, 252, 245, 0.92);
    --surface-strong: rgba(255, 250, 240, 0.96);
    --surface-soft: rgba(255, 248, 230, 0.55);
    --text-primary: #3d2e0a;
    --text-muted: rgba(61, 46, 10, 0.6);
    --shadow-lg: 0 30px 80px rgba(139, 105, 20, 0.3),
                 0 15px 35px rgba(201, 162, 39, 0.15);
    --shadow-md: 0 20px 50px rgba(139, 105, 20, 0.22),
                 0 8px 20px rgba(201, 162, 39, 0.12);
    --body-background: 
        linear-gradient(135deg, #fffcf5 0%, #fff8e7 25%, #f5e6c8 50%, #ecdbb0 75%, #e8d4a0 100%);
    --assign-background: 
        linear-gradient(145deg, rgba(255, 252, 245, 0.98), rgba(245, 230, 200, 0.92)),
        radial-gradient(ellipse at 20% 0%, rgba(232, 185, 35, 0.12), transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(201, 162, 39, 0.1), transparent 50%);
    --panel-background: 
        linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 235, 0.75)),
        linear-gradient(45deg, rgba(201, 162, 39, 0.05), transparent);
    --floating-orb-gradient: 
        radial-gradient(circle at 30% 30%, rgba(232, 185, 35, 0.4), rgba(201, 162, 39, 0.1) 50%, transparent 70%);
    --permission-glow: 
        radial-gradient(circle, rgba(232, 185, 35, 0.25), rgba(201, 162, 39, 0.1) 40%, transparent 70%);
    --assign-alert-background: 
        linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 245, 215, 0.9)),
        linear-gradient(45deg, rgba(201, 162, 39, 0.08), transparent);
    --assign-alert-shadow: 
        0 40px 80px rgba(139, 105, 20, 0.28),
        0 20px 40px rgba(201, 162, 39, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    --roller-mask-top: linear-gradient(180deg, rgba(255, 252, 245, 0.85), transparent);
    --roller-mask-bottom: linear-gradient(0deg, rgba(255, 252, 245, 0.8), transparent);
    --avatar-gradient: 
        linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 210, 0.7)),
        linear-gradient(45deg, rgba(201, 162, 39, 0.1), transparent);
    --summary-pill-tw-border: #e8b923;
    --summary-pill-br-border: #c9a227;
    --badge-editor-bg: linear-gradient(135deg, rgba(232, 185, 35, 0.35), rgba(201, 162, 39, 0.25));
    --badge-editor-color: #3d2e0a;
    --badge-viewer-bg: linear-gradient(135deg, rgba(255, 245, 210, 0.7), rgba(245, 230, 200, 0.6));
    --badge-viewer-color: #5a4510;
    --city-badge-bg: rgba(255, 255, 255, 0.8);
    --primary-btn-shadow: 
        0 15px 35px rgba(201, 162, 39, 0.4),
        0 5px 15px rgba(139, 105, 20, 0.25);
    --primary-btn-shadow-hover: 
        0 20px 50px rgba(232, 185, 35, 0.5),
        0 8px 25px rgba(139, 105, 20, 0.3);
    --table-action-edit-bg: linear-gradient(135deg, rgba(255, 245, 210, 0.8), rgba(245, 230, 200, 0.7));
    --focus-ring-color: rgba(232, 185, 35, 0.6);
    --status-success: #16a34a;
    --status-warning: #ca8a04;
    --status-danger: #dc2626;
    
    /* Aurea Frost Animations */
    --shimmer-gradient: linear-gradient(
        110deg,
        transparent 20%,
        rgba(255, 255, 255, 0.4) 40%,
        rgba(232, 185, 35, 0.2) 50%,
        rgba(255, 255, 255, 0.4) 60%,
        transparent 80%
    );
    --glow-pulse: rgba(201, 162, 39, 0.4);
    
    /* Layout Variables */
    --radius-card: 26px;
    --radius-pill: 999px;
    --blur: blur(24px);
    --transition-snappy: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Aurea Frost Theme Specific Animations */
.page-shell::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(232, 185, 35, 0.08), transparent 40%),
        radial-gradient(ellipse at 80% 70%, rgba(201, 162, 39, 0.06), transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 245, 210, 0.1), transparent 50%);
    animation: caramelOrbs 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes caramelOrbs {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(2%, 3%) rotate(90deg); }
    50% { transform: translate(-1%, 2%) rotate(180deg); }
    75% { transform: translate(1%, -2%) rotate(270deg); }
}

.primary-btn {
    background: linear-gradient(135deg, #e8b923 0%, #c9a227 50%, #a88520 100%);
    border: 1px solid rgba(139, 105, 20, 0.5);
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: btnShimmer 3s ease-in-out infinite;
}

@keyframes btnShimmer {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.primary-btn:hover {
    background: linear-gradient(135deg, #f0c52e 0%, #d4ad2a 50%, #b89225 100%);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-card,
.login__card,
.assign-tw__panel {
    background: linear-gradient(
        165deg,
        rgba(255, 255, 255, 0.92),
        rgba(255, 250, 235, 0.85) 50%,
        rgba(255, 245, 220, 0.8)
    );
    border: 1px solid rgba(201, 162, 39, 0.2);
    box-shadow: 
        0 25px 60px rgba(139, 105, 20, 0.18),
        0 10px 25px rgba(201, 162, 39, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(201, 162, 39, 0.1);
    position: relative;
    overflow: hidden;
}

.glass-card::before,
.login__card::before,
.assign-tw__panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(232, 185, 35, 0.5),
        rgba(255, 255, 255, 0.8),
        rgba(232, 185, 35, 0.5),
        transparent
    );
}

.ghost-btn {
    background: linear-gradient(135deg, rgba(255, 250, 235, 0.7), rgba(245, 235, 210, 0.5));
    border: 1px solid rgba(201, 162, 39, 0.3);
    color: #5a4510;
    transition: all 0.3s ease;
}

.ghost-btn:hover {
    background: linear-gradient(135deg, rgba(255, 248, 225, 0.9), rgba(245, 230, 200, 0.8));
    border-color: rgba(201, 162, 39, 0.5);
    box-shadow: 0 8px 25px rgba(201, 162, 39, 0.2);
    transform: translateY(-1px);
}

input,
select,
textarea {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 250, 240, 0.9));
    border: 1px solid rgba(201, 162, 39, 0.25);
    color: #3d2e0a;
    transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(201, 162, 39, 0.6);
    box-shadow: 
        0 0 0 3px rgba(232, 185, 35, 0.15),
        0 4px 15px rgba(201, 162, 39, 0.1);
    outline: none;
}

.assign-tw__card {
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.95),
        rgba(255, 250, 235, 0.9) 50%,
        rgba(255, 245, 220, 0.85)
    );
    border: 1px solid rgba(201, 162, 39, 0.18);
    box-shadow: 
        0 15px 40px rgba(139, 105, 20, 0.12),
        0 5px 15px rgba(201, 162, 39, 0.08);
}

.assign-tw__card:hover {
    border-color: rgba(201, 162, 39, 0.35);
    box-shadow: 
        0 20px 50px rgba(139, 105, 20, 0.18),
        0 8px 20px rgba(201, 162, 39, 0.12);
}

.assign-tw__card.is-selected {
    border-color: #c9a227;
    box-shadow: 
        0 0 0 3px rgba(201, 162, 39, 0.2),
        0 20px 50px rgba(139, 105, 20, 0.2);
}

.assign-tw__roller {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(255, 250, 235, 0.9));
    border: 1px solid rgba(201, 162, 39, 0.2);
}

.assign-tw__roller-item.is-selected {
    background: linear-gradient(135deg, rgba(232, 185, 35, 0.25), rgba(201, 162, 39, 0.15));
    border-color: rgba(201, 162, 39, 0.4);
}

.assign-tw__summary {
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 225, 0.92));
}

.assign-tw__history-table th {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.15), rgba(232, 185, 35, 0.1));
    color: #5a4510;
}

.assign-tw__history-table td {
    color: #3d2e0a;
}

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

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    background: var(--body-background);
    background-attachment: fixed;
}

/* Note: page-shell::before animation is defined earlier in file (lines 80-97) */

.primary-btn {
    background: linear-gradient(135deg, #e8b923 0%, #c9a227 50%, #a88520 100%);
    border: 1px solid rgba(139, 105, 20, 0.5);
    position: relative;
    overflow: hidden;
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: btnShimmer 3s ease-in-out infinite;
}

@keyframes btnShimmer {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.primary-btn:hover {
    background: linear-gradient(135deg, #f0c52e 0%, #d4ad2a 50%, #b89225 100%);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-card,
.login__card,
.assign-tw__panel {
    background: linear-gradient(
        165deg,
        rgba(255, 255, 255, 0.92),
        rgba(255, 250, 235, 0.85) 50%,
        rgba(255, 245, 220, 0.8)
    );
    border: 1px solid rgba(201, 162, 39, 0.2);
    box-shadow: 
        0 25px 60px rgba(139, 105, 20, 0.18),
        0 10px 25px rgba(201, 162, 39, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(201, 162, 39, 0.1);
    position: relative;
    overflow: hidden;
}

.glass-card::before,
.login__card::before,
.assign-tw__panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(232, 185, 35, 0.5),
        rgba(255, 255, 255, 0.8),
        rgba(232, 185, 35, 0.5),
        transparent
    );
}

.ghost-btn {
    background: linear-gradient(135deg, rgba(255, 250, 235, 0.7), rgba(245, 235, 210, 0.5));
    border: 1px solid rgba(201, 162, 39, 0.3);
    color: #5a4510;
    transition: all 0.3s ease;
}

.ghost-btn:hover {
    background: linear-gradient(135deg, rgba(255, 248, 225, 0.9), rgba(245, 230, 200, 0.8));
    border-color: rgba(201, 162, 39, 0.5);
    box-shadow: 0 8px 25px rgba(201, 162, 39, 0.2);
    transform: translateY(-1px);
}

input,
select,
textarea {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 250, 240, 0.9));
    border: 1px solid rgba(201, 162, 39, 0.25);
    color: #3d2e0a;
    transition: all 0.3s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(201, 162, 39, 0.6);
    box-shadow: 
        0 0 0 3px rgba(232, 185, 35, 0.15),
        0 4px 15px rgba(201, 162, 39, 0.1);
    outline: none;
}

.assign-tw__card {
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.95),
        rgba(255, 250, 235, 0.9) 50%,
        rgba(255, 245, 220, 0.85)
    );
    border: 1px solid rgba(201, 162, 39, 0.18);
    box-shadow: 
        0 15px 40px rgba(139, 105, 20, 0.12),
        0 5px 15px rgba(201, 162, 39, 0.08);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.assign-tw__card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 25px 60px rgba(139, 105, 20, 0.2),
        0 10px 25px rgba(201, 162, 39, 0.15),
        0 0 0 1px rgba(232, 185, 35, 0.3);
}

.assign-tw__modal-panel {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
    border: 1px solid rgba(201, 162, 39, 0.25);
    box-shadow: 
        0 40px 100px rgba(139, 105, 20, 0.25),
        0 20px 50px rgba(201, 162, 39, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* Golden glow effect for focused elements */
*:focus-visible {
    outline: 2px solid rgba(201, 162, 39, 0.6);
    outline-offset: 2px;
    box-shadow: 0 0 20px rgba(232, 185, 35, 0.3);
}

/* Subtle golden pulse for important elements */
.assign-tw__watermark {
    filter: drop-shadow(0 0 30px rgba(201, 162, 39, 0.4));
}

.assign-tw__stamp {
    animation: goldenPulse 3s ease-in-out infinite;
}

/* Watermark styling for aurea-frost */
.assign-tw__watermark {
    mix-blend-mode: normal;
    opacity: 1;
    filter: drop-shadow(0 30px 50px rgba(139, 105, 20, 0.5));
}

.assign-tw__stamp-outline {
    fill: rgba(201, 162, 39, 0.15);
    stroke: rgba(139, 105, 20, 0.6);
    stroke-width: 6;
}

.assign-tw__stamp-ridge {
    fill: none;
    stroke: rgba(201, 162, 39, 0.7);
    stroke-width: 18;
    stroke-linecap: round;
    stroke-dasharray: 12 10;
    opacity: 0.85;
}

.assign-tw__stamp-inner {
    fill: rgba(232, 185, 35, 0.1);
    stroke: rgba(139, 105, 20, 0.4);
    stroke-width: 6;
    stroke-dasharray: 6 8;
}

.assign-tw__stamp-stars text {
    fill: rgba(139, 105, 20, 0.7);
    font-size: 18px;
    letter-spacing: 0.6em;
}

.assign-tw__stamp-arc {
    fill: rgba(90, 69, 16, 0.8);
    font-size: 12px;
    letter-spacing: 0.45em;
    text-transform: uppercase;
}

.assign-tw__stamp-banner rect {
    fill: rgba(201, 162, 39, 0.9);
    stroke: rgba(139, 105, 20, 0.8);
    stroke-width: 4;
    filter: drop-shadow(0 6px 12px rgba(139, 105, 20, 0.4));
}

.assign-tw__stamp-banner text {
    fill: #3d2e0a;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.assign-tw__stamp-distress {
    fill: rgba(139, 105, 20, 0.08);
    mix-blend-mode: overlay;
}

.assign-tw__assigned-by {
    color: #3d2e0a;
    background: rgba(255, 248, 230, 0.9);
    border: 1px solid rgba(201, 162, 39, 0.3);
}

@keyframes goldenPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(201, 162, 39, 0.3)); }
    50% { filter: drop-shadow(0 0 40px rgba(232, 185, 35, 0.5)); }
}

/* Caramel scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(245, 235, 210, 0.5);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d4ad2a, #a88520);
    border-radius: 5px;
    border: 2px solid rgba(245, 235, 210, 0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #e8b923, #c9a227);
}

/* View Detail Popup - Dark text for labels */
.assign-tw__modal-panel p,
.assign-tw__modal-panel label,
.assign-tw__modal-panel h3,
.assign-tw__modal-panel h4,
.assign-tw__modal-panel span,
.assign-tw__modal-panel dt,
.assign-tw__modal-panel dd,
.assign-tw__eyebrow {
    color: #3d2e0a;
}

.assign-tw__modal-panel .assign-tw__eyebrow {
    color: #8b6914;
}

/* Dropdown styling - Golden background with dark text */
select,
.assign-tw__modal-panel select,
.assign-tw__all-controls select,
[data-all-rank],
[data-all-origin] {
    background: linear-gradient(135deg, #fff8e7 0%, #f5e6c8 100%) !important;
    border: 1px solid rgba(201, 162, 39, 0.4) !important;
    color: #3d2e0a !important;
}

select option {
    background: #fff8e7 !important;
    color: #3d2e0a !important;
}

select:hover {
    border-color: rgba(201, 162, 39, 0.6) !important;
    box-shadow: 0 4px 12px rgba(201, 162, 39, 0.15);
}

/* Summary Popup styling */
[data-summary-modal] .assign-tw__modal-panel {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
}

.assign-tw__summary-list {
    color: #3d2e0a;
}

.assign-tw__summary-body {
    background: transparent;
}

.assign-tw__summary-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 248, 230, 0.9));
    border: 1px solid rgba(201, 162, 39, 0.2);
    box-shadow: 0 8px 25px rgba(139, 105, 20, 0.1);
}

.assign-tw__summary-card h4,
.assign-tw__summary-card p,
.assign-tw__summary-card span {
    color: #3d2e0a;
}

.assign-tw__summary-progress {
    background: rgba(201, 162, 39, 0.15);
}

.assign-tw__summary-progress-fill {
    background: linear-gradient(90deg, #c9a227, #e8b923);
}

/* All Mawaze Popup - Light background for uniformity */
[data-all-modal] .assign-tw__modal-panel {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
}

/* All Mawaze Popup - Search textbox light background */
[data-all-modal] .assign-tw__search-input,
[data-all-search],
.assign-tw__all-search input {
    background: linear-gradient(135deg, #fffcf5 0%, #fff8e7 100%) !important;
    border: 1px solid rgba(201, 162, 39, 0.35) !important;
    color: #3d2e0a !important;
}

[data-all-modal] .assign-tw__search-input::placeholder,
[data-all-search]::placeholder,
.assign-tw__all-search input::placeholder {
    color: rgba(61, 46, 10, 0.5) !important;
}

/* All Mawaze table styling */
.assign-tw__all-table {
    color: #3d2e0a;
}

.assign-tw__all-table th {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.15), rgba(232, 185, 35, 0.1));
    color: #5a4510;
    border-bottom: 2px solid rgba(201, 162, 39, 0.3);
}

.assign-tw__all-table td {
    color: #3d2e0a;
    border-bottom: 1px solid rgba(201, 162, 39, 0.12);
}

.assign-tw__all-table tr:hover td {
    background: rgba(255, 248, 230, 0.6);
}

/* Hide Origin column in All Mawaze */
.assign-tw__all-table th:nth-child(4),
.assign-tw__all-table td:nth-child(4) {
    display: none;
}

/* All Mawaze filter chips */
.assign-tw__filter-chip {
    background: linear-gradient(135deg, rgba(255, 250, 235, 0.9), rgba(245, 230, 200, 0.8));
    border: 1px solid rgba(201, 162, 39, 0.25);
    color: #5a4510;
}

.assign-tw__filter-chip span {
    color: #5a4510;
}

.assign-tw__filter-label {
    color: #5a4510;
}

/* Find Khidmatguzar Popup - Light background */
[data-search-modal] .assign-tw__modal-panel {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
}

[data-search-modal] .assign-tw__search-input,
[data-search-input] {
    background: linear-gradient(135deg, #ffffff 0%, #fffcf5 100%) !important;
    border: 1px solid rgba(201, 162, 39, 0.35) !important;
    color: #3d2e0a !important;
}

[data-search-modal] .assign-tw__search-input::placeholder,
[data-search-input]::placeholder {
    color: rgba(61, 46, 10, 0.5) !important;
}

.assign-tw__search-results {
    background: transparent;
}

.assign-tw__search-results li,
.assign-tw__search-result {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 250, 235, 0.9));
    border: 1px solid rgba(201, 162, 39, 0.15);
    color: #3d2e0a;
}

.assign-tw__search-results li:hover,
.assign-tw__search-result:hover {
    background: linear-gradient(135deg, rgba(255, 248, 230, 1), rgba(245, 230, 200, 0.95));
    border-color: rgba(201, 162, 39, 0.35);
    box-shadow: 0 4px 15px rgba(201, 162, 39, 0.15);
}

.assign-tw__search-results li span,
.assign-tw__search-result span {
    color: #3d2e0a;
}

.assign-tw__search-results li small,
.assign-tw__search-result small {
    color: #8b6914;
}

.assign-tw__placeholder {
    color: rgba(61, 46, 10, 0.6);
}

/* Modal body and general text */
.assign-tw__modal-panel [data-modal-body],
.assign-tw__modal-panel .assign-tw__remark-label,
.assign-tw__modal-panel .assign-tw__remark-hint {
    color: #3d2e0a;
}

/* Sort modal styling */
[data-sort-modal] .assign-tw__modal-panel {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
}

.assign-tw__sort-row select {
    background: linear-gradient(135deg, #fff8e7 0%, #f5e6c8 100%) !important;
    color: #3d2e0a !important;
}

/* History modal styling */
[data-history-modal] .assign-tw__modal-panel {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
}

/* History Info modal styling */
[data-history-info-modal] .assign-tw__modal-panel {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
}

.assign-tw__history-table th {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.15), rgba(232, 185, 35, 0.1));
    color: #5a4510;
}

.assign-tw__history-table td {
    color: #3d2e0a;
}

button,
.btn,
.btn-primary,
.btn-outline-light,
.ghost-btn,
.danger-btn,
.primary-btn,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    border-radius: var(--radius-pill);
    padding: 0.65rem 1.5rem;
    border: 1px solid rgba(201, 162, 39, 0.4);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--brand-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.page-shell {
    width: 100%;
    max-width: 1580px;
    margin: 0 auto;
    padding: 2.5rem clamp(1.5rem, 3vw, 4rem);
}

.page-shell.assign-shell {
    max-width: 2680px;
    padding-block: 1rem;
}

.page-shell.assign-tw-shell {
    max-width: 2400px;
}

.page-shell.upload-data-shell {
    max-width: 2400px;
}

.theme-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1400;
    display: grid;
    gap: 0.35rem;
    min-width: 200px;
    padding: 0.65rem 0.85rem;
    border-radius: 18px;
    background: var(--surface-strong);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.theme-switcher label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.theme-switcher select {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    padding: 0.35rem 0.65rem;
}

.global-loader {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: rgba(8, 12, 18, 0.72);
    backdrop-filter: blur(12px);
    z-index: 1600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--transition-snappy, ease);
}

.global-loader.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.global-loader__spinner {
    width: clamp(3rem, 5vw, 4.25rem);
    height: clamp(3rem, 5vw, 4.25rem);
    border-radius: 999px;
    border: 0.4rem solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--brand, #22d3ee);
    animation: global-loader-spin 1s linear infinite;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.35);
}

.global-loader__message {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

@keyframes global-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

.theme-lab-shell {
    padding: clamp(2rem, 5vw, 4rem);
}

.theme-lab {
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 4vw, 3rem);
    color: var(--text-primary);
}

.theme-lab__hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(1.5rem, 4vw, 3rem);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    background: var(--panel-background);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
}

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.hero-subhead {
    color: var(--text-muted);
    max-width: 46ch;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.hero-panel {
    background: var(--surface);
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-panel__chip {
    display: inline-flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hero-panel__chip .chip-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hero-panel__text {
    color: var(--text-muted);
    line-height: 1.5;
}

.hero-panel__footer .user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.theme-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 320px;
    position: relative;
    overflow: hidden;
}

.theme-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--permission-glow);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.theme-card:hover::after,
.theme-card.is-active::after {
    opacity: 0.35;
}

.theme-card.is-active {
    border-color: var(--brand);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.theme-card__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.theme-card__meta h2 {
    margin: 0.15rem 0 0;
    font-size: 1.4rem;
}

.theme-card__description {
    color: var(--text-muted);
    line-height: 1.5;
}

.theme-swatches {
    display: flex;
    gap: 0.5rem;
}

.theme-swatch {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--swatch-color, #ffffff);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-attributes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 0;
}

.theme-attributes dt {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.theme-attributes dd {
    margin: 0;
    font-weight: 600;
}

.theme-card__actions {
    margin-top: auto;
}

@media (max-width: 640px) {
    .theme-card {
        min-height: unset;
    }
    .hero-panel__chip .chip-value {
        font-size: 1.15rem;
    }
}

@media (max-width: 640px) {
    .theme-switcher {
        left: 1rem;
        right: 1rem;
        min-width: auto;
    }
}

.page-shell.dashboard-shell,
.page-shell.permissions-shell,
.page-shell.login-shell {
    min-height: 100vh;
}

.btn-primary,
.primary-btn {
    border: none;
    background: linear-gradient(125deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
    box-shadow: var(--primary-btn-shadow);
}

.btn-primary:hover,
.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--primary-btn-shadow-hover);
}

.btn-outline-light,
.ghost-btn {
    border: 1px solid rgba(201, 162, 39, 0.4);
    background: linear-gradient(135deg, rgba(255, 250, 235, 0.7), rgba(245, 235, 210, 0.5));
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    transition:
        color 0.2s var(--transition-snappy),
        background 0.2s var(--transition-snappy),
        border-color 0.2s var(--transition-snappy),
        box-shadow 0.2s var(--transition-snappy),
        transform 0.2s var(--transition-snappy);
}

.ghost-btn {
    border-color: rgba(201, 162, 39, 0.4);
    background: linear-gradient(135deg, rgba(255, 250, 235, 0.7), rgba(245, 235, 210, 0.5));
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.1);
}

.btn-outline-light:hover,
.btn-outline-light:focus-visible,
.ghost-btn:hover,
.ghost-btn:focus-visible {
    border-color: rgba(201, 162, 39, 0.6);
    background: linear-gradient(135deg, rgba(255, 248, 225, 0.9), rgba(245, 230, 200, 0.8));
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 162, 39, 0.2);
}

.btn-outline-light:focus-visible,
.ghost-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.btn-outline-light:disabled,
.ghost-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.form-control,
.form-select,
input,
select,
textarea {
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    padding: 0.65rem 0.9rem;
}

.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-strong);
    box-shadow: 0 0 0 3px var(--focus-ring-color);
    background: rgba(4, 27, 29, 0.9);
}

label span {
    display: block;
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.card,
.panel,
.modal-content,
.dropdown-menu,
.list-group-item,
.offcanvas {
    background: linear-gradient(160deg, #fffcf5 0%, #fff8e7 50%, #f5e6c8 100%);
    backdrop-filter: blur(18px);
    border-radius: var(--radius-card);
    border: 1px solid rgba(201, 162, 39, 0.25);
    box-shadow: var(--shadow-md);
}

.table {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.08);
}

.table-striped > tbody > tr:nth-of-type(odd) {
    --bs-table-accent-bg: rgba(255, 255, 255, 0.04);
}

/* --------------------------------------------------------------------- */
/* Flash messages & chips                                                 */
/* --------------------------------------------------------------------- */
.flash-container {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.flash-message {
    border-radius: 18px;
    padding: 0.9rem 1.2rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: fade-in 0.4s var(--transition-snappy);
}

.flash-success { border-left: 4px solid var(--status-success); }
.flash-error { border-left: 4px solid var(--status-danger); }
.flash-info { border-left: 4px solid var(--brand); }
.flash-assignment {
    border-left: 4px solid var(--status-warning);
    animation: flash-pulse 0.4s ease, flash-beacon 1s ease-in-out 0.4s 3;
    font-weight: 600;
}

@keyframes flash-pulse {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes flash-beacon {
    0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.65); }
    70% { box-shadow: 0 0 0 16px rgba(251, 191, 36, 0); }
    100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}

@keyframes roller-spin-down {
    0% { transform: translateY(0); filter: blur(0); }
    35% { transform: translateY(-24px); filter: blur(1px); }
    65% { transform: translateY(12px); filter: blur(0.6px); }
    85% { transform: translateY(-6px); filter: blur(0.2px); }
    100% { transform: translateY(0); filter: blur(0); }
}

@keyframes roller-spin-up {
    0% { transform: translateY(0); filter: blur(0); }
    35% { transform: translateY(24px); filter: blur(1px); }
    65% { transform: translateY(-12px); filter: blur(0.6px); }
    85% { transform: translateY(6px); filter: blur(0.2px); }
    100% { transform: translateY(0); filter: blur(0); }
}

.user-chip {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 0.6rem 1rem;
    min-width: 220px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chip-label { font-size: 0.72rem; letter-spacing: 0.12em; color: var(--text-muted); }
.chip-value { font-size: 0.95rem; font-weight: 600; }

/* --------------------------------------------------------------------- */
/* Panels & forms                                                         */
/* --------------------------------------------------------------------- */
.panel {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.panel-subhead {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-field {
    display: flex;
    flex-direction: column;
}

.inline-form {
    display: inline;
}

.table-action,
.matrix-action {
    border: none;
    border-radius: 12px;
    padding: 0.45rem 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s var(--transition-snappy);
}

.table-action.edit,
.matrix-action.edit {
    background: var(--table-action-edit-bg);
    color: var(--text-primary);
}

.table-action.delete,
.matrix-action.delete {
    background: rgba(248, 113, 113, 0.2);
    color: var(--text-primary);
}

.table-action:hover,
.matrix-action:hover {
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------- */
/* Login page                                                             */
/* --------------------------------------------------------------------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-shell {
    display: grid;
    place-items: center;
}

.login-hero {
    position: relative;
    width: min(100%, 520px);
    min-height: 520px;
    display: grid;
    place-items: center;
}

.floating-orb {
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: var(--floating-orb-gradient);
    filter: blur(2px);
    animation: float 16s ease-in-out infinite;
    opacity: 0.8;
}

.orb-1 { top: -60px; left: -40px; animation-delay: -3s; }
.orb-2 { bottom: -80px; right: -20px; animation-delay: -7s; }

.login-card {
    width: min(420px, 92vw);
    padding: 2.5rem;
    background: var(--surface-strong);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: var(--blur);
}

.card-header h1 { margin: 0; font-size: 1.9rem; }
.card-header p { margin: 0.4rem 0 0; color: var(--text-muted); }

.login-form { margin-top: 1.5rem; gap: 1rem; display: flex; flex-direction: column; }

.login-form input {
    background: linear-gradient(135deg, #fffcf5 0%, #fff8e7 100%);
    color: #3d2e0a;
    border: 1px solid rgba(201, 162, 39, 0.35);
}

.login-form input:focus {
    background: linear-gradient(135deg, #fff 0%, #fffcf5 100%);
    border-color: rgba(201, 162, 39, 0.6);
}

.login-form input::placeholder {
    color: rgba(61, 46, 10, 0.5);
}

.form-extras {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.remember { display: flex; align-items: center; gap: 0.4rem; }

/* --------------------------------------------------------------------- */
/* Dashboard                                                              */
/* --------------------------------------------------------------------- */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: stretch;
}

.header-actions__group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.header-actions__group--session {
    align-items: stretch;
}

.header-actions__signout {
    margin: 0;
}

.header-action-btn {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius-pill);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    min-height: 44px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.header-action-btn:hover,
.header-action-btn:focus-visible {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.25);
    transform: translateY(-1px);
}

.dashboard-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.roster-table {
    display: grid;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    overflow: hidden;
}

.roster-row {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 0.8fr 1fr;
    padding: 0.85rem 1.2rem;
    align-items: center;
    gap: 0.75rem;
}

.roster-header {
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.roster-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.column-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Dashboard modal */
.modal-backdrop,
.modal {
    backdrop-filter: blur(6px);
}

/*
  Custom modals use `.is-open` toggling via JS.
  Bootstrap also defines `.modal` as `display: none` until `.show` is applied,
  so we explicitly control visibility here.
*/
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1100;
}

.modal.is-open {
    display: flex !important;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 0;
}

.modal-content {
    position: relative;
    z-index: 1;
    max-height: calc(100vh - 3rem);
    overflow: auto;
    padding: 2rem;
    border-radius: 24px;
    color: #3d2e0a;
}

.modal-content h2,
.modal-content h3,
.modal-content h4 {
    color: #3d2e0a;
}

.modal-content p,
.modal-content .modal-subhead {
    color: #5a4510;
}

.modal-content label span {
    color: #5a4510;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.assign-tw-body {
    background: var(--assign-background);
    min-height: 100vh;
}

/* Hide theme switcher on specific pages */
.hide-theme-switcher ~ .theme-switcher,
body.hide-theme-switcher .theme-switcher {
    display: none !important;
}

.assign-tw-shell {
    padding: clamp(1.5rem, 3vw, 3rem);
    max-width: 2400px;
}

.assign-tw {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    position: relative;
}

.assign-tw__back-arrow {
    position: absolute;
    left: -60px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    z-index: 10;
}

.assign-tw__back-arrow:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-decoration: none;
}

.assign-tw__back-arrow svg {
    width: 32px;
    height: 32px;
}

@media (max-width: 1400px) {
    .assign-tw__back-arrow {
        position: fixed;
        left: 10px;
        top: 50%;
    }
}

.assign-tw__watermark {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(240px, 34vw, 420px);
    height: clamp(240px, 34vw, 420px);
    pointer-events: none;
    z-index: 3;
    mix-blend-mode: normal;
    opacity: 1;
    filter: drop-shadow(0 40px 65px rgba(139, 105, 20, 0.4));
}

.assign-tw__stamp {
    width: 100%;
    height: 100%;
    display: block;
}

.assign-tw__stamp-outline {
    fill: rgba(201, 162, 39, 0.15);
    stroke: rgba(139, 105, 20, 0.6);
    stroke-width: 6;
}

.assign-tw__stamp-ridge {
    fill: none;
    stroke: rgba(201, 162, 39, 0.7);
    stroke-width: 18;
    stroke-linecap: round;
    stroke-dasharray: 12 10;
    opacity: 0.85;
}

.assign-tw__stamp-inner {
    fill: rgba(201, 162, 39, 0.1);
    stroke: rgba(139, 105, 20, 0.3);
    stroke-width: 6;
    stroke-dasharray: 6 8;
}

.assign-tw__stamp-stars text {
    fill: rgba(139, 105, 20, 0.7);
    font-size: 18px;
    letter-spacing: 0.6em;
}

.assign-tw__stamp-arc {
    fill: rgba(139, 105, 20, 0.75);
    font-size: 12px;
    letter-spacing: 0.45em;
    text-transform: uppercase;
}

.assign-tw__stamp-banner rect {
    fill: rgba(201, 162, 39, 0.85);
    stroke: rgba(139, 105, 20, 0.7);
    stroke-width: 4;
    filter: drop-shadow(0 6px 12px rgba(139, 105, 20, 0.4));
}

.assign-tw__stamp-banner text {
    fill: rgba(61, 46, 10, 0.95);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.12em;
}

.assign-tw__stamp-distress {
    fill: rgba(139, 105, 20, 0.05);
    mix-blend-mode: multiply;
}

.assign-tw__watermark[hidden] {
    display: none;
}

.assign-tw__assigned-by {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3d2e0a;
    background: rgba(255, 248, 230, 0.9);
    border: 1px solid rgba(201, 162, 39, 0.4);
    border-radius: 999px;
    letter-spacing: 0.05em;
    white-space: nowrap;
    z-index: 2;
}

.assign-tw__assigned-by[hidden] {
    display: none;
}

/* --- Search KG modal --- */
.assign-tw__name-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.assign-tw__search-btn {
   
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
}

.assign-tw__search-btn:hover {
   
    transform: scale(1.08);
}

.assign-tw__search-btn svg {
    width: 1.2rem;
    height: 1.2rem;
    pointer-events: none;
    stroke: currentColor;
}

.assign-tw__modal-panel--search {
    width: min(90vw, 420px);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assign-tw__search-input {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--input-border, #ccc);
    border-radius: 0.5rem;
    background: var(--input-bg, #fff);
    color: var(--input-text, inherit);
    outline: none;
    transition: border-color 0.2s;
}

.assign-tw__search-input:focus {
    border-color: var(--accent);
}

.assign-tw__search-results {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.assign-tw__search-item {
    padding: 0.6rem 0.8rem;
    border-radius: 0.4rem;
    cursor: pointer;
   
    transition: background 0.15s, transform 0.1s;
}

.assign-tw__search-item:hover,
.assign-tw__search-item:focus {
    background: var(--accent);
    color: #fff;
    outline: none;
}

.assign-tw__search-empty {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted, #888);
}

.assign-tw__panel {
    background: var(--panel-background);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assign-tw__panel--kg {
    flex: 1 1 380px;
    max-width: 520px;
    min-width: 320px;
}

.assign-tw__panel--mawaze {
    flex: 3 1 640px;
    position: relative;
    overflow: hidden;
}

.assign-tw__panel-head h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.assign-tw__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0 0 0.35rem;
}

.assign-tw__controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.assign-tw__modal-panel--wide {
    width: min(2000px, 96vw) !important;
    max-width: 2000px !important;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.assign-tw__history-body,
.assign-tw__summary-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    overflow: hidden;
}

.assign-tw__summary-overview {
    border-radius: 1.1rem;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.assign-tw__summary-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.65rem;
}

.assign-tw__summary-overview-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.assign-tw__summary-overview-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.assign-tw__summary-overview-progress {
    position: relative;
    height: 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.assign-tw__summary-overview-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-muted), var(--brand));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
    transition: width 0.3s ease;
}

.assign-tw__modal-panel--history .assign-tw__history-body {
    flex: 1;
}

.assign-tw__history-scroll {
    flex: 1;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

.assign-tw__history-scroll::-webkit-scrollbar {
    width: 0.4rem;
}

.assign-tw__history-scroll::-webkit-scrollbar-thumb {
    background: var(--brand-muted);
    border-radius: 999px;
}

.assign-tw__history-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.assign-tw__history-info-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.assign-tw__history-info-heading {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.assign-tw__history-info-meta {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.assign-tw__history-info-table-wrapper {
    overflow-x: auto;
    margin: 0 -0.3rem;
    padding: 0 0.3rem;
}

.assign-tw__history-info-table-wrapper::-webkit-scrollbar {
    height: 0.35rem;
}

.assign-tw__history-info-table-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.assign-tw__history-info-table th,
.assign-tw__history-info-table td {
    font-size: 0.85rem;
}

.assign-tw__modal-panel--history-info {
    width: min(1400px, 98vw);
}

.assign-tw__history-info-scroll {
    flex: 1;
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

.assign-tw__history-info-scroll::-webkit-scrollbar {
    width: 0.4rem;
}

.assign-tw__history-info-scroll::-webkit-scrollbar-thumb {
    background: var(--brand-muted);
    border-radius: 999px;
}

/* Print Report Style for History Info Popup */
.history-report-card {
    background: #fff;
    border: 1px solid #000;
    border-radius: 0;
    margin-bottom: 0;
}

.history-report-row {
    display: flex;
    width: 100%;
}

.history-report-col {
    border-right: 1px solid #000;
    padding: 0;
    flex-shrink: 0;
}

.history-report-col:last-child {
    border-right: none;
}

.history-report-miqaat-col {
    width: 220px;
    min-width: 180px;
}

.history-report-info-col {
    flex: 1;
    min-width: 280px;
}

.history-report-miqaat-header {
    background: var(--brand-muted, #f0f0f0);
    font-weight: bold;
    text-align: center;
    padding: 8px 10px;
    border-bottom: 1px solid #000;
    font-size: 12px;
    color: var(--text-primary, #000);
}

.history-report-miqaat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.history-report-miqaat-table th {
    background: rgba(201, 162, 39, 0.1);
    font-weight: bold;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #ccc;
    color: var(--text-primary, #333);
}

.history-report-miqaat-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    color: var(--text-primary, #000);
}

.history-report-miqaat-table tr:last-child td {
    border-bottom: none;
}

.history-report-overall-avg {
    background: rgba(201, 162, 39, 0.15);
    font-weight: bold;
}

.history-report-overall-avg td {
    padding: 8px;
    border-top: 1px solid #000;
}

.history-report-info-section {
    padding: 12px 15px;
    display: flex;
    gap: 15px;
}

.history-report-photo-section {
    width: 90px;
    flex-shrink: 0;
}

.history-report-photo {
    width: 80px;
    height: 100px;
    object-fit: cover;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.history-report-photo-placeholder {
    width: 80px;
    height: 100px;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 10px;
    text-align: center;
}

.history-report-its {
    font-size: 13px;
    color: var(--text-muted, #666);
    margin-bottom: 6px;
}

.history-report-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--brand, #8B0000);
    margin-bottom: 10px;
}

.history-report-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    font-size: 11px;
}

.history-report-detail {
    display: flex;
    gap: 5px;
}

.history-report-detail-label {
    color: var(--text-muted, #666);
}

.history-report-detail-value {
    font-weight: bold;
    color: var(--text-primary, #000);
}

.history-report-no-data {
    text-align: center;
    color: #999;
    padding: 15px;
    font-size: 11px;
}

.assign-tw__photo-stack {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.assign-tw__photo {
    width: clamp(160px, 25vw, 167px);
    height: clamp(170px, 20vw, 200px);
    border-radius: 1.25rem;
    background: var(--avatar-gradient, rgba(255, 255, 255, 0.12));
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.8rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--brand-contrast);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
    padding: 0.75rem;
}

.assign-tw__photo.has-photo [data-kg-initials] {
    display: none;
}

.assign-tw__photo-stack + .assign-tw__identity {
    margin-left: 0.25rem;
}

.assign-tw__photo-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    justify-content: center;
    padding: 0.35rem 0;
}

.assign-tw__photo-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.assign-tw__photo-btn:hover,
.assign-tw__photo-btn:focus-visible {
    transform: translateY(-1px);
    border-color: var(--brand);
    background: rgba(255, 255, 255, 0.08);
}

.assign-tw__photo-btn span:first-child {
    font-size: 1.1rem;
}

.assign-tw__photo-btn svg {
    display: block;
}

.assign-tw__identity {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.assign-tw__name {
    margin: 0;
    font-size: 1.6rem;
}

.assign-tw__role {
    margin: 0;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 10px;
}

.assign-tw__role span {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.assign-tw__role select {
    min-width: 180px;
}

.assign-tw__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.assign-tw__facts div {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.75rem;
    border-radius: 1rem;
}

.assign-tw__facts dt {
    margin: 0;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.assign-tw__facts dd {
    margin: 0.2rem 0 0;
    font-size: 0.95rem;
}

.assign-tw__kg-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.75rem;
}

.assign-tw__column-inspector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.assign-tw__column-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.assign-tw__column-label select {
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.85rem;
    min-width: 140px;
}

.assign-tw__column-value {
    margin: 0;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

.assign-tw__kg-footer p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.assign-tw__kg-footer p[data-tone='error'] {
    color: var(--danger);
}

.assign-tw__mawaze-head h2 {
    margin: 0;
    font-size: clamp(1.4rem, 2.5vw, 1.8rem);
}

.assign-tw__mawaze-actions {
    display: flex;
    justify-content: flex-end;
}

.assign-tw__mawaze-actions button[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.assign-tw__assigned {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 1.25rem;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.25);
}

.assign-tw__assigned[hidden] {
    display: none;
}

.assign-tw__assigned-text {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.assign-tw__assigned-text strong {
    font-size: 1.4rem;
}

.assign-tw__assigned-subtext {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.assign-tw__rows {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 420px;
}

.assign-tw__row {
    min-height: 110px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 1.25rem;
    padding: 0.75rem;
}

.assign-tw__row--primary {
    display: flex;
    justify-content: center;
    align-items: center;
}

.assign-tw__row--primary .assign-tw__card {
    min-width: 40%;
    transform: scale(1.15);
    transform-origin: center center;
    position: relative;
    border: none;
    background-clip: padding-box;
}

.assign-tw__row--primary .assign-tw__card::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 1.25rem;
    padding: 3px;
    background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000);
    background-size: 400% 100%;
    animation: rainbow-border 3s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
}

@keyframes rainbow-border {
    0% { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}

.assign-tw__row--trio {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.assign-tw__placeholder {
    margin: 0;
    color: var(--text-muted);
}

.assign-tw__card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
}

.assign-tw__card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: baseline;
}

.assign-tw__card-head h3 {
    margin: 0;
    font-size: 1.5rem;
}

.assign-tw__rank-pill {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
}

.assign-tw__card-meta {
    margin: 0;
    color: var(--text-muted);
}

.assign-tw__card-actions {
    margin-top: auto;
}

.assign-tw__empty {
    text-align: center;
    padding: 0.5rem;
    margin: 0;
    color: var(--text-muted);
}

.assign-tw__modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    padding: clamp(0.75rem, 4vw, 2.5rem);
    overflow-y: auto;
}

.assign-tw__modal[hidden] {
    display: none;
}

.danger-btn {
    background: rgba(251, 113, 133, 0.1);
    color: var(--status-danger);
    border: 1px solid rgba(251, 113, 133, 0.5);
    box-shadow: none;
    transition:
        color 0.2s var(--transition-snappy),
        background 0.2s var(--transition-snappy),
        border-color 0.2s var(--transition-snappy),
        transform 0.2s var(--transition-snappy);
}

.danger-btn:hover,
.danger-btn:focus-visible {
    background: rgba(251, 113, 133, 0.18);
    color: var(--status-danger);
    transform: translateY(-2px);
}

.danger-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.danger-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.assign-tw__modal-panel {
    /* background: rgba(5, 8, 18, 0.98); */
    border-radius: 1.35rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    width: min(820px, 92vw);
    max-height: 95vh;
    box-shadow: var(--shadow-lg, 0 30px 60px rgba(0, 0, 0, 0.55));
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assign-tw__modal-panel h3 {
    margin-top: 0.25rem;
}

.assign-tw__modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: auto;
}

.assign-tw__history-table {
    width: 100%;
    border-collapse: collapse;
}

.assign-tw__history-table th,
.assign-tw__history-table td {
    text-align: left;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
}

.assign-tw__history-table th {
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

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

.assign-tw__summary-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assign-tw__summary-card {
    border-radius: 1.25rem;
    padding: 1.1rem 1.35rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 15px 25px rgba(0, 0, 0, 0.25);
}

.assign-tw__summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.assign-tw__summary-card strong {
    font-size: 1.1rem;
}

.assign-tw__summary-total {
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.assign-tw__summary-progress {
    position: relative;
    height: 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.assign-tw__summary-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-muted), var(--brand));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    transition: width 0.3s ease;
}

.assign-tw__summary-metrics {
    display: flex;
    gap: 1.2rem;
    font-size: 0.9rem;
}

.assign-tw__summary-metrics span {
    display: inline-flex;
    flex-direction: column;
    text-align: center;
    min-width: 60px;
}

.assign-tw__summary-metrics span em {
    font-style: normal;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.assign-tw__summary-scroll {
    flex: 1;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

.assign-tw__summary-scroll::-webkit-scrollbar {
    width: 0.4rem;
}

.assign-tw__summary-scroll::-webkit-scrollbar-thumb {
    background: var(--brand-muted);
    border-radius: 999px;
}

.assign-tw__remark-group {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.assign-tw__remark-label {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.assign-tw__remark-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.assign-tw__remark-btn {
    flex: 1 1 30%;
    min-width: 90px;
    justify-content: center;
}

.assign-tw__remark-btn--suggested {
    box-shadow: 0 0 0 2px var(--brand);
}

.assign-tw__remark-hint {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.assign-tw__all-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assign-tw__all-search {
    flex: 1 1 300px;
    min-width: 200px;
}

.assign-tw__all-search .assign-tw__search-input {
    width: 100%;
}

.assign-tw__all-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.1rem;
    padding: 0.85rem 1rem;
    background: rgba(0, 0, 0, 0.25);
}

.assign-tw__filter-box {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 auto;
}

.assign-tw__filter-label {
    margin: 0;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.assign-tw__filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.assign-tw__filter-chip {
    position: relative;
    display: inline-flex;
}

.assign-tw__filter-chip input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.assign-tw__filter-chip span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: border-color 0.2s var(--transition-snappy),
        background 0.2s var(--transition-snappy),
        color 0.2s var(--transition-snappy);
}

.assign-tw__filter-chip span::before {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background 0.2s var(--transition-snappy),
        border-color 0.2s var(--transition-snappy);
}

.assign-tw__filter-chip input:checked + span {
    border-color: var(--brand);
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.assign-tw__filter-chip input:checked + span::before {
    background: var(--brand);
    border-color: var(--brand);
}

.assign-tw__filter-chip input:focus-visible + span {
    outline: 2px solid var(--focus-ring-color);
    outline-offset: 2px;
}

.assign-tw__filter-select {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}

.assign-tw__filter-select select {
    min-width: 180px;
    border-radius: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
    padding: 0.45rem 0.9rem;
}

.assign-tw__all-table-wrapper {
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    max-height: min(520px, 60vh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.assign-tw__all-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}

.assign-tw__all-table th,
.assign-tw__all-table td {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.assign-tw__all-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    position: sticky;
    top: 0;
    z-index: 1;
}

.assign-tw__all-table tbody {
    display: block;
    max-height: min(460px, 55vh);
    overflow-y: auto;
}

.assign-tw__all-table thead,
.assign-tw__all-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.assign-tw__all-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.assign-tw__all-table tr.is-assigned {
    background: rgba(255, 255, 255, 0.02);
}

.assign-tw__table-status {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.assign-tw__table-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--avatar-gradient, rgba(255, 255, 255, 0.12));
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.assign-tw__table-thumb.has-photo {
    border-color: var(--accent);
}

.assign-tw__table-status-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.assign-tw__table-status strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.assign-tw__table-assign {
    display: flex;
    justify-content: flex-end;
}

.assign-tw__table-assign-btn {
    padding-inline: 1rem;
    min-width: 100px;
    font-size: 0.85rem;
}

.assign-tw__all-table-wrapper .assign-tw__placeholder {
    margin: 1rem;
}

.assign-tw__all-table tbody::-webkit-scrollbar {
    width: 0.45rem;
}

.assign-tw__all-table tbody::-webkit-scrollbar-thumb {
    background: var(--brand-muted);
    border-radius: 999px;
}

.assign-tw__all-table tbody::-webkit-scrollbar-thumb {
    background: var(--brand-muted);
    border-radius: 999px;
}

@media (max-width: 640px) {
    .assign-tw__modal {
        padding: 1rem;
    }

    .assign-tw__modal-panel,
    .assign-tw__modal-panel--wide {
        width: 100%;
        max-width: 100%;
        max-height: 96vh;
    }

    .assign-tw__all-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .assign-tw__filter-select select {
        width: 100%;
    }
}

@media (max-width: 960px) {
    .assign-tw {
        flex-direction: column;
    }

    .assign-tw__panel--kg,
    .assign-tw__panel--mawaze {
        max-width: 100%;
    }

    .assign-tw__row--primary {
        justify-content: center;
    }
    
    .assign-tw__row--trio {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
}

/* Form Inputs */
.modal-content input,
.modal-content select,
.modal-content textarea,
.panel input,
.panel select,
.panel textarea {
    background: linear-gradient(135deg, #fffcf5 0%, #fff8e7 100%);
    color: #3d2e0a;
    border: 1px solid rgba(201, 162, 39, 0.35);
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus,
.panel input:focus,
.panel select:focus,
.panel textarea:focus {
    background: linear-gradient(135deg, #fff 0%, #fffcf5 100%);
    border-color: rgba(201, 162, 39, 0.6);
    box-shadow: 0 0 0 3px rgba(232, 185, 35, 0.15);
}

.modal-content input::placeholder,
.panel input::placeholder {
    color: rgba(61, 46, 10, 0.5);
}

/* --------------------------------------------------------------------- */
/* Permissions                                                            */
/* --------------------------------------------------------------------- */
.permissions {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

/* --------------------------------------------------------------------- */
/* Upload Data                                                           */
/* --------------------------------------------------------------------- */
.upload-data__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.upload-data__tab {
    border: 1px solid rgba(201, 162, 39, 0.4);
    border-radius: var(--radius-pill);
    padding: 0.55rem 1.25rem;
    background: linear-gradient(135deg, rgba(255, 250, 235, 0.6), rgba(245, 235, 210, 0.4));
    color: var(--text-primary);
    font-weight: 600;
}

.upload-data__tab.is-active {
    background: linear-gradient(125deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
    border-color: rgba(255, 255, 255, 0.12);
}

.upload-data__panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
}

.upload-data__format {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.upload-data__format-label {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.upload-data__format-columns {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}

.upload-data__upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin-top: 1.25rem;
}

.upload-data__file {
    min-width: 320px;
    flex: 1;
}

.upload-data__preview {
    margin-top: 1.75rem;
}

.upload-data__preview-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.upload-data__preview-header h3 {
    margin: 0;
}

.upload-data__preview-hint {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Upload Data - sortable tables */
[data-table-root] thead th[data-sort-index] {
    cursor: pointer;
    user-select: none;
}

[data-table-root] thead th.is-sorted {
    text-decoration: underline;
}

[data-table-root] thead th.is-sorted::after {
    content: "";
    display: inline-block;
    margin-left: 0.4rem;
    border-left: 0.35rem solid transparent;
    border-right: 0.35rem solid transparent;
}

[data-table-root] thead th.is-sorted[data-sort-direction="asc"]::after {
    border-bottom: 0.45rem solid currentColor;
}

[data-table-root] thead th.is-sorted[data-sort-direction="desc"]::after {
    border-top: 0.45rem solid currentColor;
}

.permission-glow {
    position: absolute;
    inset: 0;
    border-radius: 40px;
    background: var(--permission-glow);
    filter: blur(60px);
    z-index: -1;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.matrix-table {
    display: grid;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.matrix-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr 0.8fr 1fr;
    padding: 0.95rem 1.1rem;
    align-items: center;
    gap: 0.75rem;
}

.matrix-header {
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.matrix-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

.badge {
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.badge-admin { background: rgba(249, 115, 22, 0.25); color: #fed7aa; }
.badge-editor { background: var(--badge-editor-bg); color: var(--badge-editor-color); }
.badge-viewer { background: var(--badge-viewer-bg); color: var(--badge-viewer-color); }

.assign-footnote {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------- */
/* Assign workflow                                                        */
/* --------------------------------------------------------------------- */
.assign-body {
    background: var(--assign-background);
}

.assign-toolbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 1.5rem;
}

.assign-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
    padding-inline: 1.75rem;
}

.assign-back__icon {
    font-size: 1.1rem;
    line-height: 1;
}

.assign-layout {
    display: grid;
    grid-template-columns: minmax(250px, 30%) minmax(220px, 30%) minmax(320px, 40%);
    gap: 1rem;
}

.assign-column {
    background: var(--panel-background);
    border-radius: 32px;
    padding: 2.1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: var(--shadow-md);
}

.assign-column-controls,
.assign-column-cities {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    min-height: 0;
}

.assign-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

.assign-controls .assign-filter-group {
    width: 100%;
}

.assign-summary-btn,
.assign-export-btn {
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.85rem 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.assign-export-btn {
    margin-top: 0.5rem;
}

.assign-summary-btn:hover,
.assign-summary-btn:focus-visible,
.assign-export-btn:hover,
.assign-export-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

.assign-column-summary {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.assign-panel__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.assign-panel__identity h1 {
    margin: 0;
    font-size: 1.5rem;
}

.assign-employee__role {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.85rem;
    border-radius: var(--radius-pill);
    background: linear-gradient(120deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
    font-size: 0.78rem;
}

.assign-employee__control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.assign-employee__avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--avatar-gradient);
    display: grid;
    place-items: center;
    color: var(--brand-contrast);
    font-weight: 700;
}

.assign-employee__nav {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
    flex-wrap: nowrap;
    white-space: nowrap;
}

.assign-nav__btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    cursor: pointer;
}

.assign-field { margin: 0.1rem 0; color: var(--text-muted); }

.assign-panel__section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.assign-subheading {
    margin: 0 0 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.assign-profile {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 1.2rem;
    font-size: 0.9rem;
}

.assign-column-employee .assign-profile dt {
    font-size: 1.2em;
}

.assign-panel__filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.9rem;
    align-items: center;
}

.assign-panel__filters select {
    min-width: 180px;
}

.assign-panel__filters-label {
    margin: 0;
    white-space: nowrap;
}

.assign-panel__quick-select {
    margin-left: auto;
    white-space: nowrap;
    border-radius: var(--radius-pill);
    padding-inline: 1.25rem;
}

.assign-picker {
    position: fixed;
    inset: 0;
    background: rgba(3, 12, 14, 0.78);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1.5rem;
}

.assign-picker:not(.hidden) {
    display: flex;
}

.assign-picker__panel {
    width: min(520px, 100%);
    background: var(--surface-strong);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.assign-picker__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.assign-picker__header h2 {
    margin: 0;
}

.assign-picker__close {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.assign-picker__body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.assign-picker__body label {
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

#kgPickerSelect {
    border-radius: 20px;
    min-height: 220px;
    padding: 0.5rem;
}

.assign-picker__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.assign-alert {
    position: fixed;
    inset: 0;
    background: rgba(5, 15, 17, 0.65);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 1.5rem;
}

.assign-alert:not(.hidden) {
    display: flex;
}

.assign-alert__panel {
    width: min(520px, 100%);
    background: var(--assign-alert-background);
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.75rem;
    box-shadow: var(--assign-alert-shadow);
    animation: flash-pulse 0.35s ease;
}

.assign-alert__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.assign-alert__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.7rem;
    color: var(--status-warning);
}

.assign-alert__header h3 {
    margin: 0.25rem 0 0;
}

.assign-alert__close {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    font-size: 1.25rem;
    cursor: pointer;
}

.assign-alert__body {
    margin: 1rem 0 1.5rem;
    font-size: 1rem;
    line-height: 1.4;
}

.assign-alert__footer {
    display: flex;
    justify-content: flex-end;
}

.assign-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.assign-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.09);
    border-radius: 20px;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.assign-filter-group input,
.assign-filter-group select {
    width: 100%;
    min-width: 0;
}

.assign-filter-group--slider { grid-column: 1; }
.assign-filter-group--select { grid-column: 2; }
.assign-filter-group--toggle { grid-column: 1; }
.assign-filter-group--eligibility { grid-column: 2; }
.assign-filter-group--search { grid-column: 1; }
.assign-filter-group--sort {
    grid-column: 2;
    position: relative;
    align-self: flex-start;
    justify-self: flex-end;
    min-width: 220px;
}

.assign-filter-group--sort .ghost-btn {
    width: fit-content;
}

.assign-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.assign-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--brand);
}

.assign-checkbox span {
    margin: 0;
}

.assign-filter-group--slider {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 0.85rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.assign-filter-group--slider label {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.assign-window__range {
    width: 100%;
    accent-color: var(--brand);
}

.assign-window__range-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.assign-window__config {
    justify-self: flex-end;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.4rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.assign-summary {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.summary-header h2 {
    margin: 0;
}

.summary-header p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
}

.summary-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-card {
    padding: 1.25rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.11);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.assign-summary-popup {
    position: fixed;
    inset: 0;
    background: rgba(6, 18, 24, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1200;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.assign-summary-popup.hidden {
    display: none;
}

.assign-summary-popup.is-visible {
    opacity: 1;
}

.assign-summary-popup__panel {
    width: min(640px, 100%);
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: var(--panel-background);
    box-shadow: 0 35px 70px rgba(0, 0, 0, 0.45);
    padding: 2rem;
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.assign-summary-popup__panel.is-active {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.assign-summary-popup__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.assign-summary-popup__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.assign-summary-popup__subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
}

.assign-summary-popup__close {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
}

.assign-summary-popup__body {
    max-height: min(70vh, 520px);
    overflow-y: auto;
}

.summary-label {
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.summary-value {
    font-size: 2.35rem;
    font-weight: 700;
}

.summary-subtext {
    margin: 0;
    color: var(--text-muted);
}

.summary-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.summary-pill {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 0.5rem 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.summary-pill strong {
    font-size: 1.2rem;
}

.summary-pill--tw {
    border: 1px solid var(--summary-pill-tw-border);
}

.summary-pill--br {
    border: 1px solid var(--summary-pill-br-border);
}

.assign-toggle {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.assign-toggle__buttons {
    display: inline-flex;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    padding: 0.25rem;
}

.assign-toggle__btn {
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.35rem 0.9rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.assign-toggle__btn.is-active {
    background: linear-gradient(125deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
}

.assign-toggle__select {
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 0.55rem 0.9rem;
    font-size: 0.95rem;
    width: 100%;
}

.assign-toggle__select:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--focus-ring-color);
}

.assign-roller {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    gap: 0.75rem;
    align-items: stretch;
    padding-top: 1.4rem;
    position: relative;
    flex: 1;
    min-height: 0;
}

.assign-roller__control {
    border: none;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    height: 100%;
    min-height: 160px;
    cursor: pointer;
}

.assign-roller__viewport {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 26px;
    padding: 1.15rem 0.75rem 0.75rem;
    height: clamp(320px, calc(100vh - 360px), 720px);
    max-height: clamp(320px, calc(100vh - 360px), 720px);
    min-height: 240px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 15px 25px rgba(0, 0, 0, 0.2);
}

.assign-roller__viewport::before,
.assign-roller__viewport::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 42px;
    pointer-events: none;
    z-index: 2;
}

.assign-roller__viewport::before {
    top: 0;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    background: var(--roller-mask-top);
}

.assign-roller__viewport::after {
    bottom: 0;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
    background: var(--roller-mask-bottom);
}

.assign-roller__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    height: 100%;
    max-height: 100%;
    scroll-behavior: smooth;
    position: relative;
    z-index: 1;
}

.assign-roller__list.is-spinning {
    animation-duration: 0.65s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.assign-roller__list.is-spinning-down {
    animation-name: roller-spin-down;
}

.assign-roller__list.is-spinning-up {
    animation-name: roller-spin-up;
}

.assign-roller__item {
    position: relative;
    display: block;
    z-index: 0;
}

.assign-roller__item--owned::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 24px;
    border: 2px solid var(--brand);
    box-shadow: 0 0 18px rgba(60, 194, 196, 0.55);
    opacity: 0.35;
    animation: roller-owned-flash 1.4s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

.assign-city {
    padding: 0.85rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.12);
    transition: transform 0.2s ease, border 0.2s ease;
}

.assign-city--assigned {
    border-color: var(--brand);
}

.assign-city:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
}

.assign-city__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
}

.assign-city__badges {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.assign-city__badge {
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--city-badge-bg);
    font-size: 0.75rem;
}

.assign-city__action {
    border: none;
    border-radius: 18px;
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.7rem 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: linear-gradient(125deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
    box-shadow: var(--primary-btn-shadow);
    cursor: pointer;
    transition: transform 0.2s var(--transition-snappy), box-shadow 0.2s ease;
}

.assign-city__action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.assign-city__action:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--primary-btn-shadow-hover);
}

.assign-cities__footer {
    margin-top: 1.25rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--text-muted);
}

.assign-window-controls {
    display: flex;
    gap: 0.5rem;
}

.assign-filter-group--sort {
    position: relative;
}

.assign-sort {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 220px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(6, 20, 24, 0.95);
    box-shadow: var(--shadow-md);
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 5;
}

.assign-sort.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.assign-sort__option {
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.45rem 0.9rem;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
}

.assign-sort__option.is-active,
.assign-sort__option:hover {
    background: var(--brand-muted);
    color: var(--brand-contrast);
}

.assign-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0, 10, 12, 0.8);
    display: grid;
    place-items: center;
    z-index: 100;
}

.assign-dialog__content {
    width: min(520px, 95vw);
    padding: 2rem;
    border-radius: 26px;
    background: var(--surface-strong);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.assign-dialog__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assign-dialog__close {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1.8rem;
    cursor: pointer;
}

.assign-dialog__body {
    display: grid;
    gap: 1rem;
}

.assign-dialog__remarks-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.assign-dialog__remark-btn {
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-primary);
    padding: 0.4rem 0.9rem;
}

.assign-dialog__remark-btn[aria-checked="true"] {
    background: linear-gradient(125deg, var(--brand), var(--brand-strong));
    color: var(--brand-contrast);
}

.assign-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* --------------------------------------------------------------------- */
/* Responsive adjustments                                                */
/* --------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .assign-layout {
        grid-template-columns: minmax(320px, 1fr) minmax(400px, 1fr);
    }

    .assign-column-summary {
        grid-column: span 2;
    }
}

@keyframes roller-owned-flash {
    0% {
        opacity: 0.25;
        box-shadow: 0 0 12px rgba(60, 194, 196, 0.45);
    }
    50% {
        opacity: 0.75;
        box-shadow: 0 0 22px rgba(60, 194, 196, 0.85);
    }
    100% {
        opacity: 0.25;
        box-shadow: 0 0 12px rgba(60, 194, 196, 0.45);
    }
}

@media (max-width: 900px) {
    .roster-row,
    .matrix-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 0.4rem;
    }

    .assign-layout {
        grid-template-columns: 1fr;
    }

    .assign-filters {
        grid-template-columns: 1fr;
    }

    .assign-filter-group--select,
    .assign-filter-group--toggle,
    .assign-filter-group--eligibility,
    .assign-filter-group--search,
    .assign-filter-group--sort {
        grid-column: span 1;
        justify-self: stretch;
    }

    .assign-roller {
        grid-template-columns: 1fr;
    }

    .assign-roller__control {
        height: 48px;
    }

    .assign-filter-group--slider {
        grid-column: span 2;
        grid-template-columns: 1fr;
    }

    .assign-window__config {
        width: 100%;
        justify-self: stretch;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .page-shell {
        padding: 1.5rem;
    }

    .dashboard-header,
    .panel-header,
    .modal-header,
    .assign-panel__header {
        flex-direction: column;
    }

    .header-actions,
    .assign-window-controls {
        width: 100%;
        justify-content: space-between;
    }

    .login-card {
        padding: 2rem;
    }
}

/* --------------------------------------------------------------------- */
/* Export Tables Page                                                     */
/* --------------------------------------------------------------------- */
.export-tables {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.export-tables__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.export-tables__eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand);
    margin-bottom: 0.25rem;
}

.export-tables__header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.export-tables__subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.export-tables__content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.export-tables__card {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid rgba(128, 128, 128, 0.2);
    text-align: center;
}

.export-tables__card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(var(--brand-rgb, 100, 100, 100), 0.1);
    color: var(--brand);
    margin-bottom: 1.5rem;
}

.export-tables__card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
}

.export-tables__card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.export-tables__card code {
    background: rgba(128, 128, 128, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
}

.export-tables__info {
    background: rgba(128, 128, 128, 0.08);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.export-tables__info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
}

.export-tables__table-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.export-tables__table-list li {
    background: rgba(128, 128, 128, 0.12);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.export-tables__form {
    display: flex;
    justify-content: center;
}

.export-tables__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    padding: 0.875rem 1.75rem;
}

.export-tables__btn .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.export-tables__result {
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: left;
}

.export-tables__result--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.export-tables__result--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.export-tables__result h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.export-tables__result--success h3 {
    color: #22c55e;
}

.export-tables__result--error h3 {
    color: #ef4444;
}

.export-tables__result p {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
}

.export-tables__result code {
    background: rgba(128, 128, 128, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85em;
    word-break: break-all;
}

.export-tables__exported-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.export-tables__exported-list li {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
    padding: 0.3rem 0.65rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------- */
/* Animations                                                             */
/* --------------------------------------------------------------------- */
@keyframes float {
    0% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(20px, -25px, 0); }
    100% { transform: translate3d(0, 0, 0); }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------- */
/* Bulk Assignment Page                                                   */
/* --------------------------------------------------------------------- */
.bulk-assign-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-base);
}

.bulk-assign__panel {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.bulk-assign__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-soft);
}

.bulk-assign__title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.bulk-assign__filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bulk-assign__filter-group label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.bulk-assign__controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.bulk-assign__controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.bulk-assign__filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.bulk-assign__select {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 180px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.bulk-assign__select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.bulk-assign__search-label {
    display: flex;
    align-items: center;
}

.bulk-assign__search {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 220px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.bulk-assign__search:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.bulk-assign__stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.bulk-assign__stats-divider {
    margin: 0 0.5rem;
    opacity: 0.5;
}

.bulk-assign__filter-select {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    min-width: 180px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.bulk-assign__filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.bulk-assign__table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.bulk-assign__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.bulk-assign__table th,
.bulk-assign__table td {
    padding: 0.75rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}

.bulk-assign__table th {
    background: var(--bg-subtle);
    color: var(--text-primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.bulk-assign__table th:hover {
    background: var(--bg-input);
}

.bulk-assign__table th.bulk-assign__th-sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.4;
}

.bulk-assign__table th.bulk-assign__th-sortable.asc::after {
    border-bottom: 5px solid var(--text-primary);
    opacity: 1;
}

.bulk-assign__table th.bulk-assign__th-sortable.desc::after {
    border-top: 5px solid var(--text-primary);
    opacity: 1;
}

.bulk-assign__table tbody tr {
    transition: background 0.15s;
}

.bulk-assign__table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.bulk-assign__table tbody tr.bulk-assign__row--selected {
    background: rgba(34, 197, 94, 0.08);
}

.bulk-assign__table td {
    color: var(--text-secondary);
}

.bulk-assign__checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.bulk-assign__table input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.bulk-assign__moze-select {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-soft);
    border-radius: 5px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 140px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.bulk-assign__moze-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.bulk-assign__moze-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bulk-assign__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-soft);
}

.bulk-assign__pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bulk-assign__page-btn {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border-soft);
    border-radius: 5px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.bulk-assign__page-btn:hover:not(:disabled) {
    background: var(--bg-subtle);
    border-color: var(--accent-primary);
}

.bulk-assign__page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bulk-assign__page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

.bulk-assign__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bulk-assign__selection-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.bulk-assign__save-btn {
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bulk-assign__save-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
}

.bulk-assign__save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.bulk-assign__empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Bulk Assign Loader Overlay */
.bulk-assign__loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.bulk-assign__loader-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: bulk-spin 0.8s linear infinite;
}

@keyframes bulk-spin {
    to { transform: rotate(360deg); }
}

.bulk-assign__loader-text {
    margin-top: 1.25rem;
    font-size: 1.1rem;
    color: #fff;
    font-weight: 500;
    letter-spacing: 0.02em;
}
