/* Theme tokens taken from the captured page */
:root {
  --bg-from: #0099cc;
  --bg-color: #01bcd5;
  --bg-grey-color: #f8f8f8;
  --border-color: #d8e2e7;
  --highlight-color: #063b4f;
  --link-color: #048abb;
  --link-color-dark: #024d68;
  --text-color: #676767;
  --tree-color: #a3ca76;
  --input-color: #495057;
  --muted: #cccccc;
  --header-height: 44px;
  --sidebar-width: 240px;
  --radius: 4px;
  --radius-sm: 2px;
  --font: 'Prompt', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background: #fff;
  overflow-x: hidden;
}
body[section="login"] {
  min-height: 100vh;
  background: linear-gradient(to right, var(--bg-from), var(--bg-color));
  background-attachment: fixed;
}
button, input { font-family: inherit; }
a { color: var(--link-color); }

/* ---------- Sign-in ---------- */
.container {
  width: 100%;
  padding: 0 15px;
  margin: 0 auto;
}
@media (min-width: 576px) { .container { max-width: 540px; } }
@media (min-width: 768px) { .container { max-width: 720px; } }
@media (min-width: 992px) { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }

.col { padding: 0 15px; }
.text-center { text-align: center; }

.logo { padding-top: 25px; }
.logo svg { display: block; margin: 0 auto; width: 205px; height: 78px; }

.signin-title {
  margin: 25px 0 8px;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--highlight-color);
}
.signin-sub {
  margin: 0 0 16px;
  color: var(--highlight-color);
}

.alert-error {
  max-width: 400px;
  margin: 0 auto 9px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: #f8d7da;
  color: #721c24;
  font-size: 14px;
  text-align: center;
}

