:root {
    --blue: #2454e8;
    --blue-dark: #0f3fc4;
    --ink: #111827;
    --muted: #667085;
    --soft: #f5f7fb;
    --line: #e5e7eb;
    --panel: #ffffff;
    --chip: #eef3ff;
    --success: #16c784;
    --warning: #f97316;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: #fff;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

.admin-shell {
    display: grid;
    grid-template-columns: 222px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    border-right: 1px solid var(--line);
    background: #fff;
    padding: 26px 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 34px;
    font-weight: 700;
}

.brand-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: block;
    object-fit: cover;
}

.sidebar-section {
    margin: 22px 0 10px;
    color: #98a2b3;
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    color: #344054;
    font-size: 14px;
}

.nav-link::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #cfd5df;
}

.nav-link.active {
    color: #111827;
    font-weight: 700;
}

.nav-link.active::before {
    background: var(--blue);
}

.main {
    min-width: 0;
    background: #fff;
}

.topbar {
    height: 64px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    color: #98a2b3;
    font-size: 13px;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.top-icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    color: #111827;
}

.search-pill {
    width: 172px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: #f4f5f7;
    padding: 0 14px;
    color: #667085;
    outline: none;
}

.content {
    width: min(100%, 1040px);
    padding: 28px 32px 56px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-head.compact {
    margin-bottom: 16px;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.eyebrow {
    color: #667085;
    font-size: 12px;
    margin: 0;
}

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: 22px;
    line-height: 1.2;
}

h2 {
    font-size: 18px;
    line-height: 1.25;
}

h3 {
    font-size: 15px;
}

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

.admin-two-column {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .85fr);
    align-items: start;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

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

.metric {
    min-height: 88px;
    border-radius: 8px;
    background: #eef1ff;
    padding: 18px 20px;
}

.metric:nth-child(3) {
    background: #e8f3ff;
}

.metric-label {
    color: #1f2937;
    font-size: 12px;
    margin-bottom: 8px;
}

.metric-value {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    color: #061b64;
    font-size: 28px;
    font-weight: 800;
}

.metric-change {
    border-radius: 999px;
    background: #e7f8ef;
    color: #079455;
    font-size: 10px;
    padding: 4px 8px;
    line-height: 1;
}

.cta-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    padding: 28px 32px;
    margin: 20px 0;
}

.cta-band p {
    max-width: 560px;
    margin: 8px 0 0;
    color: rgba(255, 255, 255, .86);
    line-height: 1.55;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 12px 26px rgba(17, 24, 39, .04);
}

.panel.pad {
    padding: 24px;
}

.company-form-panel {
    max-width: 940px;
}

.form-intro {
    margin-bottom: 22px;
}

.form-intro p {
    margin: 4px 0 0;
    color: #667085;
    font-size: 12px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.panel-title a {
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0 18px;
    background: #fff;
    color: var(--blue);
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
}

.btn.primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 8px 18px rgba(36, 84, 232, .2);
}

.btn.primary:hover {
    background: var(--blue-dark);
}

.btn.is-loading,
button.is-loading,
.round-action.is-loading {
    pointer-events: none;
    opacity: .78;
}

.btn.is-loading::after,
button.is-loading::after {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: button-spin .75s linear infinite;
}

.round-action.is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-right-color: transparent;
    border-radius: 999px;
    animation: button-spin .75s linear infinite;
}

.round-action.is-loading::before {
    content: "";
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn.ghost {
    border-color: #d6def7;
    color: var(--blue);
}

.btn.soft {
    background: #eef3ff;
    color: var(--blue);
}

.btn.full {
    width: 100%;
}

.btn.danger {
    color: var(--danger);
    border-color: #f5d0d0;
}

.filter-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.companies-filter-row input[name="search"] {
    width: 260px;
}

.dashboard-companies-filter input[type="search"] {
    width: 300px;
}

.company-profile-hero {
    display: grid;
    justify-items: center;
    gap: 8px;
    min-height: 172px;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    padding: 28px 24px;
    margin-bottom: 24px;
    text-align: center;
}

.company-profile-avatar {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font-size: 18px;
    font-weight: 900;
}

.company-profile-hero h1 {
    margin-top: 6px;
    font-size: 18px;
}

.company-profile-hero p {
    margin: 0;
    color: rgba(255, 255, 255, .86);
}

.company-info-panel {
    margin-bottom: 24px;
}

.company-info-list {
    display: grid;
    margin-top: 12px;
}

.company-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 34px;
    border-bottom: 1px solid var(--surface-border);
    color: var(--ink-soft);
}

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

