:root { font: 14px/1.5 "Segoe UI", system-ui, sans-serif; color: #172933; background: #eef3f4; --line: #d2dfe1; --muted: #4b626a; --accent: #075f59 }
* { box-sizing: border-box }
body { margin: 0 }
[hidden] { display: none !important }
.shell { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); min-height: 100vh }
.sidebar { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; min-height: 100vh; border-right: 1px solid #253d46; background: #122831; color: #eff7f7 }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.45rem 1.3rem 1.1rem; font-size: .98rem; font-weight: 750; letter-spacing: .04em }
.brand small { display: block; color: #b4c9cb; font-size: .83rem; letter-spacing: 0; font-weight: 400 }
.sidebar nav { display: grid; padding: .35rem 0 }
.sidebar nav a { display: block; border: 0; border-left: 3px solid transparent; border-radius: 0; padding: .64rem 1.1rem; background: transparent; color: #d7e7e8; text-decoration: none }
.sidebar nav a:hover { background: #23424b }
.sidebar nav a[aria-current=page] { border-left-color: #69e1c3; background: #203e47; color: #fff; font-weight: 650 }
.account { margin-top: auto; border-top: 1px solid var(--line); padding: .9rem 1.15rem; display: grid; justify-items: start; gap: .6rem }
.shell main { width: 100%; max-width: 95rem; padding: 2rem clamp(1rem, 3.5vw, 3.2rem) 3rem }
h1 { margin: 0 0 1rem; font-size: clamp(1.6rem, 2.7vw, 2.1rem); line-height: 1.2; letter-spacing: -.035em }
h2 { font-size: 1.05rem; margin: 0 }
.group { margin: 1rem 0 0 }
.group > header, .card > header, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem }
.group > header, .card > header { justify-content: space-between }
.group > header { margin-bottom: .7rem }
.card > header { padding-bottom: .75rem }
.actions { margin-bottom: .65rem; align-items: end }
.actions small { margin-left: auto; align-self: center; color: var(--muted) }
button, .actions a, .group > header a { display: inline-block; font: inherit; font-weight: 550; background: #fff; color: #283848; border: 1px solid #bfc6cf; border-radius: 4px; padding: .38rem .7rem; text-decoration: none; cursor: pointer }
button:hover:not(:disabled), .actions a:hover { background: #f0f2f5 }
button[type=submit], button.primary { background: var(--accent); border-color: var(--accent); color: #fff }
button[type=submit]:hover:not(:disabled), button.primary:hover:not(:disabled) { background: #064a45 }
button:disabled { opacity: .5; cursor: default }
button.danger { color: #8e2929 }
:focus-visible { outline: 2px solid #07867b; outline-offset: 2px }
#status { min-height: 1.4em; margin: 0 0 .3rem; color: var(--muted) }
#status.error, .login-card p { color: #962a2a }
.card { padding: .95rem 1.05rem; margin-bottom: .85rem; border: 1px solid var(--line); border-radius: .75rem; background: white }
.card p { margin: .45rem 0 .65rem }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,12rem),1fr)); border: 1px solid var(--line); background: white }
.metrics div { padding: .8rem 1rem; border-right: 1px solid var(--line) }
.metrics div:last-child { border-right: 0 }
.metrics strong, .metrics span { display: block }
.metrics strong { font-size: 1.65rem; font-variant-numeric: tabular-nums }
.metrics span { color: var(--muted) }
.fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr)); gap: .85rem; margin-bottom: .55rem }
.fields .network-list { grid-column: 1 / -1 }
.network-toolbar, .network-navigation, .network-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem }
.network-toolbar input { flex: 1 1 13rem; max-width: 22rem }
.isp-search { margin-bottom: .75rem }
.isp-card { padding: 0; margin-bottom: .45rem }
.isp-summary { padding: .62rem .85rem; cursor: pointer; overflow-wrap: anywhere }
.isp-summary [data-isp-network-count] { margin-inline-start: .65rem; white-space: nowrap }
.isp-card[open] .isp-summary { border-bottom: 1px solid var(--line) }
.isp-fields { padding: .75rem .85rem 0 }
.isp-card > button { margin: 0 .85rem .75rem }
.network-navigation { justify-content: space-between; margin-top: .45rem }
.network-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); gap: .35rem; list-style: none; margin: .55rem 0 0; padding: 0 }
.network-grid li { display: flex; gap: .35rem; padding: .2rem; border: 1px solid var(--line); border-radius: .35rem; background: #f7f9fb; min-width: 0 }
.network-grid li input { padding: .25rem .4rem; border-color: transparent; background: transparent; font-family: ui-monospace, Consolas, monospace; font-size: .92rem }
.network-grid li input:focus { background: white }
.network-grid li button, .network-pagination button { padding: .24rem .55rem; font-size: .9rem }
.operation-card summary { cursor: pointer; font-weight: 650 }
.operation-fields, .operation-actions { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem .8rem; margin-top: .65rem }
.operation-fields label { flex: 1 1 13rem; max-width: 22rem }
.operation-list { list-style: none; padding: 0; margin: 0 }
#bind-preview { width: min(56rem, calc(100% - 2rem)); max-height: calc(100% - 2rem); border: 1px solid var(--line); border-radius: .75rem; padding: 1.25rem }
#bind-preview::backdrop { background: #10283190 }
.dialog-actions { justify-content: end }
label { display: grid; gap: .25rem; font-weight: 550 }
label.check { display: flex; align-items: center }
input, textarea, select { width: 100%; min-width: 0; padding: .4rem .55rem; font: inherit; font-weight: 400; border: 1px solid #adb6c1; border-radius: 4px; background: white; color: inherit }
input[type=checkbox], input[type=color] { width: auto }
textarea { min-height: 6rem; resize: vertical }
.preview { border-top: 4px solid var(--accent); padding: 1.25rem; background: #f5f9fa; overflow-wrap: anywhere }
.preview p { white-space: pre-wrap }
.preview img { display: block; max-width: min(160px,100%); max-height: 80px; object-fit: contain; margin-bottom: .65rem }
.table-wrap { overflow-x: auto; margin: .45rem 0 .8rem }
.table-wrap table { width: 100%; border-collapse: collapse; text-align: left }
.table-wrap th { background: #e9f1f1; color: #394551; font-weight: 650 }
.table-wrap th, .table-wrap td { border-bottom: 1px solid var(--line); padding: .44rem .55rem; vertical-align: middle; overflow-wrap: anywhere }
.table-wrap td > input[type=text] { min-width: 7rem }
.table-wrap > button { margin-top: .55rem }
.inventory-note { padding-left: .55rem; border-left: 2px solid #a57020; color: #694717 }
#inventory-server { min-width: 12rem }
.monitor-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,15rem),1fr)); border-top: 1px solid var(--line) }
.metric-chart { margin: 0; padding: .65rem .9rem .15rem; border-right: 1px solid var(--line) }
.metric-chart:last-child { border-right: 0 }
.metric-chart figcaption, .sample-time, #monitor-notice, #inventory-status { color: var(--muted) }
.metric-chart strong { display: block; margin: .2rem 0 .4rem; font-size: 1.4rem; font-variant-numeric: tabular-nums }
.metric-chart canvas { display: block; width: 100%; height: auto }
.ssh-status { font-weight: 650; font-size: .9rem }
.ssh-status::before { content: ""; display: inline-block; margin-right: .38rem; width: .53rem; height: .53rem; border-radius: 50%; background: currentColor }
.ssh-ok { color: #186142 }
.ssh-pending { color: #825418 }
.login { display: grid; place-items: center; min-height: 100vh; padding: 1rem }
.login-card { width: min(100%,25rem); border: 1px solid var(--line); border-radius: 4px; background: white; padding: clamp(1.2rem,6vw,2rem) }
.login-card form { display: grid; gap: .85rem }
.login-card h1 { font-size: 1.35rem }
.login-card p { margin: 0 }
.login-card .mark { display: none }
@media (max-width: 730px) {
  .shell { display: block }
  .sidebar { position: static; min-height: auto; border-right: 0; border-bottom: 1px solid var(--line) }
  .sidebar nav { display: flex; flex-wrap: wrap }
  .sidebar nav a { padding: .4rem .7rem }
  .account { display: flex; align-items: center; justify-content: space-between }
}

.rules-detail { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .6rem }
.rules-detail summary { cursor: pointer; font-weight: 650; padding: .35rem 0 }
.rules-detail input { max-width: 32rem; margin: .5rem 0 }
.inventory-failure { border-left: 3px solid #a96523 }
.table-wrap tbody tr:nth-child(even) { background: #f7f9fb }
.table-wrap tbody tr:focus-within { background: #eaf6f3 }
.shell main > h1 { border-bottom: 1px solid var(--line); padding-bottom: .75rem }

.brand-mark { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: .55rem; background: #82e0c8; color: #0c302b; font-size: 1rem }
.account { border-top-color: #365057 }
#editor > .actions { padding: .75rem .85rem; background: white; border: 1px solid var(--line); border-radius: .65rem }
#status:empty { min-height: 0 }
#status:not(:empty) { padding: .3rem .2rem }
.metrics { overflow: hidden; border-radius: .75rem }
.metrics strong { color: var(--accent); font-size: 1.9rem }
.portal-layout { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 1.5rem }
.portal-editor { display: grid; gap: .65rem; min-width: 0 }
.message-editor { min-width: 0; margin: .25rem 0; border: 1px solid var(--line); border-radius: .65rem; padding: .7rem }
.message-editor legend { padding: 0 .35rem; font-weight: 650 }
.paragraph-row { display: grid; gap: .4rem; margin-bottom: .7rem }
.paragraph-row textarea { min-height: 4.5rem }
.paragraph-toolbar { display: flex; align-items: end; gap: .4rem; flex-wrap: wrap }
.paragraph-toolbar label { font-size: .8rem; color: var(--muted) }
.paragraph-toolbar button { font-size: .84rem; min-height: 2.2rem }
.paragraph-toolbar .danger { margin-left: auto }
.portal-preview { border-radius: .65rem; box-shadow: 0 6px 18px #12283114 }
.portal-preview h2 { font-size: 1.45rem; line-height: 1.2 }
.portal-preview p { margin-bottom: 0; line-height: 1.6 }
@media (max-width: 940px) {
  .portal-layout { grid-template-columns: minmax(0, 1fr) }
}

.portal-section-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
#portal-catalog { max-width: 68rem; }
#portal-catalog .table-wrap { border: 1px solid var(--line); border-radius: .65rem; background: white; }
#portal-catalog td:first-child { width: 29%; }
#portal-catalog td { padding: .64rem .8rem; }
.portal-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.portal-default-label { display: block; color: var(--muted); font-size: .82rem; }
#portal-back { margin-bottom: .8rem; }
#portal-workspace .portal-preview { position: sticky; top: 1rem; }
#portal-workspace [name=accessNetworks] { min-height: 4.5rem; }
.portal-legal-editor { display: grid; gap: .6rem; }
.portal-legal-editor .sample-time { margin: 0; }
.portal-legal-details, .portal-resources { margin-top: 1.15rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.portal-legal-details div { margin-bottom: .4rem; }
.portal-legal-details dt { font-weight: 650; }
.portal-legal-details dd { margin: 0; }
.portal-resources h3 { margin: 0; font-size: 1rem; }
