:root {
  /* Светлая тема по мотивам My-Task: слива + коралл + мягкий зелёный */
  --brand: #4c3575;
  --brand-2: #6a4aa0;
  --accent: #fb5d6a; /* коралл — основные действия/активное */
  --accent-2: #ff7a84;
  --green: #58c993;
  --green-soft: #e6f6ee;
  --bg: #f5f6fb;
  --card: #ffffff;
  --card-2: #f3f2f9;
  --text: #2b2740;
  --muted: #8c8aa3;
  --line: #ececf3;
  --danger: #f0546b;
  --radius: 18px;
  --shadow: 0 8px 30px rgba(76, 53, 117, 0.09);
  --shadow-sm: 0 3px 14px rgba(76, 53, 117, 0.06);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family:
    "Open Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: env(safe-area-inset-top) 16px 32px;
}

.screen {
  display: none;
  animation: fade 0.25s ease;
}
.screen.active {
  display: block;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Бренд / вход --- */
.brand {
  text-align: center;
  padding: 56px 0 28px;
}
.brand-mark {
  width: 74px;
  height: 74px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 27px;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 26px rgba(76, 53, 117, 0.28);
}
.brand h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--brand);
}
.brand-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* --- Карточки --- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card.center {
  text-align: center;
}
.muted-card {
  background: var(--card);
  border: 1px solid var(--line);
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfbfe;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.15s;
}
input::placeholder {
  color: #b7b5c8;
}
input:focus,
select:focus {
  border-color: var(--accent);
}

/* --- Кнопки --- */
.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 12px;
  transition:
    transform 0.08s,
    filter 0.15s,
    box-shadow 0.15s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(251, 93, 106, 0.32);
}
.btn-primary:disabled {
  background: #e7e6ee;
  color: #b3b1c4;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-lg {
  padding: 18px;
  font-size: 17px;
}
.btn-ghost {
  background: var(--card);
  color: var(--brand);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.row select {
  margin-bottom: 0;
}
.row .btn-ghost {
  width: 52px;
  flex: none;
  margin-bottom: 0;
  font-size: 22px;
  padding: 12px;
}

.hint {
  font-size: 13px;
  margin: 6px 0 0;
  min-height: 16px;
  color: var(--danger);
}
.hint.muted,
.muted {
  color: var(--muted);
}
code {
  background: var(--card-2);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--brand);
}

/* --- Топбар --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 2px 18px;
}
.topbar-title {
  font-weight: 800;
  font-size: 19px;
  color: var(--brand);
}

/* --- Сканер --- */
.scanner-wrap {
  padding: 16px;
}
#scanner-video-box {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
#scanner-video-box.hidden {
  display: none;
}
#scanner-video {
  width: 100%;
  display: block;
  background: #000;
  max-height: 260px;
  object-fit: cover;
}
.scan-frame {
  position: absolute;
  inset: 18% 22%;
  border: 2px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}
.manual-row {
  display: flex;
  gap: 8px;
}
.manual-row input {
  margin-bottom: 0;
}
.manual-row .btn-ghost {
  width: 52px;
  flex: none;
  margin-bottom: 0;
}

.demo-codes {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.demo-label {
  width: 100%;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.chip {
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--brand);
  border-radius: 20px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.chip:active {
  transform: scale(0.96);
}

.row.two {
  gap: 10px;
  margin-bottom: 12px;
}
.row.two .btn {
  flex: 1;
  margin-bottom: 0;
}
.returned-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--card-2);
  border-radius: 20px;
  padding: 6px 12px;
  white-space: nowrap;
}

/* --- Позиции чека --- */
.positions {
  margin-bottom: 14px;
}
.position {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}
.pos-main {
  flex: 1;
  min-width: 0;
}
.pos-name {
  font-size: 15px;
  font-weight: 700;
}
.pos-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.pos-price {
  font-weight: 800;
  color: var(--brand);
  white-space: nowrap;
}
.pos-remove {
  background: none;
  border: none;
  color: #c4c2d4;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
}

.check-footer {
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
  margin-bottom: 10px;
  padding: 0 4px;
  font-weight: 600;
}
.total-row span:last-child {
  font-size: 26px;
  font-weight: 800;
  color: var(--brand);
}

/* --- Оплата (сливовый геро) --- */
.pay-amount {
  font-size: 32px;
  font-weight: 800;
  color: var(--brand);
  margin: 4px 0 16px;
}
.qr {
  width: 224px;
  height: 224px;
  border-radius: 16px;
  background: #fff;
  padding: 10px;
  border: 1px solid var(--line);
}
.pay-status {
  margin: 16px 0;
  font-size: 15px;
  color: var(--muted);
  padding: 11px;
  border-radius: 12px;
  background: var(--card-2);
  font-weight: 600;
}
.pay-status.paid {
  color: #2b8a5f;
  background: var(--green-soft);
  font-weight: 700;
}

