:root {
  --bg: #eef2ed;
  --panel: #ffffff;
  --ink: #18211c;
  --muted: #647067;
  --line: #dce4dd;
  --soft: #f8faf7;
  --accent: #0d8f6b;
  --accent-dark: #06664c;
  --blue: #236a8f;
  --amber: #b06b16;
  --green: #2f7c45;
  --warn: #a6641a;
  --ok: #2d7c45;
  --error: #9b2c2c;
  --sidebar-bg: #17231c;
  --sidebar-bg-2: #20251f;
  --sidebar-text: #e7eee8;
  --sidebar-muted: #b8c5ba;
  --sidebar-active-bg: #29372f;
  --sidebar-active-text: #ffffff;
  --brand-mark-bg: #102f26;
  --brand-mark-text: #d8fff0;
  --shadow: 0 18px 48px rgba(29, 44, 35, 0.10);
  --shadow-small: 0 8px 22px rgba(29, 44, 35, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 280px),
    var(--bg);
  color: var(--ink);
  font: 14px/1.45 Arial, Helvetica, sans-serif;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 55%, var(--sidebar-bg) 100%);
  color: var(--sidebar-text);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}

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

.brand.large {
  padding: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--brand-mark-text) 24%, transparent);
  border-radius: 10px;
  font-weight: 700;
  background: var(--brand-mark-bg);
  color: var(--brand-mark-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.brand span {
  display: block;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  color: var(--sidebar-text);
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
}

.nav a.active,
.nav a:hover {
  background: var(--sidebar-active-bg);
  border-color: color-mix(in srgb, var(--sidebar-active-text) 14%, transparent);
  color: var(--sidebar-active-text);
  text-decoration: none;
}

.nav-separator {
  grid-column: 1 / -1;
  margin: 12px 8px 4px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--sidebar-muted) 26%, transparent);
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.main {
  padding: 26px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.domain,
.muted,
.table-meta {
  color: var(--muted);
}

.domain {
  margin-top: 3px;
  font-size: 12px;
}

.panel,
.stat,
.component-head,
.hero-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-small);
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 24px;
  margin-bottom: 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, transparent), color-mix(in srgb, var(--accent-dark) 8%, transparent)),
    var(--panel);
}

.hero-panel h2 {
  font-size: 28px;
  max-width: 860px;
}

.hero-panel p {
  max-width: 760px;
  color: #4f5e54;
}

.hero-actions,
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 12px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: #3c4b41;
  font-weight: 700;
}

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

.panel-head.compact {
  margin-bottom: 8px;
}

.panel-head .actions,
.panel-head .hero-actions,
.panel-head form {
  margin-top: 4px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.stat::after {
  content: "";
  position: absolute;
  inset: auto 14px 14px auto;
  width: 46px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.stat.blue::after { background: var(--blue); }
.stat.amber::after { background: var(--amber); }
.stat.green::after { background: var(--green); }

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #435148;
  font-size: 12px;
  background: #f1f5f1;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:hover td {
  background: #fbfdfb;
}

.components-table tbody tr {
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.components-table tbody tr:hover td {
  background: #edf8f3;
}

.components-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

tr.row-next-print td {
  background: color-mix(in srgb, var(--accent) 14%, var(--panel)) !important;
}

tr.row-next-print td:first-child {
  box-shadow: inset 4px 0 0 var(--accent);
}

.project-items-table tbody tr {
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.project-items-table tbody tr:hover td {
  background: #edf8f3;
}

.project-items-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sort-link {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: #435148;
  text-decoration: none;
}

.sort-link:hover,
.sort-link.active {
  color: var(--accent-dark);
  text-decoration: none;
}

.sort-link span {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #dceee6;
  color: var(--accent-dark);
  font-size: 10px;
  line-height: 1;
}

.sort-link span:empty {
  display: none;
}

.sort-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  letter-spacing: 0;
  padding: 0;
  text-transform: inherit;
}

.table-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 12px;
  margin: 6px 0 16px;
}

.table-filter {
  min-width: min(360px, 100%);
}

.table-filter input {
  min-width: min(360px, 100%);
}

.data-grid-table th {
  vertical-align: bottom;
}

.column-filter {
  display: block;
  width: 100%;
  min-width: 120px;
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.2;
}

.data-grid-table tbody tr {
  transition: background 140ms ease, box-shadow 140ms ease;
}

.data-grid-table tbody tr:hover td {
  background: #edf8f3;
}

.data-grid-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.grid-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.grid-pagination-summary {
  color: var(--muted);
  font-weight: 700;
}

.grid-pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.grid-pagination-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.grid-pagination-controls select {
  width: auto;
  min-width: 80px;
  min-height: 32px;
  border-radius: 8px;
  padding: 5px 28px 5px 9px;
}

.bom-example {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.bom-example table {
  min-width: 680px;
}

.bom-example p {
  margin: 10px 0 0;
}

.eagle-bom-review .panel-head {
  align-items: flex-start;
}

.eagle-bom-review .panel-head p {
  margin: 6px 0 0;
}

.eagle-bom-table {
  min-width: 1420px;
}

.eagle-bom-table th,
.eagle-bom-table td {
  padding: 7px 6px;
}

.eagle-bom-table input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
}

.eagle-lcsc-cell {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 230px;
}

.eagle-lcsc-cell .component-picker {
  min-width: 360px;
  max-height: 260px;
  z-index: 8;
}

.bom-cell {
  min-height: 34px;
  min-width: 120px;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}

textarea.bom-cell {
  min-height: 58px;
  resize: vertical;
}

.bom-cell.code {
  min-width: 104px;
  font-family: Menlo, Consolas, Monaco, monospace;
}

.bom-cell.qty,
.bom-cell.small {
  min-width: 82px;
}

.bom-cell.search {
  min-width: 180px;
  min-height: 32px;
  background: var(--soft);
}

.bom-cell.designators {
  min-width: 180px;
}

.bom-cell.description {
  min-width: 320px;
}

.bom-cell.package {
  min-width: 160px;
}

.bom-cell.notes {
  min-width: 260px;
}

td.wide {
  min-width: 280px;
  max-width: 540px;
}

.select-cell {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.select-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--accent);
}

