:root {
  /* Világos (alapértelmezett) */
  --brand: #8C292E;
  --brand-dark: #6E1F23;
  --brand-tint: #F6ECEC;
  --on-brand: #FFFFFF;
  --topbar-bg: #8C292E;
  --topbar-fg: #FFFFFF;
  --bg: #F7F5F2;
  --surface: #FFFFFF;
  --surface-2: #FBFAF8;
  --text: #1F1B1A;
  --heading: #1F1B1A;
  --muted: #6B6461;
  --line: #E6E1DC;
  --ok: #2E7D4F;
  --ok-tint: #E7F3EC;
  --on-ok: #FFFFFF;
  --warn: #A86400;
  --warn-tint: #FCF1E1;
  --err: #B3261E;
  --err-tint: #FBE9E8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 27, 26, .06), 0 4px 16px rgba(31, 27, 26, .05);
  --head: "League Spartan", "Segoe UI", system-ui, sans-serif;
  --body: "Roboto Condensed", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
/* Sötét */
:root[data-theme="dark"] {
  --bg: #161312; --surface: #211C1B; --surface-2: #1B1716; --text: #F2EDEA; --heading: #F2EDEA; --muted: #A79F9B;
  --line: #362F2D; --brand: #C2484E; --brand-dark: #D5646A; --brand-tint: #3A2223; --on-brand: #FFFFFF;
  --topbar-bg: #6E1F23; --topbar-fg: #FFFFFF;
  --ok: #5CC28A; --ok-tint: #1D3326; --on-ok: #0F2418; --warn: #E3A548; --warn-tint: #3A2C17; --err: #F07C74; --err-tint: #3D2120;
  --shadow: none; color-scheme: dark;
}
/* Flúg – világos: krém alap, zsályazöld, barna */
:root[data-theme="flug"] {
  --bg: #F0E9E3; --surface: #FBF8F5; --surface-2: #F6F1EC; --text: #2E2721; --heading: #5C4E41; --muted: #6E6158;
  --line: #E2D8CF; --brand: #4F6B5C; --brand-dark: #3F5A4C; --brand-tint: #E2EAE5; --on-brand: #FFFFFF;
  --topbar-bg: #879F91; --topbar-fg: #FFFFFF;
  --shadow: 0 1px 2px rgba(92, 78, 65, .07), 0 4px 16px rgba(92, 78, 65, .06); color-scheme: light;
}
/* Flúg – sötét: barna alap, zsályazöld kiemelés */
:root[data-theme="flug-dark"] {
  --bg: #2A231E; --surface: #362E28; --surface-2: #312923; --text: #F0E9E3; --heading: #F0E9E3; --muted: #BFB2A6;
  --line: #4A3F36; --brand: #9FB8AA; --brand-dark: #B9CDC1; --brand-tint: #39443D; --on-brand: #1E1A16;
  --topbar-bg: #5C4E41; --topbar-fg: #F0E9E3;
  --ok: #7FCB9E; --ok-tint: #263A2D; --on-ok: #0F2418; --warn: #E3B263; --warn-tint: #3E3020; --err: #F08E86; --err-tint: #432823;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--body); }
h1, h2, h3 { color: var(--heading); font-family: var(--head); line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.08rem; }
a { color: var(--brand); }
.container { max-width: 1180px; margin: 0 auto; padding: 16px 16px 64px; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
@media (max-width: 400px) { .grid.wide { grid-template-columns: 1fr; } }
.hidden { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--topbar-bg); color: var(--topbar-fg); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--topbar-fg); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--topbar-fg); color: var(--topbar-bg); display: grid; place-items: center;
  font: 700 22px/1 var(--head); padding-top: 3px; }
.brand-text { font: 700 1.3rem/1 var(--head); } .brand-text small { font-weight: 500; opacity: .8; font-size: .85rem; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; color: var(--topbar-fg); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; }
.icon-btn:hover { background: rgba(0,0,0,.10); }
.badge-dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--topbar-fg); color: var(--topbar-bg);
  font: 700 11px/18px var(--body); text-align: center; padding: 0 4px; }
.user-chip { color: var(--topbar-fg); text-decoration: none; padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.16); font-weight: 500;
  max-width: 44vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { position: sticky; top: 54px; z-index: 19; display: flex; gap: 2px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 12px 12px 10px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .sep { width: 1px; background: var(--line); margin: 10px 6px; flex: none; }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.day-card.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.day-card.closed { opacity: .82; }
.day-title { font: 600 1.15rem/1.1 var(--head); text-transform: capitalize; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font: 700 1.6rem/1.1 var(--head); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .875rem; }

/* menu item row */
.mi { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.mi:first-of-type { border-top: 0; }
.meal-head { font: 700 .78rem var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 12px 0 2px; }
.day-card .meal-head:first-of-type, .card-head + .meal-head { margin-top: 0; }
.meal-head + .mi { border-top: 0; }
.meal-row td { background: var(--brand-tint); color: var(--brand); font: 700 .8rem var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 7px 12px; }
.meal-row td span { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.meal-tag { display: inline-block; font: 700 .68rem/1.6 var(--body); letter-spacing: .05em; text-transform: uppercase; padding: 0 6px; border-radius: 5px; vertical-align: 1px; }
.meal-breakfast { background: var(--warn-tint); color: var(--warn); }
.meal-lunch { background: var(--brand-tint); color: var(--brand); }
.mi-name { font-weight: 600; } .mi-meta { color: var(--muted); font-size: .85rem; }
.mi-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); font-weight: 700; margin-right: 6px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.stepper button { width: 38px; height: 38px; border: 0; background: transparent; color: var(--text); font-size: 20px; cursor: pointer; }
.stepper button:hover:not(:disabled) { background: var(--brand-tint); color: var(--brand); }
.stepper button:disabled { opacity: .35; cursor: default; }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.total { font: 700 1.15rem var(--head); font-variant-numeric: tabular-nums; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.b-pending { background: var(--warn-tint); color: var(--warn); }
.b-confirmed, .b-active, .b-paid { background: var(--ok-tint); color: var(--ok); }
.b-rejected, .b-disabled, .b-closed { background: var(--err-tint); color: var(--err); }
.b-cancelled, .b-draft, .b-neutral { background: var(--line); color: var(--muted); }
.b-brand { background: var(--brand-tint); color: var(--brand); }

/* forms & buttons */
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 42px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); vertical-align: middle; }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 .95rem var(--body); padding: 0 16px; min-height: 42px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--on-brand); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.btn.danger { color: var(--err); } .btn.danger:hover { border-color: var(--err); }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: .85rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 8px 14px; font: 500 .9rem var(--body); color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--on-brand); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 .8rem var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; background: var(--surface-2); }
td.n, th.n { text-align: right; }

