:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--page-bg);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    color: var(--text);
    background: var(--page-bg);
}

a {
    color: var(--accent-strong);
}

button,
input,
select,
textarea {
    font: inherit;
}

.startup-message,
.status-message {
    padding: 2rem;
    color: var(--text-muted);
    text-align: center;
}

.app-shell {
    min-height: 100vh;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 4.25rem;
    padding: 0 2rem;
    color: var(--header-text);
    background: var(--header-bg);
    box-shadow: 0 0.25rem 1rem rgb(var(--shadow) / 12%);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.6rem;
    color: var(--header-bg);
    background: var(--accent-soft);
    font-weight: 800;
    place-items: center;
}

.page-content {
    width: min(80rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 3rem 0;
}

.content-panel,
.auth-card {
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    box-shadow: 0 0.75rem 2rem rgb(var(--shadow) / 8%);
}

.content-panel {
    padding: clamp(1.5rem, 4vw, 3rem);
}

.content-panel h1,
.auth-heading h1 {
    margin: 0.25rem 0 0.75rem;
}

.eyebrow {
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.muted,
.auth-heading p,
.auth-footer {
    color: var(--text-muted);
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
    background: linear-gradient(145deg, var(--page-bg), var(--surface-muted));
}

.auth-card {
    width: min(28rem, 100%);
    padding: clamp(1.5rem, 5vw, 2.5rem);
}

.auth-card.wide {
    width: min(34rem, 100%);
}

.auth-card form {
    display: grid;
    gap: 0.65rem;
    margin-top: 1.5rem;
}

.auth-card label {
    margin-top: 0.35rem;
    font-weight: 650;
}

.auth-card input {
    width: 100%;
    min-height: 2.8rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.35rem;
    color: var(--text);
    background: var(--input-bg);
}

.auth-card input:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(var(--focus) / 15%);
}

.primary-button {
    min-height: 2.9rem;
    margin-top: 0.75rem;
    padding: 0.7rem 1rem;
    border: 0;
    border-radius: 0.35rem;
    color: var(--accent-text);
    background: var(--accent-strong);
    cursor: pointer;
}

.primary-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.primary-button.inline,
.danger-button,
.secondary-button {
    min-height: 2.65rem;
    margin-top: 0;
    padding: 0.6rem 1rem;
    border-radius: 0.4rem;
    cursor: pointer;
}

.secondary-button {
    border: 1px solid var(--border-strong);
    color: var(--text);
    background: var(--surface);
}

.danger-button {
    border: 1px solid var(--danger-text);
    color: #fff;
    background: var(--danger-text);
}

.secondary-button:disabled,
.danger-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.alert {
    margin-top: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--danger-border);
    border-radius: 0.35rem;
    color: var(--danger-text);
    background: var(--danger-bg);
}

.alert.compact {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}

.page-heading h1 {
    margin-bottom: 0.35rem;
}

.page-heading p {
    margin: 0;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 6rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    color: var(--text);
    background: var(--surface-soft);
    text-decoration: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

a.feature-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0.5rem 1.2rem rgb(var(--shadow) / 8%);
    transform: translateY(-1px);
}

.feature-card.disabled {
    color: var(--text-muted);
    background: var(--surface-muted);
}

.feature-card strong,
.feature-card small {
    display: block;
}

.feature-card small {
    margin-top: 0.25rem;
    color: var(--text-muted);
}

.feature-icon {
    display: grid;
    flex: 0 0 2.6rem;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.6rem;
    color: var(--accent-text);
    background: var(--accent);
    font-weight: 750;
    place-items: center;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 1.75rem;
}

.dashboard-stat {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-height: 5.5rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    color: var(--text);
    background: var(--surface-soft);
    text-decoration: none;
}

.dashboard-stat:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.dashboard-stat-icon {
    display: grid;
    flex: 0 0 2.65rem;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 0.6rem;
    color: var(--accent-strong);
    background: var(--accent-soft);
    place-items: center;
}

.dashboard-stat.warning .dashboard-stat-icon {
    color: var(--warning-text);
    background: var(--warning-bg);
}

.dashboard-stat.danger .dashboard-stat-icon {
    color: var(--danger-text);
    background: var(--danger-bg);
}

.dashboard-stat.action .dashboard-stat-icon {
    color: var(--accent-text);
    background: var(--accent);
}

.dashboard-stat strong,
.dashboard-stat small {
    display: block;
}

.dashboard-stat strong {
    font-size: 1.35rem;
}

.dashboard-stat small {
    margin-top: 0.1rem;
    color: var(--text-muted);
}