.empty-row {
  color: var(--muted);
  text-align: center;
  padding: 24px 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf1ed;
  color: #46534a;
  white-space: nowrap;
}

.pill.ok {
  background: #e6f3e8;
  color: var(--ok);
}

.pill.warn {
  background: #fff2df;
  color: var(--warn);
}

.flash {
  border-radius: 8px;
  padding: 11px 13px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: #eef5ee;
}

.flash-error {
  background: #fff0f0;
  border-color: #f0c7c7;
  color: var(--error);
}

.button,
button {
  appearance: none;
  border: 1px solid #c8d2ca;
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 13px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}

.button:hover,
button:hover {
  text-decoration: none;
  border-color: #9caea2;
}

.button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 10px 22px rgba(13, 143, 107, 0.20);
}

.button.danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
  box-shadow: 0 10px 22px rgba(155, 44, 44, 0.18);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.55);
}

.button.small {
  min-height: 32px;
  padding: 6px 10px;
}

.button.tiny {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5cd;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 143, 107, 0.12);
  outline: none;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.mono-textarea {
  min-height: 250px;
  font-family: Menlo, Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.access-email-panel > label {
  margin-top: 14px;
}

.access-email-panel > label:first-of-type {
  margin-top: 0;
}

.access-email-panel .actions {
  margin-top: 18px;
}

label {
  display: grid;
  gap: 5px;
  color: #39443d;
  font-weight: 600;
}

label.inline,
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

label.inline input {
  width: 70px;
}

label.check input {
  width: auto;
  min-height: auto;
}

.stack {
  display: grid;
  gap: 12px;
  max-width: 820px;
}

.form-grid,
.inline-form,
.searchbar {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.inline-form,
.searchbar {
  grid-template-columns: minmax(220px, 1fr) 120px auto;
  margin-bottom: 12px;
}

.project-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.8fr) minmax(120px, 150px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.settings-subpanel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.settings-subpanel h3 {
  margin: 0;
  font-size: 16px;
}

.branding-form {
  max-width: none;
}

.brand-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}

.brand-template-card {
  display: grid;
  grid-template-columns: minmax(170px, 42%) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 178px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 82%, var(--soft));
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.brand-template-card:hover,
.brand-template-card.is-selected,
.brand-template-card:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--soft));
  box-shadow: var(--shadow-small);
}

.brand-template-card:hover {
  transform: translateY(-1px);
}

.brand-template-custom {
  border-style: dashed;
}

.brand-template-custom .brand-template-preview {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--preview-accent) 16%, transparent), transparent 48%),
    var(--preview-bg);
}

.brand-template-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: auto;
  min-height: auto;
}

.brand-template-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.brand-template-copy strong,
.brand-template-copy span {
  display: block;
}

.brand-template-copy strong {
  color: var(--ink);
  font-size: 18px;
}

.brand-template-copy span {
  color: var(--muted);
  font-size: 13px;
}

.brand-template-preview {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--preview-text) 14%, transparent);
  border-radius: 8px;
  background: var(--preview-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--preview-panel) 70%, transparent);
}

.brand-template-preview::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 36%;
  background: linear-gradient(180deg, var(--preview-menu), var(--preview-menu-2));
}

.brand-template-preview span,
.brand-template-preview b,
.brand-template-preview i,
.brand-template-preview em {
  position: absolute;
  display: block;
  font-style: normal;
}

