/*
 * public/assets/pos.css — the look of the test POS.
 * Plain CSS, no frameworks. Colours are defined once as "variables" at the top
 * (--name: value) and reused below, so changing a colour is one edit.
 */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #6b7785;
  --line: #dde2e8;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --good: #1f7a46;
  --good-bg: #e5f4ea;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --bad: #a3242a;
  --bad-bg: #fbe7e8;
  --info-bg: #e8f0f7;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
/* The "hidden" attribute must always win, even over rules like label { display: block }. */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; }
h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar form { margin: 0; }
.badge {
  display: inline-block; margin-left: .5rem; padding: .1rem .5rem; border-radius: 999px;
  background: var(--info-bg); color: var(--accent); font-size: .8rem; font-weight: 600;
}
.badge-fake { background: var(--warn-bg); color: var(--warn); }
.badge-live { background: var(--good-bg); color: var(--good); }
#efdr-status { margin-left: .75rem; font-size: .85rem; }

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; padding: 1rem 1.25rem 0;
}
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem;
}
.panel.wide { margin: 1rem 1.25rem 1.5rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* ---------- buttons and inputs ---------- */
button {
  font: inherit; cursor: pointer; padding: .45rem .9rem; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: wait; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.big { width: 100%; padding: .8rem; font-size: 1.1rem; font-weight: 600; margin-top: .5rem; }
button.link { border: none; background: none; color: var(--accent); padding: .25rem .5rem; }
input, select {
  font: inherit; width: 100%; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink);
}
label { display: block; font-size: .9rem; margin-bottom: .5rem; }
label.inline { display: flex; gap: .5rem; align-items: center; }
label.inline input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 .75rem; padding: .5rem .9rem .25rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .25rem; }
.toggle { display: flex; gap: 1.25rem; margin-bottom: .75rem; }
.toggle label { display: flex; gap: .4rem; align-items: center; font-size: 1rem; }
.toggle input { width: auto; }

/* ---------- products ---------- */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.product { text-align: left; padding: .6rem .7rem; }
.product strong { display: block; font-size: .95rem; }
.product span { color: var(--muted); font-size: .8rem; }

/* ---------- tables ---------- */
/* On narrow screens, wide tables scroll sideways inside their box. */
.table-scroll { overflow-x: auto; }
.docs { min-width: 760px; }
@media (max-width: 600px) {
  .row-between { flex-wrap: wrap; }
  .layout { padding: .5rem .5rem 0; }
  .panel { padding: .9rem; }
  .panel.wide { margin: 1rem .5rem 1.5rem; }
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.cart input { width: 5.5rem; }
.docs tbody tr { cursor: pointer; }
.docs tbody tr:hover { background: var(--bg); }
.docs td.mono { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; }

/* ---------- status pills ---------- */
.status { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.status.approved { background: var(--good-bg); color: var(--good); }
.status.approved_with_warnings { background: var(--warn-bg); color: var(--warn); }
.status.rejected { background: var(--bad-bg); color: var(--bad); }
.status.pending, .status.built { background: var(--info-bg); color: var(--accent); }
.status.cancelled { background: var(--line); color: var(--muted); }

/* ---------- result box after selling ---------- */
.result { margin-top: 1rem; padding: .9rem 1rem; border-radius: 8px; border: 1px solid var(--line); }
.result.good { background: var(--good-bg); border-color: var(--good); }
.result.warn { background: var(--warn-bg); border-color: var(--warn); }
.result.bad { background: var(--bad-bg); border-color: var(--bad); }
.result.info { background: var(--info-bg); border-color: var(--accent); }
.result h3 { margin: 0 0 .5rem; font-size: 1rem; }
.result dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .75rem; margin: 0; font-size: .9rem; }
.result dt { color: var(--muted); }
.result dd { margin: 0; word-break: break-all; }

/* ---------- details pop-up ---------- */
dialog { width: min(960px, 95vw); max-height: 90vh; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; }
dialog::backdrop { background: rgba(20, 30, 40, .45); }
dialog dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; font-size: .9rem; }
dialog dt { color: var(--muted); }
dialog dd { margin: 0; word-break: break-all; }
table.pieces { width: auto; font-size: .85rem; margin-bottom: .5rem; }
table.pieces td, table.pieces th { padding: .2rem .6rem; }
table.pieces td { font-family: ui-monospace, Consolas, monospace; }
pre.xml {
  background: #0f1720; color: #d8e1ea; padding: .75rem; border-radius: 6px; overflow: auto;
  max-height: 22rem; font-size: .78rem; line-height: 1.35;
}

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-box { width: min(360px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.5rem; }
.login-box button { width: 100%; margin-top: .5rem; }
.error { background: var(--bad-bg); color: var(--bad); padding: .5rem .75rem; border-radius: 6px; font-size: .9rem; }
