/* ============================================================
   GestAI Components — built on tokens.css semantic tokens.
   Class names referenced by JavaScript are part of a hard
   contract (see plan) and must not be renamed.
   ============================================================ */

/* ==================== App Shell ==================== */

.app-container {
    display: flex;
    min-height: 100vh;
    background:
        radial-gradient(60% 42% at 108% -6%, var(--brand-soft) 0%, transparent 62%),
        radial-gradient(48% 38% at -10% 106%, var(--accent-soft) 0%, transparent 58%);
    background-attachment: fixed;
}

/* Full-page film grain — pure decoration, sits under overlays/toasts */
.app-container::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

[data-theme="dark"] .app-container::after { opacity: 0.05; }

.sidebar {
    width: 280px;
    background: var(--surface-raised);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: var(--z-drawer);
    transition: transform var(--dur-slow) var(--ease-out),
                background-color var(--dur-base) var(--ease-swift);
}

.sidebar-header {
    padding: var(--space-6) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.sidebar-toggle {
    display: none;
    padding: var(--space-2);
    color: var(--ink-muted);
    border-radius: var(--radius-sm);
    transition: background var(--dur-fast) var(--ease-swift);
}

.sidebar-toggle:hover {
    background: var(--surface-sunken);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2) var(--space-4) var(--space-4);
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    display: block;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 11px var(--space-3);
    border-radius: var(--radius-md);
    color: var(--ink-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: background var(--dur-fast) var(--ease-swift),
                color var(--dur-fast) var(--ease-swift),
                transform var(--dur-fast) var(--ease-swift);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--surface-sunken);
    color: var(--ink);
    transform: translateX(2px);
}

.nav-link.active {
    background: linear-gradient(90deg,
        var(--brand-soft) 0%,
        color-mix(in srgb, var(--brand-soft) 35%, transparent) 100%);
    color: var(--brand);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: var(--brand);
}

.nav-link .icon,
.nav-link i {
    width: 20px;
    height: 20px;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--plum-600) 0%, var(--plum-900) 100%);
    color: #fff;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-base);
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-email {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: 10px var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--ink-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: all var(--dur-fast) var(--ease-swift);
}

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

/* Main content area */
.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-8);
    background: color-mix(in srgb, var(--surface) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
}

.mobile-menu-btn {
    display: none;
    padding: var(--space-2);
    color: var(--ink-secondary);
    border-radius: var(--radius-sm);
}

.mobile-menu-btn:hover {
    background: var(--surface-sunken);
}

.page-title {
    font-size: var(--text-xl);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.content-body {
    flex: 1;
    padding: var(--space-8);
}

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

.card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--dur-base) var(--ease-swift),
                background-color var(--dur-base) var(--ease-swift);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.card-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-body {
    padding: var(--space-6);
}

/* ==================== Stat cards ==================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    transition: transform var(--dur-base) var(--ease-spring),
                box-shadow var(--dur-base) var(--ease-swift);
}

.stat-card:hover {
    box-shadow: 0 12px 32px -8px color-mix(in srgb, var(--brand) 16%, transparent),
                var(--shadow-md);
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--brand) 22%, var(--border));
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--brand-soft);    color: var(--brand); }
.stat-icon.success { background: var(--positive-soft); color: var(--positive); }
.stat-icon.warning { background: var(--caution-soft);  color: var(--caution); }
.stat-icon.info    { background: var(--info-soft);     color: var(--info); }

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

.stat-value {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-top: var(--space-2);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 11px 22px;
    font-size: var(--text-sm);
    font-weight: 700;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    white-space: nowrap;
    user-select: none;
    transition: background var(--dur-fast) var(--ease-swift),
                color var(--dur-fast) var(--ease-swift),
                border-color var(--dur-fast) var(--ease-swift),
                box-shadow var(--dur-base) var(--ease-swift),
                transform var(--dur-fast) var(--ease-spring);
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--plum-600) 0%, var(--plum-800) 100%);
    color: #fff;
    box-shadow: var(--shadow-brand), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover:not(:disabled) {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -6px rgba(109, 40, 217, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}

.btn-secondary {
    background: var(--brand-soft);
    color: var(--brand);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--brand-soft-2);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--ink-secondary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-soft);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--danger-strong);
}

.btn-lg {
    padding: 15px 32px;
    font-size: var(--text-base);
}

.btn-sm {
    padding: 7px 14px;
    font-size: var(--text-xs);
}

/* Spinner injected by GestAI.setLoading into buttons */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 13px var(--space-4);
    font-size: var(--text-sm);
    font-weight: 500;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    color: var(--ink);
    box-shadow: inset 0 1px 2px rgba(41, 30, 18, 0.03);
    transition: border-color var(--dur-fast) var(--ease-swift),
                box-shadow var(--dur-fast) var(--ease-swift),
                background-color var(--dur-base) var(--ease-swift);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--ink-faint);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--ring);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--ink-faint);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--danger);
}