.company-info-row span {
    color: var(--ink-soft);
    font-weight: 700;
}

.company-info-row strong {
    color: var(--ink);
    text-align: right;
}

.question-list-item {
    align-items: center;
}

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

.question-row-actions form {
    margin: 0;
}

.flush-panel-head {
    padding: 0 0 18px;
    margin-bottom: 18px;
    border-bottom-color: var(--surface-border);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f5f6f8;
    color: #475467;
    font-size: 11px;
    text-align: left;
    text-transform: uppercase;
    padding: 14px 22px;
}

td {
    border-top: 1px solid var(--line);
    padding: 16px 22px;
    vertical-align: middle;
}

.identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.initials {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: #e2ebff;
    color: var(--blue);
    font-weight: 800;
    font-size: 12px;
    flex: 0 0 34px;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    background: #edf2f7;
    color: #667085;
}

.status.active,
.status.generated {
    background: #dffbea;
    color: #079455;
}

.status.pending,
.status.draft {
    background: #fff4e5;
    color: #f97316;
}

.status.inactive,
.status.blocked,
.status.stopped,
.status.expired {
    background: #fee2e2;
    color: var(--danger);
}

.progress {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 160px;
}

.progress-track {
    height: 8px;
    flex: 1;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--blue);
}

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

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

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

.field label {
    font-size: 12px;
    font-weight: 800;
    color: #1f2937;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfd7e6;
    border-radius: 7px;
    background: #f9fafc;
    color: #111827;
    padding: 12px 14px;
    outline: none;
    font: inherit;
}

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

.tall-textarea {
    min-height: 210px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(36, 84, 232, .12);
}

.upload-box {
    min-height: 132px;
    display: grid;
    place-items: center;
    text-align: center;
    border: 2px dashed #cfd7e6;
    border-radius: 8px;
    background: #fbfcff;
    color: #667085;
    padding: 18px;
}

.upload-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin: 0 auto 8px;
    border: 2px solid #798198;
    border-radius: 999px;
    color: #798198;
    font-size: 22px;
    line-height: 1;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.switch {
    position: relative;
    width: 38px;
    height: 20px;
}

.switch input {
    position: absolute;
    opacity: 0;
}

.slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #d0d5dd;
    cursor: pointer;
}

.slider::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 2px;
    left: 2px;
    border-radius: 999px;
    background: #fff;
    transition: transform .16s ease;
}

.switch input:checked + .slider {
    background: var(--blue);
}

