:root {
  --bg: #14171c;
  --panel: #1c2128;
  --panel-2: #232a33;
  --line: #2d3640;
  --text: #e6ebf0;
  --muted: #8a949f;
  --accent: #e8b04b;
  --accent-d: #c8902f;
  --green: #3fb950;
  --red: #e5534b;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px;
}
header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
header h1 { font-size: 18px; margin: 0; }
header h1 .acc { color: var(--accent); }
header .badge { font-size: 12px; color: var(--muted); margin-left: auto; }
nav {
  display: flex; gap: 4px; padding: 0 24px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
nav button {
  background: none; border: none; color: var(--muted); padding: 12px 16px;
  cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent;
}
nav button.active { color: var(--accent); border-bottom-color: var(--accent); }
main { padding: 24px; max-width: 1100px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; width: 100%;
}
.field { flex: 1; min-width: 140px; }
button.btn {
  background: var(--accent); color: #1a1d22; border: none; border-radius: 8px;
  padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 14px;
}
button.btn:hover { background: var(--accent-d); }
button.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px;
}
button.ghost:hover { border-color: var(--accent); }
button.danger { color: var(--red); border-color: #4a2b2b; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--muted); }
.pill.debt { background: #3a2a18; color: var(--accent); }
.pill.ok { background: #16301c; color: var(--green); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.product {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.product .icon { font-size: 42px; line-height: 1; height: 110px; display: flex; align-items: center; justify-content: center; }
.product .pimg { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; background: #11151a; }
.product .prow { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.product .name { font-weight: 600; margin: 8px 0 4px; }
.product .price { color: var(--accent); font-size: 18px; font-weight: 700; }
.product .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.notice {
  background: #3a2a18; border: 1px solid var(--accent-d); color: var(--accent);
  padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px;
}
.muted { color: var(--muted); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px;
  border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); color: #ffb3ae; }
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; min-width: 320px;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 14px; }
#qrimg { display: block; margin: 14px auto; background: #fff; padding: 10px; border-radius: 8px; }
#loginOverlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; width: 320px; max-width: 90vw; text-align: center;
}
.login-card h2 { margin: 0 0 6px; }
.login-card input { margin-top: 8px; }
header #logoutBtn { margin-left: 12px; }
