/* ==========================================================================
   core.css — tokens, reset, shared components (front + admin)
   ========================================================================== */

/* Self-hosted fonts (no third-party requests): Barlow Condensed for headings and numerals, IBM Plex Sans for text. */
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-latin-ext-600.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/barlow-condensed-latin-600.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-latin-ext-700.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-latin-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/barlow-condensed-latin-ext-800.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/barlow-condensed-latin-800.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-400.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-500.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-ext-600.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand: #2343d1;
  --primary: var(--brand);
  --primary-contrast: #ffffff;
  --radius: 12px;
  --site-width: 1240px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 64px;
  --bottom-bar-h: 60px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --kb: 0px; /* on-screen keyboard height (core.js, visualViewport) */
  /* corners: the score components stay square-cut, everything else is soft */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r: var(--r-sm);
  color-scheme: light;
}

/* Skor Panosu 2.0 — light. One accent (the admin colour), the score colours (good / fair / poor) and the gold of the
   leader. Surfaces are separated by tone and elevation, not by heavy frames; only the score boards keep an ink frame. */
:root,
:root[data-theme="light"] {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --text: #0b1020;
  --muted: #545b70;
  --border: #dde1ea;
  --line-strong: #8a93a8;
  --edge: #0b1020;
  --primary-text: var(--primary-text-light, var(--primary));
  --primary-soft: color-mix(in srgb, var(--primary) 10%, transparent);
  --primary-tint: color-mix(in srgb, var(--primary) 7%, var(--surface));
  --ink: #0b1020;
  --on-ink: #f3f5fb;
  --on-ink-muted: color-mix(in srgb, #f3f5fb 74%, var(--ink));
  --gold: #e9a800;  --on-gold: #1a1300;  --gold-t: #7a5600;
  --score-high: #0e7a43;  --on-score-high: #ffffff;  --score-high-t: #0e7a43;
  --score-mid: #f2b01e;   --on-score-mid: #1a1300;   --score-mid-t: #8a5a00;
  --score-low: #c7302f;   --on-score-low: #ffffff;   --score-low-t: #b42624;
  --track: #e3e6ee;  --track-line: #c9cfdb;
  --danger: #b42624;
  --success: #0e7a43;
  --warn: #8a5a00;
  --overlay: rgba(11, 16, 32, .5);
  --e1: 0 1px 2px rgba(11, 16, 32, .06), 0 1px 1px rgba(11, 16, 32, .04);
  --e2: 0 4px 12px rgba(11, 16, 32, .08), 0 1px 3px rgba(11, 16, 32, .06);
  --e3: 0 16px 40px rgba(11, 16, 32, .18);
  --shadow: var(--e3);
  --plate: #ffffff; /* behind product pictures */
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d16;
  --surface: #121725;
  --surface-2: #182033;
  --text: #edf0f7;
  --muted: #a3acc2;
  --border: #263049;
  --line-strong: #5e6a8a;
  --edge: #5e6a8a;
  /* the admin colour is lightened for dark surfaces (worked out in PHP: >= 3:1 against the surface) */
  --primary: var(--primary-dark, var(--brand));
  --primary-contrast: var(--primary-dark-contrast, #ffffff);
  --primary-text: var(--primary-text-dark, #9db2ff);
  --primary-soft: color-mix(in srgb, var(--primary) 22%, transparent);
  --primary-tint: color-mix(in srgb, var(--primary) 12%, var(--surface));
  --ink: #05070d;
  --on-ink: #edf0f7;
  --on-ink-muted: color-mix(in srgb, #edf0f7 72%, var(--ink));
  --gold: #ffc845;  --on-gold: #241900;  --gold-t: #ffc845;
  --score-high: #3dd68c;  --on-score-high: #062514;  --score-high-t: #3dd68c;
  --score-mid: #ffc845;   --on-score-mid: #241900;   --score-mid-t: #ffc845;
  --score-low: #ff7a78;   --on-score-low: #2b0607;   --score-low-t: #ff8c8a;
  --track: #222b42;  --track-line: #2f3a57;
  --danger: #ff8c8a;
  --success: #3dd68c;
  --warn: #ffc845;
  --overlay: rgba(2, 4, 10, .7);
  --e1: inset 0 1px 0 rgba(255, 255, 255, .04);
  --e2: 0 6px 18px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
  --e3: 0 18px 44px rgba(0, 0, 0, .6);
  --shadow: var(--e3);
  --plate: #e9ecf2;
}

/* ---- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
img, svg, video { max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.015em; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 2px; }
.hero :focus-visible, .trust :focus-visible { outline-color: var(--on-ink); }
p, li, h1, h2, h3, strong, small, label, span, a, code, dd, dt { overflow-wrap: anywhere; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 8px; top: -60px; z-index: 300; padding: 8px 14px;
  background: var(--primary); color: var(--primary-contrast); border-radius: 8px;
}
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- icons ---------------------------------------------------------------- */
.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* theme toggle swaps sun/moon */
.theme-toggle__sun { display: none; }
[data-theme="dark"] .theme-toggle__sun { display: inline-block; }
[data-theme="dark"] .theme-toggle__moon { display: none; }

/* viewport helpers */
@media (max-width: 768px) { .only-desktop { display: none !important; } }
@media (min-width: 769px) { .only-mobile { display: none !important; } }

/* ---- buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-weight: 600; font-size: .95rem; line-height: 1; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--primary); color: var(--primary-contrast); border-color: color-mix(in srgb, var(--primary) 70%, #000); }
:root[data-theme="dark"] .btn--primary { border-color: color-mix(in srgb, var(--primary-text) 55%, transparent); }
.btn--primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn--ghost { background: transparent; border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: #c2412d; color: #fff; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: .875rem; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading .btn__text { opacity: .6; }
.btn.is-loading::after {
  content: ""; width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text);
  transition: background .15s;
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon:disabled { opacity: .35; pointer-events: none; }
.btn-icon--sm { width: 34px; height: 34px; }
.btn-icon--danger:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.badge-dot {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; line-height: 1;
  color: #fff; background: #dc2626; border-radius: 9px;
  border: 2px solid var(--surface);
}

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: var(--primary-contrast);
  font-size: .8rem; font-weight: 700; letter-spacing: .02em;
}
.avatar--lg { width: 52px; height: 52px; font-size: 1.05rem; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.badge--primary { background: var(--primary-soft); color: var(--primary-text); }
.badge--ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: color-mix(in srgb, var(--success) 78%, #000); }
.badge--warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: color-mix(in srgb, var(--warn) 78%, #000); }
.badge--off { background: color-mix(in srgb, var(--danger) 14%, transparent); color: color-mix(in srgb, var(--danger) 78%, #000); }

.chip {
  display: inline-flex; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  font-size: .875rem; color: var(--text); background: var(--surface);
}
.chip:hover { border-color: var(--primary); text-decoration: none; }
.chip.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }

/* ---- forms ---------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.label { font-size: .875rem; font-weight: 600; }
.input {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 84px; resize: vertical; }
select.input { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid { border-color: var(--danger); }
.input--lg { min-height: 50px; font-size: 1rem; }
.input--sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
input[type="file"].input { padding: 8px 10px; min-height: 0; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-wrap__btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.input-wrap__btn:hover { color: var(--text); background: var(--surface-2); }

.field__error { color: var(--danger); font-size: .8125rem; min-height: 0; }
.field__error:empty { display: none; }
.field__hint { color: var(--muted); font-size: .8125rem; }

.form__message { font-size: .9rem; border-radius: var(--radius); }
.form__message:empty { display: none; }
.form__message.is-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 10px 14px; }
.form__message.is-ok { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); padding: 10px 14px; }

.check { display: inline-flex; align-items: center; gap: 10px; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.check--sm { font-size: .8125rem; }

.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input[type="checkbox"] { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch__track {
  width: 46px; height: 26px; border-radius: 999px; background: var(--border);
  position: relative; transition: background .2s;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s var(--ease);
}
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch--sm .switch__track { width: 38px; height: 22px; }
.switch--sm .switch__track::after { width: 16px; height: 16px; }
.switch--sm input:checked + .switch__track::after { transform: translateX(16px); }

.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 14px;
  border-radius: var(--radius); font-size: .9rem; border: 1px solid transparent;
}
.alert--warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: color-mix(in srgb, var(--warn) 78%, #000); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert--danger { background: color-mix(in srgb, var(--danger) 10%, transparent); color: color-mix(in srgb, var(--danger) 78%, #000); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert--info { background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--text); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.alert--ok { background: color-mix(in srgb, var(--success) 10%, transparent); color: var(--text); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert .icon { margin-top: 2px; }

/* ---- modal ---------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal__backdrop { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity .2s; }
.modal__dialog {
  position: relative; width: 100%; max-width: 440px;
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .2s, transform .25s var(--ease);
}
.modal__dialog--sm { max-width: 400px; }
.modal__dialog--lg { max-width: 560px; }
.modal.is-open .modal__backdrop { opacity: 1; }
.modal.is-open .modal__dialog { opacity: 1; transform: none; }
.modal__head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 6px 20px; flex: none; }
.modal__title { flex: 1; font-size: 1.15rem; font-weight: 700; }
.modal__body { padding: 8px 20px 20px; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.modal__body--flush { padding: 0 0 8px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* panels (notifications / account): dropdown on desktop, sheet on mobile */
.modal--panel { align-items: flex-start; justify-content: flex-end; padding: calc(var(--header-h) + 6px) max(16px, calc((100vw - var(--site-width)) / 2 + 16px)) 0; }
.modal--panel .modal__backdrop { background: transparent; }
.modal--panel .modal__dialog { max-width: 380px; max-height: min(560px, calc(100dvh - var(--header-h) - 24px)); }

html.modal-open .app-main, html.modal-open .adm-scroll { overflow: hidden; }
html.modal-open.mode-page, html.modal-open.mode-page body { overflow: hidden; }

/* phones: every modal is a bottom sheet with a grab handle; drag it down (or tap outside / back button) to close */
@media (max-width: 768px) {
  .modal, .modal--panel { align-items: flex-end; justify-content: center; padding: 0; }
  .modal__dialog, .modal--panel .modal__dialog {
    max-width: none; max-height: calc(100dvh - var(--safe-top) - 24px - var(--kb));
    border-radius: var(--r-lg) var(--r-lg) 0 0; border: 0;
    padding-bottom: max(8px, var(--safe-bottom)); margin-bottom: var(--kb);
    transform: translateY(100%); opacity: 1; transition: transform .26s var(--ease);
  }
  .modal__dialog::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--border); }
  .modal__head { padding-top: 20px; touch-action: none; }
  .modal__title { font-family: var(--font); font-size: 1.0625rem; font-weight: 600; }
  .modal--panel .modal__backdrop { background: var(--overlay); }
  .modal.is-open .modal__dialog { transform: none; }
  .modal.is-dragging .modal__dialog { transition: none; }
  .modal__dialog--sm, .modal__dialog--lg { max-width: none; }
  /* full-screen search: the field sits at the top, the keyboard never covers it */
  .modal--full { align-items: stretch; }
  .modal--full .modal__dialog { max-height: none; height: 100dvh; border-radius: 0; padding-top: var(--safe-top); transform: translateY(-12px); opacity: 0; transition: transform .2s var(--ease), opacity .2s; }
  .modal--full.is-open .modal__dialog { transform: none; opacity: 1; }
  .modal--full .modal__dialog::before { display: none; }
  .modal--full .modal__head { padding-top: 10px; }
  html.modal-open .toasts { top: calc(var(--safe-top) + 12px); bottom: auto; }
  /* iOS zooms into fields smaller than 16 px */
  .input, .input--sm, select.input, textarea.input, .header-search__input { font-size: 16px; }
}

/* ---- drawer (mobile grid menu) --------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer__backdrop { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity .25s; }
.drawer__panel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(88vw, 380px);
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  background: var(--surface); box-shadow: var(--shadow);
  padding-top: var(--safe-top); padding-bottom: var(--safe-bottom);
  transform: translateX(-100%); transition: transform .28s var(--ease);
}
.drawer.is-open .drawer__backdrop { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.drawer__who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer__who small { color: var(--muted); }
.drawer__grid { display: grid; grid-template-columns: repeat(var(--grid-cols, 3), minmax(0, 1fr)); gap: 10px; padding: 16px; }
.drawer__empty { padding: 24px 16px; color: var(--muted); }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 92px; padding: 12px 6px; text-align: center;
  background: var(--surface-2); border: 1px solid transparent; border-radius: calc(var(--radius) + 2px);
  color: var(--text); text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .08s;
}
.tile:hover { border-color: var(--primary); }
.tile:active { transform: scale(.97); }
@media (hover: none) { .tile:hover { border-color: transparent; } }
.tile.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.tile__icon .icon { width: 26px; height: 26px; }
.tile__label { font-size: .8125rem; font-weight: 600; line-height: 1.2; }
@media (min-width: 1101px) { .drawer { display: none !important; } }
/* phones: the menu rises from the bottom (next to the "Menü" tab), drag down to close */
@media (max-width: 768px) {
  .drawer__panel { top: auto; left: 0; right: 0; width: auto; max-height: calc(100dvh - var(--safe-top) - 16px); border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%); padding-top: 14px; }
  .drawer__panel::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--border); }
  .drawer.is-dragging .drawer__panel { transition: none; }
}
.nav-toggle { display: none; flex: none; }
@media (min-width: 769px) and (max-width: 1100px) { .nav-toggle { display: inline-flex; } }
@media (max-width: 768px) { .nav-toggle--phone { display: inline-flex; } }