.brand-template-preview span {
  left: 16px;
  top: 18px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--preview-accent);
}

.brand-template-preview b {
  left: 44%;
  right: 14px;
  top: 18px;
  height: 26px;
  border-radius: 999px;
  background: var(--preview-panel);
}

.brand-template-preview i {
  left: 44%;
  right: 14px;
  top: 58px;
  height: 72px;
  border: 1px solid color-mix(in srgb, var(--preview-text) 10%, transparent);
  border-radius: 8px;
  background: var(--preview-panel);
}

.brand-template-preview em {
  left: 15px;
  right: 66%;
  bottom: 18px;
  height: 28px;
  border-radius: 8px;
  background: var(--preview-nav);
}

.brand-template-swatches {
  display: flex;
  gap: 7px;
  margin-top: 4px;
}

.brand-template-swatches i {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.brand-library-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.15fr);
  gap: 16px;
}

.brand-library-create,
.brand-library-manage {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.brand-library-manage .actions {
  align-items: center;
}

.brand-workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(520px, 1.15fr);
  gap: 16px;
}

.brand-color-stack {
  display: grid;
  gap: 14px;
}

.brand-custom-callout {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
}

.brand-custom-callout strong,
.brand-custom-callout span {
  display: block;
}

.brand-custom-callout span {
  color: var(--muted);
}

.brand-color-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.brand-color-section h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.brand-color-section summary {
  cursor: pointer;
  font-weight: 800;
}

.brand-color-section[open] summary {
  margin-bottom: 12px;
}

.color-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.color-control-grid label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.color-control-grid input[type="color"] {
  width: 58px;
  min-height: 38px;
  padding: 2px;
}

.brand-preview-shell {
  --preview-bg: var(--bg);
  --preview-panel: var(--panel);
  --preview-text: var(--ink);
  --preview-muted: var(--muted);
  --preview-line: var(--line);
  --preview-soft: var(--soft);
  --preview-menu: var(--sidebar-bg);
  --preview-menu-2: var(--sidebar-bg-2);
  --preview-menu-text: var(--sidebar-text);
  --preview-menu-muted: var(--sidebar-muted);
  --preview-nav: var(--sidebar-active-bg);
  --preview-nav-text: var(--sidebar-active-text);
  --preview-logo-bg: var(--brand-mark-bg);
  --preview-logo-text: var(--brand-mark-text);
  --preview-accent: var(--accent);
  --preview-accent-dark: var(--accent-dark);
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--preview-bg);
}

.brand-preview-shell aside {
  padding: 22px;
  background: linear-gradient(180deg, var(--preview-menu), var(--preview-menu-2));
  color: var(--preview-menu-text);
}

.brand-preview-logo {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 10px;
  background: var(--preview-logo-bg);
  color: var(--preview-logo-text);
  font-weight: 800;
}

.brand-preview-shell nav {
  display: grid;
  gap: 10px;
}

.brand-preview-shell nav span {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--preview-menu-muted);
}

.brand-preview-shell nav span.active {
  background: var(--preview-nav);
  color: var(--preview-nav-text);
}

.brand-preview-shell main {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
  color: var(--preview-text);
}

.brand-preview-shell h3,
.brand-preview-shell p {
  margin: 0;
}

.brand-preview-shell h3 {
  color: var(--preview-accent-dark);
}

.brand-preview-shell p {
  color: var(--preview-muted);
}

.brand-preview-card {
  display: grid;
  gap: 5px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--preview-line);
  border-radius: 10px;
  background: var(--preview-panel);
  box-shadow: var(--shadow-small);
}

.brand-preview-card span {
  color: var(--preview-muted);
}

.project-file-upload {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(260px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.project-customer-access {
  border-top: 4px solid color-mix(in srgb, var(--blue) 36%, var(--line));
}

.project-customer-add {
  grid-template-columns: minmax(260px, 420px) auto;
}

.project-customer-table {
  min-width: 900px;
}

.project-files-table {
  min-width: 860px;
}

.project-item-modal-card {
  max-width: 780px;
}

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

.production-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(120px, 180px) auto;
  gap: 12px;
  align-items: end;
}

.production-form-multi {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.production-lines,
.production-line-meta-list {
  display: grid;
  gap: 10px;
}

.production-plan-line {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(110px, 150px) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.production-form-actions {
  display: flex;
  align-items: flex-end;
}

.production-create-flow {
  display: grid;
  gap: 16px;
}

.production-wizard-card {
  display: grid;
  gap: 16px;
  border-top: 4px solid color-mix(in srgb, var(--accent) 48%, var(--line));
}

.production-step-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.step-badge {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(13, 143, 107, 0.18);
}

.production-customer-picker {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1fr) minmax(220px, 0.8fr);
  gap: 12px;
  align-items: end;
}

.customer-selection-card {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 10%, transparent), transparent),
    var(--soft);
}

