@import url('../design-system/fonts.css');

:root {
  --navy-950: #071525;
  --navy-900: #0b2744;
  --navy-800: #0f3460;
  --navy-700: #1a4a7a;
  --gold: #c9a227;
  --gold-soft: #e8d48b;
  --sand: #f3efe6;
  --sand-deep: #e7dfd0;
  --ink: #152033;
  --muted: #5c6b7a;
  --line: #d7dde5;
  --white: #ffffff;
  --danger: #b42318;
  --ok: #0f6b4c;
  --radius: 16px;
  --font: 'Vazirmatn', Tahoma, sans-serif;
  --side-w: 260px;
  --shadow: 0 14px 40px rgba(7, 21, 37, 0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-family: var(--font); direction: rtl; }
body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--sand);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ── Auth page only ── */
.page-auth { background: var(--sand); }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.auth-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(7,21,37,.55), rgba(15,52,96,.72)),
    radial-gradient(ellipse at 30% 20%, #1a4a7a 0%, transparent 55%),
    linear-gradient(145deg, var(--navy-950), var(--navy-800));
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 3rem 2rem;
}

.auth-visual__glow {
  position: absolute;
  inset: auto -20% -30% auto;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, rgba(201,162,39,.28), transparent 65%);
  pointer-events: none;
  animation: floatGlow 8s ease-in-out infinite;
}

.auth-visual__logo {
  width: min(180px, 42vw);
  height: auto;
  filter: drop-shadow(0 12px 28px rgba(0,0,0,.25));
  animation: riseIn .9s ease both;
}

.auth-visual__brand {
  margin-top: 1.75rem;
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.7;
  animation: riseIn .9s .12s ease both;
}

.auth-visual__tag {
  margin-top: 1rem;
  display: inline-block;
  padding: .45rem 1rem;
  border: 1px solid rgba(232,212,139,.45);
  color: var(--gold-soft);
  border-radius: 999px;
  font-size: .9rem;
  animation: riseIn .9s .22s ease both;
}

.auth-panel-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem);
  background: linear-gradient(180deg, #faf7f1 0%, var(--sand) 100%);
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  padding: .35rem;
  background: rgba(15,52,96,.08);
  border-radius: 14px;
  margin-bottom: 1.1rem;
  max-width: 420px;
}
.role-switch__btn {
  padding: .8rem 1rem;
  border-radius: 11px;
  font-weight: 700;
  color: var(--muted);
  transition: .2s ease;
}
.role-switch__btn.active {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: var(--white);
  box-shadow: 0 8px 20px rgba(15,52,96,.2);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  padding: .35rem;
  background: rgba(15,52,96,.06);
  border-radius: 14px;
  margin-bottom: 1.75rem;
  max-width: 420px;
}

.auth-tabs__btn {
  padding: .85rem 1rem;
  border-radius: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: .2s ease;
}
.auth-tabs__btn.active {
  background: var(--white);
  color: var(--navy-800);
  box-shadow: 0 6px 18px rgba(15,52,96,.08);
}

.auth-form {
  display: none;
  max-width: 420px;
  animation: riseIn .45s ease both;
}
.auth-form.active { display: block; }

.auth-form__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: .4rem;
}
.auth-form__hint {
  color: var(--muted);
  margin-bottom: 1.4rem;
  line-height: 1.7;
  font-size: .95rem;
}
.auth-form__foot {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: .9rem;
}
.auth-extra {
  margin-top: 2rem;
  max-width: 420px;
  font-size: .85rem;
  color: var(--muted);
}
.auth-extra a {
  color: var(--navy-800);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-guest {
  margin-top: 1.75rem;
  max-width: 420px;
  display: grid;
  gap: .75rem;
  justify-items: stretch;
}
.btn-guest {
  display: block;
  text-align: center;
  padding: .95rem 1.2rem;
  border-radius: 12px;
  border: 1.5px solid var(--gold);
  color: var(--navy-900);
  font-weight: 800;
  background: linear-gradient(180deg, #fffdf6, #f7efd6);
  box-shadow: 0 8px 20px rgba(201,162,39,.18);
  transition: transform .15s, filter .15s;
}
.btn-guest:hover { filter: brightness(1.03); transform: translateY(-1px); }
.btn-catalog {
  display: block;
  text-align: center;
  padding: .95rem 1.2rem;
  border-radius: 12px;
  border: none;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  box-shadow: 0 10px 24px rgba(15, 52, 96, .28);
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.btn-catalog::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(201, 162, 39, .18) 50%, transparent 70%);
  pointer-events: none;
}
.btn-catalog:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 52, 96, .35);
}

