:root {
    --bg: #ffffff;
    --shell: #f5f4f0;
    --surface: #ffffff;
    --surface-muted: #f8f8f7;
    --border: #e8e8e5;
    --border-strong: #d0d0cc;
    --text: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #a0a0a0;
    --accent: #ef4444;
    --accent-soft: #fef2f2;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #16a34a;
    --success-soft: #f0fdf4;
    --warning: #d97706;
    --warning-soft: #fff7ed;
    --shadow-floating: 0 1px 3px rgba(0, 0, 0, 0.08);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --row-height: 36px;
    --sidebar-width: 220px;
    --topbar-height: 48px;
    --transition-fast: 150ms ease-out;
    --transition-panel: 200ms ease-out;
    --transition-press: 120ms ease-out;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow: hidden;
    background: var(--shell);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    line-height: 1.45;
}

body.density-comfortable {
    --row-height: 44px;
}

a,
button,
input,
select,
textarea {
    transition:
        border-color 100ms ease-out,
        background-color 100ms ease-out,
        color var(--transition-fast),
        opacity var(--transition-fast),
        transform var(--transition-fast),
        filter 250ms ease;
}

button:active,
.button:active,
.icon-button:active {
    transform: scale(0.97);
    transition-duration: var(--transition-press);
}

.shell {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-left,
.topbar-right,
.header-actions,
.hero-actions,
.row-actions,
.toolbar,
.footer-bar,
.panel-head,
.detail-drawer-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-actions form,
.row-actions form,
.hero-actions form {
    margin: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.brand strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
}

.brand-subtitle {
    display: block;
    color: var(--text-secondary);
    font-size: 11px;
}

.brand-mark {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.icon-button,
.density-toggle,
.button,
button,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.icon-button,
.density-toggle {
    height: 32px;
    padding: 0 10px;
    cursor: pointer;
}

.icon-button:hover,
.density-toggle:hover,
.button:hover,
button:hover,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
select:hover,
textarea:hover {
    border-color: var(--border-strong);
}

.button,
button {
    height: 32px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.button-primary,
button.button-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.button-primary:hover,
button.button-primary:hover {
    background: #991b1b;
    border-color: #991b1b;
}

.density-toggle {
    gap: 8px;
}

.layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

body.sidebar-collapsed .layout {
    grid-template-columns: 68px minmax(0, 1fr);
}

.sidebar {
    min-height: 0;
    min-width: 0;
    border-right: 1px solid var(--border);
    background: var(--surface-muted);
    padding: 14px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-section {
    display: grid;
    gap: 8px;
}

.sidebar-scroll {
    min-height: auto;
    overflow: visible;
}

.sidebar-label,
.eyebrow {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.label,
.dv-label {
    font-size: 9px;
    line-height: 1;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-note,
.muted,
.hint {
    color: var(--text-secondary);
}

.hint {
    font-size: 9px;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    border-color: var(--border-strong);
    background: var(--surface);
    color: var(--text);
}

body.sidebar-collapsed .sidebar {
    padding-inline: 8px;
}

body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-note,
body.sidebar-collapsed .sidebar-nav-tables {
    display: none;
}

body.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    text-align: center;
    padding-inline: 0;
    font-size: 0;
}

body.sidebar-collapsed .sidebar-nav a::before {
    content: attr(data-short);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.main {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.page-scroll,
.workspace-shell {
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding: 18px;
    display: grid;
    gap: 16px;
}

.duty-visit-mode-select,
.import-center-page {
    padding: 2rem 1.5rem 1.5rem;
    gap: 1rem;
    align-content: start;
    align-items: start;
}

.workspace-shell {
    padding-bottom: 90px;
}

.page-header,
.hero-card,
.panel,
.card,
.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.page-header,
.hero-card,
.panel,
.card {
    padding: 16px;
}

.page-header {
    display: grid;
    gap: 10px;
}

.page-header-inline,
.hero-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-header h1,
.hero-card h1,
.panel h2,
.card h2,
.detail-drawer-head h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 600;
}

.panel-head h2,
.card h2 {
    font-size: 18px;
}

.page-header p,
.hero-card p,
.panel-head p,
.card p {
    margin: 6px 0 0;
}

.duty-visit-mode-select .page-header,
.duty-visit-mode-select .card,
.import-center-page .page-header,
.import-center-page .card {
    border-color: #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: none;
    padding: 1rem;
}

.duty-visit-mode-select .eyebrow,
.import-center-page .eyebrow,
.duty-visit-mode-select .sidebar-label,
.import-center-page .sidebar-label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b7280;
    font-weight: 600;
}

.duty-visit-mode-select .page-header h1,
.import-center-page .page-header h1 {
    font-size: 1.25rem;
    line-height: 1.3;
    font-weight: 600;
}

.duty-visit-mode-select .label,
.import-center-page .label,
.import-center-page .field > .label {
    font-size: 0.875rem;
    line-height: 1.3;
    letter-spacing: 0;
    text-transform: none;
    color: #374151;
    font-weight: 400;
}

.hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.stats-grid,
.panel-grid,
.form-section-grid,
.detail-grid {
    display: grid;
    gap: 12px;
}

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

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

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

.stat-card {
    padding: 14px 16px;
}

.stat-value {
    margin-top: 8px;
    font-size: 28px;
    font-weight: 600;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
}

.toolbar-compact {
    gap: 10px;
}

.toolbar-divider {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--border-strong);
}

.inline-field,
.search-field,
.field {
    display: grid;
    gap: 2px;
}

.inline-field select,
.inline-field input,
.search-field input {
    min-width: 120px;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
    width: 100%;
    min-height: 24px;
    height: 24px;
    padding: 0 7px;
    outline: none;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    color: #1a1a1a;
}

textarea {
    min-height: 48px;
    height: 48px;
    padding: 5px 7px;
    resize: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
select:hover,
textarea:hover {
    border-color: rgba(0, 0, 0, 0.22);
    background: #ffffff;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
select:focus,
textarea:focus,
.smart-select.is-open .smart-select-control,
.smart-select.is-focused .smart-select-control {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
    background: #ffffff;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"])[readonly],
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):disabled,
select:disabled,
textarea[readonly],
textarea:disabled {
    background: rgba(0, 0, 0, 0.03);
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;
}

input::placeholder,
select::placeholder,
textarea::placeholder {
    color: #94a3b8;
    font-size: 11px;
    opacity: 0.78;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 22px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4' viewBox='0 0 7 4' fill='none'%3E%3Cpath d='M1 0.75L3.5 3L6 0.75' stroke='%2394A3B8' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    background-size: 7px 4px;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

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

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

.dv-mode-header,
.import-center-header {
    align-items: center;
}

.duty-visit-mode-select > section {
    width: 100%;
    max-width: 920px;
    justify-self: center;
}

.import-center-page > section {
    width: 100%;
    max-width: 1040px;
    justify-self: center;
}

.import-center-page > section:last-child {
    display: flex;
    justify-content: flex-start;
}

.dv-mode-pick-shell {
    display: grid;
    gap: 0.875rem;
    max-width: 920px;
}

.dv-mode-pick-group {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.dv-mode-pick-option {
    --mode-accent: #9ca3af;
    display: grid;
    gap: 0.375rem;
    padding: 0.875rem 1rem;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--mode-accent);
    border-radius: 0.5rem;
    background: #ffffff;
    color: inherit;
    text-decoration: none;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.dv-mode-pick-option:hover {
    border-color: #d1d5db;
    background: #fcfcfd;
}

.dv-mode-pick-option:focus-visible {
    outline: 2px solid rgba(239, 68, 68, 0.2);
    outline-offset: 2px;
}

.dv-mode-pick-option.is-plan {
    --mode-accent: #d97706;
}

.dv-mode-pick-option.is-actual {
    --mode-accent: #15803d;
}

.dv-mode-pick-topline {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.dv-mode-pick-topline strong {
    font-size: 0.95rem;
    line-height: 1.3;
    font-weight: 600;
    color: #111827;
}

.dv-mode-pick-tag {
    display: inline-flex;
    align-items: center;
    min-height: 1.25rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: #f9fafb;
    color: var(--mode-accent);
    font-size: 0.75rem;
    line-height: 1;
    font-weight: 600;
    white-space: nowrap;
}

.dv-mode-pick-copy {
    font-size: 0.875rem;
    line-height: 1.4;
    color: #6b7280;
}

.import-card {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
}

.import-card h2 {
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 600;
}

.import-card .field {
    gap: 0.35rem;
}

.import-card input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.import-card select {
    min-height: 2rem;
    height: 2rem;
    padding: 0 0.625rem;
    font-size: 0.875rem;
}

.import-card input[type="file"] {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.import-card-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.25rem;
}

.import-card .button.button-primary {
    width: auto;
    min-width: 120px;
}

.import-card-secondary {
    width: min(100%, calc((100% - 1rem) / 2));
    max-width: none;
    background: #fcfcfd;
}

.form-grid,
.form-grid-wide {
    display: grid;
    gap: 6px;
}

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

.table-shell,
.duty-table-shell,
.diagram-wrap,
.code {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: auto;
    background: var(--surface);
}

.table-shell,
.duty-table-shell {
    max-width: 100%;
}

.duty-table-shell {
    min-height: calc(var(--row-height) * 20 + 44px);
    max-height: calc(100vh - 230px);
    overflow-x: hidden;
    overflow-y: auto;
}

.duty-table.duty-table-compact {
    font-size: 11px;
    width: 100%;
    max-width: 100%;
}

.duty-table.duty-table-compact thead th {
    height: 24px;
    padding: 1px 3px;
    font-size: 10px;
    letter-spacing: 0.01em;
    text-transform: none;
    white-space: normal;
    line-height: 1.1;
}

.duty-table.duty-table-compact tbody td {
    height: auto;
    min-height: 0;
    padding: 2px 3px;
    font-size: 10px;
    line-height: 1.1;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
}

.duty-title-cell {
    display: grid;
    gap: 1px;
}

.duty-title-link {
    font-size: 10px;
}

.duty-title-text {
    color: var(--text);
    font-size: 10px;
    line-height: 1.1;
}

.duty-pillbox {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: flex-start;
}

.duty-mini-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 11px;
    max-width: 100%;
    padding: 0 3px;
    border-radius: 999px;
    border: 1px solid #d6d3d1;
    background: #f5f5f4;
    color: #334155;
    font-size: 9px;
    font-weight: 600;
    line-height: 1;
    white-space: normal;
    overflow-wrap: anywhere;
}

.duty-pill-meta {
    color: #64748b;
    font-size: 9px;
    font-weight: 500;
}

.duty-pill-filter {
    cursor: pointer;
    transition: filter 120ms ease-out, transform 120ms ease-out;
}

.duty-pill-filter:hover {
    filter: brightness(0.96);
    transform: translateY(-0.5px);
}

.duty-pill-city {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0c4a6e;
}

.duty-pill-country {
    background: #f3e8ff;
    border-color: #ddd6fe;
    color: #5b21b6;
}

.duty-pill-province {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.duty-pill-region {
    background: #ecfccb;
    border-color: #bef264;
    color: #3f6212;
}

.duty-pill-assoc {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.duty-series-pill {
    align-items: baseline;
    background: #fef9c3;
    border-color: #fde68a;
    color: #854d0e;
}

.duty-pill-team {
    background: #ffedd5;
    border-color: #fdba74;
    color: #9a3412;
}

.duty-pill-unit {
    background: #ede9fe;
    border-color: #c4b5fd;
    color: #5b21b6;
}

.duty-delegation-pill {
    background: #ffe4e6;
    border-color: #fecdd3;
    color: #9f1239;
}

.duty-delegation-pill.is-head {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.duty-count-pill {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0c4a6e;
}

.duty-table.duty-table-compact .dv-tag-chip {
    min-height: 11px;
    padding: 0 3px;
    gap: 2px;
    font-size: 9px;
    font-weight: 600;
}

.duty-table.duty-table-compact button.dv-tag-chip {
    height: auto;
    min-height: 11px;
    padding: 0 3px;
}

.duty-table.duty-table-compact .dv-tag-chip-dot {
    width: 4px;
    height: 4px;
}

.duty-table.duty-table-compact .mono {
    font-size: 9px;
}

.duty-table.duty-table-compact .muted {
    font-size: 9px;
}

table.dense {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 12px;
}

table.dense thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    height: 40px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

table.dense tbody td {
    height: var(--row-height);
    min-height: var(--row-height);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.dense tbody tr:hover td {
    background: #f5f5f4;
}

table.dense tbody tr.selected td {
    background: var(--accent-soft);
}

table.dense td.copied {
    background: #fee2e2;
}

.th-sortlink {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

.th-sortlink:hover {
    color: var(--text);
}

.th-sorted {
    color: var(--text);
}

.tag {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tag.fk {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: #fecaca;
}

.align-right {
    text-align: right;
}

.table-link {
    color: var(--accent);
    text-decoration: none;
}

.table-link:hover,
.row-actions a:hover,
.row-menu-sheet a:hover {
    text-decoration: underline;
}

.footer-bar {
    min-height: 36px;
    justify-content: space-between;
    flex-wrap: wrap;
    color: var(--text-secondary);
}

.row-actions {
    flex-wrap: wrap;
}

.row-actions a,
.row-menu-sheet a {
    color: var(--accent);
    text-decoration: none;
}

.row-actions a.button-primary,
.row-menu-sheet a.button-primary {
    color: #ffffff;
    text-decoration: none;
}

.row-actions a.button:not(.button-primary),
.row-menu-sheet a.button:not(.button-primary) {
    color: var(--text);
    text-decoration: none;
}

.row-actions a.button-primary:hover,
.row-menu-sheet a.button-primary:hover,
.row-actions a.button:not(.button-primary):hover,
.row-menu-sheet a.button:not(.button-primary):hover {
    text-decoration: none;
}

.btn-danger {
    border: 0;
    background: transparent;
    color: var(--danger);
    padding: 0;
    height: auto;
}

.btn-danger:hover {
    color: #b91c1c;
}

.workspace-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.duty-toolbar-form {
    align-items: end;
}

.duty-direction-toggle {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    min-height: 24px;
    background: #ffffff;
}

.duty-direction-toggle button {
    min-height: 22px;
    min-width: 34px;
    padding: 0 8px;
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.duty-direction-toggle button:last-child {
    border-right: 0;
}

.duty-direction-toggle button.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.duty-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    background: #fafaf9;
}

.duty-active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 20px;
    padding: 0 8px;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.duty-active-filter-remove {
    font-size: 11px;
    line-height: 1;
}

.workspace-panel {
    gap: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: var(--radius-md);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.badge-direction-in {
    background: #fee2e2;
    color: #991b1b;
}

.badge-direction-out {
    background: #fef3c7;
    color: #b45309;
}

.badge-direction-all {
    background: var(--surface-muted);
    color: var(--text-secondary);
}

.badge-status-plan {
    background: var(--surface-muted);
    color: var(--text-secondary);
}

.badge-status-actual {
    background: var(--success-soft);
    color: var(--success);
}

.badge-status-cancelled {
    background: var(--danger-soft);
    color: var(--danger);
}

.avatar-stack {
    display: flex;
    align-items: center;
}

.avatar-chip {
    width: 24px;
    height: 24px;
    margin-left: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--surface);
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
}

.avatar-chip:first-child {
    margin-left: 0;
}

.avatar-chip-overflow {
    background: var(--accent-soft);
    color: var(--accent);
}

.row-menu {
    position: relative;
}

.row-menu-trigger {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
}

.duty-table tbody tr:hover .row-menu-trigger,
.row-menu.is-open .row-menu-trigger {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.row-menu-sheet {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    display: grid;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-floating);
    z-index: 15;
}

.row-menu-sheet form {
    margin: 0;
}

.empty-state {
    min-height: 220px;
    display: grid;
    place-items: center;
    gap: 8px;
    text-align: center;
}

.bulk-bar {
    position: fixed;
    left: calc(var(--sidebar-width) + 18px);
    right: 18px;
    bottom: 18px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 14px;
    border: 1px solid #fecaca;
    border-radius: var(--radius-lg);
    background: var(--accent-soft);
    box-shadow: var(--shadow-floating);
    z-index: 30;
}

body.sidebar-collapsed .bulk-bar {
    left: 86px;
}

.detail-drawer {
    position: fixed;
    inset: 0;
    z-index: 35;
}

.detail-drawer[hidden] {
    display: none;
}

.detail-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 26, 0.22);
}

.detail-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(600px, 100vw);
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
    border-left: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-floating);
    transform: translateX(0);
    animation: drawer-in var(--transition-panel);
}

.detail-drawer-head,
.detail-drawer-body {
    padding: 16px;
}

.detail-drawer-head {
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.detail-drawer-body {
    overflow: auto;
    display: grid;
    gap: 16px;
}

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

.detail-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    background: var(--surface-muted);
    display: grid;
    gap: 6px;
}

.detail-block strong {
    font-size: 14px;
}

.seed-assist,
.seed-option,
.seed-modal-card,
.seed-modal-item,
.smart-select-menu,
.slide-panel,
.toast {
    box-shadow: var(--shadow-floating);
}

.seed-assist {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-muted);
}

.seed-results {
    display: grid;
    gap: 8px;
}

.seed-option {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    cursor: pointer;
}

.seed-option:hover {
    border-color: var(--border-strong);
}

.seed-option-title {
    font-size: 12px;
    color: var(--text);
}

.seed-option-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.seed-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.seed-pill {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 11px;
}

.seed-pill-country {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: #fecaca;
}

.seed-pill-city {
    background: #eef2ff;
    color: #4338ca;
    border-color: #fecaca;
}

.seed-pill-province {
    background: #fff7ed;
    color: var(--warning);
    border-color: #fed7aa;
}

.seed-pill-ok {
    background: var(--success-soft);
    color: var(--success);
    border-color: #bbf7d0;
}

.seed-pill-warn {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: #fed7aa;
}

.seed-pill-err {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #fecaca;
}

.seed-status.ok {
    color: var(--success);
}

.seed-status.err {
    color: var(--danger);
}

.seed-modal {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(26, 26, 26, 0.22);
}

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

.seed-modal-card {
    width: min(720px, 100%);
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    animation: modal-down var(--transition-panel);
}

.seed-modal-card h2,
.seed-modal-item h3 {
    margin: 0;
}

.seed-modal-preview {
    display: grid;
    gap: 10px;
}

.seed-modal-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-muted);
}

.seed-modal-kv {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    font-size: 12px;
    padding-top: 6px;
}

.panel-stack-page {
    position: relative;
}

.panel-main-content {
    transition: opacity 250ms ease, filter 250ms ease;
}

.panel-main-content.is-panel-dimmed {
    opacity: 0.35;
    filter: blur(1px);
    pointer-events: none;
}

.panel-main-record .page-header h1 {
    font-size: 14px;
    font-weight: 500;
}

.smart-select {
    position: relative;
}

.smart-select.is-open {
    z-index: 60;
}

.smart-select-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 24px;
    min-height: 24px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.85);
    align-items: center;
}

.smart-select:hover .smart-select-control {
    border-color: rgba(0, 0, 0, 0.22);
    background: #ffffff;
}

.smart-select-input {
    min-height: 22px;
    height: 22px;
    padding: 0 7px;
    border: 0;
    background: transparent;
    font-size: 11px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-select-input:focus {
    box-shadow: none;
}

.smart-select-trigger {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    background: transparent;
    color: #94a3b8;
    font-size: 9px;
}

.smart-select-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 14px;
    margin-right: 5px;
    padding: 0 5px;
    border-radius: 4px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.82;
    transition: opacity 120ms ease-out, background-color 120ms ease-out, color 120ms ease-out;
}

.smart-select.is-open .smart-select-badge,
.smart-select.has-value .smart-select-badge {
    opacity: 1;
}

.smart-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 3px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow-floating);
    z-index: 70;
}

.smart-select-menu[hidden] {
    display: none;
}

.smart-select-options-scroll {
    display: grid;
    gap: 1px;
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.quick-panel .smart-select-options-scroll {
    max-height: 330px;
}

.smart-select-group-header {
    padding: 4px 8px;
    color: #64748b;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.smart-select-option,
.smart-select-create,
.smart-select-empty {
    min-height: 24px;
    padding: 4px 7px;
    border-radius: 4px;
    cursor: pointer;
}

.smart-select-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.smart-select-option-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--tag-color, #ef4444);
    flex-shrink: 0;
    margin-right: 6px;
    display: inline-block;
}

.smart-select-option:hover,
.smart-select-create:hover,
.smart-select-option.is-highlighted {
    background: rgba(0, 0, 0, 0.035);
}

.smart-select-option-title,
.smart-select-create {
    color: var(--text);
}

.smart-select-option-title {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-select-option-sub,
.smart-select-empty {
    font-size: 9px;
    color: #94a3b8;
}

.smart-select-option-sub {
    max-width: 42%;
    flex: 0 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 9px;
}

.smart-select-create,
.smart-select-empty {
    display: flex;
    align-items: center;
}

.smart-select-create {
    color: #ef4444;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 10px;
    font-weight: 600;
    margin-top: 1px;
}

.smart-select.is-disabled {
    opacity: 0.5;
}

.smart-select.is-disabled .smart-select-control {
    background: rgba(0, 0, 0, 0.03);
}

.smart-select.is-disabled:hover .smart-select-control {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.03);
}

.smart-select.is-disabled .smart-select-input,
.smart-select.is-disabled .smart-select-trigger {
    cursor: not-allowed;
}

.smart-select.is-not-found .smart-select-control,
.quick-panel .smart-select.is-not-found .smart-select-control {
    border-color: #f59e0b;
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
}

.quick-panel .smart-select.is-not-found.is-focused .smart-select-control,
.quick-panel .smart-select.is-not-found.is-open .smart-select-control {
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

.quick-panel .smart-select.is-not-found .smart-select-badge {
    background: #fef3c7;
    color: #92400e;
}

.smart-select-inline-hint {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 11px;
    font-size: 9px;
    color: #d97706;
}

.smart-select-inline-hint[hidden] {
    display: none;
}

.smart-select-hint-action {
    height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 9px;
    text-decoration: underline;
}

.smart-select-hint-muted {
    color: #94a3b8;
}

.slide-panel-shell {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
}

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

.slide-panel-shell.is-on {
    pointer-events: auto;
}

.slide-panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0);
    transition: background 200ms ease;
    pointer-events: none;
}

.slide-panel-shell.is-on .slide-panel-backdrop {
    background: rgba(15, 23, 42, 0.35);
    pointer-events: auto;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 264px;
    display: grid;
    grid-template-rows: auto auto auto;
    align-content: start;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-floating);
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-panel[data-panel-level="2"] {
    width: 248px;
    z-index: 120;
}

.slide-panel[data-panel-level="3"] {
    width: 240px;
    z-index: 130;
}

.slide-panel[data-panel-level="1"] {
    z-index: 110;
}

.slide-panel.is-open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.slide-panel.is-pushed {
    opacity: 0.55;
    transform: translateX(-28px);
    pointer-events: none;
}

.slide-panel.is-completing {
    opacity: 0;
    transform: translateX(0);
    pointer-events: none;
}

.col-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
}

th[data-resizable] {
    position: sticky;
}

.slide-panel-header,
.slide-panel-body,
.slide-panel-footer {
    padding-inline: 10px;
}

.slide-panel-header {
    min-height: 34px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-block: 5px 4px;
    border-bottom: 1px solid #f0f0ee;
    background: #fafaf9;
}

.slide-panel-body {
    overflow: auto;
    display: grid;
    align-content: start;
    grid-auto-rows: max-content;
    gap: 4px;
    padding-block: 6px 4px;
    max-height: calc(100vh - 84px);
}

.slide-panel-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding-block: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.slide-panel[data-panel-level="2"] .slide-panel-header {
    background: #fff7ed;
    border-bottom-color: #fee9b8;
}

.quick-panel-tag {
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.slide-panel[data-panel-level="2"] .quick-panel-tag {
    color: #92400e;
}

.quick-panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.quick-panel-title {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: #1a1a1a;
}

.quick-panel-close {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: 15px;
}

.quick-panel-close:hover {
    color: #ef4444;
}

.quick-panel-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 9px;
}

.quick-panel-breadcrumb span {
    font-size: 9px;
    color: #6b7280;
}

.quick-panel-breadcrumb .is-current {
    font-weight: 600;
    color: #dc2626;
}

.slide-panel[data-panel-level="2"] .quick-panel-breadcrumb .is-current {
    color: #d97706;
}

.quick-panel-breadcrumb-sep {
    color: #cbd5e1;
}

.slide-panel .field {
    gap: 1px;
    align-content: start;
}

.slide-panel .button,
.slide-panel button {
    height: 24px;
    padding: 0 8px;
    font-size: 10px;
}

.quick-panel-field {
    margin: 0;
}

.quick-panel-field .label {
    line-height: 1;
}

.quick-panel-field input,
.quick-panel-field textarea,
.quick-panel-field select,
.quick-panel-field .smart-select-control {
    margin-top: 0;
}

.quick-panel-field input[type="color"],
.quick-panel-field .color-input {
    height: 28px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 2px 4px;
}

.quick-panel-field input[type="color"],
.quick-panel-field .color-input {
    width: 68px;
    min-width: 68px;
    max-width: 68px;
    cursor: pointer;
}

.quick-panel-field .color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.quick-panel-field .color-input::-webkit-color-swatch {
    border: 0;
    border-radius: 5px;
}

.quick-panel-field .smart-select-inline-hint {
    margin-top: 1px;
    line-height: 1.15;
}

.slide-panel .smart-select-control,
.slide-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.slide-panel select,
.slide-panel textarea {
    font-size: 11px;
}

.toast-stack {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    gap: 8px;
    z-index: 50;
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 220px;
    padding: 6px 12px;
    border: 1px solid #a7f3d0;
    border-radius: 5px;
    background: #ffffff;
    color: #065f46;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 140ms ease-in, transform 140ms ease-in;
}

.toast-success {
    border-color: #a7f3d0;
    background: #ffffff;
}

.toast-error {
    border-color: #fecaca;
    color: #991b1b;
}

.toast-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #10b981;
    flex: 0 0 auto;
}

.toast-error .toast-dot {
    background: #ef4444;
}

.toast-copy {
    display: grid;
    gap: 1px;
}

.toast-title {
    font-size: 11px;
    font-weight: 500;
}

.toast-body {
    font-size: 10px;
    color: inherit;
    opacity: 0.82;
}

.enum-values {
    color: var(--text-secondary);
}

.diagram-wrap .mermaid,
.code {
    min-width: 900px;
    padding: 16px;
}

.code {
    margin: 0;
    white-space: pre;
}

summary {
    cursor: pointer;
}

@keyframes drawer-in {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes modal-down {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 960px) {
    .import-center-grid,
    .dv-mode-pick-group {
        grid-template-columns: 1fr;
    }

    .import-card-secondary {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .duty-visit-mode-select,
    .import-center-page {
        padding: 1rem;
    }
}

@media (max-width: 1080px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .stats-grid,
    .panel-grid-3,
    .form-grid-wide .form-section-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .workspace-toolbar,
    .hero-card {
        flex-direction: column;
        align-items: stretch;
    }

    .bulk-bar {
        left: 16px;
        right: 16px;
    }
}

.duty-visit-form-page {
    padding-top: 28px;
    align-content: start;
    align-items: start;
}

.dv-editor {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    display: grid;
    gap: 7px;
    align-self: start;
}

.dv-editor-topbar,
.dv-editor-footer {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.dv-editor-topbar {
    position: sticky;
    top: 0;
    z-index: 18;
}

.dv-editor-footer {
    position: sticky;
    bottom: 16px;
    z-index: 18;
    box-shadow: var(--shadow-floating);
}

.dv-editor-topbar-left,
.dv-editor-topbar-right,
.dv-pill-row,
.dv-section-header,
.dv-section-heading,
.dv-date-range,
.dv-officer-picker,
.dv-officer-chip,
.dv-bool-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dv-back-button {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
}

.dv-breadcrumb,
.dv-helper-text,
.dv-hint {
    font-size: 9px;
    color: #94a3b8;
}

.dv-editor-body {
    display: grid;
    gap: 7px;
}

.dv-editor-hero {
    display: grid;
    gap: 4px;
}

.dv-editor-hero h1 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.dv-pill {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
}

.dv-pill-draft {
    background: #fef2f2;
    color: #991b1b;
}

.dv-pill-plan {
    background: #fffbeb;
    color: #b45309;
}

.dv-pill-actual {
    background: #f0fdf4;
    color: #166534;
}

.dv-section {
    position: relative;
    --section-border: #e2e8f0;
    --section-card-bg: linear-gradient(135deg, #fef2f2 0%, #fafafa 100%);
    --section-body-bg: rgba(248, 250, 252, 0.5);
    --section-stripe: #94a3b8;
    --section-icon-bg: rgba(148, 163, 184, 0.15);
    --section-icon-color: #94a3b8;
    margin-bottom: 7px;
    border: 1px solid var(--section-border);
    border-radius: 8px;
    background: var(--section-card-bg);
    overflow: visible;
    z-index: 0;
}

.dv-section.has-open-select {
    z-index: 20;
}

.dv-section::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    border-radius: 8px 0 0 8px;
    background: var(--section-stripe);
}

.dv-section-blue {
    --section-border: #fecaca;
    --section-card-bg: linear-gradient(135deg, #fef2f2 0%, #fef2f2 100%);
    --section-body-bg: rgba(239, 246, 255, 0.5);
    --section-stripe: #dc2626;
    --section-icon-bg: rgba(239, 68, 68, 0.15);
    --section-icon-color: #dc2626;
}

.dv-section-violet {
    --section-border: #ddd6fe;
    --section-card-bg: linear-gradient(135deg, #f5f3ff 0%, #faf9ff 100%);
    --section-body-bg: rgba(245, 243, 255, 0.5);
    --section-stripe: #f87171;
    --section-icon-bg: rgba(139, 92, 246, 0.15);
    --section-icon-color: #f87171;
}

.dv-section-emerald {
    --section-border: #a7f3d0;
    --section-card-bg: linear-gradient(135deg, #ecfdf5 0%, #f7fff9 100%);
    --section-body-bg: rgba(236, 253, 245, 0.5);
    --section-stripe: #10b981;
    --section-icon-bg: rgba(16, 185, 129, 0.15);
    --section-icon-color: #10b981;
}

.dv-section-amber {
    --section-border: #fde68a;
    --section-card-bg: linear-gradient(135deg, #fffbeb 0%, #fffef5 100%);
    --section-body-bg: rgba(255, 251, 235, 0.5);
    --section-stripe: #f59e0b;
    --section-icon-bg: rgba(245, 158, 11, 0.15);
    --section-icon-color: #f59e0b;
}

.dv-section-slate {
    --section-border: #e2e8f0;
    --section-card-bg: linear-gradient(135deg, #fef2f2 0%, #fafafa 100%);
    --section-body-bg: rgba(248, 250, 252, 0.5);
    --section-stripe: #94a3b8;
    --section-icon-bg: rgba(148, 163, 184, 0.15);
    --section-icon-color: #94a3b8;
}

.dv-section-header {
    width: 100%;
    min-height: 34px;
    justify-content: space-between;
    padding: 0 10px 0 13px;
    border: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.dv-section:not(.is-collapsed) .dv-section-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.dv-section-heading {
    align-items: center;
    gap: 8px;
}

.dv-section-heading strong {
    display: inline;
    font-size: 11px;
    font-weight: 600;
    color: #1a1a1a;
}

.dv-section-copy {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 4px;
}

.dv-section-subtitle {
    min-width: 0;
    font-size: 10px;
    font-weight: 400;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dv-section-subtitle::before {
    content: "·";
    margin-right: 4px;
    color: #cbd5e1;
}

.dv-section-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--section-icon-bg);
    color: var(--section-icon-color);
}

.dv-section-icon svg {
    width: 12px;
    height: 12px;
}

.dv-section-chevron {
    color: #94a3b8;
    font-size: 9px;
    transition: transform 180ms ease;
}

.dv-section.is-collapsed .dv-section-chevron {
    transform: rotate(-90deg);
}

.dv-section.is-collapsed .dv-section-header {
    border-bottom: 0;
}

.dv-section-body {
    display: grid;
    gap: 6px;
    padding: 8px 10px 10px 13px;
    background: var(--section-body-bg);
    overflow: visible;
    max-height: 1000px;
    transition: max-height 220ms ease, padding 150ms ease-out, opacity 150ms ease-out;
    opacity: 1;
}

.dv-section.is-collapsed .dv-section-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
}

.dv-grid-two,
.dv-grid-three {
    display: grid;
    gap: 6px;
}

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

.dv-grid-two-tight {
    grid-template-columns: 100px minmax(0, 1fr);
}

.dv-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dv-field {
    display: grid;
    gap: 2px;
}

[data-planned-year-wrap][hidden],
[data-planned-month-wrap][hidden],
[data-planned-quarter-wrap][hidden] {
    display: none !important;
}

.dv-field-full {
    grid-column: 1 / -1;
}

.dv-field-compact input {
    width: 100px;
}

.dv-required {
    color: #ef4444;
    font-size: 8px;
    margin-left: 2px;
}

.dv-field input,
.dv-field textarea,
.dv-field select,
.dv-id-badge {
    border-radius: 4px;
}

.dv-field .dv-multiselect {
    min-height: 120px;
    height: auto;
    padding: 6px 8px;
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    background-image: none;
}

.dv-unit-option-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    display: inline-block;
}

.dv-unit-pillbox {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 20px;
    max-height: 56px;
    overflow-y: auto;
    align-content: flex-start;
    padding-right: 2px;
}

.dv-unit-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    min-height: 18px;
    font-size: 9px;
    line-height: 1;
    border: 1px solid transparent;
    background: #fef2f2;
    color: #1f2937;
}

.dv-unit-pill-remove {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 10px;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}

.dv-unit-pill-empty {
    color: #6b7280;
    font-size: 10px;
}

.dv-unit-pill-blue {
    background: #fef2f2;
    border-color: #fecaca;
    color: #1e3a8a;
}

.dv-unit-pill-amber {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.dv-unit-pill-green {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.dv-unit-pill-teal {
    background: #f0fdfa;
    border-color: #99f6e4;
    color: #115e59;
}

.dv-unit-pill-coral {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.dv-unit-pill-purple {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.dv-unit-pill-pink {
    background: #fdf2f8;
    border-color: #f9a8d4;
    color: #9d174d;
}

.dv-unit-option-dot.dv-unit-pill-blue {
    background: #ef4444;
    border: 0;
}

.dv-unit-option-dot.dv-unit-pill-amber {
    background: #d97706;
    border: 0;
}

.dv-unit-option-dot.dv-unit-pill-green {
    background: #16a34a;
    border: 0;
}

.dv-unit-option-dot.dv-unit-pill-teal {
    background: #0d9488;
    border: 0;
}

.dv-unit-option-dot.dv-unit-pill-coral {
    background: #ea580c;
    border: 0;
}

.dv-unit-option-dot.dv-unit-pill-purple {
    background: #dc2626;
    border: 0;
}

.dv-unit-option-dot.dv-unit-pill-pink {
    background: #db2777;
    border: 0;
}

.dv-id-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 7px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.03);
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;
}

.dv-divider {
    height: 1px;
    margin: 6px 0;
    background: rgba(0, 0, 0, 0.07);
}

.dv-date-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
}

.dv-schedule-date-block {
    display: grid;
    gap: 8px;
}

.dv-subsection-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.dv-subsection-head strong {
    color: var(--ds-text-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.dv-subsection-head span {
    color: var(--ds-text-muted);
    font-size: 12px;
    text-align: right;
}

.dv-date-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 12px;
}

.dv-date-range.is-derived input {
    background: rgba(0, 0, 0, 0.03);
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;
    cursor: default;
}

.dv-date-separator {
    color: #94a3b8;
    font-size: 10px;
}

.dv-officer-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
}

.dv-officer-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dv-officer-assignment-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.dv-officer-assignment-row {
    display: grid;
    grid-template-columns: minmax(180px, 0.9fr) minmax(0, 1.1fr);
    gap: 10px;
    align-items: center;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
}

.dv-officer-assignment-copy {
    display: grid;
    gap: 2px;
}

.dv-officer-assignment-copy strong {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

.dv-officer-assignment-copy span {
    font-size: 10px;
    color: #6b7280;
}

.dv-officer-assignment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: end;
}

.dv-officer-assignment-empty {
    font-size: 10px;
    color: #6b7280;
    padding: 6px 0;
}

.dv-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dv-inline-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(239, 68, 68, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    font-size: 10px;
}

.dv-inline-tag-sub {
    color: #6b7280;
}

.dv-officer-chip {
    min-height: 24px;
    padding: 3px 7px 3px 4px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transform-origin: left center;
    animation: chip-in 140ms ease-out;
}

.dv-officer-avatar {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 9px;
    font-weight: 600;
}

.dv-officer-chip-text {
    display: grid;
    gap: 1px;
    text-align: left;
}

.dv-officer-chip-text strong {
    font-size: 10px;
    font-weight: 500;
    color: var(--text);
}

.dv-officer-chip-text span,
.dv-officer-chip-close {
    font-size: 10px;
    color: #6b6b6b;
}

.dv-bool-toggle {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    overflow: hidden;
}

.dv-bool-toggle button {
    flex: 1;
    min-width: 0;
    height: 24px;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.85);
    color: #475569;
    font-size: 10px;
    font-weight: 600;
    transition: background-color 100ms ease-out, border-color 100ms ease-out, color 100ms ease-out, transform 80ms ease-out;
}

.dv-bool-toggle button + button {
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.dv-bool-toggle button.is-active.is-yes {
    background: #f0fdf4;
    color: #065f46;
    box-shadow: inset 0 0 0 1px #6ee7b7;
}

.dv-bool-toggle button.is-active.is-no {
    background: #fef2f2;
    color: #475569;
    box-shadow: inset 0 0 0 1px #cbd5e1;
}

.dv-field-readonly {
    opacity: 0.45;
}

.dv-field-readonly input {
    background: rgba(0, 0, 0, 0.03);
}

.dv-editor .button,
.dv-editor button {
    transform-origin: center;
}

.dv-editor .button:active,
.dv-editor button:active {
    transition-duration: 80ms;
}

.dv-section:nth-of-type(1) {
    animation: section-in 180ms ease-out both;
    animation-delay: 0ms;
}

.dv-section:nth-of-type(2) {
    animation: section-in 180ms ease-out both;
    animation-delay: 40ms;
}

.dv-section:nth-of-type(3) {
    animation: section-in 180ms ease-out both;
    animation-delay: 80ms;
}

.dv-section:nth-of-type(4) {
    animation: section-in 180ms ease-out both;
    animation-delay: 120ms;
}

.dv-section:nth-of-type(5) {
    animation: section-in 180ms ease-out both;
    animation-delay: 160ms;
}

@keyframes section-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes chip-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 900px) {
    .dv-editor-topbar,
    .dv-editor-footer,
    .dv-editor-topbar-left,
    .dv-editor-topbar-right {
        flex-direction: column;
        align-items: stretch;
    }

    .dv-grid-two,
    .dv-grid-three,
    .dv-grid-two-tight,
    .dv-officer-picker,
    .dv-date-range,
    .dv-officer-assignment-row,
    .dv-officer-assignment-grid {
        grid-template-columns: 1fr;
    }

    .dv-date-separator {
        display: none;
    }

    .dv-subsection-head {
        display: grid;
        gap: 4px;
    }

    .dv-subsection-head span {
        text-align: left;
    }
}

.duty-visit-form-page[data-entry-mode="plan"] {
    --dv-accent: #f59e0b;
    --dv-title: #78350f;
    --dv-page-pill-bg: #fef3c7;
    --dv-page-pill-text: #92400e;
    --dv-page-pill-border: #fde68a;
    --dv-modebar-bg: linear-gradient(90deg, #fef3c7, #fffbeb);
    --dv-modebar-border: #f59e0b;
    --dv-mode-pill-bg: #f59e0b;
    --dv-card-border: #fde68a;
    --dv-card-bg: linear-gradient(135deg, #fef3c7, #fffef0);
    --dv-body-bg: rgba(254, 243, 199, 0.4);
    --dv-stripe: #f59e0b;
    --dv-icon-bg: rgba(245, 158, 11, 0.15);
    --dv-icon-color: #f59e0b;
    --dv-input-border: rgba(245, 158, 11, 0.3);
    --dv-focus-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
    --dv-fk-bg: #fef3c7;
    --dv-fk-text: #92400e;
    --dv-button-bg: #78350f;
    --dv-button-text: #fef3c7;
}

.duty-visit-form-page[data-entry-mode="actual"] {
    --dv-accent: #16a34a;
    --dv-title: #14532d;
    --dv-page-pill-bg: #dcfce7;
    --dv-page-pill-text: #15803d;
    --dv-page-pill-border: #86efac;
    --dv-modebar-bg: linear-gradient(90deg, #dcfce7, #f0fdf4);
    --dv-modebar-border: #16a34a;
    --dv-mode-pill-bg: #16a34a;
    --dv-card-border: #86efac;
    --dv-card-bg: linear-gradient(135deg, #dcfce7, #f7fff9);
    --dv-body-bg: rgba(220, 252, 231, 0.4);
    --dv-stripe: #16a34a;
    --dv-icon-bg: rgba(22, 163, 74, 0.15);
    --dv-icon-color: #16a34a;
    --dv-input-border: rgba(22, 163, 74, 0.3);
    --dv-focus-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
    --dv-fk-bg: #dcfce7;
    --dv-fk-text: #166534;
    --dv-button-bg: #14532d;
    --dv-button-text: #dcfce7;
}

.duty-visit-form-page .dv-editor-hero h1 { color: var(--dv-title); }
.duty-visit-form-page .dv-pill-subtle { background: var(--dv-page-pill-bg); color: var(--dv-page-pill-text); border: 1px solid var(--dv-page-pill-border); }
.duty-visit-form-page .dv-tabbar { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.duty-visit-form-page .dv-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-bottom: 2px solid transparent; color: #6b7280; text-decoration: none; background: rgba(255,255,255,0.45); }
.duty-visit-form-page .dv-tab.is-active.is-plan { color: #78350f; border-bottom-color: #f59e0b; background: linear-gradient(180deg, rgba(254,243,199,0.7), rgba(255,255,255,0.55)); }
.duty-visit-form-page .dv-tab.is-active.is-actual { color: #14532d; border-bottom-color: #16a34a; background: linear-gradient(180deg, rgba(220,252,231,0.7), rgba(255,255,255,0.55)); }
.duty-visit-form-page .dv-tab.is-active.is-compare { color: #991b1b; border-bottom-color: #dc2626; }
.duty-visit-form-page .dv-tab.is-active:not(.is-plan):not(.is-actual):not(.is-compare) { color: #991b1b; border-bottom-color: #dc2626; background: linear-gradient(180deg, rgba(254,226,226,0.72), rgba(255,255,255,0.55)); }
.duty-visit-form-page .dv-tab.is-disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.duty-visit-form-page .dv-tab-dot { width: 6px; height: 6px; border-radius: 999px; background: #cbd5e1; transition: background-color 150ms ease-out, opacity 150ms ease-out; }
.duty-visit-form-page .dv-tab.is-complete .dv-tab-dot { background: #16a34a; }
.duty-visit-form-page .dv-tab.is-missing .dv-tab-dot { background: #dc2626; }
.duty-visit-form-page .dv-tab.is-disabled .dv-tab-dot { background: #cbd5e1; opacity: 0.7; }
.duty-visit-form-page .dv-modebar { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 12px; border-bottom: 2px solid var(--dv-modebar-border); background: var(--dv-modebar-bg); border-radius: 8px 8px 0 0; }
.duty-visit-form-page .dv-mode-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--dv-mode-pill-bg); color: #fff; font-size: 10px; font-weight: 700; }
.duty-visit-form-page .dv-mode-copy { font-size: 10px; color: #6b7280; }
.duty-visit-form-page .dv-section { --section-border: var(--dv-card-border); --section-card-bg: var(--dv-card-bg); --section-body-bg: var(--dv-body-bg); --section-stripe: var(--dv-stripe); --section-icon-bg: var(--dv-icon-bg); --section-icon-color: var(--dv-icon-color); }
.duty-visit-form-page .dv-editor .button.button-primary,
.duty-visit-form-page .dv-copy-actions .button.button-primary { background: var(--dv-button-bg); border-color: var(--dv-button-bg); color: var(--dv-button-text); }
.duty-visit-form-page .dv-field input,
.duty-visit-form-page .dv-field textarea,
.duty-visit-form-page .dv-field select,
.duty-visit-form-page .smart-select-control { border-color: var(--dv-input-border); }
.duty-visit-form-page .dv-field input:focus,
.duty-visit-form-page .dv-field textarea:focus,
.duty-visit-form-page .dv-field select:focus,
.duty-visit-form-page .smart-select.is-focused .smart-select-control,
.duty-visit-form-page .smart-select.is-open .smart-select-control { border-color: var(--dv-accent); box-shadow: var(--dv-focus-shadow); }
.duty-visit-form-page .smart-select-badge { background: var(--dv-fk-bg); color: var(--dv-fk-text); }
.duty-visit-form-page .dv-copy-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid #fecaca; border-radius: 6px; background: #fef2f2; }
.duty-visit-form-page .dv-copy-banner-copy { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; }
.duty-visit-form-page .dv-copy-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: #fee2e2; color: #ef4444; }
.duty-visit-form-page .dv-copy-actions { display: inline-flex; gap: 6px; }
.duty-visit-form-page .dv-copy-actions .button { height: 24px; font-size: 10px; }
.duty-visit-form-page .dv-copy-notice { font-size: 10px; color: #166534; }
.duty-visit-form-page .dv-compare-card { display: grid; gap: 8px; border: 1px solid #e8e8e5; border-radius: 7px; background: #fff; overflow: hidden; }
.duty-visit-form-page .dv-compare-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 0; }
.duty-visit-form-page .dv-compare-table { width: 100%; border-collapse: collapse; }
.duty-visit-form-page .dv-compare-table th,
.duty-visit-form-page .dv-compare-table td { padding: 8px 10px; border-top: 1px solid #f0f0ee; vertical-align: top; font-size: 11px; }
.duty-visit-form-page .dv-compare-table th:first-child,
.duty-visit-form-page .dv-compare-table td:first-child { width: 130px; background: #fafaf9; border-right: 1px solid #f0f0ee; color: #6b7280; font-size: 10px; font-weight: 500; }
.duty-visit-form-page .dv-compare-table th.is-plan { background: #fef3c7; color: #78350f; border-bottom: 2px solid #f59e0b; }
.duty-visit-form-page .dv-compare-table th.is-actual { background: #dcfce7; color: #14532d; border-bottom: 2px solid #16a34a; }
.duty-visit-form-page .dv-compare-table td:nth-child(2) { background: #fffbeb; color: #78350f; }
.duty-visit-form-page .dv-compare-table td:nth-child(3) { background: #f0fdf4; color: #166534; }
.duty-visit-form-page .dv-diff-badge { display: inline-flex; margin-left: 6px; padding: 1px 6px; border-radius: 999px; border: 1px solid transparent; font-size: 10px; }
.duty-visit-form-page .dv-diff-badge.is-changed { background: #fef9c3; color: #713f12; border-color: #fde68a; }
.duty-visit-form-page .dv-diff-badge.is-decrease { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.duty-visit-form-page .dv-diff-badge.is-increase { background: #dcfce7; color: #14532d; border-color: #86efac; }
.duty-visit-form-page .dv-compare-empty { color: #94a3b8; font-style: italic; }
.duty-visit-form-page .dv-compare-legend { padding: 0 12px 10px; font-size: 10px; color: #6b7280; }
.duty-visit-form-page .dv-bool-toggle { display: flex; gap: 4px; border: 0; background: transparent; overflow: visible; }
.duty-visit-form-page .dv-bool-toggle.is-invalid button { border-color: #fca5a5; }
.duty-visit-form-page .dv-bool-toggle button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 24px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.10); background: rgba(255,255,255,0.6); color: #6b7280; font-weight: 400; transition: all 120ms ease; }
.duty-visit-form-page .dv-bool-toggle button + button { border-left: 1px solid rgba(0,0,0,0.10); }
.duty-visit-form-page .dv-bool-dot { width: 5px; height: 5px; border-radius: 999px; flex-shrink: 0; background: #d1d5db; }
.duty-visit-form-page .dv-bool-toggle button[data-bool-value="true"]:hover { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.duty-visit-form-page .dv-bool-toggle button[data-bool-value="false"]:hover { border-color: #fecaca; background: #fef2f2; color: #dc2626; }
.duty-visit-form-page .dv-bool-toggle button.is-active.is-yes { background: #f0fdf4; border-color: #86efac; color: #15803d; font-weight: 600; box-shadow: none; }
.duty-visit-form-page .dv-bool-toggle button.is-active.is-yes .dv-bool-dot { background: #16a34a; }
.duty-visit-form-page .dv-bool-toggle button.is-active.is-no { background: #fef2f2; border-color: #fecaca; color: #dc2626; font-weight: 500; box-shadow: none; }
.duty-visit-form-page .dv-bool-toggle button.is-active.is-no .dv-bool-dot { background: #dc2626; }
.duty-visit-form-page .dv-stream-unit-row { align-items: start; }
.duty-visit-form-page .dv-stream-field,
.duty-visit-form-page .dv-units-field { align-self: start; }
.duty-visit-form-page .dv-stream-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    max-width: 240px;
    padding: 2px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fef2f2;
}
.duty-visit-form-page .dv-stream-toggle.is-invalid { border-color: #fca5a5; }
.duty-visit-form-page .dv-stream-toggle button {
    min-width: 0;
    height: 22px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
    transition: background-color 120ms ease, color 120ms ease;
}
.duty-visit-form-page .dv-stream-toggle button + button { border-left: 0; }
.duty-visit-form-page .dv-stream-toggle .dv-bool-dot { display: none; }
.duty-visit-form-page .dv-stream-toggle button[data-stream-value="FIRE"]:hover { background: #fef3c7; color: #92400e; }
.duty-visit-form-page .dv-stream-toggle button[data-stream-value="AMB"]:hover { background: #fee2e2; color: #991b1b; }
.duty-visit-form-page .dv-stream-toggle button.is-active.is-fire { background: #f59e0b; color: #fff; box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.35); }
.duty-visit-form-page .dv-stream-toggle button.is-active.is-amb { background: #ef4444; color: #fff; box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.35); }
.duty-visit-form-page .dv-field-muted { align-content: end; }

.duty-visit-form-page[data-current-tab="shared"] .dv-modebar {
    border-bottom-color: #dc2626;
    background: linear-gradient(90deg, #fee2e2, #fef2f2);
}

.duty-visit-form-page[data-current-tab="shared"] .dv-mode-copy {
    color: #991b1b;
}

.duty-visit-form-page[data-current-tab="shared"] .dv-mode-pill {
    background: #ef4444;
}

.duty-visit-form-page[data-current-tab="shared"] .dv-editor-hero h1 {
    color: #991b1b;
}

.duty-visit-form-page[data-current-tab="shared"] .dv-pill-subtle {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.duty-visit-form-page[data-current-tab="shared"] .dv-section {
    --section-border: #fecaca;
    --section-card-bg: linear-gradient(135deg, #fee2e2, #fef2f2);
    --section-body-bg: rgba(254, 226, 226, 0.42);
    --section-stripe: #dc2626;
    --section-icon-bg: rgba(239, 68, 68, 0.15);
    --section-icon-color: #ef4444;
}

.duty-visit-form-page[data-current-tab="shared"] .dv-field input,
.duty-visit-form-page[data-current-tab="shared"] .dv-field textarea,
.duty-visit-form-page[data-current-tab="shared"] .dv-field select,
.duty-visit-form-page[data-current-tab="shared"] .smart-select-control {
    border-color: rgba(239, 68, 68, 0.28);
}

.duty-visit-form-page[data-current-tab="shared"] .dv-field input:focus,
.duty-visit-form-page[data-current-tab="shared"] .dv-field textarea:focus,
.duty-visit-form-page[data-current-tab="shared"] .dv-field select:focus,
.duty-visit-form-page[data-current-tab="shared"] .smart-select.is-focused .smart-select-control,
.duty-visit-form-page[data-current-tab="shared"] .smart-select.is-open .smart-select-control {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15);
}

.duty-visit-form-page[data-current-tab="shared"] .smart-select-badge {
    background: #fee2e2;
    color: #991b1b;
}

.duty-visit-form-page[data-current-tab="shared"] .dv-editor .button.button-primary,
.duty-visit-form-page[data-current-tab="shared"] .dv-copy-actions .button.button-primary {
    background: #991b1b;
    border-color: #991b1b;
    color: #fef2f2;
}

@media (max-width: 900px) {
    .dv-mode-pick-group,
    .duty-visit-form-page .dv-tabbar,
    .duty-visit-form-page .dv-modebar,
    .duty-visit-form-page .dv-copy-banner {
        display: grid;
        grid-template-columns: 1fr;
    }
}

.dv-tag-picker-stack,
.dv-tag-readonly-row,
.vt-tag-pills,
.vt-result-tags,
.vt-saved-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dv-duty-tag-control {
    display: grid;
    gap: 4px;
}

.dv-duty-tag-selected-list {
    min-height: 18px;
    gap: 4px;
}

.dv-duty-tag-searchbox {
    position: relative;
}

.dv-duty-tag-search-input {
    width: 100%;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 12px;
}

.dv-duty-tag-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow: auto;
    display: grid;
    gap: 2px;
    padding: 2px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: var(--shadow-floating);
    z-index: 80;
}

.dv-duty-tag-menu-scroll {
    display: grid;
    gap: 4px;
    max-height: 230px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.dv-duty-tag-group-header {
    margin: 4px 6px 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.dv-duty-tag-option-list {
    display: grid;
    gap: 3px;
}

.dv-duty-tag-suggestion,
.dv-tag-group-option {
    min-height: 22px;
    border: 1px solid transparent;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 7px;
    cursor: pointer;
    background: transparent;
}

.dv-duty-tag-suggestion:hover,
.dv-tag-group-option:hover,
.dv-duty-tag-suggestion.is-highlighted,
.dv-tag-group-option.is-highlighted {
    background: rgba(0, 0, 0, 0.05);
}

.dv-duty-tag-suggestion-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--tag-color, #ef4444);
}

.dv-duty-tag-suggestion-text {
    font-size: 11px;
}

.dv-duty-tag-suggestion-check {
    margin-left: auto;
    font-size: 9px;
    color: var(--text-secondary);
}

.dv-duty-tag-add-suggestion {
    color: var(--accent);
    font-weight: 600;
}

.dv-duty-tag-group-menu {
    margin-top: 2px;
    position: relative;
    z-index: 81;
    max-height: 240px;
    overflow: auto;
    display: grid;
    gap: 1px;
    padding-right: 1px;
}

.dv-tag-group-option-sub {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 9px;
}

.dv-tag-group-option-create {
    border-style: dashed;
    color: var(--accent);
    font-weight: 600;
}

.dv-duty-tag-group-empty {
    padding: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.dv-duty-tag-quick-panel {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 96%, white);
}

.dv-duty-tag-quick-panel .dv-field {
    margin: 0;
}

.dv-duty-tag-group-search,
.dv-duty-tag-quick-name,
.dv-duty-tag-new-group-name,
.dv-duty-tag-new-group-color {
    width: 100%;
}

.dv-duty-tag-new-group {
    display: grid;
    gap: 5px;
    padding: 5px;
    border: 1px dashed rgba(0, 0, 0, 0.18);
    border-radius: 6px;
}

.dv-duty-tag-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.dv-tag-chip {
    --tag-color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--tag-color) 28%, white);
    background: color-mix(in srgb, var(--tag-color) 10%, white);
    color: color-mix(in srgb, var(--tag-color) 72%, black);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

button.dv-tag-chip {
    cursor: pointer;
}

button.dv-tag-chip:hover {
    border-color: color-mix(in srgb, var(--tag-color) 50%, white);
    background: color-mix(in srgb, var(--tag-color) 16%, white);
}

.dv-tag-chip.is-selected {
    border-color: color-mix(in srgb, var(--tag-color) 70%, white);
    background: color-mix(in srgb, var(--tag-color) 20%, white);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-color) 20%, transparent);
}

.dv-tag-chip-check {
    font-size: 9px;
    opacity: 0.88;
}

.dv-tag-chip-remove {
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.72;
    font-size: 11px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.dv-tag-chip-remove:hover {
    opacity: 1;
}

.dv-tag-chip.is-readonly {
    cursor: default;
}

.dv-tag-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--tag-color);
    flex-shrink: 0;
}

.dv-tag-chip-sub {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-secondary);
}

.dv-empty-tag-state {
    padding: 10px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-secondary);
}

.views-tags-page .page-header {
    align-items: end;
}

.views-tags-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.views-tags-stat {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    min-width: 72px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 248, 247, 0.92));
}

.views-tags-stat strong {
    font-size: 16px;
}

.views-tags-stat span {
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.views-tags-panel {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.views-tags-tabbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.views-tags-tab {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 12px 12px 0 0;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    background: linear-gradient(180deg, rgba(248, 248, 247, 0.95), rgba(255, 255, 255, 0.84));
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.views-tags-tab.is-active {
    border-color: var(--accent);
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.92));
    color: var(--accent);
}

.views-tags-tab:hover {
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(239, 68, 68, 0.12);
}

.vt-panel {
    display: grid;
    gap: 18px;
}

.vt-manager-note {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--text-secondary);
}

.vt-manager-groups {
    display: grid;
    gap: 10px;
}

.vt-group-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(239, 68, 68, 0.07), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 248, 247, 0.96));
}

.vt-group-card.is-drop-target {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.12);
}

.vt-group-head,
.vt-group-meta,
.vt-saved-list-head,
.vt-saved-list-actions,
.vt-block-copy,
.vt-row-topline,
.vt-row-copy {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vt-group-head {
    justify-content: space-between;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 8px;
}

.vt-group-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vt-inline-input {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.vt-inline-input.vt-inline-input-tag {
    min-height: 34px;
    font-size: 13px;
    font-weight: 600;
}

.vt-group-badge {
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.vt-group-badge.is-exclusive {
    background: var(--warning-soft);
    color: var(--warning);
}

.vt-group-badge.is-multi {
    background: var(--accent-soft);
    color: var(--accent);
}

.vt-group-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vt-color-input {
    width: 34px;
    min-width: 34px;
    height: 30px;
    padding: 4px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.vt-group-remove {
    min-height: 24px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 700;
}

.vt-group-remove:hover {
    text-decoration: underline;
}

.vt-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
}

.vt-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vt-toggle-track {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--border-strong);
}

.vt-toggle-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ffffff;
    transition: transform var(--transition-fast);
}

.vt-toggle input:checked + .vt-toggle-track {
    background: var(--success);
}

.vt-toggle input:checked + .vt-toggle-track::after {
    transform: translateX(18px);
}

.vt-tag-dropzone {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
}

.vt-tag-pill {
    --tag-color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--tag-color) 30%, white);
    background: color-mix(in srgb, var(--tag-color) 10%, white);
    color: color-mix(in srgb, var(--tag-color) 70%, black);
    font-size: 11px;
}

.vt-tag-pill.is-dragging {
    opacity: 0.55;
}

.vt-pill-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 15px;
    user-select: none;
}

.vt-tag-pill input {
    min-width: 68px;
    border: 0;
    background: transparent;
    color: inherit;
    font-weight: 700;
    padding: 0;
}

.vt-tag-pill input:hover,
.vt-tag-pill input:focus {
    border: 0;
    box-shadow: none;
}

.vt-pill-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.vt-pill-color {
    width: 18px;
    min-width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.vt-pill-remove {
    width: 16px;
    min-width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: inherit;
    font-size: 12px;
    line-height: 1;
}

.vt-add-tag {
    min-height: 28px;
    padding: 0 12px;
    border-radius: 12px;
    border-style: dashed;
}

.vt-new-group {
    justify-self: start;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
}

.vt-workspace {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.vt-filter-column {
    position: sticky;
    top: 0;
    display: grid;
    gap: 12px;
}

.vt-filter-title {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.vt-filter-sections {
    display: grid;
    gap: 10px;
}

.vt-filter-section {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 248, 247, 0.95), rgba(255, 255, 255, 0.94));
    overflow: hidden;
}

.vt-filter-section.is-collapsed .vt-filter-section-body {
    display: none;
}

.vt-filter-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.vt-filter-section-head:hover {
    background: rgba(239, 68, 68, 0.04);
}

.vt-filter-section-body {
    display: grid;
    gap: 8px;
    padding: 0 12px 12px;
}

.vt-filter-group-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.vt-option-list {
    display: grid;
    gap: 6px;
}

.vt-option {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.vt-option input {
    margin: 0;
}

.vt-option-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.vt-option-copy small {
    color: var(--text-secondary);
}

.vt-tree-node {
    display: grid;
    gap: 8px;
}

.vt-tree-children {
    display: grid;
    gap: 8px;
    padding-left: 18px;
    border-left: 1px dashed var(--border-strong);
}

.vt-tree-toggle {
    width: 22px;
    min-width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 999px;
}

.vt-search-input {
    width: 100%;
}

.vt-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.vt-results-column {
    display: grid;
    gap: 18px;
}

.vt-chip-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
    padding: 8px 10px;
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
    background: rgba(248, 248, 247, 0.82);
}

.vt-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 10px;
    font-weight: 600;
}

.vt-chip button {
    width: 16px;
    min-width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
}

.vt-results-block,
.vt-saved-lists-block {
    display: grid;
    gap: 12px;
}

.vt-block-copy {
    justify-content: space-between;
    flex-wrap: wrap;
}

.vt-results-list,
.vt-saved-lists {
    display: grid;
    gap: 12px;
}

.vt-results-row,
.vt-saved-list {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 248, 247, 0.96));
}

.vt-results-row {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    cursor: grab;
}

.vt-results-row:active {
    cursor: grabbing;
}

.vt-row-topline {
    justify-content: space-between;
    flex-wrap: wrap;
}

.vt-row-title {
    font-size: 14px;
    font-weight: 700;
}

.vt-row-meta {
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.vt-saved-list {
    display: grid;
    gap: 8px;
    padding: 10px 12px 12px;
}

.vt-saved-list.is-drop-target .vt-dropzone {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.vt-saved-list-name {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    font-size: 15px;
    font-weight: 700;
}

.vt-saved-list-name:hover,
.vt-saved-list-name:focus {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.9);
}

.vt-saved-list-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.vt-inline-action {
    min-height: 32px;
    padding: 0 12px;
}

.vt-dropzone {
    display: grid;
    gap: 10px;
    min-height: 92px;
    padding: 14px;
    border: 1px dashed var(--border-strong);
    border-radius: 14px;
    background: rgba(248, 248, 247, 0.72);
}

.vt-dropzone-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    color: var(--text-secondary);
    text-align: center;
}

.vt-saved-item {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
}

.vt-saved-item-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}

.vt-remove-item {
    min-height: 24px;
    padding: 0 8px;
    border: 0;
    background: transparent;
    color: var(--danger);
    font-weight: 700;
}

.vt-empty-state {
    padding: 24px 18px;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 1080px) {
    .vt-workspace {
        grid-template-columns: 1fr;
    }

    .vt-filter-column {
        position: static;
    }
}

@media (max-width: 720px) {
    .views-tags-panel {
        padding: 14px;
    }

    .views-tags-tabbar {
        flex-wrap: wrap;
    }

    .views-tags-tab {
        border-radius: 12px;
    }

    .vt-group-head,
    .vt-block-copy,
    .vt-row-topline,
    .vt-saved-list-head {
        align-items: stretch;
        flex-direction: column;
    }

    .vt-saved-list-actions {
        justify-content: start;
    }
}

/* Modern Liaison Admin UI Override */
:root {
    --bg: #090e1f;
    --shell: rgba(8, 12, 24, 0.92);
    --surface: rgba(15, 23, 42, 0.9);
    --surface-soft: rgba(20, 28, 47, 0.78);
    --surface-muted: rgba(255, 255, 255, 0.05);
    --surface-strong: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #fef2f2;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #b91c1c;
    --accent-soft: rgba(185, 28, 28, 0.14);
    --accent-strong: #ef4444;
    --danger: #f87171;
    --success: #34d399;
    --warning: #fbbf24;
    --shadow-floating: 0 20px 48px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 36px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 0 1px rgba(185, 28, 28, 0.1), 0 20px 36px rgba(0, 0, 0, 0.2);
    --radius-sm: 14px;
    --radius-md: 18px;
    --radius-lg: 22px;
    --row-height: 40px;
    --sidebar-width: 220px;
    --topbar-height: 56px;
    --transition-fast: 160ms ease;
    --transition-panel: 200ms ease;
    --transition-press: 120ms ease;
    --gradient-accent: linear-gradient(135deg, #991b1b 0%, #ef4444 100%);
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at top left, rgba(185, 28, 28, 0.18), transparent 24%), radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.12), transparent 28%), #04070f;
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

body {
    background-attachment: fixed;
}

.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 18, 35, 0.78);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03), var(--shadow-soft);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}

.brand-mark {
    width: 46px;
    min-width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    position: relative;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-mark-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: transparent;
}

.brand strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
}

.brand-subtitle {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
}

button,
.icon-button,
.density-toggle,
.button,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.icon-button,
.density-toggle {
    height: 34px;
    padding: 0 12px;
}

.button,
button {
    height: 40px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--transition-press), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.button:hover,
button:hover,
.icon-button:hover,
.density-toggle:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
}

.button-primary,
button.button-primary {
    background: var(--gradient-accent);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 20px 35px rgba(185, 28, 28, 0.3);
}

.button-primary:hover,
button.button-primary:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #f87171 100%);
}

.layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
}

body.sidebar-collapsed .layout {
    grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
    min-height: 0;
    min-width: 0;
    border-radius: var(--radius-lg);
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-soft);
    padding: 16px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-section {
    display: grid;
    gap: 12px;
}

.sidebar-label,
.eyebrow {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

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

.sidebar-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

.sidebar-nav a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(185, 28, 28, 0.2), rgba(239, 68, 68, 0.14));
    border-color: rgba(185, 28, 28, 0.24);
}

.sidebar-nav a::after {
    content: attr(data-short);
    min-width: 24px;
    min-height: 24px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    background: rgba(185, 28, 28, 0.08);
}

body.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
}

body.sidebar-collapsed .brand,
body.sidebar-collapsed .topbar-right {
    opacity: 0;
    pointer-events: none;
}

.main {
    min-height: 0;
    background: transparent;
}

.page-scroll {
    min-height: 100%;
    padding-bottom: 24px;
}

.page-header,
.hero-card,
.panel,
.card,
.import-card,
.vt-panel {
    border-radius: var(--radius-lg);
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.page-scroll {
    min-height: 100%;
    padding-bottom: 16px;
}

.page-header {
    padding: 22px 24px;
    margin-bottom: 14px;
}

.page-header-inline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header h1,
.hero-card h1,
.panel-head h2,
.card h2 {
    margin: 0;
    color: #fff;
}

.hero-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 24px 24px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(185, 28, 28, 0.15), transparent 40%), radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.14), transparent 28%);
    pointer-events: none;
}

.hero-card::after {
    content: "";
    position: absolute;
    right: -14px;
    top: -14px;
    width: 200px;
    height: 200px;
    background-image: url("/static/assets/liaison-admin-hero.png");
    background-size: cover;
    background-position: center;
    opacity: 0.32;
    pointer-events: none;
}

.hero-card > * {
    position: relative;
    z-index: 1;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.stat-card {
    padding: 18px 20px;
    display: grid;
    gap: 8px;
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
    color: #fff;
}

.panel-head,
.import-card h2,
.vt-panel h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
}

.panel {
    padding: 0;
    overflow: hidden;
}

.card,
.import-card {
    padding: 18px 22px;
    margin-bottom: 16px;
}

.form-grid,
.form-grid-wide {
    display: grid;
    gap: 16px;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 40px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.field textarea {
    min-height: 100px;
}

.field .label {
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hint,
.muted {
    color: var(--text-secondary);
}

input:focus,
select:focus,
textarea:focus,
.button:focus,
button:focus,
.icon-button:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.18);
    border-color: rgba(185, 28, 28, 0.45);
}

.table-shell {
    overflow: auto;
}

.dense {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 700px;
}

.dense th,
.dense td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: top;
}

.dense th {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 2;
}

.dense tbody tr {
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.dense tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(1px);
}

.dense td {
    color: var(--text);
}

.tag,
.seed-pill,
.smart-select-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.tag.fk,
.seed-pill-country {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
}

.row-actions,
.header-actions,
.toolbar,
.footer-bar,
.panel-head,
.detail-drawer-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar {
    padding: 14px 18px;
}

.footer-bar {
    padding: 14px 18px;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.seed-results,
.smart-select-menu,
.vt-results-list,
.vt-saved-lists,
.import-card-actions,
.views-tags-stats {
    margin-top: 12px;
}

.seed-results {
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
}

.smart-select {
    position: relative;
}

.smart-select-control {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.smart-select-input {
    width: 100%;
}

.smart-select-trigger {
    min-width: 60px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
}

.toast {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.95);
}

.toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 10px;
    z-index: 100;
}

@media (max-width: 1120px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: calc(var(--topbar-height) + 18px);
        z-index: 10;
    }
}

@media (max-width: 780px) {
    .page-header-inline,
    .hero-card,
    .form-section-grid,
    .stats-grid {
        display: block;
    }

    .page-header,
    .hero-card,
    .card,
    .panel,
    .import-card {
        padding: 22px;
    }

    .sidebar {
        padding: 16px;
    }

    .sidebar-nav a {
        padding: 12px 14px;
    }
}

/* Liaison Admin 2026 design-system refresh */
:root,
:root[data-theme="dark"] {
    --ds-bg-canvas: #070a0e;
    --ds-bg-surface: #0b1117;
    --ds-bg-panel: #101821;
    --ds-bg-elevated: #151f2a;
    --ds-bg-glass: rgba(16, 24, 33, 0.72);
    --ds-border-subtle: rgba(184, 196, 207, 0.14);
    --ds-border-strong: rgba(184, 196, 207, 0.26);
    --ds-text-primary: #f5f8fb;
    --ds-text-secondary: #b8c4cf;
    --ds-text-muted: #7d8b99;
    --ds-text-disabled: #52606d;
    --ds-accent-green: #32d583;
    --ds-accent-lime: #a6e22e;
    --ds-accent-blue: #38bdf8;
    --ds-accent-warning: #fdb022;
    --ds-accent-danger: #f97066;
    --ds-focus-ring: #38bdf8;
    --ds-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.24);
    --ds-shadow-2: 0 8px 24px rgba(0, 0, 0, 0.28);
    --ds-shadow-3: 0 16px 48px rgba(0, 0, 0, 0.36);
    --ds-radius-sm: 4px;
    --ds-radius-md: 6px;
    --ds-radius-lg: 8px;
    --ds-space-1: 4px;
    --ds-space-2: 8px;
    --ds-space-3: 12px;
    --ds-space-4: 16px;
    --ds-space-6: 24px;
    --ds-space-8: 32px;
    --bg: var(--ds-bg-canvas);
    --shell: var(--ds-bg-surface);
    --surface: var(--ds-bg-panel);
    --surface-muted: rgba(255, 255, 255, 0.04);
    --surface-soft: rgba(255, 255, 255, 0.06);
    --surface-strong: var(--ds-bg-elevated);
    --border: var(--ds-border-subtle);
    --border-strong: var(--ds-border-strong);
    --text: var(--ds-text-primary);
    --text-secondary: var(--ds-text-secondary);
    --text-muted: var(--ds-text-muted);
    --accent: var(--ds-accent-blue);
    --accent-soft: rgba(56, 189, 248, 0.12);
    --danger: var(--ds-accent-danger);
    --danger-soft: rgba(249, 112, 102, 0.12);
    --success: var(--ds-accent-green);
    --success-soft: rgba(50, 213, 131, 0.12);
    --warning: var(--ds-accent-warning);
    --warning-soft: rgba(253, 176, 34, 0.12);
    --shadow-floating: var(--ds-shadow-2);
    --shadow-soft: var(--ds-shadow-1);
    --radius-sm: var(--ds-radius-sm);
    --radius-md: var(--ds-radius-md);
    --radius-lg: var(--ds-radius-lg);
    --row-height: 40px;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --transition-fast: 120ms ease-out;
    --transition-panel: 180ms ease-out;
    --transition-press: 120ms ease-out;
    --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

body[data-page-id="record-form"],
body[data-page-id="import"] {
    --ds-bg-canvas: #f7f8fa;
    --ds-bg-surface: #ffffff;
    --ds-bg-panel: #ffffff;
    --ds-bg-elevated: #ffffff;
    --ds-bg-glass: #ffffff;
    --ds-border-subtle: #dde3ea;
    --ds-border-strong: #c8d0d9;
    --ds-text-primary: #101828;
    --ds-text-secondary: #344054;
    --ds-text-muted: #667085;
    --ds-text-disabled: #98a2b3;
    --ds-accent-green: #12b76a;
    --ds-accent-lime: #669f12;
    --ds-accent-blue: #0ea5e9;
    --ds-accent-warning: #dc6803;
    --ds-accent-danger: #f04438;
    --ds-focus-ring: #0ea5e9;
    --ds-shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06);
    --ds-shadow-2: 0 8px 16px rgba(16, 24, 40, 0.08);
    --ds-shadow-3: 0 16px 32px rgba(16, 24, 40, 0.12);
    --surface-muted: #f7f8fa;
    --surface-soft: #eef1f4;
    --accent-soft: rgba(14, 165, 233, 0.1);
    --danger-soft: rgba(240, 68, 56, 0.1);
    --success-soft: rgba(18, 183, 106, 0.1);
    --warning-soft: rgba(220, 104, 3, 0.1);
}

* {
    letter-spacing: 0 !important;
}

[hidden] {
    display: none !important;
}

html,
body {
    background: var(--ds-bg-canvas);
    color: var(--ds-text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.45;
}

body {
    position: relative;
    background: var(--ds-bg-canvas);
    font-variant-numeric: tabular-nums;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(56, 189, 248, 0.05), transparent 28%),
        linear-gradient(135deg, rgba(50, 213, 131, 0.05), transparent 42%),
        var(--ds-bg-canvas);
}

body[data-page-id="record-form"]::before,
body[data-page-id="import"]::before {
    background:
        linear-gradient(180deg, rgba(14, 165, 233, 0.04), transparent 34%),
        var(--ds-bg-canvas);
}

a {
    color: var(--ds-accent-blue);
}

a,
button,
input,
select,
textarea {
    transition:
        background-color var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast),
        opacity var(--transition-fast);
}

button:hover,
.button:hover,
.sidebar-nav a:hover,
table.dense tbody tr:hover,
.duty-pill-filter:hover {
    transform: none;
}

.topbar {
    height: var(--topbar-height);
    padding: 0 var(--ds-space-6);
    border-bottom: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-surface);
    box-shadow: none;
    backdrop-filter: none;
}

.topbar-left,
.topbar-right,
.header-actions,
.hero-actions,
.row-actions,
.toolbar,
.footer-bar,
.panel-head,
.detail-drawer-head {
    gap: var(--ds-space-2);
}

.brand {
    gap: var(--ds-space-3);
    min-width: 0;
}

.brand-mark {
    width: 34px;
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-lg);
    border: 1px solid rgba(56, 189, 248, 0.32);
    background: var(--accent-soft);
    box-shadow: var(--ds-shadow-1);
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.brand-mark-fallback {
    color: var(--ds-text-primary);
    font-size: 12px;
    line-height: 1;
    font-weight: 800;
}

.brand strong {
    color: var(--ds-text-primary);
    font-size: 14px;
    font-weight: 600;
}

.brand-subtitle {
    color: var(--ds-text-muted);
    font-size: 12px;
}

.system-status {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-2);
    min-height: 32px;
    padding: 0 var(--ds-space-3);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-panel);
    color: var(--ds-text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--ds-accent-green);
    box-shadow: 0 0 0 3px rgba(50, 213, 131, 0.12);
}

body[data-page-id="record-form"] .status-dot,
body[data-page-id="import"] .status-dot {
    box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.14);
}

.layout {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 0;
    padding: 0;
    background: var(--ds-bg-canvas);
}

body.sidebar-collapsed .layout {
    grid-template-columns: 64px minmax(0, 1fr);
}

body.sidebar-collapsed .brand,
body.sidebar-collapsed .topbar-right {
    opacity: 1;
    pointer-events: auto;
}

.sidebar {
    border-right: 1px solid var(--ds-border-subtle);
    border-radius: 0;
    background: var(--ds-bg-surface);
    box-shadow: none;
    padding: var(--ds-space-4) var(--ds-space-3);
    gap: var(--ds-space-6);
}

.sidebar-section {
    gap: var(--ds-space-2);
}

.sidebar-label,
.eyebrow,
.label,
.dv-label {
    color: var(--ds-text-muted);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    text-transform: none;
    white-space: normal;
}

body .sidebar-label,
body .eyebrow,
body .label,
body .field > .label,
body .dv-label,
body .dv-field > .dv-label,
body table.dense thead th,
body .dense th {
    text-transform: none !important;
}

.sidebar-nav {
    gap: var(--ds-space-1);
}

.sidebar-nav a {
    min-height: 36px;
    padding: 0 var(--ds-space-3);
    border: 1px solid transparent;
    border-radius: var(--ds-radius-lg);
    background: transparent;
    color: var(--ds-text-secondary);
    font-size: 14px;
    justify-content: space-between;
}

.sidebar-nav a::after {
    display: none;
}

.sidebar-nav a:hover {
    border-color: var(--ds-border-subtle);
    background: var(--surface-muted);
    color: var(--ds-text-primary);
}

.sidebar-nav a.active {
    border-color: var(--ds-border-strong);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    box-shadow: inset 3px 0 0 var(--ds-accent-blue);
}

body.sidebar-collapsed .sidebar {
    padding-inline: var(--ds-space-2);
}

body.sidebar-collapsed .sidebar-nav a {
    min-height: 40px;
    padding: 0;
    justify-content: center;
    font-size: 0;
}

body.sidebar-collapsed .sidebar-nav a::before {
    color: var(--ds-text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
}

.main {
    background: var(--ds-bg-canvas);
}

.page-scroll,
.workspace-shell {
    padding: var(--ds-space-6);
    gap: var(--ds-space-4);
    align-content: start;
}

.workspace-shell {
    padding-bottom: 88px;
}

.page-header,
.hero-card,
.panel,
.card,
.stat-card,
.workspace-toolbar,
.detail-block,
.seed-assist,
.seed-option,
.seed-modal-card,
.seed-modal-item,
.slide-panel,
.vt-group-card,
.vt-filter-section,
.vt-results-row,
.vt-saved-list,
.vt-saved-item,
.dv-section,
.dv-editor-topbar,
.dv-editor-footer,
.dv-compare-card {
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-panel);
    box-shadow: var(--ds-shadow-1);
    backdrop-filter: none;
}

.page-header,
.panel,
.card {
    padding: var(--ds-space-4);
}

.page-header {
    gap: var(--ds-space-2);
}

.page-header-inline,
.hero-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ds-space-4);
}

.page-header h1,
.hero-card h1,
.panel h2,
.card h2,
.detail-drawer-head h2 {
    color: var(--ds-text-primary);
    font-size: 24px;
    line-height: 32px;
    font-weight: 600;
}

.panel-head h2,
.card h2,
.import-card h2 {
    font-size: 18px;
    line-height: 28px;
}

.muted,
.hint,
.sidebar-note,
.dv-helper-text,
.dv-hint,
.dv-breadcrumb {
    color: var(--ds-text-secondary);
}

.hint,
.dv-helper-text,
.dv-hint,
.dv-breadcrumb {
    font-size: 12px;
    line-height: 16px;
}

.hero-card {
    min-height: 168px;
    padding: var(--ds-space-6);
    overflow: hidden;
    background: var(--ds-bg-panel);
}

.hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--ds-bg-panel) 0%, rgba(16, 24, 33, 0.96) 42%, rgba(16, 24, 33, 0.72) 100%);
    pointer-events: none;
}

body[data-page-id="dashboard"] .hero-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: min(58%, 760px);
    height: 100%;
    background-image: url("/static/assets/liaison-admin-hero.png");
    background-size: cover;
    background-position: center right;
    opacity: 0.78;
    mask-image: linear-gradient(90deg, transparent 0%, #000 28%);
    pointer-events: none;
}

.hero-card > * {
    position: relative;
    z-index: 1;
}

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

.stat-card {
    min-height: 112px;
    padding: var(--ds-space-4);
    display: grid;
    align-content: space-between;
    gap: var(--ds-space-2);
}

.stat-value {
    margin: 0;
    color: var(--ds-text-primary);
    font-size: 32px;
    line-height: 40px;
    font-weight: 600;
}

.stat-value-text {
    font-size: 20px;
    line-height: 28px;
}

.panel {
    gap: 0;
    overflow: hidden;
}

.panel-head {
    padding: var(--ds-space-4);
    border-bottom: 1px solid var(--ds-border-subtle);
    justify-content: space-between;
}

.panel > .form-grid,
.panel > .form-grid-wide,
.panel > details,
.panel > .footer-bar,
.panel > .header-actions,
.panel > .seed-results,
.panel > .vt-panel {
    padding: var(--ds-space-4);
}

.toolbar {
    padding: var(--ds-space-4);
    gap: var(--ds-space-2);
}

.toolbar-divider {
    width: 1px;
    height: 28px;
    border-radius: 0;
    background: var(--ds-border-subtle);
}

.inline-field,
.search-field,
.field,
.dv-field,
.quick-panel-field {
    gap: var(--ds-space-2);
    min-width: 0;
}

.inline-field select,
.inline-field input,
.search-field input {
    min-width: 152px;
}

.search-field input {
    min-width: min(320px, 100%);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea,
.smart-select-control,
.dv-id-badge {
    width: 100%;
    min-height: 36px;
    height: auto;
    padding: 8px 12px;
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    font-size: 14px;
    line-height: 20px;
    outline: none;
    box-shadow: none;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input::placeholder,
select::placeholder,
textarea::placeholder {
    color: var(--ds-text-muted);
    font-size: 14px;
    opacity: 0.78;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
select:hover,
textarea:hover,
.smart-select:hover .smart-select-control {
    border-color: var(--ds-border-strong);
    background: var(--ds-bg-elevated);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
select:focus,
textarea:focus,
.smart-select.is-open .smart-select-control,
.smart-select.is-focused .smart-select-control,
.button:focus-visible,
button:focus-visible,
.icon-button:focus-visible,
.density-toggle:focus-visible,
.sidebar-nav a:focus-visible {
    outline: 2px solid var(--ds-focus-ring);
    outline-offset: 2px;
    border-color: var(--ds-focus-ring);
    box-shadow: none;
}

.quick-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
.quick-panel select:focus,
.quick-panel textarea:focus,
.quick-panel .smart-select.is-open .smart-select-control,
.quick-panel .smart-select.is-focused .smart-select-control {
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
}

.quick-panel input:-webkit-autofill,
.quick-panel input:-webkit-autofill:hover,
.quick-panel input:-webkit-autofill:focus,
.quick-panel textarea:-webkit-autofill,
.quick-panel textarea:-webkit-autofill:focus,
.quick-panel select:-webkit-autofill,
.quick-panel select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ds-text-primary);
    box-shadow: 0 0 0 1000px var(--ds-bg-elevated) inset;
    caret-color: var(--ds-text-primary);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"])[readonly],
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):disabled,
select:disabled,
textarea[readonly],
textarea:disabled,
.dv-field-readonly input,
.dv-date-range.is-derived input {
    background: var(--surface-muted);
    color: var(--ds-text-disabled);
}

.button,
button,
.icon-button,
.density-toggle,
.dv-back-button {
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    box-shadow: none;
}

.icon-button,
.row-menu-trigger,
.quick-panel-close,
.vt-tree-toggle {
    width: 36px;
    min-width: 36px;
    padding: 0;
}

.button:hover,
button:hover,
.icon-button:hover,
.density-toggle:hover,
.dv-back-button:hover {
    border-color: var(--ds-border-strong);
    background: var(--surface-muted);
}

.button-primary,
button.button-primary,
.row-actions a.button-primary {
    border-color: transparent;
    background: var(--ds-accent-green);
    color: #062111;
    box-shadow: none;
}

.button-primary:hover,
button.button-primary:hover,
.row-actions a.button-primary:hover {
    background: #53dfa0;
    color: #062111;
}

body[data-page-id="record-form"] .button-primary,
body[data-page-id="import"] .button-primary,
body[data-page-id="record-form"] button.button-primary,
body[data-page-id="import"] button.button-primary {
    background: var(--ds-accent-blue);
    color: #ffffff;
}

body[data-page-id="record-form"] .button-primary:hover,
body[data-page-id="import"] .button-primary:hover,
body[data-page-id="record-form"] button.button-primary:hover,
body[data-page-id="import"] button.button-primary:hover {
    background: #0284c7;
    color: #ffffff;
}

body[data-page-id="record-form"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body[data-page-id="record-form"] select,
body[data-page-id="record-form"] textarea,
body[data-page-id="record-form"] .smart-select-control,
body[data-page-id="record-form"] .smart-select-input,
body[data-page-id="import"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
body[data-page-id="import"] select,
body[data-page-id="import"] textarea,
body[data-page-id="import"] .smart-select-control,
body[data-page-id="import"] .smart-select-input {
    background-color: #ffffff;
    color: #101828;
    -webkit-text-fill-color: #101828;
}

body[data-page-id="record-form"] select option,
body[data-page-id="import"] select option {
    background: #ffffff;
    color: #101828;
}

body[data-page-id="record-form"] input::placeholder,
body[data-page-id="record-form"] textarea::placeholder,
body[data-page-id="import"] input::placeholder,
body[data-page-id="import"] textarea::placeholder {
    color: #667085;
    -webkit-text-fill-color: #667085;
    opacity: 0.78;
}

.density-toggle {
    gap: var(--ds-space-2);
}

.density-toggle .label {
    color: var(--ds-text-muted);
}

.table-shell,
.duty-table-shell,
.diagram-wrap,
.code {
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-surface);
    overflow: auto;
}

.table-shell,
.duty-table-shell {
    max-width: 100%;
}

table.dense,
.dense {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 13px;
}

table.dense thead th,
.dense th {
    height: 40px;
    padding: 0 12px;
    border-bottom: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-surface);
    color: var(--ds-text-secondary);
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    text-transform: none;
    white-space: nowrap;
}

table.dense tbody td,
.dense td {
    height: var(--row-height);
    min-height: var(--row-height);
    padding: 8px 12px;
    border-bottom: 1px solid var(--ds-border-subtle);
    color: var(--ds-text-primary);
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.dense tbody tr:hover td,
.dense tbody tr:hover {
    background: var(--surface-muted);
}

table.dense tbody tr.selected td {
    background: var(--accent-soft);
}

table.dense td.copied {
    background: var(--success-soft);
}

.th-sortlink {
    color: inherit;
    text-decoration: none;
}

.th-sortlink:hover,
.th-sorted,
.table-link,
.row-actions a,
.row-menu-sheet a {
    color: var(--ds-accent-blue);
}

.tag,
.badge,
.seed-pill,
.duty-mini-pill,
.dv-pill,
.dv-tag-chip,
.vt-tag-pill,
.vt-chip,
.views-tags-stat,
.vt-count-badge,
.vt-group-badge {
    border-radius: 999px;
    border: 1px solid var(--ds-border-subtle);
    background: var(--surface-muted);
    color: var(--ds-text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.tag.fk,
.smart-select-badge,
.seed-pill-country,
.duty-count-pill,
.avatar-chip-overflow {
    border-color: rgba(56, 189, 248, 0.24);
    background: rgba(56, 189, 248, 0.12);
    color: var(--ds-accent-blue);
}

.btn-danger,
.vt-remove-item,
.vt-group-remove {
    border: 0;
    background: transparent;
    color: var(--ds-accent-danger);
    box-shadow: none;
}

.btn-danger:hover,
.vt-remove-item:hover,
.vt-group-remove:hover {
    background: var(--danger-soft);
    color: var(--ds-accent-danger);
    text-decoration: none;
}

.footer-bar {
    min-height: 40px;
    padding: var(--ds-space-3) var(--ds-space-4);
    border-top: 1px solid var(--ds-border-subtle);
    color: var(--ds-text-secondary);
}

.workspace-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: var(--ds-space-3) var(--ds-space-4);
    align-items: end;
    justify-content: space-between;
    gap: var(--ds-space-4);
}

.workspace-panel {
    gap: var(--ds-space-3);
}

.duty-table-shell {
    max-height: calc(100vh - 238px);
    background: var(--ds-bg-surface);
}

table.dense.duty-table {
    min-width: 1200px;
}

.duty-table.duty-table-compact {
    font-size: 11px;
}

.duty-table.duty-table-compact thead th {
    height: 32px;
    padding: 4px 6px;
    color: var(--ds-text-secondary);
    font-size: 11px;
    line-height: 14px;
    background: var(--ds-bg-surface);
}

.duty-table.duty-table-compact tbody td {
    padding: 4px 6px;
    font-size: 11px;
    line-height: 14px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.duty-title-text {
    color: var(--ds-text-primary);
}

.duty-mini-pill {
    min-height: 18px;
    padding: 2px 6px;
    line-height: 1.2;
}

.duty-status-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-3);
    padding: var(--ds-space-3) var(--ds-space-4);
    border-bottom: 1px solid var(--ds-border-subtle);
}

.duty-status-legend-items {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ds-space-2);
}

body[data-page-id="duty-visits"] .workspace-toolbar {
    padding: 8px 12px;
    gap: 10px;
}

body[data-page-id="duty-visits"] .workspace-panel {
    gap: 0;
    padding: 0;
    border-radius: 6px;
}

body[data-page-id="duty-visits"] .duty-table-shell {
    border-radius: 6px;
    background: #070a0e;
}

body[data-page-id="duty-visits"] table.dense.duty-table {
    min-width: 1180px;
    font-variant-numeric: tabular-nums;
}

body[data-page-id="duty-visits"] .duty-table.duty-table-compact {
    font-size: 10px;
}

body[data-page-id="duty-visits"] .duty-table.duty-table-compact thead th {
    height: 24px;
    padding: 3px 5px;
    color: var(--ds-text-secondary);
    font-size: 10px;
    line-height: 12px;
    background: #070a0e;
}

body[data-page-id="duty-visits"] .duty-table.duty-table-compact tbody td {
    padding: 3px 5px;
    font-size: 10px;
    line-height: 12px;
    vertical-align: top;
}

body[data-page-id="duty-visits"] .duty-title-cell {
    gap: 2px;
}

body[data-page-id="duty-visits"] .duty-location-plain {
    color: var(--ds-text-primary);
    font-weight: 650;
}

body[data-page-id="duty-visits"] .duty-number-cell {
    color: var(--ds-text-primary);
    font-weight: 750;
    text-align: center;
}

body[data-page-id="duty-visits"] .duty-title-text {
    display: -webkit-box;
    color: var(--ds-text-primary);
    font-size: 10px;
    line-height: 12px;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body[data-page-id="duty-visits"] .duty-title-link,
body[data-page-id="duty-visits"] .duty-table.duty-table-compact .mono {
    font-size: 9px;
    line-height: 11px;
}

body[data-page-id="duty-visits"] .duty-mini-pill,
body[data-page-id="duty-visits"] .duty-table.duty-table-compact .dv-tag-chip,
body[data-page-id="duty-visits"] .duty-status-badge {
    min-height: 16px;
    padding: 1px 5px;
    border-radius: 999px;
    font-size: 9px;
    line-height: 11px;
}

body[data-page-id="duty-visits"] .duty-status-legend {
    padding: 8px 12px;
}

.duty-finance-review {
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
}

.duty-finance-review-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.duty-finance-review-head h2 {
    margin: 2px 0 0;
    color: var(--ds-text-primary);
    font-size: 15px;
    line-height: 18px;
}

.duty-finance-view-tabs {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    padding: 2px;
    border: 1px solid var(--ds-border-subtle);
    border-radius: 6px;
    background: var(--ds-bg-surface);
}

.duty-finance-view-tabs button {
    min-height: 24px;
    padding: 3px 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--ds-text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.duty-finance-view-tabs button.is-active {
    background: rgba(56, 189, 248, 0.14);
    color: #38bdf8;
}

.duty-finance-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--ds-border-subtle);
    border-radius: 6px;
    overflow: hidden;
    background: #070a0e;
}

.duty-finance-metric {
    display: grid;
    gap: 1px;
    min-width: 0;
    padding: 7px 9px;
    border-right: 1px solid var(--ds-border-subtle);
}

.duty-finance-metric:last-child {
    border-right: 0;
}

.duty-finance-metric span,
.duty-finance-metric small,
.duty-finance-row-meta {
    color: var(--ds-text-muted);
    font-size: 10px;
    line-height: 12px;
}

.duty-finance-metric strong {
    color: var(--ds-text-primary);
    font-size: 14px;
    line-height: 17px;
    font-variant-numeric: tabular-nums;
}

.duty-finance-review-body {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    gap: 8px;
    align-items: stretch;
}

.duty-finance-chart,
.duty-finance-breakdown {
    min-height: 230px;
    border: 1px solid var(--ds-border-subtle);
    border-radius: 6px;
    background: #070a0e;
}

.duty-finance-chart {
    padding: 8px;
}

.duty-finance-chart-fallback {
    display: grid;
    min-height: 212px;
    place-items: center;
    color: var(--ds-text-muted);
    font-size: 12px;
}

.duty-finance-breakdown {
    overflow: auto;
}

.duty-finance-breakdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 8px;
    border-bottom: 1px solid var(--ds-border-subtle);
    color: var(--ds-text-muted);
    font-size: 10px;
}

.duty-finance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.duty-finance-table th,
.duty-finance-table td {
    padding: 5px 7px;
    border-bottom: 1px solid rgba(184, 196, 207, 0.12);
    text-align: right;
    white-space: nowrap;
}

.duty-finance-table th:first-child,
.duty-finance-table td:first-child {
    width: 42%;
    text-align: left;
    white-space: normal;
}

.duty-finance-table th {
    color: var(--ds-text-muted);
    font-weight: 700;
}

.duty-finance-table td {
    color: var(--ds-text-secondary);
}

.duty-finance-table td strong {
    display: block;
    color: var(--ds-text-primary);
    font-size: 10px;
    line-height: 12px;
}

.duty-finance-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

@media (max-width: 1180px) {
    .duty-finance-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .duty-finance-metric:nth-child(3n) {
        border-right: 0;
    }

    .duty-finance-review-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .duty-finance-review-head {
        align-items: stretch;
        flex-direction: column;
    }

    .duty-finance-view-tabs {
        flex-wrap: wrap;
        width: 100%;
    }

    .duty-finance-view-tabs button {
        flex: 1 1 90px;
    }

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

    .duty-finance-metric:nth-child(3n) {
        border-right: 1px solid var(--ds-border-subtle);
    }

    .duty-finance-metric:nth-child(2n) {
        border-right: 0;
    }
}

.duty-status-badge {
    --duty-status-color: var(--ds-text-secondary);
    --duty-status-bg: var(--surface-muted);
    --duty-status-border: var(--ds-border-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    max-width: 100%;
    padding: 2px 7px;
    border: 1px solid var(--duty-status-border);
    border-radius: 999px;
    background: var(--duty-status-bg);
    color: var(--duty-status-color);
    font-size: 10px;
    line-height: 13px;
    font-weight: 700;
    white-space: normal;
}

.duty-status-planning {
    --duty-status-color: #93c5fd;
    --duty-status-bg: rgba(30, 64, 175, 0.3);
    --duty-status-border: rgba(96, 165, 250, 0.45);
}

.duty-status-confirmed {
    --duty-status-color: #86efac;
    --duty-status-bg: rgba(20, 83, 45, 0.34);
    --duty-status-border: rgba(74, 222, 128, 0.45);
}

.duty-status-rejected {
    --duty-status-color: #fca5a5;
    --duty-status-bg: rgba(127, 29, 29, 0.36);
    --duty-status-border: rgba(248, 113, 113, 0.45);
}

.duty-status-completed {
    --duty-status-color: #a7f3d0;
    --duty-status-bg: rgba(6, 78, 59, 0.72);
    --duty-status-border: rgba(16, 185, 129, 0.42);
}

.duty-status-cancelled {
    --duty-status-color: #fecaca;
    --duty-status-bg: rgba(55, 65, 81, 0.54);
    --duty-status-border: rgba(209, 213, 219, 0.48);
}

.duty-status-row td:first-child {
    box-shadow: inset 3px 0 0 var(--duty-status-color, transparent);
}

.duty-pill-city,
.seed-pill-city {
    border-color: rgba(56, 189, 248, 0.24);
    background: rgba(56, 189, 248, 0.12);
    color: var(--ds-accent-blue);
}

.duty-pill-country,
.duty-pill-unit {
    border-color: rgba(50, 213, 131, 0.24);
    background: rgba(50, 213, 131, 0.1);
    color: var(--ds-accent-green);
}

.duty-pill-province,
.seed-pill-province {
    border-color: rgba(253, 176, 34, 0.28);
    background: rgba(253, 176, 34, 0.12);
    color: var(--ds-accent-warning);
}

.duty-pill-region,
.duty-pill-assoc,
.duty-pill-team,
.seed-pill-ok {
    border-color: rgba(166, 226, 46, 0.24);
    background: rgba(166, 226, 46, 0.1);
    color: var(--ds-accent-lime);
}

.duty-series-pill,
.seed-pill-province,
.seed-pill-warn,
.badge-direction-out,
.badge-status-plan {
    border-color: rgba(253, 176, 34, 0.24);
    background: rgba(253, 176, 34, 0.12);
    color: var(--ds-accent-warning);
}

.duty-delegation-pill,
.seed-pill-err,
.badge-status-cancelled,
.badge-direction-in {
    border-color: rgba(249, 112, 102, 0.24);
    background: rgba(249, 112, 102, 0.12);
    color: var(--ds-accent-danger);
}

.badge-status-actual,
.badge-direction-all {
    border-color: rgba(50, 213, 131, 0.24);
    background: rgba(50, 213, 131, 0.12);
    color: var(--ds-accent-green);
}

.duty-direction-toggle {
    min-height: 36px;
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    overflow: hidden;
}

.duty-direction-toggle button {
    min-height: 34px;
    min-width: 44px;
    border: 0;
    border-right: 1px solid var(--ds-border-subtle);
    border-radius: 0;
    background: transparent;
    color: var(--ds-text-secondary);
    font-size: 13px;
}

.duty-direction-toggle button.is-active {
    background: var(--accent-soft);
    color: var(--ds-accent-blue);
}

.duty-active-filters,
.vt-chip-bar,
.vt-dropzone,
.dv-empty-tag-state,
.empty-state {
    border: 1px dashed var(--ds-border-strong);
    border-radius: var(--ds-radius-lg);
    background: var(--surface-muted);
}

.duty-active-filter-chip {
    border-color: rgba(56, 189, 248, 0.24);
    background: var(--accent-soft);
    color: var(--ds-accent-blue);
}

.empty-state {
    min-height: 240px;
    padding: var(--ds-space-6);
    place-items: center;
}

.empty-state::before,
.vt-empty-state::before,
.dv-empty-tag-state::before {
    content: "";
    width: 96px;
    height: 96px;
    display: block;
    margin: 0 auto var(--ds-space-3);
    background-image: url("/static/assets/liaison-empty-state.png");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--ds-radius-lg);
}

.bulk-bar {
    left: calc(var(--sidebar-width) + var(--ds-space-6));
    right: var(--ds-space-6);
    bottom: var(--ds-space-6);
    min-height: 48px;
    border-color: var(--ds-border-strong);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    box-shadow: var(--ds-shadow-2);
}

body.sidebar-collapsed .bulk-bar {
    left: calc(64px + var(--ds-space-6));
}

.detail-drawer-backdrop,
.seed-modal,
.slide-panel-shell.is-on .slide-panel-backdrop {
    background: rgba(7, 10, 14, 0.62);
}

.detail-drawer-panel,
.slide-panel {
    border-color: var(--ds-border-subtle);
    background: var(--ds-bg-panel);
    box-shadow: var(--ds-shadow-3);
}

.detail-drawer-head {
    border-bottom: 1px solid var(--ds-border-subtle);
}

.seed-option:hover {
    border-color: var(--ds-border-strong);
    background: var(--surface-muted);
}

.seed-results {
    background: var(--surface-muted);
    border: 1px solid var(--ds-border-subtle);
    padding: var(--ds-space-3);
}

.smart-select-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 36px;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

.quick-panel,
.slide-panel {
    color: var(--ds-text-primary);
}

.quick-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.quick-panel select,
.quick-panel textarea,
.slide-panel input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.slide-panel select,
.slide-panel textarea {
    color: var(--ds-text-primary);
    background: var(--ds-bg-elevated);
    -webkit-text-fill-color: var(--ds-text-primary);
}

.smart-select-input,
.slide-panel .smart-select-input {
    min-height: 34px;
    height: auto;
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: var(--ds-text-primary);
    -webkit-text-fill-color: var(--ds-text-primary);
    font-size: 14px;
}

.smart-select-input:focus {
    outline: 0;
    box-shadow: none;
}

.smart-select-badge {
    align-self: center;
    min-height: 20px;
    margin-right: var(--ds-space-2);
    padding: 0 6px;
    font-size: 11px;
}

.smart-select-trigger {
    width: 36px;
    min-width: 36px;
    height: 36px;
    border: 0;
    border-left: 1px solid var(--ds-border-subtle);
    border-radius: 0;
    background: transparent;
    color: var(--ds-text-muted);
}

.smart-select-menu,
.dv-duty-tag-suggestions,
.row-menu-sheet {
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    box-shadow: var(--ds-shadow-2);
}

.smart-select-option:hover,
.smart-select-create:hover,
.smart-select-option.is-highlighted,
.dv-duty-tag-suggestion:hover,
.dv-tag-group-option:hover,
.dv-duty-tag-suggestion.is-highlighted,
.dv-tag-group-option.is-highlighted {
    background: var(--surface-muted);
}

.smart-select-option-title,
.smart-select-create,
.dv-duty-tag-add-suggestion,
.dv-tag-group-option-create {
    color: var(--ds-text-primary);
}

.smart-select-create,
.dv-duty-tag-add-suggestion,
.dv-tag-group-option-create {
    color: var(--ds-accent-blue);
}

.smart-select-option-sub,
.smart-select-empty,
.smart-select-group-header,
.smart-select-inline-hint,
.smart-select-hint-muted {
    color: var(--ds-text-muted);
}

.slide-panel {
    width: min(340px, 100vw);
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.slide-panel[data-panel-level="2"] {
    width: min(320px, 100vw);
}

.slide-panel[data-panel-level="3"] {
    width: min(300px, 100vw);
    z-index: 130;
}

.slide-panel-header {
    min-height: 56px;
    border-bottom: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-surface);
    padding: var(--ds-space-3);
}

.slide-panel[data-panel-level="2"] .slide-panel-header {
    background: var(--warning-soft);
    border-bottom-color: rgba(253, 176, 34, 0.24);
}

.slide-panel-body {
    gap: var(--ds-space-2);
    padding: var(--ds-space-3);
    max-height: none;
}

.slide-panel-footer {
    padding: var(--ds-space-3);
    border-top: 1px solid var(--ds-border-subtle);
}

html:has(body[data-page-id="table-list"]),
html:has(body[data-page-id="duty-visits"]) {
    overflow: auto;
}

body[data-page-id="table-list"],
body[data-page-id="duty-visits"] {
    min-height: 100%;
    overflow: auto;
}

body[data-page-id="table-list"] .shell,
body[data-page-id="duty-visits"] .shell {
    height: auto;
    min-height: 100vh;
}

body[data-page-id="table-list"] .layout,
body[data-page-id="duty-visits"] .layout {
    min-height: calc(100vh - var(--topbar-height));
}

body[data-page-id="table-list"] .main,
body[data-page-id="duty-visits"] .main,
body[data-page-id="table-list"] .page-scroll,
body[data-page-id="duty-visits"] .workspace-shell {
    height: auto;
    min-height: 0;
    overflow: visible;
}

body[data-page-id="table-list"] .table-shell,
body[data-page-id="duty-visits"] .duty-table-shell {
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
}

.quick-panel-title {
    color: var(--ds-text-primary);
    font-size: 14px;
    font-weight: 600;
}

.quick-panel-tag,
.quick-panel-breadcrumb span {
    color: var(--ds-text-muted);
    font-size: 12px;
    text-transform: none;
}

.toast-stack {
    top: var(--ds-space-4);
    right: var(--ds-space-4);
    bottom: auto;
    left: auto;
    transform: none;
    z-index: 60;
}

.toast {
    min-width: 260px;
    padding: var(--ds-space-3);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    box-shadow: var(--ds-shadow-2);
}

.toast-success .toast-dot {
    background: var(--ds-accent-green);
}

.toast-error .toast-dot {
    background: var(--ds-accent-danger);
}

.toast-error {
    border-color: rgba(249, 112, 102, 0.28);
    color: var(--ds-text-primary);
}

.diagram-wrap .mermaid,
.code {
    min-width: 900px;
    padding: var(--ds-space-4);
    color: var(--ds-text-primary);
}

.diagram-wrap {
    min-height: 360px;
    background: var(--ds-bg-surface);
}

.diagram-wrap svg {
    background: transparent !important;
}

.diagram-wrap svg text,
.diagram-wrap svg tspan {
    fill: var(--ds-text-primary) !important;
}

.diagram-wrap svg rect,
.diagram-wrap svg .entityBox,
.diagram-wrap svg .attributeBoxOdd,
.diagram-wrap svg .attributeBoxEven {
    fill: var(--ds-bg-elevated) !important;
    stroke: var(--ds-border-strong) !important;
}

.diagram-wrap svg path,
.diagram-wrap svg line,
.diagram-wrap svg marker path {
    stroke: var(--ds-accent-blue) !important;
}

.code {
    background: var(--ds-bg-surface);
}

.dv-editor {
    max-width: 980px;
    gap: var(--ds-space-3);
}

.dv-editor-topbar,
.dv-editor-footer {
    min-height: 56px;
    padding: var(--ds-space-3);
}

.dv-editor-topbar {
    top: var(--ds-space-3);
}

.dv-editor-footer {
    bottom: var(--ds-space-4);
}

.dv-back-button {
    text-decoration: none;
}

.dv-tabbar {
    gap: var(--ds-space-2);
    padding: 0;
    border-bottom: 1px solid var(--ds-border-subtle);
}

.duty-visit-form-page .dv-tab {
    min-height: 36px;
    padding: 0 var(--ds-space-3);
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0;
    background: transparent;
    color: var(--ds-text-secondary);
    text-decoration: none;
}

.duty-visit-form-page .dv-tab:hover {
    border-color: var(--ds-border-subtle);
    background: var(--surface-muted);
}

.duty-visit-form-page .dv-tab.is-active {
    border-color: var(--ds-border-subtle);
    border-bottom-color: var(--ds-accent-blue);
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
}

.duty-visit-form-page .dv-tab.is-active.is-plan {
    border-bottom-color: var(--ds-accent-warning);
    color: var(--ds-text-primary);
    background: var(--warning-soft);
}

.duty-visit-form-page .dv-tab.is-active.is-actual {
    border-bottom-color: var(--ds-accent-green);
    color: var(--ds-text-primary);
    background: var(--success-soft);
}

.duty-visit-form-page .dv-tab.is-active.is-compare {
    border-bottom-color: var(--ds-accent-blue);
    color: var(--ds-text-primary);
}

.duty-visit-form-page .dv-tab-dot {
    width: 7px;
    height: 7px;
    background: var(--ds-text-muted);
}

.duty-visit-form-page .dv-tab.is-complete .dv-tab-dot,
.duty-visit-form-page .dv-tab.is-active.is-actual .dv-tab-dot {
    background: var(--ds-accent-green);
}

.duty-visit-form-page .dv-tab.is-missing .dv-tab-dot {
    background: var(--ds-accent-danger);
}

.duty-visit-form-page .dv-modebar {
    min-height: 44px;
    padding: 0 var(--ds-space-4);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-panel);
}

.duty-visit-form-page .dv-mode-pill {
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    border: 1px solid var(--ds-border-subtle);
}

.duty-visit-form-page[data-entry-mode="plan"] {
    --dv-accent: var(--ds-accent-warning);
    --dv-title: var(--ds-text-primary);
    --dv-page-pill-bg: var(--warning-soft);
    --dv-page-pill-text: var(--ds-accent-warning);
    --dv-page-pill-border: rgba(253, 176, 34, 0.24);
    --dv-card-border: rgba(253, 176, 34, 0.24);
    --dv-card-bg: var(--ds-bg-panel);
    --dv-body-bg: rgba(253, 176, 34, 0.06);
    --dv-stripe: var(--ds-accent-warning);
    --dv-icon-bg: rgba(253, 176, 34, 0.12);
    --dv-icon-color: var(--ds-accent-warning);
    --dv-input-border: var(--ds-border-subtle);
    --dv-focus-shadow: none;
    --dv-fk-bg: var(--warning-soft);
    --dv-fk-text: var(--ds-accent-warning);
    --dv-button-bg: var(--ds-accent-blue);
    --dv-button-text: #ffffff;
}

.duty-visit-form-page[data-entry-mode="actual"] {
    --dv-accent: var(--ds-accent-green);
    --dv-title: var(--ds-text-primary);
    --dv-page-pill-bg: var(--success-soft);
    --dv-page-pill-text: var(--ds-accent-green);
    --dv-page-pill-border: rgba(50, 213, 131, 0.24);
    --dv-card-border: rgba(50, 213, 131, 0.24);
    --dv-card-bg: var(--ds-bg-panel);
    --dv-body-bg: rgba(50, 213, 131, 0.06);
    --dv-stripe: var(--ds-accent-green);
    --dv-icon-bg: rgba(50, 213, 131, 0.12);
    --dv-icon-color: var(--ds-accent-green);
    --dv-input-border: var(--ds-border-subtle);
    --dv-focus-shadow: none;
    --dv-fk-bg: var(--success-soft);
    --dv-fk-text: var(--ds-accent-green);
    --dv-button-bg: var(--ds-accent-blue);
    --dv-button-text: #ffffff;
}

.dv-editor-hero {
    gap: var(--ds-space-2);
}

.dv-editor-hero h1 {
    color: var(--ds-text-primary);
    font-size: 24px;
    line-height: 32px;
    font-weight: 600;
}

.dv-section {
    --section-border: var(--ds-border-subtle);
    --section-card-bg: var(--ds-bg-panel);
    --section-body-bg: var(--surface-muted);
    --section-stripe: var(--ds-accent-blue);
    --section-icon-bg: var(--accent-soft);
    --section-icon-color: var(--ds-accent-blue);
    margin-bottom: 0;
    overflow: visible;
}

.dv-section::before {
    width: 3px;
    background: var(--section-stripe);
}

.dv-section-header {
    min-height: 48px;
    padding: 0 var(--ds-space-4);
}

.dv-section:not(.is-collapsed) .dv-section-header {
    border-bottom-color: var(--ds-border-subtle);
}

.dv-section-heading strong {
    color: var(--ds-text-primary);
    font-size: 14px;
}

.dv-section-subtitle {
    color: var(--ds-text-secondary);
    font-size: 12px;
}

.dv-section-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--ds-radius-lg);
}

