/* Kasuwa — NegoLinks dark base with the Kasuwa "Trade Teal" accent.
   Built for small Android phones used outdoors: big targets, big numbers, strong contrast. */
:root {
  --bg-primary: #080810;
  --bg-surface: #0e0e1c;
  --bg-card: #131325;
  --bg-border: #1c1c34;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b8;
  --text-muted: #8686a3; /* slightly lighter than the suite default for outdoor legibility */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --gold: #d4af37;
  --gold-light: #f0d060;

  --accent-primary: #14b8a6;
  --accent-light: #2dd4bf;
  --accent-deep: #0f766e;
  --accent-glow: rgba(20, 184, 166, 0.16);
  --accent-border: rgba(20, 184, 166, 0.35);

  --radius: 16px;
  --font: Inter, Poppins, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: 17px/1.45 var(--font);
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: 0.55; }
:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 2px; }
h1, h2, h1:focus-visible, h2:focus-visible { outline: none; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.screen { display: flex; flex-direction: column; gap: 16px; padding-top: 12px; min-height: 100vh; }
.screen.center { align-items: stretch; justify-content: flex-start; padding-top: 40px; text-align: center; }

/* ---------- splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 10px;
  background: radial-gradient(circle at 50% 40%, rgba(20, 184, 166, 0.18), transparent 60%), var(--bg-primary);
  transition: opacity 0.35s ease;
}
.splash img { width: 88px; height: 88px; }
.splash-name { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--gold), var(--gold-light)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash-sub { color: var(--text-secondary); }
.splash-bar { width: 160px; height: 3px; border-radius: 3px; background: var(--bg-border); overflow: hidden; }
.splash-bar::after { content: ""; display: block; height: 100%; width: 40%; background: var(--accent-primary); animation: slide 1.1s ease-in-out infinite; }
.splash-out { opacity: 0; pointer-events: none; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; justify-content: center; text-align: left; }
.brand-name { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.01em; background: linear-gradient(135deg, var(--gold), var(--gold-light)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.brand-name.sm { font-size: 1rem; }
.brand-sub { color: var(--text-secondary); font-size: 0.95rem; }
.brand-sm .brand-name { font-size: 1.4rem; }
.brand-sm { justify-content: flex-start; }
.tagline { color: var(--text-secondary); font-size: 1.15rem; margin: 4px 0 8px; }

/* ---------- welcome ---------- */
.welcome-title { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin: 18px 0 4px; }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lang-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 112px;
  border-radius: var(--radius); border: 1px solid var(--accent-border); background: var(--bg-card);
}
.lang-btn:active { background: var(--accent-glow); }
.lang-greet { font-size: 1.35rem; font-weight: 700; }
.lang-name { color: var(--accent-light); font-weight: 600; }

/* ---------- buttons ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 140px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 700; text-align: center;
}
.btn-primary { background: linear-gradient(135deg, var(--accent-primary), var(--accent-deep)); color: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; border-color: var(--accent-border); color: var(--accent-light); }
.btn-xl { min-height: 64px; font-size: 1.1rem; width: 100%; }
.btn-small { min-height: 40px; padding: 6px 12px; font-size: 0.9rem; border-color: var(--accent-border); background: var(--accent-glow); color: var(--accent-light); }
.link-btn { background: none; border: 0; color: var(--accent-light); text-decoration: underline; padding: 12px; min-height: 44px; }
.center-text { align-self: center; }
.icon { width: 22px; height: 22px; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--bg-border); background: var(--bg-card); }
.icon-btn.big { width: 56px; height: 56px; }
.icon-btn-space { width: 48px; }
.lbl { display: flex; flex-direction: column; align-items: inherit; line-height: 1.2; }
.lbl .en { font-size: 0.75rem; font-weight: 500; opacity: 0.75; margin-top: 3px; }

/* ---------- top bar ---------- */
.topbar { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; }
.topbar h1 { margin: 0; font-size: 1.25rem; text-align: center; }

