.modern-view {
  --modern-ink: #252e2b;
  --modern-muted: #64716d;
  --modern-line: #e1e8e4;
  --modern-green: #16826b;
  color: var(--modern-ink);
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
}
.modern-view *, .modern-view *::before, .modern-view *::after { box-sizing: border-box; letter-spacing: 0; }
.modern-view .page-heading { margin-bottom: 24px; gap: 16px; align-items: center; }
.modern-view h1 { font-size: 26px; line-height: 1.25; }
.modern-view h2 { font-size: 17px; line-height: 1.4; }
.modern-view h3 { font-size: 14px; }
.modern-view p, .modern-view h1, .modern-view h2, .modern-view h3 { overflow-wrap: anywhere; }
.modern-view small { display: block; font-size: 11px; color: var(--modern-muted); overflow-wrap: anywhere; }
.modern-view .muted, .modern-view .help-line { color: var(--modern-muted); }
.modern-view .help-line { font-size: 12px; margin: 12px 0; overflow-wrap: anywhere; }
.modern-band { background: #fff; border-block: 1px solid var(--modern-line); padding: 22px 20px; margin: 20px 0; min-width: 0; }
.modern-band > .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.modern-band .section-band { box-shadow: none; border-radius: 0; border-inline: 0; padding-inline: 0; }
.modern-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--modern-line); background: #fff; }
.modern-metrics .metric { min-width: 0; padding: 18px 20px; box-shadow: none; border: 0; border-right: 1px solid var(--modern-line); border-radius: 0; background: transparent; }
.modern-metrics .metric:last-child { border-right: 0; }
.modern-metrics > .metric:not(:last-child), .modern-metrics > .modern-metric-link:not(:last-child) { border-right: 1px solid var(--modern-line); }
.modern-metric-link { display: block; min-width: 0; color: inherit; text-decoration: none; }
.modern-metric-link:hover { background: #f3faf6; }
.modern-metric-link .metric { height: 100%; }
.modern-metrics .metric-head { display: flex; justify-content: space-between; gap: 10px; color: var(--modern-muted); font-size: 12px; }
.modern-metrics .metric-value { font-size: 24px; line-height: 1.35; margin: 9px 0 5px; overflow-wrap: anywhere; }
.modern-metrics .metric-foot { color: var(--modern-muted); font-size: 11px; overflow-wrap: anywhere; }
.modern-view svg, .modern-view i[data-lucide] { width: 18px; height: 18px; flex: 0 0 18px; }
.modern-view button { border-radius: 4px; max-width: 100%; }
.modern-view button:disabled { cursor: not-allowed; opacity: .55; }
.modern-view .icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; min-width: 34px; padding: 0; flex: 0 0 34px; }
.modern-view .button { white-space: normal; overflow-wrap: anywhere; }
.modern-view .button.primary { background: var(--modern-green); border-color: var(--modern-green); }
.modern-view :is(button, input, select, summary):focus-visible { outline: 2px solid var(--modern-green); outline-offset: 3px; }
.modern-view .actions, .modern-view .row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.modern-view .toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.modern-view label { min-width: 0; font-size: 12px; color: var(--modern-muted); }
.modern-view input, .modern-view select { max-width: 100%; min-width: 0; border: 1px solid #d6dfda; border-radius: 4px; min-height: 34px; padding: 6px 9px; background: #fff; color: var(--modern-ink); font: inherit; }
.modern-view label > :is(input, select) { display: block; width: 100%; margin-top: 5px; }
.modern-view .notice { overflow-wrap: anywhere; }
.modern-view .gateway-table { border-radius: 0; box-shadow: none; min-width: 0; margin-top: 14px; }
.modern-view .gateway-table .data-table-scroll { max-height: 440px; min-height: 0; overscroll-behavior: contain; }
.modern-view .gateway-table td { max-width: 360px; overflow-wrap: anywhere; }
.modern-view .gateway-table td strong { display: block; }
.modern-view .gateway-table .grid-search input { margin-top: 0; }
.modern-view .gateway-table .grid-column-option input { min-height: auto; width: auto; }
.modern-view details > summary { cursor: pointer; color: var(--modern-muted); }
.modern-network { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--modern-line); }
.modern-network > :is(div, a) { min-width: 0; padding: 18px; display: grid; grid-template-columns: 24px minmax(0, 1fr); column-gap: 10px; align-content: start; border-right: 1px solid var(--modern-line); color: inherit; text-decoration: none; }
.modern-network > :last-child { border-right: 0; }
.modern-network > a:hover { background: #f3faf6; }
.modern-view a:focus-visible { outline: 2px solid var(--modern-green); outline-offset: 2px; }
.modern-network svg { color: var(--modern-green); grid-row: span 4; margin-top: 2px; }
.modern-network strong { font-size: 14px; overflow-wrap: anywhere; }
.modern-network small { margin-top: 4px; }
.modern-channels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 14px 0 8px; }
.modern-channel { min-width: 0; padding: 10px 14px; border-right: 1px solid var(--modern-line); }
.modern-channel:last-child { border-right: 0; }
.modern-channel > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modern-channel .badge { font-size: 10px; }
.modern-channel small { margin-top: 5px; }
.modern-safety { margin: 14px 0; font-size: 12px; }
.modern-safety > summary { overflow-wrap: anywhere; }
.modern-wan-counters > div { display: flex; flex-wrap: wrap; align-items: start; gap: 12px; padding: 10px 0; }
.modern-wan-counters .modern-counter { display: inline-block; }
.modern-storage-summary { display: flex; gap: 20px; flex-wrap: wrap; }
.modern-storage-summary > div { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.modern-cameras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.modern-camera { min-width: 0; }
.modern-camera > strong { font-size: 12px; }
.modern-camera-frame { aspect-ratio: 16 / 9; max-height: 190px; margin-top: 8px; background: #f2f5f3; border: 1px solid var(--modern-line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px; text-align: center; overflow-wrap: anywhere; color: var(--modern-muted); font-size: 12px; }
.modern-owner-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.modern-owner { min-width: 0; border: 1px solid var(--modern-line); border-radius: 6px; padding: 16px; background: #fff; }
.modern-owner-heading { display: grid; grid-template-columns: 20px minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
.modern-owner-heading > svg { color: var(--modern-green); }
.modern-owner-heading strong { overflow-wrap: anywhere; }
.modern-owner p { margin: 12px 0 3px; font-size: 18px; }
.modern-unavailable { display: grid; grid-template-columns: minmax(100px, .6fr) minmax(0, 1fr) 34px; gap: 14px; align-items: center; border-bottom: 1px solid var(--modern-line); padding: 13px 0; font-size: 12px; }
.modern-unavailable :is(strong, span) { overflow-wrap: anywhere; min-width: 0; }
.modern-unavailable span { color: var(--modern-muted); }
.modern-counter { display: block; font-variant-numeric: tabular-nums; }
.modern-counter small { font-size: 10px; }
.modern-traffic-filter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 12px; margin-bottom: 16px; }
.modern-traffic-filter > .button { justify-self: start; }
.modern-view .draft-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
/* Routes reuse the shared grid without changing the legacy technical tables. */
main:has(> .modern-routes) { width: 100%; max-width: none; min-width: 0; }
.modern-routes { width: 100%; min-width: 0; }
.modern-routes [data-routes-table] { width: 100%; min-width: 0; }
.modern-routes [data-routes-table] .gateway-table { width: 100%; max-width: 100%; margin: 0; border: 0; }
.modern-routes [data-routes-table] .grid-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 30px; padding: 3px 0; margin: 0; }
.modern-routes [data-routes-table] .grid-toolbar > h2 { margin: 0; font-size: 14px; line-height: 24px; white-space: nowrap; }
.modern-routes [data-routes-table] .grid-count, .modern-routes .routes-snapshot { font-size: 10px; line-height: 24px; color: var(--modern-muted); }
.modern-routes [data-routes-table] .grid-columns { margin: 0; flex-shrink: 0; }
.modern-routes [data-routes-table] .grid-columns > summary { width: 38px; height: 25px; padding: 0; }
.modern-routes [data-routes-table] .grid-columns-menu { top: 29px; max-width: calc(100vw - 48px); }
.modern-routes [data-routes-table] .data-table-scroll { width: 100%; max-width: 100%; min-width: 0; height: clamp(240px, calc(100dvh - 215px), 1600px); max-height: none; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; overflow-anchor: none; }
.modern-routes [data-routes-table] table { width: max-content; min-width: 100%; table-layout: auto; }
.modern-routes [data-routes-table] thead th { height: 28px; padding: 3px 7px; font-size: 11px; white-space: nowrap; }
.modern-routes [data-routes-table] .grid-sort { gap: 4px; min-height: 20px; }
.modern-routes [data-routes-table] .grid-filters th { height: 27px; padding: 2px 7px 4px; }
.modern-routes [data-routes-table] .grid-filters input { min-width: 48px; min-height: 22px; height: 22px; margin: 0; padding: 2px 5px; font-size: 10px; }
.modern-routes [data-routes-table] tbody tr { height: 30px; }
.modern-routes [data-routes-table] tbody td { height: 30px; max-width: 240px; padding: 1px 7px; font-size: 12px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; vertical-align: middle; }
.modern-routes .routes-cell { display: block; width: 130px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modern-routes .routes-domain { width: 190px; font-weight: 600; }
.modern-routes .routes-time { width: 140px; font-variant-numeric: tabular-nums; }
.modern-routes :is(.routes-egress, .routes-count) { width: 60px; font-variant-numeric: tabular-nums; }
.modern-routes :is(.routes-error, .routes-pending, .routes-draft, .routes-source) { width: 180px; }
.modern-routes .routes-tone-active { color: #16724f; }
.modern-routes .routes-tone-neutral { color: var(--modern-muted); }
.modern-routes .routes-tone-pending { color: #94681a; }
.modern-routes [data-routes-table] :is(svg, i[data-lucide]) { width: 15px; height: 15px; }
.modern-routes [data-routes-table] .icon-button, .modern-routes .routes-pagination .icon-button { width: 25px; height: 25px; min-width: 25px; min-height: 25px; padding: 0; }
.modern-routes [data-routes-table] .row-actions { flex-wrap: nowrap; gap: 3px; }
.modern-routes .routes-pagination { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; padding-block: 4px; margin: 0; font-size: 11px; }
.modern-routes .routes-interval { margin: 2px 0; font-size: 11px; }
.modern-routes .routes-library-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.modern-routes .routes-library-actions .button { min-height: 28px; padding: 3px 8px; font-size: 11px; }
.modern-routes .routes-actions-menu { position: relative; margin: 0; }
.modern-routes .routes-actions-menu > summary { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; list-style: none; cursor: pointer; border: 1px solid var(--modern-line); border-radius: 4px; }
.modern-routes .routes-actions-menu > summary::-webkit-details-marker { display: none; }
.modern-routes .routes-actions-popover { position: absolute; top: 32px; right: 0; z-index: 12; display: flex; flex-direction: column; gap: 4px; width: 205px; max-width: calc(100vw - 48px); padding: 6px; background: var(--modern-surface, #fff); border: 1px solid var(--modern-line); border-radius: 4px; box-shadow: 0 4px 14px #0002; }
.modern-routes .routes-actions-popover .button { justify-content: flex-start; width: 100%; }
.modern-routes .routes-pending-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.modern-routes .routes-pending-status > span { flex: 1; min-width: 0; }
.routes-change-review { min-width: 0; }
dialog:has(.routes-change-review) { width: min(1000px, calc(100vw - 32px)); max-width: calc(100vw - 32px); }
.routes-change-review .gateway-table { margin: 8px 0 16px; border-radius: 4px; }
.routes-change-review .grid-toolbar { min-height: 28px; padding: 2px 12px; margin: 0; }
.routes-change-review .data-table-scroll { max-height: 35dvh; overflow: auto; }
.routes-change-review :is(th, td) { height: 30px; padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.routes-change-review .grid-filters input { height: 24px; min-height: 24px; }
.routes-change-review h3 { font-size: 14px; margin: 12px 16px 6px; }
.routes-change-review > p { margin: 12px 16px; }
.routes-change-review .notice { margin: 8px 16px; }
.routes-change-review .notice.success, .modern-routes .notice.success { color: #16724f; border-color: #68aa88; background: #eff8f2; }
dialog:has(.routes-change-review) .dialog-footer { flex-wrap: wrap; gap: 6px; }
@media (max-width: 1100px) {
  .modern-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modern-metrics > .metric:nth-child(2), .modern-metrics > .modern-metric-link:nth-child(2) { border-right: 0; }
  .modern-metrics > :nth-child(-n+2) { border-bottom: 1px solid var(--modern-line); }
}
@media (max-width: 700px) {
  .modern-routes .routes-library-actions { position: relative; width: 100%; gap: 4px; }
  .modern-routes .routes-library-actions .button { padding-inline: 6px; }
  .modern-routes .routes-actions-menu { position: static; }
  .modern-routes .routes-actions-popover { top: calc(100% + 4px); right: 0; }
  .modern-view h1 { font-size: 23px; }
  .modern-band { padding: 18px 14px; margin-block: 16px; }
  .modern-metrics .metric { padding: 14px 10px; }
  .modern-metrics .metric-value { font-size: 21px; }
  .modern-network { grid-template-columns: 1fr; }
  .modern-network > :is(div, a) { border-right: 0; border-bottom: 1px solid var(--modern-line); padding: 14px 0; }
  .modern-network > :last-child { border-bottom: 0; }
  .modern-channel { padding-inline: 8px; }
  .modern-cameras { gap: 10px; }
  .modern-camera-frame { padding: 10px 6px; gap: 4px; width: 100%; min-width: 0; aspect-ratio: auto; height: 108px; }
  .modern-camera-frame small { font-size: 10px; }
  .modern-traffic-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modern-view .gateway-table .data-table-scroll { max-height: 360px; }
  .modern-view .gateway-table .grid-toolbar { gap: 8px; flex-wrap: wrap; }
  .modern-view .gateway-table .grid-search { min-width: 100px; flex: 1; }
  .modern-unavailable { grid-template-columns: minmax(0, 1fr) 34px; gap: 6px 12px; }
  .modern-unavailable strong { grid-column: 1; }
  .modern-unavailable span { grid-column: 1; }
  .modern-unavailable button { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 380px) {
  .modern-traffic-filter { grid-template-columns: minmax(0, 1fr); }
  .modern-metrics .metric-value { font-size: 19px; }
}
