:root {
    --bg: #07101f;
    --surface: #0e1a2e;
    --surface-2: #13243d;
    --line: #233650;
    --text: #eaf2ff;
    --muted: #8fa4c0;
    --primary: #37a0ff;
    --primary-2: #1b6fe5;
    --success: #2dd4a8;
    --warning: #ffbc4b;
    --danger: #ff647c;
    --radius: 16px;
    --shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 80% 0, rgba(36, 121, 237, .14), transparent 35%), var(--bg); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 258px; flex-direction: column; padding: 24px 18px; background: rgba(8, 18, 34, .96); border-right: 1px solid var(--line); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 13px; color: white; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 10px 25px rgba(33, 126, 235, .3); font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.nav { display: grid; gap: 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border-radius: 11px; color: #a9bbd2; font-weight: 650; transition: .18s ease; }
.nav a span { width: 20px; color: #7188a6; text-align: center; }
.nav a:hover { color: white; background: #12233b; }
.nav a.active { color: white; background: linear-gradient(90deg, rgba(50, 151, 255, .26), rgba(50, 151, 255, .08)); box-shadow: inset 3px 0 var(--primary); }
.nav a.active span { color: var(--primary); }
.sidebar-footer { margin-top: auto; padding: 15px; border: 1px solid var(--line); border-radius: 12px; color: #b9c9dc; background: rgba(17, 34, 57, .65); font-size: 13px; }
.sidebar-footer small { display: block; margin-top: 6px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(45, 212, 168, .1); }
.main-column { display: flex; width: calc(100% - 258px); min-height: 100vh; margin-left: 258px; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; min-height: 88px; align-items: center; gap: 18px; padding: 16px 34px; border-bottom: 1px solid rgba(35, 54, 80, .8); background: rgba(7, 16, 31, .86); backdrop-filter: blur(18px); }
.topbar h1 { margin: 1px 0 0; font-size: 23px; line-height: 1.1; }
.eyebrow { margin: 0; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.user-menu { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-menu strong, .user-menu small { display: block; }
.user-menu small { color: var(--muted); font-size: 12px; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #2c4b71; border-radius: 12px; background: var(--surface-2); color: var(--primary); font-weight: 800; }
.link-button { border: 0; background: transparent; color: #9eb5d0; cursor: pointer; }
.link-button:hover { color: white; }
.content { width: min(1500px, 100%); margin: 0 auto; padding: 32px 34px 50px; flex: 1; }
.footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(19, 36, 61, .92), rgba(12, 25, 44, .94)); box-shadow: var(--shadow); }
.card-body { padding: 22px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.metric { position: relative; min-height: 140px; padding: 22px; }
.metric::after { position: absolute; right: -22px; bottom: -36px; width: 110px; height: 110px; border-radius: 50%; background: rgba(55, 160, 255, .09); content: ""; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.metric-value { display: block; margin: 12px 0 4px; font-size: 34px; line-height: 1; }
.metric-detail { color: #a8bad0; font-size: 13px; }
.metric.success .metric-value { color: var(--success); }
.metric.warning .metric-value { color: var(--warning); }
.metric.danger .metric-value { color: var(--danger); }
.section-space { margin-top: 22px; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { min-width: min(480px, 100%); flex: 1; }
.search { position: relative; }
.search input { padding-left: 42px; }
.search::before { position: absolute; top: 50%; left: 16px; color: var(--muted); content: "⌕"; transform: translateY(-50%); }
input, textarea, select { width: 100%; border: 1px solid #29405e; border-radius: 10px; outline: none; background: #09172a; color: var(--text); transition: border-color .15s, box-shadow .15s; }
input, select { min-height: 44px; padding: 10px 13px; }
textarea { min-height: 110px; padding: 12px 13px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(55, 160, 255, .13); }
input[readonly] { color: #a9bed7; background: #0d1d32; }
.field { display: block; }
.field > span { display: block; margin-bottom: 7px; color: #c7d6e8; font-size: 13px; font-weight: 650; }
.field small { color: var(--muted); font-weight: 400; }
.form-grid { display: grid; gap: 18px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.input-action { display: flex; gap: 8px; }
.input-action input { flex: 1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 720; transition: transform .15s, filter .15s, background .15s; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; }
.button-success { background: #137b67; color: white; }
.button-danger { border-color: rgba(255, 100, 124, .35); background: rgba(255, 100, 124, .12); color: #ff9aab; }
.button-warning { border-color: rgba(255, 188, 75, .35); background: rgba(255, 188, 75, .12); color: #ffd185; }
.button-secondary { border-color: #315174; background: #18304e; color: #d8e8fb; }
.button-ghost { border-color: var(--line); background: transparent; color: #b7c7da; }
.button-small { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid rgba(35, 54, 80, .76); text-align: left; vertical-align: middle; }
th { color: #8198b4; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
td { color: #c8d7e8; }
tbody tr:hover { background: rgba(55, 160, 255, .035); }
tbody tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.truncate { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.badge-success { background: rgba(45, 212, 168, .13); color: #73e7c9; }
.badge-danger { background: rgba(255, 100, 124, .13); color: #ff9cad; }
.badge-warning { background: rgba(255, 188, 75, .13); color: #ffd27f; }
.badge-info { background: rgba(55, 160, 255, .13); color: #85c8ff; }
.actions { display: flex; gap: 7px; align-items: center; }
.actions form { display: inline-flex; }
.alert { margin-bottom: 18px; padding: 13px 16px; border: 1px solid; border-radius: 11px; }
.alert-success { border-color: rgba(45, 212, 168, .35); background: rgba(45, 212, 168, .11); color: #8cebd2; }
.alert-danger { border-color: rgba(255, 100, 124, .35); background: rgba(255, 100, 124, .11); color: #ffa3b2; }
.alert-warning { border-color: rgba(255, 188, 75, .35); background: rgba(255, 188, 75, .1); color: #ffd38a; }
.alert-info { border-color: rgba(55, 160, 255, .35); background: rgba(55, 160, 255, .1); color: #9ed4ff; }
.empty { padding: 45px 20px; color: var(--muted); text-align: center; }
.pagination { display: flex; justify-content: center; gap: 7px; padding: 18px; border-top: 1px solid var(--line); }
.pagination a, .pagination span { display: grid; min-width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: #aec0d6; }
.pagination .active { border-color: var(--primary); background: rgba(55, 160, 255, .14); color: white; }
.subtle { color: var(--muted); }
.code-box { padding: 13px 15px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 10px; background: #071425; color: #8acaff; font-family: ui-monospace, monospace; font-size: 12px; }
.split-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.split-head h2 { margin: 0; font-size: 20px; }
.split-head p { margin: 5px 0 0; color: var(--muted); }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.login-shell { display: grid; width: min(920px, 100%); min-height: 540px; grid-template-columns: 1.05fr .95fr; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: 0 35px 100px rgba(0,0,0,.5); }
.login-hero { position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: 46px; overflow: hidden; background: linear-gradient(145deg, rgba(24, 113, 226, .92), rgba(8, 36, 79, .96)), url('../img/logo.png') center/cover; }
.login-hero::before { position: absolute; inset: -30%; border: 1px solid rgba(255,255,255,.12); border-radius: 48%; content: ""; transform: rotate(18deg); }
.login-hero > * { position: relative; }
.login-hero h1 { max-width: 360px; margin: 12px 0; font-size: 38px; line-height: 1.06; }
.login-hero p { max-width: 400px; margin: 0; color: #d4e8ff; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 46px; }
.login-form h2 { margin: 0 0 5px; font-size: 25px; }
.login-form > p { margin: 0 0 25px; color: var(--muted); }
.login-form .field { margin-bottom: 16px; }
.login-form .button { width: 100%; margin-top: 7px; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.menu-button, .sidebar-scrim { display: none; }
.secret { cursor: pointer; user-select: none; }

@media (max-width: 1120px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
    .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
    body.menu-open .sidebar { transform: translateX(0); }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.52); }
    body.menu-open .sidebar-scrim { display: block; }
    .main-column { width: 100%; margin-left: 0; }
    .menu-button { display: grid; }
    .content, .topbar { padding-right: 20px; padding-left: 20px; }
    .user-menu > span:not(.avatar) { display: none; }
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { min-height: 260px; padding: 32px; }
    .login-hero h1 { font-size: 30px; }
}
@media (max-width: 620px) {
    .grid-4, .grid-3, .grid-2, .two-columns { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .content { padding-top: 22px; }
    .topbar { min-height: 78px; }
    .topbar h1 { font-size: 19px; }
    .footer { flex-direction: column; }
    .card-header, .split-head { align-items: stretch; flex-direction: column; }
    .input-action { flex-direction: column; }
    .login-form { padding: 32px 25px; }
}
