/* ═══════════════════════════════════════════
   直播排班系统 — 设计系统
   深色主题 + Glassmorphism + 微动画
   ═══════════════════════════════════════════ */

:root {
    /* Colors */
    --bg-base: #06060f;
    --bg-primary: #0c0c1d;
    --bg-secondary: #111128;
    --bg-card: rgba(255, 255, 255, 0.025);
    --bg-card-hover: rgba(255, 255, 255, 0.05);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-input-focus: rgba(255, 255, 255, 0.07);

    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #e8e8f0;
    --text-secondary: #9898b0;
    --text-dim: #5a5a78;
    --text-inverse: #0c0c1d;

    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);

    /* Group colors */
    --group-1: #6366f1;
    --group-2: #10b981;
    --group-3: #f59e0b;
    --group-4: #ec4899;
    --group-5: #06b6d4;
    --group-6: #8b5cf6;

    --group-bg-1: rgba(99, 102, 241, 0.08);
    --group-bg-2: rgba(16, 185, 129, 0.08);
    --group-bg-3: rgba(245, 158, 11, 0.08);
    --group-bg-4: rgba(236, 72, 153, 0.08);
    --group-bg-5: rgba(6, 182, 212, 0.08);
    --group-bg-6: rgba(139, 92, 246, 0.08);

    /* Typography */
    --font: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 0.25s;
}

:root[data-theme="light"] {
    --bg-base: #f5f7fb;
    --bg-primary: #ffffff;
    --bg-secondary: #eef2f8;
    --bg-card: rgba(255, 255, 255, 0.86);
    --bg-card-hover: rgba(255, 255, 255, 0.96);
    --bg-input: rgba(15, 23, 42, 0.045);
    --bg-input-focus: rgba(255, 255, 255, 0.96);

    --border: rgba(15, 23, 42, 0.1);
    --border-hover: rgba(15, 23, 42, 0.18);
    --border-focus: rgba(79, 70, 229, 0.42);

    --text-primary: #172033;
    --text-secondary: #566176;
    --text-dim: #8791a3;
    --text-inverse: #ffffff;

    --accent: #4f46e5;
    --accent-light: #6366f1;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    --accent-glow: 0 0 20px rgba(79, 70, 229, 0.18);

    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 24px rgba(15, 23, 42, 0.09);
    --shadow-lg: 0 8px 40px rgba(15, 23, 42, 0.12);
}

/* ── Reset ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════════
   Header
   ═══════════════════════════════════════════ */
.app-header {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

:root[data-theme="light"] .app-header {
    background: rgba(255, 255, 255, 0.86);
}

.header-content {
    max-width: 1440px;
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.header-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

.header-brand h1 {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.header-badge {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--accent-light);
    background: rgba(99, 102, 241, 0.12);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════
   Main Layout
   ═══════════════════════════════════════════ */
.app-main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
}

/* ═══════════════════════════════════════════
   Panel (Glass Card)
   ═══════════════════════════════════════════ */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel-team {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .panel-team {
        position: static;
        max-height: none;
    }
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════
   Form Elements
   ═══════════════════════════════════════════ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    transition: var(--duration) var(--ease);
    width: 100%;
}

.input:hover {
    border-color: var(--border-hover);
}

.input:focus {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* date input color fix */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

select.input,
select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    transition: var(--duration) var(--ease);
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239898b0' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

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

select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Fix dropdown option readability */
select option {
    background: #1a1a2e;
    color: #e8e8f0;
    font-size: 0.9rem;
    padding: 6px 10px;
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    outline: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background var(--duration) var(--ease);
}

.btn:hover::after {
    background: rgba(255, 255, 255, 0.05);
}

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

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 600;
    box-shadow: var(--accent-glow);
}

.btn-accent:hover {
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-gradient);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-dashed {
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border-hover);
}

.btn-dashed:hover {
    color: var(--accent-light);
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
}

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

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
}

/* ═══════════════════════════════════════════
   Team Selector
   ═══════════════════════════════════════════ */
.team-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.team-selector select {
    flex: 1;
}

.schedule-config-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
}

