:root {
    color-scheme: light;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #1e2632;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

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

.sidebar {
    background: #16202f;
    color: #edf2f7;
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 22px 16px;
}

.brand {
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    padding-bottom: 18px;
}

.brand strong {
    display: block;
    font-size: 18px;
    line-height: 1.2;
}

.brand span,
.sidebar-foot {
    color: #9fb0c5;
    font-size: 13px;
}

.nav {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.nav-group {
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    display: grid;
    gap: 5px;
    padding-top: 10px;
}

.nav-group:first-child {
    border-top: 0;
    padding-top: 0;
}

.nav-heading {
    color: #8fa1b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    padding: 0 10px 2px;
    text-transform: uppercase;
}

.nav a {
    border-radius: 6px;
    color: #dbe5f2;
    display: flex;
    gap: 10px;
    min-height: 38px;
    padding: 9px 10px;
    text-decoration: none;
}

.nav a.active,
.nav a:hover {
    background: #26364c;
    color: white;
}

.main {
    min-width: 0;
    padding: 22px;
}

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

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

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

h2 {
    font-size: 17px;
    margin-bottom: 12px;
}

h3 {
    font-size: 14px;
    margin-bottom: 8px;
}

p {
    color: #657184;
    margin-top: 5px;
}

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

form {
    margin: 0;
}

label {
    color: #465365;
    display: grid;
    font-size: 13px;
    gap: 5px;
}

input,
textarea,
select {
    border: 1px solid #c9d3df;
    border-radius: 6px;
    color: #1e2632;
    font: inherit;
    min-height: 36px;
    padding: 8px 10px;
    width: 260px;
}

textarea {
    min-height: 86px;
    resize: vertical;
    width: 100%;
}

select {
    background: white;
}

input[type="checkbox"] {
    min-height: auto;
    width: auto;
}

button,
.button {
    align-items: center;
    background: #1d6fd8;
    border: 0;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    text-decoration: none;
    white-space: nowrap;
}

button.secondary,
.button.secondary {
    background: #556371;
}

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

.metrics {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    margin-bottom: 14px;
}

.columns {
    grid-template-columns: 1.15fr 0.85fr;
}

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

.panel,
.metric,
.alert {
    background: white;
    border: 1px solid #d9e1ea;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(20, 32, 48, 0.05);
}

.panel,
.alert {
    padding: 14px;
}

.metric {
    min-height: 92px;
    padding: 12px;
}

.metric span {
    color: #667386;
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    font-size: 24px;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.metric small {
    color: #667386;
    display: block;
    font-size: 12px;
    margin-top: 8px;
}

.alert {
    background: #fff6e6;
    border-color: #edc777;
    margin-bottom: 12px;
}

.alert.health-ok {
    background: #edf8f1;
    border-color: #8bc7a0;
    color: #245b36;
}

.status-row {
    display: grid;
    gap: 8px;
}

.status-line {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: 90px 1fr 34px;
}

.bar {
    background: #e9edf3;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.bar span {
    background: #1d6fd8;
    display: block;
    height: 100%;
}

.table-wrap {
    overflow-x: auto;
}

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

.inline-actions form {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.inline-actions select {
    min-width: 120px;
    width: auto;
}

.condition-builder {
    border: 1px solid #e6ebf1;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    padding: 12px;
}

.condition-head {
    align-items: start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.condition-head label {
    min-width: 190px;
}

.condition-row {
    align-items: end;
    background: #f8fafc;
    border: 1px solid #e6ebf1;
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: 72px minmax(150px, 1fr) minmax(150px, 1fr) minmax(180px, 1.2fr) auto;
    padding: 10px;
}

.condition-row input,
.condition-row select {
    width: 100%;
}

.simulation-line {
    align-items: end;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(260px, 1fr) 120px 36px;
}

.simulation-line input,
.simulation-line select {
    width: 100%;
}

.condition-json summary {
    color: #26364c;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

table {
    border-collapse: collapse;
    font-size: 13px;
    min-width: 100%;
}

th,
td {
    border-bottom: 1px solid #e6ebf1;
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: #677386;
    font-size: 12px;
    text-transform: uppercase;
}

.wide {
    max-width: 260px;
    overflow-wrap: anywhere;
}

.muted,
.empty {
    color: #7a8697;
}

.badge {
    background: #edf2f7;
    border-radius: 999px;
    color: #26364c;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    min-height: 24px;
    padding: 4px 8px;
}

.badge.reserved,
.badge.captured,
.badge.shipped {
    background: #e5f2ff;
    color: #145da6;
}

.badge.completed,
.badge.delivered {
    background: #e8f7ee;
    color: #1f6a3f;
}

.badge.cancelled,
.badge.failed {
    background: #ffeded;
    color: #ad2f2f;
}

.badge.owner {
    background: #fff3d6;
    color: #865400;
}

.badge.manager {
    background: #e5f2ff;
    color: #145da6;
}

.badge.viewer {
    background: #edf2f7;
    color: #26364c;
}

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

.workflow-panel {
    margin-bottom: 14px;
}

.section-head {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 12px;
}

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

.workspace-head h1 {
    font-size: 24px;
    margin: 0;
}

.page-tabs {
    border-bottom: 1px solid #cfd8e3;
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.page-tab {
    border-bottom: 3px solid transparent;
    color: #526174;
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 12px 8px;
    text-decoration: none;
}

.page-tab:hover {
    color: #145da6;
}

.page-tab.active {
    border-bottom-color: #1d6fd8;
    color: #145da6;
}

.workspace-content {
    display: grid;
    gap: 14px;
}

.disclosure-panel {
    padding: 0;
}

.disclosure-panel summary {
    color: #26364c;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    list-style-position: inside;
    padding: 14px;
}

.disclosure-panel[open] summary {
    border-bottom: 1px solid #e6ebf1;
}

.disclosure-content {
    padding: 14px;
}

.form-row {
    margin-top: 12px;
}

.form-actions {
    align-items: end;
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.filter-bar {
    border-bottom: 1px solid #e6ebf1;
    padding-bottom: 14px;
}

.result-empty {
    margin-top: 16px;
}

.price-groups {
    display: grid;
}

.price-group {
    border-top: 1px solid #e6ebf1;
    padding: 16px 0;
}

.price-group:first-child {
    border-top: 0;
}

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

.price-group-head div {
    display: grid;
    gap: 3px;
}

.price-group-head span:not(.badge),
.cell-note {
    color: #657184;
    font-size: 12px;
}

.compact-alert {
    margin: 0 0 10px;
    padding: 9px 10px;
}

.compact-input {
    min-width: 90px;
    width: 110px;
}

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

.transition-next {
    margin: -6px 0 0;
}

.action-list {
    display: grid;
    gap: 8px;
}

.action-item {
    align-items: center;
    border: 1px solid #e6ebf1;
    border-radius: 8px;
    color: #1e2632;
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 62px;
    padding: 10px;
    text-decoration: none;
}

.action-item:hover {
    background: #f8fafc;
    border-color: #c9d3df;
}

.action-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.action-copy strong,
.action-copy small {
    overflow-wrap: anywhere;
}

.action-copy small {
    color: #657184;
    font-size: 12px;
}

.account-bar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.locale-switch {
    display: inline-flex;
    gap: 4px;
}

.locale-switch .button {
    min-width: 42px;
    padding: 0 8px;
}

.user-chip {
    background: #edf2f7;
    border-radius: 999px;
    color: #26364c;
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    min-height: 32px;
    padding: 7px 10px;
}

.logout-form {
    display: inline-flex;
}

.permission-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.permission {
    border: 1px solid #e6ebf1;
    border-radius: 8px;
    display: grid;
    gap: 6px;
    padding: 10px;
}

.permission strong {
    font-size: 13px;
}

.permission span {
    color: #657184;
    font-size: 12px;
}

.onboarding-hero,
.next-step-panel {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.quick-action-panel {
    margin-bottom: 14px;
}

.onboarding-hero h1 {
    margin-top: 10px;
}

.onboarding-hero-side {
    align-items: stretch;
    display: grid;
    gap: 10px;
}

.onboarding-hero-side form {
    display: grid;
}

.progress-card {
    border: 1px solid #e6ebf1;
    border-radius: 8px;
    display: grid;
    gap: 6px;
    min-width: 180px;
    padding: 12px;
}

.progress-card strong {
    font-size: 28px;
    line-height: 1;
}

.progress-card span,
.progress-card small {
    color: #657184;
    font-size: 12px;
}

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

.onboarding-step {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
}

.onboarding-step.ready {
    border-color: #b9dfc8;
}

.step-mark {
    align-items: center;
    background: #edf2f7;
    border-radius: 999px;
    color: #26364c;
    display: inline-flex;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.onboarding-step.ready .step-mark {
    background: #e8f7ee;
    color: #1f6a3f;
}

.step-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.step-copy h2 {
    margin-bottom: 0;
}

.step-copy small {
    color: #7a8697;
    font-size: 12px;
}

.step-action {
    display: flex;
    justify-content: flex-end;
}

.onboarding-summary {
    margin-top: 14px;
}

.storefront-head {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.storefront-filter {
    align-items: end;
    display: flex;
    gap: 8px;
}

.storefront-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-card {
    background: white;
    border: 1px solid #d9e1ea;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-rows: auto 1fr auto auto;
    min-height: 310px;
    padding: 12px;
}

.product-media {
    align-items: center;
    background: #eef3f8;
    border: 1px solid #d9e1ea;
    border-radius: 6px;
    color: #26364c;
    display: flex;
    font-size: 28px;
    font-weight: 700;
    height: 116px;
    justify-content: center;
}

.product-copy {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.product-copy h2 {
    font-size: 18px;
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.product-copy p {
    overflow-wrap: anywhere;
}

.product-buyline {
    align-items: center;
    border-top: 1px solid #e6ebf1;
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
}

.product-buyline strong {
    font-size: 20px;
}

.product-buyline span,
.product-meta span {
    color: #657184;
    font-size: 12px;
}

.price-breakdown {
    background: #f8fafc;
    border: 1px solid #e6ebf1;
    border-radius: 6px;
    display: grid;
    gap: 5px 8px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px;
}

.price-breakdown span,
.price-breakdown small {
    color: #657184;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.price-breakdown strong {
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.price-breakdown small {
    grid-column: 1 / -1;
}

.price-breakdown small.applied {
    color: #1f6a3f;
    font-weight: 700;
}

.price-breakdown small.rejected {
    color: #ad2f2f;
    font-weight: 700;
}

.product-meta {
    display: grid;
    gap: 4px;
}

.product-meta strong {
    overflow-wrap: anywhere;
}

.detail-list {
    display: grid;
    gap: 8px;
    grid-template-columns: 110px minmax(0, 1fr);
}

.detail-list span {
    color: #657184;
    font-size: 13px;
}

.detail-list strong {
    font-size: 13px;
    overflow-wrap: anywhere;
}

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

.timeline-business {
    gap: 0;
}

.timeline-item {
    border: 1px solid #e6ebf1;
    border-radius: 8px;
    display: grid;
    gap: 6px;
    padding: 10px;
}

.timeline-business .timeline-item {
    border: 0;
    border-left: 2px solid #d9e1ea;
    border-radius: 0;
    grid-template-columns: 16px minmax(0, 1fr);
    margin-left: 6px;
    padding: 0 0 16px 14px;
    position: relative;
}

.timeline-business .timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    background: #1d6fd8;
    border: 3px solid white;
    border-radius: 999px;
    box-shadow: 0 0 0 1px #9fbbe0;
    height: 12px;
    left: -7px;
    position: absolute;
    top: 3px;
    width: 12px;
}

.timeline-content {
    display: grid;
    gap: 6px;
}

.timeline-item small {
    color: #657184;
    font-size: 12px;
}

@media (max-width: 1180px) {
    .metrics,
    .triple,
    .permission-grid,
    .storefront-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

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

    .sidebar {
        min-height: auto;
    }

    .topbar,
    .tenant-form,
    .section-head,
    .workspace-head,
    .price-group-head,
    .condition-head,
    .account-bar,
    .onboarding-hero,
    .next-step-panel,
    .storefront-head,
    .storefront-filter {
        align-items: stretch;
        display: grid;
    }

    .form-actions {
        justify-content: stretch;
    }

    .form-actions button {
        width: 100%;
    }

    .action-item {
        grid-template-columns: 1fr;
    }

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

    .simulation-line {
        grid-template-columns: minmax(0, 1fr) 88px 36px;
    }

    .simulation-line label:first-child {
        grid-column: 1 / -1;
    }

    .onboarding-step {
        align-items: stretch;
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .step-action {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .step-action .button {
        width: 100%;
    }

    input {
        width: 100%;
    }

    .metrics,
    .triple,
    .permission-grid,
    .storefront-grid {
        grid-template-columns: 1fr;
    }
}