/* --- Успех / чек --- */
.success-check {
  width: 68px;
  height: 68px;
  margin: 8px auto 12px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.receipt {
  text-align: left;
  background: var(--card-2);
  border-radius: 14px;
  padding: 15px;
  margin: 14px 0;
  font-size: 13px;
}
.receipt-head {
  font-weight: 700;
  color: var(--brand);
}
.receipt-sub {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}
.receipt-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-weight: 600;
}
.receipt-code {
  font-size: 10px;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 4px;
}
.receipt-total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 8px;
  color: var(--brand);
}
.receipt-note {
  color: var(--muted);
  font-size: 11px;
  margin-top: 10px;
}
.send-receipt {
  text-align: left;
  margin: 8px 0 16px;
}

/* --- Остаток / отчёт --- */
.stock-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.stock-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-weight: 600;
}
.report-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}
.report-big {
  font-size: 30px;
  font-weight: 800;
  color: var(--brand);
  margin: 4px 0;
}
.report-sellers {
  margin-top: 10px;
}

/* --- Админка --- */
.row-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.role-badge {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: 20px;
  padding: 4px 11px;
  white-space: nowrap;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.admin-grid .admin-tile {
  margin-bottom: 0;
}
.admin-tile .report-big {
  font-size: 22px;
}
/* Геро-плашка со сливовым градиентом (сигнатура My-Task) */
.admin-tile.hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  box-shadow: var(--shadow);
}
.admin-tile.hero .report-title,
.admin-tile.hero .report-big,
.admin-tile.hero .hint {
  color: #fff !important;
}
.admin-tile.hero .report-title {
  opacity: 0.85;
}
.user-row {
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.user-row:first-of-type {
  border-top: none;
}
.user-partner {
  font-size: 14px;
  font-weight: 700;
}
.user-sellers {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.add-seller {
  padding: 4px 11px;
  font-size: 12px;
  color: var(--accent);
  border-color: rgba(251, 93, 106, 0.35);
}

/* --- Дашборды (KPI, спарк, рейтинг, точки) --- */
.report-scope {
  font-size: 14px;
  color: var(--muted);
  margin: 0 2px 12px;
}
.report-scope b {
  color: var(--brand);
}
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-grid.two {
  grid-template-columns: 1fr 1fr;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
}
.kpi.hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none;
  color: #fff;
}
.kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.kpi.hero .kpi-label {
  color: rgba(255, 255, 255, 0.85);
}
.kpi-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--brand);
  margin-top: 3px;
}
.kpi-val.sm {
  font-size: 15px;
}
.kpi.hero .kpi-val {
  color: #fff;
}
.kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.kpi.hero .kpi-sub {
  color: rgba(255, 255, 255, 0.85);
}

.spark {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 66px;
  padding-top: 6px;
}
.sb-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.sb {
  width: 100%;
  max-width: 26px;
  border-radius: 5px 5px 0 0;
  background: var(--line);
}
.sb.on {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.sb.future {
  background: repeating-linear-gradient(45deg, #eee, #eee 3px, #f6f6fb 3px, #f6f6fb 6px);
}
.sb-lbl {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.rank-row:first-child {
  border-top: none;
}
.rank-badge {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--muted);
}
.rank-badge.r1 {
  background: linear-gradient(135deg, #e8b64a, #d99a2b);
}
.rank-badge.r2 {
  background: #a9a7bd;
}
.rank-badge.r3 {
  background: #c08a5a;
}
.rank-name {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}
.rank-val {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.rank-go {
  color: #c4c2d4;
  font-size: 18px;
}

.points {
  margin-bottom: 4px;
}
.point-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.point-card.attention {
  border-color: rgba(240, 84, 107, 0.4);
  background: #fff7f8;
}
.point-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.point-name {
  font-weight: 700;
}
.point-total {
  font-weight: 800;
  color: var(--brand);
}
.point-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.point-sig {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sig {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
}
.sig.red {
  background: rgba(240, 84, 107, 0.12);
  color: var(--danger);
}
.sig.amber {
  background: var(--amber-soft, #fbf1de);
  color: #b8791f;
}

.card.attention {
  border-color: rgba(240, 84, 107, 0.3);
}
.stale-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.sub-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin: 10px 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.callout-mini {
  font-size: 12px;
  color: var(--muted);
  background: var(--card-2);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

/* --- Тост --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--brand);
  color: #fff;
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  box-shadow: 0 10px 30px rgba(76, 53, 117, 0.3);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
