:root {
    --bg: #0b1120;
    --surface: #151d30;
    --border: #2a3550;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --accent: #3b82f6;
    --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; }

/* ---------- top bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 1.1rem; margin: 0; }

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.inline-form { display: inline; }

.btn {
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.icon-btn { font-size: 1.1rem; line-height: 1; }

/* ---------- errors ---------- */

.errors {
    margin: 1rem 1.25rem 0;
    padding: 0.5rem 1rem;
    border: 1px solid var(--danger);
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.12);
}

.errors ul { margin: 0.25rem 0; padding-left: 1.25rem; }

.form-error { color: var(--danger); }

/* ---------- board ---------- */

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.25rem;
    align-items: start;
}

@media (max-width: 900px) {
    .board { grid-template-columns: 1fr; }
}

.board-column { display: flex; flex-direction: column; gap: 1rem; min-height: 2rem; }

.panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.panel-header h2 { font-size: 1rem; margin: 0.1rem 0; }

.tools { visibility: hidden; display: inline-flex; gap: 0.25rem; }
.panel-header:hover .tools, .item:hover .tools { visibility: visible; }

.tool {
    font: inherit;
    color: var(--text-dim);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0.2rem;
}

.tool:hover { color: var(--text); }

.items { list-style: none; margin: 0.5rem 0 0; padding: 0; }

.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 6px;
    padding: 0.3rem 0.4rem;
}

.item:hover { background: rgba(255, 255, 255, 0.06); }

.item > a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    min-width: 0;
}

.item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item-icon { width: 1.4rem; text-align: center; }

/* ---------- monitoring status ---------- */

.status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
    display: inline-block;
}

.status-pending { background: #eab308; }
.status-up { background: #22c55e; }
.status-down { background: var(--danger); }
.status-unknown { background: #64748b; }

/* ---------- panel palette (16 colors) ---------- */

.color-slate   { background: #24303f; }
.color-gray    { background: #262b33; }
.color-red     { background: #46201d; }
.color-orange  { background: #47280f; }
.color-amber   { background: #443508; }
.color-green   { background: #16321d; }
.color-emerald { background: #0d3a2c; }
.color-teal    { background: #113c3a; }
.color-cyan    { background: #123c4d; }
.color-blue    { background: #1a2f5e; }
.color-indigo  { background: #272867; }
.color-violet  { background: #3a2071; }
.color-purple  { background: #432062; }
.color-pink    { background: #56173a; }
.color-rose    { background: #551327; }
.color-stone   { background: #2b2725; }

/* ---------- dialogs / forms ---------- */

dialog {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    width: min(26rem, 90vw);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

dialog h2 { margin-top: 0; font-size: 1.05rem; }

dialog label { display: block; margin: 0.75rem 0; }

dialog label.checkbox { display: flex; align-items: center; gap: 0.5rem; }

dialog input[type="text"], dialog input[type="url"], dialog input[type="number"],
dialog input:not([type]), dialog select, .login-card input {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.45rem 0.6rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

dialog label.checkbox input { width: auto; margin: 0; }

dialog menu {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 1rem 0 0;
    padding: 0;
}

/* palette swatches */

.palette {
    border: 1px solid var(--border);
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.4rem;
    padding: 0.6rem;
}

.palette legend { padding: 0 0.3rem; color: var(--text-dim); }

.swatch { position: relative; display: block; height: 1.5rem; border-radius: 4px; cursor: pointer; margin: 0 !important; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { position: absolute; inset: 0; border-radius: 4px; border: 2px solid transparent; }
.swatch input:checked + span { border-color: var(--text); }

/* ---------- login page ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card, .login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem 2rem;
}

.login-card { width: min(22rem, 90vw); }

.login-card h1 { font-size: 1.2rem; margin-top: 0; }

.login-card label { display: block; margin: 0.75rem 0; }

.login-card button { width: 100%; margin-top: 1rem; padding: 0.5rem; }

/* ---------- settings ---------- */

.settings {
    max-width: 44rem;
    margin: 0 auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings h2 { margin-top: 0; font-size: 1.05rem; }

.settings label { display: block; margin: 0.75rem 0; }

.settings input[type="password"], .settings input[type="file"] {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.45rem 0.6rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.settings table { border-collapse: collapse; width: 100%; }
.settings th, .settings td { text-align: left; padding: 0.3rem 0.6rem; border-bottom: 1px solid var(--border); }
.settings .muted { color: var(--text-dim); }

.flash-success {
    margin: 0;
    padding: 0.5rem 1rem;
    border: 1px solid #22c55e;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.12);
}
