:root {
    --bg: #ffffff;
    --bg-soft: #f8fafc;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-alt: #f8fbff;
    --panel-border: rgba(71, 85, 105, 0.14);
    --line: rgba(148, 163, 184, 0.22);
    --text: #0f172a;
    --muted: #64748b;
    --muted-strong: #334155;
    --brand: #4f46e5;
    --brand-strong: #4338ca;
    --accent: #0f766e;
    --danger: #e11d48;
    --warning: #d97706;
    --success: #059669;
    --shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --sidebar-width: 270px;
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.06), transparent 24%),
        radial-gradient(circle at 85% 10%, rgba(15, 118, 110, 0.05), transparent 18%),
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "Inter", sans-serif;
    background: transparent;
    position: relative;
}

a { color: inherit; }

.app-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bg-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(24px);
    opacity: 0.8;
}

.bg-orb-one {
    width: 30rem;
    height: 30rem;
    top: -7rem;
    left: -6rem;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.12), transparent 65%);
}

.bg-orb-two {
    width: 28rem;
    height: 28rem;
    right: -8rem;
    top: 6rem;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.08), transparent 65%);
}

.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 80%);
}

.app-shell {
    width: min(1480px, calc(100vw - 24px));
    margin: 0 auto;
    padding: 12px 0;
    position: relative;
    z-index: 1;
}

.app-shell:not(.app-shell-auth) {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.sidebar,
.page-topbar,
.panel,
.hero-card,
.hero-dashboard-copy,
.metric-strip,
.quick-link,
.user-chip,
.ghost-button {
    border: 1px solid var(--panel-border);
    background: var(--panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.sidebar {
    min-height: calc(100vh - 24px);
    border-radius: var(--radius-xl);
    padding: 22px 18px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    position: sticky;
    top: 12px;
}

.sidebar-head {
    display: grid;
    gap: 14px;
}

.sidebar-head h1,
h2,
h3 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: -0.04em;
}

.sidebar-head h1 {
    font-size: 1.6rem;
    line-height: 1;
}

.store-switch-form {
    width: 100%;
}

.store-switch-label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.82rem;
}

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

.sidebar-nav a,
button,
.button-link,
.ghost-button {
    appearance: none;
    border: 0;
    border-radius: 14px;
    padding: 13px 14px;
    font-family: "Inter", sans-serif;
    font-size: 0.96rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.sidebar-nav a {
    background: #ffffff;
    color: var(--muted-strong);
    border: 1px solid var(--line);
}

.sidebar-nav a:hover,
.sidebar-nav a.is-active,
button:hover,
.button-link:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.sidebar-nav a.is-active {
    color: var(--brand-strong);
    background: rgba(79, 70, 229, 0.06);
    border-color: rgba(79, 70, 229, 0.18);
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.08);
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.18);
}

.secondary-button,
.ghost-button {
    color: var(--text);
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.sidebar-user {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--panel-alt);
}

.sidebar-user span {
    color: var(--muted);
    font-size: 0.92rem;
}

.shell-main {
    min-width: 0;
    display: grid;
    gap: 18px;
}

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

.page-topbar h2 {
    font-size: 1.4rem;
}

.container {
    display: grid;
    gap: 18px;
}

.panel,
.hero-card,
.hero-dashboard-copy,
.metric-strip {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.panel,
.hero-dashboard-copy,
.metric-strip {
    padding: 24px;
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) minmax(340px, 430px);
    gap: 24px;
    padding: 28px;
    min-height: calc(100vh - 120px);
}

.login-hero {
    align-items: stretch;
}

.hero-copy {
    display: grid;
    align-content: center;
    gap: 18px;
    min-width: 0;
}

.hero-copy h2,
.hero-dashboard h2 {
    font-size: clamp(2.2rem, 4vw, 4.2rem);
    line-height: 0.94;
    max-width: 11ch;
}

.hero-copy p,
.hero-dashboard-copy p {
    margin: 0;
    max-width: 62ch;
    color: var(--muted);
    line-height: 1.72;
    font-size: 1rem;
}

