:root {
    --ink: #1b1b3a;
    --paper: #fbfefb;
    --line: rgba(27, 27, 58, 0.12);
    --muted: #667085;
    --coral: #ff6b6b;
    --teal: #4ecdc4;
    --amber: #f4b860;
    --green: #2f9e44;
    --shadow: 0 18px 60px rgba(27, 27, 58, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
    cursor: pointer;
}

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

.navigation {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    background: var(--ink);
    color: var(--paper);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    font-size: 19px;
    font-weight: 800;
}

.brand img {
    width: 42px;
    height: 42px;
}

.navigation nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    border: 0;
    border-radius: 8px;
    padding: 12px;
    background: transparent;
    color: rgba(251, 254, 251, 0.7);
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    align-items: center;
    text-align: left;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item span {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid rgba(251, 254, 251, 0.18);
    font-size: 11px;
    font-weight: 800;
}

.nav-item strong {
    font-size: 14px;
}

.nav-item:hover,
.nav-item.is-active {
    background: rgba(251, 254, 251, 0.1);
    color: var(--paper);
    transform: translateX(2px);
}

.nav-item.is-active span {
    background: var(--teal);
    color: var(--ink);
    border-color: var(--teal);
}

.workspace {
    min-width: 0;
    padding: 24px clamp(18px, 3vw, 38px) 38px;
}

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

.eyebrow {
    margin: 0 0 7px;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 0.94;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 14px;
    font-size: clamp(24px, 2.4vw, 36px);
    line-height: 1;
}

h3 {
    margin: 0 0 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.live-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(86px, 1fr));
    gap: 8px;
    min-width: min(520px, 54vw);
}

.live-metrics article {
    border-left: 3px solid var(--teal);
    background: #ffffff;
    padding: 10px 12px;
    box-shadow: 0 1px 0 var(--line);
}

.live-metrics span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 5px;
}

.live-metrics strong {
    font-size: 22px;
}

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

.workflow-step {
    min-height: 78px;
    border: 0;
    background: #ffffff;
    color: var(--ink);
    text-align: left;
    padding: 13px;
    display: grid;
    align-content: space-between;
    gap: 9px;
    transition: transform 160ms ease, background 160ms ease;
}

.workflow-step:hover {
    background: #f2fbfa;
    transform: translateY(-2px);
}

.workflow-step span {
    color: var(--muted);
    font-size: 12px;
}

.workflow-step strong {
    font-size: 24px;
}

.workflow-step i,
.plan-meter i,
.finance-row i {
    display: block;
    height: 5px;
    background: rgba(27, 27, 58, 0.1);
    overflow: hidden;
}

.progress-line {
    display: block;
    height: 5px;
    background: rgba(27, 27, 58, 0.1);
    overflow: hidden;
}

.progress-line i {
    display: block;
    width: 100%;
    height: 100%;
}

.workflow-step i::before,
.progress-line i::before,
.plan-meter i::before,
.finance-row i::before {
    content: "";
    display: block;
    width: var(--value);
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--coral));
}

.screen {
    display: none;
    animation: riseIn 220ms ease both;
}

.screen.is-active {
    display: block;
}

.filters {
    display: grid;
    grid-template-columns: 170px 150px 170px minmax(220px, 1fr);
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    background: #ffffff;
    margin-bottom: 16px;
}

label {
    display: grid;
    gap: 7px;
}

label span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

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

textarea {
    resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.18);
}

.registry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 18px;
    align-items: start;
}

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

