:root {
    --bg: #0c1018;
    --panel: #131a26;
    --panel-border: #232c3d;
    --text: #e7ebf2;
    --text-dim: #8b96ab;
    --accent: #4cc9f0;
    --accent-dim: #1c5a72;
    --amber: #e8a458;
    --green: #3ddc97;
    --red: #ff6b6b;
    --mono: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
    --sans: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-bottom: 1px solid var(--panel-border);
    background: linear-gradient(180deg, #0e1420, #0c1018);
}

header.topbar .fiber {
    width: 28px; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 8px var(--accent);
}

header.topbar h1 {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin: 0;
}

header.topbar nav {
    margin-left: auto;
    display: flex;
    font-size: 0.9rem;
}

header.topbar nav a { color: var(--text-dim); margin-left: 1.5rem; }
header.topbar nav a.active { color: var(--accent); }

.nav-dropdown {
    position: relative;
    margin-left: 1.5rem;
}

.nav-dropdown > span {
    color: var(--text-dim);
    cursor: default;
}

.nav-dropdown.active > span { color: var(--accent); }

.nav-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 1.6rem;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    min-width: 160px;
    padding: 0.4rem 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 10;
}

.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content {
    display: block;
}

.nav-dropdown-content a {
    display: block;
    margin-left: 0;
    padding: 0.5rem 1rem;
    color: var(--text);
    font-size: 0.88rem;
}

