:root {
    --canvas: #ffffff;
    --surface-soft: #fafafa;
    --surface-dark: #171717;
    --hairline: #e5e5e5;
    --hairline-strong: #d4d4d4;
    --ink: #000000;
    --ink-deep: #090909;
    --charcoal: #525252;
    --body: #737373;
    --mute: #a3a3a3;
    --on-dark: #ffffff;
    --focus-ring: rgba(59, 130, 246, 0.5);
    --radius-card: 12px;
    --radius-pill: 9999px;
    --font-primary: 'Camera Plain Variable', ui-sans-serif, system-ui, sans-serif;
    --font-display: var(--font-primary);
    --font-body: var(--font-primary);
    --font-mono:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    --weight-regular: 400;
    --weight-display: 480;
    --weight-strong: 600;
    --text-display: 60px;
    --text-section: 48px;
    --text-subheading: 36px;
    --text-card-title: 20px;
    --text-body-large: 18px;
    --text-body: 16px;
    --text-small: 14px;
    --text-caption: 14px;
    --leading-display: 1.05;
    --leading-section: 1;
    --leading-subheading: 1.1;
    --leading-card-title: 1.25;
    --leading-body-large: 1.38;
    --leading-body: 1.5;
    --tracking-display: -1.5px;
    --tracking-section: -1.2px;
    --tracking-subheading: -0.9px;
    --success-bg: #ecfdf3;
    --success-text: #067647;
    --success-border: #abefc6;
    --warning-bg: #fffaeb;
    --warning-text: #b54708;
    --warning-border: #fedf89;
    --danger-bg: #fef3f2;
    --danger-text: #b42318;
    --danger-border: #fecdca;
    --info-bg: #eff8ff;
    --info-text: #175cd3;
    --info-border: #b2ddff;
    --neutral-bg: #f5f5f5;
    --neutral-text: #525252;
    --neutral-border: #e5e5e5;
    --container: 1160px;
}

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

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--body);
    font-family: var(--font-primary);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
figure,
pre {
    margin: 0;
}

h1,
h2,
h3,
h4 {
    color: var(--ink);
    font-family: var(--font-primary);
    font-weight: var(--weight-strong);
    letter-spacing: 0;
}

h1 {
    font-size: var(--text-subheading);
    line-height: var(--leading-subheading);
    letter-spacing: var(--tracking-subheading);
}

h2,
h3 {
    font-size: var(--text-card-title);
    font-weight: var(--weight-regular);
    line-height: var(--leading-card-title);
}

h4 {
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

a {
    color: var(--ink);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--charcoal);
}

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

img,
svg {
    display: block;
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

::selection {
    background: #000;
    color: #fff;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    background: var(--ink);
    color: var(--on-dark);
    border-radius: var(--radius-pill);
    padding: 10px 18px;
    text-decoration: none;
    font-size: var(--text-small);
    font-weight: var(--weight-regular);
}

.skip-link:focus {
    top: 12px;
    color: var(--on-dark);
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

.mono {
    font-family: var(--font-mono);
    font-size: 13px;
}

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

/* App shell and sidebar */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    flex: 0 0 248px;
    width: 248px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 22px 16px 18px;
    background: var(--canvas);
    border-right: 1px solid var(--hairline);
    overflow-y: auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    text-decoration: none;
    font-family: var(--font-primary);
    font-size: var(--text-body-large);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body-large);
    white-space: nowrap;
}

.brand:hover {
    color: var(--ink);
}

.brand-name {
    font-size: var(--text-body-large);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body-large);
}

.brand-sidebar {
    padding: 0 10px;
}

.brand-mark {
    width: 24px;
    height: 24px;
    color: var(--ink);
}