.form {
  width: 100%;
  max-width: 400px;
  margin: 25px auto 0; /* collapses with the subtitle's 16px margin */
  padding: 25px 25px 10px;
  background: #ffffff;
  border-radius: var(--radius-sm);
}
.form-group { margin-bottom: 12.8px; position: relative; }
.form-group.mb-0 { margin-bottom: 0; }
.form-control {
  display: block;
  width: 100%;
  height: 35px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--input-color);
  background: #ffffff;
  border: 1px solid #ced4da;
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.form-control::placeholder { color: #6c757d; opacity: 1; }
.form-control:focus {
  outline: 0;
  border-color: #80bdff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, .25);
}
.form-control.is-invalid { border-color: #dc3545; }
.invalid-feedback { display: none; margin-top: 4px; font-size: 12.8px; color: #dc3545; }
.form-control.is-invalid + .invalid-feedback { display: block; }

.forgot {
  position: absolute;
  top: 0;
  right: 2px;
  height: 35px;
  padding: 1px 6px;
  background: none;
  border: 0;
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

.btn {
  display: inline-block;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.5;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
}
.btn-web { background: var(--tree-color); color: #ffffff; }
.btn-web:hover:not(:disabled) { background: #8fbb5d; }
.btn:disabled { opacity: .65; cursor: default; }
.btn-block { display: block; width: 100%; }
.btn-light { background: #f8f9fa; color: #212529; border: 1px solid #f8f9fa; }

.ssl { font-size: 11px; color: var(--input-color); text-align: center; }
.ssl svg { width: 9px; height: 10px; vertical-align: -1px; margin-right: 2px; }

.signup-line { margin: 25px 0 4px; color: #ffffff; }
.signup-line a { color: #ffffff; text-decoration: underline; }

.dropdown { position: relative; display: inline-block; margin-right: 24px; }
.dropdown-toggle {
  padding: 6px 12px;
  background: none;
  border: 0;
  color: #ffffff;
  font-size: 16px;
  line-height: 1.5;
  cursor: pointer;
}
.dropdown-toggle::after {
  content: "";
  display: inline-block;
  margin-left: 4px;
  vertical-align: 4px;
  border-top: 4.8px solid;
  border-right: 4.8px solid transparent;
  border-left: 4.8px solid transparent;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  min-width: 160px;
  margin-top: 2px;
  padding: 8px 0;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: var(--radius);
  text-align: left;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 4px 24px;
  background: none;
  border: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-color);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.dropdown-item:hover { background: #f8f9fa; color: #16181b; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1040;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px 8px;
  overflow-y: auto;
}
.modal-content {
  width: 100%; max-width: 500px;
  background: #ffffff;
  border-radius: 4.8px;
  border: 1px solid rgba(0, 0, 0, .2);
  text-align: left;
}
.modal-header { padding: 16px; border-bottom: 1px solid #dee2e6; }
.modal-title { margin: 0; font-size: 20px; font-weight: 500; line-height: 1.5; color: var(--highlight-color); }
.modal-body { padding: 16px; font-size: 14px; color: var(--text-color); }
.modal-body label { display: block; margin-bottom: 8px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 6px; padding: 12px 16px; border-top: 1px solid #dee2e6; }
.modal-note { margin-top: 10px; color: #28a745; }

/* ---------- Desktop (after sign-in) ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--header-height);
  display: flex; align-items: center; gap: 10px;
  padding: 0 15px;
  background: linear-gradient(to right, var(--bg-from), var(--bg-color));
  color: #ffffff;
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 16px; }
.topbar .brand svg { width: 26px; height: 26px; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.topbar button {
  background: rgba(255, 255, 255, .15); color: #ffffff; border: 0;
  border-radius: var(--radius); padding: 4px 10px; font-size: 13px; cursor: pointer;
}
.menu-btn { display: none; font-size: 18px !important; line-height: 1; }

.sidebar {
  position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 40;
  width: var(--sidebar-width);
  overflow-y: auto;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  padding: 8px 0 24px;
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 18px;
  background: none; border: 0;
  font-size: 14px; color: var(--text-color);
  text-align: left; cursor: pointer;
}
.side-item .ico {
  width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: #ffffff; flex: none;
}
.side-item:hover { background: var(--bg-grey-color); }
.side-item.active { background: #eaf6fb; color: var(--highlight-color); font-weight: 500; box-shadow: inset 3px 0 0 var(--link-color); }
.side-sep { margin: 10px 18px 4px; font-size: 11px; color: #9aa5ab; text-transform: uppercase; letter-spacing: .5px; }

.content {
  margin-left: var(--sidebar-width);
  padding: calc(var(--header-height) + 20px) 24px 40px;
  min-height: 100vh;
  background: var(--bg-grey-color);
  color: var(--text-color);
  font-size: 14px;
}
.content h1 { margin: 0 0 4px; font-size: 22px; font-weight: 500; color: var(--highlight-color); line-height: 1.3; }
.content h2 { margin: 28px 0 12px; font-size: 17px; font-weight: 500; color: var(--highlight-color); }
.lead { margin: 0 0 6px; }
.note {
  margin: 12px 0 0; padding: 8px 12px;
  background: #fff8e1; border: 1px solid #ffe08a; border-radius: var(--radius);
  font-size: 12.5px; color: #7a5b00;
}

.flow {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  counter-reset: step;
}
.step {
  position: relative;
  padding: 14px 14px 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--text-color);
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.step:hover { border-color: var(--link-color); box-shadow: 0 4px 14px rgba(4, 138, 187, .15); transform: translateY(-1px); }
.step.active { border-color: var(--link-color); box-shadow: 0 0 0 2px rgba(4, 138, 187, .35); }
.step .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #ffffff; font-weight: 500; font-size: 13px; margin-bottom: 6px;
}
.step .t { display: block; font-size: 15px; font-weight: 500; color: var(--highlight-color); margin-bottom: 2px; }
.step .tag { display: inline-block; margin-top: 8px; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: var(--bg-grey-color); border: 1px solid var(--border-color); }

.detail {
  margin-top: 18px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 18px 20px;
}
.detail h3 { margin: 0 0 6px; font-size: 18px; font-weight: 500; color: var(--highlight-color); }
.detail ol { margin: 10px 0 0; padding-left: 20px; }
.detail li { margin-bottom: 6px; }
.detail .path { display: inline-block; font-size: 12px; background: #eaf6fb; color: var(--link-color-dark); padding: 1px 8px; border-radius: 10px; margin: 2px 4px 2px 0; }
.detail .nav { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.detail .nav button { padding: 6px 14px; font-size: 13px; border-radius: var(--radius); border: 1px solid var(--border-color); background: #ffffff; color: var(--text-color); cursor: pointer; }
.detail .nav button.primary { background: var(--tree-color); border-color: var(--tree-color); color: #ffffff; }

.chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.doc {
  flex: 1 1 120px;
  min-width: 0;
  padding: 10px;
  background: #ffffff; border: 1px solid var(--border-color); border-top: 3px solid var(--link-color);
  border-radius: 6px; font-size: 12.5px;
}
.doc b { display: block; color: var(--highlight-color); font-weight: 500; font-size: 13.5px; }
.arrow { align-self: center; color: var(--link-color); font-size: 18px; }

.lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lane { background: #ffffff; border: 1px solid var(--border-color); border-radius: 6px; padding: 14px; }
.lane h4 { margin: 0 0 8px; font-size: 15px; font-weight: 500; color: var(--highlight-color); }
.lane ul { margin: 0; padding-left: 18px; }

.screens { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.screen { background: #ffffff; border: 1px solid var(--border-color); border-radius: 6px; padding: 12px 14px; }
.screen b { display: block; color: var(--highlight-color); font-weight: 500; }
.screen code { font-size: 11px; color: #9aa5ab; word-break: break-all; }

.overlay { display: none; }

@media (max-width: 992px) {
  .lanes { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .menu-btn { display: inline-block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 16px rgba(0, 0, 0, .15); }
  .sidebar.open { transform: none; }
  .overlay.open { display: block; position: fixed; inset: var(--header-height) 0 0 0; background: rgba(0, 0, 0, .3); z-index: 35; }
  .content { margin-left: 0; padding: calc(var(--header-height) + 16px) 14px 32px; }
  .topbar .who { display: none; }
  .arrow { transform: rotate(90deg); flex-basis: 100%; text-align: center; }
  .chain { flex-direction: column; }
}

/* ---------- Working back-office screens ---------- */
.erp-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.erp-head .lead { max-width: 760px; }
.erp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.erp-head .erp-actions { margin-top: 0; }
.btn-g, .btn2 {
  padding: 6px 14px; font-size: 13.5px; line-height: 1.5; border-radius: var(--radius);
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.btn-g { background: var(--tree-color); border: 1px solid var(--tree-color); color: #ffffff; }
.btn-g:hover { background: #8fbb5d; }
.btn-g:disabled { opacity: .6; cursor: default; }
.btn2 { background: #ffffff; border: 1px solid var(--border-color); color: var(--text-color); }
.btn2:hover { border-color: var(--link-color); color: var(--link-color); }
.flash { margin: 0 0 12px; padding: 9px 12px; border-radius: var(--radius); background: #e8f5e0; border: 1px solid #c6e3b3; color: #2f6b12; }
.flash.bad { background: #fdecee; border-color: #f5c2c7; color: #a1202d; }
.card { background: #ffffff; border: 1px solid var(--border-color); border-radius: 6px; padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 16px; font-weight: 500; color: var(--highlight-color); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #ffffff; border: 1px solid var(--border-color); border-left: 4px solid var(--link-color); border-radius: 6px; padding: 10px 12px; }
.kpi span { display: block; font-size: 12px; }
.kpi b { font-size: 19px; font-weight: 500; color: var(--highlight-color); }
.kpi.warn { border-left-color: #e8a317; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.tab { padding: 7px 14px; background: none; border: 0; border-bottom: 2px solid transparent; font-family: inherit; font-size: 13.5px; color: var(--text-color); cursor: pointer; }
.tab.on { color: var(--link-color); border-bottom-color: var(--link-color); font-weight: 500; }
.tbl-wrap { width: 100%; overflow-x: auto; background: #ffffff; border: 1px solid var(--border-color); border-radius: 6px; margin-bottom: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--highlight-color); background: #f3f7f9; padding: 8px 10px; white-space: nowrap; border-bottom: 1px solid var(--border-color); }
.tbl td { padding: 7px 10px; border-bottom: 1px solid #edf1f3; vertical-align: middle; }
.tbl tfoot td { font-weight: 500; color: var(--highlight-color); background: #f8fafb; border-top: 1px solid var(--border-color); }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f5fbfe; }
.tbl tr.jtop td { border-top: 1px solid var(--border-color); }
.tbl td.empty { text-align: center; color: #9aa5ab; padding: 18px; }
.tbl td.count { white-space: nowrap; }
.tbl td.count .inp { display: inline-block; width: 74px; min-width: 0; margin-right: 4px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; white-space: nowrap; }
.badge.ok { background: #e8f5e0; color: #2f6b12; }
.badge.warn { background: #fff4dc; color: #8a5a00; }
.badge.info { background: #e3f3fa; color: #035d80; }
.badge.mute { background: #f0f2f3; color: #6c757d; }
.late { color: #c0392b; font-style: normal; }
.okc { color: #2f6b12; }
.mute { color: #8a969c; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.grid-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.grid-form label.wide { grid-column: 1 / -1; }
.grid-form label.chk { flex-direction: row; align-items: center; gap: 6px; padding-top: 22px; }
.grid-form.add { margin: 10px 0 0; grid-template-columns: 2fr 1fr 1fr auto; }
.inp {
  width: 100%; min-width: 0; height: 33px; padding: 4px 9px; font-family: inherit; font-size: 13.5px;
  color: var(--input-color); background: #ffffff; border: 1px solid #ced4da; border-radius: var(--radius);
}
.inp:focus { outline: 0; border-color: #80bdff; box-shadow: 0 0 0 3px rgba(0, 123, 255, .2); }
.inp.num { text-align: right; }
.tbl .inp { min-width: 80px; }
.tbl select.inp { min-width: 220px; }
.tbl .inp.sm { min-width: 64px; width: 70px; }
.x { width: 28px; height: 28px; border: 1px solid var(--border-color); background: #ffffff; border-radius: 50%; color: #c0392b; cursor: pointer; font-size: 16px; line-height: 1; }
.totals { margin: 10px 0 10px auto; max-width: 360px; font-size: 13.5px; }
.totals.wide { max-width: none; margin: 0; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.totals > div b { font-weight: 500; color: var(--highlight-color); white-space: nowrap; }
.totals .grand { border-top: 1px solid var(--border-color); font-size: 15px; }
.paper { background: #ffffff; border: 1px solid var(--border-color); border-radius: 6px; padding: 24px; margin-bottom: 16px; color: #333; }
.paper-top { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--highlight-color); margin-bottom: 14px; flex-wrap: wrap; }
.paper-top .r { text-align: right; }
.paper .co { font-size: 16px; color: var(--highlight-color); }
.doc-title { font-size: 20px; font-weight: 500; color: var(--highlight-color); }
.paper-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin-bottom: 14px; font-size: 13px; }
.paper-meta span { display: block; font-size: 11.5px; color: #8a969c; }
.paper-meta b { font-weight: 500; }
.paper-meta .refs { grid-column: 1 / -1; }
.card.pay { border-left: 4px solid var(--tree-color); }
.pos-orders { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.pos-orders .tab { border: 1px solid var(--border-color); border-radius: 18px; background: #ffffff; }
.pos-orders .tab.on { background: #eaf6fb; border-color: var(--link-color); }
.pos-new { display: inline-flex; gap: 6px; margin-left: auto; }
.pos-new .inp { width: 190px; }
.pos-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pos-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px; min-height: 92px; background: #ffffff; border: 1px solid var(--border-color); border-top: 3px solid var(--tree-color); border-radius: 6px; cursor: pointer; font-family: inherit; color: var(--text-color); }
.pos-item b { font-weight: 500; color: var(--highlight-color); font-size: 13.5px; line-height: 1.3; }
.pos-item span { font-size: 15px; color: var(--link-color-dark); }
.pos-item small { font-size: 11.5px; }
.pos-item:hover:not(:disabled) { border-color: var(--link-color); }
.pos-item.out { border-top-color: #dc3545; opacity: .7; }
.pos-item:disabled { cursor: default; opacity: .6; }
.cart { position: sticky; top: calc(var(--header-height) + 12px); }
.cart-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #edf1f3; font-size: 13px; }
.cart-line small { display: block; color: #8a969c; }
.cart-line .qty { display: inline-flex; align-items: center; gap: 6px; }
.cart-line .qty button { width: 26px; height: 26px; border: 1px solid var(--border-color); border-radius: 50%; background: #ffffff; cursor: pointer; }
.change { font-size: 15px; margin: 0 0 6px; }
.change b { color: var(--highlight-color); font-weight: 500; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@media (max-width: 992px) {
  .pos-wrap, .two { grid-template-columns: 1fr; }
  .cart { position: static; }
}
@media (max-width: 767px) {
  .grid-form.add { grid-template-columns: 1fr; }
  .pos-new { margin-left: 0; width: 100%; }
  .pos-new .inp { flex: 1; width: auto; }
  .paper { padding: 14px; }
  .paper-top .r { text-align: left; }
}
@media print {
  .topbar, .sidebar, .overlay, .no-print { display: none !important; }
  body, .content { background: #ffffff !important; }
  .content { margin: 0; padding: 0; }
  .paper { border: 0; padding: 0; }
}

/* dashboard + in-page import/export */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--link-color); }
.chart .bar:hover { fill: var(--tree-color); }
.chart .axis { stroke: #dfe5e8; stroke-width: 1; }
.chart text { font-size: 10px; fill: #6c757d; font-family: inherit; }
.hbars .row { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr auto; gap: 8px; align-items: center; margin: 7px 0; font-size: 13px; }
.hbars .r { text-align: right; white-space: nowrap; }
.hbar { display: block; background: #eef3f5; border-radius: 3px; height: 12px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--tree-color); border-radius: 3px; }
.split { display: flex; height: 16px; border-radius: 4px; overflow: hidden; background: #eef3f5; margin-bottom: 10px; }
.split i { display: block; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.delta { font-size: 11.5px; margin-left: 4px; }
.delta.up { color: #2f6b12; }
.delta.down { color: #c0392b; }
.insights { list-style: none; margin: 0; padding: 0; }
.insights li { padding: 8px 0 8px 26px; position: relative; border-bottom: 1px solid #edf1f3; font-size: 13.5px; line-height: 1.5; }
.insights li:last-child { border-bottom: 0; }
.insights li::before { position: absolute; left: 2px; top: 8px; font-weight: 600; }
.insights li.good::before { content: '\2714'; color: #2f6b12; }
.insights li.warn::before { content: '\26A0'; color: #c07a00; }
.insights li.bad::before { content: '\2716'; color: #c0392b; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
label.inline .inp { width: auto; min-width: 140px; }
.io { margin-bottom: 10px; }
.io-bar { margin: 0 0 10px; }
.io-panel ul { margin: 0 0 10px 18px; padding: 0; font-size: 12.5px; }
.io-panel input[type=file] { max-width: 320px; }
@media (max-width: 767px) { .hbars .row { grid-template-columns: 1fr auto; } .hbars .row .hbar { grid-column: 1 / -1; order: 3; } }

/* print preview: shows the paper the way it will print */
@page { size: A4; margin: 12mm; }
body.previewing .topbar, body.previewing .sidebar, body.previewing .overlay, body.previewing .no-print { display: none !important; }
body.previewing { background: #dfe5e8; }
body.previewing .content { margin: 0; padding: 70px 12px 40px; background: transparent; }
body.previewing .paper { width: 100%; max-width: 794px; min-height: 560px; margin: 0 auto; padding: 40px 44px; border: 0; border-radius: 0; box-shadow: 0 2px 14px rgba(0, 0, 0, .25); box-sizing: border-box; }
.pv-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; padding: 10px 14px; background: #063b4f; color: #ffffff; font-size: 13px; }
@media print {
  .pv-bar { display: none !important; }
  body.previewing { background: #ffffff; }
  body.previewing .content { padding: 0; }
  body.previewing .paper { max-width: none; min-height: 0; padding: 0; box-shadow: none; }
}

/* POS: scan box, shifts, returns, chips */
.scan { padding: 10px 12px; }
.scan .inp { font-size: 17px; padding: 10px 12px; }
.scan-msg { min-height: 20px; margin-top: 6px; font-size: 13.5px; }
.scan-msg.ok { color: #2f6b12; }
.scan-msg.bad { color: #c0392b; font-weight: 500; }
.scan-sug { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.scan-sug:empty { display: none; }
.shiftbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-left: 4px solid #e8a317; }
.shiftbar.on { border-left-color: var(--tree-color); }
.shiftbar h3 { flex-basis: 100%; }
.shiftbar .grid-form, .shiftbar .totals { flex-basis: 100%; }
.shiftbar .erp-actions { margin-top: 0; }
.card.ret { border-left: 4px solid #dc3545; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef3f5; border-radius: 14px; padding: 3px 10px; font-size: 13px; }
.chip .x { border: 0; background: none; cursor: pointer; font-size: 15px; color: #6c757d; }
h4 { margin: 14px 0 8px; font-size: 14px; font-weight: 500; color: var(--highlight-color); }

/* =====================================================================
   Mahachai Group theme  (orange, following mahachaigroup.me)
   primary #F58426 · text #333 · muted #9D9D9D · green #6DAF09 · radius 12px (buttons) / 16px (cards)
   fonts Poppins + IBM Plex Sans Thai
   ===================================================================== */
:root {
  --brand: #F58426;
  --brand-dark: #E06F10;
  --brand-ink: #B45309;          /* orange dark enough for small text on white */
  --brand-soft: #FFF1E3;
  --brand-softer: #FFFAF5;
  --ink: #333333;
  --muted-2: #9D9D9D;
  --surface: #F5F5F5;
  --ok: #6DAF09;
  --text-color: #5f5f5f;
  --border-color: #F0E4D6;
  --highlight-color: var(--ink);
  --link-color: var(--brand-ink);
  --link-color-dark: #8A3F00;
  --tree-color: var(--brand);
  --bg-grey-color: var(--brand-softer);
  --radius: 12px;
  --radius-sm: 12px;
  --card-radius: 16px;
  --header-height: 64px;
  --font: 'Poppins', 'IBM Plex Sans Thai', 'Prompt', sans-serif;
  --shadow: 0 2px 12px rgba(120, 60, 0, .06);
}
body { font-family: var(--font); color: var(--ink); }
body[section="login"], body[section="branch"] {
  min-height: 100vh;
  background: radial-gradient(900px 420px at 85% -10%, rgba(245, 132, 38, .13), transparent 60%), radial-gradient(700px 400px at -10% 110%, rgba(245, 132, 38, .10), transparent 60%), linear-gradient(180deg, #FFFCF8, #FFF4E8);
  background-attachment: fixed;
}
a { color: var(--brand-ink); }
:focus-visible { outline: 3px solid rgba(245, 132, 38, .45); outline-offset: 2px; }

/* ---- sign-in and branch pages ---- */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 84px; padding: 0 24px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(240, 228, 214, .8); }
.auth-top .auth-logo svg { display: block; height: 56px; width: auto; }
.auth-top .auth-right { display: flex; align-items: center; gap: 10px; }
.auth-main { width: 100%; max-width: 440px; margin: 0 auto; padding: 36px 20px 48px; text-align: center; }
.auth-main.wide { max-width: 560px; text-align: left; }
.auth-title { margin: 0 0 6px; font-size: 32px; font-weight: 600; color: var(--ink); line-height: 1.25; text-align: center; }
.auth-title span { color: var(--brand); }
.auth-sub { margin: 0 0 22px; color: var(--muted-2); font-size: 14.5px; text-align: center; }
.auth-lead { margin: 20px 0 12px; font-size: 17px; font-weight: 500; color: var(--ink); }
.form { max-width: 440px; margin: 0 auto; padding: 26px 24px 18px; background: #ffffff; border: 1px solid var(--border-color); border-radius: var(--card-radius); box-shadow: 0 10px 30px rgba(120, 60, 0, .08); text-align: left; }
.form-control { height: 48px; padding: 8px 14px; font-size: 15px; border: 1px solid #E9DED2; border-radius: var(--radius); background: #fff; color: var(--ink); }
.form-control::placeholder { color: #aaa; }
.form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(245, 132, 38, .18); }
.forgot { height: 48px; color: var(--brand-ink); font-size: 13px; }
.btn { padding: 12px 20px; font-size: 16px; font-weight: 500; border-radius: var(--radius); }
.btn-web { background: var(--brand); color: #fff; }
.btn-web:hover:not(:disabled) { background: var(--brand-dark); }
.btn:disabled { opacity: .5; }
.btn-light { background: #fff; color: var(--brand-ink); border: 1px solid var(--border-color); }
.ssl { margin-top: 4px; color: var(--muted-2); }
.signup-line { margin: 22px 0 6px; color: var(--muted-2); }
.signup-line a { color: var(--brand-ink); font-weight: 500; text-decoration: none; }
.signup-line a:hover { text-decoration: underline; }
.dropdown { margin-right: 0; }
.dropdown-toggle { padding: 10px 14px; color: var(--ink); background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); font-size: 14.5px; }
.dropdown-menu { border-radius: var(--radius); border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(120, 60, 0, .12); }
.dropdown-item { font-size: 14.5px; padding: 8px 20px; }
.dropdown-item:hover { background: var(--brand-soft); color: var(--brand-ink); }
.modal-content { border-radius: var(--card-radius); border: 0; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal-header, .modal-footer { border-color: var(--border-color); }
.modal-title { color: var(--ink); }
.modal-note { color: var(--ok); }

.branch-search { display: block; margin: 0 0 12px; }
.branch-search input { width: 100%; height: 52px; padding: 0 16px 0 46px; font-size: 15px; font-family: inherit; color: var(--ink); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239D9D9D' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 15px 50% no-repeat; border: 1px solid transparent; border-radius: var(--radius); }
.branch-search input:focus { outline: 0; background-color: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(245, 132, 38, .18); }
.branch-list { display: grid; gap: 12px; }
.branch-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 18px; text-align: left; font-family: inherit; color: var(--ink); background: #fff; border: 1px solid var(--border-color); border-radius: var(--card-radius); box-shadow: var(--shadow); cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s; }
.branch-card:hover { border-color: var(--brand); box-shadow: 0 8px 24px rgba(245, 132, 38, .18); transform: translateY(-1px); }
.branch-card.here { border-color: var(--brand); background: var(--brand-softer); }
.branch-card .bc-main { flex: 1; min-width: 0; }
.branch-card b { display: block; font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.branch-card p { margin: 0 0 10px; color: var(--muted-2); font-size: 14px; line-height: 1.45; }
.branch-card .open { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 14px; font-weight: 500; }
.branch-card .open svg { width: 16px; height: 16px; }
.branch-card .chev { color: #b8b8b8; font-size: 26px; line-height: 1; }
.branch-empty { padding: 24px; text-align: center; color: var(--muted-2); }

/* ---- app shell ---- */
.topbar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--border-color); box-shadow: 0 1px 8px rgba(120, 60, 0, .05); padding: 0 20px; gap: 12px; }
.topbar .brand { gap: 10px; font-weight: 600; font-size: 17px; color: var(--ink); }
.topbar .brand svg { width: auto; height: 38px; }
.topbar .who { color: var(--muted-2); opacity: 1; }
.topbar button, .topbar .branch-chip { background: #fff; color: var(--ink); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 8px 14px; font-size: 13.5px; cursor: pointer; font-family: inherit; }
.topbar button:hover, .topbar .branch-chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.topbar .logout { background: var(--brand); border-color: var(--brand); color: #fff; }
.topbar .logout:hover { background: var(--brand-dark); color: #fff; }
.topbar .branch-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); font-weight: 500; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar { background: #fff; border-right: 1px solid var(--border-color); padding: 12px 10px 28px; }
.side-item { width: 100%; padding: 10px 12px; border-radius: var(--radius); font-size: 14.5px; color: var(--text-color); }
.side-item .ico { width: 28px; height: 28px; border-radius: 10px; background: var(--brand-soft) !important; color: var(--brand-ink); font-size: 13px; }
.side-item:hover { background: var(--brand-softer); color: var(--ink); }
.side-item.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; box-shadow: none; }
.side-item.active .ico { background: var(--brand) !important; color: #fff; }
.side-sep { margin: 16px 12px 6px; font-size: 11px; font-weight: 600; color: #b9a99a; letter-spacing: .8px; }
.content { background: var(--brand-softer); color: var(--text-color); font-size: 14.5px; padding: calc(var(--header-height) + 24px) 28px 48px; }
.content h1 { font-size: 26px; font-weight: 600; color: var(--ink); }
.content h2 { font-size: 18px; font-weight: 600; color: var(--ink); }
.note { background: var(--brand-soft); border-color: #FBD9B8; color: #8A4A0A; border-radius: var(--radius); }

/* ---- cards, tables, forms ---- */
.card, .kpi, .step, .detail, .lane, .screen, .doc, .tbl-wrap, .paper { border-radius: var(--card-radius); border-color: var(--border-color); box-shadow: var(--shadow); }
.card { padding: 20px; }
.card h3 { color: var(--ink); font-weight: 600; font-size: 16.5px; }
.kpi { border-left: 0; position: relative; padding: 14px 16px 14px 20px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.kpi.warn::before { background: #e8a317; }
.kpi span { color: var(--muted-2); font-size: 12.5px; }
.kpi b { font-size: 21px; font-weight: 600; color: var(--ink); }
.tbl th { background: #FFF6EC; color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--border-color); }
.tbl td { border-bottom: 1px solid #F7EFE6; }
.tbl tr.click:hover td { background: #FFF9F2; }
.tbl tfoot td { background: #FFFAF4; color: var(--ink); }
.btn-g, .btn2 { padding: 9px 18px; font-size: 14px; font-weight: 500; border-radius: var(--radius); }
.btn-g { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-g:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn2 { background: #fff; border: 1px solid var(--border-color); color: var(--ink); }
.btn2:hover { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-softer); }
.inp { height: 40px; border-radius: var(--radius); border: 1px solid #E9DED2; }
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(245, 132, 38, .18); }
.tab.on { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tabs { border-bottom-color: var(--border-color); }
.badge { font-weight: 500; }
.badge.warn { background: var(--brand-soft); color: var(--brand-ink); }
.badge.info { background: #EEF1F6; color: #44546a; }
.badge.ok { background: #EAF5D8; color: #4D7C0F; }
.okc { color: #4D7C0F; }
.flash { border-radius: var(--radius); background: #EEF8DF; border-color: #CFE6A6; color: #3F6B0B; }
.flash.bad { border-radius: var(--radius); }
.totals .grand { border-top-color: var(--border-color); }
.paper-top { border-bottom-color: var(--brand); }
.paper .co { color: var(--ink); font-weight: 600; }
.step:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(245, 132, 38, .18); }
.step.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(245, 132, 38, .35); }
.step .num { background: var(--brand) !important; }
.step .tag { background: var(--brand-softer); border-color: var(--border-color); }
.detail .path { background: var(--brand-soft); color: var(--brand-ink); }
.detail .nav button.primary { background: var(--brand); border-color: var(--brand); }
.doc { border-top-color: var(--brand); }
.arrow { color: var(--brand); }
.erp-head .lead { color: var(--muted-2); }

/* ---- POS ---- */
.pos-item { min-height: 104px; padding: 14px; border-radius: var(--card-radius); border-top: 4px solid var(--brand); box-shadow: var(--shadow); }
.pos-item b { color: var(--ink); font-size: 14px; font-weight: 600; }
.pos-item span { color: var(--brand-ink); font-size: 16px; font-weight: 600; }
.pos-item:hover:not(:disabled) { border-color: var(--brand); box-shadow: 0 8px 22px rgba(245, 132, 38, .2); }
.pos-item.out { border-top-color: #d9534f; }
.pos-orders .tab { border-radius: 20px; padding: 7px 16px; }
.pos-orders .tab.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.scan .inp { height: 52px; font-size: 17px; border-radius: var(--radius); border-color: var(--brand); }
.shiftbar { border-left-color: #e8a317; }
.shiftbar.on { border-left-color: var(--ok); }
.cart { position: sticky; top: calc(var(--header-height) + 16px); }

/* ---- dashboard ---- */
.chart .bar { fill: var(--brand); }
.chart .bar:hover { fill: var(--brand-dark); }
.hbar i { background: var(--brand); }
.hbar { background: #F6EBDD; }
.insights li { border-bottom-color: #F7EFE6; }
.chip { background: var(--brand-soft); color: var(--brand-ink); }

@media (max-width: 767px) {
  :root { --header-height: 58px; }
  .auth-top { height: 68px; padding: 0 14px; }
  .auth-top .auth-logo svg { height: 44px; }
  .auth-title { font-size: 27px; }
  .topbar { padding: 0 12px; }
  .topbar .brand span.bn { display: none; }
  .topbar .branch-chip { max-width: 46vw; }
  .content { padding: calc(var(--header-height) + 16px) 14px 36px; }
  .cart { position: static; }
}

/* fine tuning after checking on a phone */
.topbar button { white-space: nowrap; }
@media (max-width: 480px) {
  .topbar { gap: 6px; padding: 0 8px; }
  .topbar button, .topbar .branch-chip { padding: 7px 10px; font-size: 13px; }
  .topbar .branch-chip { max-width: 40vw; }
  .topbar .lang-btn { display: none; }
}


/* =====================================================================
   Accessibility pass (WCAG 2.2 AA): text contrast 4.5:1, 44px touch targets,
   visible focus, text >= 12px, 16px inputs on phones, reduced motion.
   The brand orange #F58426 stays for accents; filled buttons use a deeper orange.
   ===================================================================== */
:root {
  --brand-strong: #C2410C;       /* white text on it: 5.2:1 */
  --brand-strong-hover: #9A3412;
  --brand-text-lg: #EA580C;      /* large headings only: 3.6:1 */
  --muted-2: #6B6B6B;            /* 5.3:1 on white */
  --ok: #4D7C0F;                 /* 5.0:1 on white */
  --tap: 44px;
}
.btn-g, .btn-web, .detail .nav button.primary { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-g:hover, .btn-web:hover:not(:disabled), .detail .nav button.primary:hover { background: var(--brand-strong-hover); border-color: var(--brand-strong-hover); }
.auth-title span { color: var(--brand-text-lg); }
.topbar .logout { background: #fff; color: var(--ink); border-color: var(--border-color); }
.topbar .logout:hover { background: var(--brand-softer); color: var(--brand-ink); border-color: var(--brand); }
.mute, .cart-line small, .paper-meta span, .tbl td.empty, .screen code, .side-sep, .erp-head .lead, .kpi span,
.auth-sub, .ssl, .branch-card p, .who, .chart text { color: var(--muted-2); fill: var(--muted-2); }
.badge.mute { background: #EEF0F2; color: #4B5563; }
.branch-card .open { color: var(--ok); }

/* visible keyboard focus (3:1 against white) */
:focus-visible { outline: 3px solid var(--brand-strong); outline-offset: 2px; }
.inp:focus-visible, .form-control:focus-visible, .branch-search input:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 1px; }

/* touch targets */
.btn, .btn-g, .btn2, .tab, .side-item, .dropdown-toggle { min-height: var(--tap); }
.inp { height: var(--tap); }
.form-control { min-height: var(--tap); }
select.inp { min-height: var(--tap); }
.topbar button, .topbar .branch-chip { min-height: var(--tap); display: inline-flex; align-items: center; gap: 6px; }
.menu-btn { width: var(--tap); height: var(--tap); padding: 0 !important; justify-content: center; }
.cart-line .qty button { width: var(--tap); height: var(--tap); font-size: 18px; }
.x { width: var(--tap); height: var(--tap); }
.chip .x { width: 32px; height: 32px; }
.forgot { min-height: 32px; }

/* login: visible labels */
.flabel { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 500; color: var(--ink); }
.flabel-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.flabel-row .flabel { margin: 0; }
.flabel-row .forgot { position: static; height: auto; padding: 4px 0; }

/* icons */
svg.i { width: 18px; height: 18px; flex: none; vertical-align: -4px; margin-right: 6px; }
.menu-btn svg.i { margin: 0; width: 22px; height: 22px; }
.side-item .ico svg.i { margin: 0; width: 17px; height: 17px; }
.branch-chip svg.i { margin-right: 0; width: 16px; height: 16px; }

/* readable sizes and steady numbers */
.side-sep, .badge, .pos-item small, .delta, .paper-meta span, .ssl, .step .tag, .screen code, .kpi span { font-size: 12px; }
.chart text { font-size: 14px; }
.tbl td, .kpi b, .totals b, .cart-line b, .pos-item span, .change b { font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
  .inp, .form-control, .branch-search input, .scan .inp { font-size: 16px; }   /* stops iPhone zooming in on focus */
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
/* the hamburger only shows on phones (the inline-flex rule above must not reveal it on desktop) */
.topbar .menu-btn { display: none; }
@media (max-width: 767px) { .topbar .menu-btn { display: inline-flex; } }


/* ===== UX pass 2: dialog, inline errors, chart data, card tables, dark mode ===== */
.dlg-backdrop { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(30, 20, 10, .55); }
.dlg { width: 100%; max-width: 420px; padding: 22px 22px 18px; background: #fff; border-radius: var(--card-radius); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); color: var(--ink); }
.dlg h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--ink); }
.dlg p { margin: 0 0 18px; line-height: 1.55; color: var(--text-color); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.btn-danger { min-height: var(--tap); padding: 9px 18px; font-size: 14px; font-weight: 500; font-family: inherit; color: #fff; background: #B91C1C; border: 1px solid #B91C1C; border-radius: var(--radius); cursor: pointer; }
.btn-danger:hover { background: #991B1B; border-color: #991B1B; }
.field-err { margin: 4px 0 6px; font-size: 13px; font-weight: 500; color: #B91C1C; }
.field-err::before { content: "! "; font-weight: 700; }
[aria-invalid="true"] { border-color: #B91C1C !important; box-shadow: 0 0 0 3px rgba(185, 28, 28, .15) !important; }
.chart-data { margin-top: 8px; font-size: 13.5px; }
.chart-data summary { display: inline-flex; align-items: center; min-height: var(--tap); cursor: pointer; color: var(--brand-ink); font-weight: 500; }
.chart-data .tbl { margin-top: 6px; }
.chip .x { width: var(--tap); height: var(--tap); margin: -8px -10px -8px -4px; }

@media (max-width: 767px) {
  .tbl-wrap:has(> .tbl.cards) { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tfoot, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tbl.cards tr { margin-bottom: 10px; padding: 6px 14px; background: #fff; border: 1px solid var(--border-color); border-radius: var(--card-radius); box-shadow: var(--shadow); }
  .tbl.cards td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; text-align: right; border-bottom: 1px solid #F7EFE6; }
  .tbl.cards td:last-child { border-bottom: 0; }
  .tbl.cards td:empty { display: none; }
  .tbl.cards td::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; font-size: 13px; color: var(--muted-2); }
  .tbl.cards td[data-label=""]::before, .tbl.cards tfoot td::before { content: none; }
  .tbl.cards td.empty { justify-content: center; }
  .tbl.cards td .inp, .tbl.cards td select.inp { flex: 1; min-width: 0; width: auto; }
  .tbl.cards td.count { justify-content: flex-end; }
  .tbl.cards tfoot tr { background: #FFFAF4; }
}

/* dark mode follows the device setting; printed documents and slips stay white */
/* dark: follows the device unless the user picked a theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F3EEE9; --text-color: #D7CFC7; --muted-2: #ADA49B; --border-color: #3B3129;
    --brand-ink: #FDBA74; --brand-soft: #3A2617; --brand-softer: #1C1611; --ok: #A3D46A;
    --shadow: 0 2px 12px rgba(0, 0, 0, .35);
  }
  :root:not([data-theme="light"]), :root:not([data-theme="light"]) body { background: #15110D; color: var(--ink); }
  :root:not([data-theme="light"]) body[section="login"], :root:not([data-theme="light"]) body[section="branch"] { background: radial-gradient(900px 420px at 85% -10%, rgba(245, 132, 38, .16), transparent 60%), linear-gradient(180deg, #1A1410, #120E0B); }
  :root:not([data-theme="light"]) .auth-top { background: rgba(26, 20, 16, .85); border-bottom-color: var(--border-color); }
  :root:not([data-theme="light"]) .content { background: #15110D; }
  :root:not([data-theme="light"]) .topbar, :root:not([data-theme="light"]) .sidebar { background: #1E1813; border-color: var(--border-color); }
  :root:not([data-theme="light"]) .card, :root:not([data-theme="light"]) .kpi, :root:not([data-theme="light"]) .step, :root:not([data-theme="light"]) .detail, :root:not([data-theme="light"]) .lane, :root:not([data-theme="light"]) .screen, :root:not([data-theme="light"]) .doc, :root:not([data-theme="light"]) .tbl-wrap, :root:not([data-theme="light"]) .form, :root:not([data-theme="light"]) .branch-card, :root:not([data-theme="light"]) .dlg, :root:not([data-theme="light"]) .modal-content, :root:not([data-theme="light"]) .dropdown-menu, :root:not([data-theme="light"]) .pos-item, :root:not([data-theme="light"]) .cart, :root:not([data-theme="light"]) .tbl.cards tr { background: #221B16; border-color: var(--border-color); color: var(--text-color); }
  :root:not([data-theme="light"]) .branch-card.here { background: #2B2018; }
  :root:not([data-theme="light"]) .tbl th { background: #2A211A; color: var(--ink); border-bottom-color: var(--border-color); }
  :root:not([data-theme="light"]) .tbl td, :root:not([data-theme="light"]) .tbl.cards td { border-bottom-color: #2E2620; }
  :root:not([data-theme="light"]) .tbl tfoot td, :root:not([data-theme="light"]) .tbl.cards tfoot tr { background: #261E18; color: var(--ink); }
  :root:not([data-theme="light"]) .tbl tr.click:hover td { background: #2A211A; }
  :root:not([data-theme="light"]) .inp, :root:not([data-theme="light"]) .form-control, :root:not([data-theme="light"]) .branch-search input, :root:not([data-theme="light"]) select.inp, :root:not([data-theme="light"]) .dropdown-toggle { background: #18130F; color: var(--ink); border-color: #4A3D33; }
  :root:not([data-theme="light"]) .branch-search input { background-color: #2A211A; }
  :root:not([data-theme="light"]) .inp::placeholder, :root:not([data-theme="light"]) .form-control::placeholder { color: #8F857C; }
  :root:not([data-theme="light"]) .btn2, :root:not([data-theme="light"]) .topbar button, :root:not([data-theme="light"]) .topbar .logout, :root:not([data-theme="light"]) .x { background: #261E18; color: var(--ink); border-color: var(--border-color); }
  :root:not([data-theme="light"]) .btn2:hover, :root:not([data-theme="light"]) .topbar button:hover { background: #2E241C; color: var(--brand-ink); }
  :root:not([data-theme="light"]) .topbar .branch-chip { background: var(--brand-soft); color: var(--brand-ink); }
  :root:not([data-theme="light"]) .side-item:hover { background: #2A211A; }
  :root:not([data-theme="light"]) .side-sep { color: var(--muted-2); }
  :root:not([data-theme="light"]) .badge.ok { background: #263A12; color: #BDE38A; }
  :root:not([data-theme="light"]) .badge.warn { background: #3A2617; color: #FDBA74; }
  :root:not([data-theme="light"]) .badge.info { background: #23303F; color: #B8C7DA; }
  :root:not([data-theme="light"]) .badge.mute { background: #2E2A26; color: #C9C2BA; }
  :root:not([data-theme="light"]) .flash { background: #1F2E12; border-color: #3C5A1E; color: #CDEBA5; }
  :root:not([data-theme="light"]) .flash.bad { background: #3A1515; border-color: #6B2A2A; color: #F8B4B4; }
  :root:not([data-theme="light"]) .late { color: #F87171; }
  :root:not([data-theme="light"]) .okc { color: #A3D46A; }
  :root:not([data-theme="light"]) .delta.up { color: #A3D46A; }
  :root:not([data-theme="light"]) .delta.down { color: #F87171; }
  :root:not([data-theme="light"]) .field-err { color: #F87171; }
  :root:not([data-theme="light"]) .note { background: #2B1E12; border-color: #5A3A1C; color: #F6C99A; }
  :root:not([data-theme="light"]) .hbar { background: #2E241C; }
  :root:not([data-theme="light"]) .split { background: #2E241C; }
  :root:not([data-theme="light"]) .chart .axis { stroke: #3B3129; }
  :root:not([data-theme="light"]) .tabs { border-bottom-color: var(--border-color); }
  :root:not([data-theme="light"]) .pos-orders .tab, :root:not([data-theme="light"]) .tab { color: var(--text-color); }
  :root:not([data-theme="light"]) .pos-orders .tab { background: #221B16; }
  :root:not([data-theme="light"]) .shiftbar, :root:not([data-theme="light"]) .scan { background: #221B16; }
  :root:not([data-theme="light"]) .modal-header, :root:not([data-theme="light"]) .modal-footer { border-color: var(--border-color); }
  :root:not([data-theme="light"]) .dropdown-item { color: var(--text-color); }
  :root:not([data-theme="light"]) .dropdown-item:hover { background: #2A211A; }
  :root:not([data-theme="light"]) .ssl svg { fill: currentColor; }
  :root:not([data-theme="light"]) .paper { --ink: #333333; --text-color: #5f5f5f; --muted-2: #6B6B6B; --border-color: #F0E4D6; --brand-ink: #B45309; background: #fff; color: #333; }
  :root:not([data-theme="light"]) .paper .tbl-wrap, :root:not([data-theme="light"]) .paper .tbl td { background: #fff; color: #333; border-color: #F0E4D6; }
  :root:not([data-theme="light"]) .paper .tbl th { background: #FFF6EC; color: #333; }
  :root:not([data-theme="light"]) .paper .tbl tfoot td { background: #FFFAF4; }
}
/* dark: chosen by the user */
:root[data-theme="dark"] {
  --ink: #F3EEE9; --text-color: #D7CFC7; --muted-2: #ADA49B; --border-color: #3B3129;
  --brand-ink: #FDBA74; --brand-soft: #3A2617; --brand-softer: #1C1611; --ok: #A3D46A;
  --shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
:root[data-theme="dark"], :root[data-theme="dark"] body { background: #15110D; color: var(--ink); }
:root[data-theme="dark"] body[section="login"], :root[data-theme="dark"] body[section="branch"] { background: radial-gradient(900px 420px at 85% -10%, rgba(245, 132, 38, .16), transparent 60%), linear-gradient(180deg, #1A1410, #120E0B); }
:root[data-theme="dark"] .auth-top { background: rgba(26, 20, 16, .85); border-bottom-color: var(--border-color); }
:root[data-theme="dark"] .content { background: #15110D; }
:root[data-theme="dark"] .topbar, :root[data-theme="dark"] .sidebar { background: #1E1813; border-color: var(--border-color); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .kpi, :root[data-theme="dark"] .step, :root[data-theme="dark"] .detail, :root[data-theme="dark"] .lane, :root[data-theme="dark"] .screen, :root[data-theme="dark"] .doc, :root[data-theme="dark"] .tbl-wrap, :root[data-theme="dark"] .form, :root[data-theme="dark"] .branch-card, :root[data-theme="dark"] .dlg, :root[data-theme="dark"] .modal-content, :root[data-theme="dark"] .dropdown-menu, :root[data-theme="dark"] .pos-item, :root[data-theme="dark"] .cart, :root[data-theme="dark"] .tbl.cards tr { background: #221B16; border-color: var(--border-color); color: var(--text-color); }
:root[data-theme="dark"] .branch-card.here { background: #2B2018; }
:root[data-theme="dark"] .tbl th { background: #2A211A; color: var(--ink); border-bottom-color: var(--border-color); }
:root[data-theme="dark"] .tbl td, :root[data-theme="dark"] .tbl.cards td { border-bottom-color: #2E2620; }
:root[data-theme="dark"] .tbl tfoot td, :root[data-theme="dark"] .tbl.cards tfoot tr { background: #261E18; color: var(--ink); }
:root[data-theme="dark"] .tbl tr.click:hover td { background: #2A211A; }
:root[data-theme="dark"] .inp, :root[data-theme="dark"] .form-control, :root[data-theme="dark"] .branch-search input, :root[data-theme="dark"] select.inp, :root[data-theme="dark"] .dropdown-toggle { background: #18130F; color: var(--ink); border-color: #4A3D33; }
:root[data-theme="dark"] .branch-search input { background-color: #2A211A; }
:root[data-theme="dark"] .inp::placeholder, :root[data-theme="dark"] .form-control::placeholder { color: #8F857C; }
:root[data-theme="dark"] .btn2, :root[data-theme="dark"] .topbar button, :root[data-theme="dark"] .topbar .logout, :root[data-theme="dark"] .x { background: #261E18; color: var(--ink); border-color: var(--border-color); }
:root[data-theme="dark"] .btn2:hover, :root[data-theme="dark"] .topbar button:hover { background: #2E241C; color: var(--brand-ink); }
:root[data-theme="dark"] .topbar .branch-chip { background: var(--brand-soft); color: var(--brand-ink); }
:root[data-theme="dark"] .side-item:hover { background: #2A211A; }
:root[data-theme="dark"] .side-sep { color: var(--muted-2); }
:root[data-theme="dark"] .badge.ok { background: #263A12; color: #BDE38A; }
:root[data-theme="dark"] .badge.warn { background: #3A2617; color: #FDBA74; }
:root[data-theme="dark"] .badge.info { background: #23303F; color: #B8C7DA; }
:root[data-theme="dark"] .badge.mute { background: #2E2A26; color: #C9C2BA; }
:root[data-theme="dark"] .flash { background: #1F2E12; border-color: #3C5A1E; color: #CDEBA5; }
:root[data-theme="dark"] .flash.bad { background: #3A1515; border-color: #6B2A2A; color: #F8B4B4; }
:root[data-theme="dark"] .late { color: #F87171; }
:root[data-theme="dark"] .okc { color: #A3D46A; }
:root[data-theme="dark"] .delta.up { color: #A3D46A; }
:root[data-theme="dark"] .delta.down { color: #F87171; }
:root[data-theme="dark"] .field-err { color: #F87171; }
:root[data-theme="dark"] .note { background: #2B1E12; border-color: #5A3A1C; color: #F6C99A; }
:root[data-theme="dark"] .hbar { background: #2E241C; }
:root[data-theme="dark"] .split { background: #2E241C; }
:root[data-theme="dark"] .chart .axis { stroke: #3B3129; }
:root[data-theme="dark"] .tabs { border-bottom-color: var(--border-color); }
:root[data-theme="dark"] .pos-orders .tab, :root[data-theme="dark"] .tab { color: var(--text-color); }
:root[data-theme="dark"] .pos-orders .tab { background: #221B16; }
:root[data-theme="dark"] .shiftbar, :root[data-theme="dark"] .scan { background: #221B16; }
:root[data-theme="dark"] .modal-header, :root[data-theme="dark"] .modal-footer { border-color: var(--border-color); }
:root[data-theme="dark"] .dropdown-item { color: var(--text-color); }
:root[data-theme="dark"] .dropdown-item:hover { background: #2A211A; }
:root[data-theme="dark"] .ssl svg { fill: currentColor; }
:root[data-theme="dark"] .paper { --ink: #333333; --text-color: #5f5f5f; --muted-2: #6B6B6B; --border-color: #F0E4D6; --brand-ink: #B45309; background: #fff; color: #333; }
:root[data-theme="dark"] .paper .tbl-wrap, :root[data-theme="dark"] .paper .tbl td { background: #fff; color: #333; border-color: #F0E4D6; }
:root[data-theme="dark"] .paper .tbl th { background: #FFF6EC; color: #333; }
:root[data-theme="dark"] .paper .tbl tfoot td { background: #FFFAF4; }
.badge.ok { color: #3F6212; }  /* 5.2:1 on its light-green background */
/* dark: follows the device unless the user picked a theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.ok { color: #BDE38A; }
}
/* dark: chosen by the user */
:root[data-theme="dark"] .badge.ok { color: #BDE38A; }
/* dark: follows the device unless the user picked a theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-light { background: #261E18; color: var(--brand-ink); border-color: var(--border-color); }
  :root:not([data-theme="light"]) body[section="login"], :root:not([data-theme="light"]) body[section="branch"] { background-color: #120E0B; }
}
/* dark: chosen by the user */
:root[data-theme="dark"] .btn-light { background: #261E18; color: var(--brand-ink); border-color: var(--border-color); }
:root[data-theme="dark"] body[section="login"], :root[data-theme="dark"] body[section="branch"] { background-color: #120E0B; }


/* theme switch */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
.theme-btn { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 8px 12px; font-family: inherit; font-size: 13.5px; color: var(--ink); background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.theme-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.theme-btn svg.i { margin: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-btn { background: #261E18; } }
:root[data-theme="dark"] .theme-btn { background: #261E18; }
@media (max-width: 767px) { .theme-btn .tl { display: none; } .theme-btn { padding: 8px; width: var(--tap); justify-content: center; } }

/* dark-mode switch */
.theme-btn .sw { position: relative; width: 34px; height: 20px; flex: none; border-radius: 10px; background: #D6CCC2; transition: background .15s; }
.theme-btn .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.theme-btn[aria-checked="true"] .sw { background: var(--brand-strong); }
.theme-btn[aria-checked="true"] .sw::after { transform: translateX(14px); }
.switch-row { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 500; color: var(--ink); cursor: pointer; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--brand-strong); }
@media (max-width: 767px) { .theme-btn { width: auto; padding: 8px 10px; } .theme-btn svg.i { display: none; } }
@media (max-width: 767px) { .theme-btn svg.i { display: inline-block; width: 16px; height: 16px; } }  /* phones: moon + switch, no text */
