/* ==========================================================================
   Design Tokens - Bank Style Design System
   ========================================================================== */

/* Light Theme (Default) */
:root {
    /* Brand Colors */
    --color-brand-primary: #003A8F;
    --color-brand-primary-dark: #002A6E;
    --color-brand-primary-light: #1A5FD1;
    --color-brand-secondary: #2F80ED;

    /* Background Colors */
    --color-bg-primary: #FFFFFF;
    --color-bg-secondary: #F4F7FB;
    --color-bg-tertiary: #EDF2F7;
    --color-bg-card: #F9FBFF;
    --color-bg-inverse: #0B1F44;

    /* Text Colors */
    --color-text-primary: #0B1F44;
    --color-text-secondary: #5B6B82;
    --color-text-muted: #9AA8BC;
    --color-text-inverse: #FFFFFF;

    /* State Colors */
    --color-success: #1DB954;
    --color-success-soft: #E8F7EF;
    --color-warning: #F2C94C;
    --color-warning-soft: #FFF7E0;
    --color-error: #EB5757;
    --color-error-soft: #FDECEC;

    /* Admin Panel Colors */
    --success-color: #1DB954;
    --success-hover: #17a34a;
    --success-rgb: 29, 185, 84;
    --danger-color: #EB5757;
    --danger-hover: #d64545;
    --danger-rgb: 235, 87, 87;

    /* CTA Colors */
    --color-cta: #005BFF;
    --color-cta-hover: #0047CC;
    --color-cta-disabled: #A8C2F5;

    /* Aliases for convenience */
    --color-primary: var(--color-brand-primary);
    --color-primary-alpha: rgba(0, 58, 143, 0.1);
    --color-text: var(--color-text-primary);

    /* Border & Shadow */
    --color-border: #E1E8F0;
    --shadow-sm: 0 1px 3px rgba(11, 31, 68, 0.06);
    --shadow-md: 0 4px 12px rgba(11, 31, 68, 0.08);
    --shadow-lg: 0 8px 24px rgba(11, 31, 68, 0.12);

    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Layout */
    --header-height: 64px;
    --footer-height: 72px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* Icon filter for dark theme compatibility */
    --icon-filter: none;
}

/* Dark Theme */
[data-theme="dark"] {
    --color-brand-primary: #1A5FD1;
    --color-brand-primary-dark: #0047CC;
    --color-brand-primary-light: #56CCF2;
    --color-brand-secondary: #56CCF2;

    --color-bg-primary: #0B1F44;
    --color-bg-secondary: #08162F;
    --color-bg-tertiary: #0D2345;
    --color-bg-card: #102B55;
    --color-bg-inverse: #FFFFFF;

    --color-text-primary: #FFFFFF;
    --color-text-secondary: #C7D3E3;
    --color-text-muted: #8FA3C1;
    --color-text-inverse: #0B1F44;

    --color-success: #27AE60;
    --color-success-soft: #1A3D2B;
    --color-warning: #F2C94C;
    --color-warning-soft: #3D3520;
    --color-error: #EB5757;
    --color-error-soft: #3D1F1F;

    /* Admin Panel Colors (Dark Theme) */
    --success-color: #27AE60;
    --success-hover: #219653;
    --success-rgb: 39, 174, 96;
    --danger-color: #EB5757;
    --danger-hover: #d64545;
    --danger-rgb: 235, 87, 87;

    --color-cta: #2F80ED;
    --color-cta-hover: #1A5FD1;
    --color-cta-disabled: #3D5A80;

    /* Aliases for convenience */
    --color-primary: var(--color-brand-primary);
    --color-primary-alpha: rgba(26, 95, 209, 0.2);
    --color-text: var(--color-text-primary);

    --color-border: #1E3A5F;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);

    /* Icon filter to invert dark icons to white */
    --icon-filter: invert(1);
}

/* Themed icons - invert in dark mode */
.themed-icon {
    filter: var(--icon-filter);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding-bottom: calc(var(--footer-height) + var(--safe-area-bottom) + 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Header with Logo
   ========================================================================== */

.header {
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    gap: 12px;
}

.header-brand {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header-back-btn:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

/* Logo */
.header-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.header-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.header-tenant-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

.header-tenant-initials {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--color-brand-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    text-align: right;
    white-space: nowrap;
}

.header-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.header-logout-btn:hover {
    background: var(--color-bg-tertiary);
}

.header-logout-btn img {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

/* Organization Dropdown */
.org-dropdown {
    position: relative;
}

.org-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    max-width: 200px;
}

.org-dropdown-trigger:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
}

.org-dropdown.open .org-dropdown-trigger {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-alpha);
}

.org-dropdown-label {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.org-dropdown-arrow {
    flex-shrink: 0;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.org-dropdown.open .org-dropdown-arrow {
    transform: rotate(180deg);
}

.org-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    max-width: 280px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    overflow: hidden;
}

/* In Telegram Mini App, align dropdown to right edge */
.tg-mini-app .org-dropdown-menu {
    left: auto;
    right: 0;
    transform: none;
}

.org-dropdown-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
}

.org-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--color-text);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.org-dropdown-item:hover {
    background: var(--color-bg-secondary);
}

.org-dropdown-item.active {
    background: var(--color-primary-alpha);
    color: var(--color-primary);
}

.org-dropdown-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    overflow: hidden;
}

.org-dropdown-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.org-dropdown-item.active .org-dropdown-item-icon {
    background: var(--color-primary);
    color: white;
}

.org-dropdown-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.org-dropdown-item-check {
    flex-shrink: 0;
    opacity: 0;
}

.org-dropdown-item.active .org-dropdown-item-check {
    opacity: 1;
    color: var(--color-primary);
}

.org-dropdown-item.banned {
    opacity: 0.7;
}

