/* =====================================================================
   Staff workspace pass — task list, triage, detail, catch-up, requests.
   Density decision (design-system/gulf-advisors/pages/staff-workspace.md):
   14–15px text, 600 titles at 16px, metadata demoted to muted 13px,
   red only for things that are actually late. Loaded after system.css.
   ===================================================================== */

/* Landing greeting: one quiet line, not a banner */
.landing-welcome {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-3);
}

.landing-welcome__greeting,
.landing-welcome__back {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 450;
    letter-spacing: 0;
    color: var(--text-3);
}

.landing-welcome__greeting {
    color: var(--text-2);
    font-weight: 500;
}

/* Attention chips: segmented filters with counts */
.task-attention {
    gap: 6px;
    margin-bottom: var(--space-4);
}

.task-attention__chip {
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-full);
    background: var(--paper);
    color: var(--text-2);
    font-size: var(--text-sm);
    font-weight: 450;
    transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.task-attention__chip:hover,
.task-attention__chip:focus-visible {
    border-color: var(--rule-strong);
    color: var(--text);
    background: var(--paper-2);
}

.task-attention__chip.is-active {
    border-color: var(--ink-800);
    background: var(--ink-800);
    color: var(--on-ink);
}

.task-attention__chip.is-active .task-attention__count {
    color: var(--on-ink);
}

.task-attention__chip--alert:not(.is-active) {
    border-color: var(--rule);
}

.task-attention__chip--alert:not(.is-active) .task-attention__count {
    color: var(--rose-600);
}

.task-attention__count {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.task-attention__note {
    margin: calc(-1 * var(--space-2)) 0 var(--space-4);
    font-size: var(--text-xs);
    color: var(--text-3);
}

/* Scope tabs */
.task-scope-nav {
    gap: var(--space-5);
    border-bottom: 1px solid var(--rule);
}

.task-scope-nav__link {
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    color: var(--text-3);
    font-size: var(--text-base);
    font-weight: 500;
}

.task-scope-nav__link:hover {
    color: var(--text);
}

.task-scope-nav__link.is-active,
.task-scope-nav__link[aria-current="page"] {
    color: var(--text);
    border-bottom-color: var(--sun-500);
}

.task-filter-summary {
    font-size: var(--text-sm);
    color: var(--text-2);
}

.task-filter-summary__dim {
    font-size: var(--text-xs);
    font-weight: 450;
}

/* A filter you set: a chip with an x that removes just that filter. */
.task-filter-summary__item--set {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 2px 4px 2px 10px;
    border-radius: 999px;
    background: var(--paper-2);
    color: var(--text);
}

.task-filter-summary__remove {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: var(--text-2);
    text-decoration: none;
    line-height: 1;
}

.task-filter-summary__remove:hover,
.task-filter-summary__remove:focus-visible {
    background: var(--rule);
    color: var(--text);
}

.task-filter-summary__count {
    margin-left: auto;
    color: var(--text-2);
}

/* How many "More filters" are in use, on the button. */
.task-filters-panel__count {
    display: inline-grid;
    place-items: center;
    min-width: 1.25rem;
    height: 1.25rem;
    margin-left: 0.25rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--sun-500);
    color: var(--ink-900);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* Apply clicked: the list fades until the filtered page arrives. */
.task-row-list.is-loading {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity var(--dur-fast) var(--ease);
}

/* Toolbar: one control height */
.task-toolbar {
    gap: var(--space-2);
    align-items: flex-end;
}

.task-toolbar .filter-field label {
    font-size: var(--text-xs);
}

.task-toolbar__company select,
.task-toolbar select,
.task-toolbar input,
.task-toolbar__clear-company,
.task-toolbar__control,
.task-toolbar .btn {
    min-height: var(--control-h);
    height: var(--control-h);
    font-size: var(--text-base);
}

.task-filters-panel__body {
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-4);
}

