:root {
    --sidebar-width: 210px;
    --bg: #f3f6ef;
    --bg-alt: #e7f1eb;
    --ink: #132018;
    --muted: #5e6d62;
    --brand: #116891;
    --brand-strong: #0c4c74;
    --accent: #d98d37;
    --card: #ffffff;
    --line: #d5e1d6;
    --ok: #2f7d32;
    --warn: #b85e1e;
    --shadow: 0 10px 28px rgba(13, 55, 42, 0.1);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    color: var(--ink);
    font-family: "IBM Plex Sans", "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at 12% 8%, rgba(17, 104, 145, 0.15), transparent 38%),
        radial-gradient(circle at 88% 84%, rgba(217, 141, 55, 0.16), transparent 34%),
        linear-gradient(145deg, var(--bg), var(--bg-alt));
}

.bg-shape {
    position: fixed;
    z-index: -1;
    width: 40vw;
    height: 40vw;
    border-radius: 48%;
    filter: blur(70px);
    opacity: 0.18;
}

.bg-shape-a {
    top: -14vw;
    left: -10vw;
    background: #1679b3;
}

.bg-shape-b {
    right: -8vw;
    bottom: -16vw;
    background: #d98d37;
}

.app-shell {
    min-height: 100vh;
    width: 100%;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 252, 248, 0.9));
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
}

.brand {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
}

.brand-code {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: linear-gradient(160deg, var(--brand), var(--brand-strong));
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.brand-logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    padding: 3px;
}

.brand-title {
    font-size: 1.02rem;
    font-weight: 700;
}

.brand-subtitle {
    font-size: 0.84rem;
    color: var(--muted);
}

.menu {
    display: grid;
    gap: 10px;
}

.menu-link {
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--ink);
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.menu-link:hover {
    border-color: var(--line);
    background: rgba(17, 104, 145, 0.08);
}

.menu-link.is-active {
    background: linear-gradient(140deg, rgba(17, 104, 145, 0.15), rgba(17, 104, 145, 0.08));
    border-color: rgba(17, 104, 145, 0.25);
}

.sidebar-note {
    margin-top: 28px;
    padding: 13px;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(217, 141, 55, 0.17), rgba(217, 141, 55, 0.06));
    border: 1px solid rgba(217, 141, 55, 0.26);
}

.sidebar-legal {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 0.73rem;
    color: var(--muted);
    line-height: 1.4;
}

.note-title {
    font-size: 0.88rem;
    font-weight: 700;
}

.note-text {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #5d4c39;
    line-height: 1.4;
}

.workspace {
    padding: 22px;
    min-width: 0;
    overflow-x: hidden;
}

.workspace.workspace-fixed {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
    animation: fade-up 0.45s ease both;
}

.page-title {
    margin: 0;
    font-size: 1.55rem;
}

.page-title-inline {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
}

.page-title-sep {
    color: var(--line);
    font-weight: 400;
}

.page-title-secondary {
    color: var(--muted);
    font-size: 0.72em;
    font-weight: 600;
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
}

.badge-pill {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 8px 12px;
    font-size: 0.86rem;
    font-weight: 600;
}

.badge-pill-demo {
    border-color: rgba(184, 94, 30, 0.4);
    background: rgba(184, 94, 30, 0.14);
    color: #7b3a10;
    letter-spacing: 0.04em;
}

.content-zone {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.content-zone.is-app-detail {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
}

.kpi-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow);
    animation: fade-up 0.45s ease both;
    animation-delay: var(--delay, 0s);
}

.kpi-label {
    color: var(--muted);
    font-size: 0.84rem;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 700;
    margin-top: 6px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow);
    animation: fade-up 0.45s ease both;
    animation-delay: var(--delay, 0s);
    min-width: 0;
}

.panel-success {
    border-color: rgba(47, 125, 50, 0.3);
    background: rgba(47, 125, 50, 0.08);
    color: var(--ok);
    font-weight: 600;
}

.panel-error {
    border-color: rgba(184, 94, 30, 0.35);
    background: rgba(184, 94, 30, 0.1);
    color: var(--warn);
    font-weight: 600;
}

.flash-stack {
    display: grid;
    gap: 10px;
}

.flash-message {
    transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, margin 0.35s ease, padding 0.35s ease;
    opacity: 1;
}

.flash-hidden {
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    min-width: 0;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.05rem;
    min-width: 0;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 10px 8px;
    font-size: 0.92rem;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
}