.switch input:checked + .slider::after {
    transform: translateX(18px);
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.chip-radio {
    position: relative;
}

.chip-radio input {
    position: absolute;
    opacity: 0;
}

.chip-radio span {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    border-radius: 999px;
    padding: 0 18px;
    background: var(--chip);
    color: var(--blue);
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}

.chip-radio input:checked + span {
    background: var(--blue);
    color: #fff;
}

.empty-label {
    visibility: hidden;
}

.list-stack {
    display: grid;
    gap: 12px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    padding: 16px 18px;
    background: #fff;
}

.list-item p {
    margin: 6px 0 0;
    color: #667085;
    line-height: 1.45;
}

.answer-review-item {
    align-items: flex-start;
}

.answer-grid {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.answer-chip {
    border: 1px solid #edf0f5;
    border-radius: 8px;
    background: #f9fafc;
    padding: 10px 12px;
}

.answer-chip span {
    display: block;
    color: #667085;
    font-size: 11px;
    line-height: 1.4;
}

.answer-chip strong {
    display: block;
    margin-top: 4px;
    color: #111827;
    font-size: 13px;
}

.subtle {
    color: #667085;
    font-size: 12px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-weight: 700;
}

.alert.success {
    background: #e9fbf1;
    color: #047857;
}

.alert.error {
    background: #fef2f2;
    color: #b42318;
}

.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    padding: 18px 22px;
}

.pagination a,
.pagination span {
    min-width: 32px;
    min-height: 32px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #d0d5dd;
    border-radius: 7px;
    color: #344054;
    font-size: 12px;
}

.pagination .active span,
.pagination span[aria-current="page"] {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

.empty-state {
    padding: 34px 22px;
    color: #667085;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.task-builder-page {
    width: min(100%, 760px);
}

.task-builder-header {
    margin-bottom: 22px;
}

.task-builder-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.task-back-link {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    color: var(--blue);
    font-size: 20px;
    line-height: 1;
}

.task-back-link:hover {
    background: var(--chip);
}

.task-builder-title-row h1 {
    font-size: 20px;
}

.task-builder-title-row .eyebrow {
    margin-top: 4px;
}

.task-builder-form {
    display: grid;
    gap: 24px;
}

.task-builder-section {
    display: grid;
    gap: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 16px;
}

.task-builder-section h2 {
    font-size: 14px;
}

.task-detail-fields {
    display: grid;
    gap: 10px;
}

.task-detail-fields input,
.task-detail-fields textarea {
    border-color: var(--surface-border);
    background: var(--surface-alt);
}

.task-detail-fields input {
    min-height: 44px;
}

.task-detail-fields textarea {
    min-height: 76px;
}

.task-type-block {
    display: grid;
    gap: 12px;
}

.task-type-chips {
    gap: 10px;
}

.task-type-chip span {
    min-width: 88px;
    min-height: 38px;
    justify-content: center;
    padding: 0 22px;
}

.task-type-chip input:focus-visible + span {
    outline: 3px solid rgba(36, 84, 232, .16);
    outline-offset: 2px;
}

.task-upload-box {
    min-height: 78px;
    display: grid;
    place-items: center;
    text-align: center;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-alt);
    color: var(--ink);
    cursor: pointer;
    padding: 16px;
}

.task-upload-box strong,
.task-upload-box .subtle {
    display: block;
}

.task-upload-box strong {
    font-size: 12px;
    font-weight: 500;
}

.task-upload-box .subtle {
    margin-top: 4px;
    font-size: 12px;
}

.task-upload-box input {
    display: none;
}

.task-text-panel textarea {
    min-height: 118px;
    border-color: var(--surface-border);
    background: var(--surface-alt);
}

.task-duration-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.task-duration-row label {
    color: var(--ink);
    font-weight: 800;
}

.task-duration-input {
    width: 76px;
    min-height: 40px;
    border-radius: 999px;
    border-color: var(--surface-border);
    background: var(--surface-alt);
    text-align: center;
    font-weight: 800;
    padding: 0 12px;
}

.task-created-block {
    display: grid;
    gap: 10px;
}

.task-created-list {
    display: grid;
    gap: 10px;
}

.task-created-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--panel);
    padding: 12px;
}

.task-created-thumb {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--chip);
}

.task-created-thumb::after {
    content: "";
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background: var(--panel);
}

.task-created-copy {
    min-width: 0;
}

.task-created-copy h3,
.task-created-copy p {
    overflow-wrap: anywhere;
}

.task-created-copy h3 {
    font-size: 12px;
    line-height: 1.3;
}

.task-created-copy p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.task-builder-submit {
    width: 172px;
    min-height: 42px;
}

.tips-page,
.tips-create-page {
    max-width: 920px;
}

.round-action {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-size: 0;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(36, 84, 232, .22);
}

.round-action::before {
    content: "+";
    position: absolute;
    left: 50%;
    top: 50%;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    transform: translate(-50%, -54%);
}

.tips-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.tip-stat {
    min-height: 78px;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    background: #fff;
    padding: 16px 18px;
}

.tip-stat span:not(.stat-icon) {
    display: block;
    color: #667085;
    font-size: 12px;
}

.tip-stat strong {
    display: block;
    margin-top: 4px;
    color: #111827;
    font-size: 24px;
    line-height: 1;
}

.stat-icon {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    margin-bottom: 10px;
}

.stat-icon.blue {
    background: #e9f1ff;
}

