/* PingFang HK font */
@font-face {
    font-family: 'PingFang HK';
    src: url('../fonts/PingFangHK-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'PingFang HK';
    src: url('../fonts/PingFangHK-Semibold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'PingFang HK', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    font-size: 14px;
}

/* --- Navbar --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #16213e;
    border-bottom: 1px solid #2a2a4a;
}
.navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
}
.navbar-links a {
    color: #7a8ba8;
    text-decoration: none;
    margin-left: 20px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}
.navbar-links a:hover,
.navbar-links a.active {
    color: #fff;
    background: #2a2a4a;
}

/* --- Container --- */
.container { padding: 16px 24px; }

/* --- Month Nav --- */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 12px 0 8px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
}
.month-nav button {
    background: #4a90d9;
    border: none;
    color: #fff;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}
.month-nav button:hover { background: #5ba0e9; }
.nav-action-btn {
    background: #2a2a4a !important;
    border: 1px solid #444 !important;
    color: #8899aa;
    padding: 4px 10px !important;
    font-size: 0.85rem !important;
    border-radius: 5px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.nav-action-btn:hover {
    color: #fff;
    border-color: #4a90d9 !important;
    background: #333 !important;
}

/* Gantt collapse state */
.gantt-collapsed .gantt-row { display: none; }
.gantt-collapsed .gantt-packed-row { display: none; }

/* Gantt packed view */
.gantt-packed-row { display: none; }
.gantt-packed .gantt-packed-row { display: table-row; }
.gantt-packed .gantt-row { display: none; }
.gantt-packed-row th {
    height: 24px !important;
    padding: 2px 0 !important;
    border: none !important;
}
.gantt-packed-row .corner-cell {
    background: #1a1a2e !important;
}
.nav-action-btn-active {
    color: #4a90d9 !important;
    border-color: #4a90d9 !important;
}

/* --- Legend --- */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0 12px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #bbb;
}
.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

/* --- Grid --- */
.grid-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 160px);
    border-radius: 8px;
    border: 1px solid #2a2a4a;
}

/* --- Gantt Header Bars --- */
.gantt-row th {
    height: 24px !important;
    padding: 2px 0 !important;
    border: none !important;
}
.gantt-row + tr:not(.gantt-row) th {
    border-top: 4px solid #1a1a2e !important;
}
.gantt-label {
    font-size: 0.65rem !important;
    font-weight: 600 !important;
    white-space: nowrap;
    text-align: left !important;
    padding-left: 10px !important;
    background: #1a1a2e !important;
    position: sticky;
    left: 0;
    z-index: 4;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gantt-bar {
    border-radius: 3px;
    font-size: 0.6rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    white-space: nowrap;
    overflow: visible;
    position: relative;
    line-height: 24px !important;
    padding: 0 !important;
}
.gantt-text {
    white-space: nowrap;
    font-weight: 600;
    pointer-events: none;
}
.gantt-empty {
    background: #1a1a2e !important;
}
/* Gantt row drag-and-drop reorder */
.gantt-row {
    cursor: grab;
}
.gantt-row.gantt-dragging {
    opacity: 0.4;
}
.gantt-row.gantt-drop-target {
    outline: 2px solid #4a90d9;
    outline-offset: -2px;
}
.roster-grid {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    min-width: 900px;
}
.roster-grid th,
.roster-grid td {
    border: 1px solid #2a2a4a;
    padding: 2px;
    text-align: center;
    min-width: 38px;
    height: 32px;
    vertical-align: middle;
    font-size: 0.8rem;
}
.roster-grid th {
    background: #16213e;
    color: #8899aa;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 3;
}
.roster-grid th .weekday-label {
    font-size: 0.65rem;
    color: #667;
    font-weight: 400;
}
.corner-cell {
    text-align: left !important;
    padding-left: 10px !important;
    position: sticky;
    left: 0;
    z-index: 4 !important;
}
.employee-name {
    text-align: left !important;
    padding-left: 10px !important;
    white-space: nowrap;
    background: #16213e !important;
    position: sticky;
    left: 0;
    z-index: 2;
    font-weight: 600;
    color: #ccc;
    cursor: grab;
}
/* Employee row drag-and-drop reorder */
.emp-dragging {
    opacity: 0.4;
}
.emp-drop-target > .employee-name {
    outline: 2px solid #4a90d9;
    outline-offset: -2px;
}
.day-cell {
    transition: background 0.15s;
    vertical-align: middle !important;
    overflow: visible;
    position: relative;
}
.day-cell.editable {
    cursor: pointer;
}
.day-cell.editable:hover {
    outline: 2px solid #4a90d9;
    outline-offset: -2px;
}
/* Row + column crosshair highlight */
.row-highlight > td {
    background: rgba(74, 144, 217, 0.15) !important;
}
.row-highlight > .employee-name {
    color: #fff !important;
    border-right: 2px solid #4a90d9;
}
.col-highlight {
    background: rgba(74, 144, 217, 0.15) !important;
}
.row-highlight > td.col-highlight {
    background: rgba(74, 144, 217, 0.30) !important;
}
.weekend {
    background: rgba(255, 255, 255, 0.03);
}
.drag-highlight {
    background: rgba(74, 144, 217, 0.2) !important;
}

/* --- Assignment Blocks --- */
.assignment-block {
    display: block;
    width: 90%;
    height: 8px;
    margin: 2px auto;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.1s;
}
.assignment-block:hover {
    transform: scaleY(1.5);
}
/* Pending assignment blocks (dashed border, not yet saved) */
.pending-block {
    display: block;
    width: 90%;
    height: 8px;
    margin: 2px auto;
    border-radius: 3px;
    border: 1.5px dashed rgba(255,255,255,0.5);
    opacity: 0.7;
    cursor: pointer;
}
/* Saved assignments marked for removal */
.assignment-block.pending-remove {
    opacity: 0.25;
    position: relative;
}
.assignment-block.pending-remove::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e74c3c;
}
/* Disable pointer events on blocks during drag so elementFromPoint hits the td */
.grid-dragging .assignment-block {
    pointer-events: none;
}
/* Connected consecutive blocks — overflow to bridge cell padding + border gaps */
.block-start {
    position: relative;
    width: calc(100% + 3px);
    margin-left: 0;
    margin-right: -3px;
    border-radius: 3px 0 0 3px;
    z-index: 1;
}
.block-mid {
    position: relative;
    width: calc(100% + 6px);
    margin-left: -3px;
    margin-right: -3px;
    border-radius: 0;
    z-index: 1;
}
.block-end {
    position: relative;
    width: calc(100% + 3px);
    margin-left: -3px;
    margin-right: 0;
    border-radius: 0 3px 3px 0;
    z-index: 1;
}

/* --- Block Tooltip --- */
.block-tooltip {
    position: absolute;
    z-index: 200;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    pointer-events: none;
    display: none;
    transform: translate(-50%, -100%);
    box-shadow: 0 3px 12px rgba(0,0,0,0.5);
}
.block-tooltip .tooltip-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 4px;
}
.tooltip-emp-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 0.78rem;
    line-height: 1.5;
}
.tooltip-emp-row.tooltip-self {
    font-weight: 700;
}
.tooltip-emp-name {
    opacity: 0.95;
}
.tooltip-emp-date {
    opacity: 0.7;
    text-align: right;
}