.dv-section-body {
    gap: var(--ds-space-3);
    padding: var(--ds-space-4);
    background: var(--section-body-bg);
}

.dv-grid-two,
.dv-grid-three,
.form-section-grid,
.detail-grid {
    gap: var(--ds-space-3);
}

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

.dv-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dv-divider {
    background: var(--ds-border-subtle);
    margin: 0;
}

.dv-required {
    color: var(--ds-accent-danger);
}

.dv-bool-toggle {
    border: 0;
    border-radius: var(--ds-radius-lg);
    gap: var(--ds-space-1);
}

.duty-visit-form-page .dv-bool-toggle button,
.dv-bool-toggle button {
    min-height: 34px;
    height: 34px;
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-secondary);
}

.duty-visit-form-page .dv-bool-toggle button.is-active.is-yes,
.dv-bool-toggle button.is-active.is-yes {
    border-color: rgba(50, 213, 131, 0.28);
    background: var(--success-soft);
    color: var(--ds-accent-green);
}

.duty-visit-form-page .dv-bool-toggle button.is-active.is-no,
.dv-bool-toggle button.is-active.is-no {
    border-color: rgba(249, 112, 102, 0.24);
    background: var(--danger-soft);
    color: var(--ds-accent-danger);
}

.duty-visit-form-page .dv-stream-toggle {
    max-width: 260px;
    border-color: var(--ds-border-subtle);
    background: var(--ds-bg-elevated);
}