.dashboard-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 2rem 0 0.8rem;
}

.dashboard-section-heading h2,
.dashboard-section-heading p {
    margin: 0;
}

.dashboard-section-heading h2 {
    font-size: 1.15rem;
}

.dashboard-section-heading p {
    margin-top: 0.2rem;
    font-size: 0.82rem;
}

.dashboard-deadlines {
    display: grid;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface);
}

.dashboard-deadline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.dashboard-deadline:last-child {
    border-bottom: 0;
}

.dashboard-deadline:hover {
    background: var(--surface-soft);
}

.deadline-date {
    display: grid;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 0.55rem;
    color: var(--success-text);
    background: var(--success-bg);
    text-align: center;
    place-content: center;
}

.deadline-date.soon,
.deadline-date.today {
    color: var(--warning-text);
    background: var(--warning-bg);
}

.deadline-date.overdue {
    color: var(--danger-text);
    background: var(--danger-bg);
}

.deadline-date strong,
.deadline-date small {
    line-height: 1;
}

.deadline-date strong {
    font-size: 1.15rem;
}

.deadline-date small {
    margin-top: 0.2rem;
    font-size: 0.62rem;
    font-weight: 800;
}

.dashboard-deadline-copy strong,
.dashboard-deadline-copy small {
    display: block;
}

.dashboard-deadline-copy small {
    margin-top: 0.2rem;
    color: var(--text-muted);
}

.compact-empty {
    min-height: 7rem;
}

.list-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.25rem;
    margin: 2rem 0 1.2rem;
    padding: 1rem;
    border-radius: 0.65rem;
    background: var(--surface-soft);
}

.search-field {
    display: grid;
    flex: 1;
    gap: 0.4rem;
    max-width: 38rem;
    font-weight: 650;
}

.search-field input,
.modal-card input {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.62rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.4rem;
    color: var(--text);
    background: var(--input-bg);
}

.search-field input:focus,
.modal-card input:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(var(--focus) / 15%);
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    white-space: nowrap;
}

.checkbox-field input {
    width: 1.05rem;
    height: 1.05rem;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.85rem 0.8rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--text-muted);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: var(--surface-soft);
}

.data-table .actions-column,
.data-table .row-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.inactive-row {
    color: var(--text-muted);
    background: var(--surface-soft);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-badge.active {
    color: var(--success-text);
    background: var(--success-bg);
}

.status-badge.inactive {
    color: var(--neutral-badge-text);
    background: var(--neutral-badge-bg);
}

.text-button,
.icon-button {
    padding: 0;
    border: 0;
    color: var(--accent-strong);
    background: transparent;
    cursor: pointer;
}

.text-button:hover {
    text-decoration: underline;
}

.danger-text {
    color: var(--danger-text);
}

.empty-state {
    display: grid;
    gap: 0.35rem;
    min-height: 10rem;
    padding: 2rem;
    border: 1px dashed var(--border-strong);
    border-radius: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    place-content: center;
}

.empty-state strong {
    color: var(--text);
}

.modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    padding: 1.25rem;
    background: rgb(17 28 36 / 54%);
    place-items: center;
}

.modal-card {
    width: min(34rem, 100%);
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    padding: 1.4rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    box-shadow: 0 1.2rem 3rem rgb(var(--shadow) / 28%);
}

.modal-card.compact-dialog {
    width: min(30rem, 100%);
}

