:root {
    --accent:     #337ab7;
    --accent-h:   #286090;
    --accent-ink: #ffffff;

    --blue:       #337ab7;
    --blue-bg:    #d9eaf7;
    --blue-ink:   #1a3f5c;
    --green:      #4cae4c;
    --green-bg:   #dff0d8;
    --green-ink:  #2d6a2d;
    --amber:      #e6a817;
    --amber-bg:   #fcf8e3;
    --amber-ink:  #8a6000;
    --red:        #d9534f;
    --red-bg:     #f2dede;
    --red-ink:    #7f2020;

    --ok:         #4cae4c;
    --ok-bg:      #dff0d8;
    --ok-ink:     #2d6a2d;
    --err:        #d9534f;
    --err-bg:     #f2dede;
    --err-ink:    #7f2020;
    --info-bg:    #d9eaf7;
    --info-ink:   #1a3f5c;

    --ink:        #111827;
    --ink-2:      #374151;
    --muted:      #6b7280;
    --line:       #e5e7eb;
    --bg:         #f9fafb;
    --card:       #ffffff;

    --radius:     10px;
    --radius-sm:  7px;
    --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Top bar ─────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 2rem;
    height: 58px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.topbar .brand {
    font-weight: 800;
    font-size: 1rem;
    color: var(--ink);
    letter-spacing: -.3px;
    margin-right: 1rem;
}
.topbar .brand:hover { text-decoration: none; }

.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 0.1rem; }

.topbar nav a {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-2);
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: background .1s;
}
.topbar nav a:hover { background: var(--bg); color: var(--ink); text-decoration: none; }

.topbar .nav-sep { width: 1px; height: 18px; background: var(--line); margin: 0 0.4rem; }

.topbar .who {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    margin: 0 0.15rem;
}

/* ── Layout ──────────────────────────────────────────────────── */
.container { max-width: 860px; margin: 2rem auto; padding: 0 1.5rem; }

/* ── Typography ──────────────────────────────────────────────── */
h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.4px;
    margin: 0 0 1.25rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

h2 {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.75rem;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.375rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

/* ── Forms ───────────────────────────────────────────────────── */
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-2);
    margin: 0.85rem 0 0.3rem;
}
label:first-child { margin-top: 0; }

input[type=text],
input[type=email],
input[type=password],
input[type=number],
select,
textarea {
    width: 100%;
    padding: 0.575rem 0.8rem;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    outline: none;
    appearance: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(51,122,183,.13);
}
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    padding-right: 2.2rem;
}
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: var(--accent);
    color: #fff;
    border: 0;
    padding: 0.575rem 1.125rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 0.875rem;
    transition: background .12s, transform .1s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:hover { background: var(--accent-h); text-decoration: none; }
.btn:active { transform: scale(.98); }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; margin-top: 0; border-radius: 6px; }

.btn-ghost {
    background: transparent;
    color: var(--ink-2);
    border: 1.5px solid var(--line);
}
.btn-ghost:hover { background: var(--bg); border-color: #d1d5db; color: var(--ink); }

.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #15803d; }

.btn-danger { background: transparent; color: var(--err); border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: var(--err-bg); }

/* ── Flashes ─────────────────────────────────────────────────── */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.flash-success { background: var(--ok-bg);  color: var(--ok-ink); }
.flash-success::before { content: "✓"; font-weight: 800; }
.flash-error   { background: var(--err-bg); color: var(--err-ink); }
.flash-error::before { content: "✕"; font-weight: 800; }
.flash-info    { background: var(--info-bg); color: var(--info-ink); }
.flash-info::before { content: "ℹ"; }

.errors {
    background: var(--err-bg);
    color: var(--err-ink);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.errors ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }

/* ── Tables ──────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 2px solid var(--line); }
th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}
.col-sort:hover { color: var(--accent); }
.sort-icon { font-style: normal; opacity: .5; }
.table-search {
    width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
}
.table-search:focus { border-color: var(--accent); }
td {
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f9fafb; }

/* ── Pills ───────────────────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: var(--muted);
    white-space: nowrap;
}
.pill-ok     { background: var(--green-bg); color: var(--green-ink); }
.pill-warn   { background: var(--amber-bg); color: var(--amber-ink); }
.pill-danger { background: var(--red-bg);   color: var(--red-ink); }
.pill-blue   { background: var(--blue-bg);  color: var(--blue-ink); }

/* ── Stat cards (dashboard) ──────────────────────────────────── */
.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat-card {
    flex: 1;
    min-width: 160px;
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-shadow: var(--shadow);
}
.stat-card .stat-val   { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: 0.8rem; opacity: .85; margin-top: 0.2rem; }
.stat-card .stat-icon  { font-size: 2rem; opacity: .35; }
.stat-blue   { background: var(--blue); }
.stat-green  { background: var(--green); }
.stat-amber  { background: var(--amber); }
.stat-red    { background: var(--red); }

/* ── Utilities ───────────────────────────────────────────────── */
.muted { color: var(--muted); font-size: 0.875rem; }
.right { text-align: right; }
.row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }
.inline-form { display: inline; }

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

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-wrap {
    min-height: calc(100vh - 58px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-card h1 { justify-content: center; margin-bottom: 1.5rem; }
.auth-card .btn { width: 100%; margin-top: 1.25rem; }
.auth-footer { margin-top: 1.25rem; text-align: center; font-size: 0.875rem; color: var(--muted); }

/* ── VIP hero ────────────────────────────────────────────────── */
.vip-hero { text-align: center; padding: 2.5rem 1.5rem; }
.vip-hero .vip-star { font-size: 2.75rem; display: block; margin-bottom: 0.5rem; }
.vip-hero h2 { font-size: 1.25rem; text-transform: none; letter-spacing: -.2px; color: var(--ink); margin-bottom: 0.5rem; }
.vip-hero .muted { font-size: 0.95rem; }
.vip-hero .price { font-size: 2.25rem; font-weight: 800; color: var(--accent); margin: 0.75rem 0 1.25rem; letter-spacing: -1px; }
.vip-hero .btn { margin: 0 auto; display: inline-flex; font-size: 0.95rem; padding: 0.65rem 1.75rem; }
.vip-hero ul.feature-list { text-align: left; display: inline-block; margin: 0.75rem auto 1rem; }

.feature-list { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.feature-list li { padding: 0.3rem 0; color: var(--ink); }
.feature-list li.pill-ok { color: var(--green); }

/* ── About page ──────────────────────────────────────────────── */
.about-steps {
    margin: 0;
    padding-left: 1.4rem;
}
.about-steps li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.9rem;
    line-height: 1.6;
}
.about-steps li:last-child { border-bottom: 0; }
.about-steps strong { color: var(--ink); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    .topbar { padding: 0 1rem; }
    .topbar nav a { padding: 0.3rem 0.4rem; font-size: 0.8rem; }
    .container { margin: 1rem auto; padding: 0 1rem; }
    h1 { font-size: 1.3rem; }
    .card { padding: 1rem 1.1rem; }
    .row > * { min-width: 140px; }
    td, th { padding: 0.55rem 0.4rem; }
}