.customer-selection-card strong,
.customer-selection-card span {
  display: block;
}

.customer-selection-card span {
  color: var(--muted);
  font-size: 12px;
}

.customer-create-fields {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.customer-create-fields summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 800;
}

.customer-create-fields .form-grid {
  margin-top: 12px;
}

.production-detail-grid {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) minmax(140px, 180px) minmax(240px, 1.2fr);
}

.production-po-drop {
  display: grid;
  gap: 4px;
  min-height: 70px;
  align-content: center;
}

.production-lines-rich {
  gap: 14px;
}

.production-plan-line-rich {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
}

.production-line-core {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.2fr) minmax(110px, 150px) auto;
  gap: 12px;
  align-items: end;
}

.production-line-title {
  display: grid;
  gap: 3px;
  align-self: center;
  min-width: 0;
}

.production-line-title strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.production-line-title span {
  color: var(--muted);
  font-size: 12px;
}

.production-line-detail-grid {
  display: grid;
  grid-template-columns: minmax(200px, 0.8fr) repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.production-line-detail-grid textarea {
  min-height: 74px;
}

.production-submit-panel {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--amber) 7%, transparent)),
    #fff;
}

.production-submit-panel p {
  max-width: 720px;
  margin: 6px 0 0;
}

.production-run-grid {
  align-items: stretch;
  margin-bottom: 16px;
}

.production-run-grid .panel {
  margin-bottom: 0;
}

.production-line-meta-panel {
  max-height: 780px;
  overflow: auto;
}

.production-line-meta-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.production-line-meta-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--ink);
}

.production-line-meta-head span {
  color: var(--muted);
  font-size: 12px;
}

.production-state-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.production-state-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.production-state-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.production-state-head strong,
.production-state-head span {
  display: block;
}

.production-state-head span {
  color: var(--muted);
  font-size: 12px;
}

.production-state-head b {
  color: var(--accent-dark);
  font-size: 22px;
}

.production-scanner {
  position: relative;
  border-color: rgba(13, 143, 107, 0.28);
  background:
    linear-gradient(135deg, rgba(13, 143, 107, 0.10), rgba(35, 106, 143, 0.06) 42%, rgba(255, 255, 255, 0) 72%),
    #fff;
}

.production-scanner.scan-ok {
  animation: scannerOk 480ms ease;
}

.production-scanner.scan-error {
  animation: scannerError 760ms ease;
}

body.scan-ok::before,
body.scan-error::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3000;
  pointer-events: none;
  animation: pageScanFlash 520ms ease forwards;
}

body.scan-ok::before {
  background: rgba(47, 124, 69, 0.18);
}

body.scan-error::before {
  background: rgba(155, 44, 44, 0.20);
}

.scanner-total {
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid rgba(13, 143, 107, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  text-align: right;
}

.scanner-total strong {
  color: var(--accent-dark);
  font-size: 24px;
  line-height: 1;
}

.scanner-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.scanner-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(260px, 1.4fr) minmax(140px, 0.7fr) minmax(180px, 0.9fr) auto;
  gap: 12px;
  align-items: end;
}

.scanner-input-wrap input {
  min-height: 48px;
  border-color: rgba(13, 143, 107, 0.42);
  font-family: Menlo, Consolas, Monaco, monospace;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.scanner-message {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #d9e4dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 700;
}

.scanner-message.ok {
  border-color: #b8dfc1;
  background: #eaf8ed;
  color: var(--ok);
}

.scanner-message.error {
  border-color: #efc1c1;
  background: #fff0f0;
  color: var(--error);
}

.scanner-line-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.scanner-line-card {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.scanner-line-card.complete {
  border-color: #b8dfc1;
  background: #eff9f1;
}

.scanner-line-card strong,
.scanner-line-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-line-card span,
.scanner-line-card small {
  color: var(--muted);
}

.scanner-line-card b {
  color: var(--ink);
  font-size: 20px;
}

.scanner-device-table {
  min-width: 980px;
}

.scanner-device-table tbody tr {
  transition: background 140ms ease, box-shadow 140ms ease;
}

.scanner-device-table tbody tr:hover td {
  background: #edf8f3;
}

.scanner-device-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

@keyframes scannerOk {
  0% { box-shadow: 0 0 0 0 rgba(47, 124, 69, 0.00); }
  22% { box-shadow: 0 0 0 5px rgba(47, 124, 69, 0.16), var(--shadow-small); }
  100% { box-shadow: var(--shadow-small); }
}

@keyframes scannerError {
  0% { box-shadow: 0 0 0 0 rgba(155, 44, 44, 0.00); }
  18% { box-shadow: 0 0 0 5px rgba(155, 44, 44, 0.18), var(--shadow-small); }
  100% { box-shadow: var(--shadow-small); }
}

@keyframes pageScanFlash {
  0% { opacity: 0; }
  24% { opacity: 1; }
  100% { opacity: 0; }
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(13, 143, 107, 0.08), rgba(255, 255, 255, 0)),
    var(--soft);
}

.component-create-panel {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 44%),
    var(--panel);
}

