:root { color-scheme: dark; font-family: Inter, ui-sans-serif, system-ui, sans-serif; background: #0a1115; color: #eef5f7; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(140deg, #0a1115, #0b1917); }
a { color: inherit; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 4.5rem; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #26363b; background: rgba(7, 15, 18, .96); }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .7rem; background: #36d990; color: #052016; font-weight: 900; }
.environment, .eyebrow { color: #66dba9; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.menu-toggle { display: none; margin: 0; }
.public-layout { width: min(64rem, 100%); margin: auto; padding: clamp(2rem, 7vw, 7rem); }
.selector-layout { width: min(72rem, 100%); }
.app-layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); width: min(100rem, 100%); margin: auto; }
.sidebar { position: sticky; top: 4.5rem; display: flex; flex-direction: column; min-height: calc(100vh - 4.5rem); max-height: calc(100vh - 4.5rem); padding: 1.5rem 1rem; border-right: 1px solid #26363b; background: rgba(8, 20, 20, .55); }
.sidebar > a { margin-bottom: .3rem; padding: .8rem 1rem; border-radius: .7rem; color: #aebfc4; text-decoration: none; }
.sidebar > a:hover { background: #102821; color: #d8f5e8; }
.sidebar > a.active { background: #16372b; color: #78edb8; font-weight: 750; }
.context-label { display: grid; gap: .3rem; margin-bottom: 1.25rem; padding: 0 1rem 1rem; border-bottom: 1px solid #26363b; }
.context-label span { color: #8fa4a5; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.context-label strong { overflow-wrap: anywhere; }
.sidebar-actions { display: grid; gap: .7rem; margin-top: auto; padding-top: 1.5rem; }
.sidebar-actions .secondary { text-align: center; }
.sidebar-actions form { margin: 0; }
.link-button { width: 100%; margin: 0; background: transparent; border: 1px solid #315047; color: #acd8c7; }
.page-shell { min-width: 0; padding: 1.5rem clamp(1rem, 4vw, 4rem) 5rem; }
.breadcrumbs { display: flex; gap: .5rem; margin: 0 0 1rem; padding: 0; color: #89aaa2; list-style: none; font-size: .88rem; }
.breadcrumbs li + li::before { content: "/"; margin-right: .5rem; color: #526e69; }
.breadcrumbs a { color: #78dbae; text-decoration: none; }
.page-context { display: flex; justify-content: flex-end; gap: .6rem; margin-bottom: 1rem; color: #9fb3b5; font-size: .85rem; }
.page-content { padding: clamp(1rem, 2.5vw, 2.5rem) 0; }
.page-content.narrow { max-width: 50rem; }
h1 { max-width: 18ch; margin: .35rem 0 1rem; font-size: clamp(2.2rem, 4.5vw, 4.2rem); line-height: 1.02; }
h2 { margin: 2rem 0 .75rem; }
.lead { max-width: 50rem; margin: 0 0 1.5rem; color: #b4c4c8; font-size: 1.05rem; line-height: 1.65; }
.page-heading, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.section-heading { align-items: center; margin-top: 2.5rem; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: .35rem 0 0; color: #9fb3b5; }
.primary, .secondary, button { display: inline-block; padding: .78rem 1rem; border: 0; border-radius: .65rem; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary, button { background: #43dfa0; color: #052016; }
.secondary { background: #203a35; color: #85e9be; }
button { margin-top: .5rem; }
button.danger { background: #763341; color: #ffe1e5; }
button:disabled { cursor: not-allowed; opacity: .55; }
.notice { max-width: 60rem; padding: .9rem 1rem; border: 1px solid #31594d; border-radius: .7rem; background: #142c26; color: #bcebd7; }
.notice.error { border-color: #934d59; background: #351b22; color: #ffbdc6; }
.loading, .empty-state { margin: 0; padding: 1.2rem; color: #9eb2b3; text-align: center; }
.entity-cards { display: grid; gap: 1rem; }
.entity-card, .sub-card, .metric { min-height: 0; padding: 1.25rem; border: 1px solid #294a40; border-radius: .9rem; background: rgba(10, 29, 25, .72); }
.entity-card h2 { margin: .35rem 0 1rem; }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 2rem 0; }
.metric { display: grid; gap: .3rem; }
.metric strong { color: #70e7b1; font-size: 2rem; }
.metric span { color: #adc1c0; }
.quick-links, .detail-actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.quick-links .secondary, .detail-actions .secondary, .detail-actions button, .form-actions button { margin: 0; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid #294a40; border-radius: .85rem; background: rgba(8, 24, 21, .7); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid #253d38; text-align: left; vertical-align: top; }
th { color: #8fdab9; font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(45, 104, 81, .16); }
.row-link { color: #eafaf3; font-weight: 750; text-decoration-color: #4b9275; text-underline-offset: .2rem; }
.detail-form, .stack { display: grid; gap: 1rem; }
.detail-form { padding: 1.25rem; border: 1px solid #294a40; border-radius: .9rem; background: rgba(8, 24, 21, .7); }
.detail-form label, .inline-form label { display: grid; gap: .35rem; color: #c1d2d1; }
input, select, textarea { width: 100%; min-width: 0; padding: .72rem; border: 1px solid #376451; border-radius: .6rem; background: #071711; color: inherit; font: inherit; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
fieldset { min-width: 0; margin: 0; padding: 1rem; border: 1px solid #315047; border-radius: .7rem; }
legend { padding: 0 .4rem; color: #9edabe; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .6rem; }
.check-option { display: flex !important; flex-direction: row; align-items: center; gap: .6rem; padding: .65rem; border: 1px solid #294a40; border-radius: .6rem; background: #0b1b18; }
.check-option input { width: auto; margin: 0; accent-color: #43dfa0; }
.detail-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .8rem; margin: 0; }
.detail-list div { min-width: 0; padding: .8rem; border: 1px solid #294a40; border-radius: .65rem; background: #0b1b18; }
.detail-list dt { color: #8fa9a5; font-size: .78rem; text-transform: uppercase; }
.detail-list dd { margin: .3rem 0 0; overflow-wrap: anywhere; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .7rem; }
.inline-form button { margin: 0; }
.form-hint { color: #98adad; font-size: .88rem; line-height: 1.5; }
.secret-panel { display: grid; gap: .8rem; margin-top: 1.25rem; padding: 1rem; border: 1px solid #d7a23c; border-radius: .75rem; background: #2c2412; color: #ffe0a0; }
.secret-panel code { overflow-wrap: anywhere; padding: .75rem; border-radius: .5rem; background: #17130b; }
[hidden] { display: none !important; }

@media (max-width: 800px) {
    .topbar { padding: 0 1rem; }
    .environment { display: none; }
    .menu-toggle { display: inline-block; }
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 4.5rem 0 0 0; z-index: 15; display: none; min-height: 0; max-height: none; overflow-y: auto; border-right: 0; background: #091714; }
    .sidebar.open { display: flex; }
    .page-shell { padding: 1rem; }
    .page-heading, .section-heading { align-items: stretch; flex-direction: column; }
    .page-heading > .primary, .section-heading > .secondary { text-align: center; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-context { justify-content: flex-start; flex-wrap: wrap; }
}
@media (max-width: 560px) {
    .public-layout { padding: 2rem 1rem; }
    .metric-grid { grid-template-columns: 1fr; }
    .quick-links, .detail-actions, .form-actions { align-items: stretch; flex-direction: column; }
    .quick-links > *, .detail-actions > *, .form-actions > * { width: 100%; text-align: center; }
    table, thead, tbody, tr, th, td { display: block; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    tbody tr { padding: .7rem; border-bottom: 1px solid #294a40; }
    tbody tr:last-child { border-bottom: 0; }
    td { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: .7rem; padding: .45rem; border: 0; }
    td::before { content: attr(data-label); color: #8fdab9; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
    .inline-form { grid-template-columns: 1fr; }
}
