*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: system-ui, sans-serif;
    font-size: 13px;
    color: #111;
    background: #ffffff;
    overflow: hidden;
}

/* ── App shell ─────────────────────────────────────────────── */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ── Top bar ───────────────────────────────────────────────── */

#topbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
    flex-shrink: 0;
    flex-wrap: wrap;
}

#topbar .app-title {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin-right: 8px;
    white-space: nowrap;
}

.topbar-sep {
    width: 1px;
    height: 20px;
    background: #e0e0e0;
    margin: 0 4px;
}

#zoom-display {
    min-width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: #555;
}

/* ── Main layout ───────────────────────────────────────────── */

#workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Buttons ───────────────────────────────────────────────── */

button {
    font-family: system-ui, sans-serif;
    font-size: 12px;
    color: #111;
    background: #ffffff;
    border: 1px solid #ccc;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 2px;
    white-space: nowrap;
}

button:hover { background: #f0f0f0; }
button:active { background: #e8e8e8; }

button.danger,
button.btn-delete {
    color: #c62828;
    border-color: #e57373;
}
button.btn-delete {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 6px;
}
button.btn-delete:hover { background: #ffebee; }

button.btn-tiny-danger {
    padding: 1px 5px;
    font-size: 11px;
    color: #c62828;
    border-color: #e57373;
}
button.btn-tiny-danger:hover { background: #ffebee; }

button.status-up {
    color: #2e7d32;
    border-color: #81c784;
    background: #f1f8e9;
}
button.status-down {
    color: #b71c1c;
    border-color: #ef9a9a;
    background: #ffebee;
}

/* ── Context menu ──────────────────────────────────────────── */

.ctx-menu {
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ccc;
    min-width: 160px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.ctx-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 0;
    padding: 7px 12px;
    font-size: 12px;
    color: #111;
    background: transparent;
    cursor: pointer;
}
.ctx-item:hover { background: #f0f0f0; }
.ctx-item.danger { color: #c62828; }
.ctx-item.danger:hover { background: #ffebee; }

/* ── Hidden utility ────────────────────────────────────────── */
.hidden { display: none !important; }