.hero-note {
    display: grid;
    gap: 8px;
}

.hero-stat-row,
.metric-strip,
.grid-two,
.quick-links,
.asset-preview-grid,
.grid-form,
.calendar-month {
    display: grid;
    gap: 16px;
}

.hero-stat-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-stat,
.metric-card,
.planning-row,
.shift-card,
.drag-card,
.weekly-corner,
.weekly-header,
.weekly-employee,
.weekly-cell,
.drop-lane,
.status-note,
.calendar-day {
    border-radius: 20px;
}

.hero-stat,
.metric-card,
.planning-row,
.shift-card,
.drag-card,
.weekly-corner,
.weekly-header,
.weekly-employee {
    border: 1px solid var(--line);
    background: var(--panel-alt);
}

.hero-stat,
.metric-card {
    padding: 18px;
}

.hero-stat span,
.metric-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.hero-stat strong,
.metric-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: clamp(1.05rem, 1.5vw, 1.35rem);
    line-height: 1.25;
}

.metric-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.92rem;
}

.form-card {
    align-content: center;
    gap: 16px;
}

.form-card-head {
    display: grid;
    gap: 10px;
}

.form-card h3 {
    font-size: 1.65rem;
}

.credits-inline {
    color: var(--text);
    font-weight: 700;
}

.hero-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
    gap: 18px;
}

.hero-dashboard-copy {
    display: grid;
    align-content: center;
    gap: 14px;
    min-height: 280px;
}

.hero-actions,
.inline-actions,
.legend,
.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
}

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

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

.quick-link {
    position: relative;
    display: grid;
    gap: 10px;
    padding: 24px;
    text-decoration: none;
    overflow: hidden;
}

.quick-link strong {
    font-size: 1.06rem;
}

.quick-link p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.form-card,
.inline-form,
.stack-form,
.mini-form,
.planning-editor {
    display: grid;
    gap: 14px;
}

.grid-form {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted-strong);
    font-size: 0.94rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
    padding: 14px 16px;
    font: inherit;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background: #ffffff;
}

select[multiple] {
    min-height: 170px;
}

::placeholder {
    color: #94a3b8;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.eyebrow,
.hero-kicker,
.quick-link-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.76rem;
    font-weight: 700;
}

.eyebrow { color: var(--accent); }
.hero-kicker,
.quick-link-label { color: var(--brand); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid transparent;
}

