:root {
    --green: #20b66a;
    --green-dark: #08783e;
    --green-soft: #143a28;
    --background: #07110c;
    --surface: #0d1b13;
    --surface-2: #12251a;
    --surface-3: #182f22;
    --text: #eef8f1;
    --muted: #93a89b;
    --border: #20392a;
    --danger: #ef6b73;
    --warning: #e8bd62;
    --shadow: 0 24px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
    margin: 0;
    min-width: 320px;
    background:
        radial-gradient(circle at 90% -10%, rgba(32,182,106,.12), transparent 34%),
        var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
a { color: inherit; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 74px;
    padding: 12px clamp(18px, 4vw, 54px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: rgba(7,17,12,.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: linear-gradient(145deg, var(--green), var(--green-dark));
    border-radius: 14px;
    color: #fff;
    font-weight: 900;
    letter-spacing: -.06em;
    box-shadow: 0 10px 24px rgba(32,182,106,.22);
}
.brand > span:last-child { display: grid; line-height: 1.25; }
.brand strong { font-size: 1rem; }
.brand small { color: var(--muted); font-size: .77rem; }
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.server-name { color: var(--muted); font-size: .86rem; }

.dashboard { width: min(1500px, 100%); margin: 0 auto; padding: 48px clamp(18px, 4vw, 54px) 30px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.hero h1 { max-width: 800px; margin: 3px 0 10px; font-size: clamp(2rem, 5vw, 3.9rem); line-height: 1.05; letter-spacing: -.045em; }
.hero p:not(.eyebrow) { max-width: 720px; margin: 0; color: var(--muted); font-size: 1.03rem; }
.eyebrow { margin: 0; color: var(--green); font-size: .72rem; font-weight: 900; letter-spacing: .14em; }
.hero__status { min-width: 210px; padding: 16px 18px; display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.hero__status small, .hero__status strong { display: block; }
.hero__status small { color: var(--muted); font-size: .75rem; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 6px rgba(239,107,115,.1); }
.hero__status.is-online .status-dot { background: var(--green); box-shadow: 0 0 0 6px rgba(32,182,106,.11); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-card { min-height: 178px; padding: 22px; display: grid; grid-template-columns: auto 1fr; align-content: start; gap: 16px; background: linear-gradient(150deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.metric-card__icon { width: 44px; height: 44px; display: grid; place-items: center; background: var(--green-soft); border: 1px solid rgba(32,182,106,.24); border-radius: 12px; color: var(--green); font-weight: 900; }
.metric-card small { display: block; color: var(--muted); font-size: .78rem; }
.metric-card strong { display: block; margin-top: 3px; font-size: 2.15rem; line-height: 1; }
.metric-card__mode { font-size: 1.35rem !important; line-height: 1.2 !important; }
.metric-card p { grid-column: 1 / -1; align-self: end; margin: auto 0 0; color: var(--muted); font-size: .83rem; }

.control-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 16px; margin-bottom: 16px; }
.panel { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.panel__heading { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel__heading h2 { margin: 4px 0 0; font-size: 1.35rem; letter-spacing: -.02em; }
.badge { padding: 6px 10px; color: var(--muted); background: var(--surface-3); border: 1px solid var(--border); border-radius: 999px; font-size: .69rem; font-weight: 900; letter-spacing: .08em; white-space: nowrap; }
.badge--success { color: #80e9aa; background: rgba(32,182,106,.12); border-color: rgba(32,182,106,.3); }
.badge--danger { color: #ff9da3; background: rgba(239,107,115,.1); border-color: rgba(239,107,115,.28); }
.details-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 0; background: var(--border); border: 1px solid var(--border); border-radius: 13px; }
.details-list > div { min-width: 0; padding: 14px 16px; background: var(--surface-2); }
.details-list dt { color: var(--muted); font-size: .74rem; }
.details-list dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: .9rem; font-weight: 700; }
.details-list--compact { margin-top: 20px; }
.service-actions { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }
.service-actions form { margin: 0; }
.button { min-height: 40px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-weight: 800; cursor: pointer; transition: filter .15s ease, transform .15s ease, opacity .15s ease; }
.button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.button:disabled { opacity: .35; cursor: not-allowed; }
.button--primary { color: #06100a; background: var(--green); }
.button--secondary, .button--ghost { color: var(--text); background: var(--surface-3); border-color: var(--border); }
.button--danger { color: #fff; background: #b43e48; }
.button--wide { width: 100%; }

.resource-item + .resource-item { margin-top: 18px; }
.resource-item > div:first-child { margin-bottom: 8px; display: flex; justify-content: space-between; gap: 16px; font-size: .85rem; }
.resource-item span { color: var(--muted); }
.progress { height: 9px; overflow: hidden; background: var(--surface-3); border-radius: 999px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-dark), var(--green)); border-radius: inherit; }

.table-panel { margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th { padding: 11px 13px; color: var(--muted); border-bottom: 1px solid var(--border); text-align: left; font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 13px; border-bottom: 1px solid rgba(32,57,42,.7); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(32,182,106,.035); }
.table-status { display: inline-flex; padding: 4px 8px; color: #a5e7bf; background: rgba(32,182,106,.09); border-radius: 999px; font-size: .7rem; font-weight: 800; }
.table-status.is-playing { color: #f5d68d; background: rgba(232,189,98,.1); }
.empty-state { padding: 34px 12px; display: grid; justify-items: center; text-align: center; }
.empty-state strong { font-size: 1rem; }
.empty-state span { margin-top: 4px; color: var(--muted); font-size: .85rem; }
.alert { margin-bottom: 16px; padding: 13px 16px; border-radius: 12px; font-weight: 700; }
.alert--success { color: #a8ecc2; background: rgba(32,182,106,.11); border: 1px solid rgba(32,182,106,.3); }
.alert--error { color: #ffb1b6; background: rgba(239,107,115,.1); border: 1px solid rgba(239,107,115,.28); }
.footer { padding: 20px 0 5px; color: var(--muted); text-align: center; font-size: .76rem; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(100%, 430px); }
.login-card { padding: 36px; background: rgba(13,27,19,.94); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-card .brand-mark { margin-bottom: 24px; }
.login-card h1 { margin: 5px 0 8px; font-size: 2.25rem; letter-spacing: -.04em; }
.login-copy { margin: 0 0 26px; color: var(--muted); }
.login-card form { display: grid; gap: 16px; }
.login-card label span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.login-card input { width: 100%; height: 46px; padding: 0 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; outline: none; }
.login-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(32,182,106,.12); }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .control-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .topbar { min-height: 66px; padding: 10px 16px; }
    .brand-mark { width: 42px; height: 42px; }
    .brand small, .server-name { display: none; }
    .dashboard { padding: 30px 14px 24px; }
    .hero { align-items: stretch; flex-direction: column; }
    .hero__status { min-width: 0; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 150px; }
    .panel { padding: 18px; border-radius: 15px; }
    .details-list { grid-template-columns: 1fr; }
    .service-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .service-actions form, .service-actions button { width: 100%; }
    .service-actions form:last-child { grid-column: 1 / -1; }
    .login-card { padding: 27px 22px; }
}