/* Rows */
.task-row-list {
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.task-row {
    padding: 14px 18px 14px 16px;
    border-bottom: 1px solid var(--rule);
    border-left: 2px solid transparent;
    transition: background-color var(--dur-fast) var(--ease);
}

.task-row:hover {
    background: var(--paper-2);
}

.task-row--critical,
.task-row--overdue {
    border-left-color: var(--rose-500);
}

.task-row--warning {
    border-left-color: var(--amber-500);
}

.task-row.is-selected {
    background: var(--sun-50);
    border-left-color: var(--sun-500);
    box-shadow: none;
}

.task-row__title {
    font-size: var(--text-md);
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.task-row__link:hover,
.task-row__link:focus-visible {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--sun-500);
    text-underline-offset: 3px;
}

.task-row__identity {
    gap: 2px var(--space-4);
    margin-top: 2px;
    font-size: var(--text-sm);
    color: var(--text-3);
}

.task-row__identity a {
    color: var(--text-2);
    text-decoration: none;
}

.task-row__identity a:hover {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--sun-500);
}

.task-row__handling {
    font-weight: 500;
    color: var(--text-2);
}

.task-row__owner-name--unassigned {
    color: var(--amber-700);
    font-weight: 500;
}

.task-row__briefing {
    gap: var(--space-2) var(--space-6);
    margin-top: var(--space-3);
}

.task-row__eyebrow {
    margin-bottom: 2px;
    font-size: var(--text-xs);
    color: var(--text-3);
}

.task-row__update-body,
.task-row__next-body,
.task-row__empty {
    font-size: var(--text-base);
    line-height: 1.5;
}

.task-row__empty {
    color: var(--text-3);
}

.task-row__update-meta {
    margin-top: 2px;
    font-size: var(--text-xs);
    color: var(--text-3);
}

.task-row__meta {
    gap: 4px var(--space-3);
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-3);
    align-items: center;
}

.task-row__timing--urgent {
    color: var(--rose-600);
    font-weight: 500;
}

.task-row__admin {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
}

.task-row__admin summary {
    font-weight: 450;
    color: var(--text-3);
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.task-row__admin summary::-webkit-details-marker {
    display: none;
}

.task-row__admin summary::before {
    content: "+";
    display: inline-block;
    width: 12px;
    font-family: var(--font-mono);
}

.task-row__admin[open] summary::before {
    content: "−";
}

.task-composer {
    margin-top: var(--space-3);
}

.task-composer__open {
    min-height: var(--control-h-sm);
    height: var(--control-h-sm);
}

.task-composer textarea {
    font-size: var(--text-base);
    min-height: 5.5rem;
}

/* Mentions render as quiet ink chips, not bold blue */
.task-mention,
.task-text .task-mention {
    padding: 0 4px;
    border-radius: var(--radius-xs);
    background: var(--sun-50);
    box-shadow: inset 0 0 0 1px var(--sun-200);
    color: var(--ink-900);
    font-weight: 500;
}

/* Drawer beside the list */
.task-drawer {
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: drawer-in var(--dur-slow) var(--ease) both;
}

.task-drawer__toolbar {
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
}

@keyframes drawer-in {
    from {
        opacity: 0;
        transform: translateX(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Sticky save bar on task detail */
.task-save-bar {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 0;
}

@media (max-width: 768px) {
    .task-row {
        padding: 12px 14px;
    }

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

    .task-attention {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-left: calc(-1 * var(--space-4));
        margin-right: calc(-1 * var(--space-4));
        padding: 0 var(--space-4) 2px;
        scrollbar-width: none;
    }

    .task-attention__chip {
        flex-shrink: 0;
    }
}

/* ---------------------------------------------------------------------
   Case file layout (service request detail; reusable for other records)
   --------------------------------------------------------------------- */

.page-header .page-eyebrow .mono {
    color: var(--text-2);
}

.case-stages {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--rule);
}

.case-stages .section-title {
    flex-wrap: wrap;
}

.case-stages .section-title .form-hint {
    margin: 0;
}

.stage-rail--nav .stage-rail__step {
    padding-top: 0;
}

.stage-rail--nav .stage-rail__step::before {
    top: 6px;
}

.stage-rail__link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 var(--space-2) 0 -8px;
    padding: 22px 8px 8px;
    border-radius: var(--radius-md);
    color: inherit;
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease);
}

.stage-rail__link:hover {
    background: var(--paper-2);
    color: var(--text);
}

.stage-rail__step.is-selected .stage-rail__link {
    background: var(--paper-2);
    box-shadow: inset 0 0 0 1px var(--rule);
    color: var(--text);
}

.stage-rail__step.is-selected .stage-rail__name {
    font-weight: 600;
}

.stage-rail--nav .stage-rail__step:not(.is-done):not(.is-current)::after {
    background: var(--paper);
}

.case-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(17rem, 22rem);
    gap: var(--space-7);
    align-items: start;
}

