@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
    --bg: #060914;
    --panel: rgba(12, 19, 41, 0.85);
    --panel-border: rgba(255, 255, 255, 0.08);
    --accent: #f3ba2f;
    --accent-soft: rgba(243, 186, 47, 0.3);
    --text: #f5f5f5;
    --muted: rgba(245, 245, 245, 0.6);
    --grid-line: rgba(255, 255, 255, 0.08);
    --holiday: #ff6b81;
    --work: #3dd598;
    --slot-height: 22px;
    --day-label-height: 2.2rem;
    --transition: 180ms ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}
body {
    min-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
    background: radial-gradient(circle at 20% 20%, #132344, #060914);
    color: var(--text);
    display: flex;
    justify-content: center;
    padding: 2rem;

}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.form-grid label,
.description-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.25rem;
}

.form-grid input,
.description-field textarea {
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.95rem;
}

.description-field textarea {
    resize: vertical;
    min-height: 90px;
}

.page-shell {
    width: min(100%, 1400px);
}

.app-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-self: end;
    text-align: right;
}

.eyebrow {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

h1 {
    font-weight: 600;
    font-size: clamp(1.75rem, 2.5vw, 2.6rem);
}

.progress-chip {
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 0.6rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    gap: 0.4rem;
    align-items: baseline;
}

.progress-chip .target {
    color: var(--muted);
    font-size: 0.95rem;
}

.week-meta {
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    color: var(--muted);
    justify-self: center;
    text-align: center;
}

#week-label {
    min-width: 240px;
    flex: 0 0 240px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.ghost-btn,
.icon-btn,
.primary-btn {
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.icon-btn {
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
}

.primary-btn {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1200;
    font-weight: 600;
}

.primary-btn.full {
    width: 100%;
    justify-content: center;
}

.ghost-btn:hover,
.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

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

.ghost-btn.compact {
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
}

.ghost-btn.danger {
    border-color: #ff8888;
    color: #ff8888;
}
.ghost-btn.danger:hover {
    background: rgba(255, 136, 136, 0.1);
}

.user-chip {
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.04);
}

.planner {
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 1rem;
    background: rgba(6, 9, 20, 0.6);
    overflow-x: auto;
}

.yearly-progress {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--muted);
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.yearly-progress strong {
    color: var(--text);
    margin-left: 0.35rem;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: 110px repeat(5, minmax(200px, 1fr));
    gap: 0.75rem;
    align-items: start;
}

.time-column,
.day-column {
    display: flex;
    flex-direction: column;
}

.time-column {
    color: var(--muted);
    padding-left: 0.5rem;
}

.day-label-spacer {
    min-height: var(--day-label-height);
}

.time-labels {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.time-hour-block {
    display: flex;
    flex-direction: column;
}

.time-label {
    height: calc(var(--slot-height) * 2);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    font-size: 0.75rem;
    color: var(--muted);
    padding-right: 0.5rem;
}

.time-label.major {
    font-weight: 600;
    color: var(--text);
}

.time-label.minor {
    font-size: 0.7rem;
}

.day-column {
    border-left: 1px solid var(--grid-line);
    padding-left: 0.5rem;
    gap: 0.5rem;
    position: relative;
    z-index: 0;
}

.day-column.today::before {
    content: '';
    position: absolute;
    inset: -0.35rem -0.6rem -0.35rem 0.15rem;
    background: linear-gradient(180deg, rgba(243, 186, 47, 0.18), rgba(243, 186, 47, 0.05));
    border-radius: 18px;
    z-index: -1;
    pointer-events: none;
}

.day-column.today .day-label {
    color: var(--accent);
}

.day-label {
    font-weight: 500;
    min-height: var(--day-label-height);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
}

.day-label-name {
    flex: 1;
}

.day-label-hours {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 600;
    white-space: nowrap;
}

.day-column.today .day-label-hours {
    color: var(--accent);
}

.slot-wrapper {
    position: relative;
    flex: 1;
}

.time-slot {
    height: var(--slot-height);
    border-bottom: 1px dashed var(--grid-line);
    cursor: crosshair;
    transition: background var(--transition);
}

.time-slot:nth-child(4n) {
    border-bottom: 1px solid var(--grid-line);
}

.entry-block {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 10px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #0b0b0b;
    cursor: pointer;
    overflow: visible;
    z-index: 2;
}

.entry-block.work {
    background: var(--work);
}

.entry-block.holiday {
    background: var(--holiday);
}

.entry-summary {
    flex: 1;
}

.resize-handle {
    position: absolute;
    left: 0%;
    right: 0%;
    height: 6px;
    background: rgba(0, 0, 0, 0);
    border: none;
    border-radius: 999px;
    padding: 0;
    cursor: ns-resize;
    pointer-events: auto;
    transition: background var(--transition);
    appearance: none;
}

.resize-handle:hover {
    background: rgba(0, 0, 0, 0);
}

.resize-handle.start {
    top: -4px;
}

.resize-handle.end {
    bottom: -4px;
}

.resize-handle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.entry-preview {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px dashed rgba(255, 255, 255, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 80ms ease;
    z-index: 3;
}

.entry-preview.active {
    opacity: 1;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 15, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    z-index: 100;
}

.modal.hidden,
.toast.hidden {
    display: none;
}

.modal-card {
    width: min(360px, 100%);
    background: #0c1329;
    border-radius: 18px;
    border: 1px solid var(--panel-border);
    padding: 1.5rem;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5);
    animation: floatIn 220ms ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.modal-range {
    color: var(--muted);
    margin-bottom: 1rem;
}

fieldset {
    border: none;
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

legend {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-size: 0.9rem;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 9, 20, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    z-index: 200;
}

.auth-card {
    width: min(420px, 100%);
    background: rgba(12, 19, 41, 0.95);
    border-radius: 24px;
    border: 1px solid var(--panel-border);
    padding: 2rem;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.55);
}

.auth-card h2 {
    margin: 0.4rem 0 1.2rem;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.3rem;
    border-radius: 999px;
}

.auth-tab {
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 999px;
    padding: 0.45rem 0.2rem;
    cursor: pointer;
    font-weight: 600;
    transition: background var(--transition), color var(--transition);
}

.auth-tab.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

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

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.auth-form input {
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 1rem;
}

.auth-form input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .app-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 1rem;
    }

    .brand-block {
        text-align: center;
    }

    .header-actions {
        justify-content: center;
        justify-self: center;
        text-align: center;
    }

    .week-meta {
        width: 100%;
        order: 3;
        margin-top: 0.5rem;
    }

    #week-label {
        min-width: 0;
        flex: 0 1 auto;
    }

    .yearly-progress {
        flex-direction: column;
        gap: 0.5rem;
    }

    .calendar-grid {
        grid-template-columns: 60px repeat(5, minmax(200px, 1fr));
    }
}

@media (max-width: 520px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
