:root {
    --bg: #0c1018;
    --panel: #151b27;
    --panel-2: #1b2330;
    --border: #243044;
    --text: #d6dce8;
    --muted: #7d8aa3;
    --accent: #3b82f6;
    --green: #16c784;
    --red: #ea3943;
    --yellow: #f0b90b;
}

* { box-sizing: border-box; }

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

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
h1:focus { outline: none; }
code { background: var(--panel-2); padding: .1em .4em; border-radius: 4px; font-size: .85em; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { font-size: 1.25rem; font-weight: 700; padding: .25rem 1.25rem 1.25rem; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .75rem; flex: 1; }

.navlink {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem .75rem; border-radius: 8px;
    color: var(--muted); text-decoration: none; font-weight: 500;
}
.navlink:hover { background: var(--panel-2); color: var(--text); }
.navlink.active { background: var(--accent); color: #fff; }
.navlink span { font-size: 1.05rem; }

.sidebar-status {
    margin: 0 .75rem; padding: .75rem;
    background: var(--panel-2); border-radius: 8px; font-size: .85rem;
}
.sidebar-status .mode { color: var(--muted); font-size: .75rem; margin-top: .25rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .4rem; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--muted); }

.content { flex: 1; padding: 1.5rem 2rem; max-width: 1400px; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.actions { display: flex; gap: .5rem; }

.btn {
    background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
    padding: .5rem 1rem; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .9rem;
}
.btn:hover { border-color: var(--accent); }
.btn-start { background: var(--green); border-color: var(--green); color: #04150d; }
.btn-stop { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; }
.card-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.card-value { font-size: 1.7rem; font-weight: 700; margin: .35rem 0 .2rem; }
.card-value.sm { font-size: 1.3rem; }
.card-sub { color: var(--muted); font-size: .8rem; }

/* ---------- Panels & tables ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1.25rem; overflow-x: auto; }

.tbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: .5rem .6rem; border-bottom: 1px solid var(--panel-2); }
.tbl tr:last-child td { border-bottom: none; }
.tbl.kv td:first-child { color: var(--muted); width: 55%; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.nowrap { white-space: nowrap; }
.small { font-size: .8rem; }

.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }

.badge { padding: .15rem .5rem; border-radius: 6px; font-weight: 700; font-size: .75rem; }
.badge.long { background: rgba(22,199,132,.15); color: var(--green); }
.badge.short { background: rgba(234,57,67,.15); color: var(--red); }

.status { padding: .15rem .5rem; border-radius: 6px; font-size: .75rem; font-weight: 600; }
.status.ok { background: rgba(22,199,132,.15); color: var(--green); }
.status.err { background: rgba(234,57,67,.15); color: var(--red); }
.status.warn { background: rgba(240,185,11,.15); color: var(--yellow); }

.alert { background: rgba(234,57,67,.12); border: 1px solid var(--red); color: #ffb3b8; padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; }
.alert.info { background: rgba(59,130,246,.1); border-color: var(--accent); color: #b8d0ff; }

/* ---------- Forms ---------- */
.inp {
    width: 100%; padding: .55rem .7rem; margin: .25rem 0 .8rem;
    background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: .9rem;
}
.inp:focus { outline: none; border-color: var(--accent); }
label { font-size: .8rem; color: var(--muted); display: block; }
.chk { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; color: var(--text); }
.chk input { width: auto; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }

.envbox { padding: .6rem; border-radius: 8px; font-weight: 700; text-align: center; margin-bottom: .8rem; }
.envbox.test { background: rgba(22,199,132,.15); color: var(--green); }
.envbox.live { background: rgba(234,57,67,.18); color: var(--red); }

/* ---------- Env pill (sidebar) ---------- */
.env-pill { margin: 0 1.25rem 1rem; padding: .35rem .6rem; border-radius: 6px; font-size: .75rem; font-weight: 700; text-align: center; }
.env-pill.test { background: rgba(22,199,132,.15); color: var(--green); }
.env-pill.live { background: rgba(234,57,67,.2); color: var(--red); }

/* ---------- User box ---------- */
.user-box { margin: .75rem; padding: .6rem .75rem; background: var(--panel-2); border-radius: 8px; }
.user-name { font-size: .8rem; color: var(--muted); margin-bottom: .4rem; word-break: break-all; }
.logout-btn { width: 100%; padding: .4rem; font-size: .8rem; }

/* ---------- Delete button ---------- */
.del {
    background: transparent; border: none; color: var(--muted); cursor: pointer;
    font-size: .9rem; padding: .2rem .4rem; border-radius: 6px; line-height: 1;
}
.del:hover { background: rgba(234,57,67,.15); color: var(--red); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 1rem; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; }
.login-brand { font-size: 1.6rem; font-weight: 700; text-align: center; }
.login-sub { color: var(--muted); text-align: center; margin: .25rem 0 1.5rem; }
.login-btn { width: 100%; margin-top: .5rem; }

/* ---------- Blazor defaults ---------- */
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Bir hata oluştu."; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
    color: #000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