.duty-visit-form-page .dv-stream-toggle button.is-active.is-fire {
    background: var(--ds-accent-warning);
    color: #241600;
}

.duty-visit-form-page .dv-stream-toggle button.is-active.is-amb {
    background: var(--ds-accent-danger);
    color: #ffffff;
}

.dv-officer-chip,
.dv-inline-tag,
.dv-unit-pill {
    border: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
}

.dv-officer-assignment-row {
    border-color: var(--ds-border-subtle);
    background: var(--ds-bg-elevated);
}

.dv-officer-avatar {
    background: var(--accent-soft);
    color: var(--ds-accent-blue);
}

.duty-visit-mode-select .page-header,
.duty-visit-mode-select .card {
    border-color: var(--ds-border-subtle);
    background: var(--ds-bg-panel);
    box-shadow: var(--ds-shadow-1);
}

.duty-visit-mode-select .eyebrow,
.duty-visit-mode-select .sidebar-label,
.duty-visit-mode-select .label {
    color: var(--ds-text-muted);
    text-transform: none;
}

.duty-visit-form-page .dv-mode-copy,
.duty-visit-form-page .dv-compare-legend {
    color: var(--ds-text-secondary);
}

.duty-visit-form-page .dv-copy-banner {
    border-color: rgba(56, 189, 248, 0.24);
    background: var(--accent-soft);
}

