/* LabPay — single stylesheet. Mobile-first. */

:root {
  --bg: #f5f7f5;
  --fg: #1b1f1c;
  --muted: #6b7570;
  --line: #e4e9e5;
  --card: #ffffff;
  --primary: #1f7a4d;
  --primary-fg: #ffffff;
  --primary-soft: #e6f4ec;
  --warn: #b54708;
  --danger: #b42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
               "Helvetica Neue", Arial, "Yu Gothic", "Meiryo", sans-serif;
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, button, select, textarea {
  font: inherit; color: inherit;
}

/* Header / tabs */
header#topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: white; padding: 10px 14px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
header .brand { font-weight: 800; font-size: 18px; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill { background: var(--primary-soft); color: var(--primary); padding: 4px 10px;
  border-radius: 999px; font-weight: 700; font-size: 14px; }
.bell { position: relative; font-size: 18px; }
.bell .badge { position: absolute; top: -6px; right: -10px; background: var(--danger);
  color: white; font-size: 11px; padding: 1px 6px; border-radius: 999px; font-weight: 700; }

nav#tabs {
  display: flex; gap: 4px; padding: 6px; background: white;
  border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 53px; z-index: 10;
}
nav#tabs a {
  padding: 8px 12px; border-radius: 999px; color: var(--muted); white-space: nowrap;
}
nav#tabs a.active { background: var(--primary); color: var(--primary-fg); }

main#app { padding: 14px; max-width: 720px; margin: 0 auto; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card h2 { margin: 0 0 8px; font-size: 16px; }
.card h3 { margin: 6px 0; font-size: 14px; color: var(--muted); font-weight: 600; }

/* Buttons */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: white; color: var(--fg); cursor: pointer; font-weight: 600;
  transition: background .12s, border-color .12s;
}
button.primary, .btn.primary {
  background: var(--primary); color: var(--primary-fg); border-color: var(--primary);
}
button.primary:hover { filter: brightness(0.97); }
button.danger { background: var(--danger); color: white; border-color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; color: var(--primary); }
button:disabled { opacity: .55; cursor: not-allowed; }

/* Form fields */
label.field { display: block; margin: 10px 0; }
label.field .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=url], input[type=email], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: white;
}
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }

/* Lists */
.list { display: grid; gap: 8px; }
.list-item {
  background: white; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; display: flex; justify-content: space-between; gap: 10px;
}
.list-item .meta { color: var(--muted); font-size: 12px; }

/* Balance hero */
.balance-hero { text-align: center; padding: 24px 12px; }
.balance-hero .num { font-size: 44px; font-weight: 800; color: var(--primary); letter-spacing: 1px; }
.balance-hero .lbl { color: var(--muted); }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: rgba(20,28,24,.92); color: white; padding: 10px 16px; border-radius: 999px;
  z-index: 100; max-width: 90%;
}

/* Scan view */
.scanner-wrap { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.scanner-wrap video { width: 100%; max-width: 480px; border-radius: var(--radius); background: black; }
.scanner-status { font-size: 13px; color: var(--muted); }

/* Tables for admin */
table.table { width: 100%; border-collapse: collapse; }
table.table th, table.table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
table.table th { color: var(--muted); font-weight: 600; }

/* Empty state */
.empty { color: var(--muted); text-align: center; padding: 32px 12px; }

.tag { display: inline-block; padding: 2px 8px; background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag.warn { background: #fff3df; color: var(--warn); }
.tag.danger { background: #ffe1de; color: var(--danger); }
.tag.muted { background: #eef0ef; color: var(--muted); }

.sep { height: 1px; background: var(--line); margin: 10px 0; }

.muted { color: var(--muted); }
.right { text-align: right; }
.bold { font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

@media (min-width: 720px) {
  nav#tabs { justify-content: center; }
}
