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

:root {
    --sidebar:  220px;
    --accent:   #2563eb;
    --accent-h: #1d4ed8;
    --dark:     #0f172a;
    --mid:      #1e293b;
    --surface:  #ffffff;
    --muted:    #64748b;
    --border:   #e2e8f0;
    --radius:   10px;
    --shadow:   0 4px 24px rgba(0,0,0,.08);
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

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

/* ── TOP NAV (two rows) ── */
nav {
    background: var(--dark);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Row 1: brand + user info */
.nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 52px;
}
nav .brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.5px;
    text-decoration: none;
}
nav .brand:hover { color: #e2e8f0; text-decoration: none; }

.nav-user {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.nav-user > span {
    color: #94a3b8;
    font-size: .875rem;
}
.nav-user .btn-outline {
    border-color: rgba(255,255,255,.25);
    color: #94a3b8;
    font-size: .82rem;
    padding: .3rem .85rem;
}
.nav-user .btn-outline:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
    text-decoration: none;
}

/* Row 2: nav links */
.nav-links {
    display: flex;
    align-items: stretch;
    padding: 0 2rem;
    height: 40px;
    background: rgba(0,0,0,.2);
    border-top: 1px solid rgba(255,255,255,.06);
    gap: 0;
}
.nav-links a {
    color: #94a3b8;
    font-size: .875rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    transition: background .12s, color .12s;
}
.nav-links a:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
    text-decoration: none;
}
.nav-links a.active {
    color: #fff;
    border-bottom-color: #2563eb;
    font-weight: 600;
}

/* ── BUTTONS ── */
.btn {
    display: inline-block;
    padding: .55rem 1.3rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn-sm { padding: .35rem .9rem; font-size: .82rem; }
.btn:active { transform: scale(.97); }

/* ── HERO ── */
.hero {
    background: linear-gradient(135deg, var(--dark) 0%, var(--mid) 100%);
    color: #fff;
    padding: 5rem 2rem 4rem;
    text-align: center;
}
.hero h1 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; margin-bottom: 1rem; }
.hero p  { font-size: 1.1rem; color: #94a3b8; max-width: 520px; margin: 0 auto 2rem; }
.hero .cta-group { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ── FEATURES ── */
.features { padding: 4rem 2rem; max-width: 960px; margin: 0 auto; }
.features h2 { text-align: center; font-size: 1.6rem; margin-bottom: 2.5rem; }
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.feature-card .icon { font-size: 2rem; margin-bottom: .75rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: .4rem; }
.feature-card p  { font-size: .87rem; color: var(--muted); }

/* ── CARD (login) ── */
.card-wrap {
    min-height: calc(100vh - 92px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}
.card h2 { font-size: 1.4rem; margin-bottom: .3rem; }
.card .subtitle { font-size: .87rem; color: var(--muted); margin-bottom: 1.75rem; }

/* ── FORM ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.form-group input {
    width: 100%;
    padding: .6rem .85rem;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: .95rem;
    transition: border-color .15s;
    background: #f8fafc;
}
.form-group input:focus { outline: none; border-color: var(--accent); background: #fff; }
.form-footer { margin-top: 1.25rem; font-size: .85rem; color: var(--muted); text-align: center; }

/* ── ALERTS ── */
.alert {
    padding: .75rem 1rem;
    border-radius: 7px;
    font-size: .87rem;
    margin-bottom: 1rem;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ── DASHBOARD ── */
.dash-wrap { max-width: 960px; margin: 2.5rem auto; padding: 0 1.5rem; }
.dash-header { margin-bottom: 2rem; }
.dash-header h1 { font-size: 1.5rem; }
.dash-header p   { color: var(--muted); font-size: .9rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
}
.stat-card .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--accent); }

.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.table-card h3 { padding: 1rem 1.5rem; font-size: 1rem; border-bottom: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { background: #f1f5f9; text-align: left; padding: .65rem 1.5rem; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td { padding: .7rem 1.5rem; border-top: 1px solid var(--border); }
tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-admin { background: #dbeafe; color: #1e40af; }
.badge-user  { background: #f1f5f9; color: #475569; }

/* ── NAV DROPDOWN (hamburger) ── */
.nav-dropdown-wrap {
    position: relative;
}
.nav-hamburger {
    background: none;
    border: 1px solid rgba(255,255,255,.2);
    color: #94a3b8;
    border-radius: 6px;
    padding: .28rem .55rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.nav-hamburger:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.nav-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + .4rem);
    background: #1e293b;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    z-index: 300;
    overflow: hidden;
}
.nav-dropdown.open { display: block; }
.nav-dropdown a {
    display: block;
    padding: .6rem 1rem;
    color: #94a3b8;
    font-size: .875rem;
    text-decoration: none;
    white-space: nowrap;
}
.nav-dropdown a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
    text-decoration: none;
}
.nav-dropdown a.active { color: #fff; font-weight: 600; }

/* ── FOOTER ── */
footer { text-align: center; padding: 2.5rem 1rem; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border); margin-top: 3rem; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
    .nav-top { padding: 0 1rem; }
    .nav-links { padding: 0 .5rem; overflow-x: auto; }
    .nav-links a { padding: 0 .65rem; font-size: .82rem; white-space: nowrap; }
    .dash-wrap { padding: 0 1rem; }
}