.status-pill {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(47, 125, 50, 0.12);
    color: var(--ok);
    font-size: 0.8rem;
    font-weight: 700;
}

.status-pill.is-warn {
    background: rgba(184, 94, 30, 0.13);
    color: var(--warn);
}

.link-action,
.link-muted {
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

.operator-filter,
.admin-user-form {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.operator-filter label,
.admin-user-form label {
    display: grid;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    min-width: 190px;
}

.operator-filter select,
.operator-filter input,
.admin-user-form select,
.admin-user-form input {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    background: #fff;
}

.operator-filter .filter-grow {
    flex: 1 1 360px;
    min-width: 280px;
}

.operator-filter-actions {
    display: inline-flex;
    align-items: end;
    gap: 8px;
}

.link-reset {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.quick-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.quick-filter-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 11px;
    text-decoration: none;
    color: var(--ink);
    background: #f8fcf9;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.84rem;
    font-weight: 600;
}

.quick-filter-chip strong {
    font-size: 0.82rem;
    color: var(--muted);
}

.quick-filter-chip.is-active {
    background: linear-gradient(120deg, rgba(17, 104, 145, 0.15), rgba(17, 104, 145, 0.08));
    border-color: rgba(17, 104, 145, 0.3);
}

.quick-filter-meta {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.group-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    margin-top: 10px;
    background: #fcfefd;
}

.group-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.group-card-head h3 {
    margin: 0;
    font-size: 0.98rem;
}

.empty-state-panel {
    margin-top: 12px;
    color: var(--muted);
    font-weight: 600;
}

.action-grid {
    margin-bottom: 12px;
    display: grid;
    gap: 10px;
}

.action-grid label {
    display: grid;
    gap: 6px;
    font-size: 0.86rem;
    font-weight: 600;
}

.action-grid input,
.action-grid select,
.action-grid textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    background: #fff;
}

.action-grid textarea {
    resize: vertical;
}

.action-grid-inline {
    grid-template-columns: repeat(3, minmax(190px, 1fr));
    align-items: end;
}

.status-inline-form {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
    min-width: 0;
    border-top: 1px solid var(--line);
    padding-top: 2px;
}

.status-inline-field {
    display: grid;
    gap: 4px;
    font-size: 0.86rem;
    font-weight: 600;
    min-width: 0;
}

.status-inline-field span {
    white-space: nowrap;
}

.status-inline-field select,
.status-inline-field input {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    background: #fff;
}

.status-inline-comment {
    min-width: 0;
}

.btn-icon-save {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(120deg, var(--brand), var(--brand-strong));
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-save svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.btn-icon-save:hover {
    filter: brightness(1.05);
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 600;
}

.checkbox-inline input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand);
}

.top-gap {
    margin-top: 12px;
}

.action-row {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

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

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-form input,
.inline-form select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
    min-width: 180px;
}

.mini-form {
    display: grid;
    gap: 6px;
    min-width: 210px;
}

.mini-form input,
.mini-form select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px 8px;
    font: inherit;
    background: #fff;
}

.btn-inline {
    padding: 10px 14px;
    align-self: end;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.84rem;
}

.btn-secondary {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    background: #f6faf7;
    color: var(--ink);
    cursor: pointer;
}

.btn-secondary:hover {
    background: #eef6f0;
}

.link-action:hover,
.link-muted:hover {
    text-decoration: underline;
}

.progress-line {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e7eee8;
    overflow: hidden;
}

.progress-line span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--accent));
}

.progress-caption {
    font-size: 0.79rem;
    color: var(--muted);
    margin-top: 4px;
}

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

.chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.78rem;
    color: var(--muted);
    background: #f9fcfa;
}

.stage-forms {
    display: none;
}

.stage-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.stage-checkbox input {
    width: 17px;
    height: 17px;
    accent-color: var(--brand);
}

.detail-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 12px;
}

.detail-fixed-shell {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 12px;
    min-height: 0;
    height: 100%;
}

.summary-sticky {
    position: relative;
    z-index: 2;
}

.summary-compact {
    padding-top: 10px;
    padding-bottom: 10px;
}

.summary-row {
    display: grid;
    grid-template-columns: 0.8fr 0.9fr 1.3fr 1fr 1fr 1.7fr;
    gap: 8px;
}

.summary-cell {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    background: #fbfdfb;
}

.summary-label {
    color: var(--muted);
    font-size: 0.79rem;
}