.brand-mark-lg {
    width: 40px;
    height: 40px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-label {
    margin: 18px 10px 6px;
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-label:first-child {
    margin-top: 0;
}

.sidebar-label[hidden] {
    display: none;
}

.nav-link {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--body);
    text-decoration: none;
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.nav-link[hidden] {
    display: none;
}

.nav-link:hover {
    color: var(--ink);
    background: var(--surface-soft);
}

.nav-link.is-active {
    color: var(--ink);
    background: var(--surface-soft);
    box-shadow: inset 2px 0 0 var(--ink);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding: 16px 10px 0;
    border-top: 1px solid var(--hairline);
}

.sidebar-footer form {
    margin: 0;
}

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

.nav-user {
    color: var(--charcoal);
    font-size: var(--text-small);
    line-height: var(--leading-body);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--hairline);
}

.topbar-title {
    color: var(--ink);
    font-family: var(--font-primary);
    font-size: var(--text-card-title);
    font-weight: var(--weight-strong);
    line-height: var(--leading-card-title);
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-toggle {
    display: none;
    flex: 0 0 auto;
    background: var(--canvas);
    border: 1px solid var(--hairline-strong);
    color: var(--ink);
    border-radius: var(--radius-pill);
    padding: 7px 16px;
    font-size: var(--text-small);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    cursor: pointer;
}

.sidebar-backdrop {
    display: none;
}

/* Layout */
.site-main {
    flex: 1 1 auto;
    width: 100%;
    padding: 28px 32px 48px;
}

.auth-main {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 48px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.eyebrow {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.eyebrow-sep {
    margin: 0 6px;
    color: var(--hairline-strong);
}

.page-title {
    font-size: var(--text-subheading);
    font-weight: var(--weight-strong);
    line-height: var(--leading-subheading);
    letter-spacing: var(--tracking-subheading);
}

.page-subtitle {
    color: var(--body);
    font-size: var(--text-body-large);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body-large);
    margin-top: 10px;
    max-width: 720px;
}

.page-subtitle .mono {
    color: var(--charcoal);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 4px 20px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background-color 0.12s ease,
        border-color 0.12s ease;
}

.btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--on-dark);
}

.btn-primary:hover {
    background: var(--ink-deep);
    border-color: var(--ink-deep);
    color: var(--on-dark);
}

.btn-secondary {
    background: var(--canvas);
    border-color: var(--hairline-strong);
    color: var(--ink);
}

.btn-secondary:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--body);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn-ghost:hover {
    color: var(--ink);
}

.btn-sm {
    min-height: 32px;
    padding: 4px 14px;
    font-size: var(--text-small);
    line-height: var(--leading-body);
}

.btn-block {
    width: 100%;
}

.btn-disabled {
    background: var(--surface-soft);
    border-color: var(--surface-soft);
    color: var(--mute);
    cursor: default;
}

.btn-disabled:hover {
    background: var(--surface-soft);
    color: var(--mute);
}

/* Forms */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-label {
    color: var(--ink);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
}

.field-hint {
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.field-error {
    color: var(--danger-text);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.text-input {
    width: 100%;
    min-height: 40px;
    height: auto;
    padding: 6px 16px;
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-pill);
    color: var(--ink);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    appearance: none;
}

select.text-input {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23525252' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.text-input::placeholder {
    color: var(--mute);
}

.text-input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.text-input[disabled] {
    background: var(--surface-soft);
    color: var(--mute);
}

.text-area {
    height: auto;
    min-height: 100px;
    padding: 12px 16px;
    border-radius: var(--radius-card);
    resize: vertical;
}

.ui-native {
    display: none !important;
}

.ui-select,
.ui-date {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
}

.ui-select-trigger,
.ui-date-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.ui-select-trigger:hover,
.ui-date-trigger:hover {
    border-color: var(--hairline-strong);
}

.ui-select.is-open .ui-select-trigger,
.ui-date.is-open .ui-date-trigger {
    border-color: var(--ink);
}

.ui-select-value,
.ui-date-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-select-trigger.ui-placeholder,
.ui-date-trigger.ui-placeholder {
    color: var(--body);
}

.ui-select-trigger .ui-icon,
.ui-date-trigger .ui-icon {
    flex: 0 0 auto;
    color: var(--charcoal);
}

.ui-select-trigger.ui-placeholder .ui-icon,
.ui-date-trigger.ui-placeholder .ui-icon {
    color: var(--body);
}

.ui-select-popover,
.ui-date-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 70;
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
}

