:root {
  --brand: #7a2e1f;
  --brand-2: #a8412a;
  --brand-soft: #f6ebe6;
  --bg: #f4f1ee;
  --panel: #ffffff;
  --line: #e8e1db;
  --text: #2b2421;
  --muted: #8a7f78;
  --ok: #15803d;
  --ok-soft: #e7f5ec;
  --err: #c62828;
  --err-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(60, 30, 20, .06), 0 4px 16px rgba(60, 30, 20, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); user-select: none; overflow: hidden; }
input, select, textarea, button { font: inherit; color: inherit; }
input, textarea, td, .selectable { user-select: text; }
h1, h2, h3, h4 { margin: 0; }
kbd { font-family: Consolas, monospace; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: rgba(0,0,0,.08); border: 1px solid rgba(0,0,0,.08); font-weight: 600; }
.btn kbd { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.25); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, monospace; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; transition: .12s; white-space: nowrap; }
.btn:hover { background: #faf7f5; border-color: #d9cfc7; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.success:hover { background: #166534; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.04); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.big { padding: 15px 18px; font-size: 16px; border-radius: 11px; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--text); }
.icon-btn.danger:hover { background: var(--err-soft); color: var(--err); }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 12px; outline: none; transition: .12s; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(168,65,42,.14); }
textarea.input { resize: vertical; min-height: 70px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* ---------- setup & login ---------- */
.center-wrap { height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 20% 10%, #fbe9e1 0, transparent 45%), radial-gradient(circle at 90% 90%, #efe2d6 0, transparent 40%), var(--bg); overflow: auto; padding: 24px; }
.card { background: var(--panel); border-radius: 18px; box-shadow: 0 10px 40px rgba(60,30,20,.12); border: 1px solid var(--line); }
.setup-card { width: 720px; max-width: 100%; }
.login-card { width: 440px; padding: 32px; }
.brand-head { display: flex; align-items: center; gap: 14px; padding: 26px 30px; border-bottom: 1px solid var(--line); }
.logo { width: 48px; height: 48px; border-radius: 13px; background: linear-gradient(135deg, var(--brand), #c2552f); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; font-family: Georgia, serif; font-style: italic; flex: none; }
.brand-head h1 { font-size: 20px; }
.brand-head p { margin: 2px 0 0; color: var(--muted); }
.stepper { display: flex; gap: 6px; padding: 16px 30px 0; }
.stepper .st { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-bottom: 12px; border-bottom: 3px solid var(--line); }
.stepper .st span { width: 24px; height: 24px; border-radius: 50%; background: var(--line); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.stepper .st.active { color: var(--brand); font-weight: 600; border-color: var(--brand); }
.stepper .st.active span { background: var(--brand); color: #fff; }
.stepper .st.done { color: var(--ok); border-color: var(--ok); }
.stepper .st.done span { background: var(--ok); color: #fff; }
.setup-body { padding: 24px 30px 8px; min-height: 300px; }
.setup-body h3 { margin-bottom: 4px; }
.setup-body > p { margin: 0 0 18px; color: var(--muted); }
.setup-foot { display: flex; justify-content: space-between; padding: 16px 30px 24px; }
.summary { background: var(--brand-soft); border-radius: 12px; padding: 14px 18px; line-height: 1.9; margin-bottom: 14px; }
.user-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin: 18px 0; max-height: 260px; overflow: auto; }
.user-pick button { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 14px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.user-pick button.on { border-color: var(--brand); background: var(--brand-soft); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.user-pick .nm { font-weight: 600; font-size: 13px; text-align: center; word-break: break-word; }
.user-pick .rl { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.pin-input { font-size: 22px; letter-spacing: 8px; text-align: center; padding: 12px; }

/* ---------- app shell ---------- */
.app { display: flex; height: 100vh; }
.sidebar { width: 88px; background: #2a1b16; color: #e8d9d0; display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; flex: none; }
.sidebar .logo { width: 46px; height: 46px; margin-bottom: 14px; }
.nav-btn { width: 72px; border: 0; background: transparent; color: #cdb9ad; border-radius: 12px; padding: 10px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; }
.nav-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-btn.on { background: var(--brand-2); color: #fff; }
.sidebar .spacer { flex: 1; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.topbar h2 { font-size: 19px; }
.top-right { display: flex; align-items: center; gap: 18px; color: var(--muted); }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text); }
.user-chip .avatar { width: 34px; height: 34px; font-size: 13px; }
.user-chip small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.clock { font-variant-numeric: tabular-nums; text-align: right; line-height: 1.2; }
.clock b { color: var(--text); font-size: 15px; }
.page { flex: 1; overflow: auto; padding: 20px 24px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- kasir ---------- */
.kasir { display: flex; gap: 18px; height: 100%; }
.kasir-left { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.kasir-left > .panel { padding: 14px 16px; }
.lbl { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 10px; }
.search-wrap { position: relative; flex: 1; }
.search-wrap > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 40px; height: 46px; font-size: 15px; }
.entry { display: flex; gap: 10px; align-items: stretch; }
.qty-wrap { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 0 0 0 12px; background: #fff; }
.qty-wrap label { color: var(--muted); font-weight: 600; font-size: 13px; }
.qty-wrap input { width: 80px; border: 0; outline: none; height: 44px; padding: 0 10px; font-size: 16px; font-weight: 700; text-align: center; background: transparent; }
.entry .btn { height: 46px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.14); max-height: 340px; overflow: auto; z-index: 50; }
.sg { padding: 9px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 1px solid #f3eeea; }
.sg:last-child { border-bottom: 0; }
.sg.on, .sg:hover { background: var(--brand-soft); }
.sg .c { font-family: Consolas, monospace; color: var(--brand); font-weight: 700; font-size: 13px; }
.sg .n { font-weight: 600; }
.sg small { color: var(--muted); }
.store-sel { display: flex; align-items: center; gap: 14px; background: var(--brand-soft); border: 1px solid #ecd3c7; border-radius: 10px; padding: 10px 14px; }
.store-sel .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.store-sel .nm { font-weight: 700; font-size: 16px; }
.store-sel small { color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.prod-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-content: start; padding: 2px; }
.tile { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; min-height: 104px; transition: .12s; }
.tile:hover { border-color: var(--brand-2); box-shadow: 0 4px 14px rgba(122,46,31,.12); transform: translateY(-1px); }
.tile:active { transform: scale(.98); }
.tile .c { font-family: Consolas, monospace; font-size: 12px; color: var(--brand); font-weight: 700; }
.tile .n { font-weight: 600; font-size: 13px; line-height: 1.3; flex: 1; }
.tile .p { font-size: 12px; color: var(--muted); }
.tile .badge { position: absolute; top: 8px; right: 8px; background: var(--ok); color: #fff; border-radius: 99px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.tile.in { border-color: #b8dcc5; background: #fbfefc; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty svg { opacity: .35; margin-bottom: 8px; }

.cart { width: 440px; display: flex; flex-direction: column; flex: none; overflow: hidden; }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cart-head h3 { font-size: 16px; }
.cart-head small { color: var(--muted); }
.cart-list { flex: 1; overflow: auto; }
.cart-row { display: grid; grid-template-columns: 1fr auto 86px 32px; gap: 10px; align-items: center; padding: 10px 12px 10px 16px; border-bottom: 1px solid #f3eeea; }
.cart-row.flash { animation: flash .9s; }
@keyframes flash { from { background: #fff1c7; } to { background: transparent; } }
.cr-name { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.cr-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cr-sub { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.qstep { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.qstep button { width: 30px; height: 34px; border: 0; background: #faf7f5; cursor: pointer; font-size: 16px; font-weight: 700; color: var(--brand); }
.qstep button:hover { background: var(--brand-soft); }
.qstep input { width: 54px; height: 34px; border: 0; text-align: center; font-weight: 700; outline: none; font-size: 14px; }
.cart-foot { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: #fcfaf8; }
.sum { display: flex; justify-content: space-between; color: var(--muted); }
.sum b { color: var(--text); font-variant-numeric: tabular-nums; }
.sum.total { font-size: 18px; color: var(--text); padding-top: 6px; border-top: 1px dashed var(--line); }
.sum.total b { color: var(--brand); }
.cart-foot .btn.big { margin-top: 4px; }

/* ---------- tables ---------- */
.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field { margin: 0; }
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #faf7f5; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f3eeea; vertical-align: middle; }
.tbl tr:hover td { background: #fcf9f7; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .act { white-space: nowrap; text-align: right; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.err { background: var(--err-soft); color: var(--err); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.mute { background: #eee; color: #777; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { padding: 14px 16px; }
.stat small { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11.5px; letter-spacing: .4px; }
.stat b { display: block; font-size: 22px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.page-pad { padding: 16px; }

/* ---------- settings ---------- */
.set-wrap { display: flex; gap: 18px; align-items: flex-start; }
.set-tabs { width: 220px; padding: 8px; flex: none; position: sticky; top: 0; }
.set-tabs button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 11px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); text-align: left; }
.set-tabs button:hover { background: #faf7f5; color: var(--text); }
.set-tabs button.on { background: var(--brand-soft); color: var(--brand); }
.set-body { flex: 1; padding: 22px 24px; min-width: 0; }
.set-body h3 { margin-bottom: 4px; }
.set-body .sub { color: var(--muted); margin: 0 0 18px; }
.set-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 8px; }
.split { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.preview-box { background: #e9e4df; border-radius: 12px; padding: 14px; position: sticky; top: 0; }
.preview-box h4 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.preview-box iframe { width: 100%; height: 520px; border: 0; background: #fff; border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.note { background: var(--warn-soft); color: #7a4a0c; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.note.info { background: #eaf2fb; color: #1e4f80; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(30, 18, 14, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 16px; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .15s; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fcfaf8; border-radius: 0 0 16px 16px; }
.result-hero { text-align: center; padding: 6px 0 16px; }
.result-hero .ok-ic { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.result-hero h2 { font-size: 20px; }
.result-hero .num { font-family: Consolas, monospace; font-size: 18px; color: var(--brand); font-weight: 700; margin-top: 6px; }
.status-line { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; margin-top: 10px; }
.status-line.ok { background: var(--ok-soft); }
.status-line.err { background: var(--err-soft); }
.status-line.mute { background: #f4f1ee; }
.status-line .t { font-weight: 700; }
.status-line .d { font-size: 12.5px; color: var(--muted); word-break: break-all; margin-top: 3px; }
.status-line.err .d { color: var(--err); }
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.detail-grid iframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.kv-list { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin-bottom: 14px; }
.kv-list dt { color: var(--muted); }
.kv-list dd { margin: 0; font-weight: 600; }
.file-list { font-size: 12.5px; background: #faf7f5; border-radius: 8px; padding: 8px 12px; word-break: break-all; }
.file-list div { padding: 3px 0; }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #2a1b16; color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 420px; animation: slide .2s; font-weight: 500; }
.toast.ok { background: var(--ok); }
.toast.error { background: var(--err); }
.toast.warn { background: var(--warn); }
.toast.out { opacity: 0; transform: translateX(20px); transition: .3s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8cec6; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- web additions ---------- */
.start-wrap { max-width: 880px; margin: 10px auto; }
.start-card { padding: 26px 30px; }
.start-card h3 { font-size: 20px; margin-bottom: 4px; }
.start-card > p { color: var(--muted); margin: 0 0 20px; }
.code-input { font-size: 26px !important; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; height: 60px; font-family: Consolas, monospace; }
.store-hit { margin-top: 10px; padding: 12px 16px; border-radius: 10px; display: flex; gap: 12px; align-items: center; }
.store-hit.ok { background: var(--ok-soft); color: var(--ok); }
.store-hit.err { background: var(--err-soft); color: var(--err); }
.store-hit.idle { background: #f4f1ee; color: var(--muted); }
.store-hit b { font-size: 16px; color: var(--text); }
.trip { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.trip .tcol small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.trip .tcol b { font-size: 15px; }
.trip .tcol.main b { font-size: 18px; color: var(--brand); }
.req { color: var(--err); }
.install-hero { text-align: center; }
.install-hero .logo { width: 72px; height: 72px; font-size: 34px; margin: 0 auto 12px; border-radius: 18px; }
.steps-list { margin: 0; padding-left: 20px; line-height: 1.9; }
.code-box { background: #2a1b16; color: #f6ebe6; font-family: Consolas, monospace; padding: 10px 14px; border-radius: 8px; font-size: 12.5px; word-break: break-all; user-select: text; }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; background: var(--err); color: #fff; text-align: center; padding: 6px; font-weight: 600; z-index: 300; }
.code-list { max-height: 420px; overflow: auto; margin-top: 10px; }
.code-list .sg { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