.summary-value {
    margin-top: 2px;
    font-size: 0.93rem;
    font-weight: 600;
    min-width: 0;
}

.summary-cell-wide {
    min-width: 0;
}

.summary-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.summary-inline .progress-caption {
    max-width: min(980px, 100%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-focus {
    border-color: rgba(17, 104, 145, 0.35);
}

.page-control-shell {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 0;
}

.page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.page-tab {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7fbf8;
    color: var(--ink);
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
}

.page-tab.is-active {
    background: linear-gradient(120deg, var(--brand), var(--brand-strong));
    color: #fff;
    border-color: transparent;
}

.stage-workspace {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 0;
    height: 100%;
    gap: 10px;
}

.stage-view-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stage-view-tab {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7fbf8;
    color: var(--ink);
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
}

.stage-view-tab.is-active {
    background: linear-gradient(120deg, var(--brand), var(--brand-strong));
    color: #fff;
    border-color: transparent;
}

.stage-view-panel {
    display: none;
    height: 100%;
    min-height: 0;
}

.stage-view-panel.is-active {
    display: block;
}

.stage-current-scroll {
    height: 100%;
    max-height: none;
    padding-right: 4px;
    overflow: hidden;
}

.stage-current-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfdfb;
    padding: 14px;
    height: 100%;
    min-height: 0;
}

.stage-current-layout {
    display: grid;
    grid-template-columns: minmax(420px, 1.15fr) minmax(320px, 0.85fr);
    gap: 14px;
    height: 100%;
    min-height: 0;
}

.stage-current-main {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.stage-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stage-payment-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
}

.stage-discussion {
    min-width: 0;
    border-left: 1px solid var(--line);
    padding-left: 14px;
    display: grid;
    gap: 10px;
    grid-template-rows: auto auto 1fr;
    min-height: 0;
    overflow: hidden;
}

.stage-discussion-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stage-note-form {
    display: grid;
    gap: 8px;
}

.stage-note-form textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    background: #fff;
    resize: vertical;
    min-height: 80px;
}

.stage-note-list {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 8px;
    display: grid;
    gap: 8px;
}

.stage-note-list-compact {
    max-height: none;
    height: 100%;
    min-height: 0;
}

.stage-discussion-inline {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 8px;
    min-height: 0;
    height: 100%;
}

.stage-note-item {
    border: 1px solid #e5eee7;
    border-radius: 10px;
    padding: 8px 9px;
    background: #fbfdfb;
}