.weekday-selector {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.weekday-option {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
}

.weekday-option input {
    margin: 0;
}

.staff-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.staff-config-row .input {
    width: 76px;
    padding: 7px 10px;
}

.ungrouped-option {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
}

.ungrouped-option input {
    margin: 0;
}

/* ═══════════════════════════════════════════
   Group Card
   ═══════════════════════════════════════════ */
.group-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    transition: all var(--duration) var(--ease);
    animation: slideIn 0.3s var(--ease);
}

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

.group-card:hover {
    border-color: var(--border-hover);
}

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

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

.group-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.group-card-title input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
    width: 120px;
    border-bottom: 1px solid transparent;
    transition: border-color var(--duration) var(--ease);
}

.group-card-title input:focus {
    border-bottom-color: var(--accent);
}

.group-card-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.group-card-field label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.group-card-field .input {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 6px;
    animation: slideIn 0.2s var(--ease);
}

.member-row .input {
    flex: 1;
    padding: 7px 10px;
    font-size: 0.85rem;
}

.member-row .btn-icon {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
}

.btn-add-member {
    font-size: 0.8rem;
    padding: 6px 10px;
    margin-top: 4px;
    align-self: flex-start;
}

/* ═══════════════════════════════════════════
   Date Config
   ═══════════════════════════════════════════ */
.date-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.holidays-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.holidays-input .input {
    flex: 1;
}

.holidays-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.holiday-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 20px;
    padding: 4px 10px 4px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    animation: slideIn 0.2s var(--ease);
}

.holiday-tag button {
    background: none;
    border: none;
    color: var(--warning);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--duration) var(--ease);
    padding: 0 2px;
}

.holiday-tag button:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════
   Results Section
   ═══════════════════════════════════════════ */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.5rem;
    animation: fadeIn 0.5s var(--ease);
}

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

/* Fairness Card */
.fairness-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.fairness-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-badge {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid var(--border);
    font-weight: 500;
}

.history-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.25);
}

.fairness-metrics {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-value.success {
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Result Table */
.result-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.result-table th {
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.result-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background var(--duration) var(--ease);
}

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

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

.group-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}

.person-names {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.person-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
}

/* Stats Section */
.stats-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
}

.stats-title {
    font-size: 0.9rem;
    font-weight: 600;
}

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

.stats-legend {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.cumulative-track {
    flex: 0.6;
    height: 18px;
}

.stat-bar-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-bar-name {
    width: 72px;
    font-size: 0.82rem;
    text-align: right;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.stat-bar-track {
    flex: 1;
    height: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.6s var(--ease);
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    min-width: fit-content;
}

.stat-bar-count {
    width: 36px;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   Toast Notifications
   ═══════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s var(--ease);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    max-width: 360px;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.toast.info {
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-light);
}

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

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

/* ═══════════════════════════════════════════
   Loading Spinner
   ═══════════════════════════════════════════ */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 4px;
}

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

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 640px) {
    html { font-size: 14px; }

    .app-header { padding: 0 1rem; }
    .header-badge { display: none; }

    .app-main {
        padding: 0.75rem;
        gap: 1rem;
    }

    .date-config {
        grid-template-columns: 1fr;
    }

    .fairness-metrics {
        gap: 1rem;
    }

    .result-table { font-size: 0.82rem; }
    .result-table th,
    .result-table td { padding: 8px 10px; }

    .unavail-input-row {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════
   Unavailability
   ═══════════════════════════════════════════ */
.unavail-date-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.unavail-date-row .input {
    flex: 1;
    font-size: 0.85rem;
    padding: 8px 10px;
    min-width: 0;
}

.unavail-sep {
    color: var(--text-dim);
    font-size: 0.9rem;
    flex-shrink: 0;
    padding: 0 2px;
}

.unavail-person-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    min-height: 36px;
}

.unavail-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-xs);
    transition: all var(--duration) var(--ease);
    user-select: none;
}

.unavail-checkbox:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.unavail-checkbox input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.unavail-cb-all {
    color: var(--accent-light);
    font-weight: 600;
    border-right: 1px solid var(--border);
    padding-right: 12px;
    margin-right: 4px;
}

.unavail-hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-style: italic;
}

.unavail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.unavail-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 4px 8px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 500;
    max-width: 100%;
    animation: slideIn 0.2s var(--ease);
}