.form-input.error:focus {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 25%, transparent);
}

.form-error {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--danger);
    margin-top: var(--space-1);
}

.form-hint {
    display: block;
    font-size: var(--text-xs);
    color: var(--ink-muted);
    margin-top: var(--space-1);
}

/* ==================== Tables ==================== */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

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

.table th,
.table td {
    padding: 14px var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-muted);
    background: var(--surface-sunken);
    position: sticky;
    top: 0;
    z-index: 1;
}

.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child  { border-top-right-radius: var(--radius-sm); }

.table td {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
}

.table tbody tr {
    transition: background var(--dur-fast) var(--ease-swift);
}

.table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-soft) 55%, transparent);
}

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

@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive .table {
        min-width: 600px;
    }
}

/* ==================== Badges & status ==================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    font-size: var(--text-xs);
    font-weight: 700;
    border-radius: var(--radius-pill);
    letter-spacing: 0.01em;
}

.badge-success { background: var(--positive-soft); color: var(--positive-strong); }
.badge-warning { background: var(--caution-soft);  color: var(--caution-strong); }
.badge-error   { background: var(--danger-soft);   color: var(--danger-strong); }
.badge-info    { background: var(--info-soft);     color: var(--info-strong); }
.badge-gray    { background: var(--surface-sunken); color: var(--ink-muted); }

/* Status chips — class names are JS contract (wholesale className resets) */
.call-status,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
}

.call-status-available, .status-badge.available { background: var(--positive-soft); color: var(--positive-strong); }
.call-status-on-call,   .status-badge.on-call   { background: var(--info-soft);     color: var(--info-strong); }
.call-status-on-break,  .status-badge.on-break  { background: var(--caution-soft);  color: var(--caution-strong); }
.call-status-offline,   .status-badge.offline   { background: var(--surface-sunken); color: var(--ink-muted); }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Analytics recent-calls dots (JS-generated) */
.status-dot.completed { background: var(--positive); }
.status-dot.active    { background: var(--info); }
.status-dot.missed    { background: var(--danger); }
.status-dot.cancelled { background: var(--ink-faint); }

/* Live indicator (partner page resets className wholesale) */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    animation: livePulse 2s var(--ease-swift) infinite;
}

.status-indicator.available { background: var(--positive); }
.status-indicator.on-break  { background: var(--caution); }
.status-indicator.on-call   { background: var(--info); }
.status-indicator.offline   { background: var(--ink-faint); animation: none; }

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 40%, transparent); }
    50%      { opacity: 0.85; transform: scale(1.08); box-shadow: 0 0 0 5px transparent; }
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.pulse-dot::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: currentColor;
    animation: pulseRing 1.6s var(--ease-out) infinite;
}

