:root {
    --brand: #c62b7a;
    --brand-600: #ac2069;
    --brand-050: #fce8f2;
    --bg: #f5f5f7;
    --card: #ffffff;
    --ink: #1a1a22;
    --ink-2: #3f3f4a;
    --muted: #6c6c78;
    --line: #e8e8ee;
    --sidebar-bg: #17151c;
    --sidebar-ink: #a9a6b4;
    --sidebar-hover: #26232e;
    --ok: #15803d; --ok-bg: #e7f6ec;
    --err: #b42318; --err-bg: #fdeceb;
    --warn: #b45309; --warn-bg: #fef3e2;
    --info: #1d4ed8; --info-bg: #e8eefc;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(17,17,26,.04), 0 6px 20px rgba(17,17,26,.06);
    --shadow-lg: 0 10px 40px rgba(17,17,26,.12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; letter-spacing: -.02em; margin: 0 0 .3em; }
h2 { font-size: 1.15rem; letter-spacing: -.01em; margin: 0 0 .6em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.center { text-align: center; }
.mt { margin-top: 1.1rem; }
.stack > * + * { margin-top: .5rem; }

/* ---------- Public / client shell ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header-inner { max-width: 940px; margin: 0 auto; padding: 16px 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.08rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-icon { color: var(--brand); }
.container { max-width: 940px; margin: 0 auto; padding: 30px 22px 60px; }
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 28px; }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
    margin-bottom: 22px;
}
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.card-head h1, .card-head h2 { margin: 0; flex: 1; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 600; font-size: .95rem;
    background: var(--brand); color: #fff; padding: 11px 18px; border-radius: var(--radius-sm);
    transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
    line-height: 1;
}
.btn:hover { background: var(--brand-600); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: #f3f3f6; }
.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 8px 13px; font-size: .85rem; }
.btn i { font-size: .9em; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin: 16px 0 6px; font-size: .92rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line);
    border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-050);
}
textarea { min-height: 96px; resize: vertical; }
input[type=file] {
    width: 100%; padding: 22px; border: 2px dashed var(--line); border-radius: var(--radius-sm);
    background: #fafafb; cursor: pointer; transition: border-color .15s, background .15s;
}
input[type=file]:hover { border-color: var(--brand); background: var(--brand-050); }
.help { color: var(--muted); font-size: .84rem; margin-top: 6px; }
.checkbox { display: flex; align-items: center; gap: 9px; margin-top: 16px; }
.checkbox input { width: auto; }
.checkbox label { margin: 0; font-weight: 500; }
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row > div { flex: 1; min-width: 200px; }

/* ---------- Flash ---------- */
.flash {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500;
    border: 1px solid transparent;
}
.flash i { font-size: 1.05rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); border-color: #c9ecd5; }
.flash-error { background: var(--err-bg); color: var(--err); border-color: #f7d4d1; }
.flash-info { background: var(--info-bg); color: var(--info); border-color: #d3ddf9; }

/* ---------- Link box (WeTransfer style) ---------- */
.linkbox { display: flex; gap: 9px; margin: 12px 0; flex-wrap: wrap; }
.linkbox input { font-family: ui-monospace, monospace; font-size: .85rem; background: #fafafb; flex: 1; min-width: 240px; }
.callout {
    border: 1px solid var(--brand-050); background: linear-gradient(180deg,#fff,var(--brand-050));
    border-radius: var(--radius); padding: 22px;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
.table tbody tr:hover { background: #fafafb; }
.table tr:last-child td { border-bottom: 0; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-muted { background: #f0f0f3; color: var(--muted); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-050); color: var(--brand); display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.stat .num { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: .82rem; }

/* ---------- File list ---------- */
.filelist { list-style: none; padding: 0; margin: 0; }
.filelist li { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.filelist li:last-child { border-bottom: 0; }
.file-icon { width: 42px; height: 42px; border-radius: 10px; background: #f2f2f5; color: var(--muted); display: grid; place-items: center; font-size: 1.05rem; flex: none; }
.filelist .fgrow { flex: 1; min-width: 0; }
.filelist .fname { font-weight: 600; word-break: break-word; }
.filelist .fmeta { color: var(--muted); font-size: .82rem; }

/* ---------- Auth screens ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1200px 500px at 50% -10%, var(--brand-050), var(--bg)); }
.auth-card { width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 1.15rem; margin-bottom: 6px; }
.auth-logo i { color: var(--brand); }

/* ---------- Admin shell (sidebar) ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 244px; flex: none; background: var(--sidebar-bg); color: var(--sidebar-ink);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 20px 22px; color: #fff; font-weight: 700; font-size: 1.05rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-brand i { color: var(--brand); }
.sidebar-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 13px; border-radius: 9px; color: var(--sidebar-ink); font-size: .93rem; font-weight: 500; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--brand); color: #fff; }
.sidebar-nav a i { width: 18px; text-align: center; font-size: .95rem; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-foot a { display: flex; align-items: center; gap: 12px; padding: 10px 13px; border-radius: 9px; color: var(--sidebar-ink); font-size: .93rem; }
.sidebar-foot a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.content { flex: 1; min-width: 0; }
.content-inner { max-width: 1040px; margin: 0 auto; padding: 30px 30px 60px; }
.page-title { margin-bottom: 22px; }

@media (max-width: 860px) {
    .admin-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar-brand { border-bottom: 0; padding: 14px 18px; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex: 1; padding: 8px; }
    .sidebar-nav a span { display: none; }
    .sidebar-foot { border-top: 0; padding: 8px; }
    .sidebar-foot a span { display: none; }
    .content-inner { padding: 22px 18px 50px; }
}

.inline-form { display: inline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
