:root {
    --radius: 0.625rem;
    --background: oklch(0.985 0.012 250);
    --foreground: oklch(0.28 0.03 262);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.28 0.03 262);
    --primary: oklch(0.55 0.16 255);
    --primary-foreground: oklch(0.99 0.005 250);
    --secondary: oklch(0.95 0.02 250);
    --secondary-foreground: oklch(0.32 0.06 255);
    --muted: oklch(0.96 0.015 250);
    --muted-foreground: oklch(0.48 0.03 262);
    --accent: oklch(0.94 0.03 250);
    --accent-foreground: oklch(0.35 0.08 255);
    --destructive: oklch(0.577 0.245 27.325);
    --border: oklch(0.9 0.02 250);
    --input: oklch(0.9 0.02 250);
    --ring: oklch(0.62 0.12 255);
    --sidebar: oklch(0.975 0.02 248);
    --sidebar-width: 19rem;
    --success: oklch(0.94 0.05 145);
    --success-fg: oklch(0.35 0.08 145);
    --danger: oklch(0.94 0.04 25);
    --danger-fg: oklch(0.45 0.16 25);
    --link: oklch(0.48 0.14 255);
    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100svh;
    font-family: Geist, Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 1.08rem;
    line-height: 1.5;
    background: var(--background);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

.shell {
    display: flex;
    min-height: 100svh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: none;
    width: var(--sidebar-width);
    flex-shrink: 0;
    height: 100svh;
    border-right: 1px solid var(--border);
    background: var(--sidebar);
    padding: 1rem 0.75rem;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
}

