/* DORU веб-версия — fintech-bold design system (согласован с мобильным приложением DORU).
   Palette: teal accent #0F766E, emerald #059669, ink #0F172A, canvas #F4F6F9, white cards r20. */

:root {
  --accent: #0F766E;
  --accent-dark: #0B5A54;
  --emerald: #059669;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --canvas: #F4F6F9;
  --card: #FFFFFF;
  --danger: #DC2626;
  --amber: #D97706;
  --radius: 20px;
  --radius-s: 12px;
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.07);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* ---------- Boot splash ---------- */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.boot-logo { font-size: 42px; font-weight: 800; letter-spacing: 4px; color: var(--accent); }
.boot-sub { color: var(--muted); font-size: 14px; }
.boot-track {
  width: 220px; height: 5px; border-radius: 3px; background: #E2E8F0;
  overflow: hidden; margin-top: 18px;
}
.boot-fill {
  width: 40%; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--emerald));
  animation: bootSlide 1.1s ease-in-out infinite;
}
@keyframes bootSlide {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(160%); }
  100% { transform: translateX(260%); }
}
.boot-stage { color: var(--muted); font-size: 12.5px; margin-top: 8px; min-height: 16px; }

/* ---------- Глобальный индикатор сети (тонкая полоса сверху при любом запросе) ---------- */
#net-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100;
  pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
#net-bar.on { opacity: 1; }
#net-bar::before {
  content: ''; display: block; height: 100%; width: 38%;
  background: linear-gradient(90deg, var(--emerald), var(--accent));
  border-radius: 2px; animation: netSlide 1s ease-in-out infinite;
}
@keyframes netSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(300%); }
}

/* ---------- Layout shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff; padding: calc(10px + var(--safe-t)) 16px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.appbar .title { font-size: 19px; font-weight: 800; }
.appbar .sub { font-size: 12px; opacity: 0.85; }
.appbar .right { display: flex; align-items: center; gap: 8px; }
.main { flex: 1; padding: 16px 16px calc(86px + var(--safe-b)); max-width: 760px; width: 100%; margin: 0 auto; }

/* ---------- Bottom tab nav ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
}
.tabbar button {
  flex: 1; background: none; border: none; padding: 9px 2px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
}
.tabbar button.active { color: var(--accent); }
.tabbar .ico { font-size: 21px; line-height: 1; }

/* ---------- Cards & typography ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card.tight { padding: 12px; }
.h1 { font-size: 24px; font-weight: 800; margin: 4px 0 12px; }
.h2 { font-size: 17px; font-weight: 700; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.big-num { font-size: 30px; font-weight: 800; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px; padding: 13px 18px;
  font-size: 15px; font-weight: 700; cursor: pointer; width: 100%;
  transition: transform 0.06s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.emerald { background: var(--emerald); color: #fff; }
.btn.soft { background: #EEF2F6; color: var(--ink); }
.btn.danger-soft { background: #FEF2F2; color: var(--danger); }
.btn.small { padding: 9px 13px; font-size: 13px; width: auto; border-radius: 11px; }

/* ---------- Inputs ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--radius-s);
  padding: 12px 13px; font-size: 16px; background: #fff; color: var(--ink); outline: none;
  appearance: none;
}
.input:focus { border-color: var(--accent); }
.searchbar { position: sticky; top: 0; z-index: 5; }

/* ---------- List rows ---------- */
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid #F1F5F9; cursor: pointer;
}
.item:last-child { border-bottom: none; }
.item .avatar {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; background: #E6F4F1; color: var(--accent);
}
.item .body { flex: 1; min-width: 0; }
.item .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.item .end { text-align: right; flex: none; }
.item .end .val { font-weight: 800; font-size: 15px; }

/* ---------- Chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 3px 10px; font-size: 11.5px; font-weight: 700;
}
.chip.green { background: #D1FAE5; color: #065F46; }
.chip.gray { background: #F1F5F9; color: #475569; }
.chip.amber { background: #FEF3C7; color: #92400E; }
.chip.red { background: #FEE2E2; color: #991B1B; }

/* ---------- Bottom sheet / modal ---------- */
.sheet-veil {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.sheet {
  background: var(--card); width: 100%; max-width: 640px;
  border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + var(--safe-b));
  max-height: 88vh; overflow-y: auto; animation: sheetUp 0.2s ease;
}
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(86px + var(--safe-b)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; border-radius: 13px; padding: 11px 18px;
  font-size: 14px; font-weight: 600; max-width: 86vw; box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}
.toast.error { background: var(--danger); }

/* ---------- POS-specific ---------- */
.paybar {
  position: fixed; left: 0; right: 0; bottom: calc(58px + var(--safe-b)); z-index: 25;
  padding: 10px 16px; max-width: 760px; margin: 0 auto;
}
.qty-steps { display: flex; align-items: center; gap: 12px; }
.qty-steps button {
  width: 42px; height: 42px; border-radius: 12px; border: none; background: #EEF2F6;
  font-size: 20px; font-weight: 800; color: var(--ink); cursor: pointer;
}
.qty-steps .q { font-size: 19px; font-weight: 800; min-width: 52px; text-align: center; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 420px; }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo .t { font-size: 38px; font-weight: 800; letter-spacing: 3px; color: var(--accent); }
.login-logo .s { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.err { color: var(--danger); font-size: 13.5px; font-weight: 600; margin-top: 8px; white-space: pre-wrap; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; font-size: 14px; }
.spin {
  width: 22px; height: 22px; border: 3px solid rgba(255,255,255,0.35); border-top-color: #fff;
  border-radius: 50%; animation: rot 0.8s linear infinite; display: inline-block;
}
.spin.dark { border-color: rgba(15,23,42,0.15); border-top-color: var(--accent); }
@keyframes rot { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
  .main { padding-top: 22px; }
  .grid2.wide4 { grid-template-columns: repeat(4, 1fr); }
}
