/* NanoPOS back office — light default, dark via [data-theme="dark"]. Brand blue #1F6AFD. */
:root {
  --bg: #f4f6fb; --panel: #ffffff; --panel2: #eef1f7; --line: #e3e8f0;
  --text: #161c28; --muted: #6a7384; --accent: #1f6afd; --accent2: #4a8bff;
  --good: #15a04a; --warn: #e07b18; --danger: #e23d3d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
  --logo-plate: #0b0e16;
}
[data-theme="dark"] {
  --bg: #11141b; --panel: #181c25; --panel2: #222834; --line: #2c333f;
  --text: #e9edf5; --muted: #98a1b3; --accent: #2f74ff; --accent2: #5b96ff;
  --good: #34c759; --warn: #ff9d3f; --danger: #ff6b6b;
  --shadow: none; --shadow-lg: 0 14px 40px rgba(0,0,0,.5);
  --logo-plate: #0b0e16;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
  transition: background .2s, color .2s;
}
a { color: var(--accent); }
button {
  font: inherit; cursor: pointer; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; padding: 10px 16px; font-weight: 600;
}
button.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button:active { transform: translateY(1px); }
button.icon-btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; }
input, select {
  font: inherit; background: var(--panel); border: 1px solid var(--line);
  color: var(--text); padding: 10px 12px; border-radius: 10px; width: 100%;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; border-color: var(--accent); }
.muted { color: var(--muted); }
svg.ic { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Brand emblem tile (dark plate so the white/blue emblem reads on any theme) */
.emblem { background: var(--logo-plate); border-radius: 9px; display: grid; place-items: center; }
.emblem img { width: 72%; height: 72%; object-fit: contain; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 0; width: 380px; max-width: 100%; overflow: hidden; box-shadow: var(--shadow-lg); }
.login .hero { background: var(--logo-plate); height: 150px; display: grid; place-items: center; }
.login .hero img { width: 100%; height: 100%; object-fit: cover; }
.login .body { padding: 26px 28px 30px; }
.login h1 { font-size: 18px; text-align: center; margin: 0 0 4px; }
.login p.sub { text-align: center; margin: 0 0 22px; color: var(--muted); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 14px; display: flex; flex-direction: column; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 6px 18px; }
.side .brand .emblem { width: 32px; height: 32px; }
.side .brand b { font-size: 15px; letter-spacing: .2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500; margin-bottom: 3px; font-size: 14.5px; }
.nav a.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.nav a.active svg.ic { stroke: var(--accent); }
.nav a:hover:not(.active) { background: var(--panel2); }
.side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 16px; }
.main { padding: 24px 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.topbar h2 { margin: 0; font-size: 22px; }
.pos-link { background: var(--accent); display: inline-flex; align-items: center; gap: 8px; }

/* Cards & tables */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 25px; font-weight: 700; margin-top: 6px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.panel .ph { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.panel .ph h3 { margin: 0; font-size: 15px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: var(--panel2); }
tr:last-child td { border-bottom: none; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.low { color: var(--warn); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(16,22,34,.45); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: 420px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal h3 { margin: 0 0 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; flex-direction: row; gap: 2px;
    border-right: none; border-top: 1px solid var(--line); padding: 6px; z-index: 30; overflow-x: auto; }
  .side .brand, .side .foot { display: none; }
  .nav { display: flex; width: 100%; }
  .nav a { flex: 1; flex-direction: column; gap: 3px; font-size: 10px; padding: 6px 4px; margin: 0; white-space: nowrap; }
  .main { padding: 18px 16px 90px; }
}
