:root {
    --ink: #252422;
    --paper: #fffcf2;
    --accent: #eb5e28;
    --steel: #4f6d7a;
    --line: rgba(37, 36, 34, 0.14);
    --soft: #f5f0e5;
    --white: #fffef9;
    --green: #3f7d57;
    --red: #b64028;
    --shadow: 0 18px 55px rgba(37, 36, 34, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--paper);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(79, 109, 122, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(79, 109, 122, 0.06) 1px, transparent 1px),
        var(--paper);
    background-size: 44px 44px;
    font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
}

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

button {
    cursor: pointer;
}

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

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    border-right: 1px solid var(--line);
    background: rgba(255, 252, 242, 0.92);
    backdrop-filter: blur(18px);
}

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

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 20px;
    line-height: 1;
}

.brand small {
    margin-top: 5px;
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}

.nav {
    display: grid;
    gap: 8px;
    margin-top: 34px;
}

.nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 7px;
    color: rgba(37, 36, 34, 0.68);
    background: transparent;
    padding: 0 10px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav__item:hover,
.nav__item.is-active {
    color: var(--ink);
    background: rgba(79, 109, 122, 0.12);
}

.nav__item:hover {
    transform: translateX(2px);
}

.nav__mark {
    width: 9px;
    height: 9px;
    border: 1px solid currentColor;
    border-radius: 50%;
}

.nav__item.is-active .nav__mark {
    background: var(--accent);
    border-color: var(--accent);
}

.sidebar__note {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 22px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
    line-height: 1.45;
}

.label,
.eyebrow {
    margin: 0 0 7px;
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
}

.workspace {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    max-width: 820px;
    margin: 0;
    font-size: clamp(28px, 4vw, 54px);
    line-height: 0.96;
    letter-spacing: 0;
}

h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
    letter-spacing: 0;
}

h3 {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.topbar__metric {
    display: grid;
    gap: 5px;
    min-width: 178px;
    padding: 13px 15px;
    border-left: 4px solid var(--accent);
    background: rgba(255, 254, 249, 0.72);
}

.topbar__metric span,
.metric span,
.case-row__meta,
.muted,
.record__head span,
.data-row span {
    color: rgba(37, 36, 34, 0.62);
}

.topbar__metric strong {
    font-size: 28px;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: var(--line);
}

.metric {
    min-height: 86px;
    padding: 15px;
    background: rgba(255, 254, 249, 0.88);
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
}

.board {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.5fr) minmax(260px, 0.86fr);
    gap: 14px;
    align-items: start;
}

.panel,
.table-panel,
.form-surface {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 254, 249, 0.9);
    box-shadow: var(--shadow);
}

.panel {
    min-height: 642px;
    padding: 16px;
}

.panel__head,
.record__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
}

select,
input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--white);
    color: var(--ink);
    padding: 11px 12px;
    outline: none;
}

select {
    width: auto;
    min-width: 116px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--steel);
    box-shadow: 0 0 0 3px rgba(79, 109, 122, 0.14);
}