.case-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-7);
    min-width: 0;
}

.case-section__title {
    margin: 0 0 2px;
    font-size: var(--text-lg);
    font-weight: 600;
}

.case-stage-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.case-stage-head .form-hint {
    margin: 0;
}

.case-inline-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--paper-2);
    border: 1px solid var(--rule);
}

.case-inline-form .form-field {
    margin-bottom: var(--space-3);
}

.case-inline-form__wide {
    grid-column: 1 / -1;
}

.case-inline-form__wide textarea {
    min-height: 3.5rem;
    height: 4.5rem;
}

.case-inline-form__actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

/* Document review list */

.doc-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.doc-item {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--rule);
}

.doc-item:last-child {
    border-bottom: 0;
}

.doc-item__head {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: var(--space-3);
    align-items: start;
}

.doc-item__state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--well);
    box-shadow: inset 0 0 0 1px var(--rule);
    color: var(--text-3);
}

.doc-item__state .icon {
    width: 16px;
    height: 16px;
}

.doc-item.is-accepted .doc-item__state {
    background: var(--leaf-50);
    box-shadow: inset 0 0 0 1px var(--leaf-200);
    color: var(--leaf-700);
}

.doc-item.is-correction .doc-item__state {
    background: var(--rose-50);
    box-shadow: inset 0 0 0 1px var(--rose-200);
    color: var(--rose-600);
}

.doc-item.is-pending .doc-item__state {
    background: var(--amber-50);
    box-shadow: inset 0 0 0 1px var(--amber-200);
    color: var(--amber-700);
}

.doc-item__title h3 {
    margin: 4px 0 0;
    font-size: var(--text-base);
    font-weight: 600;
}

.doc-item__title .form-hint {
    margin: 2px 0 0;
}

.doc-item__guidance,
.doc-item__file,
.doc-item__checks,
.doc-item__actions,
.doc-item__foot,
.doc-item__missing {
    margin-left: calc(32px + var(--space-3));
}

.doc-item__guidance {
    margin-top: var(--space-2);
}

.doc-item__file {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px var(--space-2);
    margin-top: var(--space-3);
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--paper-2);
    box-shadow: inset 0 0 0 1px var(--rule);
    font-size: var(--text-sm);
}

.doc-item__file .icon {
    width: 15px;
    height: 15px;
    color: var(--text-3);
}

.doc-item__file a {
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.doc-item__file a:hover {
    text-decoration: underline;
    text-decoration-color: var(--sun-500);
}

.doc-item__file .form-hint {
    margin: 0;
}

.doc-item__checks {
    margin-top: var(--space-3);
}

.doc-item__checks .form-hint {
    margin-top: 4px;
}

.doc-item__review {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px var(--space-2);
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-2);
}

.doc-item__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.doc-review-form {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: end;
}

.doc-review-form .form-field {
    margin: 0;
}

.doc-review-form label {
    font-size: var(--text-xs);
    color: var(--text-3);
}