.org-dropdown-item.banned .org-dropdown-item-icon {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.org-dropdown-item.banned.active .org-dropdown-item-icon {
    background: var(--color-error);
    color: white;
}

.org-dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

.org-dropdown-add {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    font-size: 0.875rem;
    color: var(--color-primary);
    text-decoration: none;
    transition: background 0.15s ease;
}

.org-dropdown-add:hover {
    background: var(--color-bg-secondary);
}

.org-dropdown-add svg {
    flex-shrink: 0;
}

.header-logout-btn:hover img {
    opacity: 1;
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main-content {
    flex: 1;
    padding: 20px 16px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Bottom Navigation (Mobile Style)
   ========================================================================== */

.nav-tabs {
    display: flex !important;
    flex-direction: row !important;
    background: var(--color-bg-primary);
    border-top: 1px solid var(--color-border);
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    padding-bottom: var(--safe-area-bottom);
    box-shadow: 0 -2px 12px rgba(11, 31, 68, 0.08);
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
    position: relative;
    min-height: 56px;
}

.nav-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--color-brand-primary);
    border-radius: 0 0 3px 3px;
    transition: var(--transition-fast);
}

.nav-tab:hover {
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
}

.nav-tab:active {
    transform: scale(0.95);
}

.nav-tab.active {
    color: var(--color-brand-primary);
}

.nav-tab.active::before {
    width: 32px;
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon img {
    width: 100%;
    height: 100%;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.nav-tab:hover .nav-icon img,
.nav-tab.active .nav-icon img {
    opacity: 1;
}

/* Light theme: show outlined icons, hide filled */
.nav-icon .icon-dark {
    display: none;
}

.nav-icon .icon-light {
    display: block;
}

/* Dark theme: show filled icons (inverted), hide outlined */
[data-theme="dark"] .nav-icon .icon-light {
    display: none;
}

[data-theme="dark"] .nav-icon .icon-dark {
    display: block;
    filter: invert(1);
}

.nav-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */

.section-header {
    margin-bottom: 16px;
}

.section-header.with-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header.with-toggle h2 {
    margin-bottom: 0;
}

.section-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card-list {
    margin-bottom: 28px;
}

.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-brand-secondary);
}

/* Today's duty card - highlighted with primary color */
.card.card-today {
    border-left: 4px solid var(--color-brand-primary);
    background: linear-gradient(90deg, rgba(0, 58, 143, 0.05) 0%, var(--color-bg-card) 100%);
}

[data-theme="dark"] .card.card-today {
    background: linear-gradient(90deg, rgba(26, 95, 209, 0.1) 0%, var(--color-bg-card) 100%);
}

/* Tomorrow's duty card - highlighted with secondary color */
.card.card-tomorrow {
    border-left: 4px solid var(--color-brand-secondary);
    background: linear-gradient(90deg, rgba(47, 128, 237, 0.05) 0%, var(--color-bg-card) 100%);
}

[data-theme="dark"] .card.card-tomorrow {
    background: linear-gradient(90deg, rgba(47, 128, 237, 0.08) 0%, var(--color-bg-card) 100%);
}

/* Date badge for today/tomorrow cards */
.card-date-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

.card-date-badge.badge-today {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.card-date-badge.badge-tomorrow {
    background: var(--color-brand-secondary);
    color: var(--color-text-inverse);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.btn-icon-small {
    width: 24px;
    height: 24px;
    padding: 3px;
    flex-shrink: 0;
}

.btn-icon-small svg {
    width: 16px;
    height: 16px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.3;
}

.card-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-requested {
    background: var(--color-warning-soft);
    color: #B8860B;
}

[data-theme="dark"] .badge-requested {
    color: var(--color-warning);
}

.badge-assigned {
    background: rgba(5, 150, 105, 0.15);
    color: #047857;
}

[data-theme="dark"] .badge-assigned {
    background: rgba(5, 150, 105, 0.25);
    color: #10B981;
}

.badge-closed {
    background: var(--color-bg-secondary);
    color: var(--color-text-muted);
}

.badge-awaiting_feedback {
    background: rgba(147, 51, 234, 0.15);
    color: #7C3AED;
}

[data-theme="dark"] .badge-awaiting_feedback {
    background: rgba(147, 51, 234, 0.25);
    color: #A78BFA;
}

.badge-feedback_received {
    background: rgba(139, 92, 246, 0.15);
    color: #6D28D9;
}

[data-theme="dark"] .badge-feedback_received {
    background: rgba(139, 92, 246, 0.25);
    color: #C4B5FD;
}

.badge-cancelled {
    background: rgba(127, 29, 29, 0.15);
    color: #7F1D1D;
}

[data-theme="dark"] .badge-cancelled {
    background: rgba(127, 29, 29, 0.35);
    color: #FCA5A5;
}

.card-body {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.card-row {
    display: flex;
    margin-bottom: 6px;
    line-height: 1.4;
    padding: 4px 6px;
    border-radius: 4px;
    margin-left: -6px;
    margin-right: -6px;
}

.card-row.highlight-row {
    background: var(--color-success-soft);
    border: 1px solid var(--color-success);
}

.card-label {
    color: var(--color-text-muted);
    min-width: 90px;
    flex-shrink: 0;
}

.card-value {
    color: var(--color-text-primary);
    word-break: break-word;
}

.card-id {
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--color-brand-primary);
    background: var(--color-bg-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 10px;
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.card-id:hover {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-brand-primary);
}

.card-id:active {
    transform: scale(0.95);
}

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

.card-footer .card-id {
    margin-top: 0;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* Username links */
.username-link {
    color: var(--color-brand-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.username-link:hover {
    color: var(--color-cta-hover);
    text-decoration: underline;
}

.username-link:active {
    opacity: 0.7;
}

/* ==========================================================================
   Loading & Empty States
   ========================================================================== */

.loading, .empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* ==========================================================================
   Action Grid
   ========================================================================== */

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.action-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
}

.action-card:hover {
    border-color: var(--color-brand-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.action-card:active {
    transform: translateY(0) scale(0.98);
}

.action-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon img {
    width: 100%;
    height: 100%;
}

/* Light theme: show outlined icons, hide filled */
.action-icon .icon-dark {
    display: none;
}

.action-icon .icon-light {
    display: block;
}

/* Dark theme: show filled icons (inverted), hide outlined */
[data-theme="dark"] .action-icon .icon-light {
    display: none;
}

[data-theme="dark"] .action-icon .icon-dark {
    display: block;
    filter: invert(1);
}

.action-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.action-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 4px;
    line-height: 1.3;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.action-form {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    margin-top: 20px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.action-form.hidden {
    display: none;
}

.action-form h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--color-text-primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.input-field {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    transition: var(--transition-fast);
}

.input-field:focus {
    outline: none;
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 3px rgba(0, 58, 143, 0.12);
}

[data-theme="dark"] .input-field:focus {
    box-shadow: 0 0 0 3px rgba(26, 95, 209, 0.2);
}

.input-field::placeholder {
    color: var(--color-text-muted);
}

textarea.input-field {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9375rem;
}

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

/* Multi-assignment form styles */
.form-divider-light {
    height: 1px;
    background: var(--color-border);
    margin: 16px 0;
}

.assignment-add-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.assignment-add-fields {
    flex: 1;
    display: flex;
    gap: 12px;
}

.assignment-add-fields .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group.compact {
    margin-bottom: 0;
}

.form-group.compact label {
    font-size: 0.75rem;
    margin-bottom: 4px;
    display: block;
    color: var(--color-text-secondary);
}

.form-group.compact .input-field {
    padding: 10px 12px;
    font-size: 0.875rem;
}

.btn-icon-round {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon-round.btn-primary {
    background: var(--color-brand-primary);
    color: white;
}

.btn-icon-round.btn-primary:hover {
    background: var(--color-brand-primary-dark);
    transform: scale(1.05);
}

.btn-icon-round.btn-primary:active {
    transform: scale(0.95);
}

.btn-icon-round svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.assignments-list {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-height: 60px;
    max-height: 200px;
    overflow-y: auto;
}

.assignments-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.assignment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}

.assignment-item:last-child {
    border-bottom: none;
}

.assignment-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.assignment-item-role {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-brand-primary);
    background: var(--color-primary-alpha);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.assignment-item-user {
    font-size: 0.875rem;
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.assignment-item-remove {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.15s ease;
    padding: 0;
}

.assignment-item-remove:hover {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.assignment-item-remove svg {
    width: 14px;
    height: 14px;
}

/* Tag Input with Bubbles (for team management) */
.role-assignment-group {
    margin-bottom: 16px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px;
}

.role-assignment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.role-assignment-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.role-assignment-badge {
    font-size: 0.75rem;
    background: var(--color-primary-alpha);
    color: var(--color-brand-primary);
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: auto;
}

.role-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.role-remove-btn:hover {
    opacity: 1;
    color: var(--color-text-danger);
    background: var(--color-danger-alpha);
}

.tag-input-container {
    position: relative;
}

.tag-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    min-height: 42px;
    cursor: text;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tag-input-wrapper:focus-within {
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 3px var(--color-primary-alpha);
}

.tag-bubble {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-brand-primary);
    color: white;
    padding: 4px 8px 4px 10px;
    border-radius: 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    animation: tagAppear 0.2s ease;
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tag-bubble-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
}

.tag-bubble-remove:hover {
    background: rgba(255, 255, 255, 0.4);
}

.tag-bubble-remove svg {
    width: 10px;
    height: 10px;
    stroke: white;
    stroke-width: 2.5;
}

.tag-input-field {
    flex: 1;
    min-width: 120px;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    padding: 4px 0;
}

.tag-input-field::placeholder {
    color: var(--color-text-muted);
}

.tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
    display: none;
}

.tag-dropdown.visible {
    display: block;
}

.tag-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.1s ease;
}

.tag-dropdown-item:hover,
.tag-dropdown-item.highlighted {
    background: var(--color-bg-tertiary);
}

.tag-dropdown-item-username {
    font-weight: 500;
}

.tag-dropdown-item-name {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

.tag-dropdown-empty {
    padding: 12px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* Add new role section */
.add-role-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--color-border);
}

.add-role-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--color-bg-secondary);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.add-role-btn:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
}

.add-role-btn svg {
    width: 18px;
    height: 18px;
}

/* Manage Team Drawer */
.team-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* All scrollable content in team drawer */
.team-drawer-content .team-drawer-window-info,
.team-drawer-content .team-drawer-roles,
.team-drawer-content .add-role-section,
.team-drawer-content #teamForceGroup {
    flex-shrink: 0;
}

.team-drawer-window-info {
    background: var(--color-bg-secondary);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.team-drawer-window-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.team-drawer-window-id {
    font-family: monospace;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-brand-primary);
}

.team-drawer-window-details {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Small text button */
.btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease, background 0.15s ease;
}

.btn-text:hover {
    color: var(--color-brand-primary);
    background: var(--color-primary-alpha);
}

.team-drawer-roles {
    /* Roles scroll with the rest of content */
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--color-cta);
    color: var(--color-text-inverse);
}

.btn-primary:hover {
    background: var(--color-cta-hover);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-primary:disabled {
    background: var(--color-cta-disabled);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-border);
    border-color: var(--color-text-muted);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-danger-outline {
    background: transparent;
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.btn-danger-outline:hover {
    background: var(--color-error-soft);
    border-color: var(--color-error);
}

.btn-danger-outline:active {
    transform: scale(0.97);
}

.delete-profile-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px 16px;
    font-size: 0.875rem;
}

/* Stored data tooltip styles */
.stored-data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.8125rem;
}

.stored-data-table td {
    padding: 4px 0;
    border-bottom: 1px solid var(--color-border);
}

.stored-data-table td:first-child {
    color: var(--color-text-muted);
    width: 40%;
}

.stored-data-table td:last-child {
    color: var(--color-text-primary);
    word-break: break-all;
}

.stored-data-table code {
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Consolas, monospace;
    font-size: 0.75rem;
    background: var(--color-bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.stored-data-table em {
    color: var(--color-text-muted);
    font-style: italic;
}

.stored-data-counts {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin: 8px 0 4px;
}

.stored-data-access {
    font-size: 0.75rem;
    color: var(--color-success);
    margin: 4px 0;
}

.stored-data-note {
    font-size: 0.8125rem;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed var(--color-border);
}

.stored-data-related {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin: 4px 0 8px 16px;
    padding: 0;
}

.stored-data-related li {
    margin: 2px 0;
}

.stored-data-warning {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 8px;
}

/* Confirmation popup */
.confirm-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.confirm-popup-content {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.confirm-popup-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.confirm-popup-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.confirm-popup-message {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-popup-actions .btn {
    flex: 1;
    max-width: 120px;
}

.btn-danger {
    background: var(--color-error);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-secondary {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-tertiary);
}

/* ==========================================================================
   Settings
   ========================================================================== */

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-item {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.settings-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 14px;
}

.settings-label-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.settings-label-with-action .settings-label {
    margin-bottom: 0;
}

.settings-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.settings-action-btn:hover {
    border-color: var(--color-brand-primary);
    background: var(--color-bg-secondary);
}

.settings-action-btn:active {
    transform: scale(0.95);
}

.settings-action-btn img {
    width: 18px;
    height: 18px;
}

[data-theme="dark"] .settings-action-btn img {
    filter: invert(1);
}

.settings-action-btn.loading img {
    animation: spin 1s linear infinite;
}

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

/* Feedback form */
.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feedback-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    font-size: 0.875rem;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    resize: vertical;
    transition: var(--transition-fast);
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-brand-primary-rgb), 0.1);
}

.feedback-textarea::placeholder {
    color: var(--color-text-muted);
}

.feedback-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-actions .btn {
    width: auto;
}

.feedback-counter {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.theme-switch {
    display: flex;
    gap: 8px;
}

.theme-btn {
    flex: 1;
    padding: 12px 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.theme-btn:hover {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
}

.theme-btn.active {
    background: var(--color-brand-primary);
    border-color: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.user-info-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid var(--color-border);
}

.user-info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.user-info-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.user-info-value {
    color: var(--color-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==========================================================================
   Help List
   ========================================================================== */

.help-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help-item {
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.help-item summary {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text-primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
}

.help-item summary:hover {
    background: var(--color-bg-secondary);
}

.help-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--color-text-muted);
    font-weight: 300;
}

.help-item[open] summary::after {
    content: '−';
}

.help-item ul {
    padding: 0 16px 14px;
    list-style: none;
}

.help-item li {
    padding: 8px 0;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}

.help-item li:last-child {
    border-bottom: none;
}

.help-item code {
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Consolas, monospace;
    font-size: 0.8125rem;
    background: var(--color-bg-secondary);
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--color-brand-primary);
    border: 1px solid var(--color-border);
}

/* ==========================================================================
   About Block (Collapsible)
   ========================================================================== */

.about-block {
    background: var(--color-bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.about-header {
    padding: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
    list-style: none;
}

.about-header::-webkit-details-marker {
    display: none;
}

.about-header:hover {
    background: var(--color-bg-secondary);
}

.about-toggle::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--color-text-muted);
    font-weight: 300;
}

.about-block[open] .about-toggle::after {
    content: '−';
}

.about-content {
    padding: 0 16px 16px;
    border-top: 1px solid var(--color-border);
}

.about-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.about-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.about-section:first-child {
    padding-top: 16px;
}

.about-description {
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    line-height: 1.6;
}

.about-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.about-section p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.about-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.about-features li {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    padding: 6px 0 6px 20px;
    position: relative;
}

.about-features li::before {
    content: '•';
    position: absolute;
    left: 4px;
    color: var(--color-brand-primary);
    font-weight: bold;
}

.about-version {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.about-version-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.about-version-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Consolas, monospace;
}

.about-legal p {
    margin-bottom: 8px;
}

.about-legal p:last-child {
    margin-bottom: 0;
}

.about-contact {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px dashed var(--color-border);
}

.about-contact a {
    color: var(--color-brand-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.about-contact a:hover {
    text-decoration: underline;
}

/* Glass theme support for About Block */
[data-style="glass"] .about-block {
    background: var(--glass-bg-subtle);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border-subtle);
}

[data-style="glass"] .about-header:hover {
    background: var(--glass-bg);
}

[data-style="glass"] .about-header,
[data-style="glass"] .about-description,
[data-style="glass"] .about-version-value {
    color: #ffffff;
}

[data-style="glass"] .about-section-title,
[data-style="glass"] .about-section p,
[data-style="glass"] .about-features li,
[data-style="glass"] .about-version-label {
    color: rgba(255, 255, 255, 0.85);
}

[data-style="glass"] .about-content {
    border-top-color: var(--glass-border-subtle);
}

[data-style="glass"] .about-section {
    border-bottom-color: var(--glass-border-subtle);
}

[data-style="glass"] .about-contact {
    border-top-color: var(--glass-border-subtle);
}

[data-style="glass"] .about-contact a {
    color: var(--color-brand-secondary);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-container {
    position: fixed;
    bottom: calc(var(--footer-height) + var(--safe-area-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000; /* Above drawer (9999) */
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: calc(100% - 32px);
    max-width: 400px;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    font-weight: 500;
}

.toast.success {
    background: var(--color-success-soft);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

.toast.error {
    background: var(--color-error-soft);
    border: 1px solid var(--color-error);
    color: var(--color-error);
}

.toast.info {
    background: var(--color-bg-card);
    border: 1px solid var(--color-brand-primary);
    color: var(--color-brand-primary);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-16px); }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 400px) {
    .action-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .header-user {
        display: none;
    }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .main-content {
        padding-bottom: 20px;
    }
}

/* ==========================================================================
   Access Denied / Not Registered States
   ========================================================================== */

.access-denied,
.not-registered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 24px;
    text-align: center;
    background: var(--color-bg-secondary);
}

.access-denied h1,
.not-registered h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.access-denied p,
.not-registered p {
    font-size: 1rem;
    color: var(--color-text-secondary);
    max-width: 320px;
    line-height: 1.5;
}

/* ==========================================================================
   Statistics Block
   ========================================================================== */

.stats-block {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    overflow: hidden;
}

.stats-header {
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    transition: var(--transition-fast);
    user-select: none;
}

.stats-header::-webkit-details-marker {
    display: none;
}

.stats-header:hover {
    background: var(--color-bg-secondary);
}

.stats-icon {
    font-size: 1.125rem;
}

.stats-toggle {
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.stats-toggle::after {
    content: '+';
    font-size: 1.25rem;
    font-weight: 300;
}

.stats-block[open] .stats-toggle::after {
    content: '−';
}

.stats-content {
    padding: 0 16px 16px;
    animation: fadeIn 0.25s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.stats-card.stats-total {
    background: linear-gradient(135deg, var(--color-brand-primary) 0%, var(--color-brand-primary-light) 100%);
    border: none;
    color: var(--color-text-inverse);
}

.stats-card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stats-card-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
    opacity: 0.9;
}

.stats-section {
    margin-bottom: 16px;
}

.stats-section:last-child {
    margin-bottom: 0;
}

.stats-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    padding-left: 2px;
}

.stats-list {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.stats-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.stats-list-item:last-child {
    border-bottom: none;
}

.stats-list-name {
    color: var(--color-text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.stats-list-name a {
    color: var(--color-brand-primary);
    text-decoration: none;
}

.stats-list-name a:hover {
    text-decoration: underline;
}

.stats-list-value {
    font-weight: 700;
    color: var(--color-brand-primary);
    background: var(--color-bg-secondary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8125rem;
    min-width: 36px;
    text-align: center;
    margin-left: 12px;
    flex-shrink: 0;
}

/* Style button (same as theme-btn) */
.style-btn {
    flex: 1;
    padding: 12px 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    color: #5B6B82;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.style-btn:hover {
    border-color: var(--color-brand-primary);
    color: var(--color-brand-primary);
}

.style-btn.active {
    background: var(--color-brand-primary);
    border-color: var(--color-brand-primary);
    color: #ffffff;
}

[data-theme="dark"] .style-btn {
    color: #C7D3E3;
}

[data-theme="dark"] .style-btn.active {
    color: #ffffff;
}

/* ==========================================================================
   Glass Theme (Glassmorphism / Liquid Glass)
   ========================================================================== */

/* Glass theme variables - Light */
[data-style="glass"] {
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-strong: rgba(255, 255, 255, 0.8);
    --glass-bg-subtle: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-border-subtle: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    --glass-shadow-lg: 0 12px 48px rgba(31, 38, 135, 0.2);
    --glass-blur: 16px;
    --glass-blur-strong: 24px;
    --glass-highlight: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.1) 100%);
}

/* Glass theme variables - Dark */
[data-theme="dark"][data-style="glass"] {
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-bg-strong: rgba(15, 23, 42, 0.85);
    --glass-bg-subtle: rgba(15, 23, 42, 0.5);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-border-subtle: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass-shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
    --glass-highlight: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
}

/* Glass background gradient */
[data-style="glass"] body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
}

[data-theme="dark"][data-style="glass"] body {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    background-attachment: fixed;
}

/* Glass App Container */
[data-style="glass"] #app {
    background: transparent;
}

/* Glass Text Colors - White text on colorful background */
[data-style="glass"] {
    --color-text-primary: #ffffff;
    --color-text-secondary: #f0f0f0;
    --color-text-muted: #d0d0d0;
}

[data-theme="dark"][data-style="glass"] {
    --color-text-primary: #ffffff;
    --color-text-secondary: #e8e8e8;
    --color-text-muted: #c0c0c0;
}

/* Glass - ensure white text everywhere */
[data-style="glass"] .header-title,
[data-style="glass"] .nav-label,
[data-style="glass"] .card-title,
[data-style="glass"] .card-value,
[data-style="glass"] .action-title,
[data-style="glass"] .settings-label,
[data-style="glass"] .section-header h2,
[data-style="glass"] .stats-section-title,
[data-style="glass"] .stats-list-name,
[data-style="glass"] .user-info-value,
[data-style="glass"] .help-item summary,
[data-style="glass"] .action-form h3 {
    color: #ffffff;
}

[data-style="glass"] .card-label,
[data-style="glass"] .action-desc,
[data-style="glass"] .user-info-label,
[data-style="glass"] .header-user {
    color: rgba(255, 255, 255, 0.8);
}

[data-style="glass"] .card-id {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-style="glass"] .username-link {
    color: #7dd3fc;
    text-decoration: none;
}

[data-style="glass"] .username-link:hover {
    color: #38bdf8;
    text-decoration: underline;
}

[data-style="glass"] .btn-primary,
[data-style="glass"] .btn-secondary {
    color: #ffffff;
}

[data-style="glass"] .input-field {
    color: #ffffff;
}

[data-style="glass"] .input-field::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

[data-style="glass"] .stats-card-value,
[data-style="glass"] .stats-card-label {
    color: #ffffff;
}

[data-style="glass"] .stats-list-value {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.25);
}

[data-style="glass"] .help-item li,
[data-style="glass"] .help-item code {
    color: #ffffff;
}

[data-style="glass"] .help-item code {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

[data-style="glass"] .form-group label {
    color: #ffffff;
}

[data-style="glass"] .checkbox-label {
    color: #ffffff;
}

/* Glass Header */
[data-style="glass"] .header {
    background: rgba(128, 128, 128, 0.35);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"][data-style="glass"] .header {
    background: rgba(60, 60, 60, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-style="glass"] .header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0) 100%);
}

/* Glass Navigation - Floating */
[data-style="glass"] .nav-tabs {
    background: rgba(128, 128, 128, 0.4);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    left: 16px !important;
    right: 16px !important;
    bottom: calc(12px + var(--safe-area-bottom)) !important;
    max-width: 400px;
    margin: 0 auto;
}

[data-theme="dark"][data-style="glass"] .nav-tabs {
    background: rgba(60, 60, 60, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-style="glass"] .nav-tab {
    background: transparent;
    border-radius: var(--radius-lg);
    margin: 4px;
}

[data-style="glass"] .nav-tab:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-style="glass"] .nav-tab.active {
    background: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"][data-style="glass"] .nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"][data-style="glass"] .nav-tab.active {
    background: rgba(255, 255, 255, 0.15);
}

/* Glass Cards */
[data-style="glass"] .card {
    background: rgba(128, 128, 128, 0.3);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"][data-style="glass"] .card {
    background: rgba(60, 60, 60, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-style="glass"] .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
}

[data-style="glass"] .card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* Glass Action Cards */
[data-style="glass"] .action-card {
    background: rgba(128, 128, 128, 0.3);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"][data-style="glass"] .action-card {
    background: rgba(60, 60, 60, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-style="glass"] .action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
}

[data-style="glass"] .action-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-4px);
}

/* Glass Forms */
[data-style="glass"] .action-form {
    background: rgba(128, 128, 128, 0.35);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"][data-style="glass"] .action-form {
    background: rgba(60, 60, 60, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-style="glass"] .input-field {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

[data-style="glass"] .input-field option {
    background: #4a4a6a;
    color: #ffffff;
}

[data-theme="dark"][data-style="glass"] .input-field {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-theme="dark"][data-style="glass"] .input-field option {
    background: #2a2a3a;
    color: #ffffff;
}

[data-style="glass"] .input-field:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* Glass Buttons */
[data-style="glass"] .btn-primary {
    background: rgba(128, 128, 128, 0.4);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    color: var(--color-text-primary);
}

[data-style="glass"] .btn-primary:hover {
    background: rgba(128, 128, 128, 0.55);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

[data-style="glass"] .btn-secondary {
    background: rgba(128, 128, 128, 0.3);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

[data-style="glass"] .btn-secondary:hover {
    background: rgba(128, 128, 128, 0.45);
}

[data-theme="dark"][data-style="glass"] .btn-primary {
    background: rgba(80, 80, 80, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

[data-theme="dark"][data-style="glass"] .btn-primary:hover {
    background: rgba(80, 80, 80, 0.65);
}

[data-theme="dark"][data-style="glass"] .btn-secondary {
    background: rgba(60, 60, 60, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"][data-style="glass"] .btn-secondary:hover {
    background: rgba(60, 60, 60, 0.55);
}

[data-style="glass"] .btn-danger-outline {
    background: rgba(235, 87, 87, 0.1);
    border-color: rgba(235, 87, 87, 0.6);
    color: #ff6b6b;
}

[data-style="glass"] .btn-danger-outline:hover {
    background: rgba(235, 87, 87, 0.25);
}

/* Glass Settings */
[data-style="glass"] .settings-item {
    background: rgba(128, 128, 128, 0.3);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"][data-style="glass"] .settings-item {
    background: rgba(60, 60, 60, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-style="glass"] .theme-btn,
[data-style="glass"] .style-btn {
    background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: var(--color-text-primary);
}

[data-style="glass"] .theme-btn:hover,
[data-style="glass"] .style-btn:hover {
    background: rgba(0, 0, 0, 0.12);
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--color-text-primary);
}

[data-style="glass"] .theme-btn.active,
[data-style="glass"] .style-btn.active {
    background: var(--color-brand-primary);
    border: 1px solid var(--color-brand-primary);
    color: #ffffff;
}

[data-theme="dark"][data-style="glass"] .theme-btn,
[data-theme="dark"][data-style="glass"] .style-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-theme="dark"][data-style="glass"] .theme-btn:hover,
[data-theme="dark"][data-style="glass"] .style-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-theme="dark"][data-style="glass"] .theme-btn.active,
[data-theme="dark"][data-style="glass"] .style-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

[data-style="glass"] .user-info-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

[data-style="glass"] .user-info-row {
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

[data-style="glass"] .user-info-label {
    color: rgba(255, 255, 255, 0.85);
}

[data-style="glass"] .user-info-value {
    color: #ffffff;
}

/* Glass Help List */
[data-style="glass"] .help-item {
    background: var(--glass-bg-subtle);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border-subtle);
}

[data-style="glass"] .help-item summary:hover {
    background: var(--glass-bg);
}

/* Glass Statistics */
[data-style="glass"] .stats-block {
    background: rgba(0, 30, 70, 0.45);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"][data-style="glass"] .stats-block {
    background: rgba(50, 50, 50, 0.5);
}

[data-style="glass"] .stats-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-style="glass"] .stats-card {
    background: rgba(0, 25, 60, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

[data-theme="dark"][data-style="glass"] .stats-card {
    background: rgba(50, 50, 50, 0.55);
}

[data-style="glass"] .stats-card.stats-total {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8) 0%, rgba(118, 75, 162, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

[data-style="glass"] .stats-list {
    background: rgba(0, 25, 60, 0.5);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

[data-theme="dark"][data-style="glass"] .stats-list {
    background: rgba(50, 50, 50, 0.55);
}

[data-style="glass"] .stats-list-item {
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

[data-style="glass"] .stats-list-name {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .stats-section-title {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .stats-list-value {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Glass Toast */
[data-style="glass"] .toast {
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

[data-style="glass"] .toast.success {
    background: rgba(29, 185, 84, 0.2);
    border: 1px solid rgba(29, 185, 84, 0.4);
}

[data-style="glass"] .toast.error {
    background: rgba(235, 87, 87, 0.2);
    border: 1px solid rgba(235, 87, 87, 0.4);
}

[data-style="glass"] .toast.info {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

/* Glass Card ID */
[data-style="glass"] .card-id {
    background: var(--glass-bg-subtle);
    border: 1px solid var(--glass-border-subtle);
}

[data-style="glass"] .card-id:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.5);
}

/* Glass Badges */
[data-style="glass"] .card-badge {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-style="glass"] .badge-requested {
    background: rgba(242, 201, 76, 0.35);
    border: 1px solid rgba(242, 201, 76, 0.6);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .badge-assigned {
    background: rgba(29, 185, 84, 0.2);
    border: 1px solid rgba(29, 185, 84, 0.4);
}

[data-style="glass"] .badge-closed {
    background: var(--glass-bg-subtle);
    border: 1px solid var(--glass-border-subtle);
}

[data-style="glass"] .badge-awaiting_feedback {
    background: rgba(147, 51, 234, 0.3);
    border: 1px solid rgba(147, 51, 234, 0.5);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .badge-feedback_received {
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid rgba(139, 92, 246, 0.5);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .badge-cancelled {
    background: rgba(127, 29, 29, 0.4);
    border: 1px solid rgba(127, 29, 29, 0.6);
    color: #FCA5A5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Glass highlight rows */
[data-style="glass"] .card-row.highlight-row {
    background: rgba(29, 185, 84, 0.15);
    border: 1px solid rgba(29, 185, 84, 0.3);
}

/* Smooth transitions for theme switching */
[data-style="glass"] * {
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================================================
   Calendar Styles - Apple-style minimal design
   ========================================================================== */

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.view-btn {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: calc(var(--radius-sm) - 2px);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn:hover {
    color: var(--color-text-primary);
}

.view-btn.active {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Calendar Container - Apple style */
.calendar-container {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--color-border);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendar-nav-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--color-brand-primary);
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 300;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav-btn:hover {
    background: var(--color-bg-secondary);
}

.calendar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
    min-width: 140px;
    text-align: center;
}

.calendar-view-toggle {
    display: flex;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.calendar-view-btn {
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: calc(var(--radius-sm) - 2px);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.calendar-view-btn:hover {
    color: var(--color-text-primary);
}

.calendar-view-btn.active {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Calendar Grid - Month View - Apple style compact */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-weekday {
    text-align: center;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--color-text-muted);
    padding: 2px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 1px;
    height: 28px;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day:not(.empty):not(.today):not(.selected):hover .day-number {
    background: var(--color-bg-secondary);
}

.calendar-day.today .day-number {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.calendar-day.selected .day-number {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-day.selected:hover .day-number {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-day.today:hover .day-number {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.day-number {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--color-text-primary);
    border-radius: 50%;
    transition: all var(--transition-fast);
    position: relative;
}

/* Duty indicator - circle AROUND the date */
.calendar-day.has-duty.duty-assigned .day-number {
    box-shadow: inset 0 0 0 2px var(--color-success);
}

.calendar-day.has-duty.duty-owner .day-number {
    box-shadow: inset 0 0 0 2px var(--color-brand-secondary);
}

.calendar-day.has-duty.duty-both .day-number {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success) 50%, var(--color-brand-secondary) 50%, var(--color-brand-secondary) 100%);
    color: white;
}

/* Schedule calendar indicators */
.calendar-day.has-duty.duty-requested .day-number {
    box-shadow: inset 0 0 0 2px var(--color-warning);
}

.calendar-day.has-duty.duty-voting .day-number {
    box-shadow: inset 0 0 0 2px #3B82F6;
}

.calendar-day.has-duty.duty-voting-completed .day-number {
    box-shadow: inset 0 0 0 2px #6EE7B7;
}

.calendar-day.has-duty.duty-voting-expired .day-number {
    box-shadow: inset 0 0 0 2px #F59E0B;
}

.calendar-day.has-duty.duty-closed .day-number {
    box-shadow: inset 0 0 0 2px var(--color-text-muted);
}

.calendar-day.has-duty.duty-feedback .day-number {
    box-shadow: inset 0 0 0 2px #7C3AED;
}

.calendar-day.has-duty.duty-cancelled .day-number {
    box-shadow: inset 0 0 0 2px #7F1D1D;
}

/* Proportional border for Dashboard calendar (owner + assigned) */
.calendar-day.has-duty.duty-proportional .day-number {
    position: relative;
}

/* Selected date with proportional border */
.calendar-day.selected.has-duty.duty-proportional .day-number {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-day.selected.has-duty.duty-schedule-proportional .day-number {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-day.has-duty.duty-proportional .day-number::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(
        var(--color-success) 0% var(--assigned-pct, 50%),
        var(--color-brand-secondary) var(--assigned-pct, 50%) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* Proportional border for Schedule calendar (requested + assigned + closed) */
.calendar-day.has-duty.duty-schedule-proportional .day-number {
    position: relative;
    background: transparent;
}

.calendar-day.has-duty.duty-schedule-proportional .day-number::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(
        var(--color-warning) 0% var(--req-pct, 25%),
        var(--color-success) var(--req-pct, 25%) var(--assign-pct, 50%),
        #7C3AED var(--assign-pct, 50%) var(--feedback-pct, 75%),
        var(--color-text-muted) var(--feedback-pct, 75%) var(--closed-pct, 100%),
        #7F1D1D var(--closed-pct, 100%) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* Week view proportional borders */
.calendar-week-day.has-duty.duty-proportional .week-day-date {
    position: relative;
}

/* Selected date with proportional border - week view */
.calendar-week-day.selected.has-duty.duty-proportional .week-day-date {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-week-day.selected.has-duty.duty-schedule-proportional .week-day-date {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-week-day.has-duty.duty-proportional .week-day-date::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(
        var(--color-success) 0% var(--assigned-pct, 50%),
        var(--color-brand-secondary) var(--assigned-pct, 50%) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.calendar-week-day.has-duty.duty-schedule-proportional .week-day-date {
    position: relative;
    background: transparent;
}

.calendar-week-day.has-duty.duty-schedule-proportional .week-day-date::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(
        var(--color-warning) 0% var(--req-pct, 25%),
        var(--color-success) var(--req-pct, 25%) var(--assign-pct, 50%),
        #7C3AED var(--assign-pct, 50%) var(--feedback-pct, 75%),
        var(--color-text-muted) var(--feedback-pct, 75%) var(--closed-pct, 100%),
        #7F1D1D var(--closed-pct, 100%) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* Override for today with duty */
.calendar-day.today.has-duty .day-number {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.calendar-day.today.has-duty.duty-assigned .day-number {
    box-shadow: 0 0 0 3px var(--color-bg-card), 0 0 0 5px var(--color-success);
}

.calendar-day.today.has-duty.duty-owner .day-number {
    box-shadow: 0 0 0 3px var(--color-bg-card), 0 0 0 5px var(--color-brand-secondary);
}

/* Today with proportional duty border */
.calendar-day.today.has-duty.duty-proportional .day-number {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
    isolation: isolate;
}

.calendar-day.today.has-duty.duty-proportional .day-number::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-success) 0% var(--assigned-pct, 50%),
        var(--color-brand-secondary) var(--assigned-pct, 50%) 100%
    );
    z-index: -1;
}

/* Today with schedule proportional border */
.calendar-day.today.has-duty.duty-schedule-proportional .day-number {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
    isolation: isolate;
}

.calendar-day.today.has-duty.duty-schedule-proportional .day-number::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-warning) 0% var(--req-pct, 33%),
        var(--color-success) var(--req-pct, 33%) var(--assign-pct, 66%),
        var(--color-text-muted) var(--assign-pct, 66%) 100%
    );
    z-index: -1;
}

/* Avatar on duty days */
.day-avatar {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--color-success);
    color: white;
    border-radius: 50%;
    font-size: 0.45rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-bg-card);
}

/* Hide old indicator divs */
.day-indicator {
    display: none;
}

/* Calendar Grid - Week View - Apple style compact */
.calendar-week-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-week-day {
    background: transparent;
    padding: 4px 2px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.calendar-week-day:not(.today):not(.selected):hover {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
}

.calendar-week-day.today .week-day-date {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.calendar-week-day.selected .week-day-date {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-week-day.selected:hover .week-day-date {
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
}

.calendar-week-day.today:hover .week-day-date {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

/* Week view duty circles */
.calendar-week-day.has-duty.duty-assigned .week-day-date {
    box-shadow: inset 0 0 0 2px var(--color-success);
}

.calendar-week-day.has-duty.duty-owner .week-day-date {
    box-shadow: inset 0 0 0 2px var(--color-brand-secondary);
}

.calendar-week-day.has-duty.duty-both .week-day-date {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success) 50%, var(--color-brand-secondary) 50%, var(--color-brand-secondary) 100%);
    color: white;
}

/* Schedule calendar week view indicators */
.calendar-week-day.has-duty.duty-requested .week-day-date {
    box-shadow: inset 0 0 0 2px var(--color-warning);
}

.calendar-week-day.has-duty.duty-voting .week-day-date {
    box-shadow: inset 0 0 0 2px #3B82F6;
}

.calendar-week-day.has-duty.duty-voting-completed .week-day-date {
    box-shadow: inset 0 0 0 2px #6EE7B7;
}

.calendar-week-day.has-duty.duty-voting-expired .week-day-date {
    box-shadow: inset 0 0 0 2px #F59E0B;
}

.calendar-week-day.has-duty.duty-closed .week-day-date {
    box-shadow: inset 0 0 0 2px var(--color-text-muted);
}

.calendar-week-day.has-duty.duty-feedback .week-day-date {
    box-shadow: inset 0 0 0 2px #7C3AED;
}

.calendar-week-day.has-duty.duty-cancelled .week-day-date {
    box-shadow: inset 0 0 0 2px #7F1D1D;
}

/* Week view today with proportional border */
.calendar-week-day.today.has-duty.duty-proportional .week-day-date {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
    isolation: isolate;
}

.calendar-week-day.today.has-duty.duty-proportional .week-day-date::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-success) 0% var(--assigned-pct, 50%),
        var(--color-brand-secondary) var(--assigned-pct, 50%) 100%
    );
    z-index: -1;
}

/* Week view today with schedule proportional border */
.calendar-week-day.today.has-duty.duty-schedule-proportional .week-day-date {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
    isolation: isolate;
}

.calendar-week-day.today.has-duty.duty-schedule-proportional .week-day-date::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-warning) 0% var(--req-pct, 33%),
        var(--color-success) var(--req-pct, 33%) var(--assign-pct, 66%),
        var(--color-text-muted) var(--assign-pct, 66%) 100%
    );
    z-index: -1;
}

.week-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.week-day-name {
    font-size: 0.55rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.week-day-date {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-primary);
    border-radius: 50%;
    transition: all var(--transition-fast);
    position: relative;
}

.week-day-content {
    margin-top: 2px;
}

.duty-count {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* Calendar Legend - minimal */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    color: var(--color-text-muted);
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    color: var(--color-text-primary);
}

.legend-dot.legend-assigned {
    box-shadow: inset 0 0 0 2px #047857;
}

.legend-dot.legend-owner {
    box-shadow: inset 0 0 0 2px var(--color-brand-secondary);
}

.legend-dot.legend-both {
    background: linear-gradient(135deg, var(--color-success) 0%, var(--color-success) 50%, var(--color-brand-secondary) 50%, var(--color-brand-secondary) 100%);
}

.legend-dot.legend-requested {
    box-shadow: inset 0 0 0 2px var(--color-warning);
}

.legend-dot.legend-closed {
    box-shadow: inset 0 0 0 2px var(--color-text-muted);
}

.legend-dot.legend-feedback {
    box-shadow: inset 0 0 0 2px #7C3AED;
}

.legend-dot.legend-cancelled {
    box-shadow: inset 0 0 0 2px #7F1D1D;
}

.legend-dot.legend-voting {
    box-shadow: inset 0 0 0 2px #3B82F6;
}

.legend-dot.legend-voting-completed {
    box-shadow: inset 0 0 0 2px #6EE7B7;
}

.legend-dot.legend-voting-expired {
    box-shadow: inset 0 0 0 2px #F59E0B;
}

/* Day Schedule */
.day-schedule {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.day-schedule-header {
    margin-bottom: 16px;
}

.day-schedule-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.day-schedule-slots {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Time Slot */
.time-slot {
    display: flex;
    gap: 12px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--color-border);
    align-items: flex-start;
}

.time-slot.role-assigned {
    border-left: 4px solid var(--color-success);
}

.time-slot.role-owner {
    border-left: 4px solid var(--color-brand-secondary);
}

.time-slot.role-both {
    border-left: 4px solid;
    border-image: linear-gradient(to bottom, var(--color-success) 50%, var(--color-brand-secondary) 50%) 1;
}

.time-slot-time {
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Consolas, monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary);
    background: var(--color-bg-card);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.time-slot-info {
    flex: 1;
    min-width: 0;
}

.time-slot-system {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.time-slot-desc {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
    word-break: break-word;
}

.time-slot-id {
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--color-brand-primary);
    background: var(--color-bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.time-slot-id:hover {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.time-slot-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

/* ==========================================================================
   Glass Theme - Calendar Styles
   ========================================================================== */

[data-style="glass"] .view-toggle {
    background: rgba(255, 255, 255, 0.15);
}

[data-style="glass"] .view-btn {
    color: rgba(255, 255, 255, 0.7);
}

[data-style="glass"] .view-btn:hover {
    color: #ffffff;
}

[data-style="glass"] .view-btn.active {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

[data-style="glass"] .calendar-container {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
}

[data-style="glass"] .calendar-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

[data-style="glass"] .calendar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

[data-style="glass"] .calendar-title {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .calendar-view-toggle {
    background: rgba(255, 255, 255, 0.15);
}

[data-style="glass"] .calendar-view-btn {
    color: rgba(255, 255, 255, 0.7);
}

[data-style="glass"] .calendar-view-btn:hover {
    color: #ffffff;
}

[data-style="glass"] .calendar-view-btn.active {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

[data-style="glass"] .calendar-weekday {
    color: rgba(255, 255, 255, 0.6);
}

[data-style="glass"] .calendar-day {
    background: rgba(255, 255, 255, 0.1);
}

[data-style="glass"] .calendar-day:not(.empty):hover {
    background: rgba(255, 255, 255, 0.25);
}

[data-style="glass"] .calendar-day.today {
    border-color: rgba(255, 255, 255, 0.6);
}

[data-style="glass"] .calendar-day.selected {
    background: rgba(255, 255, 255, 0.4);
}

[data-style="glass"] .calendar-day.has-duty {
    background: rgba(255, 255, 255, 0.2);
}

[data-style="glass"] .day-number {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .calendar-week-day {
    background: rgba(255, 255, 255, 0.1);
}

[data-style="glass"] .calendar-week-day:hover {
    background: rgba(255, 255, 255, 0.25);
}

[data-style="glass"] .calendar-week-day.selected {
    background: rgba(255, 255, 255, 0.4);
}

[data-style="glass"] .week-day-name {
    color: rgba(255, 255, 255, 0.6);
}

[data-style="glass"] .week-day-date {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .duty-count {
    color: rgba(255, 255, 255, 0.7);
}

[data-style="glass"] .calendar-legend {
    border-top-color: rgba(255, 255, 255, 0.2);
}

[data-style="glass"] .legend-item {
    color: rgba(255, 255, 255, 0.8);
}

[data-style="glass"] .day-schedule {
    border-top-color: rgba(255, 255, 255, 0.2);
}

[data-style="glass"] .day-schedule-header h3 {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .time-slot {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-style="glass"] .time-slot-time {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-style="glass"] .time-slot-system {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-style="glass"] .time-slot-desc {
    color: rgba(255, 255, 255, 0.8);
}

[data-style="glass"] .time-slot-id {
    background: rgba(255, 255, 255, 0.2);
    color: #7dd3fc;
}

[data-style="glass"] .time-slot-id:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

/* ==========================================================================
   Drawer Component
   ========================================================================== */

/* Drawer Backdrop */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* Drawer Container */
.drawer {
    position: fixed;
    right: -100%;
    top: 0;
    bottom: 0;
    width: 90%;
    max-width: 420px;
    background: var(--color-bg-primary);
    z-index: 10001;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--color-border);
}

[data-theme="dark"] .drawer {
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
}

.drawer.open {
    right: 0;
}

/* Drawer Header */
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.drawer-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.drawer-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: all 0.2s ease;
}

.drawer-close:hover {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.drawer-close svg {
    width: 20px;
    height: 20px;
}

/* Drawer Content */
.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex overflow */
}

/* Make form containers in drawer stretch to fill space */
.drawer-content > [id^="drawer-form-"],
.drawer-content > [id^="drawer-form-"] > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Form Elements in Drawer */
.drawer-content .form-group {
    margin-bottom: 24px;
}

.drawer-content .form-group:last-of-type {
    margin-bottom: 0;
}

.drawer-content .form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.drawer-content .form-control {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.9375rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.drawer-content .form-control:hover {
    border-color: var(--color-text-muted);
}

.drawer-content .form-control:focus {
    outline: none;
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 4px rgba(0, 58, 143, 0.1);
}

[data-theme="dark"] .drawer-content .form-control:focus {
    box-shadow: 0 0 0 4px rgba(26, 95, 209, 0.2);
}

.drawer-content .form-control::placeholder {
    color: var(--color-text-muted);
}

.drawer-content select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6B82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 44px;
}

.drawer-content .form-hint,
.form-group .form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

/* Form Divider */
.drawer-content .form-divider {
    height: 1px;
    background: var(--color-border);
    margin: 28px 0;
}

/* Permissions List */
.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.permission-item:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-text-muted);
}

.permission-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-brand-primary);
}

.permission-item .permission-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    line-height: 1.4;
}

/* Permission Rows (compact layout with dropdowns) */
.permissions-list.compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.permission-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.permission-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
    user-select: none;
}

.permission-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-brand-primary);
}

.permission-row .permission-label {
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

.permission-select {
    min-width: 80px;
    padding: 6px 10px;
    font-size: 0.8125rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
    transition: opacity 0.2s;
}

.permission-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.permission-select:focus {
    outline: none;
    border-color: var(--color-brand-primary);
}

.permission-select option {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

/* Duty ID Preview */
.drawer-content .duty-id-preview {
    padding: 14px 16px;
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-brand-primary);
    letter-spacing: 0.02em;
}

/* Drawer Actions */
.drawer-actions {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    margin-top: auto;
    flex-shrink: 0;
}

/* When action buttons are inside drawer-content, make them sticky at bottom */
.drawer-content .drawer-actions,
.drawer-content .form-actions,
.drawer-content .voting-actions {
    position: sticky;
    bottom: 0;
    margin-top: auto; /* Push to bottom when content doesn't overflow */
    margin-left: -24px;
    margin-right: -24px;
    margin-bottom: 0;
    padding: 20px 24px;
    padding-bottom: calc(20px + var(--safe-area-bottom));
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.drawer-actions .btn {
    flex: 1;
    padding: 14px 20px;
    font-weight: 600;
    border-radius: var(--radius-md);
}

.drawer-actions .btn-secondary {
    background: transparent;
    border: 2px solid var(--color-border);
    color: var(--color-text-secondary);
}

.drawer-actions .btn-secondary:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-text-muted);
}

.drawer-actions .btn-primary {
    background: var(--color-brand-primary);
    border: 2px solid var(--color-brand-primary);
    color: white;
}

.drawer-actions .btn-primary:hover {
    background: var(--color-brand-primary-dark);
    border-color: var(--color-brand-primary-dark);
}

/* Info Block */
.drawer-info-block {
    background: linear-gradient(135deg, var(--color-bg-secondary) 0%, var(--color-bg-card) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.drawer-info-block p {
    margin: 0 0 8px 0;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.drawer-info-block p:last-child {
    margin-bottom: 0;
}

.drawer-info-block p strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.drawer-info-block ol {
    margin: 12px 0 0 0;
    padding-left: 0;
    list-style: none;
    counter-reset: steps;
}

.drawer-info-block li {
    position: relative;
    padding-left: 32px;
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    counter-increment: steps;
}

.drawer-info-block li:last-child {
    margin-bottom: 0;
}

.drawer-info-block li::before {
    content: counter(steps);
    position: absolute;
    left: 0;
    top: 0;
    width: 22px;
    height: 22px;
    background: var(--color-brand-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-info-block code {
    display: inline-block;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-brand-primary);
}

/* ==========================================================================
   History Timeline
   ========================================================================== */

.history-loading,
.history-empty,
.history-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

.history-error {
    color: var(--color-error);
}

/* Duty Info Drawer Styles */
.duty-info-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.duty-info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.duty-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.duty-info-id {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    font-family: monospace;
}

.duty-info-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 12px 0;
}

.duty-info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.duty-info-row {
    display: flex;
    gap: 8px;
}

.duty-info-label {
    flex-shrink: 0;
    width: 100px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.duty-info-value {
    flex: 1;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    word-break: break-word;
}

.duty-info-feedback {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.duty-info-feedback-item {
    background: var(--color-bg-secondary);
    border-radius: 8px;
    padding: 12px;
}

.duty-info-feedback-user {
    font-weight: 600;
    color: var(--color-primary);
    display: block;
    margin-bottom: 4px;
}

.duty-info-feedback-text {
    color: var(--color-text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.history-timeline {
    position: relative;
}

.history-item {
    position: relative;
    padding-left: 28px;
    padding-bottom: 20px;
}

/* Line connecting to next item - only shown if not the last item */
.history-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 20px;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.history-item:last-child {
    padding-bottom: 0;
}

.history-item-dot {
    position: absolute;
    left: 0;
    top: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-brand-primary);
    border: 2px solid var(--color-bg-primary);
    box-shadow: 0 0 0 2px var(--color-brand-primary);
}

.history-item-content {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.history-action {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 0.95rem;
}

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

.history-author {
    font-size: 0.85rem;
    color: var(--color-brand-primary);
    margin-bottom: 8px;
}

.history-changes {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

.history-change {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.history-change:last-child {
    margin-bottom: 0;
}

.history-field {
    color: var(--color-text-muted);
}

.history-old {
    text-decoration: line-through;
    color: var(--color-error);
}

.history-new {
    color: var(--color-success);
    font-weight: 500;
}

.history-notes {
    margin: 4px 0 0 0;
    padding: 8px;
    background: var(--color-bg-secondary);
    border-radius: 4px;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--color-text-secondary);
}

/* ==========================================================================
   Card Row Muted Style
   ========================================================================== */

.card-row-muted {
    opacity: 0.7;
}

.card-row-muted .card-label,
.card-row-muted .card-value {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Card row multiline - for assignees with roles */
.card-row-multiline {
    flex-direction: column;
    align-items: flex-start;
}

.card-row-multiline .card-label {
    margin-bottom: 4px;
}

.card-row-multiline .card-value {
    width: 100%;
    line-height: 1.6;
}

/* Multiple roles container */
.assignee-roles-container {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    margin-top: 4px;
}

.assignee-role-row {
    padding: 2px 0;
    font-size: 0.875rem;
}

.assignee-role-row:not(:last-child) {
    margin-bottom: 4px;
}

/* Assignee role label */
.assignee-role-label {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
}

/* Highlight current user in assignees list */
.assignee-highlight {
    background: var(--color-success-soft);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.assignee-highlight a {
    color: var(--color-success);
}

/* ==========================================================================
   Icon Button Style
   ========================================================================== */

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-bg-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--color-brand-primary);
    color: var(--color-text-inverse);
}

.btn-icon-primary {
    background: rgba(0, 91, 255, 0.1);
    color: var(--color-cta);
}

.btn-icon-primary:hover {
    background: var(--color-cta);
    color: var(--color-text-inverse);
}

.btn-icon-danger {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.btn-icon-danger:hover {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

.btn-icon-success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.btn-icon-success:hover {
    background: var(--color-success);
    color: var(--color-text-inverse);
}

/* Form Actions Layout */
.form-actions-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Overlap Warning Checkbox */
.overlap-warning {
    background: var(--color-error-soft);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 16px;
}

.overlap-warning .checkbox-label {
    color: var(--color-error);
    font-weight: 500;
}

.overlap-warning .checkbox-label span {
    color: var(--color-text-primary);
    font-weight: 400;
}

.short-notice-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid #F59E0B;
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 16px;
}

.short-notice-warning .checkbox-label {
    color: #D97706;
    font-weight: 500;
}

.short-notice-warning .checkbox-label span {
    color: var(--color-text-primary);
    font-weight: 400;
}

/* ==========================================================================
   Card Actions
   ========================================================================== */

.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ==========================================================================
   Dark Theme Drawer Styles
   ========================================================================== */

[data-theme="dark"] .drawer {
    background: var(--color-bg-primary);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .drawer-close {
    background: var(--color-bg-secondary);
}

[data-theme="dark"] .history-item-content {
    background: var(--color-bg-secondary);
}

[data-theme="dark"] .history-item-dot {
    border-color: var(--color-bg-primary);
}

/* ==================== ADMIN STYLES ==================== */

.admin-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.stat-section {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.stat-section-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Bot Info styles */
.bot-info-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bot-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    gap: 12px;
}

.bot-info-label {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.bot-info-value {
    color: var(--color-text-primary);
    font-size: 0.875rem;
    text-align: right;
    word-break: break-all;
}

.bot-info-url {
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Consolas, monospace;
    font-size: 0.75rem;
    background: var(--color-bg-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.bot-info-error {
    color: var(--color-error);
    font-size: 0.75rem;
}

/* Status badges for bot info */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-dev {
    background: var(--color-warning);
    color: #000;
}

.status-prod {
    background: var(--color-success);
    color: #fff;
}

.status-available {
    background: var(--color-success);
    color: #fff;
}

.status-unavailable {
    background: var(--color-error);
    color: #fff;
}

.status-unknown {
    background: var(--color-text-muted);
    color: #fff;
}

.admin-user-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.admin-user-card.banned {
    background: rgba(var(--danger-rgb), 0.1);
    border-color: var(--danger-color);
}

.admin-user-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.admin-user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.admin-user-id {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: auto;
}

.admin-user-id.clickable-id {
    cursor: pointer;
    transition: color 0.2s ease;
}

.admin-user-id.clickable-id:hover {
    color: var(--color-primary);
}

.admin-user-id.clickable-id:active {
    opacity: 0.7;
}

.admin-user-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.admin-user-roles {
    font-size: 12px;
    color: var(--primary-color);
}

.admin-user-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.admin-user-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.admin-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.admin-user-action-inline {
    flex-shrink: 0;
}

/* Collapsible card */
.card-collapsible {
    display: block;
}

.card-collapsible > summary {
    list-style: none;
    list-style-type: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-collapsible > summary::-webkit-details-marker {
    display: none !important;
}

.card-collapsible > summary::marker {
    display: none !important;
    content: none !important;
}

.card-collapsible > summary::before {
    display: none !important;
}

.card-collapsible > summary h3 {
    margin: 0;
    white-space: nowrap;
}

.collapse-icon {
    font-size: 18px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.card-collapsible[open] .collapse-icon {
    transform: rotate(90deg);
}

.card-body-collapsible {
    margin-top: 16px;
}

/* Admin chats list */
.admin-chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: default;
}

.admin-chat-item .btn-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-chat-item .btn-icon img {
    width: 16px;
    height: 16px;
    max-width: 16px;
    max-height: 16px;
}

.admin-chat-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.admin-chat-title {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.admin-chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.admin-chat-members {
    font-size: 12px;
    color: var(--text-muted);
}

.admin-chat-arrow {
    font-size: 18px;
    color: var(--text-muted);
}

/* Chat members in drawer */
.chat-members-header {
    padding: 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.chat-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.chat-member-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-member-name {
    font-weight: 500;
    color: var(--text-primary);
}

.chat-member-fullname {
    font-size: 12px;
    color: var(--text-muted);
}

.badge-small {
    padding: 2px 6px;
    font-size: 10px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background: rgba(var(--success-rgb), 0.15);
    color: var(--success-color);
}

.badge-danger {
    background: rgba(var(--danger-rgb), 0.15);
    color: var(--danger-color);
}

.badge-muted {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.badge-primary {
    background: var(--color-brand-primary);
    color: white;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.alert-warning {
    background: var(--color-warning-soft);
    color: #8B6914;
    border: 1px solid var(--color-warning);
}

.alert-danger {
    background: var(--color-error-soft);
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.text-warning {
    color: var(--color-warning);
}

.text-danger {
    color: var(--color-error);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-danger:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Clickable badge */
.badge-clickable {
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.1s;
}

.badge-clickable:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-clickable:active {
    transform: scale(0.95);
}

/* User chats popup */
.user-chats-popup {
    background-color: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    max-width: 320px;
    z-index: 1000;
    overflow: hidden;
    animation: popupFadeIn 0.15s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 14px;
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--color-border);
}

.popup-header::before {
    content: '👤';
    font-size: 14px;
    flex-shrink: 0;
}

.popup-loading,
.popup-empty,
.popup-error {
    padding: 20px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    background-color: var(--color-bg-primary);
}

.popup-loading::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-brand-primary);
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: popupSpin 0.8s linear infinite;
}

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

.popup-empty::before {
    content: '📭';
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

.popup-error {
    color: var(--color-error);
}

.popup-error::before {
    content: '⚠️';
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
}

.popup-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px 0;
    background-color: var(--color-bg-primary);
}

.popup-list-item {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color var(--transition-fast);
}

.popup-list-item::before {
    content: '💬';
    font-size: 14px;
    flex-shrink: 0;
}

.popup-list-item:hover {
    background-color: var(--color-bg-secondary);
}

.popup-chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popup-chat-type {
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.popup-chat-type.staff {
    background: rgba(52, 199, 89, 0.15);
    color: var(--color-success);
}

/* ==========================================================================
   Fullscreen Messages (Banned, Access Denied, etc.)
   ========================================================================== */

.fullscreen-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    text-align: center;
    background-color: var(--color-bg-primary);
}

.fullscreen-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.fullscreen-title {
    margin-bottom: 10px;
    color: var(--color-text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.fullscreen-text {
    color: var(--color-text-secondary);
    max-width: 300px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.fullscreen-actions {
    margin-bottom: 24px;
}

.fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 44px;
    padding: 0 20px;
    background: #000000;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.fullscreen-btn:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
}

.fullscreen-btn .btn-icon {
    width: 24px;
    height: 24px;
}

.fullscreen-note {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    max-width: 280px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.fullscreen-hint {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    margin-top: 16px;
}

.fullscreen-btn-wide {
    min-width: 220px;
    padding: 12px 24px;
}

.fullscreen-form {
    width: 100%;
    max-width: 400px;
    text-align: left;
}

.fullscreen-form-title {
    color: var(--color-text-primary);
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 600;
}

.fullscreen-form-subtitle {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    text-align: center;
}

.fullscreen-form-status {
    margin-top: 12px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.fullscreen-form-status.error {
    color: var(--color-error);
}

.fullscreen-status {
    margin-top: 20px;
    text-align: center;
}

.fullscreen-status-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
}

.fullscreen-status-text {
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.fullscreen-status-success {
    color: var(--color-success);
}

/* ==========================================================================
   Info Tooltip Component
   ========================================================================== */

.section-title-with-info {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    margin-bottom: 12px;
}

.section-title-with-info h2,
.section-title-with-info h3 {
    margin: 0;
}

.info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.info-btn:hover {
    opacity: 1;
}

.info-btn img {
    width: 18px;
    height: 18px;
}

.info-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    margin-top: 8px;
}

.info-tooltip.info-tooltip-top {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 8px;
}

.info-tooltip.hidden {
    display: none;
}

.info-tooltip-content {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text-primary);
}

.info-tooltip-content p {
    margin: 0 0 12px 0;
}

.info-tooltip-content p:last-child {
    margin-bottom: 0;
}

.info-tooltip-content strong {
    color: var(--color-text-primary);
}

.info-tooltip-content ul {
    margin: 8px 0 12px 0;
    padding-left: 20px;
}

.info-tooltip-content li {
    margin-bottom: 8px;
    color: var(--color-text-secondary);
}

.info-tooltip-content li:last-child {
    margin-bottom: 0;
}

/* Dark theme adjustments */
[data-theme="dark"] .info-tooltip-content {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
}

/* Settings label with info button */
.settings-label-with-info {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.settings-label-with-info .settings-label {
    margin-bottom: 0;
}

.settings-label-with-info .info-tooltip {
    left: 0;
    right: auto;
    width: calc(100vw - 32px);
    max-width: 400px;
}

/* Adjust tooltip for section headers with toggle */
.section-header.with-toggle .section-title-with-info {
    flex: 1;
}

.section-header.with-toggle .info-tooltip {
    width: calc(100vw - 32px);
    max-width: 400px;
}

/* =====================
   Linked Accounts
   ===================== */

.linked-accounts-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid var(--color-border);
}

.linked-account-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.linked-account-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.linked-account-item:first-child {
    padding-top: 0;
}

.linked-account-provider {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.provider-logo {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.provider-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.linked-account-info {
    flex: 1;
    min-width: 0;
}

.linked-account-login {
    font-size: 0.875rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.linked-account-status {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.linked-account-error {
    color: var(--color-danger);
    font-size: 0.875rem;
    text-align: center;
    padding: 12px;
}

/* Small button variant */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
    min-height: auto;
}

/* Glass style for linked accounts */
[data-style="glass"] .linked-accounts-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

[data-style="glass"] .linked-account-item {
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

[data-style="glass"] .provider-name,
[data-style="glass"] .linked-account-login {
    color: #ffffff;
}

[data-style="glass"] .linked-account-status {
    color: rgba(255, 255, 255, 0.7);
}

/* Stored data linked accounts list */
.stored-data-accounts {
    margin-top: 8px;
    margin-bottom: 4px;
}

.stored-data-accounts-list {
    margin: 4px 0 0 16px;
    padding: 0;
    font-size: 0.8125rem;
}

.stored-data-accounts-list li {
    margin-bottom: 2px;
}

/* ==========================================================================
   Config Drawer Styles
   ========================================================================== */

/* Header actions group */
.header-actions-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Config category */
.config-category {
    margin-bottom: 20px;
}

.config-category:last-child {
    margin-bottom: 0;
}

.config-category-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

/* Config items list */
.config-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Single config item */
.config-item {
    background: var(--color-bg-secondary);
    border-radius: 8px;
    padding: 10px 12px;
}

.config-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 8px;
}

.config-name-with-info {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    flex: 1;
    min-width: 0;
}

.config-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Config info button */
.config-info-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.config-info-btn:hover {
    opacity: 1;
}

.config-info-btn img {
    width: 14px;
    height: 14px;
}

/* Config tooltip */
.config-tooltip {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 8px;
    z-index: 1000;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    max-width: 320px;
}

.config-tooltip-content {
    padding: 12px;
}

.config-tooltip-content p {
    margin: 0 0 8px 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.config-tooltip-content p:last-child {
    margin-bottom: 0;
}

.config-tooltip-content p strong {
    color: var(--color-text-primary);
}

.config-tooltip-content code {
    background: var(--color-bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.config-tooltip-default {
    color: var(--color-text-muted) !important;
    font-size: 0.75rem !important;
}

.config-tooltip-status {
    font-size: 0.75rem !important;
    font-style: italic;
}

/* Config badges */
.config-badge {
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.config-badge-default {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

.config-badge-custom {
    background: var(--color-success-soft);
    color: var(--color-success);
}

/* Config value display */
.config-value {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    word-break: break-word;
}

.config-value-secret {
    font-family: monospace;
    letter-spacing: 0.5px;
}

.config-value-null {
    color: var(--color-text-muted);
    font-style: italic;
}

.config-value-empty {
    color: var(--color-text-muted);
    font-style: italic;
}

.config-value-bool-true {
    color: var(--color-success);
    font-weight: 500;
}

.config-value-bool-false {
    color: var(--color-text-muted);
}

.config-value-number {
    color: var(--color-primary);
    font-family: monospace;
}

/* Dark theme adjustments */
[data-theme="dark"] .config-item {
    background: var(--color-bg-secondary);
}

[data-theme="dark"] .config-tooltip {
    background: var(--color-bg-secondary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .config-name {
    background: var(--color-bg-tertiary);
}

/* Glass style for config drawer */
[data-style="glass"] .config-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

[data-style="glass"] .config-tooltip {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-style="glass"] .config-name {
    background: rgba(255, 255, 255, 0.1);
}

[data-style="glass"] .config-badge-default {
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================================================
   Tenant Roles Management
   ========================================================================= */

.roles-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.role-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.8125rem;
    transition: all 0.15s ease;
}

.role-tag.system {
    background: linear-gradient(135deg, var(--color-primary-soft), transparent);
    border-color: var(--color-primary);
}

.role-tag .role-name {
    font-weight: 500;
    color: var(--color-text-primary);
}

.role-tag .role-count {
    font-size: 0.6875rem;
    padding: 2px 6px;
    background: var(--color-bg-secondary);
    border-radius: 10px;
    color: var(--color-text-secondary);
}

.role-tag .role-delete {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.15s ease;
}

.role-tag .role-delete:hover {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.role-tag.system .role-delete {
    display: none;
}

/* =========================================================================
   Custom Fields Management
   ========================================================================= */

.custom-fields-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.custom-field-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.15s ease;
}

.custom-field-item:hover {
    border-color: var(--color-primary);
}

/* Inactive/non-deletable fields - slightly grayed out */
.custom-field-item.inactive {
    opacity: 0.6;
    background: var(--color-bg-tertiary);
}

.custom-field-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.custom-field-label {
    font-weight: 500;
    color: var(--color-text-primary);
    font-size: 0.9375rem;
}

.custom-field-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-field-name {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: var(--color-bg-secondary);
    border-radius: 4px;
    color: var(--color-text-secondary);
}

.custom-field-type {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.custom-field-placeholder {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.custom-field-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}

.custom-field-actions .btn-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    overflow: hidden;
}

.custom-field-actions .btn-icon img,
.custom-field-actions .btn-icon svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    object-fit: contain;
}

.custom-field-actions .btn-icon.danger {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.custom-field-actions .btn-icon.danger:hover {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

.field-badge {
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.field-badge.required {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.field-badge.inactive {
    background: var(--color-bg-secondary);
    color: var(--color-text-muted);
}

/* =========================================================================
   Tenant Roles List (Similar to Custom Fields)
   ========================================================================= */

.role-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: all 0.15s ease;
    margin-bottom: 8px;
}

.role-item:last-child {
    margin-bottom: 0;
}

.role-item:hover {
    border-color: var(--color-primary);
}

/* System roles (non-deletable) - slightly grayed out */
.role-item.system {
    background: var(--color-bg-tertiary);
    opacity: 0.85;
}

.role-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.role-item-label {
    font-weight: 500;
    color: var(--color-text-primary);
    font-size: 0.9375rem;
}

.role-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.role-item-code {
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    background: var(--color-bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.role-item-perms {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.role-item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}

.role-item-actions .btn-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    overflow: hidden;
}

.role-item-actions .btn-icon img,
.role-item-actions .btn-icon svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    object-fit: contain;
}

.role-item-actions .btn-icon.danger {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.role-item-actions .btn-icon.danger:hover {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

/* =========================================================================
   Tenant Users Management (New Design)
   ========================================================================= */

/* Toolbar */
.users-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.users-search-group {
    display: flex;
    gap: 8px;
}

.users-search-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.users-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.users-search-input::placeholder {
    color: var(--color-text-muted);
}

.btn-add-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    white-space: nowrap;
}

.btn-add-user .btn-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

.users-filter-group {
    position: relative;
}

.users-filter-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    font-size: 0.8125rem;
}

.users-filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Stats bar */
.users-stats {
    display: flex;
    gap: 16px;
    padding: 10px 14px;
    background: var(--color-bg-tertiary);
    border-radius: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.users-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
}

.users-stat-value {
    font-weight: 600;
    color: var(--color-text-primary);
}

.users-stat-label {
    color: var(--color-text-secondary);
}

.users-stat.danger .users-stat-value {
    color: var(--color-danger);
}

/* Users grid */
.users-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* User card - compact modern design */
.user-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.user-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.user-card:hover {
    border-color: var(--color-border-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-card.banned {
    opacity: 0.75;
    border-color: var(--color-danger);
    background: linear-gradient(135deg, var(--color-danger-soft), var(--color-bg-secondary));
}

/* User identity section */
.user-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark, var(--color-primary)));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.user-avatar.banned {
    background: var(--color-danger);
}

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

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.user-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.user-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.user-username {
    color: var(--color-text-secondary);
}

.user-id {
    font-family: 'SF Mono', Monaco, monospace;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color 0.15s ease;
}

.user-id:hover {
    color: var(--color-primary);
}

.user-banned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--color-danger);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.user-chat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.user-chat-badge.success {
    background: rgba(52, 199, 89, 0.15);
    color: var(--color-success);
}

.user-chat-badge.muted {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

.user-chat-badge.clickable {
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

.user-chat-badge.clickable:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* User actions */
.user-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.user-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.user-action-btn:hover {
    background: var(--color-bg-hover);
}

.user-action-btn.danger:hover {
    background: var(--color-danger-soft);
}

.user-action-btn.warning:hover {
    background: var(--color-warning-soft);
}

.user-action-btn.success:hover {
    background: var(--color-success-soft);
}

.user-action-btn img {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.user-action-btn:hover img {
    opacity: 1;
}

/* User roles section */
.user-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

/* Role chip / toggle */
.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--color-bg-tertiary);
    border: 1px solid transparent;
    border-radius: 16px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.role-chip:hover {
    background: var(--color-bg-hover);
}

.role-chip.active {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.role-chip.active .role-chip-name {
    font-weight: 500;
}

.role-chip.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.role-chip input[type="checkbox"] {
    display: none;
}

.role-chip-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted);
    transition: all 0.15s ease;
}

.role-chip.active .role-chip-indicator {
    background: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-soft);
}

.role-chip-name {
    color: var(--color-text-secondary);
}

.role-chip.active .role-chip-name {
    color: var(--color-primary);
}

/* Footer info */
.user-footer {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

/* Button variants */
.btn-small {
    padding: 4px 10px;
    font-size: 0.75rem;
    min-width: auto;
    border-radius: 6px;
}

.btn-danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border: none;
}

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

.btn-warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
    border: none;
}

.btn-warning:hover {
    background: var(--color-warning);
    color: #fff;
}

.btn-success {
    background: var(--color-success-soft);
    color: var(--color-success);
    border: none;
}

.btn-success:hover {
    background: var(--color-success);
    color: #fff;
}

/* Dark theme adjustments */
[data-theme="dark"] .user-card {
    background: var(--color-bg-secondary);
}

[data-theme="dark"] .role-chip:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Glass style */
[data-style="glass"] .user-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

[data-style="glass"] .role-chip {
    background: rgba(255, 255, 255, 0.1);
}

[data-style="glass"] .role-chip:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-style="glass"] .role-chip.active {
    background: rgba(var(--color-primary-rgb, 0, 122, 255), 0.2);
}

/* Responsive */
@media (max-width: 480px) {
    .users-toolbar {
        gap: 8px;
    }

    .users-search-group {
        flex-direction: column;
    }

    .btn-add-user {
        width: 100%;
        justify-content: center;
    }

    .user-card {
        padding: 10px 12px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .users-stats {
        gap: 12px;
    }
}

/* Add Role Modal */
.modal-role-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-role-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-role-form label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.modal-role-form input[type="text"] {
    padding: 10px 12px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 0.875rem;
}

.modal-role-form input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

.modal-role-form .hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Instance Admin Banner */
.instance-admin-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--color-primary-soft) 0%, var(--color-bg-secondary) 100%);
    border: 1px solid var(--color-primary);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.instance-admin-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.instance-admin-banner-icon {
    font-size: 24px;
}

.instance-admin-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.instance-admin-banner-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
}

.instance-admin-banner-desc {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

[data-theme="dark"] .instance-admin-banner {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, var(--color-bg-secondary) 100%);
}

[data-style="glass"] .instance-admin-banner {
    background: rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Instance admin button - show icon on small screens */
.instance-admin-btn .btn-icon-only {
    display: none;
    width: 16px;
    height: 16px;
}

@media (max-width: 420px) {
    .instance-admin-btn .btn-label {
        display: none;
    }
    .instance-admin-btn .btn-icon-only {
        display: block;
    }
    .instance-admin-btn {
        padding: 8px 10px;
        min-width: auto;
    }
}

/* =========================================================================
   Avatar Upload
   ========================================================================= */

.avatar-upload-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    border: 2px dashed var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 24px;
    color: var(--color-text-tertiary);
    font-weight: 600;
}

.avatar-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avatar-upload-actions .btn-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    font-size: 0.8125rem;
}

.avatar-upload-actions .btn-icon {
    width: 16px;
    height: 16px;
}

.avatar-upload-hint {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: -4px;
}

/* Tenant Info Header with Avatar */
.tenant-info-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.tenant-avatar-container {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

.tenant-avatar-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tenant-avatar-placeholder {
    font-size: 22px;
    color: var(--color-text-tertiary);
    font-weight: 600;
}

.tenant-info-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tenant-info-title .tenant-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.tenant-info-title .tenant-slug {
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
    font-family: var(--font-mono);
}

/* =========================================================================
   Collapsible Cards
   ========================================================================= */

.collapsible-card .collapsible-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 0;
    margin: -4px 0;
    user-select: none;
}

.collapsible-card .collapsible-header:hover {
    background: var(--color-bg-secondary);
}

.collapsible-card .collapse-toggle {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.collapsible-card .collapse-toggle:hover {
    color: var(--color-text-primary);
}

.collapsible-card .collapse-toggle svg {
    display: block;
    transition: transform 0.2s ease;
}

.collapsible-card.collapsed .collapse-toggle svg {
    transform: rotate(-90deg);
}

.collapsible-card .collapsible-content {
    margin-top: 16px;
    overflow: visible;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease;
    max-height: none;
    opacity: 1;
}

.collapsible-card.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
}

/* ==========================================================================
   Voting System Styles
   ========================================================================== */

/* Voting status badges */
.badge-voting {
    background: rgba(59, 130, 246, 0.15);
    color: #2563EB;
    cursor: pointer;
}

[data-theme="dark"] .badge-voting {
    background: rgba(59, 130, 246, 0.25);
    color: #60A5FA;
}

.badge-voting_completed {
    background: rgba(110, 231, 183, 0.2);
    color: #059669;
}

[data-theme="dark"] .badge-voting_completed {
    background: rgba(110, 231, 183, 0.3);
    color: #6EE7B7;
}

.badge-voting_expired {
    background: rgba(245, 158, 11, 0.15);
    color: #D97706;
}

[data-theme="dark"] .badge-voting_expired {
    background: rgba(245, 158, 11, 0.25);
    color: #FBBF24;
}

/* Glass style voting badges */
[data-style="glass"] .badge-voting {
    background: rgba(59, 130, 246, 0.25);
    backdrop-filter: blur(4px);
    color: #2563EB;
}

[data-style="glass"] .badge-voting_completed {
    background: rgba(16, 185, 129, 0.25);
    backdrop-filter: blur(4px);
    color: #059669;
}

[data-style="glass"] .badge-voting_expired {
    background: rgba(245, 158, 11, 0.25);
    backdrop-filter: blur(4px);
    color: #D97706;
}

/* Voting drawer content styles */
.voting-drawer-info {
    background: var(--color-bg-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.voting-drawer-window-id {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.voting-drawer-deadline {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.voting-drawer-deadline.expired {
    color: var(--color-error);
}

.voting-drawer-progress {
    background: var(--color-bg-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.voting-progress-bar {
    height: 8px;
    background: var(--color-bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.voting-progress-fill {
    height: 100%;
    background: var(--color-brand-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.voting-progress-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    text-align: center;
}

/* Voting role items */
.voting-role-item {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.voting-role-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.voting-role-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
}

.voting-role-stats {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.voting-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.voting-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.voting-option:hover {
    background: var(--color-bg-tertiary);
}

.voting-option.selected {
    border-color: var(--color-brand-primary);
    background: var(--color-primary-alpha);
}

.voting-option.selected.ready {
    border-color: var(--color-success);
    background: var(--color-success-soft);
}

.voting-option.selected.unavailable {
    border-color: var(--color-error);
    background: var(--color-error-soft);
}

.voting-option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.voting-option.selected .voting-option-radio {
    border-color: var(--color-brand-primary);
}

.voting-option.selected.ready .voting-option-radio {
    border-color: var(--color-success);
}

.voting-option.selected.unavailable .voting-option-radio {
    border-color: var(--color-error);
}

.voting-option-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s ease;
}

.voting-option.selected .voting-option-radio::after {
    background: var(--color-brand-primary);
}

.voting-option.selected.ready .voting-option-radio::after {
    background: var(--color-success);
}

.voting-option.selected.unavailable .voting-option-radio::after {
    background: var(--color-error);
}

.voting-option-label {
    font-size: 0.9375rem;
    color: var(--color-text-primary);
}

/* Voting results styles */
.voting-results {
    margin-top: 20px;
}

.voting-results-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.voting-result-item {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.voting-result-role {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.voting-result-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
}

.voting-result-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
}

.voting-result-stat.ready {
    color: var(--color-success);
}

.voting-result-stat.unavailable {
    color: var(--color-error);
}

.voting-result-stat.pending {
    color: var(--color-text-muted);
}

.voting-result-users {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin-top: 8px;
}

.voting-result-users strong {
    color: var(--color-text-primary);
}

/* Voting action buttons */
.voting-actions {
    display: flex;
    gap: 12px;
}

.voting-actions .btn {
    flex: 1;
}

/* Voting loading state */
.voting-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}

.voting-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

/* No voting items message */
.voting-no-items {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}

.voting-no-items-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.voting-no-items-text {
    font-size: 0.9375rem;
}

/* Voting windows list (for selection) */
.voting-windows-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.voting-window-item {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.voting-window-item:hover {
    border-color: var(--color-brand-primary);
    background: var(--color-primary-alpha);
}

.voting-window-item:active {
    transform: scale(0.98);
}

.voting-window-item-id {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.voting-window-item-meta {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

/* Admin voting controls */
.voting-admin-controls {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.voting-admin-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.voting-admin-buttons {
    display: flex;
    gap: 8px;
}

.voting-admin-buttons .btn {
    flex: 1;
}

/* New voting drawer styles */
.voting-drawer-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.voting-window-badge {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-brand-primary);
    background: var(--color-primary-alpha);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    display: inline-block;
    width: fit-content;
}

.voting-window-meta {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.voting-expires-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-warning-soft);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.voting-expires-label {
    color: var(--color-text-secondary);
}

.voting-expires-time {
    font-weight: 600;
    color: var(--color-warning);
}

.voting-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.voting-section-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.voting-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.voting-item {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.voting-item .voting-role-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    margin-bottom: 10px;
}

.voting-item .voting-options {
    display: flex;
    gap: 8px;
}

.voting-item .voting-option {
    flex: 1;
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.875rem;
}

/* Ready option styling */
.voting-option-ready {
    border-color: var(--color-success-soft);
}

.voting-option-ready:hover {
    background: var(--color-success-soft);
    border-color: var(--color-success);
}

.voting-option-ready.selected {
    background: var(--color-success-soft);
    border-color: var(--color-success);
}

.voting-option-ready.selected .voting-option-check {
    border-color: var(--color-success);
    background: var(--color-success);
}

/* Unavailable option styling */
.voting-option-unavailable {
    border-color: var(--color-error-soft);
}

.voting-option-unavailable:hover {
    background: var(--color-error-soft);
    border-color: var(--color-error);
}

.voting-option-unavailable.selected {
    background: var(--color-error-soft);
    border-color: var(--color-error);
}

.voting-option-unavailable.selected .voting-option-check {
    border-color: var(--color-error);
    background: var(--color-error);
}

.voting-option input[type="radio"] {
    display: none;
}

.voting-option-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.voting-option.selected .voting-option-check {
    border-color: var(--color-brand-primary);
    background: var(--color-brand-primary);
}

.voting-option.selected .voting-option-check::after {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
}

.voting-submit-btn {
    width: 100%;
    margin-top: 16px;
}

.voting-empty-message {
    text-align: center;
    padding: 24px 16px;
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

.voting-not-started {
    text-align: center;
    padding: 32px 16px;
}

.voting-not-started-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.voting-not-started-text {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.voting-hint {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 8px;
}

.voting-results h4 {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-primary);
    margin-bottom: 16px;
}

.voting-result-total {
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    margin-top: 8px;
}

.voting-stat {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.voting-stat.ready {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.voting-stat.unavailable {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.voting-stat.pending {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

/* Voting Results with Chart */
.voting-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.voting-results-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.voting-progress-badge {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    background: var(--color-bg-tertiary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

/* Chart Bar */
.voting-summary-chart {
    margin-bottom: 20px;
}

.voting-chart-bar {
    display: flex;
    height: 24px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-bg-tertiary);
}

.voting-chart-segment {
    transition: width 0.3s ease;
    min-width: 0;
}

.voting-chart-segment.ready {
    background: var(--color-success);
}

.voting-chart-segment.unavailable {
    background: var(--color-error);
}

.voting-chart-segment.pending {
    background: var(--color-bg-tertiary);
}

.voting-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.8125rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-item.ready .legend-dot {
    background: var(--color-success);
}

.legend-item.unavailable .legend-dot {
    background: var(--color-error);
}

.legend-item.pending .legend-dot {
    background: var(--color-text-muted);
}

/* Roles breakdown (collapsible) */
.voting-roles-details,
.voting-pending-details {
    margin-top: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.voting-roles-details summary,
.voting-pending-details summary {
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    user-select: none;
}

.voting-roles-details summary:hover,
.voting-pending-details summary:hover {
    background: var(--color-bg-tertiary);
}

.voting-roles-list,
.voting-pending-list {
    padding: 12px 16px;
}

.voting-role-result {
    margin-bottom: 12px;
}

.voting-role-result:last-child {
    margin-bottom: 0;
}

.voting-role-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.voting-role-result-header .role-name {
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

.voting-role-result-header .role-count {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.voting-role-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--color-bg-tertiary);
}

/* Pending users list */
.voting-pending-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

.voting-pending-user:last-child {
    border-bottom: none;
}

.pending-username {
    font-size: 0.875rem;
    color: var(--color-text-primary);
    font-weight: 500;
}

.pending-roles {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Voting Role Details (collapsible per-role) */
.voting-roles-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.voting-role-details {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.voting-role-summary {
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.voting-role-summary::-webkit-details-marker {
    display: none;
}

.voting-role-summary::before {
    content: '▶';
    font-size: 0.7rem;
    margin-right: 8px;
    color: var(--color-text-muted);
    transition: transform 0.2s ease;
    display: inline-block;
}

.voting-role-details[open] .voting-role-summary::before {
    transform: rotate(90deg);
}

.voting-role-summary:hover {
    background: var(--color-bg-tertiary);
}

.voting-role-info {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.voting-role-info .role-name {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
}

.voting-role-info .role-count {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.voting-role-content {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-card);
}

/* Vote groups (ready, unavailable, pending) */
.vote-group {
    margin-bottom: 12px;
}

.vote-group:last-child {
    margin-bottom: 0;
}

.vote-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.vote-group-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.vote-group.ready .vote-group-icon {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.vote-group.unavailable .vote-group-icon {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.vote-group.pending .vote-group-icon {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

.vote-group-label {
    font-size: 0.8125rem;
    font-weight: 500;
}

.vote-group.ready .vote-group-label {
    color: var(--color-success);
}

.vote-group.unavailable .vote-group-label {
    color: var(--color-error);
}

.vote-group.pending .vote-group-label {
    color: var(--color-text-muted);
}

.vote-group-users {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-left: 28px;
}

.vote-user {
    font-size: 0.8125rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.vote-group.ready .vote-user {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.vote-group.unavailable .vote-user {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.vote-group.pending .vote-user {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

/* Summary only (when no details available) */
.vote-summary-only {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.vote-summary-only .vote-stat {
    font-size: 0.875rem;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.vote-summary-only .vote-stat.ready {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.vote-summary-only .vote-stat.unavailable {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.vote-summary-only .vote-stat.pending {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

/* ==========================================================================
   Manage Team Drawer - Error Handling
   ========================================================================== */

/* Error message container */
.manage-team-error {
    background: var(--color-error-soft);
    color: var(--color-error);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.4;
    border: 1px solid var(--color-error);
}

/* Force checkbox highlight when overlap error occurs */
.force-checkbox-highlight {
    background: var(--color-error-soft);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-error);
    animation: pulse-error 1s ease-in-out 2;
}

.force-checkbox-highlight .checkbox-label {
    color: var(--color-error);
    font-weight: 500;
}

@keyframes pulse-error {
    0%, 100% {
        border-color: var(--color-error);
    }
    50% {
        border-color: transparent;
    }
}

/* ==========================================================================
   History - Voting Results
   ========================================================================== */

.history-results {
    flex-direction: column;
    align-items: flex-start;
}

.history-vote-result {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    margin-left: 8px;
}

.history-role {
    font-weight: 500;
    min-width: 80px;
}

.history-ready {
    color: var(--color-success);
}

.history-unavailable {
    color: var(--color-error);
}

/* ==========================================================================
   Card Customization Editor
   ========================================================================== */

.card-customization-content {
    padding: 12px;
}

/* Edit Mode Toggle */
.edit-mode-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 10px 12px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-text-muted);
    transition: 0.3s;
    border-radius: 26px;
    border: 1px solid var(--color-border);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: #FFFFFF;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background-color: #FFFFFF;
}

.toggle-label {
    font-size: 14px;
    color: var(--color-text-primary);
    font-weight: 500;
}

/* Card Preview Container */
.card-preview-container {
    background: var(--color-bg-secondary);
    border-radius: 12px;
    padding: 8px;
}

.card-preview-container .card {
    margin: 0;
    max-width: 100%;
}

/* Interactive Card in Edit Mode */
.card-preview-container.edit-mode {
    background: var(--color-bg-tertiary);
    border: 2px dashed var(--color-cta);
}

.card-preview-container.edit-mode .card {
    background: var(--color-bg-card);
}

/* Editable Card Row */
.card-row.editable {
    position: relative;
    cursor: grab;
    border-radius: 6px;
    margin: 2px -8px;
    padding-left: 32px;
    padding-right: 8px;
    transition: background 0.2s, opacity 0.2s;
}

.card-row.editable:hover {
    background: var(--color-bg-tertiary);
}

.card-row.editable .row-drag-handle {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    opacity: 0.5;
    cursor: grab;
}

.card-row.editable:hover .row-drag-handle {
    opacity: 1;
}

.card-row.editable .row-visibility-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
    opacity: 0;
    transition: opacity 0.2s;
}

.card-row.editable:hover .row-visibility-toggle {
    opacity: 1;
}

.card-row.editable.hidden-field {
    opacity: 0.4;
}

.card-row.editable.hidden-field .card-label,
.card-row.editable.hidden-field .card-value {
    text-decoration: line-through;
}

.card-row.editable.dragging {
    opacity: 0.6;
    background: var(--color-cta);
    color: white;
}

.card-row.editable.drag-over {
    border-top: 2px solid var(--color-cta);
}

/* Editable Button */
.card-actions.edit-mode .btn-icon {
    position: relative;
    cursor: grab;
}

.card-actions.edit-mode .btn-icon.hidden-btn {
    opacity: 0.3;
}

.card-actions.edit-mode .btn-icon::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: var(--color-cta);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.card-actions.edit-mode .btn-icon:hover::after {
    opacity: 1;
}

.card-actions.edit-mode .btn-icon.dragging {
    opacity: 0.5;
    transform: scale(1.1);
}

.card-actions.edit-mode .btn-icon.drag-over {
    box-shadow: -3px 0 0 var(--color-cta);
}

/* Editable Card Header */
.card-header.editable {
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: background 0.2s;
}

.card-header.editable:hover {
    background: var(--color-bg-tertiary);
}

.card-header.editable .edit-indicator {
    font-size: 11px;
    color: var(--color-cta);
    margin-left: 8px;
}

/* Highlight animation for config sections */
.card-config-section.highlight {
    animation: highlightPulse 1s ease-out;
}

@keyframes highlightPulse {
    0% { background: var(--color-cta); }
    100% { background: transparent; }
}

.card-config-section {
    margin-bottom: 16px;
}

.card-config-section .section-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-primary);
    margin-bottom: 10px;
}

/* Title Configuration */
.title-config-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    transition: background 0.2s, border-color 0.2s;
}

.radio-option:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-text-secondary);
}

.radio-option:has(input:checked) {
    border-color: var(--color-cta);
    background: var(--color-bg-tertiary);
}

.radio-option input[type="radio"] {
    accent-color: var(--color-cta);
    width: 18px;
    height: 18px;
}

.radio-option span {
    font-size: 14px;
    color: var(--color-text-primary);
}

.template-option {
    flex-wrap: wrap;
}

.template-input {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.template-input:focus {
    outline: none;
    border-color: var(--color-cta);
    background: var(--color-bg-primary);
}

.template-input::placeholder {
    color: var(--color-text-muted);
}

/* Dark theme: make input more visible */
[data-theme="dark"] .template-input {
    background: var(--color-bg-tertiary);
    border-color: var(--color-text-muted);
}

[data-theme="dark"] .template-input:focus {
    background: var(--color-bg-tertiary);
    border-color: var(--color-cta);
}

.template-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 6px;
    padding-left: 12px;
}

/* Sortable Lists */
.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.sortable-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--color-bg-card);
    border-radius: 8px;
    cursor: grab;
    transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
    user-select: none;
}

.sortable-item:hover {
    background: var(--color-bg-tertiary);
}

.sortable-item.dragging {
    opacity: 0.8;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.sortable-item.drag-over {
    border-top: 2px solid var(--color-cta);
    padding-top: 8px;
}

.sortable-item .drag-handle {
    color: var(--color-text-secondary);
    cursor: grab;
    display: flex;
    align-items: center;
}

.sortable-item .drag-handle svg {
    width: 16px;
    height: 16px;
}

.sortable-item .item-checkbox {
    display: flex;
    align-items: center;
}

.sortable-item .item-checkbox input[type="checkbox"] {
    accent-color: var(--color-cta);
    width: 16px;
    height: 16px;
}

.sortable-item .item-label {
    flex: 1;
    font-size: 14px;
    color: var(--color-text-primary);
}

.sortable-item .item-type {
    font-size: 11px;
    color: var(--color-text-secondary);
    background: var(--color-bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
}

.sortable-item.disabled {
    opacity: 0.6;
}

.sortable-item.disabled .item-label {
    text-decoration: line-through;
    color: var(--color-text-secondary);
}

/* Card Config Actions */
.card-config-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Button Icons in sortable items */
.sortable-item .button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--color-text-secondary);
}

.sortable-item .button-icon svg {
    width: 16px;
    height: 16px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .card-customization-content {
        padding: 12px;
    }

    .sortable-item {
        padding: 8px 10px;
    }

    .template-input {
        width: 100%;
        margin-top: 8px;
    }

    .template-option {
        flex-direction: column;
        align-items: flex-start;
    }
}