.ui-select-popover.ui-popover-up,
.ui-date-popover.ui-popover-up {
    top: auto;
    bottom: calc(100% + 8px);
}

.ui-select-popover {
    width: max-content;
    min-width: 100%;
    max-width: min(360px, calc(100vw - 32px));
    padding: 6px;
}

.ui-select-listbox {
    max-height: 280px;
    overflow-y: auto;
}

.ui-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 8px;
    color: var(--charcoal);
    font-size: var(--text-small);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    cursor: pointer;
}

.ui-select-option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-select-option[aria-selected='true'] {
    background: var(--surface-soft);
    color: var(--ink);
    font-weight: var(--weight-strong);
}

.ui-select-option.is-active {
    background: var(--ink);
    color: var(--on-dark);
}

.ui-select-option[aria-disabled='true'] {
    opacity: 0.45;
    cursor: not-allowed;
}

.ui-select-check {
    display: inline-flex;
    flex: 0 0 auto;
}

.ui-date-popover {
    width: min(320px, calc(100vw - 32px));
    padding: 12px;
}

.ui-calendar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ui-calendar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.ui-calendar-nav {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-pill);
    background: var(--canvas);
    color: var(--charcoal);
    cursor: pointer;
}

.ui-calendar-nav:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.ui-calendar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
}

.ui-calendar-title-btn {
    padding: 5px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-size: var(--text-small);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
    cursor: pointer;
}

.ui-calendar-title-btn:hover {
    background: var(--surface-soft);
}

.ui-calendar-title-btn.is-active {
    background: var(--ink);
    color: var(--on-dark);
}

.ui-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}

.ui-calendar-weekdays[hidden] {
    display: none;
}

.ui-calendar-weekdays span {
    padding: 2px 0;
    color: var(--body);
    font-size: 11px;
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
}

.ui-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
}

.ui-calendar-grid.is-modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding-top: 2px;
}

.ui-calendar-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--charcoal);
    font-size: 13px;
    font-weight: var(--weight-regular);
    line-height: 1;
    cursor: pointer;
}

.ui-calendar-day:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.ui-calendar-day.is-outside {
    color: var(--body);
}

.ui-calendar-day.is-today {
    color: var(--ink);
    font-weight: var(--weight-strong);
    box-shadow: inset 0 0 0 1px var(--hairline-strong);
}

.ui-calendar-day.is-selected {
    background: var(--ink);
    color: var(--on-dark);
    font-weight: var(--weight-strong);
    box-shadow: none;
}

.ui-calendar-day.is-selected:hover {
    background: var(--ink-deep);
    color: var(--on-dark);
}

.ui-calendar-day:focus-visible,
.ui-calendar-chip:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 1px;
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.ui-calendar-chip {
    min-height: 40px;
    padding: 6px 4px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--charcoal);
    font-size: 13px;
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    cursor: pointer;
}

.ui-calendar-chip:hover {
    border-color: var(--hairline-strong);
    color: var(--ink);
}

.ui-calendar-chip.is-selected {
    background: var(--ink);
    color: var(--on-dark);
    font-weight: var(--weight-strong);
}

.ui-calendar-chip.is-selected:hover {
    border-color: var(--ink);
    color: var(--on-dark);
}

.ui-calendar-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--hairline);
}

.ui-calendar-action {
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.ui-calendar-action:hover {
    background: var(--surface-soft);
}

.ui-calendar-action[disabled] {
    background: transparent;
    color: var(--mute);
    text-decoration: none;
    cursor: default;
}

.ui-calendar-clear {
    color: var(--body);
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-compact {
    gap: 12px;
}

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

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--hairline);
}

.divider {
    border: 0;
    border-top: 1px solid var(--hairline);
    margin: 8px 0;
}

/* Filters */
.filter-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 24px;
}