.doc-review-form textarea {
    min-height: var(--control-h);
    height: var(--control-h);
    padding-top: 7px;
    resize: vertical;
}

.doc-check-form {
    margin: 0;
}

.doc-check-findings {
    margin: 6px 0 0;
    padding-left: 1.1rem;
    font-size: var(--text-sm);
    color: var(--amber-700);
}

.doc-item__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--rule-strong);
}

.doc-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.doc-item__more summary,
.case-add summary {
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-3);
}

.doc-item__more[open] {
    flex-basis: 100%;
}

.doc-item__more form {
    margin-top: var(--space-2);
}

.doc-removed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-2);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    background: var(--paper-2);
    border: 1px dashed var(--rule-strong);
}

.doc-removed .form-hint,
.doc-removed form {
    margin: 0;
}

.case-add {
    margin-top: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius-lg);
}

.case-add summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--text-2);
    list-style: none;
}

.case-add summary::-webkit-details-marker {
    display: none;
}

.case-add summary .icon {
    width: 16px;
    height: 16px;
}

.case-add[open] summary {
    margin-bottom: var(--space-3);
}

.case-add__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--space-3);
}

/* Aside cards */

.case-aside {
    position: sticky;
    top: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
}

.aside-card {
    padding: var(--space-4);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    background: var(--paper);
}

.aside-card__title {
    margin: 0 0 var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
}

.aside-card .form-hint {
    margin-top: var(--space-2);
}

.aside-card textarea {
    font-size: var(--text-sm);
}

.aside-card .btn {
    margin-top: var(--space-2);
}

.aside-card__quote {
    margin: 0 0 var(--space-3);
    padding-left: var(--space-3);
    border-left: 2px solid var(--sun-400);
    font-size: var(--text-base);
}

.kv {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.kv > div {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: var(--space-3);
    padding: 7px 0;
    border-bottom: 1px solid var(--rule);
    font-size: var(--text-sm);
}

.kv > div:last-child {
    border-bottom: 0;
}

.kv dt {
    color: var(--text-3);
}

.kv dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.aside-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
}

.aside-list li {
    display: flex;
    flex-direction: column;
    padding: 6px 0;
    border-bottom: 1px solid var(--rule);
}

.aside-list li .form-hint {
    margin: 0;
}

.timeline {
    position: relative;
    margin: 0;
    padding: 0 0 0 16px;
    list-style: none;
    max-height: 22rem;
    overflow-y: auto;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--rule-strong);
}

.timeline li {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 0 var(--space-3);
    font-size: var(--text-sm);
}

.timeline li::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--paper);
    box-shadow: inset 0 0 0 1.5px var(--ink-400);
}

.timeline li:first-child::before {
    background: var(--sun-500);
    box-shadow: 0 0 0 3px var(--sun-100);
}

.timeline__when {
    font-size: var(--text-xs);
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.timeline__what {
    color: var(--text-2);
    overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
    .case-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .case-aside {
        position: static;
    }
}

@media (max-width: 768px) {
    .stage-rail--nav {
        grid-auto-flow: row;
    }

    .stage-rail--nav .stage-rail__step {
        padding: 0 0 0 20px;
    }

    .stage-rail--nav .stage-rail__step::before {
        top: 14px;
        bottom: -14px;
        left: 5px;
        right: auto;
        width: 2px;
        height: auto;
    }

    .stage-rail--nav .stage-rail__step:last-child::before {
        display: none;
    }

    .stage-rail--nav .stage-rail__step::after {
        top: 12px;
    }

    .stage-rail__link {
        padding: 8px;
        margin: 0;
    }

    .case-inline-form,
    .case-add__grid,
    .doc-review-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-item {
        padding: var(--space-4);
    }

    .doc-item__guidance,
    .doc-item__file,
    .doc-item__checks,
    .doc-item__actions,
    .doc-item__foot,
    .doc-item__missing {
        margin-left: 0;
    }
}

/* ---------------------------------------------------------------------
   Business proposal editor — a sheet you are composing, with the
   package tools and the running total beside it.
   --------------------------------------------------------------------- */

.proposal-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: var(--space-5);
    align-items: start;
}

