/* Shared backoffice and Admin design system, matching the Telegram mini app. */
:root {
  color-scheme: dark;
  --bg: #07100d;
  --surface: #101b17;
  --surface2: #17251f;
  --line: #26372f;
  --text: #f1f7f3;
  --muted: #8da298;
  --accent: #62e89d;
  --accent2: #d7ff5f;
  --danger: #ff6b6b;
  --warning: #efd19b;
  --nb-ok: var(--accent);
  --nb-warn: #efc46a;
  --nb-bad: var(--danger);
  --radius: 18px;
  --shadow: 0 16px 50px #00000047;
  --nb-border: var(--line);
  --nb-muted: var(--muted);
  --nb-bg: var(--bg);
  --nb-text: var(--text);
  --ease: cubic-bezier(.22, .8, .32, 1);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 0; scroll-padding-top: 24px; }
body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding:
    calc(28px + env(safe-area-inset-top, 0px))
    max(24px, env(safe-area-inset-right, 0px))
    calc(48px + env(safe-area-inset-bottom, 0px))
    max(24px, env(safe-area-inset-left, 0px));
  background: radial-gradient(ellipse at 90% 0%, #183e2b66 0, transparent 50%) no-repeat, var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #62e89d40; color: var(--text); }
a { color: var(--accent); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[hidden] { display: none !important; }
header, .site-main { width: min(100%, 1080px); margin-inline: auto; }
header { margin-bottom: 32px; }
.header-primary { min-width: 0; overflow-wrap: anywhere; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none; }
.eyebrow { font-size: 10px; line-height: 1.4; font-weight: 800; letter-spacing: .18em; color: var(--accent); }
.brand-name { font-size: 32px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.brand-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }
.header-actions:empty { display: none; }
.site-main { animation: page-enter .24s var(--ease); }
.site-main:focus { outline: none; }
.muted { color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 650; }
.field small, small.muted { font-size: 12px; line-height: 1.5; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  min-width: 0; max-width: 100%; width: 100%; min-height: 44px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--text); font: inherit; line-height: 1.35;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled, input[readonly], .competition-locked {
  background: var(--surface2); color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; accent-color: var(--accent); vertical-align: middle; }
input[type=color] { cursor: pointer; }
textarea { min-height: 100px; resize: vertical; }
option { background: var(--surface); color: var(--text); }
/* WebKit can let native control text enlarge the page beyond its border box. */
select { overflow: hidden; text-overflow: ellipsis; }
input:is([type=date], [type=datetime-local], [type=time]) {
  display: block; min-inline-size: 0; max-inline-size: 100%;
  appearance: none; -webkit-appearance: none; overflow: hidden;
}
input::-webkit-datetime-edit { min-width: 0; padding: 0; }
input::-webkit-date-and-time-value { min-width: 0; min-height: 1.35em; text-align: left; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > .field { flex: 1 1 200px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions > form { margin: 0; }
form.inline { display: inline; }
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; flex: 0 0 44px; }
.error, .warning-card, .success-card {
  padding: 16px 18px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: var(--radius);
  overflow-wrap: anywhere; line-height: 1.55;
}
.error { background: #321c20; border-color: #704046; color: #ffb5ba; }
.warning-card { background: #30291a; border-color: #615232; color: var(--warning); }
.success-card { background: #13291e; border-color: #29553d; }
.warning-card h3, .success-card h3 { color: inherit; margin: 0 0 8px; font-size: 16px; }
.warning-card p, .success-card p { margin: 8px 0 0; }
.warning-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.warning { color: var(--warning); }
.pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface2); color: var(--text); font-size: 12px; font-weight: 650; line-height: 1.3; }
.dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--nb-ok); }
.dot.warn { background: var(--nb-warn); }
.dot.bad { background: var(--nb-bad); }
code { padding: 3px 6px; background: var(--surface2); border-radius: 6px; font-size: .9em; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 650; }
tbody tr:last-child td { border-bottom: 0; }
td .actions { flex-wrap: nowrap; gap: 6px; }
td .btn { padding: 9px 12px; min-height: 38px; font-size: 13px; white-space: nowrap; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.table-controls { margin: 16px 0; }
.search { width: 100%; }
th[data-sort-key] { cursor: pointer; user-select: none; }
th[data-sort-key]:hover { color: var(--accent); }
.sort-indicator { margin-left: 4px; font-size: 10px; }
dialog { max-width: min(520px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 24px; padding: 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: #00000094; backdrop-filter: blur(4px); }
.save-toast {
  position: fixed; z-index: 1000; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 40px); padding: 13px 16px; border-radius: 14px;
  background: #edf9f1; color: #102018; box-shadow: var(--shadow); font-weight: 700;
  opacity: 0; transform: translateY(10px) scale(.98); pointer-events: none;
  transition: opacity .2s ease, transform .22s var(--ease);
}
.save-toast.visible { opacity: 1; transform: translateY(0) scale(1); }
.card {
  min-width: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-inline: auto;
}
.landing-hero {
  background: linear-gradient(135deg, #173728, #112019);
  border-color: #29553d;
  border-radius: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  padding: 32px;
}
h1, h2, h3 { color: var(--text); line-height: 1.25; overflow-wrap: break-word; }
.landing-hero h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.035em; }
.landing-hero p { margin: 12px 0 0; max-width: 65ch; line-height: 1.65; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 22px;
  min-height: 144px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease, transform .22s var(--ease);
}
.link-card > div:not(.tile-icon) { flex: 1; min-width: 0; }
.link-card .tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  color: var(--accent);
  background: var(--surface2);
  border: 1px solid #62e89d1f;
  border-radius: 14px;
}
.link-card h3 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -.015em; }
.link-card p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.link-card__arrow { flex: 0 0 18px; color: var(--muted); }
.card-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 99px;
  padding: 4px 8px;
  margin-bottom: 8px;
  background: #1f3329;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--accent);
  color: #062012;
  font-weight: 750;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .22s var(--ease);
}
.btn.secondary, .btn.tertiary { background: var(--surface2); color: var(--text); border-color: var(--line); }
.btn.icon-btn { padding: 0; }
.btn.danger { color: #ffd0d0; background: #3c2023; border-color: #704046; }
.btn:active, button:active, .link-card:active { transform: scale(.985); }
.btn:disabled, button:disabled { opacity: .5; cursor: not-allowed; }
.select-emoji { position: relative; display: inline-flex; align-items: center; }
.select-emoji__icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: 21px;
  line-height: 1;
}
.select-emoji select {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: transparent;
  -webkit-text-fill-color: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.select-emoji select option { color: var(--text); -webkit-text-fill-color: var(--text); background: var(--surface); }
.page-back { margin: 0 0 20px; }
.page-back a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; }
.page-back svg { flex: 0 0 auto; }
.doc-shell { max-width: 860px; margin-inline: auto; }
.doc-heading { margin-bottom: 24px; }
.doc-heading h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.doc-card { padding: 28px 32px; }
.doc-content { min-width: 0; font-size: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.doc-content > :first-child { margin-top: 0; }
.doc-content > :last-child { margin-bottom: 0; }
.doc-content h2 { margin: 32px 0 12px; font-size: 23px; font-weight: 750; letter-spacing: -.025em; }
.doc-content h3 { margin: 24px 0 10px; font-size: 18px; font-weight: 750; letter-spacing: -.015em; }
.doc-content p { margin: 12px 0; }
.doc-content ul, .doc-content ol { margin: 12px 0; padding-left: 24px; }
.doc-content li { margin: 8px 0; padding-left: 2px; }
.doc-content li::marker { color: var(--accent); }
.doc-content hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.doc-content a { overflow-wrap: anywhere; }
.doc-callout, .doc-notice { padding: 18px 20px; border: 1px solid #29553d; border-radius: var(--radius); background: #13291e; margin: 0 0 24px; }
.doc-callout h3 { color: var(--accent); margin: 0 0 8px; }
.doc-callout p { margin: 0; }
.doc-notice { background: #30291a; border-color: #615232; color: #efd19b; }
.doc-content table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; margin: 20px 0; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.doc-content th, .doc-content td { text-align: left; padding: 12px 16px; vertical-align: middle; border-bottom: 1px solid var(--line); }
.doc-content th { background: var(--surface2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 750; }
.doc-content th:first-child, .doc-content td:first-child { width: 31%; }
.doc-content tr:last-child td { border-bottom: 0; }
.doc-content .btn[data-pronounce] { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border-radius: 12px; font-size: 16px; }
.pronounce-cell { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pronounce-cell > span { min-width: 0; }
.error-page { max-width: 640px; margin: 48px auto 0; padding: 32px; }
.error-page h1 { margin: 0 0 12px; font-size: 26px; }
.error-page .muted { margin: 0 0 24px; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; padding: 12px 16px; background: var(--accent); color: var(--bg); border-radius: 12px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
@keyframes page-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (hover: hover) and (pointer: fine) {
  .link-card:hover { background: var(--surface2); border-color: #3e5e4b; transform: translateY(-2px); }
  .btn:hover, button:hover { filter: brightness(1.07); }
  .page-back a:hover { color: var(--accent); }
  .select-emoji select:hover { border-color: #3e5e4b; }
}
@media (max-width: 640px) {
  body {
    padding:
      calc(22px + env(safe-area-inset-top, 0px))
      max(16px, env(safe-area-inset-right, 0px))
      calc(32px + env(safe-area-inset-bottom, 0px))
      max(16px, env(safe-area-inset-left, 0px));
  }
  header { margin-bottom: 24px; }
  .brand-name { font-size: 28px; }
  .landing-hero { padding: 24px; margin-bottom: 16px; }
  .landing-hero h1 { font-size: 25px; }
  .landing-hero p { font-size: 15px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); gap: 11px; }
  .link-card { min-height: 112px; gap: 14px; padding: 18px; }
  .link-card h3 { font-size: 16px; }
  .link-card .tile-icon { width: 40px; height: 40px; flex-basis: 40px; border-radius: 12px; }
  .doc-heading { margin-bottom: 20px; }
  .doc-heading h1 { font-size: 26px; }
  .doc-card { padding: 22px 20px; }
  .doc-content { font-size: 15px; }
  .doc-content h2 { font-size: 21px; }
  .doc-content h3 { font-size: 17px; }
  .doc-content th, .doc-content td { padding: 10px; }
  .doc-content th:first-child, .doc-content td:first-child { width: 36%; }
  .doc-content td:first-child { font-size: 14px; }
  .doc-callout, .doc-notice { padding: 16px; }
  .error-page { margin-top: 24px; padding: 24px; }
}
@media (max-width: 359px) {
  .link-card { padding: 16px; gap: 12px; }
  .link-card__arrow { display: none; }
  .doc-card { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-main { animation: none; }
  .link-card, .btn, button { transition: none; }
  .save-toast { transition: none; }
  .link-card:hover, .link-card:active, .btn:active, button:active { transform: none; }
}
@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --surface2: #f4f4f4; --text: #111; --muted: #444; --accent: #14532d; --line: #ccc; }
  body { background: #fff; padding: 0; }
  .brand-actions, .page-back, .skip-link, [data-pronounce] { display: none; }
  .site-main { animation: none; }
  .doc-card { border: 0; padding: 0; }
  .doc-callout, .doc-notice { background: #f4f4f4; border-color: #ccc; }
}