@keyframes pulseRing {
    0%   { transform: scale(1);   opacity: 0.8; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* ==================== Toasts ==================== */

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    padding: var(--space-4) var(--space-5);
    background: color-mix(in srgb, var(--surface-overlay) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 300px;
    max-width: 420px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    animation: slideIn var(--dur-slow) var(--ease-spring);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast-success::before { background: var(--positive); }
.toast-error::before   { background: var(--danger); }
.toast-warning::before { background: var(--caution); }
.toast-info::before    { background: var(--info); }

.toast-success { color: var(--ink); }
.toast-success > span:first-child { color: var(--positive); }
.toast-error   > span:first-child { color: var(--danger); }
.toast-warning > span:first-child { color: var(--caution); }
.toast-info    > span:first-child { color: var(--info); }

/* JS contract: keyframe name referenced from main.js */
@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ==================== Empty states ==================== */

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-5);
}

.empty-state-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: var(--space-4);
    opacity: 0.85;
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.empty-state-text {
    font-size: var(--text-sm);
    color: var(--ink-muted);
    margin-bottom: var(--space-6);
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== Toggle switch ==================== */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border-strong);
    transition: background-color var(--dur-base) var(--ease-swift);
    border-radius: var(--radius-pill);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: transform var(--dur-base) var(--ease-spring);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--positive);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 2px var(--ring-offset), 0 0 0 5px var(--ring);
}

/* ==================== Modal ==================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--surface-veil);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-5);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur-base) var(--ease-swift),
                visibility var(--dur-base) var(--ease-swift);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface-overlay);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(24px) scale(0.97);
    transition: transform var(--dur-slow) var(--ease-spring);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.modal-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
}

.modal-close {
    padding: var(--space-2);
    color: var(--ink-muted);
    border-radius: var(--radius-pill);
    line-height: 0;
    transition: all var(--dur-fast) var(--ease-swift);
}

.modal-close:hover {
    background: var(--surface-sunken);
    color: var(--ink);
}

.modal-body {
    padding: var(--space-6);
    font-size: var(--text-sm);
    color: var(--ink-secondary);
    line-height: 1.6;
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ==================== Dropdown ==================== */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    min-width: 190px;
    background: var(--surface-overlay);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: var(--z-drawer);
    padding: var(--space-1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: all var(--dur-fast) var(--ease-out);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--dur-fast) var(--ease-swift);
}

.dropdown-item:hover {
    background: var(--surface-sunken);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: var(--danger-soft);
}

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

/* ==================== Avatars ==================== */

.avatar-stack {
    display: flex;
}

.avatar-stack .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--surface-raised);
    margin-left: -8px;
    background: var(--surface-sunken);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
}

.avatar-stack .avatar:first-child { margin-left: 0; }

.avatar-stack .avatar-more {
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

/* ==================== Progress ==================== */

.progress {
    height: 8px;
    background: var(--surface-sunken);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width var(--dur-slow) var(--ease-out);
}

.progress-bar-primary { background: var(--brand); }
.progress-bar-success { background: var(--positive); }

/* ==================== Tabs ==================== */

.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.tab {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-swift),
                border-color var(--dur-fast) var(--ease-swift);
}

.tab:hover { color: var(--ink); }

.tab.active {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

/* ==================== Pagination ==================== */

.pagination {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-swift);
}

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

.pagination-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--on-brand);
}

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

/* ==================== Tooltip ==================== */

.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    padding: 6px 12px;
    background: var(--ink);
    color: var(--ink-inverse);
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--dur-fast) var(--ease-out);
    pointer-events: none;
    margin-bottom: var(--space-2);
    z-index: var(--z-overlay);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ==================== Search input ==================== */

.search-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-input-wrapper input {
    padding-left: 44px;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 14px;
    color: var(--ink-faint);
    pointer-events: none;
    display: flex;
}

/* ==================== Language switcher ==================== */

.language-flags {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: var(--surface-sunken);
    border-radius: var(--radius-pill);
    padding: 3px;
}

.flag-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease-swift);
    cursor: pointer;
}

.flag-btn:hover {
    color: var(--ink);
}

.flag-btn.active {
    background: var(--surface-raised);
    color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.language-dropdown {
    width: 100%;
}

.lang-select {
    width: 100%;
    padding: 10px var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-strong);
    background-color: var(--surface-raised);
    color: var(--ink);
    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='%2378716c' stroke-width='2.5' 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 12px center;
    padding-right: 36px;
}

.lang-select:hover { border-color: var(--brand); }

.lang-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--ring);
}

/* ==================== Theme toggle ==================== */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: 10px var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--ink-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: all var(--dur-fast) var(--ease-swift);
}

