:root {
    --bg: #1a1b26;
    --bg2: #24283b;
    --bg3: #414868;
    --fg: #c0caf5;
    --fg2: #a9b1d6;
    --blue: #7aa2f7;
    --green: #9ece6a;
    --red: #f7768e;
    --yellow: #e0af68;
    --cyan: #7dcfff;
    --purple: #bb9af7;
    --border: #3b4261;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
}

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

/* Login */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-box {
    background: var(--bg2);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    width: 320px;
    text-align: center;
}
.login-box h1 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    color: var(--blue);
}
.login-box input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
    font-size: 1rem;
    margin-bottom: 1rem;
}
.login-box button {
    width: 100%;
    padding: 0.6rem;
    border: none;
    border-radius: 4px;
    background: var(--blue);
    color: var(--bg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.login-box button:hover { opacity: 0.9; }

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

/* Nav */
nav {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
nav .logo { font-weight: 700; font-size: 1.1rem; color: var(--blue); }
nav .links a {
    margin-left: 1.5rem;
    color: var(--fg2);
    font-size: 0.9rem;
}
nav .links a:hover, nav .links a.active { color: var(--blue); text-decoration: none; }
nav .links .logout { color: var(--red); }

/* Flash */
.flash {
    padding: 0.7rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.flash.success { background: rgba(158,206,106,0.15); border: 1px solid var(--green); color: var(--green); }
.flash.error { background: rgba(247,118,142,0.15); border: 1px solid var(--red); color: var(--red); }

/* Cards */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--blue); text-decoration: none; }
.card h3 { color: var(--blue); margin-bottom: 0.5rem; font-size: 1rem; }
.card .count { font-size: 2rem; font-weight: 700; color: var(--fg); }

/* Tables */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 0 1rem;
}
.table-header h2 { font-size: 1.2rem; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
th, td {
    padding: 0.6rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--bg3);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--fg2);
    font-weight: 600;
}
tr:hover { background: rgba(122,162,247,0.05); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--blue); color: var(--bg); }
.btn-danger { background: var(--red); color: var(--bg); }
.btn-sm { padding: 0.2rem 0.5rem; font-size: 0.8rem; }
.btn-ghost { background: transparent; color: var(--fg2); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }

/* Forms */
.form-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.form-row input, .form-row select {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--fg);
    font-size: 0.9rem;
}
.form-row input[type="text"] { flex: 1; }

/* Toggle */
.toggle {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: var(--bg3);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}
.toggle.active { background: var(--green); }
.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    transition: transform 0.2s;
}
.toggle.active::after { transform: translateX(16px); }

/* Badge */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-green { background: rgba(158,206,106,0.2); color: var(--green); }
.badge-red { background: rgba(247,118,142,0.2); color: var(--red); }

/* Section */
.section { margin-top: 2rem; }
.section h3 { color: var(--cyan); margin-bottom: 0.8rem; }

/* Inline edit */
.inline-edit {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.inline-edit input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    width: 100%;
    font-size: 0.9rem;
}
.inline-edit input:focus { border-color: var(--blue); outline: none; }

/* Responsive */
@media (max-width: 768px) {
    nav { flex-direction: column; gap: 0.5rem; }
    .form-row { flex-direction: column; }
    .container { padding: 1rem; }
}
