:root {
  --bg: #eef2f4;
  --ink: #12202c;
  --muted: #667888;
  --card: #ffffff;
  --line: #dce4ea;
  --accent: #0e7a72;
  --accent-2: #14607a;
  --ok: #1b7a54;
  --err: #c0392b;
  --nav: #10181f;
  --nav-text: #c5d0d8;
  --shadow: 0 10px 30px rgba(16, 32, 48, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", sans-serif;
  background: var(--bg);
}

.admin-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 50% 30% at 80% 0%, rgba(14, 122, 114, 0.08), transparent 50%),
    var(--bg);
}

.admin-shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px;
  background: var(--nav);
  color: #fff;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
}

.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-family: "Syne", "Noto Sans SC", sans-serif;
  font-weight: 800;
}

.nav-brand .eyebrow {
  color: #7f93a1;
  letter-spacing: 0.12em;
}

.nav-brand strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 700;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--nav-text);
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.on {
  background: rgba(14, 122, 114, 0.28);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-foot {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.nav-foot .btn.ghost,
.nav-foot .btn.link {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--nav-text);
}

.admin-main {
  min-width: 0;
  width: 100%;
  max-width: 1280px;
  padding: 28px 32px 56px;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.admin-top h1 {
  margin: 2px 0 6px;
  font-size: 26px;
}

.agent-banner {
  max-width: 280px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.pane {
  display: none;
}

.pane.on {
  display: block;
}

.panel {
  margin-top: 16px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

h1 {
  margin: 4px 0 8px;
  font-family: "Syne", "Noto Sans SC", sans-serif;
  font-size: 28px;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sub,
.hint {
  color: var(--muted);
  line-height: 1.5;
}

.hint {
  margin: 0 0 12px;
  font-size: 13px;
}

select,
input[type="password"],
input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
}

select:focus,
input:focus {
  outline: 2px solid rgba(14, 122, 114, 0.25);
  border-color: var(--accent);
}

.url-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.9;
}

.url-list a {
  color: var(--accent);
  word-break: break-all;
}

.job-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.job-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fafb;
  color: var(--ink);
  line-height: 1.5;
}

.preset {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
}

.preset-head {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.preset-head input {
  flex: 1;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.printer-picks {
  grid-column: 1 / -1;
}

.printer-picks > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.printer-picks .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 10px 8px 0;
  font-size: 13px;
}

.preset-grid label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

#colorList > .preset strong {
  display: block;
  margin-bottom: 4px;
}

.match {
  margin: 0 0 10px;
  color: var(--ok) !important;
}

.color-guide {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.color-guide summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--accent);
  list-style: none;
}

.color-guide summary::-webkit-details-marker {
  display: none;
}

.color-guide[open] summary {
  margin-bottom: 8px;
}

.color-guide p,
.color-guide li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.color-guide .wheel {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
}

.color-guide table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
}

.color-guide th,
.color-guide td {
  border-bottom: 1px solid var(--line);
  padding: 7px 6px;
  text-align: left;
  vertical-align: top;
}

.color-guide th {
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
}

.color-guide ol {
  margin: 0;
  padding-left: 18px;
}

.tone span {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
}

.tone em {
  font-style: normal;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tone input[type="range"] {
  accent-color: var(--accent);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.btn.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn.danger {
  color: var(--err);
}

.btn.link {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.status {
  min-height: 22px;
  margin-top: 12px;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--err);
}

.hold-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 22, 34, 0.72);
}

.hold-mask.hidden {
  display: none;
}

.hold-card {
  width: min(440px, 100%);
  padding: 28px 24px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.hold-kicker {
  margin: 0 0 8px;
  color: var(--err);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.hold-card h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.hold-text {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.55;
}

.hold-card .btn {
  width: 100%;
  margin-top: 8px;
}

.station-enable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
}

.station-groups {
  display: grid;
  gap: 12px;
  margin: 8px 0 14px;
}

.station-group-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
}

.station-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.station-picks .check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
}

.station-qr {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 12px 16px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.station-qr img {
  width: 148px;
  height: 148px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.station-qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.station-qr .hint {
  grid-column: 2;
  word-break: break-all;
}

.terminal-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background: #f4f8f8;
  border: 1px solid var(--line);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa8b3;
  flex-shrink: 0;
}

.dot.on {
  background: #2bb673;
  box-shadow: 0 0 0 4px rgba(43, 182, 115, 0.16);
}

.terminal-card strong {
  display: block;
  font-size: 16px;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats-bar div {
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
  text-align: center;
}

.stats-bar strong {
  display: block;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.stats-bar span {
  color: var(--muted);
  font-size: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.product-group {
  margin-top: 8px;
}

.product-group h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.product-table {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.product-tr {
  display: grid;
  grid-template-columns: 200px 96px 72px minmax(160px, 1fr) 56px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}

.product-tr.head {
  border-top: 0;
  background: #f4f7f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-tr input[type="text"],
.product-tr input[type="number"] {
  min-height: 36px;
  padding: 6px 8px;
  font-size: 13px;
}

.printer-picks.compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0;
}

.printer-picks.compact .check {
  margin: 0;
  font-size: 12px;
}

.product-tr .switch {
  justify-content: center;
}

.span-2 {
  grid-column: 1 / -1;
}

.device-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fafb;
}

.device-head {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  align-items: end;
}

.field span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.device-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 50% at 20% 0%, rgba(14, 122, 114, 0.2), transparent 55%),
    linear-gradient(165deg, #10181f, #16343c);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
  font-size: 24px;
}

form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.admin {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

@media (min-width: 1100px) {
  #printerTable,
  #stationList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }

  #printerTable .device-card,
  #stationList .preset,
  #stationList > .hint {
    margin-top: 0;
  }

  #colorList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }

  #colorList .color-guide {
    grid-column: 1 / -1;
  }

  #colorList > .preset {
    margin-top: 0;
  }

  #productList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    align-items: start;
  }

  #productList .product-group:has(.product-tr:nth-child(n + 5)) {
    grid-column: 1 / -1;
  }

  .shop-form {
    max-width: 720px;
  }

  .admin-table {
    max-width: 980px;
  }
}

@media (min-width: 1480px) {
  .admin-main {
    max-width: 1440px;
    padding-right: 48px;
  }

  #printerTable {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    position: sticky;
    top: 0;
    z-index: 8;
    gap: 10px;
    padding: 12px 14px;
  }

  .nav-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .nav-item.on {
    box-shadow: none;
    background: var(--accent);
  }

  .nav-foot {
    margin-top: 0;
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }

  .admin-main {
    padding: 16px 14px 40px;
  }

  .admin-top {
    flex-direction: column;
  }

  .agent-banner {
    max-width: none;
  }

  .device-head {
    grid-template-columns: 16px 1fr;
  }

  .device-head .switch {
    grid-column: 2;
  }

  .station-qr {
    grid-template-columns: 1fr;
  }

  .station-qr .hint {
    grid-column: 1;
  }

  .stats-bar,
  .preset-grid {
    grid-template-columns: 1fr;
  }

  .product-tr,
  .product-tr.head {
    grid-template-columns: 1fr 1fr;
  }

  .product-tr.head {
    display: none;
  }

  .product-tr input:nth-child(1) {
    grid-column: 1 / -1;
  }

  .product-tr .printer-picks {
    grid-column: 1 / -1;
  }
}