.search {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.search span,
label {
    color: rgba(37, 36, 34, 0.7);
    font-size: 13px;
}

.case-list {
    display: grid;
    gap: 9px;
    max-height: 520px;
    overflow: auto;
    padding-right: 2px;
}

.case-row {
    display: grid;
    gap: 8px;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(245, 240, 229, 0.72);
    padding: 12px;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.case-row:hover,
.case-row.is-selected {
    border-color: rgba(235, 94, 40, 0.45);
    background: #fffaf0;
    transform: translateY(-1px);
}

.case-row__top,
.case-row__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.case-row__top b {
    min-width: 0;
    font-size: 15px;
}

.case-row__bottom {
    color: var(--steel);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.case-row__bottom em,
.data-row em {
    color: var(--ink);
    font-style: normal;
}

.case-row__progress,
.progress-block i {
    display: block;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(79, 109, 122, 0.14);
}

.case-row__progress i,
.progress-block b {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--steel);
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 9px;
    white-space: nowrap;
    color: var(--steel);
    background: rgba(79, 109, 122, 0.12);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chip--urgent,
.chip--overdue,
.chip--needs_review {
    color: var(--red);
    background: rgba(235, 94, 40, 0.13);
}

.chip--paid,
.chip--signed,
.chip--closed {
    color: var(--green);
    background: rgba(63, 125, 87, 0.13);
}

.record__head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
}

.flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin: 16px 0;
}

.flow__step {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 7px;
    display: grid;
    place-items: center;
    color: rgba(37, 36, 34, 0.58);
    background: var(--soft);
    text-align: center;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.flow__step.is-current {
    color: var(--white);
    background: var(--ink);
}

.progress-block {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    align-items: center;
    margin-bottom: 18px;
}

.progress-block i {
    grid-column: 1 / -1;
}

.record-section {
    border-top: 1px solid var(--line);
    padding-top: 15px;
    margin-top: 15px;
}

.record-section p {
    margin: 0;
    line-height: 1.65;
}

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

.compact-list,
.timeline {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.compact-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    min-width: 0;
}

.timeline li {
    border-left: 3px solid rgba(79, 109, 122, 0.22);
    padding-left: 10px;
}

.timeline span {
    color: var(--steel);
    font-weight: 700;
    font-size: 12px;
}

.timeline p {
    margin: 4px 0;
}

.timeline small {
    color: rgba(37, 36, 34, 0.54);
}

.action-focus {
    margin-bottom: 16px;
    padding: 14px;
    border-left: 4px solid var(--accent);
    background: var(--soft);
}

.action-focus span {
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
    font-weight: 700;
}

.action-focus p {
    margin: 8px 0 0;
    line-height: 1.5;
}

.note-form,
.form-surface {
    display: grid;
    gap: 13px;
}

.primary,
.secondary {
    width: 100%;
    min-height: 44px;
    border-radius: 7px;
    border: 1px solid var(--ink);
    padding: 0 14px;
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary {
    color: var(--white);
    background: var(--accent);
    border-color: var(--accent);
}

.secondary {
    margin-top: 10px;
    color: var(--ink);
    background: transparent;
}

.primary:hover,
.secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(37, 36, 34, 0.12);
}

.screen {
    max-width: 980px;
}

.form-surface,
.table-panel {
    padding: 22px;
}

.form-surface label {
    display: grid;
    gap: 7px;
}

.form-message {
    min-height: 22px;
    margin: 0;
    color: var(--steel);
    font-weight: 700;
}

.data-list {
    display: grid;
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
}

.data-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(90px, auto);
    gap: 16px;
    align-items: center;
    min-height: 70px;
    padding: 13px 15px;
    background: var(--white);
}

.data-row div {
    min-width: 0;
}

.data-row b,
.data-row span {
    display: block;
}

.empty-state,
.empty-line {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 380px;
    color: rgba(37, 36, 34, 0.58);
    text-align: center;
}

.empty-state h2 {
    color: var(--ink);
}

.empty-state p {
    max-width: 320px;
    line-height: 1.5;
}

.is-hidden {
    display: none;
}

@media (max-width: 1180px) {
    .board {
        grid-template-columns: minmax(270px, 0.9fr) minmax(380px, 1.4fr);
    }

    .action {
        grid-column: 1 / -1;
        min-height: 0;
    }
}

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

    .sidebar {
        position: relative;
        height: auto;
        display: grid;
        gap: 18px;
        padding: 14px;
    }

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

    .nav__item {
        justify-content: center;
        min-width: 0;
        padding: 0 6px;
        font-size: 10px;
    }

    .sidebar__note {
        position: static;
    }

    .workspace {
        padding: 16px;
    }

    .topbar,
    .panel__head,
    .record__head {
        display: grid;
    }

    .topbar__metric {
        min-width: 0;
    }

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

    .board,
    .record-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        min-height: 0;
    }

    .case-list {
        max-height: none;
    }
}

@media (max-width: 560px) {
    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metrics {
        grid-template-columns: 1fr;
    }

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

    .data-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    select {
        width: 100%;
    }
}