.component-create-panel .panel-head p {
  margin: 6px 0 0;
}

.component-create-drawer {
  padding: 12px 14px;
}

.component-create-drawer[open] {
  padding: 18px;
}

.component-create-summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.component-create-summary::-webkit-details-marker {
  display: none;
}

.component-create-summary span {
  opacity: 0.75;
  font-size: 12px;
  text-transform: uppercase;
}

.component-create-drawer[open] .component-create-summary {
  margin-bottom: 16px;
}

.component-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.3fr) repeat(3, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.component-create-form .source-check {
  min-height: 38px;
  align-self: end;
}

.component-create-form .wide-field {
  grid-column: span 2;
}

.component-create-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  row-gap: 12px;
}

.component-preview-hero {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.component-preview-media {
  display: grid;
  place-items: center;
  min-height: 280px;
}

.component-preview-media img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

.component-preview-summary .flash {
  margin-top: 12px;
  margin-bottom: 0;
}

.component-preview-warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.component-confirm-form {
  display: grid;
  gap: 12px;
}

.product-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(5, minmax(130px, 0.8fr));
  gap: 12px;
  align-items: end;
}

.product-form .wide-field,
.product-inline-form .wide-field {
  grid-column: span 2;
}

.product-inline-form {
  display: grid;
  min-width: 760px;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 8px;
  align-items: end;
}

.invoice-draft-lines {
  min-width: 1060px;
}

.sales-invoice-builder {
  display: grid;
  gap: 16px;
  overflow: visible;
}

.sales-invoice-builder > .panel {
  margin-bottom: 0;
}

.invoice-lines-panel {
  width: 100%;
  overflow-x: auto;
}

.invoice-header-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.invoice-lines-head {
  margin-top: 10px;
}

.invoice-line-editor {
  min-width: 1120px;
}

.invoice-line-editor th:first-child,
.invoice-line-editor td:first-child {
  min-width: 260px;
}

.invoice-line-editor select,
.invoice-line-editor input {
  min-width: 120px;
}

.invoice-line-editor [name="line_description[]"] {
  min-width: 260px;
}

.invoice-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.invoice-report-grid div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.invoice-report-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.template-ide-shell {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.template-file-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-small);
}

.template-file-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.template-file-list {
  display: grid;
  gap: 8px;
}

.template-file-list a {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  text-decoration: none;
}

.template-file-list a.active {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.template-file-list span,
.template-file-list small {
  color: var(--muted);
  font-size: 12px;
}

.template-editor-panel,
.template-editor-form {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.template-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.template-ide-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 300px);
  gap: 16px;
  align-items: stretch;
}

.template-code-panel {
  display: grid;
  grid-template-rows: auto minmax(520px, 62vh);
  padding: 0;
  overflow: hidden;
}

.template-code-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--sidebar-bg) 92%, #fff);
  color: var(--sidebar-text);
}

.template-code-toolbar span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-code-editor {
  width: 100%;
  min-height: 520px;
  height: 100%;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: #101820;
  color: #eaf2f7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
}

.template-code-editor:focus {
  outline: 3px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: -3px;
}

.template-meta-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.template-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-token-list code {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  cursor: pointer;
}

.template-preview-panel {
  overflow-x: auto;
}

