* { box-sizing: border-box; }

:root {
    --bg: #100c17;
    --surface: #191323;
    --surface-2: #1f1830;
    --border: #2c2340;
    --accent-a: #a855f7;
    --accent-b: #ec4899;
    --text: #e8e2f0;
    --text-dim: #8d829e;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-size: 14px;
}

h1, h2, h3 { color: var(--text); font-weight: 600; margin: 0 0 4px 0; }
.subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }

.accent {
    background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 200px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
}
.sidebar-brand {
    font-weight: 700;
    font-size: 15px;
    padding: 20px 20px;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.2px;
}
.sidebar-nav { display: flex; flex-direction: column; padding: 12px 0; flex: 1; }
.sidebar-nav a {
    color: var(--text-dim);
    text-decoration: none;
    padding: 9px 20px;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 2px solid transparent;
}
.sidebar-nav a:hover { color: var(--text); background: var(--surface-2); }
.sidebar-nav a.active {
    color: var(--text);
    background: var(--surface-2);
    border-left: 2px solid var(--accent-b);
}
.sidebar-logout {
    color: var(--text-dim);
    text-decoration: none;
    padding: 12px 20px;
    font-size: 13px;
    border-top: 1px solid var(--border);
}
.sidebar-logout:hover { color: var(--text); }

main { margin-left: 200px; padding: 28px 40px; max-width: 1600px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 18px;
    margin-bottom: 16px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 14px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }
.stat-label { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.dashboard-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .dashboard-row { grid-template-columns: 1fr; } }

/* Bar chart */
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin-top: 8px; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--accent-a), var(--accent-b));
    border-radius: 3px 3px 0 0;
    min-height: 2px;
}
.chart-label { font-size: 10px; color: var(--text-dim); writing-mode: vertical-rl; text-orientation: mixed; }

/* Horizontal breakdown bars */
.breakdown-row { margin-bottom: 10px; }
.breakdown-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.breakdown-head span:last-child { color: var(--text-dim); }
.breakdown-track { background: var(--surface-2); border-radius: 3px; height: 6px; overflow: hidden; }
.breakdown-fill { height: 100%; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--text-dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.3px; }
tr:last-child td { border-bottom: none; }

input, select, button {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 9px 10px;
    font-size: 13.5px;
}
button {
    background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
    color: #ffffff;
    border: none;
    font-weight: 600;
    cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.danger { background: #7f1d3a; }
button.secondary { background: var(--surface-2); color: var(--text); }

.login-box { max-width: 340px; margin: 100px auto; }
.error { color: #f87171; margin-bottom: 12px; font-size: 13px; }

.ip-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    margin: 2px;
    font-size: 12px;
}
.ip-tag button { padding: 0 6px; font-size: 12px; border-radius: 10px; }
form.inline { display: inline; }

@media (max-width: 720px) {
    .sidebar { position: static; width: auto; flex-direction: row; overflow-x: auto; }
    .sidebar-nav { flex-direction: row; }
    main { margin-left: 0; }
}
