:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1c2333;
    --muted: #6b7280;
    --border: #e2e5ea;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success-bg: #ecfdf5;
    --success-text: #047857;
    --error-bg: #fef2f2;
    --error-text: #b91c1c;
    --warn-bg: #fffbeb;
    --warn-text: #b45309;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }

main.container { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-top: .75rem; padding-bottom: .75rem; flex-wrap: wrap; gap: .5rem; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--primary); }
.nav a.button { color: #fff; }
.nav a.button:hover { color: #fff; background: var(--primary-dark); }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; padding: 2rem 0 1rem; background: var(--surface); }
.site-footer strong { color: var(--text); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; } }
.footer-links { list-style: none; padding: 0; margin: .5rem 0 0; }
.footer-links li { margin-bottom: .35rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 1.5rem; padding-top: 1rem; }

/* Cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.card h1, .card h2 { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat-tile .value { font-size: 1.75rem; font-weight: 700; }
.stat-tile .label { color: var(--muted); font-size: .85rem; }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: 1.1rem; }
input[type=text], input[type=email], input[type=password], input[type=file], textarea, select {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 8rem; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.field-error { color: var(--error-text); font-size: .85rem; margin-top: .25rem; }

.checkbox-row { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.checkbox-row input { width: auto; }

/* Buttons */
.button, button[type=submit]:not(.link-button) {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .55rem 1.2rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.button:hover, button[type=submit]:not(.link-button):hover { background: var(--primary-dark); }
.button.secondary, button.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.button.secondary:hover, button.secondary:hover { background: var(--bg); }
.button.danger, button.danger { background: var(--error-text); }
.button.small { padding: .35rem .8rem; font-size: .9rem; }
.link-button { background: none; border: none; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; padding: 0; }
.link-button:hover { color: var(--primary); }
.inline { display: inline; }

/* Alerts */
.alert { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1.25rem; }
.alert.success { background: var(--success-bg); color: var(--success-text); }
.alert.error { background: var(--error-bg); color: var(--error-text); }
.alert ul { margin: 0; padding-left: 1.2rem; }

/* Badges */
.badge { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .78rem; font-weight: 600; }
.badge.draft { background: var(--warn-bg); color: var(--warn-text); }
.badge.pending { background: var(--warn-bg); color: var(--warn-text); }
.badge.published { background: var(--success-bg); color: var(--success-text); }
.badge.failed { background: var(--error-bg); color: var(--error-text); }
.badge.neutral { background: var(--bg); color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; }

/* Misc */
.auth-card { max-width: 440px; margin: 3rem auto; }
.muted { color: var(--muted); }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 1rem; }
.post-content { white-space: pre-wrap; }
.thumb { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.tag-chip { display: inline-block; background: #eef2ff; color: var(--primary-dark); border-radius: 999px; padding: .1rem .6rem; font-size: .8rem; margin-right: .3rem; }
.provider-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.provider-row:last-child { border-bottom: none; }
.provider-meta { display: flex; align-items: center; gap: .75rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); }
.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.qr-box { background: #fff; display: inline-block; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.recovery-codes { background: var(--bg); border-radius: 8px; padding: 1rem; font-family: ui-monospace, monospace; font-size: .9rem; line-height: 1.8; }
/* Pagination (simple-default view) */
ul.pagination { list-style: none; display: flex; gap: .5rem; padding: 0; }
ul.pagination a, ul.pagination span { display: inline-block; padding: .4rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text); }
ul.pagination .disabled span { color: var(--muted); }

.hero { text-align: center; padding: 2rem 1rem 3rem; }
.hero h1 { font-size: 2.4rem; margin-bottom: .75rem; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 0 auto 1.75rem; }
.hero-art { max-width: 700px; margin: 0 auto 1rem; }
.hero-art svg { width: 100%; height: auto; display: block; }
