/* TREFIN B2B design system. No external fonts, scripts or images: the portal works on a closed network too.
   Tokens first; light is the default, dark follows the system or the person's choice (html[data-theme]). */

:root {
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #e5eaf4;
  --border: #dfe5f1;
  --border-strong: #c9d2e4;
  --text: #0e1a33;
  --text-2: #4b5b78;
  --text-3: #75839f;

  --primary: #2457f5;
  --primary-600: #1c47cf;
  --primary-soft: #e8eeff;
  --on-primary: #ffffff;

  --success: #0f9d66;
  --success-soft: #e0f5ec;
  --warning: #b86e00;
  --warning-soft: #fff1d6;
  --danger: #d12b48;
  --danger-soft: #fde6ea;
  --info: #0a7ba0;
  --info-soft: #dff3f9;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px rgb(14 26 51 / 6%), 0 1px 1px rgb(14 26 51 / 4%);
  --shadow-2: 0 8px 24px rgb(14 26 51 / 8%), 0 2px 6px rgb(14 26 51 / 5%);
  --ring: 0 0 0 3px rgb(36 87 245 / 28%);
  --header-h: 64px;
  --tabbar-h: 62px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #121a2e;
    --surface-2: #19233d;
    --surface-3: #212d4b;
    --border: #25314f;
    --border-strong: #34436a;
    --text: #e8edf9;
    --text-2: #a7b4d0;
    --text-3: #7f8eab;
    --primary: #6d8dff;
    --primary-600: #8aa4ff;
    --primary-soft: #1a2754;
    --on-primary: #0b1120;
    --success: #3ed598;
    --success-soft: #0f2d25;
    --warning: #f2b64b;
    --warning-soft: #36280d;
    --danger: #ff7a90;
    --danger-soft: #3a1520;
    --info: #55c4e6;
    --info-soft: #0d2b36;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-2: 0 10px 30px rgb(0 0 0 / 45%);
    --ring: 0 0 0 3px rgb(109 141 255 / 38%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #121a2e;
  --surface-2: #19233d;
  --surface-3: #212d4b;
  --border: #25314f;
  --border-strong: #34436a;
  --text: #e8edf9;
  --text-2: #a7b4d0;
  --text-3: #7f8eab;
  --primary: #6d8dff;
  --primary-600: #8aa4ff;
  --primary-soft: #1a2754;
  --on-primary: #0b1120;
  --success: #3ed598;
  --success-soft: #0f2d25;
  --warning: #f2b64b;
  --warning-soft: #36280d;
  --danger: #ff7a90;
  --danger-soft: #3a1520;
  --info: #55c4e6;
  --info-soft: #0d2b36;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 10px 30px rgb(0 0 0 / 45%);
  --ring: 0 0 0 3px rgb(109 141 255 / 38%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

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

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 24px; height: 24px; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.grow { flex: 1; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #7a3df0));
  color: var(--on-primary); display: grid; place-items: center; font-weight: 800; font-size: 0.95rem;
  box-shadow: 0 6px 14px rgb(36 87 245 / 28%);
}
.brand { min-width: 0; }
.brand__name { min-width: 0; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.brand__name small { display: block; font-weight: 500; font-size: 0.72rem; color: var(--text-3); letter-spacing: 0; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav__link {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 560; position: relative;
}
.nav__link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav__link[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--on-primary);
  font-size: 0.72rem; font-weight: 700; display: inline-grid; place-items: center;
}
.count--soft { background: var(--surface-3); color: var(--text-2); }
.count[data-zero="true"] { display: none; }

.topbar__search { flex: 1; max-width: 460px; position: relative; margin-left: auto; }
.topbar__search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar__search input {
  width: 100%; height: 40px; padding: 0 14px 0 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none;
}
.topbar__search input:focus { background: var(--surface); border-color: var(--primary); box-shadow: var(--ring); }
.topbar__actions { display: flex; align-items: center; gap: 6px; }

.iconbtn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 0; background: transparent;
  color: var(--text-2); position: relative;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.iconbtn .count { position: absolute; top: 2px; right: 0; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 12px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--surface-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
}
.usermenu__who { line-height: 1.2; text-align: left; }
.usermenu__who strong { display: block; font-size: 0.88rem; }
.usermenu__who span { font-size: 0.75rem; color: var(--text-3); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; border: 0; background: none;
  color: var(--text); text-align: left; font-weight: 520;
}
.menu__item:hover { background: var(--surface-2); text-decoration: none; }
.menu__sep { height: 1px; background: var(--border); margin: 6px 4px; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.main { padding: 28px 0 56px; min-height: calc(100vh - var(--header-h)); }

.tabbar { display: none; }

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head__sub { color: var(--text-2); margin-top: 4px; }
.page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--text-3); font-size: 0.85rem; margin-bottom: 10px; }
.crumbs a { color: var(--text-2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card--pad { padding: 20px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card__body { padding: 16px 20px 20px; }
.stack { display: grid; gap: 16px; }
.stack--lg { gap: 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.cols { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.cols--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 620; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px rgb(36 87 245 / 25%); }
.btn--primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn--soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn--soft:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--primary) 12%); }
.btn--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 0.88rem; border-radius: 10px; }
.btn--lg { height: 48px; padding: 0 24px; font-size: 1rem; }
.btn--block { width: 100%; }

.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
.field__hint { font-size: 0.82rem; color: var(--text-3); }
.field__error, .validation { font-size: 0.85rem; color: var(--danger); }

.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid transparent; align-items: flex-start; }
.alert--info { background: var(--info-soft); color: var(--info); }
.alert--success { background: var(--success-soft); color: var(--success); }
.alert--warning { background: var(--warning-soft); color: var(--warning); }
.alert--danger { background: var(--danger-soft); color: var(--danger); }
.alert strong { color: inherit; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 650;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--plain::before { display: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-weight: 580; font-size: 0.9rem;
}
.chip:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.chip[aria-current="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip small { opacity: .75; font-weight: 600; }

/* ---------- dashboard ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 28px;
  background: linear-gradient(120deg, #1d3fb8 0%, #2457f5 55%, #5a7bff 100%); color: #fff; box-shadow: var(--shadow-2);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgb(255 255 255 / 28%), transparent 65%);
}
.hero h1 { color: #fff; font-size: 1.7rem; }
.hero p { color: rgb(255 255 255 / 82%); margin-top: 6px; max-width: 56ch; }
.hero__actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .btn { background: rgb(255 255 255 / 14%); border-color: rgb(255 255 255 / 30%); color: #fff; box-shadow: none; }
.hero .btn:hover { background: rgb(255 255 255 / 22%); }
.hero .btn--primary { background: #fff; color: #1d3fb8; border-color: #fff; }
.hero .btn--primary:hover { background: #eef2ff; }
.hero__note { display: inline-flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 0.88rem; color: rgb(255 255 255 / 85%); }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 18px 20px; }
.stat__label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 0.86rem; font-weight: 600; }
.stat__value { font-size: 1.7rem; font-weight: 720; letter-spacing: -0.02em; margin-top: 8px; }
.stat__sub { color: var(--text-3); font-size: 0.84rem; margin-top: 2px; }
.stat__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 12px; }
.meter__fill { height: 100%; border-radius: inherit; background: var(--primary); }
.meter__fill[data-tone="warning"] { background: var(--warning); }
.meter__fill[data-tone="danger"] { background: var(--danger); }
.w-0 { width: 0; } .w-10 { width: 10%; } .w-20 { width: 20%; } .w-30 { width: 30%; } .w-40 { width: 40%; } .w-50 { width: 50%; }
.w-60 { width: 60%; } .w-70 { width: 70%; } .w-80 { width: 80%; } .w-90 { width: 90%; } .w-100 { width: 100%; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-title a { font-size: 0.9rem; font-weight: 600; }

.offer-card { padding: 18px 20px; display: grid; gap: 10px; }
.offer-card h3 a { color: var(--text); }
.offer-card__meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--text-2); font-size: 0.88rem; }

/* ---------- catalog ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.grid-items { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.item { display: flex; flex-direction: column; overflow: hidden; transition: box-shadow .18s, transform .18s, border-color .18s; }
.item:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: var(--border-strong); }
.item__media { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.item__media img { width: 100%; height: 100%; object-fit: cover; }
.item__flags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; }
.flag { padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.flag--promo { background: var(--danger); color: #fff; }
.flag--cart { background: var(--primary); color: var(--on-primary); }
.item__body { padding: 14px 14px 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.item__cat { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; }
.item__name { font-weight: 640; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; color: var(--text); }
.item__name:hover { text-decoration: none; color: var(--primary); }
.item__code { font-size: 0.8rem; color: var(--text-3); }
.price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price__now { font-size: 1.25rem; font-weight: 740; letter-spacing: -0.02em; }
.price__unit { color: var(--text-3); font-size: 0.82rem; }
.price__old { color: var(--text-3); text-decoration: line-through; font-size: 0.88rem; }
.price__vat { flex-basis: 100%; color: var(--text-3); font-size: 0.8rem; }
.stock { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 600; }
.stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.stock--success { color: var(--success); }
.stock--warning { color: var(--warning); }
.stock--danger { color: var(--danger); }
.item__buy { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

.stepper { display: inline-grid; grid-template-columns: 36px 1fr 36px; align-items: center; height: 42px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); overflow: hidden; width: 124px; flex: none; }
.stepper button { height: 100%; border: 0; background: transparent; color: var(--text-2); display: grid; place-items: center; }
.stepper button:hover { background: var(--surface-2); color: var(--text); }
.stepper input { width: 100%; height: 100%; border: 0; text-align: center; background: transparent; outline: none; font-weight: 650; -moz-appearance: textfield; font-variant-numeric: tabular-nums; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.stepper--sm { height: 36px; width: 108px; grid-template-columns: 30px 1fr 30px; }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 40px; height: 40px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; }
.pager a:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.pager [aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pager .is-disabled { opacity: .45; }

/* item page */
.detail { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
.gallery__main { aspect-ratio: 4 / 3; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.gallery__main img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery__thumb { width: 74px; height: 56px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--surface-2); }
.gallery__thumb[aria-current="true"] { border-color: var(--primary); }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; margin: 0; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; font-weight: 580; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .right, .table th.right { text-align: right; }
.table__name strong { display: block; font-weight: 620; }
.table__name span { color: var(--text-3); font-size: 0.82rem; }
.thumb { width: 52px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }

.totals { display: grid; gap: 10px; }
.totals__row { display: flex; justify-content: space-between; gap: 16px; color: var(--text-2); }
.totals__row--grand { color: var(--text); font-size: 1.2rem; font-weight: 740; padding-top: 12px; border-top: 1px solid var(--border); }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 20px 34px; }
.timeline li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline__dot { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.timeline__dot--success { background: var(--success-soft); color: var(--success); }
.timeline__dot--danger { background: var(--danger-soft); color: var(--danger); }
.timeline__title { font-weight: 640; }
.timeline__meta { color: var(--text-3); font-size: 0.85rem; }

.empty { text-align: center; padding: 56px 24px; display: grid; gap: 10px; justify-items: center; color: var(--text-2); }
.empty__icon { width: 64px; height: 64px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.empty h2 { color: var(--text); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth__panel { background: linear-gradient(150deg, #14308f 0%, #2457f5 60%, #6b8bff 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth__panel::after { content: ""; position: absolute; right: -120px; bottom: -140px; width: 440px; height: 440px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgb(255 255 255 / 22%), transparent 65%); }
.auth__panel h2 { color: #fff; font-size: 2rem; max-width: 18ch; line-height: 1.15; }
.auth__panel p { color: rgb(255 255 255 / 82%); max-width: 44ch; margin-top: 12px; }
.auth__points { display: grid; gap: 14px; margin-top: 28px; position: relative; z-index: 1; }
.auth__points div { display: flex; gap: 12px; align-items: center; color: rgb(255 255 255 / 92%); }
.auth__points .icon { background: rgb(255 255 255 / 16%); border-radius: 10px; padding: 7px; width: 34px; height: 34px; }
.auth__form { display: grid; place-items: center; padding: 32px; }
.auth__box { width: 100%; max-width: 400px; }
.auth__box h1 { font-size: 1.6rem; margin-bottom: 6px; }

/* ---------- toasts and dialog ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--text); color: var(--bg); box-shadow: var(--shadow-2); animation: toast-in .2s ease-out; }
.toast--success .icon { color: #3ed598; }
.toast--danger .icon { color: #ff7a90; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

dialog { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(8 14 30 / 55%); backdrop-filter: blur(2px); }
.dialog__body { padding: 24px; display: grid; gap: 8px; }
.dialog__actions { padding: 0 24px 24px; display: flex; gap: 10px; justify-content: flex-end; }

.footer { padding: 24px 0 40px; color: var(--text-3); font-size: 0.85rem; }

/* small additions used by several pages */
.row > .input { width: auto; flex: 1 1 200px; min-width: 160px; }
.row > .select { width: auto; flex: 0 0 auto; }
a.card, a.stat { color: inherit; display: block; }
a.card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.crumbs { display: flex; gap: 6px; align-items: center; }
.crumbs .icon { width: 14px; height: 14px; }
.mb-4 { margin-bottom: 16px; }
.row--between { justify-content: space-between; }
.grid-offers { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.page-head h1 .badge { vertical-align: middle; margin-left: 8px; font-size: 0.8rem; }
.table__name .row { flex-wrap: nowrap; }
.table .btn, .table .iconbtn { margin-left: auto; }
.card .table { border-radius: inherit; }
.card.table-wrap { overflow: hidden; }
.item__buy .btn { padding: 0 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
  .usermenu__who { display: none; }
}

@media (max-width: 820px) {
  :root { --header-h: 58px; }
  .container { padding: 0 16px; }
  .nav { display: none; }
  .topbar__inner { gap: 10px; }
  .brand__name small { display: none; }
  .topbar__search { max-width: none; }
  .main { padding: 18px 0 calc(var(--tabbar-h) + 28px); }
  h1 { font-size: 1.4rem; }
  .detail, .cols--even { grid-template-columns: 1fr; }
  .grid-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 2px 16px 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; scroll-snap-align: start; }
  .item__body { padding: 10px 10px 12px; }
  .item__buy { flex-wrap: wrap; }
  .item__buy .stepper { width: 100%; }
  .item__buy .btn { flex: 1; }
  .auth { grid-template-columns: 1fr; }
  .auth__panel { padding: 28px 24px; min-height: 0; }
  .auth__panel h2 { font-size: 1.5rem; }
  .auth__points { display: none; }
  .hero { padding: 22px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  }
  .tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--text-3); font-size: 0.72rem; font-weight: 620; position: relative; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--primary); }
  .tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); }
  .toasts { bottom: calc(var(--tabbar-h) + 12px); right: 12px; left: 12px; max-width: none; }

  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table--cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table--cards td::before { content: attr(data-label); color: var(--text-3); font-size: 0.8rem; text-align: left; }
  .table--cards td.table__name { display: block; text-align: left; }
  .table--cards td.table__name::before { display: none; }
}

@media (max-width: 420px) {
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat__value { font-size: 1.35rem; }
  .stat__sub { font-size: 0.78rem; }
  .brand__name { max-width: 38vw; }
  .hero h1 { font-size: 1.35rem; }
  .topbar__search { max-width: 52px; margin-left: auto; }
  .topbar__search input { padding-left: 38px; padding-right: 0; }
}

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

@media print {
  .topbar, .tabbar, .toasts, .page-head__actions, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}

/* The default arrow on everything clickable, as the people of TREFIN want it: the hover animation already says it is interactive. */
a, button, summary, label, select, [role="button"], .chip, .item__media, .gallery__thumb { cursor: default; }

/* Administrator area: the same system, a few more shapes. */
.grid--stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); }
.qr svg { width: 220px; height: 220px; display: block; }
.secret { display: block; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: 1rem; letter-spacing: .08em; word-break: break-all; }
.qr svg { width: min(220px, 100%); height: auto; aspect-ratio: 1 / 1; }