.modal-card form {
    display: grid;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.modal-card label {
    font-weight: 650;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.modal-header h2 {
    margin: 0.2rem 0 0;
    font-size: 1.35rem;
}

.icon-button {
    width: 2rem;
    height: 2rem;
    color: var(--text-muted);
    font-size: 1.55rem;
    line-height: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.field-hint {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.duplicate-warning {
    margin-top: 0.4rem;
    padding: 0.75rem;
    border-left: 3px solid var(--warning-border);
    color: var(--warning-text);
    background: var(--warning-bg);
}

.duplicate-warning ul {
    margin: 0.45rem 0 0;
    padding-left: 1.15rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.password-rules {
    margin-top: 0.5rem;
    padding: 0.8rem;
    border-left: 3px solid var(--accent);
    color: var(--text-muted);
    background: var(--surface-soft);
}

.auth-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.75rem;
    font-size: 0.75rem;
}

.validation-message,
.validation-errors {
    color: var(--danger-text);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    padding: 1rem;
    border: 1px solid var(--warning-border);
    color: var(--warning-text);
    background: var(--warning-bg);
}

#blazor-error-ui .dismiss {
    float: right;
}

.app-icon {
    display: block;
    flex: 0 0 auto;
}

.menu-toggle,
.drawer-close {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    padding: 0;
    border: 0;
    border-radius: 0.55rem;
    color: inherit;
    background: transparent;
    cursor: pointer;
    place-items: center;
}

.menu-toggle:hover,
.drawer-close:hover {
    background: rgb(255 255 255 / 12%);
}

.menu-backdrop {
    position: fixed;
    z-index: 2000;
    inset: 0;
    display: flex;
    justify-content: flex-end;
    background: rgb(10 17 24 / 46%);
    animation: menu-fade 140ms ease-out;
}

.navigation-drawer {
    display: flex;
    flex-direction: column;
    width: min(17rem, calc(100% - 1rem));
    height: 100%;
    overflow-y: auto;
    color: var(--text);
    background: var(--surface);
    box-shadow: -1rem 0 3rem rgb(0 0 0 / 22%);
    animation: drawer-in 180ms ease-out;
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    color: var(--header-text);
    background: var(--header-bg);
}

.drawer-header .eyebrow {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--header-muted);
}

.drawer-header strong {
    font-size: 1.15rem;
}

.drawer-navigation {
    display: grid;
    flex: 1 0 auto;
    align-content: start;
    grid-auto-rows: min-content;
    gap: 0.1rem;
    padding: 0.75rem;
}

.drawer-navigation a,
.drawer-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    min-height: 2.9rem;
    padding: 0.6rem 0.8rem;
    border: 0;
    border-radius: 0.65rem;
    color: var(--text);
    background: transparent;
    font-size: 1.05rem;
    font-weight: 650;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.drawer-navigation a:hover,
.drawer-logout:hover {
    background: var(--surface-soft);
}

.drawer-navigation a.active {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.drawer-logout {
    color: var(--danger-text);
}

.drawer-section-label {
    margin: 0.7rem 0.8rem 0.15rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.drawer-version {
    padding: 0.65rem 1.25rem 1rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 650;
    text-align: center;
}

@keyframes drawer-in {
    from {
        transform: translateX(100%);
    }
}

@keyframes menu-fade {
    from {
        opacity: 0;
    }
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    text-decoration: none;
}

.secondary-button.inline {
    display: inline-flex;
    width: max-content;
    margin-top: 1rem;
}

.practice-filters {
    display: grid;
    grid-template-columns: minmax(14rem, 2fr) repeat(5, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin: 1.75rem 0 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface-soft);
}

.practice-filters label,
.field,
.smart-selector {
    display: grid;
    align-content: start;
    gap: 0.4rem;
    min-width: 0;
    font-weight: 650;
}

.practice-filters label > span,
.field > span,
.smart-selector > label {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 750;
}

.practice-filters input,
.practice-filters select,
.field input,
.field select,
.field textarea,
.smart-selector input,
.route-option input[type="date"] {
    width: 100%;
    min-height: 2.7rem;
    padding: 0.58rem 0.7rem;
    border: 1px solid var(--border-strong);
    border-radius: 0.42rem;
    color: var(--text);
    background: var(--input-bg);
}

.practice-filters input:focus,
.practice-filters select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.smart-selector input:focus,
.route-option input[type="date"]:focus {
    border-color: var(--accent);
    outline: 3px solid rgb(var(--focus) / 15%);
}

.practice-filters .search-field {
    max-width: none;
}

.practice-list-summary {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: 1rem 0 0.35rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.practice-list-summary strong {
    color: var(--text);
    font-size: 1rem;
}

.practice-number {
    margin-right: 0.45rem;
    color: var(--accent-strong);
    font-weight: 800;
    text-decoration: none;
}

.practice-number:hover {
    text-decoration: underline;
}

.phase-badge,
.deadline-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.22rem 0.58rem;
    border-radius: 999px;
    font-size: 0.73rem;
    font-weight: 750;
}

.phase-badge {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.deadline-cell {
    display: grid;
    gap: 0.22rem;
}

.deadline-cell small {
    color: var(--text-muted);
    white-space: nowrap;
}

.deadline-badge.regular {
    color: var(--success-text);
    background: var(--success-bg);
}

.deadline-badge.soon,
.deadline-badge.today {
    color: var(--warning-text);
    background: var(--warning-bg);
}

.deadline-badge.today {
    box-shadow: inset 0 0 0 1px var(--warning-border);
}

.deadline-badge.overdue {
    color: var(--danger-text);
    background: var(--danger-bg);
}

.overdue-row {
    box-shadow: inset 3px 0 var(--danger-border);
}

.practice-editor {
    width: min(96rem, calc(100% - 1.5rem));
    margin: 1rem auto 2rem;
}

.practice-editor-header {
    position: sticky;
    z-index: 50;
    top: 0;
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) auto auto;
    align-items: center;
    gap: 1.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--header-text);
    background: var(--header-bg);
    box-shadow: 0 0.55rem 1.5rem rgb(var(--shadow) / 16%);
}

.practice-editor-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.practice-editor-title .eyebrow {
    color: var(--header-muted);
}

.practice-editor-title h1 {
    overflow: hidden;
    margin: 0.1rem 0 0;
    font-size: 1.2rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.back-link {
    display: grid;
    flex: 0 0 2.3rem;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    color: var(--header-text);
    background: rgb(255 255 255 / 10%);
    font-size: 1.4rem;
    text-decoration: none;
    place-items: center;
}

.practice-editor-summary {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.practice-editor-summary > div {
    display: grid;
    gap: 0.15rem;
}

.practice-editor-summary small {
    color: var(--header-muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.practice-editor-summary strong {
    max-width: 16rem;
    font-size: 0.83rem;
}

.practice-editor-actions {
    display: flex;
    gap: 0.55rem;
}

.practice-editor-actions .primary-button,
.practice-editor-actions .secondary-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.practice-alert,
.practice-validation {
    margin-inline: 0.25rem;
}

.practice-sections {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.practice-section {
    grid-column: span 6;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface);
    box-shadow: 0 0.35rem 1rem rgb(var(--shadow) / 5%);
}

.practice-section.identification-section,
.practice-section.route-section,
.practice-section.notes-section {
    grid-column: 1 / -1;
}

.practice-section > header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: -0.85rem -0.85rem 0.8rem;
    padding: 0.62rem 0.75rem;
    border-bottom: 1px solid var(--border);
    border-radius: 0.7rem 0.7rem 0 0;
    background: var(--surface-muted);
}

.practice-section h2,
.practice-section header p {
    margin: 0;
}

.practice-section h2 {
    font-size: 0.98rem;
}

.practice-section header p {
    margin-top: 0.12rem;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.section-number {
    display: grid;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    color: var(--accent-strong);
    background: var(--accent-soft);
    font-size: 0.7rem;
    font-weight: 800;
    place-items: center;
}

.practice-fields {
    display: grid;
    gap: 0.65rem;
}

.identity-grid {
    grid-template-columns: minmax(10rem, 0.7fr) repeat(2, minmax(14rem, 1fr));
}

.date-grid {
    grid-template-columns: repeat(3, minmax(9.5rem, 1fr));
}

.date-grid > .field > span {
    display: flex;
    align-items: flex-end;
    min-height: 1.85rem;
    line-height: 1.2;
}

.calculated-field output {
    display: flex;
    align-items: center;
    min-height: 2.7rem;
    padding: 0.58rem 0.7rem;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    border-radius: 0.42rem;
    color: var(--accent-strong);
    background: var(--surface-calculated);
    font-weight: 750;
}

.route-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.route-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(10rem, 0.42fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface-soft);
    cursor: pointer;
}

.route-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.route-option > input[type="radio"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent);
}

.route-option strong,
.route-option small {
    display: block;
}

.route-option small {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.clear-route {
    margin-top: 0.65rem;
}

.notes-section textarea {
    resize: vertical;
}

.practice-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.75rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface);
}

.deadline-text-overdue {
    color: #ffd1d1;
}

.deadline-text-soon {
    color: #ffe0bb;
}

.smart-selector {
    position: relative;
}

.smart-selector-input {
    position: relative;
}

.selection-check {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    display: grid;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    color: #fff;
    background: var(--success-text);
    font-size: 0.75rem;
    transform: translateY(-50%);
    place-items: center;
}

.smart-selector-results {
    position: absolute;
    z-index: 100;
    top: calc(100% + 0.25rem);
    right: 0;
    left: 0;
    display: grid;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    background: var(--surface);
    box-shadow: 0 0.8rem 2rem rgb(var(--shadow) / 18%);
}

.smart-selector-option,
.smart-selector-create {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.72rem;
    border: 0;
    border-radius: 0.4rem;
    color: var(--text);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.smart-selector-option:hover {
    background: var(--surface-soft);
}

.smart-selector-option small {
    color: var(--text-muted);
}

.smart-selector-create {
    justify-content: flex-start;
    color: var(--accent-strong);
    background: var(--accent-soft);
    font-weight: 750;
}

.smart-selector-status,
.smart-selector-error {
    padding: 0.7rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.smart-selector-error {
    color: var(--danger-text);
}

.settings-message {
    margin-top: 1.25rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.45rem;
}

.settings-message.success {
    color: var(--success-text);
    background: var(--success-bg);
}

.settings-message.error {
    color: var(--danger-text);
    background: var(--danger-bg);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.75rem;
}

.theme-card {
    display: grid;
    grid-template-columns: minmax(10rem, 0.8fr) minmax(12rem, 1fr);
    gap: 0.85rem 1rem;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: var(--text);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
}

.theme-card:hover,
.theme-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0.55rem 1.4rem rgb(var(--shadow) / 10%);
}

.theme-card.selected {
    box-shadow: inset 0 0 0 1px var(--accent), 0 0.55rem 1.4rem rgb(var(--shadow) / 10%);
}

.theme-preview {
    grid-row: span 3;
    overflow: hidden;
    min-height: 9rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    background: var(--preview-bg);
}

.theme-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 2.5rem;
    padding: 0 0.65rem;
    color: #fff;
    background: var(--preview-header);
}

.theme-preview-brand {
    display: grid;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 0.35rem;
    color: var(--preview-header);
    background: var(--preview-soft);
    font-size: 0.72rem;
    font-weight: 800;
    place-items: center;
}

.theme-preview-body {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem;
}

.theme-preview-line {
    width: 55%;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--preview-accent);
}

.theme-preview-line.wide {
    width: 80%;
}

.theme-preview-panels {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.45rem;
}

.theme-preview-panels span {
    height: 3.5rem;
    border-radius: 0.35rem;
    background: var(--preview-surface);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%);
}

.theme-preview-panels span:last-child {
    background: var(--preview-soft);
}

.theme-card-copy strong,
.theme-card-copy small {
    display: block;
}

.theme-card-copy strong {
    font-size: 1.02rem;
}

.theme-card-copy small {
    margin-top: 0.3rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.theme-swatches {
    display: flex;
    gap: 0.4rem;
}

.theme-swatches span {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--border);
}

.theme-selection {
    align-self: end;
    color: var(--accent-strong);
    font-size: 0.76rem;
    font-weight: 750;
}

@media (max-width: 78rem) {
    .dashboard-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .practice-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .practice-filters .search-field {
        grid-column: span 2;
    }

    .practice-editor-header {
        grid-template-columns: minmax(14rem, 1fr) auto;
    }

    .practice-editor-summary {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-content: space-between;
    }

    .practice-editor-actions {
        justify-content: flex-end;
    }

    .date-grid {
        grid-template-columns: repeat(2, minmax(9rem, 1fr));
    }

    .theme-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 62rem) {
    .practice-section {
        grid-column: 1 / -1;
    }

    .identity-grid {
        grid-template-columns: 1fr;
    }

    .route-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 42rem) {
    .date-grid > .field > span {
        min-height: 0;
    }

    .app-header {
        min-height: 3.75rem;
        padding: 0 1rem;
    }

    .page-content {
        width: min(100% - 1rem, 80rem);
        padding-top: 1.5rem;
    }

    .page-heading,
    .list-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .home-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .dashboard-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-deadline {
        align-items: start;
    }

    .search-field {
        max-width: none;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table tr {
        margin-bottom: 0.75rem;
        padding: 0.35rem 0.65rem;
        border: 1px solid var(--border);
        border-radius: 0.55rem;
    }

    .data-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.6rem 0.25rem;
    }

    .data-table td::before {
        color: var(--text-muted);
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .data-table .row-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .data-table .row-actions::before {
        content: none;
    }

    .modal-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .auth-footer {
        flex-direction: column;
    }

    .practice-filters {
        grid-template-columns: 1fr;
    }

    .practice-filters .search-field {
        grid-column: auto;
    }

    .practice-editor {
        width: calc(100% - 0.6rem);
        margin-top: 0.3rem;
    }

    .practice-editor-header {
        position: static;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .practice-editor-actions,
    .practice-editor-summary {
        grid-column: auto;
        grid-row: auto;
        align-items: stretch;
        flex-direction: column;
    }

    .practice-editor-actions .primary-button,
    .practice-editor-actions .secondary-button {
        justify-content: center;
        width: 100%;
    }

    .practice-sections {
        display: block;
    }

    .practice-section {
        margin-top: 0.6rem;
    }

    .date-grid,
    .route-option {
        grid-template-columns: 1fr;
    }

    .route-option > input[type="radio"] {
        grid-row: 1;
    }

    .practice-editor-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .theme-card {
        grid-template-columns: 1fr;
    }

    .theme-preview {
        grid-row: auto;
    }
}
