:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --text: #152033;
    --muted: #65728a;
    --line: #e3e8f2;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --green: #16a34a;
    --red: #dc2626;
    --yellow: #ca8a04;
    --shadow: 0 18px 40px rgba(21, 32, 51, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: inherit; text-decoration: none; }
label { display: block; font-weight: 700; margin: 0 0 8px; }
input[type="text"], input[type="password"], input[type="url"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 15px;
    outline: none;
    background: #fff;
    margin-bottom: 16px;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
button, .api-link, .secondary, .small {
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
button:hover, .api-link:hover { background: var(--primary-dark); }
.secondary { background: #edf2ff; color: var(--primary); }
.danger { background: #fee2e2 !important; color: var(--red) !important; }
.small { padding: 8px 10px; border-radius: 9px; font-size: 13px; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top left, #dbeafe, transparent 35%), var(--bg);
}
.login-card {
    width: min(420px, calc(100% - 32px));
    background: var(--panel);
    padding: 34px;
    border-radius: 24px;
    box-shadow: var(--shadow);
}
.login-mark, .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
    font-size: 22px;
}
.login-card h1 { margin: 18px 0 8px; }
.login-card p, .hint { color: var(--muted); }
.login-card button { width: 100%; margin-top: 8px; }
.hint { margin-top: 18px; text-align: center; font-size: 13px; }

.shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 270px;
    background: #0f172a;
    color: #fff;
    padding: 26px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 30px; }
.brand-title { font-size: 20px; font-weight: 900; }
.brand-subtitle { color: #9ca3af; font-size: 13px; }
.nav { display: grid; gap: 8px; }
.nav a {
    padding: 13px 14px;
    border-radius: 13px;
    color: #dbe4f0;
    font-weight: 700;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.content { margin-left: 270px; padding: 34px; width: calc(100% - 270px); }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 24px; }
h1 { margin: 0; font-size: 34px; }
h2 { margin: 0 0 18px; font-size: 20px; }
p { margin: 6px 0 0; color: var(--muted); }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}
.narrow { max-width: 540px; }
.grid.two { display: grid; grid-template-columns: 1fr 1.5fr; gap: 18px; }
.checkline { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.checkline input { width: auto; margin: 0; }
.actions { display: flex; gap: 12px; align-items: center; }
.alert {
    border-radius: 14px;
    padding: 14px 16px;
    font-weight: 700;
    margin-bottom: 18px;
}
.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.right { text-align: right; }
code {
    background: #f1f5f9;
    padding: 5px 7px;
    border-radius: 8px;
    white-space: nowrap;
}
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 900;
}
.pill.on { background: #dcfce7; color: #166534; }
.pill.off { background: #fef3c7; color: #92400e; }
.action-buttons { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.action-buttons form { display: inline; margin: 0; }
.empty { color: var(--muted); padding: 20px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; }

@media (max-width: 850px) {
    .shell { display: block; }
    .sidebar { position: static; width: 100%; }
    .content { width: 100%; margin-left: 0; padding: 22px; }
    .topbar { display: block; }
    .api-link { margin-top: 16px; }
    .grid.two { grid-template-columns: 1fr; gap: 0; }
    .action-buttons { justify-content: flex-start; flex-wrap: wrap; }
}


.branding-grid input[type="file"] {
    width: 100%;
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 13px;
    background: #fff;
    margin-bottom: 16px;
}
.preview-box {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #0f172a;
    overflow: hidden;
    margin: 0 0 12px;
    display: grid;
    place-items: center;
}
.logo-preview { height: 190px; }
.background-preview { height: 190px; }
.preview-box img { max-width: 100%; max-height: 100%; display: block; }
.background-preview img { width: 100%; height: 100%; object-fit: cover; }
.small-empty { margin-bottom: 12px; }
.json-preview {
    background: #0f172a;
    color: #dbeafe;
    border-radius: 16px;
    padding: 18px;
    overflow-x: auto;
    line-height: 1.5;
}