.badge-standard { background: rgba(79, 70, 229, 0.08); color: #4338ca; border-color: rgba(79, 70, 229, 0.12); }
.badge-delay { background: rgba(217, 119, 6, 0.08); color: #b45309; border-color: rgba(217, 119, 6, 0.12); }
.badge-early { background: rgba(5, 150, 105, 0.08); color: #047857; border-color: rgba(5, 150, 105, 0.12); }
.badge-off { background: rgba(148, 163, 184, 0.12); color: #475569; border-color: rgba(148, 163, 184, 0.14); }
.badge-half { background: rgba(217, 119, 6, 0.08); color: #b45309; border-color: rgba(217, 119, 6, 0.12); }
.badge-alert { background: rgba(225, 29, 72, 0.08); color: #be123c; border-color: rgba(225, 29, 72, 0.12); }

.calendar-grid,
.drag-board {
    display: grid;
    gap: 14px;
}

.calendar-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.shift-card,
.planning-row,
.drag-card {
    padding: 18px;
}

.shift-card h3 {
    margin-bottom: 8px;
}

.shift-card p {
    margin: 6px 0 0;
    color: var(--muted-strong);
    line-height: 1.55;
}

.shift-card.delay,
.drag-card.compact.delayed_start,
.drag-card.compact.morning_open_delay,
.drag-card.compact.afternoon_open_delay { border-left: 4px solid #d97706; }
.shift-card.early,
.drag-card.compact.early_exit,
.drag-card.compact.morning_close_early,
.drag-card.compact.evening_close_early { border-left: 4px solid #059669; }
.shift-card.off,
.drag-card.compact.day_off { border-left: 4px solid #64748b; }
.drag-card.compact.standard { border-left: 4px solid var(--brand-strong); }

.alert {
    border-radius: 18px;
    padding: 14px 16px;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(225, 29, 72, 0.08);
    color: #9f1239;
    border-color: rgba(225, 29, 72, 0.12);
}

.alert-warning {
    background: rgba(217, 119, 6, 0.08);
    color: #9a3412;
    border-color: rgba(217, 119, 6, 0.12);
}

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

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

.status-note {
    padding: 14px 16px;
    color: var(--muted-strong);
    background: #ffffff;
    border: 1px solid var(--line);
}

.info-stack {
    display: grid;
    gap: 10px;
}

.info-stack p {
    margin: 0;
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--panel-alt);
    border: 1px solid var(--line);
}

.info-stack strong {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 4px;
    overflow: hidden;
}

.panel { overflow-x: auto; }

thead th {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

th,
td {
    padding: 16px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

tbody tr:hover {
    background: rgba(79, 70, 229, 0.03);
}

thead th {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.footer {
    padding: 10px 2px 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.hidden { display: none; }

.weekly-editor-wrap { overflow-x: auto; }

.weekly-editor {
    display: grid;
    grid-template-columns: 220px repeat(var(--day-count, 6), minmax(190px, 1fr));
    gap: 12px;
    min-width: 1200px;
}

.weekly-corner,
.weekly-header,
.weekly-employee {
    padding: 16px;
    font-weight: 700;
}

.weekly-header { text-align: center; }

.weekly-cell,
.drop-lane {
    min-height: 116px;
    padding: 10px;
    border: 1px dashed rgba(79, 70, 229, 0.18);
    background: var(--panel-alt);
    transition: border-color 150ms ease, background 150ms ease;
}

.weekly-cell.drag-over,
.drop-lane.drag-over {
    border-color: rgba(79, 70, 229, 0.35);
    background: rgba(79, 70, 229, 0.06);
}

.drag-card {
    cursor: grab;
    display: grid;
    gap: 8px;
}

.drag-card.compact { min-height: 90px; }

.cell-placeholder {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 10px 4px;
}

.app-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 40;
}

.app-modal.hidden {
    display: none;
}

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.24);
}

.app-modal-card {
    position: relative;
    width: min(92vw, 440px);
    padding: 28px;
    border-radius: 28px;
    background: #ffffff;
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    display: grid;
    gap: 16px;
}

.calendar-month {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-month-head {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.calendar-day {
    min-height: 160px;
    padding: 14px;
    border: 1px solid var(--line);
    background: #ffffff;
    display: grid;
    align-content: start;
    gap: 12px;
}

.calendar-day.is-outside {
    background: #f8fafc;
    opacity: 0.68;
}

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

.calendar-day-body {
    display: grid;
    gap: 8px;
}

.calendar-event {
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(79, 70, 229, 0.08);
    color: #3730a3;
    font-size: 0.9rem;
    font-weight: 600;
}

.calendar-event.is-off {
    background: rgba(15, 118, 110, 0.08);
    color: #0f766e;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}

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

    .sidebar {
        min-height: auto;
        position: static;
    }
}

@media (max-width: 900px) {
    .hero-dashboard,
    .hero-card,
    .grid-two,
    .hero-stat-row,
    .quick-links,
    .metric-strip,
    .asset-preview-grid,
    .grid-form,
    .calendar-month {
        grid-template-columns: 1fr;
    }

    .hero-copy h2,
    .hero-dashboard h2 {
        max-width: 100%;
    }
}

@media (max-width: 820px) {
    .app-shell {
        width: min(100vw - 18px, 1480px);
    }

    .sidebar,
    .page-topbar,
    .panel,
    .hero-card,
    .hero-dashboard-copy,
    .metric-strip {
        border-radius: 24px;
    }

    .sidebar,
    .page-topbar,
    .panel,
    .hero-card,
    .hero-dashboard-copy,
    .metric-strip {
        padding: 18px;
    }

    .weekly-editor {
        grid-template-columns: 160px repeat(var(--day-count, 6), minmax(160px, 1fr));
        min-width: 1040px;
    }
}