.filter-bar .field {
    min-width: 150px;
}

.filter-grow {
    flex: 1 1 240px;
}

.filter-group {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

/* Cards */
.card {
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 28px;
    margin-bottom: 24px;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.card-head-tight {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--hairline);
}

.card-title {
    font-size: var(--text-card-title);
    font-weight: var(--weight-regular);
    line-height: var(--leading-card-title);
    letter-spacing: 0;
}

.card-note {
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.card-note + form,
.card-note + .action-row {
    margin-top: 14px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-grid-4 {
    margin-bottom: 8px;
}

.metric-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 8px;
}

.split-grid .metric {
    padding: 16px;
}

.split-grid .metric-value {
    font-size: var(--text-card-title);
    font-weight: var(--weight-strong);
    line-height: var(--leading-card-title);
}

.split-grid .metric-note {
    margin-top: 6px;
}

.metric {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 20px;
    background: var(--canvas);
}

.metric-label {
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    margin-bottom: 8px;
}

.metric-value {
    color: var(--ink);
    font-family: var(--font-primary);
    font-size: var(--text-subheading);
    font-weight: var(--weight-strong);
    line-height: var(--leading-subheading);
    letter-spacing: var(--tracking-subheading);
}

.metric-note {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    margin-top: 8px;
}

.split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

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

.split-grid > .card {
    margin-bottom: 24px;
}

.status-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
}

.status-tile {
    background: var(--surface-soft);
    border-radius: var(--radius-card);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.status-count {
    color: var(--ink);
    font-family: var(--font-primary);
    font-size: var(--text-card-title);
    font-weight: var(--weight-strong);
    line-height: var(--leading-card-title);
}

.attention-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--hairline);
}

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

.attention-title {
    color: var(--ink);
    font-size: var(--text-body);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
    margin-bottom: 2px;
}

.attention-text {
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    max-width: 520px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    white-space: nowrap;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}

.badge-neutral {
    background: var(--neutral-bg);
    color: var(--neutral-text);
    border-color: var(--neutral-border);
}

.badge-muted {
    background: var(--surface-soft);
    color: var(--mute);
    border-color: var(--hairline);
}

/* Alerts and notices */
.alert {
    border-radius: var(--radius-card);
    border: 1px solid var(--hairline);
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.alert-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}

.flash-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.flash {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 12px 18px;
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    background: var(--surface-soft);
    color: var(--charcoal);
}

.flash-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}

.flash-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.flash-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}

.notice {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 16px;
}

.notice-title {
    color: var(--ink);
    font-size: var(--text-body);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
    margin-bottom: 4px;
}

.notice-text {
    color: var(--body);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.notice .field-hint {
    margin-top: 8px;
}

.notice-meta {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    margin-top: 8px;
}

/* Tables */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
}

.card > .table-wrap {
    margin-top: 4px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--canvas);
}

.table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--hairline);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--hairline);
    vertical-align: top;
    color: var(--charcoal);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

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

.table tbody tr:hover {
    background: var(--surface-soft);
}

.table-strong {
    display: block;
    color: var(--ink);
    font-weight: var(--weight-strong);
    font-size: var(--text-body);
    line-height: var(--leading-body);
}

.table-sub {
    display: block;
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    margin-top: 2px;
}

.table-wrap-text {
    max-width: 320px;
    white-space: normal;
}

.table-actions {
    text-align: right;
    white-space: nowrap;
}

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

.link-strong:hover {
    text-decoration: underline;
}

.link-inline {
    color: var(--charcoal);
    font-size: var(--text-small);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.link-inline:hover {
    color: var(--ink);
}

/* Detail grids */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1px;
    background: var(--hairline);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    overflow: hidden;
    margin-bottom: 24px;
}

