:root {
    color-scheme: dark;
    --bg: #070b14;
    --bg-soft: #0b1120;
    --panel: #101827;
    --panel-2: #151f31;
    --text: #edf3ff;
    --muted: #8c9ab0;
    --line: #243047;
    --primary: #4f8cff;
    --primary-hover: #6ba0ff;
    --green: #19a974;
    --green-soft: #0d3b31;
    --red: #e3505a;
    --red-soft: #452127;
    --orange: #e49a36;
    --blue: #3979dc;
    --gray: #5b687d;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    min-height: 100vh;
    margin: 0;
    font: 13px/1.35 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 12% -10%, rgba(54, 111, 217, .17), transparent 30rem),
        radial-gradient(circle at 90% 0, rgba(13, 164, 126, .09), transparent 24rem),
        var(--bg);
    color: var(--text);
}

a { color: #82adff; text-decoration: none; }
a:hover { color: #a8c6ff; }
.topbar {
    min-height: 52px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 16, 28, .88);
    border-bottom: 1px solid rgba(94, 117, 155, .22);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { color: white; font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.brand span { color: #86aef8; font-weight: 550; }
.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { color: #cad6ea; font-weight: 550; }
.topbar nav a:hover { color: white; }
.topbar .user { color: #7f90aa; padding-left: 8px; border-left: 1px solid var(--line); }
.container { max-width: 1600px; margin: 16px auto; padding: 0 20px; }
h1 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 12px; }
.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-end; margin: 0 0 12px; }
.eyebrow { display: block; margin-bottom: 2px; color: #65a0ff; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.refresh-note { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 7px; }
.refresh-note i { width: 7px; height: 7px; background: var(--green); border-radius: 50%; box-shadow: 0 0 12px rgba(25, 169, 116, .9); }

.card, .panel {
    background: linear-gradient(145deg, rgba(18, 27, 44, .98), rgba(13, 20, 34, .98));
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
}
.panel { padding: 15px; margin-bottom: 14px; overflow-x: auto; }
.dashboard-panel { padding: 0; overflow: hidden; }
.panel-heading { min-height: 48px; padding: 9px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel-heading > div { display: flex; align-items: baseline; gap: 9px; }
.services-panel { margin-bottom: 8px; }
.table-wrap { overflow-x: auto; }

.watchdog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.watchdog-card {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 13px;
    background: rgba(24, 34, 53, .7);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.watchdog-card.is-online { border-left: 3px solid var(--green); }
.watchdog-card.is-offline { border-left: 3px solid var(--red); }
.watchdog-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.watchdog-main > div { min-width: 0; }
.watchdog-main strong, .watchdog-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watchdog-main strong { font-size: 14px; }
.watchdog-main span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.status-light { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--red); box-shadow: 0 0 14px rgba(227, 80, 90, .55); }
.is-online .status-light { background: var(--green); box-shadow: 0 0 14px rgba(25, 169, 116, .7); }
.watchdog-meta { display: flex; align-items: center; justify-content: flex-end; gap: 11px; color: var(--muted); font-size: 11px; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: #7f8da4; font-weight: 750; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
th, td { padding: 9px 10px; border-bottom: 1px solid rgba(45, 59, 83, .78); vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(67, 91, 132, .08); }
tr:last-child td { border-bottom: 0; }
.service-table { min-width: 1050px; table-layout: fixed; }
.service-table th:nth-child(1) { width: 19%; }
.service-table th:nth-child(2) { width: 12%; }
.service-table th:nth-child(3) { width: 17%; }
.service-table th:nth-child(4) { width: 13%; }
.service-table th:nth-child(5) { width: 20%; }
.service-table th:nth-child(6) { width: 19%; }
.service-name strong, .service-name span { display: block; }
.service-name strong { color: var(--text); font-size: 13px; }
.service-name span { margin-top: 3px; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; color: white; font-size: 10px; font-weight: 800; letter-spacing: .035em; white-space: nowrap; }
.green { background: var(--green); }
.red { background: var(--red); }
.orange { background: var(--orange); color: #221305; }
.blue { background: var(--blue); }
.gray { background: var(--gray); }
.muted { color: var(--muted); }
.status-note { display: block; margin-top: 3px; font-size: 10px; }
.error-text { max-width: 270px; color: #f08a92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.process-line { display: flex; flex-direction: column; gap: 3px; }
.mini-state { display: inline-flex; align-items: center; gap: 6px; color: #ccd7e9; white-space: nowrap; }
.mini-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gray); }
.mini-state.green-dot::before { background: var(--green); box-shadow: 0 0 7px rgba(25, 169, 116, .75); }
.mini-state.red-dot::before { background: var(--red); }
.mini-state.gray-dot::before { background: var(--gray); }
.empty-state { padding: 18px; color: var(--muted); text-align: center; }

.actions { display: flex; gap: 5px; flex-wrap: wrap; }
.control-actions { flex-wrap: nowrap; }
.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 7px 10px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover { color: white; background: var(--primary-hover); transform: translateY(-1px); }
.btn.secondary { background: #1c2940; border-color: #31415d; color: #d6e2f7; }
.btn.secondary:hover { background: #263755; }
.btn.danger { background: var(--red-soft); border-color: #71303a; color: #ffabb1; }
.btn.danger:hover { background: #632a32; }
.btn.warning { background: #4a341d; border-color: #75522b; color: #ffc878; }
.btn.warning:hover { background: #624425; }
.btn.small { padding: 4px 7px; font-size: 10px; }
form.inline { display: inline; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 13px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
label { color: #c7d3e7; font-size: 12px; font-weight: 650; }
input, select, textarea {
    width: 100%;
    border: 1px solid #34425b;
    border-radius: 6px;
    padding: 8px 9px;
    background: #0c1321;
    color: var(--text);
    font: inherit;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #5b91ec; box-shadow: 0 0 0 3px rgba(79, 140, 255, .13); }
input[type=checkbox] { width: auto; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 7px; font-weight: normal; }
textarea { min-height: 90px; resize: vertical; }
.alert { border: 1px solid #31415e; border-radius: 7px; padding: 10px 12px; margin-bottom: 12px; background: #17243b; }
.alert.success { background: #102f28; border-color: #1d604e; color: #83e2c1; }
.alert.error { background: #3a1e23; border-color: #6b2c35; color: #ff9ea6; }
.alert.warning { background: #3e2d19; border-color: #6b4c24; color: #ffd08a; }
.secret { margin-top: 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; background: #070d18; color: #b9d7ff; padding: 10px; border-radius: 6px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 13px; }
.detail-grid dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.detail-grid dd { margin: 2px 0 0; font-weight: 600; }
.section-label { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 2px; }
.section-label h2 { margin: 0; }
.command-state { margin-top: 5px; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.filter-grid .btn { width: 100%; }
.login-panel { max-width: 400px; margin: 64px auto; }
.login-panel form { display: grid; gap: 14px; margin-top: 18px; }
.login-panel .btn { width: 100%; margin-top: 3px; }
code { color: #bcd3ff; }
footer { color: #65748b; text-align: center; padding: 12px 20px 18px; font-size: 11px; }

@media (max-width: 1050px) {
    .watchdog-grid { grid-template-columns: 1fr; }
    .watchdog-meta { gap: 8px; }
}
@media (max-width: 760px) {
    .container { margin-top: 12px; padding: 0 12px; }
    .form-grid, .detail-grid, .filter-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .topbar { align-items: flex-start; flex-direction: column; padding: 11px 14px; gap: 8px; }
    .topbar nav { flex-wrap: wrap; gap: 10px; }
    .dashboard-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
    .watchdog-card { align-items: flex-start; flex-direction: column; }
    .watchdog-meta { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
}