.sidebar-brand-mark {
    width: 1.92rem;
    height: 1.92rem;
    border-radius: calc(var(--radius) - 2px);
    background: linear-gradient(145deg, #3b82f6, #6366f1);
    color: var(--primary-foreground);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.sidebar-brand-mark svg {
    width: 1.08rem;
    height: 1.08rem;
}

.sidebar-brand-text {
    display: grid;
    line-height: 1.15;
}

.sidebar-brand strong {
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.sidebar-brand small {
    font-size: 0.81rem;
    color: var(--muted-foreground);
}

.nav-label {
    margin: 0.35rem 0 0.15rem;
    padding: 0 0.75rem;
    font-size: 0.81rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}

.sidebar-nav {
    display: grid;
    gap: 0.25rem;
}

.sidebar-user {
    margin-top: auto;
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem 0.75rem 0.25rem;
    border-top: 1px solid var(--border);
}

.sidebar-user strong {
    font-size: 0.945rem;
}

.sidebar-user form {
    margin-top: 0.45rem;
}

.sidebar-user .btn {
    width: 100%;
}

.auth-card .btn {
    width: 100%;
}

.auth-page {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 1.5rem 1rem;
    background: var(--background);
}

.auth-card {
    width: min(100%, 32rem);
    margin-top: 0;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: fit-content;
    font-size: 0.945rem;
    font-weight: 500;
    cursor: pointer;
}

.check input {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    text-decoration: none;
    font-size: 0.945rem;
    font-weight: 500;
    color: var(--foreground);
}

.sidebar-nav a:hover {
    background: var(--accent);
}

.sidebar-nav a.is-active {
    background: color-mix(in oklab, var(--primary) 10%, white);
    color: var(--foreground);
    font-weight: 600;
}

.sidebar-nav svg {
    width: 1.2rem;
    height: 1.2rem;
    opacity: 0.85;
    flex-shrink: 0;
}

.workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: oklch(0.975 0.015 250);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 3.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.topbar-start {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.icon-btn {
    width: 2.28rem;
    height: 2.28rem;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
}

.icon-btn svg {
    width: 1.08rem;
    height: 1.08rem;
}

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

.topbar-sep {
    width: 1px;
    align-self: stretch;
    margin: 0.35rem 0;
    background: var(--border);
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    font-size: 0.945rem;
}

.crumbs span {
    color: var(--muted-foreground);
}

.crumbs strong {
    font-weight: 500;
    color: var(--foreground);
}

.topbar-end {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.profile {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.4rem 0.25rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    background: var(--background);
}

.profile-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--secondary);
    font-size: 0.81rem;
    font-weight: 600;
}

.profile-name {
    font-size: 0.945rem;
    font-weight: 500;
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    text-decoration: none;
}

a.profile-name:hover {
    color: var(--link);
}

.profile form {
    margin: 0;
}

.content {
    flex: 1;
    padding: 1.5rem 1.5rem 1.75rem;
    width: 100%;
    max-width: 90rem;
    margin: 0 auto;
}

.site-footer {
    position: relative;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: linear-gradient(180deg, #fff 0%, #eef4ff 100%);
    padding: 1.25rem 1.5rem 1.4rem;
}

.site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #14b8a6 42%, #f59e0b 72%, #8b5cf6);
}

.site-footer-inner {
    width: 100%;
    max-width: 90rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    flex-wrap: wrap;
}

.site-footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.site-footer-mark {
    width: 0.7rem;
    height: 2.2rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #3b82f6, #14b8a6 55%, #f59e0b);
    flex-shrink: 0;
}

.site-footer-brand strong {
    display: block;
    font-size: 0.945rem;
    font-weight: 600;
}

.site-footer-brand span {
    display: block;
    margin-top: 0.15rem;
    color: var(--muted-foreground);
    font-size: 0.81rem;
}

.site-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.site-footer-nav a {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--link);
    font-size: 0.81rem;
    font-weight: 500;
    text-decoration: none;
}

.site-footer-nav a:hover {
    background: #e8f1ff;
    border-color: #bfdbfe;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-head h1 {
    margin: 0;
    font-size: 1.944rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.page-head p {
    margin: 0.35rem 0 0;
    color: var(--muted-foreground);
    font-size: 0.945rem;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.stat {
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    background: var(--card);
    box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.stat p {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.945rem;
}

.stat strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.944rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.stat-month {
    background: linear-gradient(180deg, #e8f1ff 0%, #fff 58%);
}

.stat-month strong {
    color: #2563eb;
}

.stat-today {
    background: linear-gradient(180deg, #e5f8f4 0%, #fff 58%);
}

.stat-today strong {
    color: #0f766e;
}

.stat-cases {
    background: linear-gradient(180deg, #fff4e5 0%, #fff 58%);
}

.stat-cases strong {
    color: #c2410c;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-head h2 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0.15rem 0.55rem;
    border-radius: calc(var(--radius) - 4px);
    background: var(--secondary);
    color: var(--secondary-foreground);
    font-size: 0.81rem;
    font-weight: 500;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    background: var(--card);
    color: var(--card-foreground);
    box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}

.card-header {
    display: grid;
    gap: 0.35rem;
}

.card-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-desc {
    margin: 0;
    font-size: 0.945rem;
    color: var(--muted-foreground);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.28rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: calc(var(--radius) - 2px);
    background: var(--primary);
    color: var(--primary-foreground);
    font: inherit;
    font-size: 0.945rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
    filter: brightness(1.08);
}

.btn-outline {
    background: var(--background);
    color: var(--foreground);
    border-color: var(--border);
    box-shadow: 0 1px 2px rgb(0 0 0 / 3%);
}

.btn-outline:hover {
    background: var(--accent);
    filter: none;
}

.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background: var(--accent);
    filter: none;
}

.btn-nav {
    min-width: 4.5rem;
    min-height: 2rem;
    font-size: 1.08rem;
}

.month-nav {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.month-nav .nav-links {
    display: flex;
    gap: 0.5rem;
}

.calendars {
    display: flex;
    flex-wrap: wrap;
    gap: 3.75rem;
    justify-content: center;
    align-items: flex-start;
}

.calendar {
    flex: 0 1 27.625rem;
    width: 100%;
    max-width: 27.625rem;
}

.calendar-title {
    margin: 0 0 0.65rem;
    font-size: 1.026rem;
    font-weight: 600;
    text-align: center;
}

.weekdays,
.days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.3rem;
}

.weekdays span {
    text-align: center;
    font-size: 0.756rem;
    font-weight: 600;
    color: var(--muted-foreground);
    padding-bottom: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.day {
    aspect-ratio: 2.4 / 1;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    background: var(--card);
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.2rem 0.3rem;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

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

.day.out {
    opacity: 0.4;
}

.day.today {
    border-color: var(--ring);
}

.day.selected {
    background: var(--secondary);
    border-color: var(--primary);
}

.day-number {
    font-size: 0.864rem;
    font-weight: 600;
    line-height: 1;
}

.day-marks {
    display: flex;
    gap: 0.18rem;
    align-items: center;
    min-height: 0.45rem;
}

.day-mark {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--primary);
    flex-shrink: 0;
}

.day-mark.empty-mark {
    background: transparent;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.945rem;
}

table.data .col-index {
    width: 2.75rem;
    min-width: 2.75rem;
    padding-right: 0.35rem;
    color: var(--muted-foreground);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

table.data .col-case {
    width: 14rem;
    min-width: 14rem;
    white-space: nowrap;
}

table.data th,
table.data td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    line-height: 1.3;
}

table.data td > form {
    display: flex;
    align-items: center;
    margin: 0;
}

table.data .btn {
    min-height: 0;
    height: 1.96rem;
    padding: 0 0.65rem;
}

table.data th {
    color: var(--muted-foreground);
    font-weight: 500;
    background: color-mix(in oklab, var(--muted) 70%, white);
}

table.data tbody tr:hover {
    background: color-mix(in oklab, var(--muted) 50%, transparent);
}

table.data tbody tr:last-child td {
    border-bottom: 0;
}

table.data-compact th,
table.data-compact td {
    padding: 0.18rem 0.75rem;
    line-height: 1.3;
    vertical-align: middle;
}

table.data-compact .btn {
    min-height: 0;
    height: 1.96rem;
    padding: 0 0.65rem;
    font-size: 0.945rem;
}

table.data-compact td.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    white-space: nowrap;
}

table.data-compact form {
    display: flex;
    margin: 0;
}

.empty {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.945rem;
}

a.link {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
}

.case-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: none;
    padding: 0.12rem 0.6rem 0.12rem 0.45rem;
    border-radius: 999px;
    background: var(--case-bg, var(--secondary));
    color: var(--case-fg, var(--foreground));
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
}

.case-chip::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--case-dot, var(--primary));
    flex-shrink: 0;
}

.case-chip:hover {
    filter: brightness(0.97);
}

.case-row {
    box-shadow: inset 3px 0 0 var(--case-dot, transparent);
}

.link:hover {
    opacity: 0.75;
}

.howto ol {
    margin: 0;
    padding-left: 1.25rem;
    display: grid;
    gap: 0.65rem;
    line-height: 1.5;
    font-size: 0.945rem;
    color: var(--muted-foreground);
}

.howto strong {
    color: var(--foreground);
}

.form-grid {
    display: grid;
    gap: 0.9rem;
}

.field {
    display: grid;
    gap: 0.4rem;
    font-size: 0.945rem;
    font-weight: 500;
}

.field-narrow {
    width: 66.666%;
    max-width: 100%;
}

.field input {
    width: 100%;
    min-height: 2.28rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 2px);
    background: var(--background);
    color: var(--foreground);
    font: inherit;
    font-weight: 400;
}

.field input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 35%, transparent);
}

.message,
.error {
    padding: 0.75rem 0.9rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.945rem;
}

.message {
    background: var(--success);
    color: var(--success-fg);
}

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

.turnstile-wrap {
    display: flex;
    justify-content: flex-start;
    min-height: 65px;
}

.mobile-nav {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
}

.mobile-nav a {
    white-space: nowrap;
    font-size: 0.864rem;
    padding: 0.4rem 0.7rem;
}

@media (min-width: 900px) {
    .sidebar {
        display: flex;
    }

    .shell.is-nav-hidden .sidebar {
        display: none;
    }

    .topbar .mobile-nav {
        display: none;
    }

    .content {
        padding-inline: 1.5rem;
    }
}

@media (max-width: 720px) {
    .stats {
        grid-template-columns: 1fr;
    }
    .calendar {
        max-width: 100%;
        flex-basis: 100%;
    }

    .calendars {
        gap: 1.5rem;
    }

    table.data th,
    table.data td {
        padding: 0.65rem 0.5rem;
        font-size: 0.864rem;
    }
}