.nav-dropdown-content a:hover { background: #1a2233; text-decoration: none; }
.nav-dropdown-content a.active { color: var(--accent); }

.page-with-sidebar {
    display: flex;
    align-items: flex-start;
}

.sidebar {
    flex: 0 0 220px;
    min-width: 220px;
    border-right: 1px solid var(--panel-border);
    padding: 1.5rem 1rem 4rem 1.75rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.sidebar-title {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 1rem;
}

.sidebar a {
    display: block;
    color: var(--text-dim);
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 0.88rem;
    margin-bottom: 0.15rem;
}

.sidebar a:hover { background: #1a2233; text-decoration: none; color: var(--text); }
.sidebar a.active { color: var(--accent); background: #16202f; }

.sidebar-subheading {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 1rem 0 0.4rem 0.6rem;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid var(--panel-border);
    margin: 0.75rem 0;
}

.sidebar-group summary {
    cursor: pointer;
    color: var(--text-dim);
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 0.88rem;
    list-style: none;
}

.sidebar-group summary::-webkit-details-marker { display: none; }

.sidebar-group summary::before {
    content: "▸ ";
    display: inline-block;
    width: 1em;
}

.sidebar-group[open] summary::before {
    content: "▾ ";
}

.sidebar-group summary:hover { background: #1a2233; }

.sidebar-group a {
    margin-left: 1rem;
}

.page-with-sidebar > main {
    flex: 1;
    min-width: 0;
}

main {
    max-width: 98vw;
    margin: 0 auto;
    padding: 2rem 1.75rem 4rem;
}

.page-with-sidebar > main {
    max-width: 100%;
    margin: 0;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 0.35rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1.25rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 1.1rem 1.25rem;
    display: block;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.1s ease;
}

.stat-card:hover {
    border-color: var(--accent-dim);
    text-decoration: none;
}

.stat-card .value {
    font-family: var(--mono);
    font-size: 1.9rem;
    font-weight: 500;
    color: var(--accent);
    line-height: 1;
}

.stat-card .label {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    overflow: hidden;
}

th, td {
    text-align: left;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--panel-border);
    font-size: 0.9rem;
}

th {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 500;
    background: #0f1420;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #161e2c; }

.mono { font-family: var(--mono); }

.chip {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: #1a2233;
    border: 1px solid var(--panel-border);
    color: var(--text);
}

.chip.vlan { color: var(--accent); border-color: var(--accent-dim); }
.chip.adaptive { color: var(--amber); }

.section {
    margin-bottom: 2.25rem;
}

.section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--panel-border);
}

.tree {
    font-family: var(--mono);
    font-size: 0.88rem;
}

.tree ul { list-style: none; margin: 0; padding-left: 1.4rem; }
.tree > ul { padding-left: 0; }

.tree li {
    padding: 0.3rem 0;
    border-left: 1px solid var(--panel-border);
    padding-left: 1rem;
    margin-left: -1px;
}

.tree li.root { border-left: none; padding-left: 0; }

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.breadcrumb a { color: var(--text-dim); }

.empty-state {
    padding: 2.5rem;
    text-align: center;
    color: var(--text-dim);
    border: 1px dashed var(--panel-border);
    border-radius: 6px;
}

.timestamp { color: var(--text-dim); font-size: 0.82rem; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.1rem;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field.full { grid-column: 1 / -1; }

.form-field label {
    font-size: 0.78rem;
    color: var(--text-dim);
    letter-spacing: 0.02em;
}

.form-field input, .form-field select {
    background: #0f1420;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 0.5rem 0.65rem;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.9rem;
}

.form-field input:focus, .form-field select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-field .hint { font-size: 0.75rem; color: var(--text-dim); }

.btn {
    display: inline-block;
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.55rem 1.1rem;
    border-radius: 5px;
    border: 1px solid var(--panel-border);
    background: #1a2233;
    color: var(--text);
    cursor: pointer;
}

.btn:hover { text-decoration: none; border-color: var(--accent-dim); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06141c; font-weight: 600; }
.btn-primary:hover { background: #6ad4f2; }
.btn-danger { color: #ff9494; border-color: #5a2c2c; }
.btn-danger:hover { background: #2a1616; border-color: #ff9494; }

.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.row-actions { display: flex; gap: 0.6rem; }
.row-actions form { display: inline; margin: 0; }
.row-actions .btn { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

/* --- Details-Dropdown in Tabellenspalten (z.B. "Registrierte ONTs") ---
   Nutzt <details>/<summary> statt eigenem JS: oeffnet/schliesst per
   Klick, schliesst automatisch bei Klick woanders hin (Browser-
   Standardverhalten von <details>), und faellt ohne CSS immer noch
   lesbar auf eine einfache aufgeklappte Liste zurueck. */
.details-menu { position: relative; display: inline-block; }
.details-menu summary { cursor: pointer; list-style: none; }
.details-menu summary::-webkit-details-marker { display: none; }
.details-menu summary::marker { content: ""; }

.details-menu-content {
    position: absolute;
    left: 0;
    top: calc(100% + 0.3rem);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    min-width: 180px;
    padding: 0.4rem 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 20;
}

.details-menu-content a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    font-size: 0.85rem;
    white-space: nowrap;
}

.details-menu-content a:hover { background: #1a2233; text-decoration: none; }

/* --- Kunden-Suche & Netzwerk-Baum (klappbar via details/summary) --- */

.search-bar {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.search-bar input[type="text"] {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.92rem;
}

.search-bar input[type="text"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent-dim);
}

.search-bar input[type="text"]::placeholder {
    color: var(--text-dim);
}

.search-bar button {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--text);
    border-radius: 6px;
    padding: 0.6rem 1.1rem;
    font-family: var(--sans);
    font-size: 0.9rem;
    cursor: pointer;
}

.search-bar button:hover {
    background: var(--accent);
    color: var(--bg);
}

.search-bar .clear-link {
    font-size: 0.85rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.result-count {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin: -0.5rem 0 1rem;
}

.table-centered th, .table-centered td {
    text-align: center;
}

.tree summary {
    cursor: pointer;
    padding: 0.3rem 0;
    list-style: none;
}

.tree summary::-webkit-details-marker { display: none; }

.tree summary::before {
    content: "▸";
    display: inline-block;
    width: 1.1rem;
    color: var(--text-dim);
    transition: transform 0.15s ease;
}

.tree details[open] > summary::before {
    transform: rotate(90deg);
}

.tree details > ul {
    margin: 0.15rem 0 0.5rem;
}

.tree .sans {
    font-family: var(--sans);
    font-size: 0.82rem;
}

/* Kundenname: rot = gesperrt, violett = interne Anmerkung hinterlegt (gesperrt hat Vorrang) */
.cust-internal, a.cust-internal { color: #b48cff; }
.cust-locked, a.cust-locked { color: var(--red); }

/* GPON-Liste: gleich grosse Aktions-Buttons */
.act-btn { display: block; box-sizing: border-box; width: 100%; min-width: 9.5rem; text-align: center; padding: 0.3rem 0.7rem; font-size: 0.78rem; margin: 0 0 0.3rem 0; }
td form { margin: 0; }
/* Interne Anmerkung als kleines Popup */
.note-pop { position: relative; display: block; margin-top: 0.15rem; }
.note-pop summary { cursor: pointer; font-size: 0.72rem; color: #b48cff; list-style: none; }
.note-pop summary::-webkit-details-marker { display: none; }
.note-pop summary:hover { text-decoration: underline; }
.note-pop-box { position: absolute; z-index: 30; left: 0; top: 1.3rem; min-width: 14rem; max-width: 24rem; padding: 0.6rem 0.8rem; background: var(--panel); color: var(--text); border: 1px solid #b48cff; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.45); font-size: 0.8rem; white-space: pre-wrap; text-align: left; }