#repAuthBlock.auth-form.active { display: block; }
#repAuthBlock[hidden] { display: none !important; }
#customerAuthBlock[hidden] { display: none !important; }

.field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}
.field > span {
  font-size: .88rem;
  font-weight: 600;
  color: var(--navy-800);
}
.field .req { color: var(--danger); font-style: normal; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 12px;
  padding: .95rem 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(15,52,96,.12);
}
.field input:disabled {
  background: #f0f2f5;
  color: var(--muted);
}

.btn-main {
  width: 100%;
  margin-top: .35rem;
  padding: 1rem 1.2rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: var(--white);
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15,52,96,.25);
  transition: transform .15s, filter .15s;
}
.btn-main:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-main:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-inline { width: auto; display: inline-block; padding: .75rem 1.25rem; }

.btn-ghost {
  width: 100%;
  margin-top: .65rem;
  padding: .7rem;
  color: var(--muted);
  font-weight: 600;
}
.btn-sm { width: auto; padding: .45rem .85rem; font-size: .85rem; }

.linkish {
  color: var(--navy-800);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mode-switch, .amt-chips {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.chip {
  flex: 1;
  min-width: 5.5rem;
  padding: .65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  font-size: .88rem;
  background: var(--white);
}
.chip.active {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: var(--white);
}

.auth-error {
  margin-top: 1rem;
  color: var(--danger);
  background: #fdecea;
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .9rem;
}
.auth-ok {
  margin-top: 1rem;
  color: var(--ok);
  background: #e8f6ef;
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .9rem;
}

/* ── Dashboard page ── */
.page-dash {
  background:
    radial-gradient(ellipse at 0% 0%, rgba(15,52,96,.08), transparent 40%),
    linear-gradient(180deg, #e8eef5 0%, var(--sand) 50%, var(--sand-deep) 100%);
  overflow-x: hidden;
}

.app-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
}
.app-loading[hidden] { display: none !important; }

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
}

.app-side {
  background: linear-gradient(185deg, var(--navy-950), var(--navy-800));
  color: var(--white);
  padding: 1.35rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.app-side__brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .35rem .5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.app-side__brand img {
  width: 42px;
  height: auto;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.25));
}
.app-side__brand strong {
  display: block;
  font-size: .95rem;
}
.app-side__brand span {
  font-size: .72rem;
  opacity: .7;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex: 1;
}

.app-nav__item {
  text-align: right;
  padding: .8rem .95rem;
  border-radius: 12px;
  color: rgba(255,255,255,.78);
  font-weight: 600;
  font-size: .92rem;
  transition: background .15s, color .15s;
}
.app-nav__item:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav__item.active {
  background: rgba(201,162,39,.22);
  color: var(--gold-soft);
}
.app-nav__item--cta {
  margin-top: 0;
  margin-bottom: .35rem;
  background: linear-gradient(135deg, #8a6d12, var(--gold));
  color: #1a1405;
  text-align: center;
}
.app-nav__item--cta:hover { filter: brightness(1.05); color: #1a1405; }

.app-side__logout {
  margin-top: auto;
  padding: .75rem;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.8);
  font-weight: 600;
  font-size: .88rem;
}
.app-side__logout:hover { background: rgba(255,255,255,.08); }

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(215,221,229,.85);
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-bar__hello { font-size: 1.05rem; color: var(--navy-900); }
.app-bar__mobile {
  font-size: .82rem;
  color: var(--muted);
  margin-top: .15rem;
}
.app-bar__menu { display: none; }

.app-content {
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2.5rem;
  max-width: 880px;
  width: 100%;
  animation: riseIn .4s ease both;
}

.dash-section__title {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  color: var(--navy-900);
  margin-bottom: .25rem;
}
.dash-section__desc {
  color: var(--muted);
  margin-bottom: 1.35rem;
  font-size: .95rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: 0 6px 18px rgba(15,52,96,.04);
}
.stat__label {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .35rem;
}
.stat__value {
  font-size: 1.15rem;
  color: var(--navy-900);
  font-weight: 800;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
  margin-bottom: 1.35rem;
}
.quick {
  padding: .9rem 1rem;
  border-radius: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  font-weight: 700;
  color: var(--navy-800);
  text-align: center;
  transition: transform .15s, box-shadow .15s;
}
.quick:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.quick--accent {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: var(--white);
  border-color: transparent;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  box-shadow: 0 10px 28px rgba(15,52,96,.05);
  margin-bottom: 1rem;
}
.panel--tight { padding-top: 1rem; }
.panel--form { max-width: 440px; }
.panel h2, .subhead {
  font-size: 1.05rem;
  color: var(--navy-900);
  margin-bottom: .85rem;
}
.panel-actions { margin-bottom: 1.25rem; }
.panel-empty {
  color: var(--muted);
  padding: 1.25rem 0;
  text-align: center;
  line-height: 1.8;
}

.card-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .95rem 1rem;
  margin-bottom: .65rem;
  background: linear-gradient(135deg, #fff, #f7fafc);
}
.card-row:last-child { margin-bottom: 0; }
.card-row__title { font-weight: 700; margin-bottom: .2rem; }
.card-row__meta { font-size: .85rem; color: var(--muted); line-height: 1.7; }
.card-row--request {
  border: 1px dashed #bfdbfe;
  background: #f8fbff;
  border-radius: 12px;
  padding: .85rem 1rem;
}
.req-badge {
  display: inline-block;
  margin-right: .4rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: #e2e8f0;
  color: var(--navy-800);
  vertical-align: middle;
}
.req-badge--draft {
  background: #fef3c7;
  color: #92400e;
}

.wallet-balance {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy-900);
  margin: .25rem 0 1rem;
  direction: ltr;
  text-align: right;
}