.proposal-sheet {
    min-width: 0;
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    background: var(--paper);
    overflow: hidden;
}

.proposal-sheet__head {
    padding: var(--space-5) var(--space-6);
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
}

.proposal-fields {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 0 var(--space-4);
}

.proposal-fields .form-field {
    margin-bottom: var(--space-3);
}

.proposal-fields__title,
.proposal-fields__note {
    grid-column: 1 / -1;
}

.proposal-fields__title input {
    font-size: var(--text-md);
    font-weight: 500;
}

.proposal-sheet__lines {
    padding: var(--space-5) var(--space-6) var(--space-6);
}

/* Only the line table scrolls sideways. The scroller is the containing
   block, so the hidden "Actions" header label (position: absolute) stays
   inside it instead of widening the whole page. */
.proposal-sheet__lines .table-scroll {
    position: relative;
}

.line-editor {
    width: 100%;
    min-width: 56rem;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-base);
}

/* Fixed widths for everything except Description, which takes the rest
   and is always the widest column. */
.line-col-index { width: 2.25rem; }
.line-col-sku { width: 7.5rem; }
.line-col-qty { width: 4.5rem; }
.line-col-price { width: 7.5rem; }
.line-col-included { width: 5.5rem; }
.line-col-amount { width: 7.5rem; }
.line-col-actions { width: 6.5rem; }

.line-editor th {
    padding: 0 6px 8px;
    border-bottom: 1px solid var(--rule);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-3);
    white-space: nowrap;
}

.line-editor td {
    padding: 6px;
    border-bottom: 1px solid var(--rule);
    vertical-align: middle;
}

.line-editor tbody td:first-child {
    width: 2rem;
    color: var(--text-3);
    font-variant-numeric: tabular-nums;
}

.line-editor input[type="text"],
.line-editor input[type="number"] {
    width: 100%;
    min-height: 34px;
    padding: 0 8px;
    border-color: var(--rule);
    background: var(--paper);
    box-shadow: none;
}

.line-editor input[type="text"]:hover,
.line-editor input[type="number"]:hover {
    border-color: var(--rule-strong);
}

.line-editor input:focus {
    background: var(--paper);
    border-color: var(--sun-600);
}

.line-editor input:disabled {
    background: transparent;
    color: var(--text-3);
    text-decoration: line-through;
}

.line-editor .line-sku {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.line-editor .line-actions .btn {
    width: 24px;
}

.line-editor .line-qty,
.line-editor .line-price {
    text-align: right;
}

.line-editor .line-amount,
.line-editor .line-total td {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.line-editor .line-actions {
    white-space: nowrap;
}

.line-editor .line-actions .btn {
    width: 28px;
    padding: 0;
    color: var(--text-3);
}

.line-editor tbody tr:hover td {
    background: var(--paper-2);
}

.line-editor .line-total td {
    padding-top: var(--space-3);
    font-weight: 600;
    font-size: var(--text-md);
}

.line-editor tr.line-total:hover td {
    background: transparent;
}

/* Total Amount plus the subsection lines, always the last row. */
.line-editor tr.line-final td {
    border-top: 2px solid var(--rule-strong);
}

/* A subsection heading: extra costs listed below the total. */
.line-editor tr.line-section td {
    padding-top: var(--space-4);
    background: var(--paper-2);
}

.line-editor .line-section-title {
    font-weight: 600;
}

.line-editor .line-section-note {
    font-size: var(--text-xs);
    color: var(--text-3);
}

.proposal-add-line {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.proposal-add-line [hidden] {
    display: none;
}

.proposal-add-line + .form-hint {
    margin-top: var(--space-2);
}

.proposal-aside {
    position: sticky;
    top: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.proposal-aside .form-field {
    margin-bottom: var(--space-2);
}

.proposal-paste {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--rule);
}

.proposal-paste summary {
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--text-2);
}

#paste-text {
    width: 100%;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    margin: var(--space-2) 0;
}

.proposal-total {
    background: var(--ink-900);
    border-color: var(--ink-900);
    color: var(--on-ink-2);
}

.proposal-total .form-hint {
    color: var(--on-ink-3);
}

.proposal-total__label {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--on-ink-3);
}