.stat-icon.green {
    background: #e8fbef;
}

.stat-icon.red {
    background: #fff0f0;
}

.tips-search {
    margin-bottom: 14px;
}

.tips-search input {
    min-height: 44px;
    border-color: #edf0f5;
    background: #fff;
}

.tip-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.tip-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    border-radius: 999px;
    padding: 0 18px;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
}

.tip-tabs a.active {
    background: var(--blue);
    color: #fff;
}

.tip-list {
    display: grid;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.tip-card-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 18px;
    min-height: 128px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid #edf0f5;
}

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

.tip-copy h2 {
    margin: 8px 0 4px;
    font-size: 15px;
    line-height: 1.25;
}

.tip-copy p {
    max-width: 680px;
    margin: 0 0 6px;
    color: #667085;
    font-size: 12px;
    line-height: 1.45;
}

.tip-category {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    border-radius: 4px;
    padding: 0 7px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.tip-category.blue {
    background: #eaf1ff;
    color: var(--blue);
}

.tip-category.orange {
    background: #fff1e7;
    color: #ea580c;
}

.tip-category.green {
    background: #e8fbef;
    color: #079455;
}

.tip-category.violet {
    background: #f2edff;
    color: #6941c6;
}

.tip-side {
    display: grid;
    justify-items: end;
    align-content: space-between;
    gap: 10px;
    text-align: right;
}

.tip-state {
    color: #667085;
    font-size: 10px;
    font-weight: 900;
}

.tip-state.active {
    color: #12a153;
}

.tip-state.inactive {
    color: var(--danger);
}

.tip-row-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 28px;
}

.tip-row-actions form {
    display: grid;
    justify-items: center;
    gap: 3px;
    margin: 0;
}

.tip-row-actions small {
    color: var(--blue);
    font-size: 9px;
    font-weight: 900;
}

.switch-button {
    position: relative;
    width: 36px;
    height: 20px;
    border: 0;
    border-radius: 999px;
    background: #d0d5dd;
    padding: 0;
    cursor: pointer;
}

.switch-button span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    transition: transform .16s ease;
}

.switch-button.on {
    background: var(--blue);
}

.switch-button.on span {
    transform: translateX(16px);
}

.text-danger {
    border: 0;
    background: transparent;
    color: var(--danger);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.list-footnote {
    padding: 14px 0 0;
    color: #667085;
    font-size: 11px;
    text-align: center;
}

.tip-create-form {
    display: grid;
    gap: 22px;
    max-width: 760px;
}

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

.form-section h2 {
    font-size: 15px;
}

.field-note {
    color: #98a2b3;
    font-size: 11px;
}

.code-box {
    max-height: 180px;
    overflow: auto;
    border: 1px solid #edf0f5;
    border-radius: 8px;
    background: #f8fafc;
    color: #344054;
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #f7f9fc;
    padding: 24px;
}

.login-card {
    width: min(100%, 430px);
}

:root {
    --ink-soft: #344054;
    --page: #ffffff;
    --sidebar-bg: #ffffff;
    --topbar-bg: #ffffff;
    --field-bg: #f9fafc;
    --field-pill: #f4f5f7;
    --field-border: #cfd7e6;
    --surface-alt: #f9fafc;
    --surface-border: #edf0f5;
    --table-head: #f5f6f8;
}

:root[data-theme="dark"] {
    --blue: #7ea2ff;
    --blue-dark: #93b2ff;
    --ink: #f4f7fb;
    --ink-soft: #d0d8e6;
    --muted: #94a3b8;
    --soft: #101725;
    --line: #253149;
    --panel: #111827;
    --page: #0b1220;
    --sidebar-bg: #0f172a;
    --topbar-bg: #0b1220;
    --field-bg: #162033;
    --field-pill: #162033;
    --field-border: #334155;
    --surface-alt: #111b2d;
    --surface-border: #263246;
    --table-head: #182235;
    --chip: #1b2950;
}

body {
    background: var(--page);
}

.sidebar {
    background: var(--sidebar-bg);
}

.sidebar-section,
.topbar,
.eyebrow,
.form-intro p,
.list-item p,
.answer-chip span,
.subtle,
.empty-state,
.tip-stat span:not(.stat-icon),
.tip-copy p,
.tip-tabs a,
.tip-state,
.list-footnote,
.field-note {
    color: var(--muted);
}

.nav-link,
.pagination a,
.pagination span,
.code-box {
    color: var(--ink-soft);
}

.nav-link.active,
.field label,
.answer-chip strong {
    color: var(--ink);
}

.main,
.topbar {
    background: var(--topbar-bg);
}

.topbar-left {
    min-width: 84px;
}

.topbar-search {
    margin: 0;
}

.top-icon svg,
.theme-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.top-icon svg rect,
.theme-icon-sun circle {
    fill: none;
}

.search-pill {
    width: 220px;
    height: 36px;
    border: 1px solid var(--field-border);
    background: var(--field-pill);
    color: var(--ink-soft);
}

.search-pill::placeholder {
    color: var(--muted);
}

.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--field-border);
    border-radius: 999px;
    background: var(--field-pill);
    color: var(--ink);
    padding: 0;
    cursor: pointer;
}

