/* Quik.mn — design system. Built from DESIGN-SYSTEM.md. Light + dark via
   [data-theme]. Pure custom CSS (no Bootstrap). */

/* Gilroy (GIP) — copied from usashop. Capped at weight 700 (Bold): the
   ExtraBold/Heavy cuts render poorly, so no 800/900 is used anywhere. */
@font-face { font-family:'Gilroy'; font-weight:400; font-style:normal; font-display:swap; src:url('../fonts/Gilroy/GIP-Regular.woff2') format('woff2'), url('../fonts/Gilroy/GIP-Regular.otf') format('opentype'); }
@font-face { font-family:'Gilroy'; font-weight:500; font-style:normal; font-display:swap; src:url('../fonts/Gilroy/GIP-Medium.woff2') format('woff2'), url('../fonts/Gilroy/GIP-Medium.otf') format('opentype'); }
@font-face { font-family:'Gilroy'; font-weight:600; font-style:normal; font-display:swap; src:url('../fonts/Gilroy/GIP-SemiBold.woff2') format('woff2'), url('../fonts/Gilroy/GIP-SemiBold.otf') format('opentype'); }
@font-face { font-family:'Gilroy'; font-weight:700; font-style:normal; font-display:swap; src:url('../fonts/Gilroy/GIP-Bold.woff2') format('woff2'), url('../fonts/Gilroy/GIP-Bold.otf') format('opentype'); }

:root, [data-theme="light"] {
  --bg:#F8FAFC; --surface:#FFFFFF; --border:#E2E8F0; --text:#0F172A;
  --muted:#64748B; --faint:#94A3B8; --primary:#4F46E5; --accent:#4F46E5;
  --soft:#EEF2FF; --navbg:#FFFFFF; --input:#F8FAFC; --grid:rgba(15,23,42,.045);
  --success:#16A34A; --successsoft:#F0FDF4; --warning:#B45309; --warningsoft:#FFFBEB;
  --danger:#DC2626; --dangersoft:#FEF2F2; --qrbg:#0F172A; --qrdot:#FFFFFF;
  --shadow:0 12px 32px -12px rgba(79,70,229,.18);
  --code:#0F172A; --codetext:#E2E8F0; --tip:#0F172A;
}
[data-theme="dark"] {
  --bg:#0B1220; --surface:#141D30; --border:#26324A; --text:#EDF2FA;
  --muted:#93A4BE; --faint:#5C6E8C; --primary:#6366F1; --accent:#8B92F8;
  --soft:rgba(99,102,241,.16); --navbg:#0F172A; --input:#0F172A; --grid:rgba(255,255,255,.05);
  --success:#4ADE80; --successsoft:rgba(34,197,94,.12); --warning:#FBBF24; --warningsoft:rgba(245,158,11,.14);
  --danger:#F87171; --dangersoft:rgba(239,68,68,.12); --qrbg:#EDF2FA; --qrdot:#0B1220;
  --shadow:0 12px 32px -12px rgba(0,0,0,.5); --code:#060B16; --codetext:#C7D2E5; --tip:#334155;
}

* { box-sizing:border-box; }
html,body { margin:0; }
body {
  font-family:'Gilroy',system-ui,-apple-system,sans-serif;
  background:var(--bg); color:var(--text);
  font-size:14px; line-height:1.6; -webkit-font-smoothing:antialiased;
}
a { color:var(--accent); text-decoration:none; }
a:hover { opacity:.85; }
h1,h2,h3,h4 { color:var(--text); letter-spacing:-.02em; font-weight:700; margin:0; }
.text-muted-2 { color:var(--muted); }
.text-faint { color:var(--faint); }
::selection { background:var(--soft); }

/* base resets (previously supplied by Bootstrap reboot) */
button, input, select, textarea { font-family:inherit; font-size:100%; }
button { cursor:pointer; }
img, svg { vertical-align:middle; }
table { border-collapse:collapse; }

/* display utilities (the only Bootstrap classes the views used) */
.d-none { display:none !important; }
.d-flex { display:flex !important; }
.d-inline-flex { display:inline-flex !important; }
@media (min-width:576px){ .d-sm-inline-flex { display:inline-flex !important; } }
@media (min-width:992px){ .d-lg-flex { display:flex !important; } .d-lg-none { display:none !important; } }