.duty-visit-form-page .dv-copy-icon {
    background: var(--ds-bg-elevated);
    color: var(--ds-accent-blue);
}

.duty-visit-form-page .dv-copy-notice {
    color: var(--ds-accent-green);
}

.duty-visit-form-page .dv-compare-card {
    border-color: var(--ds-border-subtle);
    background: var(--ds-bg-panel);
}

.duty-visit-form-page .dv-compare-table th,
.duty-visit-form-page .dv-compare-table td {
    border-color: var(--ds-border-subtle);
    background: var(--ds-bg-surface);
    color: var(--ds-text-primary);
}

.duty-visit-form-page .dv-compare-table th:first-child,
.duty-visit-form-page .dv-compare-table td:first-child {
    background: var(--surface-muted);
    color: var(--ds-text-secondary);
}

.duty-visit-form-page .dv-compare-table th.is-plan,
.duty-visit-form-page .dv-compare-table td:nth-child(2) {
    background: var(--warning-soft);
    color: var(--ds-text-primary);
}

.duty-visit-form-page .dv-compare-table th.is-actual,
.duty-visit-form-page .dv-compare-table td:nth-child(3) {
    background: var(--success-soft);
    color: var(--ds-text-primary);
}

.duty-visit-form-page .dv-diff-badge.is-changed {
    border-color: rgba(253, 176, 34, 0.24);
    background: var(--warning-soft);
    color: var(--ds-accent-warning);
}