.stage-note-meta {
    font-size: 0.76rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.stage-note-text {
    font-size: 0.88rem;
    line-height: 1.35;
    word-break: break-word;
}

.stage-current-title {
    margin: 0 0 10px;
    font-size: 1.15rem;
    line-height: 1.3;
}

.stage-current-meta {
    margin: 12px 0 0;
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 12px;
}

.stage-current-meta dt {
    color: var(--muted);
    font-size: 0.85rem;
}

.stage-current-meta dd {
    margin: 0;
    font-weight: 500;
    min-width: 0;
    word-break: break-word;
}

.stages-customer-grid {
    display: grid;
    grid-template-columns: minmax(250px, 0.85fr) minmax(0, 1.55fr);
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.panel-lite {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfdfb;
    padding: 12px;
    display: grid;
    gap: 10px;
    min-height: 0;
    align-content: start;
}

.panel-lite-left {
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
}

.panel-lite-title {
    margin: 0;
    font-size: 1.03rem;
}

.panel-lite-list {
    grid-template-rows: auto 1fr;
}

.customer-stage-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.customer-stage-tab {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7fbf8;
    color: var(--ink);
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
}

.customer-stage-tab.is-active {
    background: linear-gradient(120deg, var(--brand), var(--brand-strong));
    color: #fff;
    border-color: transparent;
}

.customer-stage-panel {
    display: none;
    min-height: 0;
}

.customer-stage-panel.is-active {
    display: block;
    min-height: 0;
}

.customer-stage-panel[data-customer-stage-panel="discussion"].is-active {
    display: grid;
    height: 100%;
}

.stage-list-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stage-list-filter-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stage-list-filter-tab {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f7fbf8;
    color: var(--ink);
    font-weight: 700;
    padding: 6px 12px;
    cursor: pointer;
}

.stage-list-filter-tab.is-active {
    background: linear-gradient(120deg, rgba(17, 104, 145, 0.15), rgba(17, 104, 145, 0.08));
    border-color: rgba(17, 104, 145, 0.3);
}

.timeline-item.is-hidden-by-filter {
    display: none;
}

.timeline-item.is-current {
    border: 1px solid rgba(17, 104, 145, 0.35);
    background: linear-gradient(120deg, rgba(17, 104, 145, 0.12), rgba(17, 104, 145, 0.05));
    border-radius: 12px;
    padding: 10px;
}

.timeline-item.is-current .timeline-mark {
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(217, 141, 55, 0.2);
}

.timeline-item.is-current .timeline-title {
    color: var(--brand-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.page-panels {
    min-height: 0;
    height: 100%;
}

.page-panel {
    display: none;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto 1fr;
    gap: 10px;
}

.page-panel.is-active {
    display: grid;
}

.panel-scroll {
    overflow: auto;
    min-height: 0;
}

.panel-scroll-events {
    height: 100%;
    max-height: none;
}

.panel-scroll-stages {
    height: 100%;
    max-height: none;
    padding-right: 4px;
}

.panel-scroll-docs {
    height: 100%;
    max-height: none;
}

.meta-grid {
    margin: 0;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 12px;
}

.meta-grid dt {
    color: var(--muted);
    font-size: 0.85rem;
}

.meta-grid dd {
    margin: 0;
}

.timeline {
    display: grid;
    gap: 10px;
}

.timeline.timeline-compact {
    gap: 6px;
}

.timeline.timeline-compact .timeline-item {
    grid-template-columns: 10px 1fr;
    gap: 8px;
}

.timeline.timeline-compact .timeline-mark {
    margin-top: 6px;
    width: 8px;
    height: 8px;
}

.timeline.timeline-compact .timeline-meta {
    margin-top: 3px;
    gap: 8px;
    font-size: 0.8rem;
}

.timeline.timeline-compact .progress-caption {
    margin-top: 2px;
}

.timeline.timeline-compact .timeline-item.is-current {
    padding: 6px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 10px;
    align-items: start;
}

.timeline-mark {
    margin-top: 7px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--brand);
}

.timeline-title {
    font-weight: 700;
}

.timeline-meta {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.84rem;
}

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

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-wrap {
    width: min(760px, 100%);
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 22px;
    animation: fade-up 0.45s ease both;
}

.auth-head h1 {
    margin: 0;
}

.auth-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.auth-kicker {
    color: var(--brand);
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    font-weight: 700;
    text-transform: none;
    margin-bottom: 4px;
    line-height: 1.35;
}

.auth-demo-badge {
    display: inline-flex;
    margin-bottom: 6px;
}

.form-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-grid label {
    display: grid;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
}

.form-grid input {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    background: #fff;
}

.form-grid select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    background: #fff;
}

.form-grid .btn-primary,
.form-grid .form-hint,
.form-grid .form-result {
    grid-column: 1 / -1;
}

.btn-primary {
    border: 0;
    border-radius: 12px;
    padding: 11px 14px;
    font-weight: 700;
    background: linear-gradient(120deg, var(--brand), var(--brand-strong));
    color: #fff;
    cursor: pointer;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-icon-save:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: none;
}

.form-hint {
    color: var(--muted);
    font-size: 0.84rem;
}

.form-result {
    min-height: 1.3em;
    color: var(--brand-strong);
    font-size: 0.86rem;
}

.form-result-error {
    color: var(--warn);
}

.auth-links {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.auth-links a {
    color: var(--brand);
    text-decoration: none;
    font-size: 0.9rem;
}

.auth-links a:hover {
    text-decoration: underline;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .action-grid-inline {
        grid-template-columns: 1fr;
    }
    .summary-row {
        grid-template-columns: 1fr 1fr;
    }
    .stage-current-layout {
        grid-template-columns: 1fr;
    }
    .stage-discussion {
        border-left: 0;
        border-top: 1px solid var(--line);
        padding-left: 0;
        padding-top: 12px;
    }
    .stages-customer-grid {
        grid-template-columns: 1fr;
    }
    .status-inline-form {
        grid-template-columns: 1fr 1fr auto;
    }
    .status-inline-comment {
        grid-column: 1 / 3;
    }
}

@media (max-width: 920px) {
    :root {
        --sidebar-width: 190px;
    }
}

@media (max-width: 700px) {
    .workspace {
        padding: 14px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .topbar {
        flex-direction: column;
    }
    .summary-row {
        grid-template-columns: 1fr;
    }
}