.template-preview-frame {
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.invoice-create-details {
  margin-top: 14px;
}

.invoice-create-details summary {
  cursor: pointer;
  font-weight: 800;
}

.invoice-total-box {
  display: grid;
  gap: 8px;
  max-width: 360px;
  margin: 18px 0 0 auto;
}

.invoice-total-box div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.invoice-total-box strong {
  font-size: 18px;
}

.invoice-print-shell {
  max-width: 980px;
}

.invoice-print-panel {
  overflow-x: visible;
}

.filter-wide {
  grid-column: span 2;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.danger-panel {
  border-color: #efc6c6;
  background:
    linear-gradient(135deg, rgba(155, 44, 44, 0.08), rgba(255, 255, 255, 0) 38%),
    #fff;
}

.reset-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.reset-grid .actions {
  grid-column: 1 / -1;
}

.backup-table {
  min-width: 760px;
  margin-top: 14px;
}

.backup-actions {
  min-width: 420px;
}

.restore-inline {
  display: inline-flex !important;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.restore-inline input {
  width: 92px;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.filter-status {
  min-width: 92px;
  color: var(--muted);
  font-size: 12px;
  line-height: 32px;
}

.component-picker {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #cbd8cf;
  border-radius: 12px;
  background: #f9fcf9;
  box-shadow: var(--shadow-small);
}

.component-picker[hidden] {
  display: none;
}

.component-picker-row {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 7px;
  border-color: #dbe5de;
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.component-picker-row:hover {
  border-color: rgba(13, 143, 107, 0.55);
  background: #edf8f3;
}

.component-picker-row img,
.component-picker-thumb {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.component-picker-row img {
  object-fit: contain;
}

.component-picker-thumb {
  display: block;
  background:
    linear-gradient(135deg, rgba(13, 143, 107, 0.10), rgba(35, 106, 143, 0.07)),
    #fff;
}

.component-picker-body {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.component-picker-body strong,
.component-picker-body span,
.component-picker-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.component-picker-body span {
  color: #405148;
}

.component-picker-body small,
.component-picker-empty {
  color: var(--muted);
}

.component-picker-empty {
  padding: 11px;
  text-align: center;
}

.components-results {
  transition: opacity 140ms ease;
}

.components-results.loading {
  opacity: 0.55;
}

.queue-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.queue-bars div,
.facts div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--soft);
}

.queue-bars span,
.facts span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.api-endpoint-list {
  display: grid;
  gap: 8px;
}

.api-endpoint-list div {
  display: grid;
  grid-template-columns: 54px minmax(160px, 1fr) minmax(180px, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.api-endpoint-list b {
  color: var(--accent-dark);
  font-size: 12px;
}

.api-endpoint-list span {
  color: var(--muted);
}

.api-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.api-code {
  margin: 8px 0 14px;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid #d9e4dc;
  border-radius: 10px;
  background: #101814;
  color: #d7efe4;
  font: 12px/1.5 Menlo, Consolas, Monaco, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.api-spec-preview {
  max-height: 620px;
}

.component-head {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  margin-bottom: 16px;
}

.part-image,
.empty-image {
  width: 150px;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fafcf9;
}

.part-image img {
  max-width: 140px;
  max-height: 140px;
}

.part-thumb {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.part-thumb img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}

.part-thumb.empty {
  background: #f4f7f4;
}

.invoice-components-table {
  min-width: 1280px;
}

.production-pick-table {
  min-width: 1180px;
}

.customer-admin-body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 280px),
    var(--bg);
}

.customer-app-shell .brand strong {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-main {
  display: grid;
  align-content: start;
  gap: 18px;
}

.customer-main .topbar,
.customer-main .panel,
.customer-main .hero-panel,
.customer-main .stat-grid,
.customer-main .grid {
  margin-bottom: 0;
}

.customer-main .panel {
  overflow-x: auto;
}

.customer-hero {
  margin-bottom: 0;
}

.customer-stat-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.customer-dashboard-grid {
  align-items: start;
}

.customer-dashboard-stack {
  display: grid;
  gap: 18px;
}

.customer-filterbar {
  margin: 0 0 16px;
}

.portal-body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 340px),
    var(--bg);
}

.portal-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.portal-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.legal-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 28px 0 0;
  padding: 12px 0 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.legal-footer a {
  color: var(--muted);
  font-weight: 700;
}

.notification-panel {
  border-color: rgba(13, 143, 107, 0.28);
  background:
    linear-gradient(135deg, rgba(13, 143, 107, 0.10), rgba(255, 255, 255, 0) 38%),
    #fff;
}

.notification-list {
  display: grid;
  gap: 8px;
}

.notification-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(240px, 1.4fr) minmax(120px, auto);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
}

.notification-row:hover {
  border-color: rgba(13, 143, 107, 0.5);
  text-decoration: none;
}

.notification-row span,
.notification-row small {
  color: var(--muted);
}

.customer-order-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(110px, 150px) minmax(150px, 0.7fr) minmax(180px, 0.9fr) auto;
  gap: 12px;
  align-items: end;
}

.customer-order-notes {
  grid-column: 1 / -2;
}

.customer-project-access {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent),
    var(--soft);
}

.customer-project-access p {
  margin: 0;
}

.customer-project-access > form {
  max-width: none;
}

.customer-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.customer-project-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.customer-project-card:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
}

.customer-project-card input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 1px;
  accent-color: var(--accent);
}

.customer-project-card strong,
.customer-project-card small,
.customer-project-card em {
  display: block;
}

.customer-project-card small,
.customer-project-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

.report-cover {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 28px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(13, 143, 107, 0.15), rgba(35, 106, 143, 0.10)),
    #fff;
  box-shadow: var(--shadow-small);
}