.duty-visit-form-page .dv-diff-badge.is-decrease {
    border-color: rgba(249, 112, 102, 0.24);
    background: var(--danger-soft);
    color: var(--ds-accent-danger);
}

.duty-visit-form-page .dv-diff-badge.is-increase {
    border-color: rgba(50, 213, 131, 0.24);
    background: var(--success-soft);
    color: var(--ds-accent-green);
}

.duty-visit-form-page .dv-compare-empty {
    color: var(--ds-text-muted);
}

.officers-page {
    max-width: 1440px;
}

.officers-toolbar-panel {
    overflow: visible;
}

.officer-toolbar {
    align-items: end;
}

.officers-list {
    display: grid;
    gap: var(--ds-space-3);
}

.officer-card {
    display: grid;
    gap: var(--ds-space-4);
    padding: var(--ds-space-4);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-panel);
    box-shadow: var(--ds-shadow-1);
}

.officer-card-head,
.officer-identity,
.officer-card-actions,
.officer-block-head,
.officer-visit-row,
.officer-rank-row {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
}

.officer-card-head,
.officer-block-head,
.officer-visit-row,
.officer-rank-row {
    justify-content: space-between;
}

.officer-identity {
    min-width: 0;
}

.officer-avatar {
    width: 42px;
    min-width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: var(--ds-radius-lg);
    background: var(--accent-soft);
    color: var(--ds-accent-blue);
    font-weight: 800;
}

