/* ==========================================================================
   MetaGold Cup — shared design system
   Used by both the prediction panel and the admin panel, so the two look and
   behave identically. Tokens mirror the approved dark design.
   ========================================================================== */

/* --- fonts --------------------------------------------------------------- */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/vazirmatn-arabic.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF,
                 U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/vazirmatn-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/vazirmatn-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1EFF, U+2020, U+20A0-20AB, U+2113, U+2C60-2C7F;
}

/* --- tokens -------------------------------------------------------------- */
:root {
  --bg:            #201f1c;
  --bg-glow:       radial-gradient(ellipse 120% 60% at 50% -8%, rgba(187,64,51,.16), transparent 60%);
  --surface:       #2c2c29;
  --surface-2:     #34342f;
  --surface-3:     #3c3c36;
  --glass:         rgba(44,44,41,.9);

  --text:          #dfdfda;
  --muted:         #aeb0a3;
  --faint:         rgba(174,176,163,.55);

  --accent:        #bb4033;
  --accent-hi:     #cf4c3e;
  --accent-soft:   #e4b3ad;
  --accent-dim:    rgba(187,64,51,.16);

  --ok:            #8fd0a6;
  --ok-bg:         rgba(77,160,106,.14);
  --ok-br:         rgba(77,160,106,.5);
  --warn:          #d8be7e;
  --warn-bg:       rgba(201,169,90,.13);
  --warn-br:       rgba(201,169,90,.45);
  --danger:        #e4b3ad;
  --danger-bg:     rgba(187,64,51,.16);
  --danger-br:     rgba(187,64,51,.45);
  --gold:          #e6c06a;
  --green:         #4da06a;

  --line:          rgba(223,223,218,.09);
  --line-2:        rgba(223,223,218,.14);
  --fill:          rgba(223,223,218,.04);
  --fill-2:        rgba(223,223,218,.07);

  --r-pill:  999px;
  --r-xl:    20px;
  --r-lg:    16px;
  --r-md:    14px;
  --r-sm:    12px;
  --r-xs:    10px;

  --shadow-cta:   0 12px 30px rgba(187,64,51,.32);
  --shadow-card:  0 8px 28px rgba(0,0,0,.28);
  --shadow-sheet: 0 -20px 80px rgba(0,0,0,.6);

  --sidebar-w: 256px;
  --wrap:      1180px;
}

/* --- reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg-glow), var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

::selection { background: var(--accent); color: var(--text); }
::placeholder { color: rgba(174,176,163,.5); }

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

img, svg { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 6px; }

/* --- animations ---------------------------------------------------------- */
@keyframes mgUp    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Movement only, for content that must stay visible even if animations are
   throttled and the clock never advances past frame zero. */
@keyframes mgRise  { from { transform: translateY(8px); } to { transform: none; } }
@keyframes mgSheet { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes mgPop   { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes mgBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes mgPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes mgSpin  { to { transform: rotate(360deg); } }

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

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { display: flex; gap: 22px; max-width: var(--wrap); margin: 0 auto; padding: 26px 26px 44px; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 20px 16px;
  position: sticky; top: 26px; align-self: flex-start;
  max-height: calc(100vh - 52px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.sidebar-brand img { width: 30px; height: 30px; object-fit: contain; }
.sidebar-brand b { font-size: 15px; font-weight: 900; }
.sidebar-brand span { font-size: 11px; color: var(--muted); display: block; font-weight: 700; }

.sidebar-group { margin-top: 14px; padding: 0 8px 6px; font-size: 10.5px; font-weight: 800;
                 letter-spacing: .08em; color: var(--faint); }

.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 12px; border-radius: 11px;
  font-size: 13px; font-weight: 700; color: var(--muted);
  transition: background .15s, color .15s; text-align: right;
}
.nav-item:hover { background: var(--fill); color: var(--text); text-decoration: none; }
.nav-item.is-active { background: var(--accent); color: var(--text); font-weight: 800; }
.nav-item .ico { font-size: 15px; width: 20px; text-align: center; flex: 0 0 20px; }
.nav-item .badge { margin-inline-start: auto; }

.sidebar-foot { margin-top: auto; padding-top: 16px; }

.panel {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); overflow: hidden;
}
.panel-main { padding: 26px 28px 34px; animation: mgRise .35s ease; }

/* --- mobile header + tabs ------------------------------------------------ */
.topbar, .tabbar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--glass); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-top));
  align-items: center; justify-content: space-between; gap: 12px;
}
.tabbar { padding: 12px 16px 0; gap: 6px; }
.tabbar .nav-item { justify-content: center; padding: 9px 6px; font-size: 12.5px; }

