:root {
  color-scheme: dark;
  --background: #0e121b;
  --surface: #171d29;
  --border: #303a4c;
  --text: #edf2fb;
  --muted: #aab8cf;
  --accent: #a8c5ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); font: 15px/1.55 system-ui, sans-serif; }
main { width: min(100%, 1360px); margin: auto; padding: 28px 26px 48px; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 22px; }
.brand { color: var(--accent); font-size: 13px; font-weight: 700; margin: 0 0 4px; }
h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); }
h2 { font-size: 18px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
p { color: var(--muted); }
.auth { gap: 4px; justify-items: end; }
.auth p { margin: 0; font-size: 13px; text-align: right; }
.auth-controls { display: flex; align-items: center; gap: 8px; }
.auth-controls button { margin: 0; white-space: nowrap; }
.auth-controls input { width: min(260px, 36vw); margin: 0; }
.workspace-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 18px; }
.workspace-nav a { color: var(--muted); text-decoration: none; font-weight: 650; padding: 9px 14px; border-radius: 7px; }
.workspace-nav a:hover { color: var(--text); background: #232e41; }
.workspace-nav a[aria-current] { color: #d5e4ff; background: #243956; box-shadow: inset 0 0 0 1px #47658f; }
.workspace, .panel-grid { display: grid; gap: 16px; }
.panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
input, textarea, select, button { font: inherit; border-radius: 7px; padding: 8px 11px; }
input, textarea, select { background: #101520; color: white; border: 1px solid #465167; width: 100%; margin: 4px 0; }
input[type=checkbox] { width: auto; }
button { background: var(--accent); color: #101520; border: 0; font-weight: 700; cursor: pointer; margin: 6px 6px 6px 0; }
button.secondary { background: #29354a; color: var(--text); }
button:disabled { opacity: .58; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
form { display: grid; gap: 8px; }
form > button { justify-self: start; }
#panel-products form { max-width: 560px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border-bottom: 1px solid #344055; padding: 9px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { color: #c4d5f0; white-space: nowrap; }
.scroll { overflow: auto; }
.confirm-row { display: flex; align-items: center; gap: 10px; }
.confirm-row input { width: auto; margin: 0; }
label { display: block; color: #ced9eb; font-size: 14px; }
[role=status] { overflow-wrap: anywhere; }
@media (max-width: 740px) {
  main { padding: 16px 12px 32px; }
  .masthead { flex-direction: column; align-items: stretch; gap: 12px; }
  .auth { justify-items: start; }
  .auth p { text-align: left; }
  .auth-controls { width: 100%; flex-wrap: wrap; }
  .auth-controls input { flex: 1 1 180px; min-width: 0; }
  .workspace-nav a { padding: 7px 9px; font-size: 14px; }
  .panel-grid { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 14px; }
}

.portal-login { max-width: 480px; padding-top: 8vh; }
.portal-login h1 { margin-bottom: 16px; }

body:has(.portal-layout) {
  color-scheme: light;
  --background: #f1f4f8;
  --surface: #ffffff;
  --border: #e0e6ee;
  --text: #172437;
  --muted: #536478;
  --accent: #d8f1e2;
}
.portal-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100dvh; }
.portal-layout main { padding: 26px clamp(14px, 2.4vw, 34px) 40px; }
.portal-sidebar { background: #111b28; color: #edf3fa; padding: 22px 14px; }
.portal-brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 0 7px; margin-bottom: 24px; }
.portal-brand small, .portal-brand strong { display: block; }
.portal-brand small { color: #a9b6c7; font-size: 12px; }
.portal-mark { border-radius: 9px; padding: 6px 10px; color: #a0efbb; background: #243b3b; font-weight: 750; }
.portal-sidebar .workspace-nav { display: grid; gap: 5px; background: transparent; border: 0; margin: 0; padding: 0; }
.portal-sidebar .workspace-nav a { color: #c4d0de; }
.portal-sidebar .workspace-nav a[aria-current] { color: #b8f4cb; background: #243b3b; box-shadow: none; }
.portal-layout .panel { box-shadow: 0 2px 5px #182c4607; }
.portal-layout th { color: #40576e; }
.portal-layout th, .portal-layout td { border-color: #e2e9f0; }
.portal-layout input, .portal-layout textarea, .portal-layout select { color: var(--text); background: #f8fafc; border-color: #cbd6e2; }
.portal-layout label { color: #314b62; }
.portal-layout button { color: #194a37; }
.portal-layout button.secondary { color: #26364a; background: #e7edf3; }
.portal-layout .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.portal-layout .stat span { color: var(--muted); }
.portal-layout .stat strong { display: block; font-size: 28px; margin-top: 4px; }
.portal-layout .panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.portal-layout .panel-heading a { color: #176341; }
@media (max-width: 860px) {
  .portal-layout { grid-template-columns: minmax(0, 1fr); }
  .portal-sidebar { padding: 14px; }
  .portal-brand { margin-bottom: 8px; }
  .portal-sidebar .workspace-nav { display: flex; }
  .portal-layout .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Keep the original operator sample layout and controls. */
:root {
  --bg: #f1f4f8;
  --panel: #fff;
  --line: #e0e6ee;
  --color: #172437;
  --muted: #536478;
  --nav: #111b28;
  --mint: #93efb6;
  --brand: #176341;
  --green: #e4f7ea;
  color: var(--color);
  font-family: "PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  line-height: 1.5;
}
a {
  color: inherit;
  text-decoration: none;
}
button,input,select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible {
  outline: 2px solid #43866a;
  outline-offset: 3px;
}
.layout {
  display: grid;
  grid-template-columns: 222px minmax(0,1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--nav);
  color: #e9f0f7;
  padding: 24px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 0 6px;
}
.brand strong,.brand span {
  display: block;
}
.brand strong {
  font-size: 1rem;
}
.brand span {
  font-size: .81rem;
  color: #a9b6c7;
  margin-top: 1px;
}
.mark {
  width: 34px;
  height: 34px;
  display: grid;
  grid-template-columns: repeat(2,6px);
  grid-template-rows: repeat(2,6px);
  place-content: center;
  gap: 3px;
  background: #243b3b;
  border: 1px solid #456869;
  border-radius: 9px;
}
.mark i {
  border-radius: 1px;
  background: #a0efbb;
}
.mark i:last-child {
  background: #6cb18e;
}
.sidebar nav {
  display: grid;
  gap: 4px;
}
.sidebar nav button {
  padding: 10px 12px;
  color: #bcc8d7;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  font-size: .93rem;
  display: flex;
  gap: 11px;
  align-items: center;
  white-space: nowrap;
}
.sidebar nav button span {
  color: #9caec1;
  width: 18px;
  text-align: center;
  font-size: 1rem;
}
.sidebar nav button[aria-current="page"] {
  background: #243648;
  color: #f4fbff;
  border-color: #40566b;
}
.sidebar nav button[aria-current="page"] span {
  color: var(--mint);
}
.sidebar nav button:hover {
  background: #243648;
}
.back {
  border: 1px solid #44566a;
  border-radius: 8px;
  padding: 8px 11px;
  text-align: center;
  margin-top: auto;
  color: #dbe7f4;
  font-size: .89rem;
}
.back:hover {
  border-color: var(--mint);
}
.side-note {
  color: #a5b4c5;
  font-size: .79rem;
  padding-inline: 6px;
  margin: -12px 0 0;
}
.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: .94rem;
  font-weight: 670;
}
.demo-tag {
  padding: 3px 9px;
  border-radius: 5px;
  background: #e9f6ed;
  color: #205e42;
  font-size: .81rem;
}
.content {
  max-width: 1295px;
  margin: auto;
  padding: 27px 28px 32px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 15px;
  margin: 0 0 22px;
}
.page-head h1 {
  font-weight: 750;
  letter-spacing: -.045em;
  font-size: 2.04rem;
  margin: 0;
}
.page-head p {
  color: var(--muted);
  margin: 5px 0 0;
}
.primary,.secondary,.row-action {
  border-radius: 7px;
  padding: 8px 12px;
  min-height: 40px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-weight: 640;
  font-size: .9rem;
}
.primary {
  color: #fff;
  background: #1b6848;
}
.primary:hover {
  background: #145338;
}
.secondary {
  background: #fff;
  color: #344758;
  border-color: #cad4df;
}
.secondary:hover {
  border-color: #75938b;
  background: #f5faf7;
}
.button-link {
  display: inline-flex;
  align-items: center;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 12px;
  margin-bottom: 17px;
}
.stat {
  padding: 14px 16px;
  min-width: 0;
}
.stat>span {
  font-size: .9rem;
  color: var(--muted);
}
.stat>strong {
  display: block;
  font-size: 2.1rem;
  letter-spacing: -.055em;
  line-height: 1.25;
  margin-top: 6px;
}
.stat small {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 500;
  margin-left: 6px;
  letter-spacing: 0;
}
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}
.card-heading h2 {
  margin: 0;
  font-size: 1.08rem;
}
.link-action {
  border: 0;
  background: transparent;
  color: #236448;
  padding: 4px 0;
  font-size: .89rem;
}
.link-action:hover {
  text-decoration: underline;
}
.pool-card {
  margin-bottom: 17px;
}
.pools {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 10px;
  padding: 0 16px 16px;
}
.pool {
  padding: 10px 12px;
  border: 1px solid #e3ebe7;
  background: #f7faf8;
  border-radius: 8px;
  min-width: 0;
}
.pool>div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.pool>span {
  color: var(--muted);
  font-size: .85rem;
  display: block;
  margin: 2px 0;
}
.pool meter {
  width: 100%;
  height: 9px;
  accent-color: #4ea17a;
}
.pool meter::-webkit-meter-optimum-value {
  background: #559a76;
}
.pool meter::-webkit-meter-bar {
  background: #e4ede8;
  border: 0;
}
code,.mono {
  font-family: ui-monospace,monospace;
  font-size: .85rem;
}
code {
  color: #245c46;
}
.table-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: .93rem;
}
th,td {
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-size: .87rem;
  color: #43536a;
  background: #f7f9fc;
  font-weight: 650;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.empty {
  padding-block: 22px;
  text-align: center;
  color: var(--muted);
}
.status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .82rem;
  background: #e9edf3;
  color: #3c5269;
  white-space: nowrap;
}
.status.delivered,.status.available {
  background: #e2f6e9;
  color: #1f6545;
}
.status.waiting,.status.unassigned {
  background: #fff1d9;
  color: #6c4709;
}
.status.pending {
  background: #e8effb;
  color: #304f82;
}
.filters {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 15px;
}
.filters form,.filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .9rem;
}
.filters input,.filters select {
  min-height: 40px;
  border: 1px solid #cad4df;
  border-radius: 7px;
  background: #fff;
  color: var(--color);
  padding: 7px 9px;
}
.filters input {
  width: min(240px,49vw);
}
.filters select {
  appearance: none;
  padding-right: 28px;
  background-image: linear-gradient(45deg,transparent 50%,#516275 50%),linear-gradient(135deg,#516275 50%,transparent 50%);
  background-position: calc(100% - 13px) 17px,calc(100% - 8px) 17px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.row-action {
  border: 1px solid #b9d8c6;
  background: #f4fbf6;
  min-height: 34px;
  padding: 4px 9px;
  color: #236448;
}
.row-action:hover {
  background: #e2f6e9;
}
.toast:not(:empty) {
  position: fixed;
  bottom: 14px;
  right: 14px;
  background: #182c27;
  color: #eff9f3;
  border-radius: 8px;
  padding: 10px 13px;
  box-shadow: 0 6px 15px #15293b32;
}
@media(max-width:900px) {
  .layout {
    grid-template-columns: 175px minmax(0,1fr);
  }
  .sidebar {
    padding-inline: 11px;
  }
  .stats {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .content {
    padding: 21px 19px;
  }
  .topline {
    padding-inline: 19px;
  }
}
@media(max-width:640px) {
  .layout {
    display: block;
    min-height: 100vh;
  }
  .sidebar {
    padding: 11px 12px 8px;
    gap: 10px;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
  }
  .brand {
    padding: 0;
  }
  .sidebar nav {
    grid-column: 1/-1;
    grid-row: 2;
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
  }
  .sidebar nav button {
    padding: 6px 5px;
    flex: 1;
    justify-content: center;
    min-height: 40px;
    font-size: .84rem;
  }
  .sidebar nav button span,.side-note {
    display: none;
  }
  .back {
    grid-column: 2;
    grid-row: 1;
    margin: auto 0;
    font-size: .79rem;
    padding: 6px 8px;
  }
  .topline {
    min-height: 44px;
    padding-inline: 13px;
    font-size: .88rem;
  }
  .content {
    padding: 13px;
  }
  .page-head {
    margin-bottom: 15px;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .page-head h1 {
    font-size: 1.55rem;
  }
  .page-head p {
    font-size: .91rem;
  }
  .stat {
    padding: 11px;
  }
  .stat>strong {
    font-size: 1.65rem;
  }
  .pools {
    grid-template-columns: 1fr;
  }
  .filters {
    gap: 9px;
  }
  .filters input {
    width: min(175px,52vw);
  }
  th,td {
    padding: 9px 11px;
  }
}
body { color-scheme: light; color: #172437; background: #f1f4f8; }
.layout main { width: auto; min-width: 0; margin: 0; padding: 0; }
.layout p, .layout label { color: #536478; }
.layout input, .layout select, .layout textarea { background: #f8fafc; border-color: #cbd6e2; color: #172437; }
.layout .panel { color: #172437; background: white; border-color: #e0e6ee; }
.layout th, .layout td { color: #172437; border-color: #e0e6ee; }
.topline .auth { display: flex; flex-wrap: wrap; align-items: center; }
.topline .auth p { margin: 0; }
.operator-extra { margin-top: 14px; }
.operator-extra summary { cursor: pointer; font-weight: 700; }
.operator-extra[open] summary { margin-bottom: 14px; }
.operator-extra .panel-grid { margin-bottom: 12px; }
#operator-dialog { width: min(520px, calc(100vw - 24px)); max-height: 85vh; overflow: auto; color: #172437; background: white; }
#operator-dialog::backdrop { background: #15203099; }
#operator-dialog-content { overflow-wrap: anywhere; }
#operator-dialog .table-scroll { margin-bottom: 10px; }
#operator-dialog-content { white-space: pre-wrap; }