.theme-toggle .theme-icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-moon {
    display: block;
}

.metric {
    background: var(--chip);
}

.metric:nth-child(3) {
    background: color-mix(in srgb, var(--chip) 70%, var(--panel));
}

.panel,
.list-item,
.tip-stat,
.tip-list,
.tips-search input {
    background: var(--panel);
}

th {
    background: var(--table-head);
    color: var(--ink-soft);
}

.initials {
    background: var(--chip);
}

.status {
    background: var(--surface-alt);
    color: var(--muted);
}

.progress-track {
    background: var(--line);
}

input,
select,
textarea {
    border-color: var(--field-border);
    background: var(--field-bg);
    color: var(--ink);
}

.upload-box {
    border-color: var(--field-border);
    background: var(--surface-alt);
    color: var(--muted);
}

.list-item,
.answer-chip,
.tip-stat,
.tip-list,
.tip-card-row,
.code-box {
    border-color: var(--surface-border);
}

.answer-chip,
.code-box {
    background: var(--surface-alt);
}

.btn {
    background: var(--panel);
}

.btn.ghost {
    border-color: var(--field-border);
}

:root[data-theme="dark"] .btn.primary {
    background: #3b82f6;
    color: #f8fbff;
    box-shadow: 0 8px 18px rgba(59, 130, 246, .22);
}

:root[data-theme="dark"] .btn.soft {
    background: #172554;
}

:root[data-theme="dark"] .text-danger {
    color: #fda4af;
}

.audit-log-page {
    display: grid;
    gap: 18px;
}

.audit-log-stat-grid {
    margin-bottom: 0;
}

.audit-log-stat {
    min-height: 92px;
}

.audit-log-filter-panel {
    display: grid;
    gap: 18px;
}

.audit-log-filter-head,
.audit-log-results-head,
.audit-log-card-head,
.audit-log-chip-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.audit-log-filter-head p,
.audit-log-results-head p {
    margin: 6px 0 0;
}

.audit-log-filter-form {
    align-items: end;
}

.audit-log-filter-actions {
    align-items: flex-end;
}

.audit-log-list {
    display: grid;
    gap: 16px;
}

.audit-log-card {
    display: grid;
    gap: 16px;
}

.audit-log-identity {
    align-items: flex-start;
}

.audit-log-subline {
    display: block;
    margin-top: 4px;
}

.audit-log-chip-row {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.audit-log-module {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border: 1px solid var(--field-border);
    border-radius: 999px;
    padding: 0 10px;
    background: var(--field-pill);
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.audit-log-description {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    line-height: 1.6;
}

.audit-log-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.audit-log-meta-item {
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-alt);
    padding: 12px 14px;
}

.audit-log-meta-item strong {
    display: block;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.5;
}

.audit-log-meta-item-wide strong {
    word-break: break-word;
}

.audit-log-meta-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.audit-log-payload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.audit-log-payload {
    display: grid;
    gap: 8px;
}

.audit-log-payload-title {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

body.modal-open {
    overflow: hidden;
}

.detail-hero {
    display: grid;
    gap: 20px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--surface-border);
}

.detail-hero-main,
.detail-hero-actions,
.detail-hero-subtitle,
.modal-head,
.modal-actions {
    display: flex;
    gap: 12px;
}

.detail-hero-main,
.modal-head,
.modal-actions {
    align-items: flex-start;
    justify-content: space-between;
}

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

.detail-hero-subtitle {
    flex-wrap: wrap;
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
}

.detail-hero-subtitle span {
    position: relative;
    padding-left: 14px;
}

.detail-hero-subtitle span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: var(--muted);
}

