/* Shared visual system for every coromesh section. */
:root {
  --portal-bg: #f4f6f8;
  --portal-surface: #fff;
  --portal-ink: #172b2a;
  --portal-muted: #667487;
  --portal-line: #e1e7ec;
  --portal-green: #24634d;
  --portal-green-dark: #174a3a;
  --portal-green-soft: #edf5ef;
  --portal-shadow: 0 1px 2px rgb(20 36 58 / 5%), 0 5px 16px rgb(20 36 58 / 3%);
}

html, body { background: var(--portal-bg); color: var(--portal-ink); }
body { font-size: 15px; }
button, input, select, textarea { font: inherit; }
button, .button, a { transition: color .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
:focus-visible { outline: 3px solid #78aa91 !important; outline-offset: 2px; }

.sidebar {
  z-index: 5;
  display: flex;
  flex-direction: column;
  padding: 24px 12px 16px;
  background: #fff;
  border-right: 1px solid var(--portal-line);
  box-shadow: 2px 0 10px rgb(20 36 58 / 2%);
}
.brand { color: var(--portal-ink); font-size: 1.55rem; font-weight: 750; letter-spacing: -.055em; padding: 4px 12px 26px; }
.sidebar nav { display: grid; gap: 4px; margin: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #46566a;
  font-size: .88rem;
  font-weight: 550;
  text-align: left;
}
.nav-item > span { width: 18px; color: #8492a3; font-size: 1.08rem; text-align: center; }
.nav-item:hover { background: #f5f7f8; color: var(--portal-ink); }
.nav-item.active { background: #edf5e8; color: #316a22; font-weight: 650; }
.nav-item.active > span { color: #397d27; }
.nav-item b { margin-left: auto; min-width: 20px; border-radius: 6px; background: #e8efe7; color: #53715d; font-size: .7rem; text-align: center; }
.sidebar-bottom { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid #edf0f3; }
.edition { color: #66805e; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; }
.edition small { display: block; margin: 7px 0 14px; color: #8a96a5; font-size: .68rem; letter-spacing: 0; text-transform: none; }
.pulse { background: #54a96b; }
.logout { width: 100%; padding: 9px 0; border: 0; background: transparent; color: #657386; text-align: left; }
.logout:hover { color: #b4443b; }

main { background: var(--portal-bg); }
.topbar { position: sticky; top: 0; z-index: 4; height: 60px; padding: 0 32px; border-bottom: 1px solid var(--portal-line); background: rgb(255 255 255 / 96%); color: #334357; backdrop-filter: blur(12px); }
.topbar > div:first-child { font-size: .84rem; font-weight: 600; }
.topbar-right { color: var(--portal-muted); gap: 14px; }
.topbar-right #current-user { font-size: .82rem; }
.version { color: #8b97a6; font-size: .7rem; }
.content { padding: 34px clamp(20px, 3.2vw, 52px) 48px; }
.page-heading { align-items: center; gap: 24px; margin: 0 0 22px; }
.page-heading h1 { margin: 7px 0 6px; color: var(--portal-ink); font-size: clamp(1.7rem, 2.3vw, 2.1rem); font-weight: 700; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: #667487; font-size: .9rem; }
.eyebrow { color: #587269; font-size: .67rem; font-weight: 700; letter-spacing: .12em; }

.panel, .section-help, .login-card, .routing-device-card, .guide-card, .settings-card {
  border-color: var(--portal-line);
  border-radius: 10px;
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow);
}
.panel { color: var(--portal-ink); }
.panel-heading { gap: 18px; padding: 19px 22px; }
.panel-heading h2, .panel-heading h3 { color: var(--portal-ink); font-size: .98rem; font-weight: 650; letter-spacing: -.015em; }
.panel-heading p { margin-top: 4px; color: var(--portal-muted); font-size: .78rem; line-height: 1.5; }
.section-help { margin: 0 0 22px; padding: 15px 18px; border: 1px solid #d4e5d9; border-left: 4px solid #4b8065; background: #f0f6f1; color: #375846; font-size: .82rem; }
.section-help p { margin: 0; }
.section-help details { margin-top: 8px; }
.section-help summary { color: var(--portal-green); font-weight: 650; }

.button, button.button, .icon-button, .routing-tab, .nav-item {
  font-family: inherit;
}
.button { min-height: 38px; padding: 9px 14px; border-radius: 7px; font-size: .8rem; font-weight: 600; }
.button.primary { border: 1px solid var(--portal-green); background: var(--portal-green); color: #fff; box-shadow: 0 1px 1px rgb(14 50 36 / 8%); }
.button.primary:hover { border-color: var(--portal-green-dark); background: var(--portal-green-dark); transform: translateY(-1px); }
.button.secondary, .icon-button { border: 1px solid #d8e0e7; background: #fff; color: #42566a; }
.button.secondary:hover, .icon-button:hover { border-color: #9eb8a8; background: #f6faf7; color: var(--portal-green-dark); }
.button.danger { border-color: #a43f3b; background: #a43f3b; color: #fff; }
.button.danger:hover { border-color: #87312e; background: #87312e; color: #fff; }
.button.secondary.danger-text { color: #963b30; }
.button.secondary.danger-text:hover { border-color: #963b30; background: #fff3f2; color: #87312e; }
.delete-button { color: #b54b45; }
.text-button, .dashboard-text-link { color: var(--portal-green); }

input, select, textarea {
  border: 1px solid #d6dee6;
  border-radius: 7px;
  background-color: #fff;
  color: #26384a;
  box-shadow: inset 0 1px 1px rgb(20 36 58 / 2%);
}
input::placeholder, textarea::placeholder { color: #8592a1; opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: #aebdc9; }
input:focus, select:focus, textarea:focus { border-color: #579171; box-shadow: 0 0 0 3px rgb(66 132 96 / 13%); outline: 0; }
label, legend { color: #46596c; font-size: .8rem; font-weight: 600; }
label small { color: #718093; font-weight: 400; }

.table-scroll { border-top: 1px solid #edf0f3; }
.table-scroll table { border-collapse: separate; border-spacing: 0; }
.table-scroll th { position: sticky; top: 0; background: #eef3f0; color: #536c61; font-size: .66rem; font-weight: 700; letter-spacing: .045em; }
.table-scroll td { border-bottom-color: #edf0f3; color: #334456; font-size: .8rem; }
.table-scroll tbody tr:hover td { background: #f8faf9; }
.table-scroll td small { color: #778597; }
.table-footer { border-top: 1px solid #edf0f3; color: #778597; font-size: .72rem; }
.site-link-usage { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 20px 16px; padding: 14px 16px; border: 1px solid #dfe8e2; border-radius: 8px; background: #f8faf9; }
.site-link-usage-copy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.site-link-usage-icon { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 8px; background: #eaf3ec; color: #3d7658; font-size: 1.35rem; }
.site-link-usage-copy strong { color: #2d4438; font-size: .82rem; }
.site-link-usage-copy p { margin: 3px 0 0; color: #718093; font-size: .72rem; }
.site-link-usage-capacity { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 9px; min-width: 210px; color: #657487; font-size: .7rem; }
.site-link-usage-capacity > strong { color: #294a3a; font-size: 1.1rem; }
.site-link-usage-capacity > strong small { color: #8290a0; font-size: .73rem; font-weight: 500; }
.site-link-usage-capacity > span { text-align: right; }
.site-link-usage-meter { grid-column: 1 / -1; height: 5px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #e4ebe6; }
.site-link-usage-meter i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: #4a9068; }
.filters { gap: 9px; }
.filters input, .filters select { font-size: .78rem; }
.table-heading { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, auto); align-items: center; gap: 20px; }
.table-heading > div:first-child { min-width: 0; }
.table-heading .filters { display: grid; grid-template-columns: minmax(180px, 205px) minmax(150px, 170px) minmax(150px, 170px); align-items: center; flex-wrap: nowrap; }
.table-heading .filters input, .table-heading .filters select { width: 100%; max-width: none; min-width: 0; }
.count, .tag, .vrf-pill { border-color: #dce7df; border-radius: 5px; background: #eff5f0; color: #557260; font-size: .68rem; }
.status { color: #557260; }
.status.stale { color: #a36e18; }
.empty-cell { color: #718093; }
.empty-cell b { color: #354d42; }

.notice { border-color: #f0d9ad; border-radius: 7px; background: #fff8e9; color: #73551b; font-size: .8rem; }
.error { color: #b3423c !important; font-size: .8rem; }
.toast { border: 1px solid #d4e4d9; border-radius: 8px; background: #fff; color: #254d3a; box-shadow: 0 8px 28px rgb(20 36 58 / 16%); font-size: .85rem; }
.activity-item { border-color: #edf0f3; color: #455a4f; font-size: .82rem; }
.activity-item .activity-icon { border-color: #dce7df; color: #52745f; }
.activity-item time, .activity-empty { color: #778597; }
.vrf-card { border-color: var(--portal-line); border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgb(20 36 58 / 4%); }
.vrf-card h3 { color: var(--portal-ink); font-weight: 650; }
.vrf-card dt { color: #778597; }
.login { background: radial-gradient(ellipse at top left, #e5efe7, transparent 68%), #f3f6f8; }
.login-card { border: 1px solid var(--portal-line); }
.login-card h1 { color: var(--portal-ink); }
.login-card > p { color: var(--portal-muted); }
.login-card small { color: #8290a0; font-size: .72rem; }

dialog { border: 1px solid #dce3e8; border-radius: 12px; background: #fff; color: var(--portal-ink); box-shadow: 0 24px 80px rgb(17 34 47 / 24%); }
dialog::backdrop { background: rgb(18 35 43 / 48%); backdrop-filter: blur(3px); }
.dialog-heading h2, .dialog-heading h3 { color: var(--portal-ink); font-weight: 700; }
.dialog-actions { border-color: #e8edf0; }
.config-dialog pre { border: 1px solid #263c3a; border-radius: 8px; background: #152b2a; }
.site-test-run, .site-test-direction, .routing-device-card { border-radius: 8px; }
.routing-tabs { margin: 4px 22px 18px; padding: 0 0 10px; }
.routing-intro { padding: 0 22px; }
.routing-device-list { padding: 0 22px 22px; }
#vrf-section { padding: 0 0 22px; }
#vrf-section > .panel-heading { padding: 19px 22px; }
.topology-tools .tag { padding: 6px 9px; }

@media (max-width: 850px) {
  .sidebar { padding-inline: 9px; }
  .brand { color: transparent; }
  .nav-item { color: #526175; }
  .nav-item.active { color: #316a22; }
}
@media (max-width: 700px) {
  .topbar { padding-inline: 16px; }
  .content { padding: 24px 16px 36px; }
  .page-heading { align-items: flex-start; }
  .panel-heading { padding: 16px; }
  .dashboard-health-summary { white-space: normal; }
  .site-link-usage { align-items: stretch; flex-direction: column; gap: 12px; margin-inline: 12px; }
  .site-link-usage-capacity { min-width: 0; }
  .table-heading { grid-template-columns: minmax(0, 1fr); }
  .table-heading .filters { grid-template-columns: minmax(0, 1fr); width: 100%; }
  .routing-tabs { margin-inline: 14px; }
  .routing-intro { padding-inline: 14px; }
  .routing-device-list { padding-inline: 14px; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .table-heading { grid-template-columns: minmax(0, 1fr); }
  .table-heading .filters { grid-template-columns: minmax(180px, 1.2fr) repeat(2, minmax(150px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  button, .button, a { transition: none; }
}

#mfa-enrollment { margin-block: 16px; }
#mfa-qr { display: block; max-width: 100%; height: auto; margin: 0 auto 12px; border-radius: 8px; }
#mfa-secret { display: block; padding: 10px; background: #eef3f0; overflow-wrap: anywhere; user-select: all; }
#mfa-form .button, #mfa-recovery .button { width: 100%; margin-top: 10px; }
#mfa-recovery-codes { padding: 14px; background: #eef3f0; color: #172b2a; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