/* ---- bottom bar (mobile) ---------------------------------------------------- */
.bottom-bar {
  display: none; flex: none;
  height: calc(var(--bottom-bar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
  z-index: 40;
}
@media (max-width: 768px) { .bottom-bar { display: flex; } }
.bottom-bar__item {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none !important; font-size: .6875rem; font-weight: 600;
  transition: color .15s;
}
.bottom-bar__item.is-active, .bottom-bar__item:hover { color: var(--primary-text); }
.bottom-bar__icon { position: relative; display: inline-flex; }
.bottom-bar__icon .icon { width: 24px; height: 24px; }
.bottom-bar__icon .badge-dot { top: -6px; right: -10px; border-color: var(--surface); }
.bottom-bar__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }

/* ---- toasts ------------------------------------------------------------------ */
.toasts {
  position: fixed; z-index: 200; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: .9rem;
  animation: toast-in .25s var(--ease);
}
.toast--success { border-left: 4px solid var(--success); }
.toast--error { border-left: 4px solid var(--danger); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 768px) {
  .toasts { right: 16px; left: 16px; width: auto; bottom: calc(var(--bottom-bar-h) + var(--safe-bottom) + 14px); }
}

/* ---- cards & misc ------------------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px); padding: 20px;
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card__head h2 { font-size: 1.05rem; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-state h1, .empty-state h2 { color: var(--text); font-size: 1.25rem; }
.empty-state__icon { width: 40px; height: 40px; opacity: .6; }
.empty-state--sm { padding: 24px 12px; }
.error-code { font-size: 4rem; font-weight: 800; line-height: 1; color: var(--primary-text); }
.empty-note { padding: 20px; text-align: center; color: var(--muted); font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---- breadcrumbs (front + admin editors) ------------------------------------------------ */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; margin-bottom: 14px; font-size: .875rem; color: var(--muted); }
.crumbs > * + *::before { content: "›"; display: inline-block; margin: 0 8px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary-text); }
.crumbs span[aria-current] { color: var(--text); font-weight: 600; max-width: 100%; overflow-wrap: anywhere; }

/* ---- star rating display (front + admin) ---------------------------------------- */
.stars { position: relative; display: inline-block; line-height: 1; font-size: 1rem; letter-spacing: 2px; white-space: nowrap; vertical-align: middle; }
.stars__bg { color: var(--star-off, #8fa198); }
.stars__fg { position: absolute; left: 0; top: 0; overflow: hidden; color: var(--star-on, #c97a00); }

:root { --star-on: #b07d00; --star-off: #8a93a8; }
:root[data-theme="dark"] { --star-on: #ffc845; --star-off: #5e6a8a; }

.check--top { align-items: flex-start; }
.check--top input { margin-top: 3px; }
.check--top span { font-size: .875rem; line-height: 1.45; }

/* tinted status text: darkened in light mode only (the dark-theme tokens are already light) */
:root[data-theme="dark"] .badge--ok { color: var(--success); }
:root[data-theme="dark"] .badge--warn, :root[data-theme="dark"] .alert--warn { color: var(--warn); }
:root[data-theme="dark"] .badge--off { color: var(--danger); }
:root[data-theme="dark"] .alert--danger { color: var(--danger); }
