:root {
    --bg: #0b0f19;
    --panel: #121827;
    --panel-2: #0f1524;
    --line: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --violet: #8b5cf6;
    --ok: #10b981;
    --error: #f43f5e;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
}

h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 16px; margin: 0 0 14px; color: var(--text); }
p.muted, .muted { color: var(--muted); margin: 0 0 18px; }
small { color: var(--muted); }

/* ------------------------------------------------------------------ login */

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 20% 0%, rgba(139, 92, 246, .18), transparent 60%),
        radial-gradient(700px 400px at 90% 100%, rgba(56, 189, 248, .12), transparent 60%),
        var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

/* ------------------------------------------------------------------ layout */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    flex: 0 0 250px;
    background: var(--panel-2);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #0b0f19; }
.brand-fallback {
    width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--violet), var(--accent));
    font-weight: 700; font-size: 20px; color: #fff;
}
.brand strong { display: block; font-size: 14px; }
.brand small { font-size: 11px; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 14px;
}
.sidebar nav a:hover { background: rgba(148, 163, 184, .08); color: var(--text); }
.sidebar nav a.active { background: rgba(56, 189, 248, .12); color: var(--accent); font-weight: 600; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.sidebar-foot span { overflow: hidden; text-overflow: ellipsis; }

.content { flex: 1; padding: 34px clamp(18px, 4vw, 46px); max-width: 1100px; }

/* ------------------------------------------------------------------ tarjetas */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat strong { font-size: 30px; letter-spacing: -0.03em; }

/* ------------------------------------------------------------------ formularios */

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.inline { flex-direction: row; align-items: center; gap: 9px; color: var(--text); font-size: 14px; }

input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="file"], select, textarea {
    background: #0a0f1a;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    width: 100%;
}
input[type="color"] {
    width: 100%;
    height: 42px;
    background: #0a0f1a;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 4px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(56, 189, 248, .35); border-color: var(--accent); }
textarea { resize: vertical; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: #1a2336;
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    width: fit-content;
}
.btn:hover { border-color: #2c3b52; }
.btn.primary { background: linear-gradient(135deg, var(--violet), var(--accent)); border: none; color: #fff; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.ghost { background: transparent; }

/* ------------------------------------------------------------------ logo */

.logo-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.logo-preview {
    width: 150px; height: 150px;
    border: 1px dashed #2b3a52;
    border-radius: 18px;
    display: grid; place-items: center;
    background: #0a0f1a;
    overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-empty { text-align: center; color: var(--muted); padding: 12px; }
.logo-empty span { display: block; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.logo-empty small { font-size: 11px; }
.logo-actions { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 220px; }

/* ------------------------------------------------------------------ tablas */

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 8px;
}
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: var(--panel-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.table tr:last-child td { border-bottom: none; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; background: #1e293b; font-size: 12px; }
.pill.ok { background: rgba(16, 185, 129, .15); color: #34d399; }

/* ------------------------------------------------------------------ avisos */

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 14px; }
.alert.ok { background: rgba(16, 185, 129, .12); border: 1px solid rgba(16, 185, 129, .35); color: #6ee7b7; }
.alert.error { background: rgba(244, 63, 94, .12); border: 1px solid rgba(244, 63, 94, .35); color: #fda4af; }

code.code, pre.code {
    display: block;
    background: #0a0f1a;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 12.5px;
    color: #a5b4fc;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.inline-form { display: inline; }

/* ----------------------------------------------------------------- tabs */

.tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    text-decoration: none;
    font-size: 13.5px;
    background: var(--panel-2);
}

.tab.active {
    border-color: var(--violet);
    color: #ede9fe;
    background: rgba(139, 92, 246, .16);
}

@media (max-width: 880px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-foot { margin: 0 0 0 auto; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
}
