:root {
    --brand: #4f46e5;
    --brand-dark: #3730a3;
    --brand-light: #e0e7ff;
    --surface: #ffffff;
    --bg: #f4f4f7;
    --text: #1e1e2e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ── Front page ── */

.bg-gradient-main {
    background: #1a1a2e;
    min-height: 100vh;
}

.main-card {
    width: 100%;
    max-width: 460px;
    border-radius: 14px;
    overflow: hidden;
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.main-card .card-header {
    background: #16213e;
    color: #fff;
    padding: 32px 28px 24px;
    border: none;
    text-align: center;
}

.main-card .card-header h4 {
    font-size: 1.25rem;
    letter-spacing: .5px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    background: rgba(255,255,255,.08);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.main-card .card-body { padding: 28px; }

.main-card .card-footer {
    background: #fafafa;
    border-top: 1px solid var(--border);
    padding: 14px 28px;
    font-size: .8rem;
    color: var(--text-muted);
}

.main-card .form-control,
.main-card .form-control:focus {
    border-radius: 8px;
    border-color: var(--border);
    font-size: .9rem;
    transition: border-color .15s, box-shadow .15s;
}

.main-card .form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

.main-card .btn-primary {
    background: var(--brand);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: .3px;
    padding: 12px;
    transition: background .15s;
}

.main-card .btn-primary:hover { background: var(--brand-dark); }

textarea.form-control {
    font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
    font-size: .82rem;
    line-height: 1.6;
}

/* ── Flash messages ── */

.flash-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    width: 96%;
    max-width: 520px;
}

.flash-container .alert {
    border: none;
    border-radius: 8px;
    font-size: .88rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

/* ── Admin ── */

.navbar { border-bottom: 1px solid rgba(255,255,255,.06); }

.admin-stats .card {
    border-radius: var(--radius);
    transition: transform .12s;
}

.admin-stats .card:hover { transform: translateY(-2px); }

.nav-tabs {
    border-bottom: 2px solid var(--border);
}

.nav-tabs .nav-link {
    color: var(--text-muted);
    font-weight: 500;
    font-size: .88rem;
    border: none;
    padding: 10px 18px;
    border-radius: 6px 6px 0 0;
    transition: color .15s, background .15s;
}

.nav-tabs .nav-link:hover { color: var(--text); background: rgba(0,0,0,.03); }

.nav-tabs .nav-link.active {
    color: var(--brand);
    background: var(--surface);
    border-bottom: 2px solid var(--brand);
    font-weight: 600;
}

.tab-card {
    border: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.table {
    font-size: .85rem;
}

.table th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    border-bottom-width: 2px;
}

.table td { vertical-align: middle; }

code {
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 4px;
    color: #334155;
    font-size: .82em;
    font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
}

.badge {
    font-weight: 500;
    font-size: .72rem;
    letter-spacing: .3px;
    padding: 4px 8px;
}

.user-select-all { user-select: all; cursor: pointer; }
.sticky-top { position: sticky; top: 0; z-index: 10; }

.btn { font-size: .85rem; border-radius: 7px; }
.btn-sm { font-size: .78rem; padding: 4px 10px; }

.form-label { font-size: .85rem; }
.form-text { font-size: .78rem; }
.form-control { font-size: .88rem; }
.form-select { font-size: .88rem; }

.section-title {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hint-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .82rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
