:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --ink: #1c2430;
    --muted: #6b7684;
    --line: #e3e7ec;
    --brand: #c0392b;
    --brand-dark: #97281c;
    --ok: #1e874b;
    --warn: #b8860b;
    --danger: #c0392b;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

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

.topbar {
    background: var(--ink);
    color: #fff;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar .brand { font-weight: 700; letter-spacing: 0.02em; }
.topbar .brand span { color: var(--brand); }
.topbar a { color: #cfd6de; }
.topbar .spacer { flex: 1; }
.topbar nav a { margin-left: 1rem; }

.container { max-width: 960px; margin: 1.5rem auto; padding: 0 1.25rem; }
.container.narrow { max-width: 460px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.muted { color: var(--muted); font-size: 0.9rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0.2rem; }
input, select, textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 60px; resize: vertical; }

.btn {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f0f2f5; }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }
.btn.danger { background: var(--danger); }

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.ok { background: #e4f4ea; color: var(--ok); }
.badge.warn { background: #fbf1d8; color: var(--warn); }
.badge.danger { background: #fbe3e0; color: var(--danger); }

.flash { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; background: #e4f4ea; color: var(--ok); border: 1px solid #b8e0c6; }
.error { padding: 0.7rem 1rem; border-radius: 6px; margin-bottom: 1rem; background: #fbe3e0; color: var(--danger); border: 1px solid #f0c2bc; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .kicker { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; color: var(--brand); font-weight: 700; }

/* Public menu */
.menu-hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.menu-hero h1 { font-size: 1.8rem; margin-bottom: 0.25rem; }
.menu-logo { max-height: 96px; max-width: 70%; margin: 0 auto 0.5rem; display: block; }
.menu-cat { margin-top: 1.5rem; }
.menu-cat h2 { border-bottom: 2px solid var(--brand); padding-bottom: 0.3rem; }
.menu-item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px dashed var(--line); }
.menu-item .name { font-weight: 600; }
.menu-item .desc { color: var(--muted); font-size: 0.9rem; }
.menu-item .price { white-space: nowrap; font-weight: 600; }
.menu-item.unavailable { opacity: 0.5; }
.soldout { font-size: 0.75rem; color: var(--danger); font-weight: 600; }

.qr-box { text-align: center; }
.qr-box img { width: 300px; height: 300px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.qr-box img.table-card-preview {
    width: 320px;
    height: auto;
    max-width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10);
}
.linkbox { font-family: monospace; background: #f0f2f5; padding: 0.5rem; border-radius: 6px; word-break: break-all; }

/* Analytics */
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat .label { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.trend { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 0.5rem; }
.trend .bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.trend .bar { width: 100%; min-height: 2px; background: var(--brand); border-radius: 3px 3px 0 0; transition: background 0.15s; }
.trend .bar:hover { background: var(--brand-dark); }
.trend .bar.empty { background: var(--line); }
.trend-axis { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-top: 0.35rem; }
