:root {
  font:16px system-ui,-apple-system,Segoe UI,sans-serif;
  color:#173b2a;
  background:#f5f8f4}
* {
  box-sizing:border-box}
body {
  margin:0}
button,input,select,textarea {
  font:inherit}
button {
  cursor:pointer}
header {
  background:#176b46;
  color:white;
  padding:22px max(20px,calc((100vw - 1160px)/2))}
header h1 {
  margin:0;
  font-size:27px}
header p {
  margin:5px 0;
  color:#d8efdf}
main {
  max-width:1160px;
  margin:auto;
  padding:24px 18px 60px}
.toolbar,.row,.summary {
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap}
.toolbar {
  justify-content:space-between;
  margin-bottom:20px}
.btn {
  border:0;
  border-radius:10px;
  background:#176b46;
  color:white;
  padding:10px 15px;
  font-weight:700}
.btn.secondary {
  background:#e4efe8;
  color:#176b46}
.btn.danger {
  background:#fff0ed;
  color:#a63223}
.btn:disabled {
  opacity:.5;
  cursor:not-allowed}
.panel {
  background:#fff;
  border:1px solid #e0ebe2;
  border-radius:16px;
  padding:20px;
  margin:16px 0;
  box-shadow:0 2px 12px #173b2a08}
.panel h2 {
  margin:0 0 12px;
  font-size:21px}
.summary>div {
  background:#eaf4ec;
  border-radius:12px;
  padding:14px;
  min-width:150px}
.summary strong {
  display:block;
  font-size:23px}
.grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(210px,1fr));
  gap:12px}
.field {
  display:flex;
  flex-direction:column;
  gap:5px}
.field span {
  font-size:13px;
  font-weight:700;
  color:#456250}
input,select,textarea {
  width:100%;
  border:1px solid #b9cec0;
  background:white;
  color:#173b2a;
  border-radius:9px;
  padding:10px}
input:focus,select:focus,textarea:focus {
  outline:2px solid #176b46;
  outline-offset:1px}
input[type=checkbox] {
  width:auto}
textarea {
  min-height:70px}
.hint {
  color:#5e7565;
  font-size:14px;
  line-height:1.5}
.alert {
  background:#fff3dc;
  color:#704b12;
  padding:13px;
  border-radius:10px}
.error {
  background:#ffe9e6;
  color:#8a231c;
  padding:13px;
  border-radius:10px}
.good {
  background:#e5f5e9;
  color:#176b46;
  padding:13px;
  border-radius:10px}
.category-row {
  padding:9px 0;
  border-bottom:1px solid #e1ece4}
.category-row input {
  flex:1;
  min-width:180px}
.product {
  border:1px solid #e1ece4;
  border-radius:12px;
  padding:14px;
  margin:10px 0}
.producthead {
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center}
.producthead h3 {
  margin:0 0 10px}
.product .grid {
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
.product .wide {
  grid-column:1/-1}
#message {
  margin:12px 0}
footer {
  color:#65796b;
  text-align:center;
  padding:22px}
a {
  color:#176b46}
header a {
  color:white}
@media(max-width:600px) {
  .toolbar .row {
  width:100%}
.toolbar button {
  flex:1}
}


:root {
  color:#18364d;
  background:#f1f6fb;
  --accent:#126dba;
  --line:#d9e5ef}
body {
  line-height:1.55}
header {
  background:#fff;
  color:#18364d;
  border-bottom:1px solid var(--line);
  padding:24px max(20px,calc((100vw - 1160px)/2))}
header p {
  color:#60788b}
header a {
  color:var(--accent)}
main {
  max-width:1160px}
.workspace-nav {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:20px 0}
.workspace-nav a {
  display:inline-flex;
  align-items:center;
  padding:10px 15px;
  border:1px solid var(--line);
  border-radius:10px;
  background:white;
  color:#28536f;
  text-decoration:none;
  font-weight:650}
.workspace-nav a[aria-current=page] {
  background:#126dba;
  color:white;
  border-color:#126dba}
.workspace-nav a:hover {
  box-shadow:0 3px 12px #18364d15}
.btn,button,.action-link {
  background:#126dba;
  min-height:44px}
.btn.secondary,.detail-button {
  background:#e8f2fc;
  color:#155a95}
.btn.danger {
  background:#fff0ed;
  color:#a63223}
.panel {
  border-color:var(--line);
  box-shadow:0 6px 24px #18364d07}
.panel h2 {
  font-size:22px}
.summary {
  gap:14px}
.summary>div {
  background:#fff;
  border:1px solid var(--line);
  padding:20px;
  flex:1}
.summary strong {
  color:#126dba;
  font-size:30px}
input,select,textarea {
  color:#18364d;
  border-color:#b5c9db}
select {
  font:inherit;
  border-radius:9px;
  padding:10px;
  background:white}
a {
  color:#126dba}
button:focus-visible,a:focus-visible,summary:focus-visible {
  outline:3px solid #70b9ef;
  outline-offset:3px}
button:hover:not(:disabled) {
  filter:brightness(.95)}
.product,.order {
  border-color:var(--line);
  padding:20px;
  background:#fff}
.product h3,.order h4 {
  color:#18364d}
.hint,.note {
  color:#587084}
.guide {
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  margin:18px 0;
  padding:18px 22px}
.guide summary {
  font-weight:750;
  color:#155a95;
  cursor:pointer;
  min-height:28px}
.guide-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:16px;
  margin-top:18px}
.guide-grid article {
  padding:16px;
  background:#f3f8fd;
  border-radius:12px}
.guide h3 {
  margin:0 0 10px;
  font-size:17px}
.guide li {
  margin:9px 0}
.guide ol {
  padding-left:22px}
.section-nav {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:18px 0}
.section-nav a {
  padding:8px 13px;
  background:#e8f2fc;
  border-radius:8px;
  text-decoration:none}
.section-nav a:hover {
  background:#d4e8fb}
section,details {
  scroll-margin-top:20px}
.order-actions {
  display:flex;
  flex-wrap:wrap;
  gap:8px}
.order-tools {
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:end;
  margin:20px 0}
.order-tools label {
  flex:1;
  min-width:180px}
#message:empty {
  display:none}
[hidden] {
  display:none!important}
dialog::backdrop {
  background:#18364d80}
@media(max-width:600px) {
  main {
  padding:18px 14px 40px}
.panel {
  padding:16px}
.workspace-nav a {
  flex:1;
  justify-content:center}
.producthead {
  align-items:flex-start}
.product .grid {
  grid-template-columns:1fr}
.toolbar button {
  font-size:14px}
.guide {
  padding:16px}
.order-tools label {
  width:100%}
}

.grid-scroll { overflow-x:auto; margin-top:18px; border:1px solid var(--line); border-radius:10px; }
.product-grid { width:100%; border-collapse:collapse; font-size:14px; }
.product-grid caption { text-align:left; padding:12px; font-weight:700; background:#e8f2fc; }
.product-grid th,.product-grid td { padding:12px; text-align:left; border-bottom:1px solid var(--line); vertical-align:middle; }
.product-grid thead { background:#f1f6fb; }
.product-grid tbody tr:nth-child(even) { background:#f7faff; }
.product-grid tbody tr:hover { background:#eaf4ff; }
.product-grid td:last-child { min-width:190px; }
.sort-button { background:transparent; color:#18364d; border:0; padding:0; font-weight:700; white-space:nowrap; }
.record-dialog { border:0; border-radius:16px; padding:24px; width: min(760px,calc(100% - 28px)); max-height:90vh; overflow-y:auto; color:#18364d; }
.field-error,#adminError,#productFormMessage { color:#9b251d; }
.field-error:empty,#adminError:empty,#productFormMessage:empty { display:none; }
[aria-invalid=true] { border:2px solid #b62b24; }
.record-dialog .wide { grid-column:1/-1; }

#products,#ordersList { max-height: min(650px,70vh); overflow:auto; scrollbar-gutter:stable; overscroll-behavior:contain; padding:8px; border:1px solid var(--line); border-radius:12px; background:#f4f8fc; }
#products { margin-top:16px; }
.product-grid thead { position:sticky; top:0; z-index:1; }
#ordersControls { align-items:end; padding:18px; background:#f1f6fb; border-radius:12px; margin-bottom:16px; }
#ordersSearch,#orderDashboard { width:100%; }
.order-card { border:1px solid #d9e5ef; border-radius:12px; background:white; margin:8px 0; overflow:hidden; }
.order-card-heading { display:grid; grid-template-columns:1fr auto; gap:6px 16px; padding:16px 20px; cursor:pointer; list-style:inside; }
.order-card-heading:hover { background:#eaf4ff; }
.order-customer { font-size:17px; font-weight:750; }
.order-amount { font-size:19px; font-weight:750; color:#126dba; }
.order-reference { font-size:12px; color:#587084; overflow-wrap:anywhere; }
.order-status { justify-self:end; border-radius:20px; background:#e8f2fc; padding:3px 12px; font-size:12px; font-weight:750; }
.order-status.new { color:#945000; background:#fff1cf; }
.order-status.delivered { color:#186c40; background:#def5e6; }
.order-status.cancelled { color:#9b251d; background:#ffebe8; }
.order-card-body { border-top:1px solid #d9e5ef; padding:18px 20px; }
.order-card-body p { margin:8px 0; }
.order-items { background:#f1f6fb; padding:14px; border-radius:9px; }
.order-card[open] .order-card-heading { background:#eaf4ff; }
#ordersCount { font-weight:700; }

/* Sensitive records remain hidden unless a valid administrator session is active. */
#recordsPanel .records-scroll{overflow:auto;max-height:min(70vh,660px);min-height:90px}
#recordsPanel .product-grid{min-width:780px}
#recordsPanel .product-grid thead{position:sticky;top:0;background:#eef5fb;z-index:1}
#recordsPanel .product-grid button{margin:2px;white-space:nowrap;font-size:12px}
#recordsPanel #recordsControls .row{align-items:end}
#recordsPanel #recordsSearch{min-width:220px;width:min(100%,330px)}
#recordsPanel .records-paging{margin-top:12px;justify-content:center;align-items:center;gap:16px}
#recordsPanel .records-detail{padding:18px;border:1px solid #d7e5f1;border-radius:12px;background:#fff;margin-top:16px}
#recordsPanel .records-detail[hidden]{display:none!important}
#recordsPanel .records-detail ul{margin:8px 0 16px;padding-left:22px;line-height:1.7;overflow-wrap:anywhere}
#recordsPanel .records-detail h3,#recordsPanel .records-detail h4{margin:12px 0 6px}
@media(max-width:640px){#recordsPanel #recordsSearch{width:100%}#recordsPanel .records-paging{flex-wrap:wrap}}

/* Operations Desk V1 — live workspace, independent of legacy admin panels */
.ops-workspace{background:linear-gradient(130deg,#f2f9ff,#f8fcfa);border:1px solid #d3e4ef;border-radius:22px;padding:22px;margin:0 0 28px;box-shadow:0 10px 35px #123d5920;scroll-margin-top:18px;color:#193447}
.ops-heading,.ops-top-actions,.ops-tools,.ops-actions,.ops-paging{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.ops-heading h2{font-size:clamp(25px,3vw,36px);margin:4px 0 6px;letter-spacing:-.8px;color:#153c53}
.ops-kicker{margin:0;font-size:11px;letter-spacing:1.8px;color:#176b46;font-weight:900}
.ops-muted{font-size:12px;color:#667887;line-height:1.5}
.ops-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin:19px 0}
.ops-kpi{border:1px solid #d8e7ef;background:white;border-radius:14px;padding:13px;text-align:left;display:flex;flex-direction:column;gap:7px;min-width:0;color:#36546a}
.ops-kpi span{font-size:12px;font-weight:650}
.ops-kpi strong{font-size:clamp(18px,2vw,26px);color:#173d52}
.ops-kpi[data-active=true]{border-color:#298761;background:#e8f6ef;box-shadow:0 0 0 1px #29876144}
.ops-kpi:focus-visible,.ops-order:focus-visible{outline:3px solid #247a5e;outline-offset:2px}
.ops-layout{display:grid;grid-template-columns:minmax(275px,.92fr) minmax(0,1.5fr);gap:14px;align-items:start}
.ops-list-column,.ops-detail-column{border:1px solid #d9e6ed;background:#fff;border-radius:18px;min-width:0;overflow:hidden}
.ops-list-top,.ops-detail-heading{padding:15px 17px;border-bottom:1px solid #e5edf1}
.ops-list-top h3,.ops-detail-heading h3{margin:0 0 12px;font-size:17px}
.ops-search-label input{width:100%;margin-bottom:8px}
.ops-filter-line{display:flex;align-items:center;gap:9px}
.ops-filter-line select{flex:1;min-width:0}
.ops-list-top .ops-muted{margin:8px 0 0}
.ops-queue-list{max-height:min(67vh,720px);overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;min-height:170px;padding:8px}
.ops-order{width:100%;display:flex;flex-direction:column;gap:5px;text-align:left;background:#fff;color:#24435a;border:1px solid #e5edf0;border-radius:12px;padding:11px;margin-bottom:7px}
.ops-order:hover{background:#f2fafc}
.ops-order[data-current=true]{border-color:#2c9564;background:#ecf8f0}
.ops-order-head{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:13px}
.ops-stage{font-size:12px}
.ops-attention{align-self:flex-start;border-radius:20px;background:#fff0d8;color:#75501c;padding:4px 9px;font-size:11px}
.ops-empty{padding:20px;color:#70818a}
.ops-paging{padding:12px;border-top:1px solid #e5edf1}
.ops-detail-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.ops-detail-heading h3{margin:0}
.ops-detail{padding:13px;max-height:min(78vh,900px);overflow-y:auto;overscroll-behavior:contain}
.ops-detail-block{border:1px solid #e1eaf0;padding:15px;border-radius:14px;margin-bottom:11px;background:#fff}
.ops-detail-block h4{margin:0 0 12px;font-size:15px;color:#176b46}
.ops-pair{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin:6px 0;font-size:13px}
.ops-pair>span{color:#687b85;flex:0 0 31%}
.ops-pair>strong{flex:1;text-align:right;overflow-wrap:anywhere;font-size:13px}
.ops-items{padding:0 0 0 18px;font-size:13px;line-height:1.6}
.ops-actions{justify-content:flex-start;margin-top:13px}
.ops-actions a{font-size:13px;color:#176b46}
#opsMessage{padding:0 14px 10px;font-size:13px}
.ops-error{color:#a82b27}.ops-success{color:#176b46}
.ops-tools{justify-content:flex-start;margin-top:14px;font-size:12px}
.ops-tools a{color:#176b46}
.sr-only{position:absolute;clip:rect(0,0,0,0);width:1px;height:1px;overflow:hidden;white-space:nowrap}
@media(min-width:1500px){main{max-width:1480px}.ops-layout{grid-template-columns:minmax(320px,.8fr) minmax(0,1.6fr)}}
@media(max-width:850px){.ops-layout{grid-template-columns:1fr}.ops-detail{max-height:none}.ops-queue-list{max-height:360px}.ops-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:540px){.ops-workspace{padding:12px;border-radius:13px}.ops-kpi{padding:9px}.ops-top-actions{justify-content:flex-start}.ops-list-top,.ops-detail-heading{padding:12px}.ops-pair{display:block}.ops-pair>span,.ops-pair>strong{display:block;text-align:left;margin-bottom:2px}.ops-actions button{width:100%}}
@media(prefers-reduced-motion:reduce){.ops-order,.ops-kpi{scroll-behavior:auto}}

/* Operations Desk: always-accessible, collapsible operator instructions */
.ops-guide{border:1px solid #c9dfeb;border-radius:15px;background:#fff;margin:16px 0;box-shadow:0 3px 12px #133e5410;scroll-margin-top:12px}
.ops-guide>summary{display:flex;align-items:center;gap:12px;cursor:pointer;list-style:none;padding:13px 17px;color:#1d4357}
.ops-guide>summary::-webkit-details-marker{display:none}
.ops-guide>summary:focus-visible{outline:3px solid #237f59;outline-offset:3px;border-radius:14px}
.ops-guide-icon{display:grid;place-items:center;flex-shrink:0;background:#dceffb;color:#176b46;font-weight:900;border-radius:50%;width:32px;height:32px;font-size:18px}
.ops-guide>summary>span:nth-child(2){display:grid;gap:3px;flex:1}
.ops-guide>summary strong{font-size:16px}
.ops-guide>summary small{color:#667d8a;font-size:12px;line-height:1.4}
.ops-guide-chevron{color:#176b46;font-size:19px;transition:transform .16s ease}
.ops-guide[open] .ops-guide-chevron{transform:rotate(180deg)}
.ops-guide-content{border-top:1px solid #e0ebf2;padding:18px}
.ops-guide-content h3{color:#176b46;font-size:15px;margin:13px 0 12px}
.ops-guide-intro{background:#f0f7fc;border-radius:10px;padding:12px;margin:0 0 17px;font-size:13px;line-height:1.65}
.ops-guide-steps{list-style:none;counter-reset:ops-step;padding:0;margin:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.ops-guide-steps>li{counter-increment:ops-step;position:relative;padding:14px 13px 14px 51px;border-radius:12px;border:1px solid #e0eaf0;background:#fbfdfe;min-width:0;display:flex;flex-direction:column;gap:7px}
.ops-guide-steps>li:before{content:counter(ops-step);position:absolute;left:12px;top:13px;display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#dff2e6;color:#176b46;font-weight:900}
.ops-guide-steps>li>strong{font-size:14px;color:#234b5c}
.ops-guide-steps>li>span:not(.ops-guide-hi){font-size:12.5px;line-height:1.6;color:#526f7c}
.ops-guide-steps>li>span.ops-guide-hi{color:#47745a;font-size:12px}
.ops-guide-action-row{display:flex;gap:6px;flex-wrap:wrap}
.ops-guide-action{align-self:flex-start;margin-top:auto;cursor:pointer;border:1px solid #b7d8c5;background:#e7f4ed;color:#176b46;font-weight:800;font-size:12px;border-radius:9px;padding:8px 11px}
.ops-guide-action:hover{background:#d8f0e1}
.ops-guide-action:focus-visible{outline:3px solid #237f59;outline-offset:2px}
.ops-guide-bottom{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:14px}
.ops-guide-bottom section{padding:14px;border-radius:12px;background:#f0f6fb}
.ops-guide-bottom h3{margin:0 0 10px}
.ops-guide-bottom p{margin:0;font-size:12.5px;line-height:1.7;color:#3b5766}
.ops-guide-note{margin:15px 0 0;border-left:3px solid #176b46;padding:6px 10px;color:#526d7e;font-size:12px;line-height:1.6}
@media(max-width:720px){.ops-guide-steps,.ops-guide-bottom{grid-template-columns:1fr}.ops-guide-content{padding:12px}}
@media(prefers-reduced-motion:reduce){.ops-guide-chevron{transition:none}}
/* Authenticated server media library for product and category photographs. */
.media-panel{border:1px solid #c5deeb;background:linear-gradient(160deg,#f2f9ff,#fff)}
.media-upload-row{display:flex;align-items:end;gap:12px;flex-wrap:wrap;margin:14px 0}
.media-upload-row .field{flex:1;min-width:185px}
.media-upload-row input[type=file]{max-width:100%;padding:10px 7px}
.media-upload-preview{width:72px;height:72px;object-fit:cover;border:1px solid #b2cee0;border-radius:10px}
.media-upload-preview[hidden]{display:none!important}
#mediaStatus{margin:12px 0;padding:9px 12px;background:#eaf4ff;border-radius:9px;overflow-wrap:anywhere}
#mediaStatus[data-status=error]{color:#962d20;background:#fff0ed}
.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px;margin:15px 0}
.media-card{display:flex;min-width:0;flex-direction:column;gap:7px;padding:10px;background:white;border:1px solid #d6e7f0;border-radius:12px}
.media-card>img{width:100%;height:118px;object-fit:cover;border-radius:9px;background:#eff6fb}
.media-card small{font-size:10px;overflow-wrap:anywhere;color:#678}
.media-card .row{margin-top:auto;gap:6px;flex-wrap:wrap}
.media-card button{padding:7px 9px;font-size:11px}
.media-category-thumb{width:55px;height:55px;object-fit:cover;flex-shrink:0;border-radius:10px;background:#e4eff9;border:1px solid #d3e2ec}
.media-placeholder{position:relative}
.media-choose{font-size:12px}
.media-inline-preview{display:block;max-width:100%;width:120px;height:95px;object-fit:contain;border:1px solid #d3e5ee;border-radius:9px;padding:5px}
.media-inline-preview[hidden]{display:none!important}
.media-picker-dialog{max-width:min(960px,calc(100vw - 30px));width:900px;max-height:90vh}
.media-picker-dialog .media-grid{max-height:62vh;overflow:auto}
@media(max-width:600px){.media-upload-row{align-items:stretch}.media-upload-row .field{flex-basis:100%}.media-card>img{height:105px}.media-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.category-row{flex-wrap:wrap}}
