@font-face {
    font-family: "Modam";
    src: url("../fonts/modam.woff2") format("woff2"), url("../fonts/modam.woff") format("woff");
    font-display: swap;
}

:root {
    --bg: #f6f7fc;
    --surface: #ffffff;
    --surface-soft: #f5f6ff;
    --surface-dark: #5b4ff7;
    --text: #23283a;
    --muted: #8b91a9;
    --primary: #5b4ff7;
    --primary-strong: #4e43ea;
    --accent: #0ea5a4;
    --success: #0f9f63;
    --danger: #ef4444;
    --border: rgba(83, 91, 130, 0.08);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --transition: 220ms ease;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Modam", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(91, 79, 247, 0.08), transparent 28%),
        radial-gradient(circle at bottom left, rgba(14, 165, 164, 0.08), transparent 28%),
        linear-gradient(180deg, #fafbff 0%, #f4f6fb 100%);
    overflow-x: hidden;
}

body.rail-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #f9faff;
    color: var(--text);
    transition: border-color var(--transition), transform var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(91, 79, 247, 0.24);
}

textarea {
    resize: vertical;
}

.ambient {
    position: fixed;
    border-radius: 999px;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
}

.ambient-one {
    top: -80px;
    right: -70px;
    width: 220px;
    height: 220px;
    background: rgba(91, 79, 247, 0.08);
}

.ambient-two {
    left: -60px;
    bottom: 20px;
    width: 180px;
    height: 180px;
    background: rgba(14, 165, 164, 0.08);
}

.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 278px minmax(0, 1fr);
    min-height: 100vh;
}

.guest-shell {
    grid-template-columns: minmax(0, 1fr);
}

.guest-shell .app-frame {
    padding: 0;
}

.app-frame {
    display: grid;
    gap: 16px;
    padding: 24px;
}

.side-rail {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
    padding: 22px 18px;
    color: rgba(255, 255, 255, 0.92);
    background: linear-gradient(180deg, #5b4ff7 0%, #4e43ea 100%);
}

.side-rail-head,
.brand-block,
.topbar,
.topbar-start,
.topbar-actions,
.section-head,
.filter-bar,
.inline-form,
.input-shell,
.date-input,
.panel-head,
.timer-card-head,
.timer-card-body,
.timer-card-actions,
.entry-card,
.entry-meta,
.install-sheet-actions,
.app-hero-meta,
.time-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.side-rail-head,
.topbar,
.section-head,
.panel-head,
.timer-card-head,
.timer-card-body,
.entry-card,
.entry-meta,
.install-sheet-actions {
    justify-content: space-between;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.brand-mark.large {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    font-size: 1.3rem;
}

.eyebrow,
.muted,
small {
    color: var(--muted);
}

.side-rail .eyebrow,
.side-rail small {
    color: rgba(255, 255, 255, 0.7);
}

.side-nav {
    display: grid;
    gap: 8px;
    align-content: start;
}

.side-nav a {
    padding: 14px 16px;
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.76);
    transition: background var(--transition), color var(--transition);
}

.side-nav a.active,
.side-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.user-chip,
.ghost-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
}

.ghost-link {
    justify-content: center;
}

.danger-link {
    color: #ffe5e9;
}

.topbar,
.card,
.mobile-panel,
.app-hero-main,
.app-hero-stats,
.install-sheet-card {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.84);
}

.topbar {
    padding: 20px 22px;
    border-radius: var(--radius-xl);
}

.topbar h1 {
    margin: 2px 0 0;
    font-size: 1.38rem;
}

.topbar-start {
    gap: 14px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f3f4ff;
    color: var(--primary);
}

.page-content {
    display: grid;
    gap: 16px;
    align-content: start;
    padding-bottom: 18px;
}

.card,
.mobile-panel,
.app-hero-main,
.app-hero-stats,
.install-sheet-card {
    border-radius: var(--radius-xl);
}

.card,
.mobile-panel {
    padding: 22px;
}

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-panel {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: 1.1fr 420px;
    gap: 18px;
}

.login-brand {
    min-height: 520px;
    padding: 36px;
    border-radius: 34px;
    color: #fff;
    display: grid;
    align-content: end;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 24%),
        linear-gradient(160deg, #5b4ff7 0%, #4e43ea 100%);
}

.login-brand h1 {
    margin: 8px 0 0;
    font-size: clamp(2rem, 3vw, 3rem);
}

.auth-card {
    display: grid;
    align-content: center;
}

.stack {
    display: grid;
    gap: 14px;
}

.section-head,
.panel-head {
    margin-bottom: 16px;
}

.section-head.stacked,
.panel-head.small {
    align-items: flex-start;
}