.officer-name-block,
.officer-rank-main,
.officer-visit-main,
.officer-rank-meta {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.officer-name-block strong,
.officer-metric strong,
.officer-rank-main strong,
.officer-visit-main strong {
    color: var(--ds-text-primary);
    font-weight: 600;
}

.officer-name-block span,
.officer-rank-main span,
.officer-visit-main span,
.officer-rank-meta {
    color: var(--ds-text-secondary);
    font-size: 12px;
}

.officer-summary-grid,
.officer-detail-grid {
    display: grid;
    gap: var(--ds-space-3);
}

.officer-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.officer-metric,
.officer-detail-block {
    display: grid;
    gap: var(--ds-space-2);
    min-width: 0;
    padding: var(--ds-space-3);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--surface-muted);
}

.officer-rank-list,
.officer-visit-list {
    display: grid;
    gap: var(--ds-space-2);
}

.officer-rank-row,
.officer-visit-row,
.officer-empty-line {
    min-height: 42px;
    padding: var(--ds-space-2) var(--ds-space-3);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
}

.officer-visit-row {
    color: inherit;
    text-decoration: none;
}

.officer-visit-row:hover {
    border-color: var(--ds-border-strong);
    background: var(--ds-bg-panel);
}

.officer-empty-line {
    display: flex;
    align-items: center;
    color: var(--ds-text-muted);
}

.tag-success {
    border-color: rgba(50, 213, 131, 0.24);
    background: var(--success-soft);
    color: var(--ds-accent-green);
}

.tag-danger {
    border-color: rgba(249, 112, 102, 0.24);
    background: var(--danger-soft);
    color: var(--ds-accent-danger);
}

.views-tags-page .page-header {
    align-items: center;
}

.views-tags-stats {
    gap: var(--ds-space-2);
}

.views-tags-stat {
    min-width: 84px;
    padding: var(--ds-space-2) var(--ds-space-3);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-panel);
}

.views-tags-stat strong {
    color: var(--ds-text-primary);
    font-size: 18px;
    line-height: 24px;
}

.views-tags-stat span {
    color: var(--ds-text-muted);
    font-size: 12px;
    text-transform: none;
}

