:root {
    --bg: #14161c;
    --surface: #1d2029;
    --surface-2: #262a36;
    --border: #333847;
    --text: #e8e9ed;
    --text-dim: #9aa0b0;
    --accent: #5b8def;
    --accent-hover: #4a78d6;
    --danger: #e15a5a;
    --success: #4fb477;
    --error: #e15a5a;
    --radius: 10px;
}

* { box-sizing: border-box; }

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

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

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.topnav { display: flex; align-items: center; gap: 1.25rem; }

.page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.flash-list { margin-bottom: 1.5rem; }
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}
.flash-error { background: rgba(225, 90, 90, 0.15); color: var(--error); border: 1px solid rgba(225, 90, 90, 0.3); }
.flash-success { background: rgba(79, 180, 119, 0.15); color: var(--success); border: 1px solid rgba(79, 180, 119, 0.3); }

.auth-card {
    max-width: 380px;
    margin: 3rem auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.auth-card h1 { margin-top: 0; text-align: center; }

form label {
    display: block;
    margin: 1rem 0 0.35rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

form input[type="text"],
form input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}

form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 1.25rem;
}
button:hover, .button:hover { background: var(--accent-hover); text-decoration: none; }

.inline-form { display: inline; margin: 0; }
.link-button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0;
    margin: 0;
    font-size: 0.95rem;
    text-decoration: underline;
}
.link-button.danger { color: var(--danger); }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text);
    margin: 0.5rem 0;
}
.checkbox-label input { width: auto; }

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 1.25rem;
    padding: 0.75rem 1rem 1rem;
}
legend { color: var(--text-dim); padding: 0 0.5rem; }
.hint { color: var(--text-dim); font-size: 0.85rem; margin: 0.5rem 0 0; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.tile {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 120px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.tile:hover { border-color: var(--accent); text-decoration: none; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.data-table th { color: var(--text-dim); font-weight: 600; }
.row-actions { display: flex; gap: 0.75rem; }