.report-cover h1 {
  max-width: 820px;
  font-size: 34px;
}

.report-cover p {
  color: var(--muted);
  font-weight: 700;
}

.report-status {
  min-width: 190px;
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.report-status strong {
  font-size: 30px;
}

.report-status small {
  color: var(--muted);
}

.report-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.report-facts div {
  min-height: 76px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-small);
}

.report-facts span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-facts strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.report-panel table {
  min-width: 860px;
}

.invoice-components-table th:first-child,
.invoice-components-table td:first-child {
  width: 56px;
}

.invoice-components-table tbody tr {
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.invoice-components-table tbody tr:hover td {
  background: #edf8f3;
}

.invoice-components-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.invoice-facts {
  margin: 0;
}

.raw-fields {
  margin-top: 8px;
}

.raw-fields summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 700;
}

.raw-fields pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid #d9e4dc;
  border-radius: 8px;
  background: #101814;
  color: #d7efe4;
  font: 12px/1.45 Menlo, Consolas, Monaco, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actions-cell {
  white-space: nowrap;
}

.actions-cell .button,
.actions-cell .inline-action {
  display: inline-block;
  margin: 2px 6px 6px 0;
  vertical-align: top;
}

.lede {
  color: #3d4942;
  max-width: 920px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  row-gap: 12px;
  margin-top: 10px;
}

.panel-head .actions,
.panel-head .hero-actions,
.topbar .actions,
.topbar .hero-actions,
.hero-panel .hero-actions,
td .actions,
td .inline-action:first-child {
  margin-top: 0;
}

.actions.column {
  display: grid;
}

.pager {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.error-box,
.agent-result {
  background: #1f241f;
  color: #edf5ee;
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
}

.drop-zone {
  border: 2px dashed #aebcaf;
  border-radius: 8px;
  background: #f8fbf8;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  color: #39443d;
}

.path-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.path-list div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.path-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.path-list code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.sidebar-foot {
  margin-top: auto;
  border: 1px solid color-mix(in srgb, var(--sidebar-muted) 22%, transparent);
  border-radius: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--sidebar-active-bg) 48%, transparent);
}

.sidebar-foot span,
.sidebar-foot strong {
  display: block;
}

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

.sidebar-foot strong {
  margin-top: 3px;
  color: var(--sidebar-text);
}

.login-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 15%, rgba(13, 143, 107, 0.22), transparent 32%),
    radial-gradient(circle at 82% 74%, rgba(176, 107, 22, 0.14), transparent 30%),
    #111812;
  color: #eef4ee;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-frame {
  width: min(1060px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
  background:
    linear-gradient(135deg, rgba(13, 143, 107, 0.22), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
}

.login-hero h1 {
  max-width: 760px;
  margin-top: 36px;
  font-size: 48px;
  line-height: 1.04;
}

.login-hero p {
  max-width: 620px;
  color: #bdcabe;
  font-size: 17px;
}

.login-metrics {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.login-metrics div {
  min-width: 130px;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.login-metrics b,
.login-metrics span {
  display: block;
}

.login-metrics b {
  color: #d8fff0;
  font-size: 22px;
}

.login-metrics span {
  color: #bdcabe;
  font-size: 12px;
}

.login-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(255, 255, 255, 0.97);
  color: var(--ink);
  border-radius: 0;
  padding: 34px;
  box-shadow: none;
}

.login-card h2 {
  font-size: 30px;
  margin-bottom: 4px;
}

.setup-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent-dark);
}

.drop-zone.compact {
  padding: 14px;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: #edf8ef;
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 400;
}

.setup-page {
  max-width: 920px;
  margin: 32px auto;
  padding: 0 16px;
}

.setup-panel {
  padding: 22px;
}

.label-workbench {
  display: grid;
  grid-template-columns: minmax(0, 720px) 320px;
  gap: 16px;
  align-items: start;
}

.label-preview {
  width: 720px;
  height: 405px;
  background: #fff;
  border: 2px solid #111;
  display: grid;
  grid-template-columns: 58% 42%;
  gap: 12px;
  padding: 20px;
  overflow: hidden;
}

.label-preview h2 {
  font-size: 42px;
  margin-bottom: 10px;
}

.label-preview .kv {
  font-size: 23px;
  margin-bottom: 7px;
}

.label-preview .desc {
  font-size: 20px;
  line-height: 1.22;
  max-height: 190px;
  overflow: hidden;
}

.label-right {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 12px;
}

.label-right img {
  max-width: 250px;
  max-height: 185px;
}

.qr-box {
  width: 160px;
  display: grid;
  justify-items: end;
  gap: 4px;
}

.qr-code {
  width: 160px;
  height: 160px;
  display: block;
  background: #fff;
  image-rendering: pixelated;
}