.theme-toggle:hover {
    background: var(--surface-sunken);
    color: var(--ink);
}

.theme-toggle .icon { width: 18px; height: 18px; }

[data-theme="light"] .theme-toggle .theme-icon-sun,
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }

[data-theme="light"] .theme-toggle .theme-label-light,
[data-theme="dark"] .theme-toggle .theme-label-dark { display: none; }

.theme-toggle-compact {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    color: var(--ink-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-raised);
    transition: all var(--dur-fast) var(--ease-swift);
}

.theme-toggle-compact:hover {
    color: var(--ink);
    background: var(--surface-sunken);
}

[data-theme="light"] .theme-toggle-compact .theme-icon-sun,
[data-theme="dark"] .theme-toggle-compact .theme-icon-moon { display: none; }

/* ==================== JS-generated: admin dashboard ==================== */

.translator-status-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.translator-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
}

.translator-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.translator-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--plum-600) 0%, var(--plum-900) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    flex-shrink: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: var(--brand-soft);
    color: var(--brand);
}

.activity-icon.call {
    background: var(--positive-soft);
    color: var(--positive);
}

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

.activity-text {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
}

.activity-time {
    font-size: var(--text-xs);
    color: var(--ink-faint);
    margin-top: 2px;
    display: block;
}

/* ==================== JS-generated: analytics ==================== */

.chart-container {
    position: relative;
    height: 320px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}

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

.breakdown-label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.breakdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.breakdown-avatar.partner    { background: linear-gradient(135deg, var(--plum-600), var(--plum-900)); }
.breakdown-avatar.translator { background: linear-gradient(135deg, var(--ember-500), var(--ember-700)); }

.breakdown-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breakdown-stats {
    display: flex;
    gap: var(--space-5);
    flex-shrink: 0;
}

.breakdown-stat { text-align: right; }

.breakdown-stat-value {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.breakdown-stat-label {
    font-size: var(--text-xs);
    color: var(--ink-faint);
}

/* ==================== JS-generated: assignments ==================== */

.assignment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.item-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    font-size: var(--text-sm);
    font-weight: 600;
}

.item-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--plum-600), var(--plum-900));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.no-assignments {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--ink-muted);
    font-size: var(--text-sm);
}

/* ==================== JS-generated: translator partner cards ==================== */

.partner-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-sunken);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.partner-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--ember-500), var(--ember-700));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    flex-shrink: 0;
}

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

.partner-name {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.partner-email {
    font-size: var(--text-xs);
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== Recent-call list (partner overlay + translator dashboard) ==================== */

.recent-calls-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    margin: 0 0 var(--space-3);
}

.recent-call-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    transition: border-color var(--dur-fast) var(--ease-swift),
                background var(--dur-fast) var(--ease-swift);
}

.recent-call-item:hover {
    background: color-mix(in srgb, var(--brand-soft) 45%, transparent);
    border-color: var(--brand-soft-2);
}

.recent-call-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.recent-call-date {
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.recent-call-translator {
    font-size: var(--text-xs);
    color: var(--ink-muted);
}

.recent-call-duration {
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--ink-secondary);
}

.recent-calls-empty {
    text-align: center;
    color: var(--ink-muted);
    padding: var(--space-6) 0;
}

/* ==================== Alerts ==================== */

.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.alert-error   { background: var(--danger-soft);   color: var(--danger-strong); }
.alert-success { background: var(--positive-soft); color: var(--positive-strong); }
.alert-warning { background: var(--caution-soft);  color: var(--caution-strong); }
.alert-info    { background: var(--info-soft);     color: var(--info-strong); }

/* ==================== Responsive shell ==================== */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .content-body {
        padding: var(--space-5);
    }

    .content-header {
        padding: var(--space-3) var(--space-5);
    }
}

@media (max-width: 640px) {
    .page-title { font-size: var(--text-lg); }
    .stats-grid { grid-template-columns: 1fr; }
    .content-body { padding: var(--space-4); }
    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
        bottom: var(--space-4);
    }
    .toast { min-width: 0; width: 100%; }
}
