:root {
    --bg: #0f172a;
    --bg-soft: #f1f5f9;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-strong: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --accent: #f97316;
    --accent-strong: #ea580c;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
        linear-gradient(180deg, #eff6ff 0%, #f8fafc 40%, #eef2ff 100%);
    min-height: 100vh;
}

button,
input,
select {
    font: inherit;
}

[hidden] {
    display: none !important;
}

.login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(8px);
    z-index: 9999;
}

.login-panel {
    width: min(100%, 420px);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 28px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.login-badge,
.eyebrow,
.panel-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-panel h1,
.app-title,
.panel-head h2 {
    margin: 0;
}

.login-subtitle,
.app-subtitle,
.holiday-text,
.metric-label,
.detail-label,
.select-group label,
.header-actions,
.status-pill {
    color: var(--text-muted);
}

.login-subtitle {
    margin: 12px 0 24px;
    line-height: 1.6;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.text-input,
.select-group select {
    width: 100%;
    border: 1px solid #dbe3f0;
    border-radius: 14px;
    padding: 13px 14px;
    background: #fff;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.text-input:focus,
.select-group select:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.6);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.login-error {
    min-height: 20px;
    margin-top: 14px;
    color: var(--danger);
    font-size: 14px;
}

.app-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
}

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

.app-title {
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.1;
}

.app-subtitle {
    margin: 10px 0 0;
    max-width: 700px;
    line-height: 1.6;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.identity-card {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(148, 163, 184, 0.12);
}

.holiday-banner,
.panel,
.metric-card,
.status-pill {
    background: rgba(255, 255, 255, 0.92);
}

.holiday-banner {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px 20px;
    border-left: 6px solid var(--warning);
    border-radius: 18px;
    margin-bottom: 24px;
    box-shadow: 0 14px 35px rgba(245, 158, 11, 0.12);
}

.holiday-icon {
    font-size: 24px;
}

.holiday-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.page-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.overview-grid,
.content-grid {
    display: grid;
    gap: 24px;
}

.overview-grid {
    grid-template-columns: minmax(360px, 420px) 1fr;
}

.content-grid {
    grid-template-columns: 1.05fr 1fr;
}

.panel {
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.75);
    min-width: 0;
}

.panel-highlight {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.96));
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.panel-head h2 {
    font-size: 22px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.auto-slot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card {
    border-radius: 18px;
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.metric-label {
    display: block;
    font-size: 13px;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 24px;
}

.latest-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(248, 250, 252, 0.9);
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.85);
}

.detail-row-column {
    align-items: flex-start;
    flex-direction: column;
}

.detail-label {
    font-size: 13px;
    font-weight: 600;
}

.text-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

.action-row {
    margin-top: 20px;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 700;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.7;
    cursor: default;
    transform: none;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.26);
}

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

.btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 26px rgba(249, 115, 22, 0.24);
}

.btn-accent:hover {
    background: var(--accent-strong);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.75);
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.map-panel {
    min-height: 100%;
}

.map-container {
    min-height: 420px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #dbeafe;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 420px;
}

.table-shell {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 14px 12px;
    font-size: 14px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background: #1e3a8a;
    color: #fff;
    font-size: 13px;
    letter-spacing: 0.03em;
}

.data-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.calendar-toolbar {
    display: flex;
    gap: 14px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.select-group {
    min-width: 130px;
}

.select-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
}

.calendar-shell {
    overflow-x: hidden;
    padding: 0;
}

.calendar {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 8px;
    background: transparent;
}

.calendar th {
    background: transparent;
    padding: 0 8px 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.06em;
}

.calendar td {
    width: 14.2%;
    height: 96px;
    border: none;
    vertical-align: top;
    padding: 0;
    cursor: pointer;
    background: transparent;
}

.calendar td.is-empty {
    cursor: default;
}

.calendar-day-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    border: 1px solid rgba(219, 234, 254, 0.9);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(148, 163, 184, 0.12);
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.calendar td:hover .calendar-day-card {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.75);
}

.calendar td.is-empty::after {
    content: '';
    display: block;
    height: 100%;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.9);
    border: 1px dashed rgba(226, 232, 240, 0.95);
}

.calendar-day-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.calendar-day-bottom {
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

.day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.92);
}

.dot.green {
    background: #22c55e;
}

.dot.blue {
    background: #2563eb;
}

.dot.red {
    background: #ef4444;
}

.day-popup {
    position: absolute;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.24);
    padding: 20px;
    border-radius: 20px;
    min-width: 250px;
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    animation: fadeIn 0.16s ease-out;
}

.day-popup h4 {
    margin: 0 24px 14px 0;
    font-size: 14px;
    color: #0f172a;
}

.day-popup .close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-muted);
}

.day-popup .popup-row {
    margin-top: 10px;
    font-size: 14px;
    color: #334155;
}

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

@media (max-width: 1120px) {
    .overview-grid,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .map-container,
    #map {
        min-height: 360px;
    }
}

@media (max-width: 768px) {
    .app-shell {
        padding: 18px;
    }

    .app-header {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .identity-card {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .auto-slot-grid {
        grid-template-columns: 1fr;
    }

    .detail-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .select-group {
        width: 100%;
    }

    .calendar-shell {
        overflow-x: visible;
        padding: 0;
    }

    .calendar {
        min-width: 100%;
        border-spacing: 6px;
        table-layout: fixed;
    }

    .calendar th {
        padding: 0 2px 6px;
        font-size: 11px;
        letter-spacing: 0.03em;
    }

    .calendar td {
        height: 84px;
    }

    .calendar-day-card {
        padding: 10px 8px;
        border-radius: 14px;
    }

    .day-number {
        width: 28px;
        height: 28px;
        border-radius: 10px;
        font-size: 13px;
    }

    .calendar-day-bottom {
        font-size: 10px;
        line-height: 1.3;
    }

    .dot {
        width: 10px;
        height: 10px;
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.92);
    }

    .day-popup {
        min-width: 220px;
        max-width: calc(100vw - 24px);
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .calendar {
        border-spacing: 4px;
    }

    .calendar th {
        font-size: 10px;
        padding-bottom: 4px;
    }

    .calendar td {
        height: 72px;
    }

    .calendar-day-card {
        padding: 8px 6px;
        border-radius: 12px;
    }

    .day-number {
        width: 24px;
        height: 24px;
        border-radius: 8px;
        font-size: 12px;
    }

    .calendar-day-bottom {
        font-size: 9px;
    }

    .dot {
        width: 9px;
        height: 9px;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92);
    }
}
