:root {
  --bg: #d4d0c8;
  --panel: #ece9d8;
  --panel2: #f5f4ea;
  --line: #808080;
  --line2: #aca899;
  --sel: #316ac5;
  --danger: #c00;
  --btn: #ece9d8;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 12px/1.35 Tahoma, "Segoe UI", sans-serif;
  background: var(--bg);
  color: #000;
}
.menubar, .topbar {
  display: flex; gap: 2px; align-items: center;
  padding: 3px 6px; background: var(--panel);
  border-bottom: 1px solid var(--line2);
}
.menubar .title, .topbar strong { font-weight: 700; margin-right: 8px; }
.menubar a, .topbar a {
  color: #000; text-decoration: none; padding: 3px 8px;
  border: 1px solid transparent;
}
.menubar a:hover, .topbar a:hover { border-color: var(--line2); background: #fff; }
.menubar a.active, .topbar a.active { background: var(--sel); color: #fff; border-color: var(--sel); }
.toolbar {
  display: flex; gap: 4px; align-items: center;
  padding: 4px 6px; background: var(--panel);
  border-bottom: 1px solid var(--line2);
}
.shell {
  display: grid;
  grid-template-columns: 210px minmax(0,1fr) 300px;
  height: calc(100vh - 72px);
}
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: auto;
}
.sidebar .sec {
  font-weight: 700; padding: 8px 10px 4px; color: #003399;
  background: var(--panel2); border-bottom: 1px solid var(--line2);
}
.sidebar a {
  display: block; padding: 5px 12px 5px 18px; color: #000;
  text-decoration: none;
}
.sidebar a:hover { background: #e8f0ff; }
.sidebar a.active { background: var(--sel); color: #fff; }
.sidebar a.muted { color: #888; }
.sidebar .daybox {
  margin-top: auto; padding: 8px; border-top: 1px solid var(--line2);
  background: var(--panel2); font-size: 11px;
}
.main, .right {
  background: var(--panel);
  display: flex; flex-direction: column;
  overflow: hidden;
  padding: 6px;
}
.main { border-right: 1px solid var(--line); }
.panel-title { font-weight: 700; margin: 0 0 6px; }
.field-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.field-row label { min-width: 70px; }
.row { display:flex; gap:6px; flex-wrap:wrap; margin:6px 0; align-items:center; }
.panel {
  background: var(--panel2); border: 1px solid var(--line); padding: 8px;
}
input, select, button.btn { font: 12px Tahoma, sans-serif; }
input, select {
  border: 1px solid var(--line);
  padding: 3px 5px;
  background: #fff;
}
.grid-wrap { flex: 1; overflow: auto; border: 1px solid var(--line); background: #fff; min-height: 120px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  border: 1px solid var(--line2); padding: 3px 6px; text-align: left; white-space: nowrap;
}
table.data th { background: var(--panel); position: sticky; top: 0; }
table.data tr.selected { background: #cde8ff; }
table.data tr:hover { background: #eef5ff; }
table.data tr { cursor: pointer; }
.total-box {
  margin-top: 6px; background: #000; color: #f33;
  font: 700 36px/1.1 Consolas, monospace;
  text-align: right; padding: 8px 12px; border: 2px inset #666;
}
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
.btn {
  background: var(--btn);
  border: 1px solid #fff;
  border-right-color: #404040;
  border-bottom-color: #404040;
  padding: 6px 8px; cursor: pointer;
}
.btn:active {
  border: 1px solid #404040;
  border-right-color: #fff;
  border-bottom-color: #fff;
}
.btn.sell {
  grid-column: 1 / -1; background: #dff5df;
  font-weight: 700; padding: 12px; font-size: 14px;
}
.btn.danger { color: #800; }
.btn.primary { background: #dce8ff; font-weight: 700; }
.detail {
  border: 1px solid var(--line); background: #fff;
  padding: 6px; margin-top: 6px; min-height: 70px;
}
.barcode-box {
  margin-top: 6px; border: 1px solid var(--line);
  background: var(--panel2); padding: 6px;
}
.barcode-box input { width: 100%; font-size: 14px; padding: 6px; }
.muted { color: #555; }
.status {
  padding: 2px 8px; background: var(--panel);
  border-top: 1px solid #fff; font-size: 11px;
}
.toast {
  position: fixed; right: 12px; bottom: 28px;
  background: #333; color: #fff; padding: 8px 12px; display: none; z-index: 50;
}



/* sortable tables */
table.data th[data-sort] { user-select: none; }
table.data th.sort-asc, table.data th.sort-desc { color: #1a1a1a; font-weight: 700; }

/* Wave 1 reports hub */
.reports-panel .reports-head { display:flex; flex-wrap:wrap; gap:12px; align-items:center; justify-content:space-between; }
.reports-panel .filters { display:flex; gap:8px; flex-wrap:wrap; }
.reports-panel .filters input, .reports-panel .filters select { padding:6px 8px; }
.report-sec { margin: 16px 0 8px; font-size: 14px; opacity: .85; }
.report-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap:8px; }
.report-card { text-align:left; padding:10px; border:1px solid #cfc8b8; border-radius:8px; background:#f7f3ea; color:#1a1a1a; cursor:pointer; display:flex; flex-direction:column; gap:4px; }
.report-card.live { border-color:#2a7; background:#eef8f1; }
.report-card .badge { font-size:10px; color:#555; }
.report-card strong { font-size:13px; }
.report-card small { color:#555; font-size:11px; }
.report-view.hidden, .hidden { display:none !important; }
table.data { width:100%; border-collapse:collapse; font-size:13px; }
table.data th, table.data td { border-bottom:1px solid #cfc8b8; padding:6px 8px; text-align:left; color:#1a1a1a; }
pre.json { white-space:pre-wrap; background:#fff; color:#1a1a1a; border:1px solid #cfc8b8; padding:12px; border-radius:8px; }
.sidebar a.muted { opacity:.55; pointer-events:auto; }

/* Wave 4a — card / modal / total polish */
.total-box {
  margin-top: 6px;
  background: #000;
  color: #ff2222;
  font: 700 40px/1.1 Consolas, "Courier New", monospace;
  text-align: right;
  padding: 10px 14px;
  border: 2px inset #666;
  letter-spacing: 1px;
}
.card-form {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
  flex: 1;
  overflow: auto;
}
.card-form .field-row { margin-bottom: 8px; }
.card-form .field-row label { min-width: 72px; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 12px 14px;
  min-width: 320px; max-width: 420px;
  box-shadow: 4px 4px 0 rgba(0,0,0,.25);
}
.modal .field-row label { min-width: 90px; }

/* Wave 4b — payment modal / cash polish */
.pay-modal {
  min-width: 380px;
  max-width: 460px;
  background: #ece9d8;
  border: 2px outset #fff;
}
.pay-modal .panel-title {
  background: #000080;
  color: #fff;
  margin: -12px -14px 10px;
  padding: 6px 12px;
  font-size: 13px;
}
.pay-aux {
  padding: 4px 8px;
  min-width: 28px;
}
.cash-balance-box {
  background: #000;
  color: #ff2222;
  font: 700 22px/1.2 Consolas, "Courier New", monospace;
  padding: 8px 12px;
  margin-bottom: 8px;
  border: 2px inset #666;
  text-align: right;
}
.cash-balance-box .muted {
  color: #aaa;
  font-size: 12px;
  font-weight: 400;
  font-family: Tahoma, sans-serif;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.modal-backdrop[style*="flex"] {
  display: flex !important;
}

.report-view-toolbar { display:flex; gap:8px; align-items:center; margin-bottom:8px; flex-wrap:wrap; }
.btn-excel {
  background: #e8f5e9;
  border-color: #fff #2a7 #2a7 #fff;
  font-weight: 700;
  color: #0a5;
}
.btn-excel:hover { background: #d4edda; }

/* Language switcher */
.lang-switch a {
  font-weight: 700;
  padding: 2px 6px;
  margin: 0 1px;
}
.lang-switch a.active {
  background: var(--sel);
  color: #fff;
  border-color: var(--sel);
}