.tx-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: .9rem;
}
.tx-item:last-child { border-bottom: none; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .85rem;
}
.panel-head h2 {
  margin: 0;
  font-size: 1rem;
}
.panel-count {
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 .45rem;
  border-radius: 999px;
  background: #e8eef5;
  color: var(--navy-800);
  font-size: .78rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}

.dash-section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}
.dash-section__head .dash-section__title { margin-bottom: .15rem; }
.dash-section__head .dash-section__desc { margin-bottom: 0; }

.mycards-block { margin-bottom: 1rem; }
.mycards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .75rem;
}

.mycard {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: linear-gradient(160deg, #fff, #f7fafc);
  box-shadow: 0 6px 18px rgba(15,52,96,.04);
}
.mycard--compact {
  padding: .85rem .95rem;
  margin-bottom: .55rem;
}
.mycard--compact:last-child { margin-bottom: 0; }
.mycard--draft {
  border-style: dashed;
  border-color: #f0c36d;
  background: #fffdf5;
}
.mycard--pending {
  border-style: dashed;
  border-color: #93c5fd;
  background: #f8fbff;
}
.mycard--issued {
  border-color: rgba(15,52,96,.12);
  background:
    linear-gradient(135deg, rgba(201,162,39,.08), transparent 45%),
    linear-gradient(160deg, #fff, #f5f8fc);
}
.mycard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .45rem;
}
.mycard__top strong {
  font-size: .98rem;
  color: var(--navy-900);
}
.mycard__chip {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  background: #e8f6ef;
  color: var(--ok);
}
.mycard__chip--paid {
  background: #e8eef8;
  color: var(--navy-800, #1e3a5f);
}
.mycard__meta {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.7;
}
.mycard__rows {
  display: grid;
  gap: .45rem;
  margin-top: .55rem;
}
.mycard__rows > div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .86rem;
  padding-bottom: .4rem;
  border-bottom: 1px dashed var(--line);
}
.mycard__rows > div:last-child { border-bottom: 0; padding-bottom: 0; }
.mycard__rows span { color: var(--muted); }
.mycard__rows b { color: var(--navy-900); font-weight: 800; }
.mycard__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .75rem;
}
.mycard__actions .btn-main,
.mycard__actions .btn-ghost {
  width: auto;
  margin-top: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── خرید داخل داشبورد ── */
.app-content { max-width: 980px; }
.buy-steps {
  display: flex; gap: .5rem; list-style: none; margin: 0 0 1rem; padding: 0; flex-wrap: wrap;
}
.buy-steps__item {
  flex: 1; min-width: 120px; display: flex; align-items: center; gap: .5rem;
  padding: .7rem .9rem; border-radius: 12px; background: var(--white);
  border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .88rem;
}
.buy-steps__item span {
  width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center;
  background: #e8eef5; font-size: .78rem;
}
.buy-steps__item.active { border-color: var(--navy-700); color: var(--navy-900); }
.buy-steps__item.active span,
.buy-steps__item.done span { background: var(--navy-700); color: #fff; }
.buy-postage-addr {
  display: grid;
  gap: .55rem;
  margin: 1rem 0;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fc;
}
.buy-postage-addr > div {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  font-size: .9rem;
}
.buy-postage-addr span { color: var(--muted); }
.buy-postage-result { margin: .75rem 0 0; }
.buy-postage-card,
.buy-pay-breakdown {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .35rem .85rem;
  background: #fff;
}
.buy-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.buy-layout {
  display: grid; grid-template-columns: 1fr 260px; gap: 1rem; align-items: start;
}
.buy-summary { position: sticky; top: 4.5rem; }
.buy-summary__total strong { color: var(--navy-900); font-size: 1.05rem; }
.buy-summary__hint { margin-top: .75rem; font-size: .82rem; color: var(--muted); text-align: center; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.buy-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .65rem; margin-bottom: 1rem;
}
.buy-card {
  text-align: right; padding: 1rem; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; display: flex; flex-direction: column; gap: .25rem;
}
.buy-card.selected { border-color: var(--navy-700); box-shadow: 0 0 0 2px rgba(15,52,96,.15); }
.buy-card__img { width: 100%; height: 64px; object-fit: contain; margin-bottom: .25rem; }
.buy-card small { color: var(--muted); font-size: .78rem; }
.plate-row { display: flex; gap: .4rem; margin-bottom: 0; align-items: center; }
.plate-row--ir {
  flex-wrap: wrap;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.plate-row input, .plate-row select {
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .5rem; text-align: center; min-width: 0;
}
.plate-seg--2, .plate-seg--iran { width: 3.2rem; flex: 0 0 3.2rem; }
.plate-seg--3 { width: 4.2rem; flex: 0 0 4.2rem; }
.plate-seg--letter { width: 5.5rem; flex: 0 0 5.5rem; }
.plate-sep { color: var(--muted); font-weight: 700; user-select: none; }
.plate-iran-label {
  font-size: .78rem; font-weight: 700; color: var(--navy-800);
  background: #dbeafe; border-radius: 8px; padding: .35rem .45rem;
}
.buy-issue { display: flex; flex-direction: column; gap: .65rem; margin-bottom: 1rem; }
.buy-issue__opt {
  display: flex; gap: .75rem; align-items: flex-start; padding: 1rem;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer;
}
.buy-issue__opt.disabled { opacity: .45; pointer-events: none; }
.buy-issue__opt span { display: flex; flex-direction: column; gap: .2rem; }
.buy-issue__opt small { color: var(--muted); font-weight: 500; }
.buy-nav { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.buy-discount { display: flex; gap: .5rem; }
.buy-discount input { flex: 1; }
.buy-terms {
  display: flex; flex-wrap: wrap; gap: .55rem .65rem; align-items: flex-start; margin: 1rem 0; font-size: .92rem;
}
.buy-terms.has-error {
  padding: .75rem;
  border: 1px solid rgba(185, 28, 28, .35);
  border-radius: 12px;
  background: #fef2f2;
}
.buy-terms .field-error { width: 100%; margin-top: 0; }
.field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--white);
  border-radius: 12px; padding: .85rem 1rem; outline: none; font: inherit;
}
.field textarea { resize: vertical; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea,
.plate-wrap.has-error .plate-row input,
.plate-wrap.has-error .plate-row select,
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, .12);
}
.field-error {
  display: block;
  color: var(--danger);
  font-size: .8rem;
  font-weight: 600;
  margin-top: .35rem;
  line-height: 1.5;
}
.field-error[hidden] { display: none !important; }
.vehicle-combo { position: relative; margin-bottom: 1rem; }
.vehicle-combo__wrap { position: relative; }
.vehicle-combo__input {
  width: 100%;
  padding-left: 2.25rem;
}
.vehicle-combo__clear {
  position: absolute;
  left: .45rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: .2rem .4rem;
  z-index: 2;
}
.vehicle-combo__clear[hidden] { display: none !important; }
.vehicle-combo__list {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  margin: 0;
  padding: .35rem 0;
  list-style: none;
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line, #dbe3ef);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 39, 68, .12);
}
.vehicle-combo__list[hidden] { display: none !important; }
.vehicle-combo__option {
  padding: .55rem .85rem;
  cursor: pointer;
  font-size: .92rem;
}
.vehicle-combo__option:hover,
.vehicle-combo__option.is-active {
  background: #eef4fb;
  color: var(--navy-900);
}
.vehicle-combo__empty {
  padding: .7rem .85rem;
  color: var(--muted);
  font-size: .88rem;
}
.vehicle-combo.has-error .vehicle-combo__input {
  border-color: var(--danger);
}
.buy-cards-wrap.has-error .buy-cards {
  outline: 2px solid rgba(185, 28, 28, .35);
  border-radius: 12px;
}
.buy-draft-banner {
  margin: 0 0 1rem;
  padding: .85rem 1rem;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--navy-800);
  font-size: .9rem;
  line-height: 1.7;
}
.buy-draft-banner[hidden] { display: none !important; }