.detail-hero-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-hero-grid,
.detail-hero-meta,
.detail-summary-grid {
    display: grid;
    gap: 14px;
}

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

.detail-hero-meta,
.detail-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-hero-card,
.detail-meta-item,
.detail-summary-item,
.detail-access-note {
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    background: var(--surface-alt);
}

.detail-hero-card {
    display: grid;
    gap: 8px;
    min-height: 110px;
    padding: 18px;
}

.detail-hero-card span,
.detail-meta-item span,
.detail-summary-item span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-hero-card strong {
    color: var(--ink);
    font-size: 20px;
    line-height: 1.3;
}

.detail-hero-card p,
.detail-access-note p {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.6;
}

.detail-meta-item,
.detail-summary-item {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
}

.detail-meta-item strong,
.detail-summary-item strong,
.detail-access-note strong {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

.detail-access-note {
    display: grid;
    gap: 8px;
    padding: 16px 18px;
    margin-top: 18px;
}

.detail-access-note span {
    color: var(--ink);
    font-weight: 700;
}

.detail-toggle-card {
    min-height: 46px;
    border: 1px solid var(--field-border);
    border-radius: 7px;
    background: var(--field-bg);
    padding: 0 14px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.52);
}

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

.modal-card {
    width: min(100%, 720px);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--surface-border);
}

.modal-head {
    margin-bottom: 18px;
}

.modal-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--field-border);
    border-radius: 999px;
    background: var(--field-pill);
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 6px;
}

@media (max-width: 900px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 18px 20px;
    }

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

    .topbar {
        height: auto;
        min-height: 64px;
        gap: 12px;
        flex-wrap: wrap;
        padding: 0 20px;
        padding-top: 14px;
        padding-bottom: 14px;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .topbar-search {
        flex: 1 1 220px;
    }

    .search-pill {
        width: 100%;
    }

    .content {
        padding: 24px 20px 42px;
    }

    .metric-grid,
    .tips-stat-grid,
    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .metric-grid.compact-metrics,
    .admin-two-column,
    .detail-hero-grid,
    .detail-hero-meta,
    .detail-summary-grid {
        grid-template-columns: 1fr;
    }

    .audit-log-meta,
    .audit-log-payload-grid {
        grid-template-columns: 1fr;
    }

    .page-head,
    .cta-band,
    .panel-head,
    .detail-hero-main,
    .modal-head,
    .modal-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .filter-row,
    .companies-filter-row input[name="search"],
    .dashboard-companies-filter input[type="search"],
    .filter-row select,
    .filter-row .btn {
        width: 100%;
    }

    .audit-log-filter-head,
    .audit-log-results-head,
    .audit-log-card-head {
        flex-direction: column;
    }

    .audit-log-chip-row {
        justify-content: flex-start;
    }

    .task-builder-page,
    .task-builder-submit {
        width: 100%;
    }

    .task-builder-section {
        padding: 14px;
    }

    .task-type-chip span {
        min-width: 82px;
    }

    .tip-card-row {
        grid-template-columns: 1fr;
    }

    .tip-side {
        justify-items: start;
        text-align: left;
    }

    .tip-row-actions {
        justify-content: flex-start;
    }

    .tip-tabs {
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .detail-hero-actions {
        justify-content: flex-start;
    }

    .company-info-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        padding: 10px 0;
    }

    .company-info-row strong {
        text-align: left;
    }

    .question-row-actions {
        justify-content: flex-start;
    }

    .modal-backdrop {
        padding: 16px;
    }

    .modal-card {
        width: 100%;
        max-height: calc(100vh - 32px);
    }
}
