:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5d667a;
    --accent: #2f5fd0;
    --border: #d8dce5;
    --ok-bg: #e6f4ea;  --ok-text: #1e6b34;
    --err-bg: #fdecea; --err-text: #9b1c1c;
    --info-bg: #e8f0fe; --info-text: #1a3f8f;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 1rem; }
main.container { flex: 1; padding-top: 2rem; padding-bottom: 2rem; }
a { color: var(--accent); }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 3.5rem; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
nav { display: flex; gap: 1rem; align-items: center; }
nav a { text-decoration: none; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.flash { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-success { background: var(--ok-bg);   color: var(--ok-text); }
.flash-error   { background: var(--err-bg);  color: var(--err-text); }
.flash-info    { background: var(--info-bg); color: var(--info-text); }
.site-footer { border-top: 1px solid var(--border); padding: 1rem 0; color: var(--muted); }

/* ---- Forms ---- */
h1 { margin-top: 0; }
.form { max-width: 24rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin-bottom: 1rem; }
.form label { display: block; font-weight: 600; margin: 1rem 0 .25rem; }
.form label:first-of-type { margin-top: 0; }
.form input[type="email"], .form input[type="password"], .form input[type="text"] {
    width: 100%; padding: .55rem .7rem; font: inherit; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text);
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.button { margin-top: 1.25rem; padding: .6rem 1.1rem; font: inherit; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 6px; cursor: pointer; }
.button:hover { filter: brightness(1.1); }

/* ---- Admin tables ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: .1rem .5rem; font-size: .8rem; border-radius: 999px; background: var(--info-bg); color: var(--info-text); }
.badge-admin { background: var(--ok-bg); color: var(--ok-text); }
.button-small { padding: .25rem .6rem; font: inherit; font-size: .85rem; color: #fff; background: var(--accent); border: 0; border-radius: 5px; cursor: pointer; }
.button-secondary { background: transparent; color: var(--err-text); border: 1px solid var(--err-text); }
.muted { color: var(--muted); }
.pager { display: flex; gap: 1rem; align-items: center; }

/* ---- Two-factor ---- */
h2 { margin: 2rem 0 .5rem; font-size: 1.15rem; }
.qr { background: #fff; display: inline-block; padding: .75rem; border: 1px solid var(--border); border-radius: 8px; margin: .5rem 0 1rem; }
.qr img { display: block; }
.manual-key { font: 1rem/1.4 ui-monospace, Consolas, monospace; background: var(--surface); padding: .15rem .4rem; border: 1px solid var(--border); border-radius: 4px; word-break: break-all; }
.codes { list-style: none; padding: 1rem; margin: 0 0 1rem; max-width: 24rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; columns: 2; font: 1.05rem/1.9 ui-monospace, Consolas, monospace; }
.button-danger { background: var(--err-text); }

/* ---- Navigation: current page ---- */
nav a[aria-current="page"] { font-weight: 700; color: var(--text); }

/* Menu settings page */
.menu-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.menu-table th, .menu-table td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border, #ddd); }
.menu-table input[type="number"] { width: 4.5rem; }
.muted { color: #666; }
