/* DAS POS — shared theme
   One stylesheet drives every screen. Tweak the variables below to re-theme. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --primary-dark: #4338ca;
  --sidebar: #111827;
  --sidebar-ink: #e5e7eb;
  --sidebar-active: #4f46e5;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- App shell ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar .brand {
  padding: 18px 20px; font-size: 18px; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08); letter-spacing: .3px;
}
.sidebar .brand small { display: block; font-size: 11px; font-weight: 400; color: #9ca3af; }
.nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.nav .group { padding: 14px 20px 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: #6b7280; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 20px;
  color: var(--sidebar-ink); font-size: 14px; border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255, 255, 255, .05); text-decoration: none; }
.nav a.active { background: rgba(79, 70, 229, .18); border-left-color: var(--sidebar-active); color: #fff; }
.nav .ico { width: 18px; text-align: center; opacity: .9; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .user { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.topbar .user b { color: var(--ink); }
.topbar .user form { display: inline-flex; align-items: center; margin: 0; }
.topbar .store-select { font-size: 13px; }
.content { padding: 22px; flex: 1; }

/* ---------- Cards & page header ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }

/* Stat tiles */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat.accent { border-top: 3px solid var(--primary); }
.stat.warn { border-top: 3px solid var(--warn); }
.stat.success { border-top: 3px solid var(--success); }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafafa; }
table.data tr:hover td { background: #fafbff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total td { font-weight: 700; background: #f5f3ff; border-top: 2px solid var(--primary); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer;
  font-size: 14px; font-weight: 500; }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
form .field { margin-bottom: 14px; }
form label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
input[type=text], input[type=number], input[type=password], input[type=email],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.errorlist { color: var(--danger); font-size: 13px; margin: 4px 0; padding-left: 18px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

/* ---------- Misc ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.yes { background: #fef3c7; color: #92400e; }
.badge.no { background: #dcfce7; color: #166534; }
.badge.low { background: #fee2e2; color: #991b1b; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 11px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
.messages li.success { background: #dcfce7; color: #166534; }
.messages li.error { background: #fee2e2; color: #991b1b; }
.messages li.info { background: #dbeafe; color: #1e40af; }
.muted { color: var(--muted); }
.right { text-align: right; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=text], .toolbar select { width: auto; min-width: 180px; }
.toolbar input[type=date] { width: auto; min-width: 0; }
.toolbar label { margin-bottom: 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); }
.login-card { background: var(--surface); padding: 32px; border-radius: 14px; box-shadow: var(--shadow); width: 340px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin-bottom: 20px; font-size: 13px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .5);
  display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--surface); border-radius: 14px; padding: 24px;
  width: 440px; max-width: 92vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 12px 48px rgba(0, 0, 0, .3); }
.modal h2 { margin: 0 0 12px; font-size: 17px; }
.modal h3 { color: var(--muted); }

/* ---------- Print (receipts/reports) ---------- */
@media print {
  .sidebar, .topbar, .no-print, .btn-row, .toolbar { display: none !important; }
  .content, .main, .layout { display: block; padding: 0; margin: 0; }
  .card { box-shadow: none; border: none; }
  body { background: #fff; }
  .receipt { width: 80mm; margin: 0 auto; font-size: 12px; }
}
