/* NetDocs — screen styles. System fonts, no external resources. */
:root {
    --bg: #f5f6f8;
    --panel: #fff;
    --text: #1f2328;
    --muted: #656d76;
    --line: #d8dee4;
    --accent: #0b5cad;
    --accent-bg: #e8f0fb;
    --ok: #1a7f37;
    --ok-bg: #e6f4ea;
    --err: #b42318;
    --err-bg: #fdecea;
    --warn-bg: #fff4d6;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .75rem; }
.muted { color: var(--muted); }

/* frame */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .45rem 1.25rem; background: #17324d; color: #fff;
}
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; letter-spacing: .02em; display: flex; align-items: center; gap: .6rem; }
.topbar .brand-logo { height: 34px; filter: brightness(0) invert(1); }
.login-logo { display: block; height: 72px; margin: 0 auto 1rem; }
.topbar .who { display: flex; gap: 1rem; align-items: center; font-size: .9rem; }
.topbar .link { color: #cfe0f5; }
.shell { display: flex; min-height: calc(100vh - 44px); }
.sidenav { width: 220px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: .75rem 0; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav a { display: block; padding: .4rem 1.25rem; color: var(--text); text-decoration: none; }
.sidenav a:hover { background: var(--bg); }
.sidenav a.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; border-left: 3px solid var(--accent); padding-left: calc(1.25rem - 3px); }
.content { flex: 1; padding: 1.5rem 2rem; min-width: 0; overflow-x: auto; }
.content.narrow { max-width: 420px; margin: 8vh auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1.5rem; }

/* flash */
.flash { padding: .65rem .9rem; border-radius: 4px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: #b7dfc3; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #f5c2bd; }
.flash-info { background: var(--accent-bg); color: var(--accent); border-color: #bcd3f0; }

/* forms */
form.inline { display: inline; margin: 0; }
.field { margin-bottom: .9rem; }
.field label { display: block; font-weight: 600; margin-bottom: .25rem; }
.field input[type=checkbox] + * , .field label input[type=checkbox] { margin-right: .35rem; }
.field .req { color: var(--err); }
.field .hint { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.field .error { color: var(--err); font-size: .85rem; margin-top: .2rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--err); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=search], select, textarea {
    width: 100%; max-width: 32rem; padding: .45rem .55rem; font: inherit;
    border: 1px solid var(--line); border-radius: 4px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.btn {
    display: inline-block; padding: .45rem .9rem; font: inherit; border-radius: 4px; cursor: pointer;
    border: 1px solid var(--line); background: #fff; color: var(--text); text-decoration: none;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #094a8c; }
.btn.danger { color: var(--err); border-color: #f5c2bd; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }

/* tables */
table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #eef1f4; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #fafbfc; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* misc */
.badge { display: inline-block; padding: .05rem .45rem; border-radius: 10px; font-size: .8rem; background: #eef1f4; }
.badge.warn { background: var(--warn-bg); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.pager { display: flex; gap: .25rem; margin: 1rem 0; flex-wrap: wrap; }
.pager a, .pager span { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 4px; background: #fff; text-decoration: none; }
.pager .current { background: var(--accent); color: #fff; border-color: var(--accent); }
.login h1 { text-align: center; }
.login .btn { width: 100%; }
.login input { max-width: none; }

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .sidenav { width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidenav ul { display: flex; flex-wrap: wrap; }
    .content { padding: 1rem; }
}

/* map (/map) */
.map-tools { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-bottom: .75rem; }
.map-tools select { width: auto; }
.map-wrap { display: flex; gap: 1rem; }
#map { flex: 1; height: calc(100vh - 13rem); min-height: 420px; background: #efece6; border: 1px solid var(--line); border-radius: 6px; }
#map.placing { cursor: crosshair; }
.map-side { width: 15rem; flex-shrink: 0; }
.map-side h2 { font-size: 1rem; margin-top: 0; }
.map-side ul { list-style: none; padding: 0; margin: 0; }
.map-side li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.map-side .hint { color: var(--muted); font-size: .85rem; }
.map-sym { display: inline-block; width: .75rem; height: .75rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #777; margin-right: .25rem; vertical-align: -1px; box-sizing: border-box; }
.map-sym-pole { background: #3b2f26; width: .55rem; height: .55rem; border-width: 1px; }
.map-sym-manhole { background: #555; border-radius: 1px; }
.map-sym-wall_mount { background: #e08a00; border-radius: 0; width: .6rem; height: .6rem; transform: rotate(45deg); }
.map-sym-cabinet { background: #9467bd; border-radius: 2px; width: .95rem; height: .7rem; }
.map-sym-building_entry { background: #2ca02c; }
.map-sym-closure { background: #d62728; width: .9rem; height: .9rem; }
.map-sym-box { background: #1f77b4; border-radius: 3px; }
.map-sym-fob { background: #ff7f0e; border-radius: 2px; width: .8rem; height: .8rem; }
.map-sym-pon_box { background: #17becf; border-radius: 2px; width: .9rem; height: .75rem; box-shadow: 0 0 0 1px #0b5f68; }
.map-sym-other { background: #7f7f7f; }
.map-sym.map-ring { box-shadow: 0 0 0 1px #777, 0 0 0 3px #d62728; }
.map-node { display: flex; align-items: center; justify-content: center; }
.map-node .map-sym { margin: 0; }
.map-vertex { background: #fff; border: 2px solid #000; border-radius: 2px; box-sizing: border-box; }
.map-vertex.map-mid { opacity: .45; border-radius: 50%; }
.map-panel { margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 2px solid var(--line); }
.map-panel label { display: block; margin-bottom: .4rem; }
.map-panel [hidden] { display: none; }
.map-confirm input { width: 5.5em; }
.leaflet-tooltip.map-label { background: none; border: 0; box-shadow: none; padding: 0; color: #555; font-size: 11px; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.leaflet-tooltip.map-label::before { display: none; }
.leaflet-tooltip.map-house { color: #888; font-size: 10px; }
.map-assets { margin: .3rem 0 0; padding-left: 1.1rem; }
@media (max-width: 760px) { .map-wrap { flex-direction: column; } .map-side { width: auto; } }

/* fibers: joints, trace, free path */
.fiber-chip { display: inline-block; min-width: 1.5rem; height: 1.5rem; line-height: 1.5rem; border-radius: 50%; border: 1px solid #777; text-align: center; font-size: .75rem; font-weight: 600; margin: 0 .1rem; vertical-align: middle; box-sizing: border-box; }
.fiber-path .fiber-chip, .fiber-path .fiber-chip:empty { min-width: .9rem; height: .9rem; }
.chip-row { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.chip-cable { display: block; font-size: .85rem; color: var(--muted); }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip input:checked + .fiber-chip { outline: 3px solid #000; outline-offset: 1px; }
.chip input:focus-visible + .fiber-chip { outline: 2px dashed #000; }
.chip input:disabled + .fiber-chip { opacity: .25; cursor: not-allowed; }
.joint-cols { display: flex; gap: 1rem; flex-wrap: wrap; }
.joint-cols fieldset { flex: 1; min-width: 18rem; border: 1px solid var(--line); border-radius: 6px; }
.joint-form label { margin-right: .75rem; }
.route-option { margin-bottom: 1.5rem; }
.route-option h2 { margin-top: 0; font-size: 1.1rem; }
tr.path-end td { background: #f7f9fb; }
/* opened closure scheme (fibers/_closure) */
.closure-wrap { overflow-x: auto; margin-bottom: .5rem; }
.closure { max-width: 100%; height: auto; font-family: inherit; }
.closure .cl-body { fill: #f6f7f9; stroke: #9aa3ad; stroke-width: 1.5; }
.closure .cl-cable { stroke: #3b4652; stroke-width: 10; stroke-linecap: round; }
.closure .cl-tube { fill: #fff; stroke: #3b4652; stroke-width: 2.5; }
.closure .cl-name { font-size: 13px; font-weight: 600; fill: #1d2733; }
.closure .cl-side { font-size: 11px; fill: #5b6672; }
.closure .cl-fiber { stroke: #555; stroke-width: 1; }
.closure .cl-no { font-size: 9px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.closure .cl-transit { fill: none; stroke: #b9c0c8; stroke-width: 1.2; stroke-dasharray: 3 3; pointer-events: none; }
.closure .cl-splice { fill: none; stroke: #1d2733; stroke-width: 2; }
.closure .cl-splice:hover { stroke: #e0600f; stroke-width: 3; }
.closure .cl-mark circle { fill: #fff; stroke: #1d2733; stroke-width: 1.5; }
.closure .cl-mark text { font-size: 9px; text-anchor: middle; fill: #5b6672; }
.closure .cl-port { stroke: #1f5fd1; stroke-width: 2; }
.closure .cl-legacy { stroke-dasharray: 4 3; }
.closure .cl-cut { stroke: #d62828; stroke-width: 2; }
.closure .cl-end { font-size: 11px; fill: #1d2733; }
.closure .cl-mod { font-size: 10px; font-weight: 700; fill: #5b6672; }
.chip-mod { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--muted, #667); margin: 0 .2rem 0 .5rem; }
/* devices in a closure + click-to-splice */
.closure-box { position: relative; }
.closure .cl-dev-box { fill: #fff; stroke: #3b4652; stroke-width: 1.5; }
.closure .cl-splitter { fill: #eef8fa; stroke: #0b7285; }
.closure .cl-dev-name { font-size: 12px; font-weight: 700; text-anchor: middle; fill: #1d2733; }
.closure .cl-dport { fill: #fff; stroke: #3b4652; stroke-width: 1.2; }
.closure .cl-dport-busy { fill: #3b4652; }
.closure .cl-dport-no { font-size: 9px; fill: #5b6672; }
.closure .cl-dev-link { stroke: #0b7285; }
.closure .cl-pick { cursor: pointer; }
.closure .cl-pick:hover circle, .closure .cl-pick:hover rect { stroke: #e0600f; stroke-width: 2.5; }
.closure .cl-busy { opacity: .45; }
.closure .cl-sel circle, .closure .cl-sel rect { stroke: #e0600f; stroke-width: 3.5; }
.closure[data-edit] [data-joint] { cursor: pointer; }
.closure .cl-jsel { stroke: #e0600f; stroke-width: 3.5; }
.cl-panel { position: absolute; z-index: 5; min-width: 16rem; max-width: 24rem; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.cl-panel p { margin: .3rem 0; }
.dev-ports { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 30rem; vertical-align: middle; }
.dev-port { display: inline-block; min-width: 1.3rem; font-size: .7rem; text-align: center; border: 1px solid #777; border-radius: 2px; }
.dev-port.busy { background: #3b4652; color: #fff; }
.dev-form label { display: inline-block; margin: 0 .75rem .4rem 0; white-space: nowrap; } .dev-form select, .dev-form input { width: auto; }
/* racks (fibers/joints) */
.racks { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; position: relative; }
.rack { border: 2px solid #3b4652; border-radius: 6px; padding: .4rem; min-width: 20rem; background: #f6f7f9; }
.rack-head { margin-bottom: .3rem; }
.rack-grid { display: grid; grid-template-columns: 2.6rem 1fr; position: relative; font-size: .8rem; }
.rack-grid > div { border: 1px solid #c9ced4; margin: 0 0 -1px -1px; padding: 0 .4rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; line-height: 1.5rem; }
.rack-u { grid-column: 1; color: #5b6672; text-align: right; background: #eceff2; }
.rack-empty { grid-column: 2; background: repeating-linear-gradient(90deg, #fff 0 6px, #f1f3f5 6px 12px); }
.rack-empty[data-unit] { cursor: pointer; } .rack-empty[data-unit]:hover { background: #fff3e6; }
.rack-dev { grid-column: 2; background: #e7f0fb; }
.rack-dev[draggable] { cursor: grab; } .rack-dev.rack-dragging { opacity: .4; }
.rack-splitter { background: #e6f5f2; }
.rack-switch { background: #eef0d8; }
.rack-olt { background: #f6e7f3; }
.rack-grid > .rack-ghost { grid-column: 2; z-index: 3; pointer-events: none; border: 2px dashed #2e9e44; background: rgba(230,246,234,.93); }
.rack-grid > .rack-ghost.bad { border-color: #d62828; background: rgba(253,232,232,.93); color: #a01818; }
.rack-handle { cursor: grab; color: #5b6672; }
.cl-panel [hidden] { display: none; }
.inline-details { display: inline-block; margin-left: .4rem; }
.inline-details summary { cursor: pointer; color: var(--accent, #1f5fd1); font-size: .85rem; }