.form-grid,
.content-grid,
.stats-grid,
.panel-grid,
.hero-card,
.app-hero,
.mobile-panels {
    display: grid;
    gap: 16px;
}

.content-grid,
.panel-grid,
.mobile-panels,
.hero-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-span {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 8px;
}

.input-shell,
.date-input {
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #f9faff;
}

.input-shell input {
    padding: 14px 0;
    border: 0;
    background: transparent;
}

.btn,
.btn-light,
.btn-accent,
.primary-cta,
.icon-btn,
.text-action,
.chip-action {
    cursor: pointer;
    transition: transform var(--transition), opacity var(--transition), background var(--transition);
}

.btn,
.btn-light,
.btn-accent,
.primary-cta {
    min-height: 50px;
    padding: 12px 18px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn,
.primary-cta {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
}

.btn-light {
    background: #f3f4ff;
    color: var(--primary);
}

.btn-accent {
    background: linear-gradient(135deg, #0eb6b5, #0ea5a4);
    color: #fff;
}

.primary-cta {
    width: 100%;
}

.primary-cta.small {
    width: auto;
}

.primary-cta.light {
    background: #eef0ff;
    color: var(--primary);
}

.primary-cta.dark {
    background: #252b42;
    color: #fff;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: #f3f4ff;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn.subtle {
    background: #f7f8ff;
    color: var(--muted);
}

.text-action {
    background: transparent;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.muted-action {
    color: var(--muted);
}

.btn:hover,
.btn-light:hover,
.btn-accent:hover,
.primary-cta:hover,
.icon-btn:hover,
.chip-action:hover {
    transform: translateY(-1px);
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #fff;
}

.alert-success {
    color: var(--success);
}

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

.table-wrap {
    overflow: auto;
    border-radius: 18px;
    background: #fafbff;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(83, 91, 130, 0.06);
}

.list-row:last-child {
    border-bottom: 0;
}

.stat-card {
    display: grid;
    gap: 12px;
}

.stat-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stat-card strong {
    font-size: 1.4rem;
}

.hero-panel {
    padding: 18px;
    border-radius: 24px;
    background: #f6f7ff;
    display: grid;
    gap: 12px;
}

.summary-row,
.meta-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-caption,
.table-muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.empty-state {
    padding: 18px;
    border-radius: 20px;
    background: #f6f7ff;
    color: var(--muted);
    text-align: center;
}

.progress-line {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: #eceffd;
    overflow: hidden;
}

.progress-line span {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
}

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

th,
td {
    padding: 14px 12px;
    text-align: right;
    border-bottom: 1px solid rgba(83, 91, 130, 0.06);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 500;
}

.badge,
.status-badge,
.status-pill,
.chip-action,
.chip-static {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: #f3f4ff;
    color: var(--primary);
}

.chip-action.primary {
    background: var(--primary);
    color: #fff;
}

.chip-static {
    background: rgba(15, 159, 99, 0.12);
    color: var(--success);
}

.status-active,
.status-paid,
.status-employee_confirmed,
.status-submitted {
    background: rgba(15, 159, 99, 0.12);
    color: var(--success);
}

.status-paused,
.status-pending_employee_confirmation,
.status-in_payment,
.status-closed {
    background: rgba(91, 79, 247, 0.12);
    color: var(--primary);
}

.status-completed,
.status-draft {
    background: #f3f4ff;
    color: var(--primary);
}

.status-rejected,
.status-running {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

.app-hero {
    grid-template-columns: minmax(0, 1.2fr) 220px;
}

.app-hero-main {
    padding: 22px;
    color: #fff;
    background: linear-gradient(160deg, #5b4ff7 0%, #6b62ff 100%);
}

.app-hero-main .eyebrow,
.app-hero-main .app-hero-meta {
    color: rgba(255, 255, 255, 0.8);
}

.app-hero-main h2 {
    margin: 10px 0 0;
    line-height: 1.7;
    font-size: clamp(1.2rem, 2vw, 1.75rem);
}

.app-hero-meta {
    margin-top: 16px;
    flex-wrap: wrap;
}

.app-hero-stats {
    padding: 18px;
    display: grid;
    gap: 12px;
}

.app-hero-stats article {
    padding: 16px 18px;
    border-radius: 22px;
    background: #f6f7ff;
}

.app-hero-stats strong {
    display: block;
    color: var(--primary);
    font-size: 1.25rem;
}

.app-note,
.app-total {
    padding: 16px 18px;
    border-radius: 20px;
    background: #f6f7ff;
}

.summary-box {
    padding: 16px 18px;
    border-radius: 20px;
    background: #f6f7ff;
}

.app-note {
    color: var(--muted);
    font-size: 0.92rem;
}

.app-total span {
    display: block;
    color: var(--muted);
}

.app-total strong {
    display: block;
    margin-top: 8px;
    color: var(--primary);
}

.entry-mode-tabs,
.segmented,
.timer-actions,
.time-ranges,
.timer-list,
.entry-list,
.time-pair {
    display: grid;
    gap: 12px;
}

.entry-mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entry-mode-tabs input,
.segmented input {
    display: none;
}

.entry-mode-tabs label,
.segmented label {
    min-height: 48px;
    border-radius: 18px;
    background: #f3f4ff;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.entry-mode-tabs input:checked + label,
.segmented input:checked + label {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
}

.mode-panel[hidden] {
    display: none;
}

.datepicker-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(320px, 86vw);
    padding: 16px;
    border-radius: 22px;
    background: #fff;
    border: 1px solid var(--border);
    z-index: 30;
}

.datepicker-head,
.datepicker-weekdays,
.datepicker-grid {
    display: grid;
    gap: 8px;
}

.datepicker-head {
    grid-template-columns: 42px 1fr 42px;
    align-items: center;
    margin-bottom: 10px;
}

.datepicker-title {
    text-align: center;
    font-weight: 700;
}

.datepicker-weekdays,
.datepicker-grid {
    grid-template-columns: repeat(7, 1fr);
}

.datepicker-weekdays {
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.datepicker-day {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 14px;
    background: transparent;
}

.datepicker-day.selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #fff;
}

.datepicker-day.muted {
    color: rgba(139, 145, 169, 0.45);
}

.time-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1;
}

.timer-spotlight {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px;
    border-radius: 26px;
    background: #f7f8ff;
}

.timer-spotlight.is-running {
    background: linear-gradient(160deg, #5b4ff7 0%, #6b62ff 100%);
    color: #fff;
}

.timer-kicker {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.timer-spotlight.is-running .timer-kicker,
.timer-spotlight.is-running small {
    color: rgba(255, 255, 255, 0.78);
}

.timer-spotlight strong {
    display: block;
    margin-top: 6px;
    font-size: clamp(1.4rem, 2vw, 2rem);
}

.timer-indicator {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 79, 247, 0.16) 0%, rgba(91, 79, 247, 0.04) 70%);
}

.timer-spotlight.is-running .timer-indicator {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.16) 70%);
}

.timer-actions {
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
}

.timer-card,
.entry-card {
    padding: 16px 18px;
    border-radius: 24px;
    background: #fbfbff;
}

.timer-card-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 12px;
}

.timer-description,
.timer-card-head span,
.entry-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: inline-flex;
}