.qr-caption {
  color: #111;
  font-size: 14px;
  line-height: 1;
}

body.modal-open {
  overflow: hidden;
}

.label-modal[hidden] {
  display: none;
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 12, 0.58);
  backdrop-filter: blur(5px);
}

.confirm-modal-card {
  position: relative;
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--error) 28%, var(--line));
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 22, 18, 0.28);
}

.confirm-modal-card p {
  margin: 0;
  color: var(--muted);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.label-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
}

.label-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 22, 17, 0.72);
  backdrop-filter: blur(10px);
}

.label-modal-card {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  background: #f7faf7;
  box-shadow: 0 28px 80px rgba(7, 18, 12, 0.38);
  padding: 18px;
}

.label-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.label-modal-header h2 {
  font-size: 24px;
  margin: 2px 0 0;
}

.modal-label-workbench {
  grid-template-columns: minmax(0, 720px) minmax(240px, 1fr);
}

.label-modal-actions {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-small);
}

.label-modal-actions h2 {
  margin-bottom: 12px;
}

.modal-row-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.modal-row-nav .button {
  width: 100%;
}

.modal-image-inspector {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.modal-image-inspector img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.component-image-popover {
  position: fixed;
  z-index: 60;
  width: 260px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 12px;
  background: rgba(20, 28, 23, 0.94);
  box-shadow: 0 18px 48px rgba(7, 18, 12, 0.32);
  padding: 10px;
}

.component-image-popover[hidden] {
  display: none;
}

.component-image-popover img {
  width: 100%;
  max-height: 210px;
  object-fit: contain;
  display: block;
  border-radius: 8px;
  background: #fff;
}

.component-image-popover div {
  margin-top: 8px;
  color: #d7efe4;
  font-weight: 700;
  text-align: center;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-grid,
  .grid.two,
  .facts,
  .label-workbench,
  .modal-label-workbench,
  .login-frame {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-panel,
  .filter-wide,
  .component-create-form,
  .component-create-form .wide-field,
  .component-preview-hero,
  .searchbar,
  .brand-template-grid,
  .brand-library-grid,
  .brand-workspace-grid,
  .customer-order-form,
  .notification-row,
  .project-create-form,
  .project-file-upload,
  .production-customer-picker,
  .production-detail-grid,
  .production-form,
  .production-form-multi,
  .production-line-core,
  .production-line-detail-grid,
  .production-plan-line,
  .product-form,
  .product-form .wide-field,
  .product-inline-form,
  .product-inline-form .wide-field,
  .scanner-form,
  .template-ide-shell,
  .template-ide-grid {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .template-file-panel {
    position: static;
  }

  .template-code-panel {
    grid-template-rows: auto minmax(420px, 54vh);
  }

  .production-submit-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-template-card,
  .brand-preview-shell {
    grid-template-columns: 1fr;
  }

  .brand-preview-shell {
    min-height: auto;
  }

  .brand-preview-shell aside {
    display: flex;
    gap: 16px;
    align-items: center;
    overflow-x: auto;
  }

  .brand-preview-logo {
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  .brand-preview-shell nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
  }

  .scanner-total {
    width: 100%;
    text-align: left;
  }

  .customer-order-notes {
    grid-column: auto;
  }

  .reset-grid {
    grid-template-columns: 1fr;
  }

  .api-console-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .api-endpoint-list div {
    grid-template-columns: 1fr;
  }

  .login-hero h1 {
    font-size: 34px;
  }

  .login-frame {
    min-height: auto;
  }

  .login-card {
    border-radius: 0;
  }

  .label-preview {
    width: 100%;
    aspect-ratio: 100 / 62;
    height: auto;
  }

  .label-modal {
    padding: 12px;
  }

  .label-modal-card {
    max-height: calc(100vh - 24px);
    padding: 12px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .panel,
  .flash,
  .no-print,
  .label-modal-header,
  .label-modal-actions,
  .label-modal-backdrop {
    display: none !important;
  }

  .app-shell,
  .main,
  .label-workbench,
  .label-modal,
  .label-modal-card,
  .modal-label-workbench {
    display: block;
    padding: 0;
    position: static;
    inset: auto;
    max-height: none;
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .label-preview {
    width: 100mm;
    height: 62mm;
    border: 0.3mm solid #000;
    box-shadow: none;
    page-break-after: always;
  }

  .production-print-panel {
    display: block !important;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .production-print-panel .panel-head,
  .production-print-panel .panel-head > div {
    display: block;
    margin-bottom: 10px;
  }

  .production-print-panel table {
    min-width: 0;
    font-size: 10px;
  }

  .production-print-panel th,
  .production-print-panel td {
    padding: 5px;
  }

  .production-print-panel .wide {
    min-width: 0;
    max-width: none;
  }
}