/* ---------- home ---------- */
.home-head { display: flex; justify-content: space-between; align-items: center; }
.shop { margin: 0; font-size: 1.35rem; }
.pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; background: var(--bg-card); border: 1px solid var(--bg-border); color: var(--text-secondary); }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); }
.pill-up .dot { background: var(--success); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18); }
.pill-down .dot { background: var(--warning); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { text-align: left; padding: 14px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--accent-border); }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; }
.stat-value { font-size: 1.55rem; font-weight: 800; background: linear-gradient(135deg, var(--accent-primary), var(--accent-light)); -webkit-background-clip: text; background-clip: text; color: transparent; word-break: break-word; }
.stat-value.stat-amber { background: linear-gradient(135deg, #f59e0b, #fcd34d); -webkit-background-clip: text; background-clip: text; }
.stat-note { color: var(--text-muted); font-size: 0.85rem; }
.stat-note + .stat-note { margin-top: 2px; font-size: 0.78rem; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 140px; padding: 14px 10px;
  border-radius: 20px; border: 2px solid; background: var(--bg-card); font-weight: 800; font-size: 1.1rem; text-align: center;
}
.action:active { transform: scale(0.98); }
.action-icon { width: 46px; height: 46px; }
.action-sale { border-color: rgba(34, 197, 94, 0.55); color: #4ade80; }
.action-debt { border-color: rgba(245, 158, 11, 0.55); color: #fbbf24; }
.action-payment { border-color: rgba(59, 130, 246, 0.6); color: #60a5fa; }
.action-expense { border-color: rgba(244, 63, 94, 0.55); color: #fb7185; }
.action-ask { border-color: var(--accent-border); color: var(--accent-light); grid-column: 1 / -1; flex-direction: row; min-height: 84px; gap: 14px; }
.action-ask .action-icon { width: 38px; height: 38px; }
.action-ask .lbl { align-items: flex-start; text-align: left; }
.action .lbl { align-items: center; }
.action .lbl .en { color: var(--text-secondary); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; min-height: 64px; border-radius: 12px; background: var(--bg-surface); border: 1px solid var(--bg-border); font-size: 0.85rem; color: var(--text-secondary); }

/* ---------- recording ---------- */
.hint { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--bg-border); }
.hint p { margin: 0; color: var(--text-secondary); }
.hint-icon { width: 32px; height: 32px; flex: none; }
.hint-sale .hint-icon { color: #4ade80; }
.hint-debt .hint-icon { color: #fbbf24; }
.hint-payment .hint-icon { color: #60a5fa; }
.hint-expense .hint-icon { color: #fb7185; }
.hint-ask .hint-icon { color: var(--accent-light); }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0 6px; }
.mic {
  position: relative; width: 168px; height: 168px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-deep)); color: #fff;
  box-shadow: 0 10px 40px rgba(20, 184, 166, 0.25);
}
.mic-icon { width: 64px; height: 64px; position: relative; }
.mic .level {
  --level: 0; position: absolute; inset: -10px; border-radius: 50%; border: 6px solid var(--accent-light);
  opacity: calc(0.15 + var(--level) * 0.85); transform: scale(calc(1 + var(--level) * 0.18)); transition: transform 0.08s linear, opacity 0.08s linear;
  display: none;
}
.mic-on { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 10px 40px rgba(239, 68, 68, 0.3); }
.mic-on .level { display: block; border-color: #fca5a5; }
.mic-busy { background: var(--bg-card); border: 2px solid var(--accent-border); }
.mic-status { margin: 8px 0 0; font-weight: 700; font-size: 1.15rem; }
.timer { margin: 0; color: var(--text-muted); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 5px solid var(--bg-border); border-top-color: var(--accent-light); animation: spin 0.9s linear infinite; }
.center-spin { margin: 40px auto; width: 40px; height: 40px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.lang-pick { display: flex; flex-direction: column; gap: 6px; }

/* ---------- forms ---------- */
.form, .entry-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { color: var(--text-secondary); font-size: 0.9rem; font-weight: 600; }
input:not([type="checkbox"]) {
  width: 100%; min-height: 54px; padding: 12px 14px; border-radius: 12px;
  background: var(--bg-surface); border: 1px solid var(--bg-border); font-size: 1.1rem;
}
input:not([type="checkbox"]):focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow); outline: none; }
.amount-input { font-size: 1.6rem !important; font-weight: 800; letter-spacing: 0.02em; }
.code-input { text-transform: uppercase; letter-spacing: 0.25em; font-weight: 800; }
.two { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.consent { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--bg-border); font-size: 0.95rem; color: var(--text-secondary); }
.consent input { width: 28px; height: 28px; flex: none; margin-top: 2px; accent-color: var(--accent-primary); }
.error { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.4); color: #fca5a5; }
.amount-preview { margin: 4px 0 0; color: #4ade80; font-weight: 800; font-size: 1.15rem; min-height: 0; }
.amount-preview:empty { display: none; }
.warn { margin: 4px 0 0; color: #fbbf24; font-weight: 600; font-size: 0.95rem; }
.matched { display: flex; gap: 6px; align-items: center; margin: 4px 0 0; color: #4ade80; font-size: 0.9rem; }
.matched .icon { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--bg-border); background: var(--bg-card); color: var(--text-primary); }
.chip-on { border-color: var(--accent-primary); background: var(--accent-glow); color: var(--accent-light); font-weight: 700; }
.chips-lang { margin-top: 0; }

/* ---------- review / answer ---------- */
.heard { padding: 14px; border-radius: var(--radius); background: var(--bg-surface); border: 1px dashed var(--bg-border); display: flex; flex-direction: column; gap: 4px; }
.heard q { font-size: 1.1rem; color: var(--text-primary); font-style: italic; }
.section-title { margin: 4px 0 0; font-size: 1.1rem; }
.answer { padding: 18px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--accent-border); display: flex; flex-direction: column; gap: 12px; }
.answer-text { margin: 0; font-size: 1.4rem; font-weight: 700; line-height: 1.35; }
.feedback { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); }

/* ---------- lists ---------- */
.tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: 14px; background: var(--bg-surface); border: 1px solid var(--bg-border); }
.tab { min-height: 46px; padding: 4px 2px; border-radius: 10px; border: 0; background: transparent; color: var(--text-secondary); font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
.tab-on { background: var(--accent-glow); color: var(--accent-light); box-shadow: inset 0 0 0 1px var(--accent-border); }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row-item { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--bg-border); }
.row-item > span:first-child:not(.kind-badge) { flex: 1; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main strong { overflow-wrap: anywhere; }
.kind-badge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: none; }
.badge-sale { background: rgba(34, 197, 94, 0.14); color: #4ade80; }
.badge-debt { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
.badge-payment { background: rgba(59, 130, 246, 0.14); color: #60a5fa; }
.badge-expense { background: rgba(244, 63, 94, 0.14); color: #fb7185; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 4px 0; color: var(--text-secondary); }
.total-line strong { font-size: 1.3rem; }
.green { color: #4ade80; }
.amber { color: #fbbf24; }
.blue { color: #60a5fa; }
.rose { color: #fb7185; }
.empty { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ---------- settings ---------- */
.card { padding: 16px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--bg-border); display: flex; flex-direction: column; gap: 6px; }
.card p { margin: 0 0 6px; }
.strong { font-weight: 700; font-size: 1.1rem; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.shop-code { font-size: 2.6rem; font-weight: 900; letter-spacing: 0.22em; padding: 18px; border-radius: var(--radius); background: var(--bg-card); border: 2px dashed var(--accent-border); color: var(--accent-light); font-variant-numeric: tabular-nums; }
.shop-code.sm { font-size: 1.6rem; padding: 8px 12px; align-self: flex-start; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 14px; max-width: calc(100% - 32px);
  background: #1f2937; border: 1px solid var(--accent-border); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); font-weight: 600;
}
.toast-action { min-height: 44px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--accent-border); background: var(--accent-glow); color: var(--accent-light); font-weight: 800; }

/* ---------- footer ---------- */
.footer { margin-top: auto; padding: 18px 0 4px; border-top: 1px solid var(--bg-border); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.75rem; color: var(--text-muted); text-align: center; }
.footer a { color: var(--text-secondary); text-decoration: none; font-weight: 600; }

@media (max-width: 360px) {
  .action { min-height: 124px; font-size: 1rem; }
  .stat-value { font-size: 1.3rem; }
  .mic { width: 148px; height: 148px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
