*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0f1115;
    color: #e4e6ea;
    display: flex;
}
a { color: #6ab0ff; text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select { color: #e4e6ea; background: #0f1115; border: 1px solid #2e3440; border-radius: 8px; }
input:focus, textarea:focus, select:focus { border-color: #6ab0ff; outline: none; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill, select:-webkit-autofill { -webkit-box-shadow: 0 0 0px 1000px #0f1115 inset !important; -webkit-text-fill-color: #e4e6ea !important; }

.sidebar {
    width: 240px;
    min-width: 220px;
    background: #161a22;
    border-right: 1px solid #232831;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
}
.brand { padding: 0 20px 16px; font-weight: 700; font-size: 1.05rem; color: #fff; }
.sidebar a {
    display: block;
    padding: 10px 20px;
    color: #aab2bf;
    border-left: 3px solid transparent;
    transition: .15s;
}
.sidebar a:hover { background: #1f242e; color: #fff; text-decoration: none; }
.sidebar a.active { background: #1c2230; color: #6ab0ff; border-left-color: #6ab0ff; }
.nav-user { display: flex; align-items: center; gap: 10px; padding: 12px 20px 16px; border-bottom: 1px solid #232831; margin-bottom: 8px; }
.nav-user-avatar { font-size: 1.4rem; }
.nav-user-name { font-weight: 600; font-size: .9rem; color: #fff; }
.nav-user-role { font-size: .78rem; color: #8b93a1; }
.nav-icon { display: inline-block; width: 24px; text-align: center; margin-right: 4px; }
.nav-footer { margin-top: auto; padding: 12px 20px; font-size: .75rem; color: #5a6270; border-top: 1px solid #232831; }

.main { flex: 1; margin-left: 240px; padding: 20px 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.topbar h1 { margin: 0; font-size: 1.35rem; }
.user-badge { background: #1c2230; padding: 6px 12px; border-radius: 999px; font-size: .9rem; color: #9aa3b2; }

.card {
    background: #161a22;
    border: 1px solid #232831;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 1.05rem; color: #d5dae2; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
    background: #161a22;
    border: 1px solid #232831;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: #6ab0ff; }
.stat-label { font-size: .85rem; color: #8b93a1; margin-top: 4px; }

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 10px; border-bottom: 1px solid #232831; text-align: left; }
.table th { color: #8b93a1; font-weight: 600; font-size: .85rem; text-transform: uppercase; }
.table tr:last-child td { border-bottom: 0; }

.badge { font-size: .78rem; padding: 3px 8px; border-radius: 999px; font-weight: 600; }
.badge-green { background: #143d22; color: #4ade80; }
.badge-red { background: #3b1418; color: #f87171; }

.btn {
    display: inline-block;
    background: #232831;
    color: #e4e6ea;
    border: 1px solid #2e3440;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .95rem;
    transition: .15s;
}
.btn:hover { background: #2a2f3a; }
.btn-primary { background: #1c4e80; border-color: #2563a8; color: #fff; }
.btn-primary:hover { background: #235d99; }
.btn-danger { background: #6b1c23; border-color: #8b2630; color: #fff; }
.btn-danger:hover { background: #7f222e; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .85rem; color: #aab2bf; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 9px 11px;
    background: #0f1115;
    border: 1px solid #2e3440;
    border-radius: 8px;
    color: #e4e6ea;
    font-size: .95rem;
    outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #6ab0ff; }

.toggle-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-label input { display: none; }
.toggle-switch {
    width: 38px; height: 20px; background: #2e3440; border-radius: 999px; position: relative; transition: .2s;
}
.toggle-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #8b93a1; border-radius: 50%; transition: .2s;
}
.toggle-label input:checked + .toggle-switch { background: #1c4e80; }
.toggle-label input:checked + .toggle-switch::after { left: 20px; background: #fff; }

.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: .95rem; }
.alert-success { background: #143d22; color: #4ade80; border: 1px solid #1d5a32; }
.alert-error { background: #3b1418; color: #f87171; border: 1px solid #5c1e24; }

.empty-state { color: #8b93a1; font-size: .95rem; }

.login-body { display: flex; align-items: center; justify-content: center; background: #0f1115; }
.login-box {
    background: #161a22; border: 1px solid #232831; border-radius: 12px;
    width: 100%; max-width: 380px; padding: 28px;
    box-shadow: 0 10px 35px rgba(0,0,0,.35);
}
.login-box h1 { margin: 0 0 18px; font-size: 1.25rem; text-align: center; color: #fff; }
.login-box .form-group { margin-bottom: 14px; }
.login-box button { width: 100%; margin-top: 6px; }
.login-box .hint { text-align: center; font-size: .85rem; color: #8b93a1; margin-top: 12px; }

.section-title { grid-column: 1 / -1; font-size: .9rem; font-weight: 600; color: #6ab0ff; text-transform: uppercase; letter-spacing: .5px; margin-top: 8px; padding-bottom: 4px; border-bottom: 1px solid #232831; }
.color-input { width: 48px !important; height: 36px; padding: 2px !important; border-radius: 6px; cursor: pointer; border: 1px solid #2e3440; }
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; grid-column: 1 / -1; }
.platform-item { display: flex; align-items: center; gap: 8px; background: #0f1115; border: 1px solid #2e3440; border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: .9rem; }
.platform-item input[type="checkbox"] { width: auto; accent-color: #6ab0ff; }
.platform-item:hover { border-color: #6ab0ff; }
.dns-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; grid-column: 1 / -1; }
.dns-item { display: flex; align-items: center; gap: 8px; background: #0f1115; border: 1px solid #2e3440; border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: .9rem; }
.dns-item input[type="checkbox"] { width: auto; accent-color: #6ab0ff; }
.dns-item:hover { border-color: #6ab0ff; }
.api-preview { grid-column: 1 / -1; background: #0a0c10; border: 1px solid #232831; border-radius: 8px; padding: 12px; font-family: monospace; font-size: .85rem; color: #4ade80; overflow-x: auto; }
.api-preview code { white-space: pre-wrap; word-break: break-all; }
.full-width { grid-column: 1 / -1; }

@media (max-width: 860px) {
    .sidebar { width: 100%; position: static; border-right: 0; border-bottom: 1px solid #232831; }
    body { flex-direction: column; }
    .main { margin-left: 0; }
}