.proposal-total__value {
    margin: 2px 0 var(--space-2);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--on-ink);
    font-variant-numeric: tabular-nums;
}

.proposal-total__cur {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--sun-400);
    letter-spacing: 0.04em;
    vertical-align: 0.6em;
}

.proposal-total .btn--primary {
    margin-top: var(--space-3);
    height: var(--control-h-lg);
    background: var(--sun-500);
    border-color: var(--sun-500);
    color: var(--ink-950);
    font-weight: 600;
}

.proposal-total .btn--primary:hover {
    background: var(--sun-400);
    border-color: var(--sun-400);
    color: var(--ink-950);
}

.proposal-total .btn.is-busy {
    --btn-spinner: var(--ink-950);
}

@media (max-width: 1360px) {
    .proposal-editor {
        grid-template-columns: minmax(0, 1fr);
    }

    .proposal-aside {
        position: static;
    }
}

@media (max-width: 640px) {
    .proposal-sheet__head,
    .proposal-sheet__lines {
        padding: var(--space-4);
    }

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

/* ---------------------------------------------------------------------
   List pages: inline filter bars and the service request table
   --------------------------------------------------------------------- */

.editor-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2) var(--space-3);
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    background: var(--paper-2);
}

.editor-tools .form-field {
    flex: 0 1 12rem;
    margin: 0;
}

.editor-tools .form-field:first-child {
    flex: 1 1 16rem;
}

.editor-tools label {
    font-size: var(--text-xs);
    color: var(--text-3);
    font-weight: 450;
}

.sr-drafts {
    margin-bottom: var(--space-4);
}

.sr-drafts .alert__title {
    font-size: var(--text-base);
    margin: 0 0 2px;
}

.sr-drafts__list {
    margin: var(--space-2) 0 0;
    padding-left: 1.1rem;
    font-size: var(--text-sm);
}

.sr-table__request a {
    font-weight: 600;
}

.sr-table__request {
    min-width: 18rem;
}

.sr-table__owner {
    white-space: nowrap;
}

.sr-table__owner .avatar {
    margin-right: 6px;
    vertical-align: -5px;
}

.sr-table__unassigned {
    color: var(--amber-700);
}

.sr-table__stage {
    min-width: 12rem;
}

.sr-table__stage-name {
    display: block;
}

.sr-track {
    display: flex;
    gap: 3px;
    margin-top: 6px;
}

.sr-track i {
    width: 14px;
    height: 4px;
    border-radius: 4px;
    background: var(--rule-solid);
}

.sr-track i.is-done {
    background: var(--ink-800);
}

.sr-track i.is-current {
    background: var(--sun-500);
}

.sr-track i.is-blocked {
    background: var(--amber-500);
}

.data-table td .badge + .cell-sub {
    margin-top: 4px;
}

/* Rename a task: a quiet button under the title that opens one field. */
.task-rename {
    margin: 2px 0 6px;
}

.task-rename > summary {
    list-style: none;
    width: fit-content;
}

.task-rename > summary::-webkit-details-marker {
    display: none;
}

.task-rename[open] > summary {
    display: none;
}

.task-rename__form {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.task-rename__form input[type="text"] {
    flex: 1 1 24rem;
    min-width: 0;
    height: var(--control-h-sm);
}

/* Issued copy page: checks and downloads side by side on wide screens (ADR-037). */
.issued-logs {
    display: grid;
    gap: var(--space-5);
    align-items: start;
}

@media (min-width: 72rem) {
    .issued-logs {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }
}