/* auth */
.auth-wrap { min-height: 100vh; display: flex; justify-content: center; align-items: flex-start; padding: max(48px, 8vh) 16px 32px;
  background: linear-gradient(180deg, var(--topbar-bg) 0 290px, var(--bg) 290px); }
.auth { width: 100%; max-width: 420px; }
.auth-brand { color: var(--topbar-fg); text-align: center; margin-bottom: 18px; }
.auth-brand .brand-mark { width: 56px; height: 56px; font-size: 36px; margin: 0 auto 10px; border-radius: 14px; }
.auth-brand h1 { color: var(--topbar-fg); font-size: 2rem; margin: 0; }
.auth-brand p { margin: 4px 0 0; opacity: .85; }

/* misc */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--brand-tint); color: var(--text); border: 1px solid transparent; }
.notice.warn { background: var(--warn-tint); } .notice.ok { background: var(--ok-tint); } .notice.err { background: var(--err-tint); }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: calc(100vw - 32px); font-weight: 500; }
.toast.err { background: var(--err); color: #fff; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20, 12, 12, .45); }
dialog form { padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.person { border-top: 1px solid var(--line); padding: 12px 0; }
.person:first-child { border-top: 0; }
.person-items { margin: 4px 0 0; padding: 0; list-style: none; color: var(--muted); }
.names { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--brand); }
.meal-head.spread { margin: 14px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.card-head + .meal-head.spread, .card-head + div + .meal-head.spread { border-top: 0; padding-top: 0; margin-top: 4px; }
.menu-edit-row { display: grid; grid-template-columns: minmax(0,1fr) 84px 62px 32px; gap: 6px; margin-bottom: 6px; align-items: center; }
.menu-edit-row input, .menu-edit-row select { padding: 6px 8px; min-height: 36px; font-size: .9rem; }
.recipe-row { display: grid; grid-template-columns: 1fr 110px 48px 36px; gap: 6px; margin-bottom: 6px; align-items: center; }
.recipe-row input, .recipe-row select { padding: 6px 8px; min-height: 36px; }
.section-gap { margin-top: 22px; }
.notif { padding: 12px 0; border-top: 1px solid var(--line); }
.notif.unread b { color: var(--brand); }
@media (max-width: 640px) {
  h1 { font-size: 1.4rem; }
  .hide-sm { display: none; }
  .container { padding: 12px 12px 72px; }
  .card { padding: 14px; }
  .tabs { top: 54px; }
}
@media print {
  .topbar, .tabs, .no-print, .btn { display: none !important; }
  body { background: #fff; } .card, .table-wrap { border: 0; box-shadow: none; }
}

/* Flúg logó (maszk: a szín a témából jön) */
.logo-mask { display: block; background: currentColor; -webkit-mask: url(/static/brand/flug-logo.png) center / contain no-repeat;
  mask: url(/static/brand/flug-logo.png) center / contain no-repeat; aspect-ratio: 809 / 481; }
.brand .logo-mask { height: 40px; margin: -4px 0; }
.auth-brand .logo-mask { width: min(230px, 62vw); margin: 0 auto 4px; }
.auth-brand .sub { font: 500 1.15rem var(--head); letter-spacing: .02em; opacity: .92; margin-top: -2px; }
.auth-brand.simple h1 { font-size: 2.6rem; }
/* téma-választó */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.theme-opt { border: 2px solid var(--line); border-radius: 12px; padding: 0; background: var(--surface); cursor: pointer; overflow: hidden; text-align: left; font: inherit; color: var(--text); }
.theme-opt[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.theme-opt .sw { display: grid; grid-template-columns: 2fr 1fr 1fr; height: 44px; }
.theme-opt .sw i { display: block; }
.theme-opt span { display: block; padding: 7px 9px; font-weight: 600; font-size: .88rem; }
.theme-opt small { display: block; padding: 0 9px 8px; color: var(--muted); font-size: .76rem; margin-top: -4px; }
.radio-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; font-weight: 400; }
.radio-row input { width: 18px; height: 18px; min-height: 0; margin-top: 2px; accent-color: var(--brand); }
.radio-row b { display: block; }