.impersonate-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.7rem 1rem;
  background: #1a3a5c;
  color: #fff;
  font-size: 0.9rem;
}
.impersonate-banner[hidden] { display: none !important; }
.impersonate-banner .btn-ghost {
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  background: transparent;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
}

.app-nav__item--cta.active {
  background: linear-gradient(135deg, #8a6d12, var(--gold)) !important;
  color: #1a1405 !important;
}
.dash-toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--navy-900); color: #fff; padding: .75rem 1.25rem; border-radius: 999px;
  z-index: 100; font-size: .9rem; box-shadow: var(--shadow);
}
.dash-toast.error { background: var(--danger); }
.dash-toast[hidden] { display: none !important; }
button.linkish {
  background: none; border: none; color: var(--navy-800); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit;
}

.buy-summary__disc { margin-top: 1rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.buy-summary__disc-msg { font-size: .82rem; margin-top: .4rem; line-height: 1.5; }
.buy-summary__disc-msg.ok { color: var(--ok); }
.buy-summary__disc-msg.err { color: var(--danger); }
#buySumDiscRow strong { color: var(--ok); }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.catalog-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  box-shadow: 0 8px 22px rgba(15,52,96,.05);
}
.catalog-card h2 { font-size: 1.05rem; color: var(--navy-900); }
.catalog-card__img { width: 100%; height: 90px; object-fit: contain; margin-bottom: .35rem; }
.catalog-card__badge {
  display: inline-flex; align-self: flex-start; padding: .35rem .7rem;
  border-radius: 999px; font-size: .8rem; font-weight: 700; color: #fff;
  background: var(--navy-700); margin-bottom: .25rem;
}
.catalog-card__badge--eco { background: #9b1c1c; }
.catalog-card__badge--silver { background: #64748b; }
.catalog-card__badge--gold { background: #a16207; }
.catalog-card__badge--diamond { background: #6d28d9; }
.catalog-card__price { font-size: 1.1rem; font-weight: 800; color: var(--navy-800); }
.catalog-card__price small { font-weight: 600; font-size: .8rem; color: var(--muted); }
.catalog-card__meta { font-size: .82rem; color: var(--muted); }
.catalog-card__desc { font-size: .9rem; line-height: 1.7; color: var(--ink); }
.catalog-card__note { font-size: .78rem; line-height: 1.7; color: var(--muted); margin: .35rem 0 .5rem; }
.catalog-card__actions {
  display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto;
}
.catalog-detail__faces {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.catalog-detail__fig { margin: 0; }
.catalog-detail__fig figcaption {
  font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: .35rem;
}
.catalog-detail__img {
  width: 100%; max-height: 220px; object-fit: contain; margin-bottom: .5rem;
  background: #f8fafc; border-radius: 12px; border: 1px solid var(--line);
}
.catalog-detail__img--sec { max-height: 180px; }
.catalog-detail__html {
  margin-top: 1rem; line-height: 1.8; font-size: .95rem; color: var(--ink);
}
.catalog-detail__html img { max-width: 100%; height: auto; border-radius: 10px; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes floatGlow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-18px, -12px); }
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual {
    min-height: 32vh;
    padding: 2rem 1.25rem 1.5rem;
  }
  .auth-visual__logo { width: 110px; }
  .auth-visual__brand { font-size: 1.05rem; margin-top: 1rem; }
  .auth-panel-wrap { padding-top: 1.5rem; }

  .app-layout {
    display: block;
    grid-template-columns: 1fr;
    min-height: 100vh;
  }
  .app-side {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: min(280px, 86vw);
    height: 100vh;
    max-height: 100vh;
    z-index: 40;
    transform: translateX(105%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  .app-layout.side-open .app-side { transform: none; }
  .app-layout.side-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(7,21,37,.4);
    z-index: 30;
  }
  .app-main {
    width: 100%;
    min-width: 0;
  }
  .app-bar {
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .app-bar__menu { display: inline-block; }
  .app-content {
    padding: 1rem;
    max-width: none;
  }
  .stat-row { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .quick--accent { grid-column: 1 / -1; }
  .buy-layout { grid-template-columns: 1fr; }
  .buy-summary { position: static; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .mycards-grid { grid-template-columns: 1fr; }
  .dash-section__head { flex-direction: column; align-items: stretch; }
  .dash-section__head .btn-inline { width: 100%; }
  .buy-steps__item { min-width: 0; flex: 1 1 100%; }
  .catalog-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .quick-actions { grid-template-columns: 1fr; }
  .app-bar { padding: .85rem 1rem; }
  .app-bar__hello { font-size: .95rem; }
}