.menu-toggle { display: none; padding: 7px 10px; border-radius: var(--r-xs);
               background: var(--fill); font-size: 18px; line-height: 1; }

/* ==========================================================================
   Page furniture
   ========================================================================== */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
             gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 20px; font-weight: 900; }
.page-head p  { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section { margin-bottom: 28px; }
.section > h2 { font-size: 15px; font-weight: 800; margin-bottom: 12px;
                display: flex; align-items: center; gap: 8px; }
.section > h2 .hint { font-size: 11.5px; font-weight: 700; color: var(--muted); }

.hr { height: 1px; background: var(--line); border: 0; margin: 24px 0; }

/* --- cards --------------------------------------------------------------- */
.card {
  background: var(--fill); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between;
             gap: 12px; margin-bottom: 12px; }
.card-head h3 { font-size: 14px; font-weight: 800; }
.card-sub { font-size: 12px; color: var(--muted); }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* --- stat tiles ---------------------------------------------------------- */
.stat {
  background: var(--fill); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px; text-align: center;
}
.stat .num   { font-size: 22px; font-weight: 900; line-height: 1.2; }
.stat .label { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 700; }
.stat.accent .num { color: var(--accent-soft); }
.stat.ok .num     { color: var(--ok); }
.stat.warn .num   { color: var(--warn); }

/* --- badges & pills ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 800; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--fill-2); color: var(--muted);
}
.badge.ok     { color: var(--ok);      background: var(--ok-bg);     border-color: var(--ok-br); }
.badge.warn   { color: var(--warn);    background: var(--warn-bg);   border-color: var(--warn-br); }
.badge.danger { color: var(--danger);  background: var(--danger-bg); border-color: var(--danger-br); }
.badge.gold   { color: var(--gold);    background: rgba(230,192,106,.12); border-color: rgba(230,192,106,.4); }
.badge.accent { color: var(--text);    background: var(--accent);    border-color: transparent; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.dot.live { background: var(--accent); animation: mgBlink 1.3s infinite; }

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 800; white-space: nowrap;
  border: 1px solid transparent; transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary   { background: var(--accent); color: var(--text); box-shadow: var(--shadow-cta); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-secondary { background: var(--fill-2); color: var(--text); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost     { background: transparent; color: var(--muted); border-color: var(--line-2); }
.btn-ghost:hover { color: var(--text); background: var(--fill); }
.btn-danger    { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-br); }
.btn-danger:hover { background: rgba(187,64,51,.26); }
.btn-ok        { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-br); }
.btn-ok:hover  { background: rgba(77,160,106,.24); }

.btn-sm  { padding: 6px 12px; font-size: 12px; border-radius: var(--r-xs); }
.btn-xs  { padding: 4px 9px;  font-size: 11px; border-radius: 8px; }
.btn-lg  { padding: 13px 24px; font-size: 14px; width: 100%; }
.btn-icon { padding: 6px 9px; font-size: 14px; }

.btn:disabled, .btn.is-disabled {
  background: rgba(174,176,163,.16); color: rgba(223,223,218,.42);
  border-color: transparent; box-shadow: none; cursor: not-allowed;
}

/* --- forms --------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 12px; font-weight: 800;
  margin-bottom: 6px; color: var(--text);
}
.field .help { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.field .err  { font-size: 11.5px; color: var(--danger); margin-top: 5px; font-weight: 700; }

.input, input[type=text], input[type=tel], input[type=number], input[type=url],
input[type=search], input[type=password], select, textarea {
  width: 100%; padding: 10px 12px;
  background: rgba(44,44,41,.9); color: var(--text);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  font-size: 13px; transition: border-color .15s, background .15s;
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface-2);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.8; }
select {
  appearance: none; cursor: pointer; padding-inline-end: 32px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23aeb0a3' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 10px;
  background-position: left 12px center;
}
input[type=color] { width: 44px; height: 38px; padding: 3px; cursor: pointer; }

input[type=file] {
  width: 100%; font-size: 12px; color: var(--muted);
  background: rgba(44,44,41,.9); border: 1px dashed var(--line-2);
  border-radius: var(--r-sm); padding: 9px 11px; cursor: pointer;
}
input[type=file]::file-selector-button {
  font: inherit; font-size: 11.5px; font-weight: 700;
  background: var(--fill-2); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 8px;
  padding: 5px 12px; margin-inline-end: 10px; cursor: pointer;
}
input[type=file]:hover { border-color: var(--accent); }
input[dir=ltr], .ltr { direction: ltr; text-align: left; }

.field-row { display: flex; gap: 10px; align-items: flex-start; }
.field-row > * { flex: 1; }

.switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
          user-select: none; min-height: 24px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 40px; height: 22px; border-radius: var(--r-pill); flex: 0 0 40px;
  background: rgba(174,176,163,.22); border: 1px solid var(--line-2);
  position: relative; transition: background .18s; margin-top: 1px;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; inset-inline-end: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted); transition: transform .18s, background .18s;
}
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(-18px); background: var(--text); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
/* Long labels must wrap under themselves, not push the track off the row. */
.switch .txt { font-size: 12.5px; font-weight: 700; flex: 1; min-width: 0; line-height: 1.7; }

.checkline { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px;
             color: var(--muted); cursor: pointer; line-height: 1.7; }
.checkline input { margin-top: 4px; accent-color: var(--accent); flex: 0 0 auto; }

/* --- tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.table { font-size: 12.5px; min-width: 100%; }
.table th {
  text-align: right; font-size: 11px; font-weight: 800; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--fill);
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--fill); }
.table .num, .table .ltr { direction: ltr; text-align: left; }
.table .actions { display: flex; gap: 5px; justify-content: flex-start; }
.table .row-me { background: var(--accent-dim); }
.table .row-me td { border-color: rgba(187,64,51,.3); }

.rank { font-weight: 900; font-size: 13px; color: var(--muted); }
.rank.top { color: var(--accent-soft); }

/* --- avatars ------------------------------------------------------------- */
.avatar {
  width: 34px; height: 34px; border-radius: var(--r-xs); flex: 0 0 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill-2); border: 1px solid var(--line-2);
  font-weight: 900; font-size: 14px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 12px; border-radius: 8px; }