.views-tags-panel {
    gap: var(--ds-space-4);
    padding: var(--ds-space-4);
}

.views-tags-tabbar {
    gap: var(--ds-space-2);
    padding-bottom: var(--ds-space-3);
    border-bottom-color: var(--ds-border-subtle);
}

.views-tags-tab {
    min-height: 36px;
    padding: 0 var(--ds-space-3);
    border-radius: var(--ds-radius-lg);
    border: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.views-tags-tab.is-active {
    border-color: var(--ds-border-strong);
    background: var(--accent-soft);
    color: var(--ds-accent-blue);
}

.vt-panel,
.vt-manager-groups,
.vt-filter-sections,
.vt-results-column,
.vt-results-list,
.vt-saved-lists,
.vt-results-block,
.vt-saved-lists-block {
    gap: var(--ds-space-3);
}

.vt-manager-note,
.vt-chip-bar,
.vt-dropzone,
.vt-empty-state {
    border-color: var(--ds-border-subtle);
    background: var(--surface-muted);
}

.vt-group-card,
.vt-filter-section,
.vt-results-row,
.vt-saved-list,
.vt-saved-item {
    background: var(--ds-bg-panel);
    border-radius: var(--ds-radius-lg);
}

.vt-group-card.is-drop-target,
.vt-saved-list.is-drop-target .vt-dropzone {
    border-color: var(--ds-accent-blue);
    background: var(--accent-soft);
    box-shadow: none;
}

.vt-filter-column {
    top: var(--ds-space-3);
}

.vt-filter-title,
.vt-filter-group-label {
    color: var(--ds-text-muted);
    font-size: 12px;
    text-transform: none;
}

.vt-filter-section-head {
    min-height: 40px;
    padding: 0 var(--ds-space-3);
    color: var(--ds-text-primary);
    font-size: 14px;
}

.vt-filter-section-head:hover {
    background: var(--surface-muted);
}

.vt-option,
.vt-row-title,
.vt-saved-list-name {
    color: var(--ds-text-primary);
}

.vt-row-meta,
.vt-option-copy small,
.vt-dropzone-empty {
    color: var(--ds-text-secondary);
}

.import-center-page,
.duty-visit-mode-select {
    padding: var(--ds-space-6);
}

.import-center-page > section,
.duty-visit-mode-select > section {
    max-width: 1120px;
}

.import-center-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ds-space-4);
}

.import-card,
.import-card-secondary {
    width: 100%;
    max-width: none;
    background: var(--ds-bg-panel);
}

.dv-mode-pick-shell {
    max-width: 920px;
}

.dv-mode-pick-option {
    --mode-accent: var(--ds-text-muted);
    gap: var(--ds-space-2);
    padding: var(--ds-space-4);
    border: 1px solid var(--ds-border-subtle);
    border-left: 3px solid var(--mode-accent);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
}

.dv-mode-pick-option:hover {
    border-color: var(--ds-border-strong);
    background: var(--surface-muted);
}

.dv-mode-pick-option.is-plan {
    --mode-accent: var(--ds-accent-warning);
}

.dv-mode-pick-option.is-actual {
    --mode-accent: var(--ds-accent-green);
}

.dv-mode-pick-topline strong {
    color: var(--ds-text-primary);
    font-size: 16px;
}

.dv-mode-pick-tag {
    background: var(--surface-muted);
    color: var(--mode-accent);
}

.dv-mode-pick-copy {
    color: var(--ds-text-secondary);
    font-size: 14px;
}

.dv-wizard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--ds-space-4);
}

.dv-wizard-progress-copy {
    display: grid;
    justify-items: flex-end;
    gap: 2px;
    min-width: 140px;
    text-align: right;
}

.dv-wizard-progress-copy strong {
    color: var(--ds-text-primary);
    font-size: 16px;
    line-height: 1.3;
}

.dv-wizard-shell {
    max-width: 960px;
    gap: var(--ds-space-4);
}

.dv-status-progress {
    display: grid;
    gap: var(--ds-space-2);
    padding: var(--ds-space-3);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: color-mix(in srgb, var(--ds-bg-elevated) 76%, #0a2232);
}

.dv-status-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-2);
}

.dv-status-progress-caption {
    color: var(--ds-text-secondary);
    font-size: 12px;
}

.dv-visit-live-summary {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--ds-accent-blue) 38%, var(--ds-border-subtle));
    border-radius: var(--ds-radius-lg);
    background:
        linear-gradient(120deg, color-mix(in srgb, #0f766e 14%, transparent) 0%, transparent 52%),
        linear-gradient(320deg, color-mix(in srgb, #1d4ed8 14%, transparent) 0%, transparent 58%),
        color-mix(in srgb, var(--ds-bg-elevated) 88%, #0a2232);
}

.dv-visit-live-summary-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.dv-visit-live-summary-head strong {
    color: var(--ds-text-primary);
    font-size: 15px;
}

.dv-visit-live-summary-head span {
    color: var(--ds-text-muted);
    font-size: 11px;
}

.dv-visit-live-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.dv-visit-live-item {
    display: grid;
    gap: 3px;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--ds-border-subtle) 78%, transparent);
    border-radius: var(--ds-radius-md);
    background: color-mix(in srgb, var(--ds-bg-panel) 84%, transparent);
    min-height: 62px;
}

.dv-visit-live-item .sidebar-label {
    font-size: 10px;
    color: var(--ds-text-muted);
}

.dv-visit-live-item strong {
    color: var(--ds-text-primary);
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}

.dv-visit-live-finance-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dv-visit-live-finance-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid var(--ds-border-strong);
    font-size: 12px;
    font-weight: 700;
    color: var(--ds-text-primary);
    background: color-mix(in srgb, var(--ds-bg-panel) 82%, transparent);
}

.dv-visit-live-finance-pill.is-budget {
    border-color: rgba(20, 184, 166, 0.5);
    background: rgba(15, 118, 110, 0.24);
    color: #99f6e4;
}

.dv-visit-live-finance-pill.is-estimation {
    border-color: rgba(245, 158, 11, 0.56);
    background: rgba(146, 64, 14, 0.28);
    color: #fcd34d;
}

.dv-visit-live-finance-pill.is-actual {
    border-color: rgba(244, 63, 94, 0.5);
    background: rgba(159, 18, 57, 0.3);
    color: #fda4af;
}

.dv-status-pill-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dv-status-arrow {
    color: var(--ds-text-muted);
    font-size: 20px;
    line-height: 1;
}

.dv-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--ds-border-strong);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-secondary);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    opacity: 0.74;
}

.dv-status-pill.is-current {
    color: var(--ds-text-primary);
    opacity: 1;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.dv-status-pill.is-planning {
    border-color: rgba(96, 165, 250, 0.45);
    background: rgba(30, 64, 175, 0.26);
}

.dv-status-pill.is-confirmed {
    border-color: rgba(74, 222, 128, 0.44);
    background: rgba(22, 101, 52, 0.3);
}

.dv-status-pill.is-rejected {
    border-color: rgba(248, 113, 113, 0.46);
    background: rgba(127, 29, 29, 0.32);
}

.dv-status-pill.is-completed {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(6, 78, 59, 0.44);
}

.dv-status-pill.is-cancelled {
    border-color: rgba(209, 213, 219, 0.46);
    background: rgba(55, 65, 81, 0.48);
}

.dv-status-meaning-grid {
    display: flex;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
    padding: 2px 0 4px;
    scrollbar-width: thin;
}

.dv-status-meaning-card {
    display: grid;
    gap: 3px;
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 7px;
    border-radius: var(--ds-radius-md);
    border: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-elevated);
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.dv-status-meaning-card:hover,
.dv-status-meaning-card:focus-visible {
    border-color: var(--ds-border-strong);
    transform: translateY(-1px);
}

.dv-status-meaning-card:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--ds-accent, #3b82f6) 72%, #ffffff);
    outline-offset: 2px;
}

.dv-status-meaning-card.is-current {
    border-color: color-mix(in srgb, var(--ds-accent, #60a5fa) 64%, #ffffff);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ds-accent, #60a5fa) 24%, transparent);
    background: color-mix(in srgb, var(--ds-bg-elevated) 76%, #12394e);
}

.dv-status-meaning-title {
    color: var(--ds-text-primary);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
}

.dv-status-meaning-card p {
    display: grid;
    gap: 2px;
    margin: 0;
    color: var(--ds-text-secondary);
    font-size: 8.5px;
    line-height: 1.22;
}

.dv-status-meaning-desc-zh {
    color: var(--ds-text-secondary);
}

.dv-status-meaning-card.is-planning {
    border-color: rgba(96, 165, 250, 0.4);
}

.dv-status-meaning-card.is-confirmed {
    border-color: rgba(74, 222, 128, 0.4);
}

.dv-status-meaning-card.is-rejected {
    border-color: rgba(248, 113, 113, 0.4);
}

.dv-status-meaning-card.is-completed {
    border-color: rgba(16, 185, 129, 0.42);
}

.dv-status-meaning-card.is-cancelled {
    border-color: rgba(209, 213, 219, 0.4);
}

.dv-wizard-panel {
    display: grid;
    gap: var(--ds-space-3);
}

.dv-wizard-error {
    padding: var(--ds-space-3);
    border: 1px solid rgba(249, 112, 102, 0.35);
    border-radius: var(--ds-radius-lg);
    background: rgba(249, 112, 102, 0.12);
    color: #ffd6d1;
}

.dv-wizard-question {
    margin: 0;
    color: var(--ds-text-primary);
    font-size: 20px;
    line-height: 1.3;
    font-weight: 600;
}

.dv-wizard-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ds-space-3);
}

.dv-wizard-choice {
    display: grid;
    gap: var(--ds-space-2);
    min-height: 94px;
    padding: var(--ds-space-4);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.dv-wizard-choice:hover {
    border-color: var(--ds-border-strong);
    background: rgba(56, 189, 248, 0.08);
}

.dv-wizard-choice:focus-visible {
    outline: 2px solid var(--ds-focus-ring);
    outline-offset: 2px;
}

.dv-wizard-choice.is-selected {
    border-color: var(--ds-accent-blue);
    background: rgba(56, 189, 248, 0.12);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.dv-wizard-choice strong {
    font-size: 15px;
    line-height: 1.35;
}

.dv-wizard-choice span {
    color: var(--ds-text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.dv-wizard-result {
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    padding: var(--ds-space-4);
    background: var(--surface-muted);
}

.dv-wizard-result-summary {
    margin: 0;
    color: var(--ds-text-primary);
    font-size: 21px;
    line-height: 1.25;
    font-weight: 650;
}

.dv-wizard-selection {
    display: grid;
    gap: var(--ds-space-2);
    padding: var(--ds-space-3);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-lg);
    background: rgba(8, 47, 73, 0.28);
}

.dv-wizard-selection-head {
    color: var(--ds-text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dv-wizard-selection-pill-row {
    display: flex;
    gap: var(--ds-space-2);
    flex-wrap: wrap;
}

.dv-wizard-selection-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--ds-border-strong);
    background: rgba(15, 23, 42, 0.76);
    color: var(--ds-text-primary);
    font-size: 16px;
    line-height: 1.2;
    font-weight: 650;
}

.dv-wizard-selection-pill[data-tone="past"] {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(120, 53, 15, 0.36);
    color: #fbbf24;
}

.dv-wizard-selection-pill[data-tone="future"] {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(29, 78, 216, 0.28);
    color: #93c5fd;
}

.dv-wizard-selection-pill[data-tone="inbound"] {
    border-color: rgba(45, 212, 191, 0.52);
    background: rgba(15, 118, 110, 0.32);
    color: #99f6e4;
}

.dv-wizard-selection-pill[data-tone="outbound"] {
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(88, 28, 135, 0.32);
    color: #d8b4fe;
}

.dv-wizard-selection-pill[data-tone="recommended"] {
    border-color: rgba(56, 189, 248, 0.52);
    background: rgba(14, 116, 144, 0.34);
    color: #a5f3fc;
}

.dv-wizard-selection-pill[data-tone="not_recommended"] {
    border-color: rgba(148, 163, 184, 0.5);
    background: rgba(71, 85, 105, 0.34);
    color: #cbd5e1;
}

.dv-wizard-selection-pill[data-tone="pending"] {
    border-color: rgba(250, 204, 21, 0.5);
    background: rgba(113, 63, 18, 0.34);
    color: #fde68a;
}

.dv-chapter-stack {
    display: grid;
    gap: var(--ds-space-3);
}

.dv-chapter-card {
    --chapter-accent: var(--ds-accent-blue);
    border: 1px solid color-mix(in srgb, var(--chapter-accent) 38%, var(--ds-border-subtle));
    border-radius: var(--ds-radius-lg);
    background: color-mix(in srgb, var(--chapter-accent) 8%, var(--ds-bg-panel));
    overflow: hidden;
}

.dv-chapter-card[data-dv-chapter="location_schedule"] {
    --chapter-accent: #2dd4bf;
}

.dv-chapter-card[data-dv-chapter="finance"] {
    --chapter-accent: #f59e0b;
    overflow: visible;
}

.dv-chapter-card[data-dv-chapter="people"] {
    --chapter-accent: #38bdf8;
}

.dv-chapter-card[data-dv-chapter="reporting"] {
    --chapter-accent: #6366f1;
}

.dv-chapter-card[data-dv-chapter="remarks_submit"] {
    --chapter-accent: #94a3b8;
}

.dv-chapter-card.is-complete {
    border-color: rgba(74, 222, 128, 0.42);
}

.dv-chapter-card.is-pending {
    border-color: rgba(251, 191, 36, 0.4);
}

.dv-chapter-card.is-progress {
    border-color: rgba(56, 189, 248, 0.42);
}

.dv-chapter-toggle {
    width: 100%;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--chapter-accent) 24%, transparent);
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--chapter-accent) 18%, var(--ds-bg-elevated)) 0%,
        color-mix(in srgb, var(--chapter-accent) 6%, var(--ds-bg-panel)) 100%
    );
    color: var(--ds-text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-2);
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
}

.dv-chapter-toggle-copy {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dv-chapter-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--chapter-accent) 34%, transparent);
    font-size: 16px;
    flex-shrink: 0;
}

.dv-chapter-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.dv-chapter-text strong {
    color: var(--ds-text-primary);
    font-size: 15px;
    line-height: 1.2;
}

.dv-chapter-text span {
    color: var(--ds-text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

.dv-chapter-toggle-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dv-chapter-chevron {
    color: var(--ds-text-muted);
    font-size: 15px;
    line-height: 1;
    transition: transform 150ms ease;
}

.dv-chapter-card.is-open .dv-chapter-chevron {
    transform: rotate(180deg);
}

.dv-chapter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.dv-chapter-badge.is-complete,
.dv-chapter-card.is-complete .dv-chapter-badge {
    color: #14532d;
    border-color: rgba(74, 222, 128, 0.45);
    background: rgba(74, 222, 128, 0.18);
}

.dv-chapter-badge.is-pending,
.dv-chapter-card.is-pending .dv-chapter-badge {
    color: #92400e;
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.18);
}

.dv-chapter-badge.is-progress,
.dv-chapter-card.is-progress .dv-chapter-badge {
    color: #0c4a6e;
    border-color: rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.18);
}

.dv-chapter-badge.is-optional,
.dv-chapter-card.is-optional .dv-chapter-badge {
    color: var(--ds-text-secondary);
    border-color: var(--ds-border-strong);
    background: color-mix(in srgb, var(--ds-bg-elevated) 84%, transparent);
}

.dv-chapter-body {
    display: grid;
    gap: var(--ds-space-3);
    padding: 12px;
    background: color-mix(in srgb, var(--ds-bg-panel) 88%, transparent);
}

.dv-chapter-card[data-dv-chapter="finance"] .dv-chapter-body {
    overflow: visible;
}

.dv-chapter-body .dv-wizard-section {
    padding: 10px 12px;
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-md);
    background: color-mix(in srgb, var(--ds-bg-elevated) 82%, #0a2232);
}

.dv-wizard-actions {
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
    flex-wrap: wrap;
}

.dv-wizard-actions-external {
    width: 100%;
    max-width: 960px;
    justify-self: center;
    justify-content: center;
    padding: 0 2px;
}

.dv-wizard-nav {
    display: flex;
    align-items: center;
}

.dv-wizard-form {
    display: grid;
    gap: var(--ds-space-3);
}

.dv-wizard-section {
    display: grid;
    gap: var(--ds-space-3);
}

.dv-wizard-section-head {
    display: grid;
    gap: 2px;
}

.dv-wizard-section-head-centered {
    text-align: center;
    justify-items: center;
}

.dv-wizard-section-head h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
    color: var(--ds-text-primary);
}

.dv-wizard-section-head p {
    margin: 0;
    color: var(--ds-text-muted);
    font-size: 12px;
}

.dv-wizard-section-head-centered p {
    max-width: 62ch;
}

.dv-wizard-divider {
    height: 1px;
    background: var(--ds-border-subtle);
}

.dv-wizard-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ds-space-3);
}

.dv-wizard-report-grid,
.dv-wizard-date-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ds-space-3);
}

.dv-wizard-date-grid-top {
    max-width: 760px;
    margin-inline: auto;
}

.dv-finance-list {
    display: grid;
    gap: 8px;
}

.dv-finance-control-section {
    --chapter-accent: #14b8a6;
}

.dv-finance-control-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, #14b8a6 42%, var(--ds-border-subtle));
    border-radius: var(--ds-radius-lg);
    background:
        linear-gradient(118deg, color-mix(in srgb, #0f766e 16%, transparent) 0%, transparent 56%),
        color-mix(in srgb, var(--ds-bg-elevated) 84%, #082f49);
}

.dv-finance-item {
    position: relative;
    overflow: visible;
    --dv-finance-accent: #64748b;
    --dv-finance-border: color-mix(in srgb, var(--dv-finance-accent) 38%, var(--ds-border-subtle));
    --dv-finance-bg: color-mix(in srgb, var(--ds-bg-elevated) 80%, var(--dv-finance-accent) 20%);
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--dv-finance-border);
    border-radius: var(--ds-radius-lg);
    background: var(--dv-finance-bg);
}

.dv-finance-item::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: color-mix(in srgb, var(--dv-finance-accent) 72%, #ffffff 28%);
    pointer-events: none;
}

.dv-finance-item.is-stage-budget_annual {
    --dv-finance-accent: #0f766e;
}

.dv-finance-item.is-stage-estimation_before_departure {
    --dv-finance-accent: #b45309;
}

.dv-finance-item.is-stage-actual_completion {
    --dv-finance-accent: #be123c;
}

.dv-finance-static-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-2);
    flex-wrap: wrap;
    width: 100%;
    padding: 2px 0;
    text-align: left;
}

.dv-finance-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-2);
    width: 100%;
    margin-top: 2px;
    border: 1px solid color-mix(in srgb, var(--dv-finance-accent) 40%, var(--ds-border));
    border-radius: var(--ds-radius-lg);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--dv-finance-accent) 16%, transparent), color-mix(in srgb, var(--dv-finance-accent) 8%, transparent)),
        var(--dv-surface-soft);
    color: var(--ds-text-primary);
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--dv-finance-accent) 18%, transparent);
    transition: border-color 150ms ease, transform 120ms ease, box-shadow 150ms ease, background 150ms ease;
}

.dv-finance-toggle:hover,
.dv-finance-toggle:focus-visible {
    border-color: color-mix(in srgb, var(--dv-finance-accent) 62%, var(--ds-border-strong));
    transform: translateY(-1px);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--dv-finance-accent) 24%, transparent);
    outline: none;
}

.dv-finance-item.is-open .dv-finance-toggle {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--dv-finance-accent) 28%, transparent), color-mix(in srgb, var(--dv-finance-accent) 16%, transparent)),
        var(--dv-surface-soft);
}

