:root {
    color-scheme: light;
    --canvas: #f5f4ef;
    --surface: #fffefa;
    --ink: #202b26;
    --muted: #59635d;
    --line: #dedfd5;
    --sidebar: #182b23;
    --accent: #245b43;
    --accent-hover: #194632;
    --accent-soft: #e8f1e8;
    --radius: 16px;
    --shadow: 0 2px 4px #21312608, 0 12px 32px #21312606;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font: 1rem/1.5 "Aptos", "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); text-underline-offset: .19em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid #587d62; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 10; top: .75rem; left: .75rem; transform: translateY(-180%); padding: .6rem .85rem; border-radius: 8px; background: var(--surface); }
.skip-link:focus { transform: none; }
h1, h2, h3, h4, p { margin: 0 0 .8rem; }
h1 { font-size: clamp(2rem, 4.6vw, 3rem); letter-spacing: -.052em; line-height: 1.1; font-weight: 750; overflow-wrap: anywhere; }
h2 { font-size: 1.25rem; letter-spacing: -.026em; line-height: 1.3; }
h3 { margin-top: 1.35rem; font-size: 1rem; }
small { color: var(--muted); }
code, pre { font-family: "Cascadia Mono", Consolas, monospace; font-size: .9em; }
code { overflow-wrap: anywhere; }

.workspace { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); background: linear-gradient(90deg, var(--sidebar) 0 14.5rem, var(--canvas) 14.5rem); }
.site-header { padding: 1.55rem 1.3rem; background: var(--sidebar); color: #f5f8f3; }
.workspace .site-header { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 2.5rem; }
.brand { display: inline-flex; align-items: center; gap: .72rem; width: fit-content; color: inherit; text-decoration: none; font-size: 1.12rem; font-weight: 760; line-height: 1.2; }
.brand:hover { color: white; }
.brand-mark { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 9px; flex-shrink: 0; color: #1b3427; background: #b9e0be; font-size: 1.28rem; }
.brand small { display: block; margin-top: .15rem; color: #bdcfc2; font-weight: 500; font-size: .78rem; }
.site-nav { display: grid; gap: .32rem; }
.site-nav a { border-radius: 9px; color: #c8d6cd; text-decoration: none; padding: .62rem .82rem; font-size: .94rem; font-weight: 640; }
.site-nav a:hover { background: #29453a; color: #fff; }
.site-nav a[aria-current] { background: #315143; color: #fff; box-shadow: inset 3px 0 #b9e0be; }
.site-account { margin-top: auto; padding-top: 1rem; border-top: 1px solid #45584d; display: grid; gap: .65rem; }
.account-address { color: #d6e2d8; font-size: .83rem; overflow-wrap: anywhere; }
.site-account button.secondary { justify-self: start; background: transparent; border-color: #64796b; color: #edf5ed; font-size: .85rem; min-height: 2.2rem; }
.site-account button.secondary:hover { background: #304b3d; color: white; }

.page-content { width: 100%; max-width: 83rem; margin: 0 auto; min-width: 0; padding: clamp(1.25rem, 4vw, 3.5rem) clamp(1.2rem, 4.2vw, 4rem) 4rem; }
.public-page .site-header { padding-inline: max(1.2rem, calc((100vw - 66rem) / 2)); }
.public-page .narrow { margin-inline: auto; }
.narrow { max-width: 31rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: .8rem 1.2rem; margin-bottom: 1.55rem; }
.page-heading h1 { margin-bottom: .35rem; }
.page-heading p, .section-heading p { color: var(--muted); margin: 0; }
.breadcrumb { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin-bottom: 1rem; font-size: .88rem; color: var(--muted); }
.breadcrumb a { font-weight: 650; }
.context-line { display: flex; align-items: center; gap: .55rem .8rem; flex-wrap: wrap; color: var(--muted); }
.context-line strong { color: var(--ink); }
.environment-label, .status-pill { display: inline-flex; align-items: center; max-width: 100%; border-radius: 100px; padding: .16rem .65rem; font-size: .8rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.environment-label--live { background: #f5e9d6; color: #774b1f; }
.status-pill--draft { background: #f4ecd9; color: #72541e; }

.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: clamp(1rem, 2vw, 1.5rem); box-shadow: var(--shadow); }
.panel > :last-child { margin-bottom: 0; }
.stacked-panel { margin-top: 1rem; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.section-heading h2 { margin: 0; }
.section-heading p { margin-top: .22rem; }
.service-group { margin-top: 1.9rem; }
.environment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.environment-card { display: flex; flex-direction: column; align-items: start; min-height: 12.75rem; padding: 1.35rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); text-decoration: none; }
.environment-card:hover { border-color: #8ba494; background: #fcfdf7; color: var(--ink); }
.environment-marker { width: .65rem; height: .65rem; border-radius: 50%; background: #428262; box-shadow: 0 0 0 5px var(--accent-soft); margin: .35rem .32rem .9rem; }
.environment-marker--live { background: #9d662f; box-shadow: 0 0 0 5px #f5e9d6; }
.environment-card h3 { margin: 0 0 .25rem; font-size: 1.18rem; letter-spacing: -.02em; }
.environment-card p { color: var(--muted); margin-bottom: 1.25rem; }
.service-card, .environment-card--compact { min-height: 9rem; }
.service-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.card-action { display: flex; align-items: center; gap: .45rem; margin-top: auto; color: var(--accent); font-size: .92rem; font-weight: 700; }

.editor-layout { display: grid; grid-template-columns: minmax(13.5rem, .72fr) minmax(0, 1.55fr); align-items: start; gap: 1rem; }
.config-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); align-items: start; gap: 1rem; }
.config-columns > * { min-width: 0; }
.revision-bar { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1rem; margin: 0 0 1rem; padding: .65rem .85rem; border-radius: 10px; background: #eaece3; color: #46564b; font-size: .9rem; }
.revision-bar strong { color: var(--ink); margin-left: .2rem; }
.parameter-list, .items, .preview-sources { margin: 0; padding: 0; list-style: none; }
.parameter-list li + li, .items li + li { border-top: 1px solid #ecebe4; }
.parameter-list a { display: grid; gap: .14rem; border-radius: 8px; padding: .7rem .68rem; text-decoration: none; color: var(--ink); }
.parameter-list a:hover, .parameter-list a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.parameter-list a span, .empty-state { color: var(--muted); font-size: .89rem; }
.parameter-list .empty-state { padding: .7rem 0; }
.parameter-panel .button { min-height: 2.15rem; padding: .32rem .7rem; font-size: .86rem; }
.editor-empty { padding: clamp(1.25rem, 4vw, 3rem) 0; text-align: center; }
.editor-empty p, .revision-reason { color: var(--muted); }
.items li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .55rem; padding: .65rem 0; overflow-wrap: anywhere; }
.catalog-search { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.catalog-search label { flex: 1 1 9rem; display: grid; gap: .3rem; min-width: 0; font-size: .9rem; font-weight: 660; }
.catalog-pagination, .catalog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem 1rem; }
.catalog-pagination { margin-top: .85rem; }

.stack { display: grid; gap: .85rem; justify-items: start; max-width: 39rem; margin-bottom: .8rem; }
.stack label, .preview-form label { display: grid; gap: .3rem; width: 100%; font-size: .94rem; font-weight: 660; }
.preview-form { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(7rem, 12rem) auto; align-items: end; justify-content: start; gap: .75rem; margin-bottom: .85rem; }
.preview-sources li { border-bottom: 1px solid #ecebe4; padding: .42rem 0; font-size: .89rem; }
input, textarea, select, button { font: inherit; }
input, textarea, select { accent-color: var(--accent); }
input:not([type=checkbox]), textarea, select { width: 100%; min-width: 0; padding: .58rem .7rem; min-height: 2.65rem; border: 1px solid #aeb8ae; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 450; }
textarea { resize: vertical; }
button, .button { display: inline-flex; justify-content: center; align-items: center; min-height: 2.55rem; padding: .5rem .84rem; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; font-size: .9rem; font-weight: 690; }
button:hover, .button:hover { background: var(--accent-hover); color: #fff; }
button.secondary, .button.secondary { border-color: #cbd5cc; background: var(--surface); color: var(--accent); }
button.secondary:hover, .button.secondary:hover { background: var(--accent-soft); }
button.danger { color: #8c2925; }
.grant fieldset { display: flex; gap: .65rem 1rem; align-items: center; flex-wrap: wrap; padding: .7rem; margin: 0 0 .85rem; border: 1px solid var(--line); border-radius: 10px; }
details { padding: .7rem 0; border-top: 1px solid #ecebe4; }
details[open] > summary { margin-bottom: .6rem; }
summary { cursor: pointer; font-weight: 660; color: var(--accent); }
.error { color: #832e27; background: #fbeae5; border: 1px solid #eac8be; border-radius: 9px; padding: .75rem .9rem; }
.table { overflow: auto; }
.table-panel { padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .8rem 1rem; border-bottom: 1px solid #ecebe4; text-align: left; vertical-align: top; }
th { background: #efefe7; font-size: .84rem; color: #46564b; }
tr:last-child td { border-bottom: 0; }
.date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-link { font-weight: 730; }
.table-empty { color: var(--muted); }
pre { max-height: 20rem; overflow: auto; margin: .4rem 0 .8rem; padding: .9rem; color: #eef5ec; background: #23352b; border-radius: 9px; }
.exception { margin-bottom: .8rem; }
.activation-qr { display: block; width: min(100%, 320px); height: auto; margin-bottom: .8rem; }

@media (max-width: 820px) {
    .workspace { display: block; background: var(--canvas); }
    .workspace .site-header { position: static; display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1rem; height: auto; padding: .8rem 1.2rem; }
    .site-nav { display: flex; gap: .18rem; flex-wrap: wrap; order: 3; flex-basis: 100%; }
    .site-nav a { padding: .46rem .65rem; }
    .site-account { margin: 0; padding: 0; border: 0; }
    .account-address { display: none; }
}

@media (max-width: 620px) {
    .editor-layout, .preview-form { grid-template-columns: 1fr; }
    .preview-form button { justify-self: start; }
    .page-heading { align-items: start; }
}