/* --- Event Picker --- */
.event-picker {
    position: absolute;
    background: #16213e;
    border: 1px solid #4a90d9;
    border-radius: 8px;
    padding: 8px;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    min-width: 180px;
}
.event-picker-columns {
    display: flex;
    gap: 8px;
}
.event-picker-col {
    flex: 1;
    min-width: 150px;
}
.event-picker-col-remove {
    border-left: 1px solid #2a2a4a;
    padding-left: 8px;
}
.remove-event-btn {
    opacity: 0.85;
}
.event-picker-title {
    font-size: 0.75rem;
    color: #667;
    margin-bottom: 6px;
    padding: 0 4px;
}
.event-picker-btn {
    display: block;
    width: 100%;
    padding: 7px 12px;
    margin: 3px 0;
    border: none;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 0.85rem;
    transition: opacity 0.2s;
}
.event-picker-btn:hover { opacity: 0.85; }
.cancel-btn {
    background: #444 !important;
    margin-top: 6px;
}
.remove-btn {
    background: #e74c3c !important;
    margin-top: 6px;
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 10px 18px;
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
    animation: fadeIn 0.3s, fadeOut 0.3s 3.7s;
}
.toast-warn { background: #e67e22; }
.toast-info { background: #3498db; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-header h2 {
    color: #fff;
    font-size: 1.3rem;
}
.page-header-actions {
    display: flex;
    gap: 8px;
}

/* --- Buttons --- */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: opacity 0.2s;
    color: #fff;
    background: #4a90d9;
}
.btn:hover { opacity: 0.85; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-primary { background: #4a90d9; }
.btn-secondary { background: #555; }
.btn-danger { background: #e74c3c; }
.btn-success { background: #2ecc71; }

/* --- Form Card --- */
.form-card {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.form-row label {
    min-width: 100px;
    color: #8899aa;
    font-size: 0.85rem;
}
.form-row input[type="text"],
.form-row input[type="color"] {
    padding: 6px 10px;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.85rem;
}
.form-row input[type="text"] { flex: 1; }
.form-row input[type="color"] { width: 50px; height: 32px; padding: 2px; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #8899aa;
    min-width: auto !important;
}
.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* --- Data Table --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #2a2a4a;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Event table column widths */
#event-table th:nth-child(1),
#event-table td:nth-child(1) { width: 60px; }
#event-table th:nth-child(4),
#event-table td:nth-child(4) { width: 80px; }
#event-table th:nth-child(5),
#event-table td:nth-child(5) { width: 240px; overflow: visible; }
.data-table th {
    background: #16213e;
    color: #8899aa;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}
.data-table td { font-size: 0.9rem; }
.data-table .actions { display: flex; gap: 6px; }
.inactive-row { opacity: 0.4; }
.color-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    vertical-align: middle;
}
.picker-empty {
    color: #667;
    font-size: 0.8rem;
    padding: 8px;
}
.picker-divider {
    height: 1px;
    background: #2a2a4a;
    margin: 6px 0;
}

/* --- GCal Sync Button --- */
.gcal-sync-btn {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: #2a2a4a;
    color: #667;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    display: none;
    z-index: 10;
}
.gcal-sync-btn:hover {
    color: #aab;
    border-color: #4a90d9;
}
.ooo-toggle-btn {
    position: fixed;
    bottom: 16px;
    right: 80px;
    background: #2a2a4a;
    color: #556;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    z-index: 10;
    opacity: 0.5;
}
.ooo-toggle-btn:hover {
    opacity: 0.9;
    color: #aab;
    border-color: #555;
}
.ooo-toggle-btn.active {
    opacity: 0.8;
    color: #e8a735;
    border-color: #e8a735;
    background: #2a2a3a;
}

/* --- Loading Overlay --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.5);
    z-index: 500;
    display: none;
    cursor: none;
}
.loading-overlay.active {
    display: block;
}
.loading-cursor {
    position: fixed;
    z-index: 501;
    display: none;
    pointer-events: none;
    align-items: center;
    gap: 10px;
}
.loading-cursor.active {
    display: flex;
}
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.loading-text {
    font-size: 0.8rem;
    color: #ccc;
    white-space: nowrap;
    line-height: 1.3;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Skill Tags --- */
.skill-tag {
    display: inline-block;
    background: #2a2a4a;
    color: #aab;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 3px;
    margin: 1px 2px;
}
.skill-check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.skill-check-grid label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #bbb;
    min-width: auto !important;
    cursor: pointer;
}
.skills-panel {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.skills-panel h3 {
    color: #fff;
    font-size: 1rem;
    margin: 0 0 10px;
}
.skill-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
    color: #ccc;
}
.skill-list-item input[type="text"] {
    padding: 3px 8px;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.8rem;
    width: 140px;
}

/* --- Mode Selection Dialog --- */
.mode-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.85);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}
.mode-dialog-overlay.active {
    display: flex;
}
.mode-dialog {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 32px 40px;
    text-align: center;
    min-width: 320px;
}
.mode-dialog h3 {
    color: #fff;
    margin: 0 0 24px;
    font-size: 1.2rem;
}
.mode-btn {
    display: block;
    width: 100%;
    padding: 16px;
    margin: 10px 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    color: #fff;
    transition: transform 0.15s;
}
.mode-btn:hover { transform: scale(1.03); }
.mode-btn-xuanfei {
    background: linear-gradient(135deg, #e74c3c, #9b59b6, #e74c3c);
    background-size: 200% 200%;
    font-size: 1.6rem;
    font-weight: 700;
    padding: 24px;
    animation: xuanfei-pulse 2s ease-in-out infinite, xuanfei-bg 4s ease infinite;
    letter-spacing: 8px;
}
@keyframes xuanfei-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(231,76,60,0.3); }
    50% { box-shadow: 0 0 30px rgba(231,76,60,0.8), 0 0 60px rgba(155,89,182,0.4); }
}
@keyframes xuanfei-bg {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
.mode-btn-normal {
    background: #333;
    font-size: 0.9rem;
    color: #999;
}

/* --- Xuanfei Wizard --- */
.xuanfei-wizard {
    border-color: #9b59b6;
}
.wizard-steps {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.wizard-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2a2a4a;
    color: #667;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}
.wizard-step-dot.active {
    background: #9b59b6;
    color: #fff;
}
.wizard-step-dot.done {
    background: #2ecc71;
    color: #fff;
}
.wizard-step-panel {
    display: none;
    min-height: 80px;
}
.wizard-step-panel.active {
    display: block;
}
.wizard-step-panel h4 {
    color: #aab;
    font-size: 0.85rem;
    margin: 0 0 10px;
    font-weight: 400;
}
.wizard-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}
.wizard-day-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.wizard-day-btn {
    padding: 6px 2px;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    background: #1a1a2e;
    color: #bbb;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    font-size: 0.75rem;
    transition: all 0.15s;
}
.wizard-day-btn:hover { border-color: #9b59b6; }
.wizard-day-btn.selected {
    background: #9b59b6;
    color: #fff;
    border-color: #9b59b6;
}
.wizard-day-btn.weekend { color: #666; }
.wizard-day-btn .day-num { font-weight: 600; font-size: 0.85rem; }
.wizard-day-btn .day-wd { font-size: 0.6rem; opacity: 0.7; }

/* --- Task Panel (Roster) --- */
.task-panel {
    background: #16213e;
    border: 2px solid #9b59b6;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    display: none;
}
.task-panel.active { display: block; }
.task-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.task-event-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}
.task-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}
.task-progress {
    margin-left: auto;
    font-size: 0.9rem;
    color: #9b59b6;
    font-weight: 600;
}
.task-skills {
    margin: 6px 0;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.task-skill-tag {
    background: #9b59b6;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 3px;
}
.task-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.task-unqualified { opacity: 0.25; }
.task-divider-row td {
    background: #2a2a4a !important;
    height: 3px !important;
    padding: 0 !important;
    border: none !important;
}
.task-day-highlight {
    background: rgba(155, 89, 182, 0.12) !important;
    animation: task-col-pulse 2.5s ease-in-out infinite;
    box-shadow: inset 0 0 0 1px rgba(155, 89, 182, 0.25);
}
@keyframes task-col-pulse {
    0%, 100% { background: rgba(155, 89, 182, 0.08) !important; }
    50% { background: rgba(155, 89, 182, 0.28) !important; }
}
/* Header cells for task days */
.task-day-header-highlight {
    background: rgba(155, 89, 182, 0.3) !important;
    color: #d4a0ff !important;
    animation: task-header-pulse 2.5s ease-in-out infinite;
}
.task-day-header-highlight .weekday-label {
    color: #b07de0 !important;
}
@keyframes task-header-pulse {
    0%, 100% { background: rgba(155, 89, 182, 0.2) !important; }
    50% { background: rgba(155, 89, 182, 0.45) !important; }
}

/* --- Unqualified Cell Tooltip --- */
.task-unqualified-tooltip {
    position: absolute;
    z-index: 200;
    background: #2a2a4a;
    color: #e74c3c;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: pre-line;
    pointer-events: none;
    display: none;
    transform: translate(-50%, -100%);
    box-shadow: 0 3px 12px rgba(0,0,0,0.5);
    border: 1px solid #e74c3c;
    max-width: 220px;
    line-height: 1.4;
}

/* --- Login & Change Password Pages --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a1a2e;
    margin: 0;
}
.login-card {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}
.login-title {
    color: #fff;
    font-size: 1.5rem;
    text-align: center;
    margin: 0 0 4px 0;
}
.login-subtitle {
    color: #667;
    font-size: 0.85rem;
    text-align: center;
    margin: 0 0 24px 0;
}
.login-field {
    margin-bottom: 16px;
}
.login-field label {
    display: block;
    color: #8899aa;
    font-size: 0.85rem;
    margin-bottom: 6px;
}
.login-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.login-field input:focus {
    outline: none;
    border-color: #4a90d9;
}
.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 8px;
}
.login-error {
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
}
.login-success {
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid #2ecc71;
    color: #2ecc71;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
}
.password-hint {
    color: #667;
    font-size: 0.75rem;
    margin: 4px 0 12px;
}
.login-back-link {
    display: block;
    text-align: center;
    color: #4a90d9;
    font-size: 0.85rem;
    margin-top: 16px;
    text-decoration: none;
}
.login-back-link:hover {
    color: #5ba0e9;
}

/* --- OOO/SOOO Tags --- */
.has-ooo {
    cursor: not-allowed !important;
}
.ooo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;  /* CRITICAL: don't interfere with drag-and-select */
    z-index: 1;
}
/* OOO/SOOO picker buttons */
.ooo-picker-btn {
    background: #2a2a4a !important;
    color: #e74c3c !important;
    border: 1px solid #e74c3c !important;
}
.ooo-picker-btn:hover {
    background: #3a3a5a !important;
}
.ooo-picker-btn.ooo-active {
    background: #e74c3c !important;
    color: #fff !important;
}
/* OOO tooltip */
.ooo-tooltip {
    position: absolute;
    z-index: 200;
    background: #2a2a4a;
    color: #ff6b6b;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    display: none;
    transform: translate(-50%, -100%);
    box-shadow: 0 3px 12px rgba(0,0,0,0.5);
    border: 1px solid #e74c3c;
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
}

/* --- Mobile (events page + wizard) --- */
@media (max-width: 640px) {
    .container { padding: 10px 12px; }

    /* Navbar hamburger */
    .navbar { padding: 10px 16px; flex-wrap: wrap; }
    .navbar-toggle { display: block; }
    .navbar-links { display: none; flex-direction: column; width: 100%; margin-top: 8px; gap: 4px; }
    .navbar-links.open { display: flex; }
    .navbar-links a { margin-left: 0; padding: 10px 12px; border-radius: 6px; display: block; }
    .navbar-links form { margin-left: 0; margin-top: 4px; }
    .navbar-links form button { width: 100%; padding: 10px; font-size: 0.85rem; }
    #current-user { margin-left: 0 !important; padding: 10px 12px; display: block; }

    /* Page header stacks vertically */
    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .page-header-actions { flex-wrap: wrap; }
    .page-header-actions .btn { flex: 1; text-align: center; }

    /* Event table: hide Color + Status columns, make Actions wrap */
    #event-table th:nth-child(1),
    #event-table td:nth-child(1),
    #event-table th:nth-child(4),
    #event-table td:nth-child(4) { display: none; }
    #event-table th:nth-child(5),
    #event-table td:nth-child(5) { width: auto; }
    .data-table th, .data-table td { padding: 8px; }
    .data-table .actions { flex-wrap: wrap; gap: 4px; }
    .btn-sm { padding: 6px 10px; }

    /* Wizard full-width */
    .xuanfei-wizard, .form-card { padding: 12px; }
    .wizard-day-grid { grid-template-columns: repeat(5, 1fr); }
    .wizard-nav { justify-content: space-between; }
    .wizard-nav .btn { flex: 1; text-align: center; }
    .form-row { flex-wrap: wrap; }
    .form-row label { min-width: unset; width: 100%; }
    .form-row input[type="text"] { width: 100%; }

    /* History panel past-month buttons full width */
    .hist-past-btn { flex: 1; text-align: center; }

    /* Mode buttons full width */
    .mode-btn { width: 100%; padding: 14px; font-size: 1rem; }
}