.avatar.lg { width: 46px; height: 46px; flex-basis: 46px; font-size: 18px; border-radius: var(--r-sm); }

.team-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
/* The admin table has horizontal room, so a long name wraps instead of
   being cut — an administrator needs to read the whole thing. */
.team-cell .name { font-weight: 800; font-size: 13px; overflow-wrap: anywhere; }
.team-cell .sub  { font-size: 11px; color: var(--muted); }

/* --- flash messages ------------------------------------------------------ */
.flash {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 14px;
  font-size: 12.5px; font-weight: 700; border: 1px solid;
  animation: mgUp .3s ease;
}
.flash.ok    { color: var(--ok);     background: var(--ok-bg);     border-color: var(--ok-br); }
.flash.err   { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-br); }
.flash.warn  { color: var(--warn);   background: var(--warn-bg);   border-color: var(--warn-br); }
.flash.info  { color: var(--muted);  background: var(--fill);      border-color: var(--line-2); }

/* --- empty state --------------------------------------------------------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ico  { font-size: 34px; margin-bottom: 10px; opacity: .5; }
.empty .ttl  { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 5px; }
.empty .sub  { font-size: 12.5px; margin-bottom: 16px; }

/* --- sheets / modals ----------------------------------------------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(18,17,15,.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
/* display:flex above would otherwise beat the UA's [hidden] rule. */
.sheet-backdrop[hidden] { display: none; }
.sheet {
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 22px; width: 100%; max-width: 460px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  padding: 20px; box-shadow: var(--shadow-sheet);
  animation: mgSheet .3s cubic-bezier(.22,1,.36,1);
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between;
              gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 18px; font-weight: 900; }