.detail-item {
    background: var(--canvas);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.detail-wide {
    grid-column: 1 / -1;
}

.detail-label {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.detail-value {
    color: var(--ink);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    overflow-wrap: anywhere;
}

.detail-note {
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.balance-value {
    font-family: var(--font-primary);
    font-size: var(--text-card-title);
    font-weight: var(--weight-regular);
    line-height: var(--leading-card-title);
}

.balance-cell {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.stale-flag {
    color: var(--warning-text);
    font-size: var(--text-caption);
    font-weight: var(--weight-strong);
    margin-left: 6px;
}

/* Code */
.code-block {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 16px;
    color: var(--charcoal);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin-top: 10px;
}

.code-block-sm {
    margin-top: 4px;
    padding: 10px 12px;
    font-size: 11px;
}

.inline-details summary {
    color: var(--charcoal);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.inline-details-label {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 8px;
}

/* Empty state */
.empty-state {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 48px 24px;
    text-align: center;
}

.empty-title {
    font-size: var(--text-card-title);
    font-weight: var(--weight-strong);
    line-height: var(--leading-card-title);
    margin-bottom: 8px;
}

.empty-text {
    color: var(--body);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    max-width: 440px;
    margin: 0 auto 20px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.pagination-status {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.report-note {
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    margin-top: 16px;
}

.prose {
    color: var(--charcoal);
    font-size: var(--text-body-large);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body-large);
    max-width: 760px;
}

/* Auth */
.auth-wrap {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    background: var(--canvas);
    padding: 40px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-title {
    font-size: var(--text-subheading);
    font-weight: var(--weight-strong);
    line-height: var(--leading-subheading);
    letter-spacing: var(--tracking-subheading);
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--body);
    font-size: var(--text-body-large);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body-large);
    margin-bottom: 24px;
}

.auth-footnote {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    margin-top: 20px;
    text-align: center;
}

/* Error page */
.error-page {
    max-width: 640px;
    margin: 48px auto;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 40px;
}

.error-message {
    color: var(--body);
    margin: 16px 0;
}

.error-request {
    color: var(--mute);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.error-request code {
    font-family: var(--font-mono);
    color: var(--charcoal);
}

.error-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--hairline);
    padding: 24px 32px;
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--body);
    font-size: var(--text-caption);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.footer-brand {
    color: var(--ink);
    font-family: var(--font-primary);
    font-size: var(--text-body);
    font-weight: var(--weight-strong);
    line-height: var(--leading-body);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.35);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
}

.modal[hidden],
.modal-backdrop[hidden] {
    display: none;
}

body.modal-open {
    overflow: hidden;
}

.modal-panel {
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.modal-title {
    color: var(--ink);
    font-family: var(--font-primary);
    font-size: var(--text-card-title);
    font-weight: var(--weight-regular);
    line-height: var(--leading-card-title);
    letter-spacing: 0;
}

.modal-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-pill);
    background: var(--canvas);
    color: var(--charcoal);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.modal-body {
    color: var(--body);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
}

.modal-body .form-stack {
    gap: 16px;
}

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

.modal-body .notice {
    margin-bottom: 16px;
}

.modal-body .report-note {
    margin-top: 16px;
}

.modal-text {
    color: var(--body);
    font-size: var(--text-body);
    font-weight: var(--weight-regular);
    line-height: var(--leading-body);
    margin-bottom: 10px;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.modal-actions:empty {
    display: none;
}

@media (max-width: 640px) {
    .modal {
        padding: 14px;
    }

    .modal-panel {
        max-height: calc(100vh - 28px);
        padding: 20px;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .split-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        max-width: 84vw;
        height: auto;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    body.nav-open {
        overflow: hidden;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 35;
        border: 0;
        padding: 0;
        margin: 0;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    body.nav-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar {
        padding: 0 20px;
    }

    .site-main {
        padding: 24px 20px 40px;
    }

    .site-footer {
        padding: 20px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .site-main {
        padding-top: 28px;
        padding-bottom: 56px;
    }

    .card {
        padding: 20px;
    }

    .auth-card,
    .error-page {
        padding: 28px 22px;
    }

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

    .filter-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-bar .field,
    .filter-group,
    .filter-group .field {
        width: 100%;
        min-width: 0;
    }

    .filter-grow {
        flex: 0 1 auto;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .attention-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .pagination {
        justify-content: center;
        text-align: center;
    }

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

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

    .table td,
    .table th {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Stack key operational tables on phones instead of hiding columns
       behind a horizontal scrollbar. */
    .table-responsive thead {
        display: none;
    }

    .table-responsive,
    .table-responsive tbody,
    .table-responsive tr,
    .table-responsive td {
        display: block;
        width: 100%;
    }

    .table-responsive tr {
        padding: 12px 0;
        border-bottom: 1px solid var(--hairline);
    }

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

    .table-responsive td {
        padding: 4px 14px;
        border-bottom: 0;
    }

    .table-responsive td::before {
        content: attr(data-label);
        display: block;
        color: var(--mute);
        font-size: var(--text-caption);
        font-weight: var(--weight-strong);
        line-height: var(--leading-body);
        letter-spacing: 0.06em;
        text-transform: uppercase;
        margin-bottom: 2px;
    }

    .table-responsive td.table-actions {
        padding-top: 10px;
    }
}

.captcha-frame {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border, #d8dee9);
    border-radius: 10px;
    background: #fff;
}

.captcha-image {
    display: block;
    max-width: 100%;
    height: auto;
    image-rendering: auto;
}

.captcha-placeholder {
    margin: 0;
    color: var(--muted, #5b6472);
    font-size: 0.875rem;
}

.field .captcha-frame + .text-input {
    margin-top: 10px;
}

/* Public documentation */
.docs-page {
    width: min(1040px, 100%);
}

.docs-page .page-subtitle {
    color: var(--ink);
    font-size: 1rem;
}

.docs-title {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: var(--text-page-title, 2rem);
    font-weight: var(--weight-regular, 600);
    line-height: 1.25;
}

.docs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.docs-nav .nav-link {
    border: 1px solid var(--hairline);
    background: var(--canvas);
}

.docs-nav .nav-link.is-active {
    border-color: var(--ink);
}

.docs-markdown {
    color: var(--ink);
    font-size: 16px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.docs-markdown > :first-child {
    margin-top: 0;
}

.docs-markdown > :last-child {
    margin-bottom: 0;
}

.docs-markdown h1,
.docs-markdown h2,
.docs-markdown h3,
.docs-markdown h4 {
    margin: 1.6em 0 0.6em;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.3;
}

.docs-markdown h1 {
    font-size: 1.9rem;
}

.docs-markdown h2 {
    font-size: 1.55rem;
}

.docs-markdown h3 {
    font-size: 1.3rem;
}

.docs-markdown h4 {
    font-size: 1.15rem;
}

.docs-markdown p,
.docs-markdown ul,
.docs-markdown ol,
.docs-markdown table,
.docs-markdown blockquote {
    margin: 0 0 1.1em;
}

.docs-markdown ul,
.docs-markdown ol {
    padding-left: 1.5em;
}

.docs-markdown li {
    margin: 0.25em 0;
}

.docs-markdown strong {
    color: var(--ink);
    font-weight: 700;
}

.docs-markdown a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.docs-markdown code {
    padding: 2px 4px;
    border-radius: 4px;
    background: var(--surface-soft);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.docs-markdown pre {
    margin: 0 0 1.2em;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    background: var(--surface-soft);
}

.docs-markdown pre code {
    padding: 0;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre;
}

.docs-markdown table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.docs-markdown th,
.docs-markdown td {
    padding: 8px 10px;
    border: 1px solid var(--hairline);
    text-align: left;
    vertical-align: top;
}

.docs-markdown th {
    background: var(--surface-soft);
    color: var(--ink);
    font-weight: 600;
}

.docs-markdown blockquote {
    padding: 8px 14px;
    border-left: 3px solid var(--hairline);
    background: var(--surface-soft);
    color: var(--ink);
}

.docs-markdown hr {
    margin: 1.5em 0;
    border: 0;
    border-top: 1px solid var(--hairline);
}

.docs-markdown img {
    max-width: 100%;
    height: auto;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