/* ---- keyframes ---- */
@keyframes pulseDot {0%{box-shadow:0 0 0 0 rgba(34,197,94,.55)}70%{box-shadow:0 0 0 7px rgba(34,197,94,0)}100%{box-shadow:0 0 0 0 rgba(34,197,94,0)}}
@keyframes fadeUp {from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@keyframes spin {to{transform:rotate(360deg)}}
.fade-up { animation:fadeUp .5s ease both; }

/* ---- grid background ---- */
.grid-bg {
  background-image:linear-gradient(var(--grid) 1px,transparent 1px),
    linear-gradient(90deg,var(--grid) 1px,transparent 1px);
  background-size:44px 44px;
}

/* ---- brand (pure wordmark: "Quik" in --text + ".mn" in --accent) ---- */
.brand { display:inline-flex; align-items:baseline; font-weight:700; font-size:20px;
  color:var(--text); letter-spacing:-.02em; line-height:1.1; white-space:nowrap; }
.brand .dot { color:var(--accent); }

/* ---- buttons ---- */
.btn { border-radius:10px; font-weight:700; padding:10px 18px; border:1px solid transparent;
  transition:transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
  display:inline-flex; align-items:center; gap:8px; justify-content:center; cursor:pointer; font-size:14px; line-height:1; }
.btn-primary, .btn-primary:focus { background:var(--primary); color:#fff; border-color:var(--primary); }
.btn-primary:hover { color:#fff; transform:translateY(-2px); box-shadow:0 12px 24px -8px rgba(79,70,229,.6); }
.btn-ghost { background:var(--surface); border:1px solid var(--border); color:var(--muted); }
.btn-ghost:hover { border-color:var(--accent); color:var(--accent); opacity:1; }
.btn-soft { background:var(--soft); color:var(--accent); border-color:transparent; }
.btn-soft:hover { filter:brightness(.97); color:var(--accent); }
.btn-danger { background:var(--dangersoft); color:var(--danger); }
.btn-danger:hover { filter:brightness(.95); color:var(--danger); }
.btn-danger-solid { background:var(--danger); color:#fff; }
.btn-danger-solid:hover { color:#fff; filter:brightness(.95); }
.btn-block { width:100%; }
.btn-lg { padding:14px 28px; font-size:15px; font-weight:700; }
.btn-sm { padding:8px 14px; font-size:13px; }
.btn:disabled { opacity:.55; cursor:not-allowed; transform:none; box-shadow:none; }

/* icon button */
.icon-btn { width:36px; height:36px; border-radius:9px; border:1px solid var(--border);
  background:var(--surface); color:var(--muted); display:grid; place-items:center; cursor:pointer;
  position:relative; transition:.15s ease; }
.icon-btn:hover { border-color:var(--accent); color:var(--accent); }

/* ---- cards ---- */
.card-q { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; }
.card-q.hoverable { transition:.18s ease; }
.card-q.hoverable:hover { transform:translateY(-4px); border-color:var(--accent);
  box-shadow:0 16px 36px -20px rgba(79,70,229,.4); }
.card-pad-sm { padding:16px; }

/* ---- forms ---- */
.field { display:block; width:100%; background:var(--input); border:1px solid var(--border);
  border-radius:11px; padding:12px 14px; font-size:14px; color:var(--text); font-family:inherit;
  transition:border-color .15s ease; }
.field:focus { outline:none; border:1.5px solid var(--primary); }
/* keyboard focus: add an on-brand ring (mouse focus keeps the clean border only) */
.field:focus-visible { box-shadow:0 0 0 3px var(--soft); }
.field::placeholder { color:var(--faint); }
/* selects: replace the native OS dropdown arrow with a custom chevron so the
   only browser-chrome control matches the rest of the custom design system.
   Chevron colour (--faint mid-grey) reads on both light + dark input fills. */
select.field, select.filter-pill { appearance:none; -webkit-appearance:none; -moz-appearance:none;
  cursor:pointer; padding-right:36px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='3' 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 14px center; }
select.field::-ms-expand, select.filter-pill::-ms-expand { display:none; }
.flabel { display:block; font-size:13px; font-weight:700; color:var(--muted); margin-bottom:7px; }
.flabel .opt { color:var(--faint); font-weight:600; }
.field-icon { position:relative; }
.field-icon > i.lead { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--faint); }
.field-icon > .field { padding-left:40px; }
.field-icon > .eye { position:absolute; right:14px; top:50%; transform:translateY(-50%); color:var(--faint); cursor:pointer; background:none; border:none; }
.help-text { font-size:12px; color:var(--faint); margin-top:6px; }
.field-error { border-color:var(--danger) !important; }
.err-msg { color:var(--danger); font-size:12px; margin-top:6px; font-weight:700; }

/* alias segmented field */
.alias-group { display:flex; align-items:center; background:var(--input); border:1px solid var(--border);
  border-radius:11px; overflow:hidden; }
.alias-group:focus-within { border:1.5px solid var(--primary); }
.alias-group:has(input:focus-visible) { box-shadow:0 0 0 3px var(--soft); }
.alias-prefix { flex:none; padding:12px 12px; color:var(--muted); font-weight:700; border-right:1px solid var(--border);
  background:transparent; white-space:nowrap; font-size:13px; }
.alias-group input { flex:1; min-width:0; width:100%; border:none; background:transparent; padding:12px 12px; color:var(--text);
  font-family:inherit; font-size:14px; }
.alias-group input:focus { outline:none; }
.alias-pill { flex:none; margin:0 8px; }

/* toggle switch */
.switch { position:relative; display:inline-block; width:40px; height:22px; flex:none; cursor:pointer; }
/* keep the checkbox in the tab order (was display:none → keyboard could not
   reach it): visually hide but leave focusable + Space-toggleable. */
.switch input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; }
.switch input:focus-visible + .track { box-shadow:0 0 0 3px var(--soft); }
.switch .track { position:absolute; inset:0; border-radius:99px; background:var(--border); transition:.15s; }
.switch .knob { position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%;
  background:var(--surface); box-shadow:0 1px 2px rgba(0,0,0,.2); transition:.15s; }
.switch input:checked + .track { background:var(--primary); }
.switch input:checked + .track + .knob, .switch input:checked ~ .knob { left:auto; right:2px; background:#fff; }

/* checkbox */
.check { width:18px; height:18px; border-radius:5px; border:1.5px solid var(--border); background:transparent;
  display:inline-grid; place-items:center; cursor:pointer; flex:none; color:transparent; font-size:10px; }
.check.on { background:var(--primary); border-color:var(--primary); color:#fff; }

/* ---- badges / pills ---- */
.badge-q { font-size:11px; font-weight:700; padding:4px 11px; border-radius:99px; display:inline-flex; align-items:center; gap:6px; }
.badge-success { color:var(--success); background:var(--successsoft); }
.badge-warning { color:var(--warning); background:var(--warningsoft); }
.badge-danger  { color:var(--danger);  background:var(--dangersoft); }
.badge-info    { color:var(--accent);  background:var(--soft); }
.badge-q .d { width:6px; height:6px; border-radius:50%; background:currentColor; }
.live-dot { width:8px; height:8px; border-radius:50%; background:var(--success); animation:pulseDot 2s infinite; display:inline-block; }

/* chips */
.chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700;
  padding:6px 12px; border-radius:99px; background:var(--soft); color:var(--accent); }
.chip.dashed { background:transparent; border:1px dashed var(--border); color:var(--faint); cursor:pointer; }
.chip.dashed:hover { border-color:var(--accent); color:var(--accent); }
.chip .x { cursor:pointer; opacity:.7; }

/* ---- eyebrow / labels ---- */
.eyebrow { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--faint); }
.card-title { font-size:15px; font-weight:700; }
.mono { font-family:ui-monospace,Menlo,monospace; }

/* ---- app shell ---- */
.app-shell { display:flex; min-height:100vh; background:var(--bg); }
.sidebar { width:240px; background:var(--navbg); border-right:1px solid var(--border);
  padding:20px 14px; display:flex; flex-direction:column; gap:4px; position:sticky; top:0; height:100vh; }
.nav-item { display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:9px;
  font-size:14px; font-weight:600; color:var(--muted); transition:.15s; }
.nav-item i { width:18px; text-align:center; color:var(--faint); }
.nav-item:hover { background:var(--soft); color:var(--accent); opacity:1; }
.nav-item:hover i { color:var(--primary); }
.nav-item.active { font-weight:700; color:var(--accent); background:var(--soft); }
.nav-item.active i { color:var(--primary); }
.sidebar-user { margin-top:auto; border-top:1px solid var(--border); padding-top:14px; display:flex; align-items:center; gap:10px; }
.avatar { width:32px; height:32px; border-radius:50%; background:var(--soft); color:var(--accent);
  display:grid; place-items:center; font-weight:700; font-size:12px; flex:none; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 32px;
  background:var(--navbg); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:20; }
.topbar-left { display:flex; align-items:center; gap:12px; flex:1; min-width:0; }
.topbar-right { display:flex; align-items:center; gap:12px; flex:none; }
.topbar-search-form { position:relative; flex:1; display:flex; min-width:0; max-width:320px; }
.topbar-search-form > i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--faint); pointer-events:none; }
.topbar-search { width:100%; min-width:0; background:var(--input); border:1px solid var(--border);
  border-radius:9px; padding:9px 14px 9px 38px; color:var(--text); }
.notify-count { position:absolute; top:-5px; right:-6px; min-width:16px; height:16px; padding:0 4px;
  border-radius:99px; background:var(--danger); color:#fff; font-size:10px; font-weight:700;
  display:grid; place-items:center; line-height:1; }
.main-col { flex:1; min-width:0; display:flex; flex-direction:column; }
.main-content { flex:1; padding:28px 32px; display:flex; flex-direction:column; gap:20px; }
.page-h1 { font-size:26px; font-weight:700; }

/* stat tile */
.stat-tile { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; transition:.18s; }
.stat-tile:hover { transform:translateY(-4px); border-color:var(--accent); box-shadow:0 16px 36px -20px rgba(79,70,229,.4); }
.stat-label { font-size:13px; font-weight:700; color:var(--muted); }
.stat-value { font-size:30px; font-weight:700; letter-spacing:-.02em; }

/* segmented control */
.segmented { display:inline-flex; background:var(--surface); border:1px solid var(--border); border-radius:9px; padding:3px; gap:2px; }
.segmented a, .segmented button { border:none; background:transparent; color:var(--muted); font-weight:700;
  font-size:13px; padding:6px 14px; border-radius:7px; cursor:pointer; }
.segmented .active { background:var(--primary); color:#fff; }

/* data table */
.table-q { width:100%; border-collapse:collapse; }
.table-q thead th { font-size:11px; font-weight:700; color:var(--faint); text-transform:uppercase;
  letter-spacing:.05em; text-align:left; padding:13px 22px; border-bottom:1px solid var(--border); }
.table-q tbody td { padding:14px 22px; border-bottom:1px solid var(--border); vertical-align:middle; }
.table-q tbody tr:hover { background:var(--soft); }
.table-q tbody tr:last-child td { border-bottom:none; }
.slug-cell { font-weight:700; color:var(--accent); }
.favicon-tile { width:22px; height:22px; border-radius:6px; background:var(--soft); color:var(--accent);
  display:inline-grid; place-items:center; font-size:11px; flex:none; }
.row-action { width:30px; height:30px; line-height:30px; text-align:center; border-radius:8px;
  background:transparent; color:var(--faint); display:inline-block; transition:.15s; cursor:pointer; }
.row-action:hover { color:var(--accent); background:var(--soft); }
.row-action.danger:hover { color:var(--danger); background:var(--dangersoft); }
/* row-action rendered as <button> (CSRF form wrappers): strip UA chrome so it
   matches the <a> variant exactly. */
button.row-action { border:0; padding:0; margin:0; font:inherit; font-size:inherit;
  appearance:none; -webkit-appearance:none; background:transparent; }
button.row-action:hover { background:var(--soft); }
button.row-action.danger:hover { background:var(--dangersoft); }

/* pagination */
.pager { display:flex; align-items:center; justify-content:space-between; padding:16px 22px; }
.pager .pages { display:flex; gap:6px; }
.pager .pages a, .pager .pages span { min-width:34px; height:34px; border-radius:8px; border:1px solid var(--border);
  display:grid; place-items:center; color:var(--muted); font-weight:700; font-size:13px; }
.pager .pages a:hover { border-color:var(--accent); color:var(--accent); }
.pager .pages .active { background:var(--primary); color:#fff; border-color:var(--primary); }

/* filter pill */
.filter-pill { display:inline-flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border);
  border-radius:10px; padding:11px 15px; font-size:13px; font-weight:700; color:var(--muted); cursor:pointer; }
.filter-pill:hover { border-color:var(--accent); color:var(--accent); }

/* toast */
#toast-wrap { position:fixed; top:20px; right:20px; z-index:1080; display:flex; flex-direction:column; gap:10px; }
.toast-q { background:var(--surface); border:1px solid var(--border); border-left:4px solid var(--primary);
  border-radius:12px; padding:12px 16px; box-shadow:0 12px 30px -12px rgba(0,0,0,.3); min-width:260px;
  font-weight:600; transition:opacity .3s ease; }
.toast-q.success { border-left-color:var(--success); }
.toast-q.danger { border-left-color:var(--danger); }
.toast-q.warning { border-left-color:var(--warning); }

/* empty / dropzone */
.dropzone { border:1.5px dashed var(--border); border-radius:12px; padding:32px; text-align:center;
  color:var(--muted); transition:.15s; cursor:pointer; }
.dropzone:hover { border-color:var(--accent); background:var(--soft); }
.empty-state { text-align:center; padding:56px 24px; color:var(--muted); }
.empty-state i { font-size:34px; color:var(--faint); margin-bottom:12px; }

/* qr tile */
.qr-tile { background:var(--qrbg); border-radius:14px; padding:14px; display:inline-block; }

/* progress bar */
.progress-q { height:8px; border-radius:99px; background:var(--border); overflow:hidden; }
.progress-q > span { display:block; height:100%; background:var(--primary); border-radius:99px; }

/* flash */
.flash { border-radius:12px; padding:12px 16px; font-weight:600; margin-bottom:14px; border:1px solid transparent;
  transition:opacity .3s ease; }
.flash.success { background:var(--successsoft); color:var(--success); }
.flash.danger  { background:var(--dangersoft);  color:var(--danger); }
.flash.warning { background:var(--warningsoft); color:var(--warning); }
.flash.info    { background:var(--soft);        color:var(--accent); }
.flash[data-flash] { position:relative; padding-right:42px; }
.flash-x { position:absolute; top:50%; right:10px; transform:translateY(-50%); border:none; background:none;
  color:inherit; font-size:18px; line-height:1; padding:4px 6px; cursor:pointer; opacity:.6; }
.flash-x:hover { opacity:1; }

/* tooltip ([data-tip] → dark bubble above, per design system) */
[data-tip] { position:relative; }
[data-tip]:hover::after { content:attr(data-tip); position:absolute; bottom:calc(100% + 7px); left:50%;
  transform:translateX(-50%); background:var(--tip); color:#fff; font-size:11px; font-weight:600;
  padding:6px 10px; border-radius:7px; white-space:nowrap; z-index:95; pointer-events:none; }

/* sortable table headers */
.sort-h { color:inherit; display:inline-flex; align-items:center; gap:5px; text-transform:inherit;
  letter-spacing:inherit; font-size:inherit; font-weight:inherit; }
.sort-h:hover, .sort-h.active { color:var(--accent); opacity:1; }

/* QR color swatches — active state */
.swatch-fg.active, .swatch-bg.active { border-color:var(--primary) !important; box-shadow:0 0 0 2px var(--soft); }

/* utility */
.divider { height:1px; background:var(--border); border:none; margin:0; }
.stack { display:flex; flex-direction:column; }
.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.grid-3 { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.grid-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
/* prevent grid blowout: min-width:auto would let content (canvas, tables,
   long URLs) force tracks wider than the viewport on mobile */
.grid-2 > *, .grid-3 > *, .grid-4 > *,
.dash-grid > *, .builder-grid > *, .qr-grid > *, .set-grid > *, .usage-grid > * { min-width:0; }
canvas { max-width:100%; }
.flex { display:flex; } .items-center{align-items:center} .justify-between{justify-content:space-between}
.ml-auto{margin-left:auto} .w-100{width:100%}

/* mobile links list — stacked cards (hidden on desktop, shown ≤900px) */
.link-cards { display:none; }
.link-card { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:14px 16px; }
.link-card .lc-dest { color:var(--muted); font-size:13px; overflow:hidden; text-overflow:ellipsis;
  white-space:nowrap; margin-top:4px; }
.link-card .lc-meta { display:flex; align-items:center; gap:10px; margin-top:8px; font-size:12px; color:var(--faint); flex-wrap:wrap; }
.link-card .lc-actions { display:flex; align-items:center; gap:8px; margin-top:10px; padding-top:10px;
  border-top:1px solid var(--border); }

/* mobile bottom tab bar (app) */
.tabbar { display:none; }

/* mobile nav drawer trigger + scrim (hidden on desktop) */
.menu-btn { display:none; width:36px; height:36px; border-radius:9px; border:1px solid var(--border);
  background:var(--surface); color:var(--muted); place-items:center; cursor:pointer; }
.nav-scrim { display:none; }

/* responsive */
@media (max-width:900px){
  /* sidebar becomes an off-canvas drawer toggled by .menu-btn */
  .sidebar { position:fixed; top:0; left:0; bottom:0; width:250px; height:100vh;
    transform:translateX(-100%); transition:transform .2s ease; z-index:70; display:flex; }
  body.nav-open .sidebar { transform:translateX(0); box-shadow:0 0 50px rgba(0,0,0,.35); }
  body.nav-open .nav-scrim { display:block; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:65; }
  .menu-btn { display:grid; }
  .admin-body .main-content { padding-bottom:24px; }  /* admin has no bottom tabbar */
  /* wide data tables scroll inside their card instead of overflowing the page */
  .card-q:has(.table-q) { overflow-x:auto; }
  /* links list: table → stacked cards */
  .links-table-wrap { display:none; }
  .link-cards { display:flex; flex-direction:column; gap:12px; }
  .topbar { padding:12px 16px; }
  .topbar-search-form { max-width:none; }
  /* topbar "Шинэ холбоос" collapses to icon-only (the tabbar FAB covers create) */
  .topbar-new span { display:none; }
  .topbar-new { padding:8px 11px; }
  .main-content { padding:18px 16px 90px; }
  .grid-4 { grid-template-columns:1fr 1fr; }
  .grid-3 { grid-template-columns:1fr; }
  .grid-2 { grid-template-columns:1fr; }
  .l-stats { grid-template-columns:1fr 1fr !important; }
  /* mobile stat frame = value only (per design system); drop the inline sparkline */
  .stat-tile svg { display:none; }
  .stat-value { font-size:22px; }
  /* Settings tab rail → horizontal scrolling pills on mobile */
  .settings-tabs { position:static !important; flex-direction:row !important; overflow-x:auto;
    gap:8px !important; padding-bottom:4px; -webkit-overflow-scrolling:touch; }
  .settings-tabs .nav-item { white-space:nowrap; flex:0 0 auto; }
  .tabbar { display:flex; position:fixed; bottom:0; left:0; right:0; background:var(--navbg);
    border-top:1px solid var(--border); padding:8px 6px calc(8px + env(safe-area-inset-bottom));
    justify-content:space-around; align-items:center; z-index:50; }
  .tabbar a { display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10px;
    font-weight:700; color:var(--muted); flex:1; }
  .tabbar a i { font-size:17px; }
  .tabbar a.active { color:var(--accent); }
  .tabbar .fab { width:48px; height:48px; border-radius:50%; background:var(--primary); color:#fff;
    display:grid; place-items:center; margin-top:-26px; box-shadow:0 6px 16px -4px rgba(79,70,229,.5); font-size:20px; }
  /* landing hero: sit near the top instead of floating centered (avoids dead space) */
  .landing-hero { justify-content:flex-start !important; padding:40px 24px 56px !important; }
}

/* ---- phone-specific polish (≤560px) ---- */
@media (max-width:560px){
  /* Public marketing nav: keep brand + register + hamburger on one tidy row.
     Tighten padding/gaps; the МН·EN switch moves into the hamburger menu. */
  .pnav-inner { padding:12px 16px !important; }
  .pnav-right { gap:10px !important; }
  .pnav-lang { display:none !important; }            /* desktop lang toggle hidden on phones */
  .menu-lang { display:flex !important; }            /* …surfaced inside the hamburger menu */
  .pnav-right .btn-primary { white-space:nowrap; padding:9px 13px; }
  /* landing hero: tighten the top gap further on phones */
  .landing-hero { padding-top:28px !important; }
  /* shorten form: stack full-width input + full-width button so typing is comfortable */
  .landing-hero #shorten-form { flex-direction:column; gap:10px; }
  .landing-hero #shorten-form .btn-lg { width:100%; }
  /* drop low-value columns on phones so the useful info fits without side-scroll */
  .table-q .dest-col, .table-q .col-hide-sm { display:none; }
  /* tighter cell padding lets the remaining columns fit without side-scroll */
  .table-q thead th, .table-q tbody td { padding-left:16px; padding-right:16px; }
}

/* ============================================================
   Micro-interactions — subtle, 150–250ms, ease curves.
   All motion gated behind prefers-reduced-motion:no-preference.
   ============================================================ */

/* keyboard focus ring — every interactive element (no motion → outside gate) */
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; }
.btn:focus-visible, .icon-btn:focus-visible, .row-action:focus-visible,
.nav-item:focus-visible, .switch:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

/* inline button spinner (loading feedback — kept under reduced motion too) */
.spinner-q { width:14px; height:14px; border:2px solid currentColor; border-right-color:transparent;
  border-radius:50%; display:inline-block; flex:none; animation:spin .6s linear infinite; }

/* tooltips also on keyboard focus */
[data-tip]:focus-visible::after { content:attr(data-tip); position:absolute; bottom:calc(100% + 7px); left:50%;
  transform:translateX(-50%); background:var(--tip); color:#fff; font-size:11px; font-weight:600;
  padding:6px 10px; border-radius:7px; white-space:nowrap; z-index:95; pointer-events:none; }
/* touch devices: no hover → suppress bubbles (aria-label/title cover mobile) */
@media (hover:none) {
  [data-tip]:hover::after, [data-tip]:focus-visible::after { display:none; }
}

/* hover tints that read as state, not motion */
.table-q tbody tr { transition:background .15s ease; }
.icon-btn:hover, .menu-btn:hover { background:var(--soft); }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior:smooth; }

  /* page-enter: gentle fadeUp on main sections, staggered max 3 steps.
     "backwards" fill (not "both") so no residual transform lingers —
     a lingering transform would break position:fixed descendants. */
  .main-content > * { animation:fadeUp .35s ease backwards; }
  .main-content > :nth-child(2) { animation-delay:.06s; }
  .main-content > :nth-child(n+3) { animation-delay:.12s; }

  /* card grids: tiny stagger inside the first grid rows */
  .grid-4 > :nth-child(2), .grid-3 > :nth-child(2) { animation-delay:.05s; }
  .grid-4 > :nth-child(3), .grid-3 > :nth-child(3) { animation-delay:.1s; }
  .grid-4 > :nth-child(n+4) { animation-delay:.15s; }
  .grid-4 > *, .grid-3 > * { animation:fadeUp .35s ease backwards; }

  /* consistent hover lift (cards + tiles already lift; unify timing) */
  .card-q.hoverable, .stat-tile { transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
  .card-q.hoverable:hover, .stat-tile:hover { transform:translateY(-2px); }

  /* buttons: press-in feedback */
  .btn:active { transform:scale(.98); }
  .icon-btn:active, .row-action:active { transform:scale(.94); }

  /* toasts: slide in from the right (dismiss = opacity transition) */
  .toast-q { animation:toastIn .25s ease backwards; }

  /* flashes: slide-in on load (JS fades them out) */
  .flash[data-flash] { animation:fadeUp .3s ease backwards; }

  /* bell badge pop-in when the count changes */
  .notify-count.pop { animation:popIn .3s cubic-bezier(.34,1.56,.64,1); }

  /* stat tile live-update pulse */
  .stat-bump { animation:statBump .8s ease; }

  /* sidebar nav: smooth state change */
  .nav-item { transition:background .18s ease, color .18s ease; }
}

@keyframes toastIn { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:none; } }
@keyframes popIn { from { opacity:0; transform:scale(.4); } to { opacity:1; transform:scale(1); } }
@keyframes statBump { 0% { color:var(--accent); transform:scale(1.05); } 100% { color:inherit; transform:none; } }
