:root {
    --sidebar-bg: #14213d;
    --sidebar-bg-active: #1d2f57;
    --sidebar-text: #a8b3cf;
    --sidebar-text-active: #ffffff;
    --bg: #f3f5f9;
    --card-bg: #ffffff;
    --text: #16213d;
    --muted: #6b7385;
    --border: #e7eaf1;
    --accent: #3b6ef6;
    --accent-dark: #2a54d6;
    --accent-light: #eaf0ff;
    --success: #16a34a;
    --success-light: #eafaf0;
    --danger: #dc2626;
    --danger-light: #fdecec;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(20, 33, 61, 0.04), 0 4px 16px rgba(20, 33, 61, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 16px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Layout: Sidebar + Content ---------- */

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

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 22px;
}

.sidebar-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent), #7c9bff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-title { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2; }
.sidebar-subtitle { color: var(--sidebar-text); font-size: 11.5px; opacity: 0.75; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }

.sidebar-section {
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.06em;
    color: var(--sidebar-text);
    opacity: 0.55;
    padding: 16px 10px 6px;
}

.sidebar-nav a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.sidebar-nav a.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 14px;
    padding-top: 14px;
}

.sidebar-user {
    font-size: 12px;
    color: var(--sidebar-text);
    opacity: 0.8;
    padding: 0 10px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--sidebar-text);
}
.sidebar-logout:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }

.content { flex: 1; min-width: 0; padding: 28px 34px 60px; max-width: 1100px; }

.page-head { margin-bottom: 22px; }

/* ---------- Cards ---------- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 18px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stat {
    border-left: 4px solid var(--accent);
    padding-left: 18px;
}
.stat.stat-alt { border-left-color: var(--success); }
.stat .label { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 12px 16px; }
    .sidebar-nav, .sidebar-footer { display: none; }
    .content { padding: 20px; }
    .two-col { grid-template-columns: 1fr; }
}

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; font-size: 13.5px; }
thead th, tr:first-child th {
    color: var(--muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}
tbody tr, tr:not(:first-child) { border-bottom: 1px solid var(--border); }
tbody tr:last-child, tr:last-child { border-bottom: none; }
tbody tr:hover, tr:hover { background: #fafbfd; }

/* ---------- Forms & Buttons ---------- */

form.inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
label { font-size: 12.5px; color: var(--muted); font-weight: 500; }

input[type=text], input[type=email], input[type=password], input[type=url] {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: 13.5px;
    min-width: 220px;
    background: #fbfcfe;
    transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--accent); background: #fff; }

button, .btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--accent-dark); text-decoration: none; }

.btn-secondary {
    background: var(--accent-light);
    color: var(--accent-dark);
}
.btn-secondary:hover { background: #dde7ff; color: var(--accent-dark); }

.error {
    background: var(--danger-light);
    color: #a91f1f;
    border: 1px solid #f8caca;
    padding: 11px 15px;
    border-radius: 9px;
    margin-bottom: 16px;
    font-size: 13.5px;
}

.success {
    background: var(--success-light);
    color: #0f7a3d;
    border: 1px solid #b9ecd0;
    padding: 11px 15px;
    border-radius: 9px;
    margin-bottom: 16px;
    font-size: 13.5px;
}

/* ---------- Login / Install ---------- */

.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, #14213d 0%, #1d2f57 45%, #3b6ef6 130%);
}

.login-card {
    width: 360px;
    text-align: center;
}

.login-logo {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #7c9bff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 17px;
}

.login-card h1 { text-align: center; }
.login-card .muted { display: block; margin-bottom: 20px; }
.login-card form { text-align: left; }
.login-card .field { width: 100%; }
.login-card input[type=email],
.login-card input[type=password],
.login-card input[type=text] { width: 100%; min-width: 0; }
.login-card button { width: 100%; margin-top: 4px; }

/* ---------- Misc ---------- */

code.snippet {
    display: block;
    background: #0f1730;
    color: #cdd7f5;
    padding: 15px 16px;
    border-radius: 10px;
    font-size: 12.5px;
    overflow-x: auto;
    white-space: pre;
    font-family: "SF Mono", Consolas, Monaco, monospace;
}

.days-switch { display: inline-flex; gap: 4px; background: #eef1f7; padding: 4px; border-radius: 9px; }
.days-switch a {
    padding: 6px 14px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}
.days-switch a:hover { text-decoration: none; color: var(--text); }
.days-switch a.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(20,33,61,0.08); }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent-dark);
}

.btn-danger {
    background: var(--danger-light);
    color: #a91f1f;
}
.btn-danger:hover { background: #fbd5d5; color: #a91f1f; }

.icon-btn {
    background: transparent;
    color: var(--muted);
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}
.icon-btn:hover { background: var(--danger-light); color: #a91f1f; }

.col-action { width: 32px; text-align: right; }

.danger-zone { border-color: #f6d3d3; }
.danger-zone h2 { color: #a91f1f; }

.fi {
    width: 20px;
    height: 15px;
    vertical-align: middle;
    margin-right: 6px;
    border-radius: 2px;
    background-size: cover;
}