.sheet-head .meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.sheet-close { font-size: 20px; line-height: 1; color: var(--muted); padding: 2px 6px; }
.sheet-close:hover { color: var(--text); }
.sheet-wide { max-width: 780px; }

/* --- misc utilities ------------------------------------------------------ */
.muted   { color: var(--muted); }
.small   { font-size: 11.5px; }
.strong  { font-weight: 800; }
.center  { text-align: center; }
.nowrap  { white-space: nowrap; }
.row     { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%; flex: 0 0 15px;
  border: 2px solid rgba(223,223,218,.25); border-top-color: currentColor;
  animation: mgSpin .7s linear infinite;
}

/* --- test-mode box ------------------------------------------------------- */
/* Deliberately loud: it should be obvious at a glance that the SMS step is
   being skipped, so this never ships to production unnoticed. */
.bypass-box {
  margin-top: 18px; padding: 14px; border-radius: var(--r-md);
  background: rgba(201,169,90,.09); border: 1px dashed var(--warn-br);
}
.bypass-title { font-size: 12.5px; font-weight: 800; color: var(--warn); margin-bottom: 6px; }
.bypass-box p { font-size: 11.5px; color: var(--muted); margin-bottom: 12px; line-height: 1.8; }
.bypass-box code {
  font-size: 11px; background: rgba(0,0,0,.3); border-radius: 5px;
  padding: 1px 5px; direction: ltr; display: inline-block;
}
.bypass-box .btn { width: 100%; }

/* --- captcha ------------------------------------------------------------- */
.captcha-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.captcha-img { border-radius: var(--r-xs); border: 1px solid var(--line-2); background: var(--surface); }
.captcha-reload { padding: 8px 11px; border-radius: var(--r-xs); background: var(--fill-2);
                  border: 1px solid var(--line-2); color: var(--muted); font-size: 15px; }
.captcha-reload:hover { color: var(--text); background: var(--surface-2); }

/* --- OTP input ----------------------------------------------------------- */
.otp-input {
  text-align: center; letter-spacing: .5em; font-size: 20px; font-weight: 900;
  padding-inline-start: .5em; direction: ltr;
}

/* --- pagination ---------------------------------------------------------- */
.pager { display: flex; gap: 5px; justify-content: center; align-items: center;
         margin-top: 20px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px; padding: 6px 10px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 700; text-align: center;
  border: 1px solid var(--line-2); color: var(--muted);
}
.pager a:hover { background: var(--fill); color: var(--text); text-decoration: none; }
.pager .is-current { background: var(--accent); color: var(--text); border-color: transparent; }

/* ==========================================================================
   Responsive: below 860px the sidebar becomes a top tab bar
   ========================================================================== */
@media (max-width: 860px) {
  .shell { flex-direction: column; gap: 0; padding: 0; max-width: 560px; }
  .sidebar { display: none; }
  .panel { border-radius: 0; border: 0; min-height: 100vh; }
  .panel-main { padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }

  .topbar { display: flex; }
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); }

  .page-head h1 { font-size: 18px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }

  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet { max-width: 100%; border-radius: 22px 22px 0 0;
           padding-bottom: calc(20px + env(safe-area-inset-bottom));
           max-height: 92vh; }
}

@media (max-width: 460px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}