.object-tile {
    min-height: 208px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    padding: 16px;
    text-align: left;
    display: grid;
    gap: 14px;
    align-content: space-between;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.object-tile:hover,
.object-tile.is-selected {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: rgba(78, 205, 196, 0.75);
}

.tile-top,
.tile-bottom,
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tile-top {
    justify-content: space-between;
}

.tile-top i,
.tile-top b,
.tile-bottom small,
.detail-meta span,
.doc-kind {
    border-radius: 999px;
    padding: 5px 8px;
    background: rgba(27, 27, 58, 0.06);
    font-style: normal;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
}

.risk-critical .tile-top b,
.risk-high .tile-top b {
    background: rgba(255, 107, 107, 0.16);
    color: #a52626;
}

.risk-medium .tile-top b {
    background: rgba(244, 184, 96, 0.22);
    color: #7b4e00;
}

.risk-low .tile-top b {
    background: rgba(78, 205, 196, 0.2);
    color: #11665f;
}

.object-tile strong {
    display: block;
    font-size: 22px;
    line-height: 1.05;
}

.object-tile em {
    color: var(--muted);
    font-style: normal;
}

.progress-line {
    width: 100%;
}

.detail-panel,
.request-side,
.plain-panel {
    border-left: 4px solid var(--ink);
    background: #ffffff;
    padding: 20px;
    box-shadow: 0 1px 0 var(--line);
}

.detail-panel {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow: auto;
}

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

.plan-meter {
    margin: 18px 0;
    display: grid;
    gap: 8px;
}

.plan-meter span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.plan-meter strong {
    font-size: 34px;
}

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

.stop-row,
.proof-row,
.action-row,
.document-row,
.finance-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 0;
    border-top: 1px solid rgba(27, 27, 58, 0.08);
}

.stop-row:first-of-type,
.proof-row:first-of-type,
.action-row:first-of-type {
    border-top: 0;
}

.stop-row > span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--teal);
    font-size: 12px;
    font-weight: 900;
}

.stop-row strong,
.proof-row strong,
.action-row strong,
.document-row strong,
.finance-row strong {
    display: block;
    line-height: 1.2;
}

.stop-row small,
.proof-row small,
.document-row small,
.finance-row small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.proof-row > span {
    min-width: 76px;
    color: var(--coral);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.action-row {
    grid-template-columns: 92px 1fr;
}

.action-row span {
    color: var(--muted);
}

.next-step {
    margin: 18px 0 0;
    padding: 14px;
    background: #f2fbfa;
    border-left: 4px solid var(--teal);
    color: #174a45;
}

.request-layout,
.split-pane {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
}

.request-form,
.document-list,
.finance-table {
    background: #ffffff;
    border: 1px solid var(--line);
    padding: 20px;
}

.request-form {
    display: grid;
    gap: 14px;
}

.primary-action {
    border: 0;
    border-radius: 8px;
    background: var(--coral);
    color: #ffffff;
    min-height: 44px;
    padding: 0 16px;
    font-weight: 900;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 107, 107, 0.28);
}

output {
    min-height: 22px;
    color: var(--muted);
}

.request-side ol {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 12px;
}

.document-row {
    grid-template-columns: 90px minmax(0, 1fr) 90px;
}

.document-row b {
    justify-self: end;
    color: var(--muted);
    font-size: 12px;
}

.plain-panel {
    display: grid;
    gap: 8px;
}

.plain-panel strong {
    font-size: 48px;
    line-height: 1;
}

.plain-panel span {
    color: var(--muted);
}

.finance-row {
    grid-template-columns: minmax(0, 1fr) 180px;
}

.finance-row span {
    text-align: right;
    font-weight: 800;
}

.finance-row i {
    grid-column: 1 / -1;
}

.empty-state {
    min-height: 210px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    color: var(--muted);
    background: #ffffff;
    text-align: center;
    padding: 24px;
}

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

@media (max-width: 1120px) {
    .app-shell {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .brand span,
    .nav-item strong {
        display: none;
    }

    .nav-item {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .registry-layout,
    .request-layout,
    .split-pane {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        position: static;
        max-height: none;
    }
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .navigation {
        position: static;
        height: auto;
        padding: 14px;
        gap: 14px;
    }

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

    .nav-item {
        padding: 8px;
    }

    .workspace {
        padding: 18px 14px 28px;
    }

    .topbar {
        display: grid;
    }

    .live-metrics,
    .workflow-strip,
    .filters,
    .portfolio-grid {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .object-tile {
        min-height: 190px;
    }

    .document-row,
    .finance-row {
        grid-template-columns: 1fr;
    }

    .document-row b,
    .finance-row span {
        justify-self: start;
        text-align: left;
    }
}