.bottom-nav {
    position: fixed;
    right: 14px;
    left: 14px;
    bottom: 12px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 10px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(83, 91, 130, 0.08);
}

.bottom-nav a {
    min-height: 62px;
    border-radius: 18px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.76rem;
}

.bottom-nav a.active {
    color: var(--primary);
    background: #f3f4ff;
}

.install-sheet {
    position: fixed;
    right: 18px;
    left: 18px;
    bottom: 92px;
    z-index: 60;
}

.install-sheet-card {
    padding: 18px;
}

.install-sheet-card h3,
.install-sheet-card p {
    margin: 0;
}

.install-sheet-card p {
    margin-top: 8px;
    color: var(--muted);
}

@media (max-width: 1180px) {
    .stats-grid,
    .panel-grid,
    .content-grid,
    .hero-card,
    .login-panel,
    .app-hero,
    .mobile-panels {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .side-rail {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(82vw, 320px);
        transform: translateX(100%);
        transition: transform var(--transition);
        z-index: 70;
    }

    body.rail-open .side-rail {
        transform: translateX(0);
    }

    .mobile-only {
        display: inline-flex;
    }

    .desktop-only {
        display: none;
    }

    .app-frame {
        padding: 14px 14px 88px;
    }
}

@media (max-width: 760px) {
    .form-grid,
    .time-pair,
    .stats-grid,
    .timer-actions {
        grid-template-columns: 1fr;
    }

    .topbar,
    .panel-head,
    .section-head,
    .filter-bar,
    .inline-form,
    .timer-card-head,
    .timer-card-body,
    .timer-card-actions,
    .entry-card,
    .entry-meta,
    .install-sheet-actions,
    .app-hero-meta,
    .time-range-row,
    .timer-spotlight {
        flex-direction: column;
        align-items: stretch;
    }

    .login-screen {
        padding: 14px;
    }

    .login-brand {
        min-height: 220px;
        padding: 28px;
    }

    .topbar,
    .card,
    .mobile-panel,
    .app-hero-main,
    .app-hero-stats,
    .install-sheet-card {
        border-radius: 24px;
    }
}