.dv-finance-title {
    display: block;
    color: var(--ds-text-primary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.dv-finance-toggle-copy {
    color: var(--ds-text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dv-finance-item.is-open .dv-finance-toggle-copy {
    color: var(--ds-text-secondary);
}

.dv-finance-toggle-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: color-mix(in srgb, var(--dv-finance-accent) 22%, var(--ds-surface));
    color: var(--ds-text-primary);
    font-size: 14px;
    font-weight: 700;
    transition: transform 150ms ease;
}

.dv-finance-item.is-open .dv-finance-toggle-icon {
    transform: rotate(180deg);
}

.dv-finance-calc {
    display: grid;
    gap: 6px;
    padding: 8px 10px;
    border-radius: var(--ds-radius-md);
    border: 1px dashed color-mix(in srgb, var(--ds-border-strong) 70%, transparent);
    background: color-mix(in srgb, var(--ds-bg-panel) 88%, #0f172a);
}

.dv-finance-calc-table-wrap {
    overflow-x: auto;
}

.dv-finance-calc-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
}

.dv-finance-calc-table thead th {
    text-align: left;
    color: var(--ds-text-muted);
    font-size: 11px;
    font-weight: 600;
    border-bottom: 1px solid var(--ds-border-subtle);
    padding: 4px 6px 6px;
}

.dv-finance-calc-table tbody th,
.dv-finance-calc-table tbody td {
    border-bottom: 1px solid color-mix(in srgb, var(--ds-border-subtle) 70%, transparent);
    padding: 6px;
    vertical-align: middle;
}

.dv-finance-calc-table tbody tr:last-child th,
.dv-finance-calc-table tbody tr:last-child td {
    border-bottom: 0;
}

.dv-finance-calc-table tbody th {
    width: 31%;
    color: var(--ds-text-secondary);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.dv-finance-calc-table .is-total {
    width: 17%;
}

.dv-finance-calc-cell-total {
    color: var(--ds-text-primary);
    font-weight: 700;
    white-space: nowrap;
}

.dv-finance-calc-input {
    min-height: 28px;
    height: 28px;
    padding: 3px 6px;
    font-size: 12px;
    width: 86px;
    min-width: 86px;
    max-width: 86px;
    box-sizing: border-box;
    border-radius: var(--ds-radius-sm);
    border: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
}

.dv-finance-calc-input-pax {
    width: 64px;
    min-width: 64px;
    max-width: 64px;
}

.dv-finance-calc-input-narrow {
    width: 58px;
    min-width: 58px;
    max-width: 58px;
}

.dv-finance-formula-inline {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
    white-space: nowrap;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 1px;
}

.dv-finance-calc-op {
    color: var(--ds-text-muted);
    font-size: 12px;
    line-height: 1;
}

.dv-finance-pax-token {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--ds-border-subtle) 82%, transparent);
    color: var(--ds-text-secondary);
    background: color-mix(in srgb, var(--ds-bg-elevated) 78%, transparent);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.dv-finance-calc-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.dv-finance-calc-total {
    color: var(--ds-text-primary);
    font-size: 12px;
}

.dv-actual-expenditure {
    display: grid;
    gap: 8px;
    padding: 8px 10px;
    border: 1px dashed color-mix(in srgb, var(--ds-border-strong) 68%, transparent);
    border-radius: var(--ds-radius-md);
    background: color-mix(in srgb, var(--ds-bg-elevated) 72%, #0f172a);
}

.dv-actual-expenditure-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.dv-actual-expenditure-head strong {
    color: var(--ds-text-primary);
    font-size: 12px;
}

.dv-actual-expenditure-add {
    width: 100%;
    justify-content: center;
    min-height: 28px;
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
}

.dv-actual-expenditure-table-wrap {
    overflow: visible;
}

.dv-actual-expenditure-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11px;
}

.dv-actual-expenditure-table thead th {
    text-align: left;
    color: var(--ds-text-muted);
    font-size: 10px;
    font-weight: 600;
    border-bottom: 1px solid var(--ds-border-subtle);
    padding: 4px 6px 5px;
}

.dv-actual-expenditure-table thead th:nth-child(1) {
    width: 34%;
}

.dv-actual-expenditure-table thead th:nth-child(2) {
    width: 16%;
}

.dv-actual-expenditure-table thead th:nth-child(3) {
    width: 24%;
}

.dv-actual-expenditure-table thead th:nth-child(4) {
    width: 20%;
}

.dv-actual-expenditure-table tbody td {
    border-bottom: 1px solid color-mix(in srgb, var(--ds-border-subtle) 70%, transparent);
    padding: 5px 6px;
    vertical-align: top;
    overflow: visible;
    position: relative;
}

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

.dv-actual-expenditure-table .is-actions {
    width: 48px;
}

.dv-actual-expenditure-input {
    width: 100%;
    min-height: 28px;
    height: 28px;
    padding: 3px 7px;
    border-radius: var(--ds-radius-sm);
    border: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
    font-size: 11px;
    box-sizing: border-box;
}

.dv-actual-expenditure-input-amount {
    max-width: 130px;
}

.dv-actual-expenditure-fy-stack {
    display: grid;
    gap: 4px;
}

.dv-actual-expenditure-vote-stack {
    display: grid;
    gap: 4px;
}

.dv-actual-expenditure-vote-smart .smart-select-control {
    min-height: 28px;
    height: 28px;
    grid-template-columns: minmax(0, 1fr) auto 26px 26px;
}

.dv-actual-expenditure-vote-smart .smart-select-input {
    font-size: 11px;
    min-height: 26px;
    height: 26px;
}

.dv-actual-expenditure-vote-smart.is-open {
    z-index: 160;
}

.dv-actual-expenditure-vote-smart .smart-select-menu {
    left: 0;
    right: auto;
    width: max-content;
    min-width: 100%;
    max-width: min(96vw, 1180px);
    margin-top: 0;
}

.dv-actual-expenditure-vote-smart .smart-select-options-scroll {
    max-height: min(78vh, 760px);
}

.dv-actual-expenditure-fy-smart .smart-select-control {
    min-height: 28px;
    height: 28px;
    grid-template-columns: minmax(0, 1fr) auto 26px 26px;
}

.dv-visit-fy-smart .smart-select-control {
    grid-template-columns: minmax(0, 1fr) auto 36px 36px;
}

.dv-actual-expenditure-fy-smart .smart-select-input {
    font-size: 11px;
    min-height: 26px;
    height: 26px;
}

.dv-actual-expenditure-fy-smart.is-open {
    z-index: 160;
}

.dv-actual-expenditure-fy-smart .smart-select-menu {
    margin-top: 0;
}

.dv-actual-expenditure-fy-smart.is-disabled .smart-select-control {
    opacity: 0.72;
}

.dv-actual-expenditure-vote-smart.is-disabled .smart-select-control {
    opacity: 0.72;
}

.dv-actual-expenditure-vote-smart .smart-select-trigger,
.dv-actual-expenditure-vote-lock {
    width: 26px;
    min-width: 26px;
    height: 28px;
    border: 0;
    border-left: 1px solid var(--ds-border-subtle);
    border-radius: 0;
    background: transparent;
    color: var(--ds-text-muted);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dv-actual-expenditure-vote-lock {
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.dv-actual-expenditure-vote-lock:hover {
    background: color-mix(in srgb, var(--surface-muted) 66%, transparent);
}

.dv-actual-expenditure-vote-lock.is-unlocked {
    color: var(--ds-accent-warning);
}

.dv-actual-expenditure-vote-warning {
    font-size: 10px;
    color: var(--ds-accent-warning);
}

.dv-actual-expenditure-fy-smart .smart-select-trigger,
.dv-actual-expenditure-fy-lock {
    width: 26px;
    min-width: 26px;
    height: 28px;
    border: 0;
    border-left: 1px solid var(--ds-border-subtle);
    border-radius: 0;
    background: transparent;
    color: var(--ds-text-muted);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dv-actual-expenditure-fy-lock {
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.dv-actual-expenditure-fy-lock:hover {
    background: color-mix(in srgb, var(--surface-muted) 66%, transparent);
}

.dv-actual-expenditure-fy-lock.is-unlocked {
    color: var(--ds-accent-warning);
}

.dv-visit-fy-lock {
    width: 36px;
    min-width: 36px;
    height: 36px;
    border: 0;
    border-left: 1px solid var(--ds-border-subtle);
    border-radius: 0;
    background: transparent;
    color: var(--ds-text-muted);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.dv-visit-fy-lock:hover {
    background: color-mix(in srgb, var(--surface-muted) 66%, transparent);
}

.dv-visit-fy-lock.is-unlocked {
    color: var(--ds-accent-warning);
}

.dv-visit-fy-smart.is-disabled .smart-select-control {
    opacity: 0.72;
}

.dv-actual-expenditure-fy-warning {
    font-size: 10px;
    color: var(--ds-accent-warning);
}

.dv-actual-expenditure-row.is-fy-mismatch td {
    background: color-mix(in srgb, var(--ds-accent-warning) 10%, transparent);
}

.dv-actual-expenditure-remove {
    min-height: 24px;
    height: 24px;
    width: 24px;
    padding: 0;
    border-radius: 999px;
}

.dv-wizard-field {
    display: grid;
    gap: 6px;
}

[data-duty-wizard-status-smart] {
    display: grid;
}

.dv-wizard-field-full {
    grid-column: 1 / -1;
}

.dv-wizard-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.dv-wizard-field select,
.dv-wizard-field textarea {
    min-height: 36px;
    padding: 8px 10px;
    border-radius: var(--ds-radius-md);
    border: 1px solid var(--ds-border-subtle);
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
}

.dv-wizard-field textarea {
    min-height: 72px;
    resize: vertical;
}

.dv-wizard-field .label {
    color: var(--ds-text-secondary);
}

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

@media (max-width: 1080px) {
    .layout,
    body.sidebar-collapsed .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .page-scroll,
    .workspace-shell,
    .import-center-page,
    .duty-visit-mode-select {
        padding: var(--ds-space-4);
    }

    .workspace-toolbar,
    .hero-card {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid,
    .form-section-grid,
    .form-grid-wide .form-section-grid,
    .detail-grid,
    .officer-summary-grid,
    .officer-detail-grid,
    .dv-grid-two,
    .dv-grid-three,
    .vt-workspace,
    .import-center-grid,
    .dv-mode-pick-group,
    .dv-wizard-choice-grid,
    .dv-wizard-form-grid,
    .dv-wizard-report-grid,
    .dv-wizard-date-grid {
        grid-template-columns: 1fr;
    }

    .dv-visit-live-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dv-finance-calc-table {
        min-width: 980px;
    }

    .dv-finance-control-card {
        grid-template-columns: 1fr;
    }

    .dv-chapter-toggle {
        align-items: flex-start;
    }

    .dv-chapter-toggle-copy {
        align-items: flex-start;
    }

    .dv-chapter-toggle-meta {
        margin-top: 2px;
    }

    .bulk-bar,
    body.sidebar-collapsed .bulk-bar {
        left: var(--ds-space-4);
        right: var(--ds-space-4);
    }
}

@media (max-width: 720px) {
    .topbar {
        padding: 0 var(--ds-space-3);
    }

    .brand-subtitle,
    .system-status,
    .density-toggle .label {
        display: none;
    }

    .page-header,
    .hero-card,
    .panel,
    .card,
    .import-card {
        padding: var(--ds-space-4);
    }

    .hero-actions,
    .header-actions,
    .row-actions,
    .footer-bar,
    .duty-status-legend,
    .officer-card-head,
    .officer-card-actions,
    .officer-rank-row,
    .officer-visit-row,
    .dv-editor-topbar,
    .dv-editor-footer,
    .dv-editor-topbar-left,
    .dv-editor-topbar-right,
    .duty-visit-form-page .dv-tabbar,
    .duty-visit-form-page .dv-modebar,
    .duty-visit-form-page .dv-copy-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .dv-wizard-header,
    .dv-wizard-actions,
    .dv-status-progress-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dv-visit-live-summary-grid {
        grid-template-columns: 1fr;
    }

    .dv-wizard-progress-copy {
        justify-items: flex-start;
        text-align: left;
    }

    .hero-card::after {
        width: 100%;
        opacity: 0.22;
        mask-image: linear-gradient(180deg, transparent 0%, #000 22%);
    }

    table.dense,
    .dense {
        min-width: 680px;
    }
}

/* Final dark-theme contrast pass for selected pills and multi-select chips. */
.dv-wizard-choice.is-selected {
    border-color: var(--ds-accent-blue);
    background: color-mix(in srgb, var(--ds-accent-blue) 22%, var(--ds-bg-elevated));
    color: var(--ds-text-primary);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ds-accent-blue) 42%, transparent);
}

.dv-wizard-choice.is-selected span,
.dv-wizard-choice.is-selected strong {
    color: var(--ds-text-primary);
}

.dv-wizard-selection-pill {
    background: var(--ds-bg-elevated);
    color: var(--ds-text-primary);
    border-color: var(--ds-border-strong);
}

.dv-wizard-selection-pill[data-tone="past"],
.dv-wizard-selection-pill[data-tone="future"],
.dv-wizard-selection-pill[data-tone="inbound"],
.dv-wizard-selection-pill[data-tone="outbound"],
.dv-wizard-selection-pill[data-tone="recommended"],
.dv-wizard-selection-pill[data-tone="not_recommended"],
.dv-wizard-selection-pill[data-tone="pending"] {
    color: var(--ds-text-primary);
}

.dv-wizard-selection-pill[data-tone="past"] {
    background: color-mix(in srgb, var(--ds-accent-warning) 24%, var(--ds-bg-elevated));
}

.dv-wizard-selection-pill[data-tone="future"],
.dv-wizard-selection-pill[data-tone="recommended"] {
    background: color-mix(in srgb, var(--ds-accent-blue) 24%, var(--ds-bg-elevated));
}

.dv-wizard-selection-pill[data-tone="inbound"] {
    background: color-mix(in srgb, var(--ds-accent-teal, #2dd4bf) 24%, var(--ds-bg-elevated));
}

.dv-wizard-selection-pill[data-tone="outbound"] {
    background: color-mix(in srgb, var(--ds-accent-purple, #a855f7) 24%, var(--ds-bg-elevated));
}

.dv-wizard-selection-pill[data-tone="not_recommended"] {
    background: color-mix(in srgb, var(--ds-text-secondary) 24%, var(--ds-bg-elevated));
}

.dv-wizard-selection-pill[data-tone="pending"] {
    background: color-mix(in srgb, var(--ds-accent-warning) 28%, var(--ds-bg-elevated));
}

.dv-tag-chip {
    border-color: color-mix(in srgb, var(--tag-color, var(--ds-accent-blue)) 48%, var(--ds-border-subtle));
    background: color-mix(in srgb, var(--tag-color, var(--ds-accent-blue)) 14%, var(--ds-bg-elevated));
    color: var(--ds-text-primary);
}

.dv-tag-chip.is-selected {
    border-color: color-mix(in srgb, var(--tag-color, var(--ds-accent-blue)) 72%, var(--ds-border-strong));
    background: color-mix(in srgb, var(--tag-color, var(--ds-accent-blue)) 24%, var(--ds-bg-elevated));
    color: var(--ds-text-primary);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tag-color, var(--ds-accent-blue)) 36%, transparent);
}

button.dv-tag-chip:hover,
button.dv-tag-chip.is-selected:hover {
    border-color: color-mix(in srgb, var(--tag-color, var(--ds-accent-blue)) 84%, var(--ds-border-strong));
    background: color-mix(in srgb, var(--tag-color, var(--ds-accent-blue)) 30%, var(--ds-bg-elevated));
    color: var(--ds-text-primary);
}

.dv-tag-chip-sub,
.dv-tag-chip-remove {
    color: var(--ds-text-secondary);
}

.dv-tag-chip.is-selected .dv-tag-chip-sub,
.dv-tag-chip.is-selected .dv-tag-chip-remove {
    color: var(--ds-text-primary);
}

.dv-unit-pill,
.dv-unit-pill-blue,
.dv-unit-pill-amber,
.dv-unit-pill-green,
.dv-unit-pill-teal,
.dv-unit-pill-coral,
.dv-unit-pill-purple,
.dv-unit-pill-pink {
    color: var(--ds-text-primary);
}

.dv-unit-pill-blue {
    border-color: rgba(56, 189, 248, 0.38);
    background: rgba(56, 189, 248, 0.16);
}

.dv-unit-pill-amber {
    border-color: rgba(253, 176, 34, 0.38);
    background: rgba(253, 176, 34, 0.16);
}

.dv-unit-pill-green {
    border-color: rgba(50, 213, 131, 0.38);
    background: rgba(50, 213, 131, 0.16);
}

.dv-unit-pill-teal {
    border-color: rgba(45, 212, 191, 0.38);
    background: rgba(45, 212, 191, 0.16);
}

.dv-unit-pill-coral {
    border-color: rgba(249, 112, 102, 0.38);
    background: rgba(249, 112, 102, 0.16);
}

.dv-unit-pill-purple {
    border-color: rgba(168, 85, 247, 0.38);
    background: rgba(168, 85, 247, 0.16);
}

.dv-unit-pill-pink {
    border-color: rgba(236, 72, 153, 0.38);
    background: rgba(236, 72, 153, 0.16);
}

/* Duty visit input contrast hardening: keep readable text/background on blur and autofill. */
.duty-visit-mode-select .dv-wizard-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.duty-visit-mode-select .dv-wizard-field select,
.duty-visit-mode-select .dv-wizard-field textarea,
.duty-visit-mode-select .dv-finance-calc-input {
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
    -webkit-text-fill-color: var(--ds-text-primary);
    caret-color: var(--ds-text-primary);
}

.duty-visit-mode-select .dv-wizard-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):hover,
.duty-visit-mode-select .dv-wizard-field select:hover,
.duty-visit-mode-select .dv-wizard-field textarea:hover,
.duty-visit-mode-select .dv-finance-calc-input:hover {
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
}

.duty-visit-mode-select .dv-wizard-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
.duty-visit-mode-select .dv-wizard-field select:focus,
.duty-visit-mode-select .dv-wizard-field textarea:focus,
.duty-visit-mode-select .dv-finance-calc-input:focus {
    background: var(--ds-bg-panel);
    color: var(--ds-text-primary);
    -webkit-text-fill-color: var(--ds-text-primary);
}

.duty-visit-mode-select .dv-wizard-field input:-webkit-autofill,
.duty-visit-mode-select .dv-wizard-field input:-webkit-autofill:hover,
.duty-visit-mode-select .dv-wizard-field input:-webkit-autofill:focus,
.duty-visit-mode-select .dv-wizard-field textarea:-webkit-autofill,
.duty-visit-mode-select .dv-wizard-field textarea:-webkit-autofill:focus,
.duty-visit-mode-select .dv-wizard-field select:-webkit-autofill,
.duty-visit-mode-select .dv-wizard-field select:-webkit-autofill:focus,
.duty-visit-mode-select .dv-finance-calc-input:-webkit-autofill,
.duty-visit-mode-select .dv-finance-calc-input:-webkit-autofill:hover,
.duty-visit-mode-select .dv-finance-calc-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ds-text-primary);
    box-shadow: 0 0 0 1000px var(--ds-bg-panel) inset;
    caret-color: var(--ds-text-primary);
    border-color: var(--ds-border-subtle);
}

.duty-visit-form-page .dv-field input:-webkit-autofill,
.duty-visit-form-page .dv-field input:-webkit-autofill:hover,
.duty-visit-form-page .dv-field input:-webkit-autofill:focus,
.duty-visit-form-page .dv-field textarea:-webkit-autofill,
.duty-visit-form-page .dv-field textarea:-webkit-autofill:focus,
.duty-visit-form-page .dv-field select:-webkit-autofill,
.duty-visit-form-page .dv-field select:-webkit-autofill:focus,
.duty-visit-form-page .smart-select-input:-webkit-autofill,
.duty-visit-form-page .smart-select-input:-webkit-autofill:hover,
.duty-visit-form-page .smart-select-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--ds-text-primary);
    box-shadow: 0 0 0 1000px var(--ds-bg-elevated) inset;
    caret-color: var(--ds-text-primary);
}

body.has-seed-modal-open {
    overflow: hidden;
}

.seed-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2600 !important;
    isolation: isolate;
}

.seed-modal-card {
    position: relative;
    z-index: 1;
}
