:root {
  --brand: #0f766e; --brand-dark: #115e59; --brand-soft: #e6f4f1;
  --ink: #1c2530; --muted: #5d6b78; --line: #dde3e8; --bg: #f4f6f8; --card: #fff;
  --danger: #b42318; --danger-soft: #fdecea; --warn: #9a6700; --warn-soft: #fff4d6; --ok: #11733f;
  --radius: 14px;
  font-family: "Noto Sans", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { font-size: 16px; -webkit-tap-highlight-color: transparent; padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 8px; background: var(--brand); color: #fff; }
.bar-title { flex: 1; font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; }
.icon-btn { min-width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 20px; cursor: pointer; }
.icon-btn:active { background: rgba(255,255,255,.15); }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.loading { text-align: center; color: var(--muted); padding: 48px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 18px 4px 8px; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }

label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 17px; }
textarea { height: auto; min-height: 84px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #f1c4bf; }
.btn.block { width: 100%; }
.btn.big { height: 60px; font-size: 18px; }
.btn:disabled { opacity: .5; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row > .btn { flex: 1; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .num { font-size: 26px; font-weight: 700; margin-top: 4px; }
.actions { display: grid; gap: 12px; margin-top: 12px; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer; }
.item:first-child { border-top: 0; }
.item:active { background: var(--brand-soft); }
.item .t { font-weight: 600; }
.item .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

.search { position: relative; }
.search input { padding-right: 56px; }
.mic { position: absolute; right: 4px; top: 4px; width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--brand-soft); color: var(--brand-dark); font-size: 20px; cursor: pointer; }
.mic.on { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.results { margin-top: 8px; }

.lines .line { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
.lines .line:first-child { border-top: 0; }
.line .x { border: 0; background: none; color: var(--danger); font-size: 20px; width: 36px; cursor: pointer; }
.total-bar { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; padding: 0 4px 10px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; height: 44px; border: 0; background: #fff; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--brand); color: #fff; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 48px; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 22px; cursor: pointer; }
.qty input { text-align: center; }
.note { background: var(--warn-soft); color: #5c4300; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,23,32,.45); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.sheet h3 { margin: 0 0 4px; font-size: 19px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: 92vw;
  background: #1c2530; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

.login { max-width: 380px; margin: 8vh auto 0; }
.brand { text-align: center; margin-bottom: 22px; }
.brand img { width: 72px; height: 72px; border-radius: 18px; }
.brand h1 { font-size: 24px; margin: 12px 0 4px; }
.done { text-align: center; padding: 8px 0; }
.done .big-num { font-size: 30px; font-weight: 700; margin: 6px 0; }
.req { color: var(--danger); }
.ledger { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.lrow { display: grid; grid-template-columns: minmax(0, 2.2fr) repeat(5, minmax(0, 1fr)); gap: 4px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: center; }
.lrow:first-child { border-top: 0; }
.lrow > div:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.lhead { background: #f7f9fa; color: var(--muted); font-size: 12px; font-weight: 600; }
.lname { overflow-wrap: anywhere; }
.btn.scan { height: 44px; color: var(--brand-dark); border-style: dashed; border-color: var(--brand); background: var(--brand-soft); }