.unavail-tag.reason-请假 {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.unavail-tag.reason-出差 {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.unavail-tag.reason-调休 {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.unavail-tag button {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--duration) var(--ease);
    padding: 0 2px;
    flex-shrink: 0;
}

.unavail-tag button:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════
   Compensation Indicator
   ═══════════════════════════════════════════ */
.stat-compensation {
    width: 44px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    flex-shrink: 0;
    border-radius: var(--radius-xs);
    padding: 2px 6px;
}

.stat-compensation.comp-positive {
    color: #34d399;
    background: rgba(16, 185, 129, 0.1);
}

.stat-compensation.comp-zero {
    color: var(--text-dim);
}

.comp-positive {
    color: #34d399;
}

/* ═══════════════════════════════════════════
   Online Indicator
   ═══════════════════════════════════════════ */
.header-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

.online-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    padding: 5px 14px 5px 10px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--success);
    transition: all var(--duration) var(--ease);
}

.online-indicator.disconnected {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
    flex-shrink: 0;
}

.online-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--success);
    animation: pulse 2s ease-in-out infinite;
    opacity: 0;
}

.online-indicator.disconnected .online-dot {
    background: var(--danger);
}

.online-indicator.disconnected .online-dot::after {
    display: none;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(0.8); opacity: 0; }
}

.ws-status {
    display: none;
}

/* ═══════════════════════════════════════════
   Confirmed Banner
   ═══════════════════════════════════════════ */
.confirmed-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--success);
    animation: fadeIn 0.3s var(--ease);
}

/* ═══════════════════════════════════════════
   Confirm Button
   ═══════════════════════════════════════════ */
.btn-confirm {
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
    border: none;
}

.btn-confirm:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-confirm.confirmed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    box-shadow: none;
    border: 1px solid rgba(16, 185, 129, 0.3);
    pointer-events: none;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ═══════════════════════════════════════════
   Table Edit Mode
   ═══════════════════════════════════════════ */
.th-actions {
    width: 60px;
    text-align: center;
}

.btn-edit-row {
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-dim);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

.btn-edit-row:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--accent-light);
}

.btn-edit-row.editing {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent);
    color: var(--accent-light);
}

.result-table tr.editing-row {
    background: rgba(99, 102, 241, 0.06) !important;
}

.result-table tr.editing-row td {
    border-bottom-color: rgba(99, 102, 241, 0.15);
}

.edit-select {
    background: var(--bg-input);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-xs);
    padding: 5px 8px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    min-width: 80px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236366f1' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 22px;
}

.edit-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.edit-select option {
    background: #1a1a2e;
    color: #e8e8f0;
}

.person-edit-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-save-edit {
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-xs);
    color: var(--success);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.btn-save-edit:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: scale(1.05);
}

.btn-cancel-edit {
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-xs);
    color: var(--danger);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    flex-shrink: 0;
}

.btn-cancel-edit:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05);
}

/* ═══════════════════════════════════════════
   Real-time Update Flash Animation
   ═══════════════════════════════════════════ */
.result-table tr.flash-update td {
    animation: rowFlash 1.2s ease-out;
}

@keyframes rowFlash {
    0% { background: rgba(99, 102, 241, 0.2); }
    100% { background: transparent; }
}

.result-table tr.flash-confirm td {
    animation: rowConfirmFlash 1.5s ease-out;
}

@keyframes rowConfirmFlash {
    0% { background: rgba(16, 185, 129, 0.2); }
    100% { background: transparent; }
}

/* ═══════════════════════════════════════════
   Radius LG variable
   ═══════════════════════════════════════════ */
:root {
    --radius-lg: 16px;
}

/* ═══════════════════════════════════════════
   Auto-save Indicator
   ═══════════════════════════════════════════ */
.save-btn-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.autosave-indicator {
    font-size: 0.75rem;
    font-weight: 500;
    height: 18px;
    transition: all 0.3s var(--ease);
    letter-spacing: 0.01em;
}

.autosave-indicator.pending {
    color: var(--text-dim);
}

.autosave-indicator.saving {
    color: var(--text-secondary);
    animation: savingPulse 1s ease-in-out infinite;
}

.autosave-indicator.saved {
    color: var(--success);
}

.autosave-indicator.error {
    color: var(--danger);
}

@keyframes savingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
