:root {
  color-scheme: light;
  --page: #fbfbfa;
  --panel: #f0f0f0;
  --panel-strong: #e8e8e8;
  --line: #d7d7d7;
  --line-dark: #9c9c9c;
  --text: #172434;
  --muted: #65707b;
  --field: #ffffff;
  --focus: #a96b25;
  --accent: #ffd84b;
  --accent-soft: #fff7ba;
  --danger: #d0342c;
  --edge: #ff0000;
  --ok: #267f3e;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1500px, calc(100vw - 48px));
  margin: 18px auto 44px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 12px 24px;
  border-bottom: 1px solid #e5e5e5;
}

.topbar h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: 0;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.brand-block {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-width: 260px;
}

.brand-logo {
  width: 86px;
  max-height: 58px;
  object-fit: contain;
}

.topbar-actions {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.view-tabs .secondary-action {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.admin-tools .secondary-action {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.view-tabs .secondary-action.selected,
.admin-tools .secondary-action.selected {
  border-color: #a76820;
  background: #fff7d6;
  color: #172434;
}

.view-tabs svg,
.admin-tools svg {
  width: 16px;
  height: 16px;
}

.user-pill {
  display: inline-grid;
  min-height: 32px;
  place-items: center;
  padding: 0 10px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #2d3a48;
  font-size: 13px;
}

.workspace {
  display: block;
}

.cut-workbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0 12px;
  border-bottom: 1px solid #e5e5e5;
}

.main-column {
  min-width: 0;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--page);
}

.auth-card {
  width: min(940px, 100%);
  border: 1px solid #d1d1d1;
  background: #fff;
  padding: 28px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.auth-head {
  padding-bottom: 18px;
  border-bottom: 1px solid #e5e5e5;
}

.auth-head h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 400;
}

.auth-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.auth-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border: 1px solid #dedede;
  background: #fafafa;
}

.auth-panel h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 400;
}

.auth-panel-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.auth-action {
  justify-self: start;
  min-width: 150px;
}

.auth-action svg {
  width: 16px;
  height: 16px;
}

.auth-check-line {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
}

.auth-check-line input {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.auth-terms-preview {
  border: 1px solid #d9d9d9;
  background: #fff;
  padding: 8px 10px;
  font-size: 13px;
}

.auth-terms-preview summary {
  cursor: pointer;
  color: var(--accent);
}

.auth-terms-preview .terms-text {
  margin-top: 8px;
}

.auth-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.auth-reset-panel {
  margin-top: 18px;
}

.auth-reset-panel form {
  display: grid;
  gap: 12px;
}

.auth-inline-status {
  min-height: 20px;
  overflow-wrap: anywhere;
  color: #42612b;
  font-size: 13px;
  line-height: 1.35;
}

.auth-inline-status.is-error {
  color: #9a3412;
}

.auth-inline-status.is-success {
  color: #267f3e;
}

.auth-status {
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid #dfdfdf;
  background: #fafafa;
  color: #4f5b66;
  font-size: 13px;
}

.auth-status.is-error {
  border-color: #c88b20;
  background: #fff3c4;
  color: #3d2c0c;
}

.terms-gate {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(22, 29, 36, 0.58);
}

.terms-gate[hidden] {
  display: none !important;
}

.terms-gate-card {
  width: min(720px, 100%);
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  padding: 24px;
}

.terms-gate-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid #e4e9ef;
}

.terms-gate-head svg {
  width: 34px;
  height: 34px;
  color: #c88b20;
}

.terms-gate-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
}

.terms-gate-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.terms-gate-content {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.terms-gate-content ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.terms-accept-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid #f1d38b;
  background: #fff8df;
}

.terms-accept-line input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.terms-gate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.terms-gate-status {
  min-height: 20px;
  margin-top: 10px;
  color: #42612b;
  font-size: 13px;
}

.terms-gate-status.is-error {
  color: #9a3412;
}

.route-view {
  margin-top: 0;
}

.home-view {
  display: grid;
  min-height: 520px;
  place-items: center;
  padding: 30px 0;
}

.home-stack {
  width: min(760px, 100%);
  display: grid;
  gap: 18px;
}

.home-panel {
  width: 100%;
  border: 1px solid #d6d6d6;
  background: #fff;
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.home-mark {
  display: grid;
  gap: 4px;
  padding: 24px;
  border: 1px solid #d8d8d8;
  background: #f7f7f7;
}

.home-logo {
  width: min(100%, 220px);
  max-height: 96px;
  object-fit: contain;
  justify-self: start;
  margin-bottom: 6px;
}

.home-mark strong {
  color: #102033;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
}

.home-mark span {
  color: var(--muted);
  font-size: 14px;
}

.home-note h2 {
  margin: 0 0 6px;
  color: #102033;
  font-size: 24px;
  font-weight: 400;
}

.home-note p {
  margin: 0;
  color: var(--muted);
}

.home-static-pages {
  width: 100%;
  border: 1px solid #d6d6d6;
  background: #fff;
}

.home-static-tabs {
  display: flex;
  align-items: stretch;
  min-height: 42px;
  background: #5a5a5a;
  border-bottom: 1px solid #454545;
}

.home-static-tab {
  min-width: 82px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid #d8d8d8;
  background: #5a5a5a;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.home-static-tab:hover,
.home-static-tab:focus-visible,
.home-static-tab.selected {
  background: #3f3f3f;
  outline: none;
}

.home-static-page {
  padding: 20px 24px 24px;
  color: var(--text);
}

.home-static-page h2 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 400;
}

.home-static-page p {
  margin: 0 0 12px;
  color: var(--muted);
}

.home-static-page ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

.home-cookie-tools {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 12px;
  background: #fff;
}

.home-cookie-button {
  min-width: 150px;
  border-left: 1px solid #d8d8d8;
}

.account-view {
  padding: 28px 0 0;
}

.account-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.account-summary,
.account-card {
  border: 1px solid #d1d1d1;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.account-summary {
  display: grid;
  gap: 0;
}

.account-person {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 28px 20px;
  background: #fafafa;
  text-align: center;
}

.account-person strong {
  color: #122033;
  font-size: 20px;
  font-weight: 400;
}

.account-person span {
  color: #172434;
  font-size: 14px;
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 22px 12px;
  border-top: 1px solid #ededed;
  border-bottom: 1px solid #ededed;
}

.account-stats div {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.account-stats strong {
  color: #000;
  font-size: 18px;
  font-weight: 400;
}

.account-stats span {
  color: #1f2933;
  font-size: 11px;
  line-height: 1.25;
}

.account-last-login {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 26px 22px 34px;
  text-align: center;
  color: #1f2933;
  font-size: 13px;
}

.account-last-login strong {
  color: #172434;
  font-weight: 400;
}

.account-card {
  display: grid;
  gap: 30px;
  padding: 26px 34px 36px;
}

.account-section {
  display: grid;
  gap: 14px;
}

.account-section h2 {
  display: inline-grid;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #172434;
  font-size: 17px;
  font-weight: 400;
}

.account-section h2 svg {
  width: 17px;
  height: 17px;
}

.account-data-list {
  display: grid;
}

.account-data-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.34fr) minmax(0, 1fr);
  min-height: 28px;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
}

.account-data-row:nth-child(even) {
  background: #f7f7f7;
}

.account-data-row strong {
  color: #111;
  font-size: 13px;
}

.account-data-row span {
  color: #111;
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-note,
.account-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.account-password-form {
  display: grid;
  gap: 14px;
  max-width: 300px;
}

.account-password-form .inline-field span {
  text-transform: uppercase;
  font-size: 11px;
}

.account-password-form .inline-field input {
  height: 28px;
}

.account-password-button {
  justify-content: center;
  min-height: 34px;
  background: #5a5a5a;
  color: #fff;
}

.account-password-button:hover {
  background: #4b4b4b;
  color: #fff;
}

.account-status {
  min-height: 18px;
}

.account-status.is-error {
  color: #a12b24;
}

.account-status.is-success {
  color: #267f3e;
}

.management-view {
  margin: 24px 0 0 310px;
}

.scanner-view {
  margin: 24px 0 0 310px;
}

.management-card {
  width: min(920px, 100%);
  border: 1px solid #d1d1d1;
  background: #fff;
  padding: 18px;
}

.scanner-card {
  width: min(1060px, 100%);
}

.management-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
}

.management-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
}

.management-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.management-head > span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.management-grid {
  display: grid;
  gap: 12px;
}

.scanner-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.scanner-form input {
  height: 38px;
  font-size: 20px;
  letter-spacing: 0;
}

.scanner-result {
  min-height: 260px;
  border: 1px solid #d9d9d9;
  background: #fff;
  padding: 16px;
}

.scanner-result-empty {
  display: grid;
  min-height: 190px;
  place-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.scanner-result-empty svg {
  width: 34px;
  height: 34px;
}

.scanner-result-warning {
  border-color: #c88b20;
  background: #fff7d9;
  color: #3d2c0c;
}

.scanner-result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
}

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

.scanner-result-head h3 {
  margin: 3px 0 0;
  font-size: 24px;
  font-weight: 400;
}

.scanner-result-head > strong {
  align-self: start;
  padding: 6px 10px;
  border: 1px solid #cfcfcf;
  background: #f7f7f7;
  font-family: Consolas, "Courier New", monospace;
  font-size: 18px;
}

.scanner-result-layout {
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-top: 16px;
}

.scanner-visual-card {
  display: grid;
  gap: 22px;
  place-items: center;
  padding: 28px 18px 16px;
  border: 1px solid #e2e2e2;
  background: #fafafa;
}

.scanner-piece-drawing {
  width: min(78%, 340px);
  min-height: 0;
}

.scanner-edge-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.scanner-edge-list li {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  border: 1px solid #dedede;
  background: #fff;
  padding: 5px 7px;
}

.scanner-edge-list span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid #c8c8c8;
  background: #f5f5f5;
  font-weight: 600;
}

.scanner-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scanner-info-grid div {
  min-width: 0;
  border: 1px solid #e0e0e0;
  background: #fafafa;
  padding: 7px 9px;
}

.scanner-info-grid span,
.scanner-info-grid strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scanner-info-grid span {
  color: var(--muted);
  font-size: 11px;
}

.scanner-info-grid strong {
  margin-top: 3px;
  color: #152334;
  font-size: 13px;
  font-weight: 600;
}

.cutting-view {
  margin: 18px 0 0;
}

.cutting-head,
.cutting-job-bar {
  margin-left: 0;
  padding: 0 0 12px;
}

.cutting-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e5e5e5;
}

.cutting-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 400;
}

.cutting-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.cutting-head > span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.cutting-job-bar {
  display: grid;
  grid-template-columns: minmax(240px, 390px) minmax(200px, 1fr) minmax(190px, 230px) auto auto auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.cutting-guide-mode-field select {
  min-width: 0;
}

.cutting-status {
  margin: 8px 0 14px;
  padding: 9px 12px;
  border: 1px solid #dfdfdf;
  background: #fafafa;
  color: #4f5b66;
  font-size: 13px;
}

.cutting-workbench {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) minmax(250px, 320px);
  gap: 16px;
  align-items: start;
}

.cutting-sheets {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding-right: 4px;
}

.cutting-sheet-thumb {
  display: grid;
  gap: 5px;
  border: 1px solid #d3d3d3;
  background: #fff;
  padding: 6px;
  color: #1f2833;
  cursor: pointer;
  text-align: left;
}

.cutting-sheet-thumb.is-done {
  border-color: #76a66b;
  background: #f2f8ef;
}

.cutting-sheet-thumb.selected,
.cutting-sheet-thumb:hover {
  border-color: #bb7b2e;
  box-shadow: inset 0 0 0 1px #bb7b2e;
}

.cutting-thumb-board {
  position: relative;
  width: 100%;
  aspect-ratio: 2070 / 2800;
  border: 1px solid #767676;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    #f3eee8;
  background-size: 14px 14px;
  overflow: hidden;
}

.cutting-sheet-thumb span {
  font-size: 12px;
}

.cutting-sheet-thumb small {
  justify-self: start;
  padding: 2px 6px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: #4f5b66;
  font-size: 11px;
  line-height: 1.2;
}

.cutting-sheet-thumb.is-done small {
  border-color: #76a66b;
  background: #dff0db;
  color: #214f25;
}

.cutting-main {
  min-width: 0;
}

.cutting-main-head {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: #1f2833;
}

.cutting-main-head > div {
  display: grid;
  gap: 3px;
}

.cutting-main-head span {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.cutting-main-head em {
  justify-self: start;
  padding: 2px 7px;
  border: 1px solid #d8d8d8;
  background: #fff;
  color: #4f5b66;
  font-size: 11px;
  font-style: normal;
}

.cutting-main-head em.is-done {
  border-color: #76a66b;
  background: #dff0db;
  color: #214f25;
}

.cutting-sheet-done-button {
  min-height: 30px;
  white-space: nowrap;
}

.cutting-guide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 0 0 10px;
  padding: 12px 14px;
  border: 2px solid #bb7b2e;
  background: #fff7df;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.cutting-guide-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.cutting-guide-copy span {
  color: #825214;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.cutting-guide-copy strong {
  color: #071323;
  font-size: 20px;
  line-height: 1.15;
}

.cutting-guide-copy p {
  margin: 0;
  color: #172434;
  font-size: 16px;
  line-height: 1.3;
}

.cutting-guide-copy em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.cutting-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.cutting-guide-actions button {
  min-height: 34px;
}

.cutting-complete-button svg,
.cutting-sheet-done-button svg {
  width: 16px;
  height: 16px;
}

.cutting-board-stage {
  display: grid;
  justify-items: center;
  align-items: start;
  min-height: calc(100vh - 205px);
  overflow: auto;
}

.cutting-board {
  position: relative;
  height: min(calc(100vh - 220px), 920px);
  max-height: calc(100vh - 220px);
  aspect-ratio: 2070 / 2800;
  border: 2px solid #767676;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    #f3eee8;
  background-size: 24px 24px;
  overflow: hidden;
}

.cutting-board .placed-piece {
  font-size: 12px;
}

.cutting-board .placed-piece.is-label-printable {
  cursor: pointer;
}

.cutting-board .placed-piece.is-label-printable:hover {
  box-shadow: inset 0 0 0 2px #172434, 0 0 0 2px rgba(255, 216, 75, 0.9);
}

.cutting-board .piece-edge {
  z-index: 14;
  background: var(--edge);
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.95),
    0 0 0 2px rgba(0, 0, 0, 0.18),
    0 1px 3px rgba(0, 0, 0, 0.28);
  opacity: 0.98;
  pointer-events: none;
}

.cutting-board .piece-edge-top {
  top: 4px;
  left: max(7px, 12%);
  right: max(7px, 12%);
  height: 6px;
}

.cutting-board .piece-edge-right {
  top: max(7px, 12%);
  right: 4px;
  bottom: max(7px, 12%);
  width: 6px;
}

.cutting-board .piece-edge-bottom {
  right: max(7px, 12%);
  bottom: 4px;
  left: max(7px, 12%);
  height: 6px;
}

.cutting-board .piece-edge-left {
  top: max(7px, 12%);
  bottom: max(7px, 12%);
  left: 4px;
  width: 6px;
}

.cutting-thumb-board .placed-piece {
  border-width: 1px;
  font-size: 0;
}

.cutting-thumb-board .piece-edge {
  z-index: 6;
  background: var(--edge);
  pointer-events: none;
}

.cutting-thumb-board .piece-edge-top {
  top: 1px;
  left: max(2px, 12%);
  right: max(2px, 12%);
  height: 2px;
}

.cutting-thumb-board .piece-edge-right {
  top: max(2px, 12%);
  right: 1px;
  bottom: max(2px, 12%);
  width: 2px;
}

.cutting-thumb-board .piece-edge-bottom {
  right: max(2px, 12%);
  bottom: 1px;
  left: max(2px, 12%);
  height: 2px;
}

.cutting-thumb-board .piece-edge-left {
  top: max(2px, 12%);
  bottom: max(2px, 12%);
  left: 1px;
  width: 2px;
}

.cutting-board .piece-edge,
.cutting-thumb-board .piece-edge {
  display: block;
}

.cutting-board .placed-piece .piece-edge,
.cutting-thumb-board .placed-piece .piece-edge {
  position: absolute;
  padding: 0;
  font-size: 0;
  line-height: 0;
}

.cutting-board .cut-line {
  z-index: 7;
  pointer-events: none;
}

.cutting-board .cut-line.is-guide-active {
  z-index: 16;
  background: #0057d8;
  box-shadow: 0 0 0 3px #fff, 0 0 0 7px rgba(0, 87, 216, 0.28);
}

.cutting-board .cut-line.is-guide-active.horizontal {
  height: 5px;
}

.cutting-board .cut-line.is-guide-active.vertical {
  width: 5px;
}

.cutting-board .cut-line.is-guide-active b {
  border-color: #0057d8;
  background: #0057d8;
  color: #fff;
  font-size: 12px;
}

.cutting-board .placed-piece strong,
.cutting-board .placed-piece span,
.cutting-board .placed-piece em {
  z-index: 9;
}

.cutting-board .placed-piece.is-guide-active {
  z-index: 15;
  background: rgba(255, 216, 75, 0.32);
  outline: 4px solid #0057d8;
  outline-offset: -4px;
  box-shadow: inset 0 0 0 3px #ffd84b, 0 0 0 5px rgba(0, 87, 216, 0.18);
}

.cutting-board .placed-piece.is-guide-active strong,
.cutting-board .placed-piece.is-guide-active span,
.cutting-board .placed-piece.is-guide-active em {
  background: rgba(255, 255, 255, 0.85);
}

.cutting-thumb-board .cut-line {
  z-index: 5;
  pointer-events: none;
}

.cutting-board .placed-piece.has-edge-top {
  border-top-color: #4f4f4f;
}

.cutting-board .placed-piece.has-edge-right {
  border-right-color: #4f4f4f;
}

.cutting-board .placed-piece.has-edge-bottom {
  border-bottom-color: #4f4f4f;
}

.cutting-board .placed-piece.has-edge-left {
  border-left-color: #4f4f4f;
}

.cutting-piece-list {
  position: sticky;
  top: 12px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  max-height: calc(100vh - 210px);
  overflow: hidden;
  border: 1px solid #d8d8d8;
  background: #fff;
}

.cutting-piece-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid #e4e4e4;
  background: #f7f7f7;
  color: #1f2833;
}

.cutting-piece-list-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cutting-piece-list-title strong {
  font-size: 14px;
}

.cutting-piece-list-title span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.cutting-label-pdf-button {
  min-height: 28px;
  padding: 4px 8px;
  gap: 5px;
  font-size: 12px;
}

.cutting-label-pdf-button svg {
  width: 15px;
  height: 15px;
}

.cutting-plan-pdf-button {
  min-height: 34px;
  gap: 6px;
}

.cutting-plan-pdf-button svg {
  width: 16px;
  height: 16px;
}

.cutting-piece-list-items {
  display: grid;
  align-content: start;
  min-height: 0;
  overflow: auto;
}

.cutting-piece-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #ececec;
}

.cutting-piece-row:last-child {
  border-bottom: 0;
}

.cutting-piece-row-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #cfcfcf;
  background: #fafafa;
  font-size: 12px;
  font-weight: 700;
}

.cutting-piece-row-body {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.cutting-piece-row-body strong,
.cutting-piece-row-body span,
.cutting-piece-row-body em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cutting-piece-row-body strong {
  color: #172434;
  font-size: 13px;
}

.cutting-piece-row-body span {
  color: #1f2833;
  font-size: 12px;
}

.cutting-piece-row-body em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.cutting-piece-list-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.cutting-piece-list .cut-sequence {
  max-height: 230px;
  overflow: auto;
  border-bottom: 1px solid #e4e4e4;
}

.cutting-thumb-board .placed-piece.has-edge-top {
  border-top-color: #4f4f4f;
}

.cutting-thumb-board .placed-piece.has-edge-right {
  border-right-color: #4f4f4f;
}

.cutting-thumb-board .placed-piece.has-edge-bottom {
  border-bottom-color: #4f4f4f;
}

.cutting-thumb-board .placed-piece.has-edge-left {
  border-left-color: #4f4f4f;
}

.optimization-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 360px);
  gap: 16px;
  align-items: stretch;
}

.optimization-controls {
  display: grid;
  gap: 12px;
  align-content: start;
}

.optimization-controls select {
  min-height: 132px;
}

.optimization-levels {
  max-width: 220px;
}

.optimization-samples {
  max-width: 260px;
}

.optimization-note {
  margin: -2px 0 0;
  max-width: 620px;
  color: #4f5b66;
  font-size: 13px;
  line-height: 1.35;
}

.optimization-preview {
  min-height: 170px;
  border: 1px solid #b8c0c8;
  background: #fff;
  display: grid;
  place-items: center;
}

.optimization-diagram {
  position: relative;
  width: 190px;
  height: 116px;
  border: 2px solid #5f6870;
  background: #f8f8f8;
  box-shadow: inset 0 0 0 1px #d8d8d8;
}

.optimization-tile {
  position: absolute;
  border: 1px solid rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 10px 14px rgba(255, 255, 255, 0.25);
}

.optimization-tile.green {
  background: #91bf3f;
}

.optimization-tile.red {
  background: #cf3833;
}

.optimization-tile.blue {
  background: #3479bd;
}

.optimization-tile.orange {
  background: #f39a2b;
}

.optimization-tile.purple {
  background: #bd32b5;
}

.optimization-tile.cyan {
  background: #37a8bf;
}

.optimization-tile.yellow {
  background: #f2d21d;
}

.optimization-tile.gray {
  background: #777;
}

.admin-panel {
  width: min(1240px, 100%);
  padding: 0;
  border-color: #d5dce4;
  background: #f7f9fb;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.admin-panel .management-head {
  margin: 0;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #e0e6ec;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.admin-panel input[type="number"] {
  text-align: right;
}

.admin-panel .inline-field input:not([type="number"]):not([type="file"]),
.admin-panel textarea {
  text-align: left;
}

.admin-panel .inline-field input,
.admin-panel .inline-field select,
.admin-panel textarea {
  border-color: #cdd6df;
  background: #fff;
}

.admin-panel .inline-field span {
  color: #405265;
  font-weight: 600;
}

.admin-tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid #dfe5ec;
  background: #eef3f7;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid #c7d1dc;
  border-radius: 6px;
  background: #fff;
  color: #253545;
  font-weight: 600;
  cursor: pointer;
}

.admin-tab svg {
  width: 16px;
  height: 16px;
}

.admin-tab:hover,
.admin-tab:focus-visible {
  border-color: #c88b20;
  outline: none;
}

.admin-tab.selected {
  border-color: #c88b20;
  background: #fff4d8;
  box-shadow: inset 0 -2px 0 #c88b20;
}

.admin-tab-panels {
  padding: 20px 24px 24px;
}

.admin-tab-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid #dde4eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.admin-tab-panel[hidden] {
  display: none !important;
}

.admin-tab-panel > .admin-divider:first-child {
  display: none;
}

.admin-divider {
  height: 1px;
  margin: 18px 0;
  background: #e4e9ee;
}

.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf0f3;
}

.admin-panel-head strong {
  font-size: 16px;
}

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

.label-designer {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 420px);
  gap: 18px;
  align-items: start;
}

.label-designer-controls {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.label-designer-size {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.label-designer-size .check-field {
  align-items: center;
}

.label-logo-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 180px) minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid #d9e1e8;
  border-radius: 6px;
  background: #f8fbfd;
}

.label-logo-file input {
  text-align: left;
}

.label-logo-preview {
  display: grid;
  min-height: 54px;
  place-items: center;
  border: 1px solid #cdd6df;
  border-radius: 6px;
  background: #fff;
  padding: 7px;
}

.label-logo-preview img {
  max-width: 150px;
  max-height: 38px;
  object-fit: contain;
}

.label-logo-preview span,
.label-logo-name {
  color: var(--muted);
  font-size: 12px;
}

.label-logo-name {
  align-self: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.label-field-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid #d9e1e8;
  border-radius: 6px;
  background: #fff;
}

.label-field-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.label-field-table th,
.label-field-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e7edf2;
  text-align: left;
  white-space: nowrap;
}

.label-field-table th {
  background: #f2f6fa;
  color: #34495e;
  font-weight: 700;
}

.label-field-table td:first-child {
  min-width: 145px;
  color: #1f2f3f;
  font-weight: 600;
}

.label-field-table input[type="number"] {
  width: 72px;
}

.label-field-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.label-designer-preview-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.label-preview-wrap {
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 18px;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #f3f6f8 25%, transparent 25%),
    linear-gradient(-45deg, #f3f6f8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f6f8 75%),
    linear-gradient(-45deg, transparent 75%, #f3f6f8 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.label-template-preview {
  position: relative;
  flex: none;
}

.label-template-preview .label {
  position: relative;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.label-template-preview .label-edge,
.label-template-preview .label-field {
  position: absolute;
}

.label-template-preview .label-edge {
  z-index: 2;
  display: block;
}

.label-template-preview .label-field {
  z-index: 3;
  overflow: hidden;
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.label-template-preview .label-field-barcode {
  display: grid;
  align-content: stretch;
}

.label-template-preview .label-field-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.label-template-preview .barcode {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.25mm;
  width: 100%;
  height: 100%;
}

.label-template-preview .barcode-bars {
  display: flex;
  width: 100%;
  min-height: 3mm;
  background: #fff;
}

.label-template-preview .barcode-bars span {
  flex-basis: 0;
  min-width: 0;
  height: 100%;
}

.label-template-preview .barcode-bars .bar {
  background: #000;
}

.label-template-preview .barcode-code {
  font-size: inherit;
  line-height: 1;
  text-align: center;
}

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

.admin-logo-file input {
  text-align: left;
}

.admin-logo-preview {
  display: grid;
  min-height: 64px;
  place-items: center;
  border: 1px solid #cdd6df;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.admin-logo-preview img {
  max-width: 220px;
  max-height: 46px;
  object-fit: contain;
}

.admin-logo-preview span {
  color: #506070;
  font-size: 18px;
  font-weight: 600;
}

.project-status {
  min-height: 32px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #dfdfdf;
  background: #fafafa;
  color: #4f5b66;
  font-size: 13px;
}

.project-status.is-dirty {
  border-color: #c88b20;
  background: #fff3c4;
  color: #3d2c0c;
}

.project-history {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #d8d8d8;
  background: #fff;
}

.project-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #253241;
}

.project-history-head strong {
  font-size: 14px;
}

.project-history-head span,
.project-history-row time,
.project-history-row small,
.project-history-empty {
  color: var(--muted);
  font-size: 12px;
}

.project-history-list {
  display: grid;
  max-height: 180px;
  overflow: auto;
  gap: 6px;
}

.project-history-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 6px 0;
  border-top: 1px solid #f0f0f0;
}

.project-history-row:first-child {
  border-top: 0;
}

.project-history-change {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}

.project-history-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid currentColor;
  font-size: 12px;
  line-height: 1.2;
}

.project-history-arrow {
  color: #7d8791;
  font-size: 13px;
}

.project-history-empty {
  margin: 0;
  padding: 8px 0;
}

.deleted-project-log {
  overflow-x: auto;
  border: 1px solid #d8e1ec;
  border-radius: 8px;
  background: #fff;
}

.deleted-project-log-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 14px;
}

.deleted-project-log-table th,
.deleted-project-log-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e6edf4;
  text-align: left;
  vertical-align: top;
}

.deleted-project-log-table th {
  background: #f4f7fb;
  color: #1b324a;
  font-weight: 700;
}

.deleted-project-log-table tr:last-child td {
  border-bottom: 0;
}

.deleted-project-log-main {
  font-weight: 700;
  color: #0c2236;
}

.deleted-project-log-muted {
  margin-top: 3px;
  color: #5c6b78;
  font-size: 12px;
}

.deleted-project-log-empty {
  padding: 24px;
  color: #5c6b78;
  text-align: center;
}

#ordersView .management-card {
  width: min(1160px, 100%);
}

.project-board-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.project-status-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.project-status-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid #cfcfcf;
  border-left-width: 5px;
  background: #fff;
  color: #27313d;
  cursor: pointer;
}

.project-status-filter:hover,
.project-status-filter.selected {
  border-color: #c88b20;
}

.project-status-filter.selected {
  background: #fff4c6;
  box-shadow: inset 0 -2px 0 #d59b22;
}

.project-status-filter span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.project-status-filter strong {
  flex: 0 0 auto;
  font-size: 18px;
  font-weight: 600;
}

.project-filter-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.35fr) minmax(180px, 1fr);
  gap: 10px;
}

.project-hidden-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.project-board {
  min-height: 220px;
  max-height: 470px;
  overflow: auto;
  border: 1px solid #d8d8d8;
  background: #fff;
}

.project-board-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}

.project-board-table th,
.project-board-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #ececec;
  text-align: left;
  vertical-align: top;
}

.project-board-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f1f1;
  color: #3f4b57;
  font-size: 12px;
  font-weight: 600;
}

.project-board-table th:nth-child(1) {
  width: 22%;
}

.project-board-table th:nth-child(2) {
  width: 18%;
}

.project-board-table th:nth-child(3) {
  width: 28%;
}

.project-board-table th:nth-child(4) {
  width: 16%;
}

.project-board-table th:nth-child(5) {
  width: 16%;
}

.project-board-table tbody tr {
  cursor: pointer;
}

.project-board-table tbody tr:hover {
  background: #fafafa;
}

.project-board-table tbody tr.selected {
  background: #fff7cf;
  box-shadow: inset 4px 0 0 #c88b20;
}

.project-board-table tbody tr:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.project-board-table td strong,
.project-board-table td span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-board-table td strong {
  color: #172434;
  font-size: 13px;
  font-weight: 600;
}

.project-board-table td span {
  color: var(--muted);
  font-size: 12px;
}

.project-state-badge,
.project-lock-badge,
.project-archive-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid #cfcfcf;
  background: #f7f7f7;
  color: #27313d;
  font-size: 12px;
}

.project-lock-badge {
  margin-top: 5px;
  border-color: #b8b8b8;
  background: #fff;
  color: #66707c;
}

.project-archive-badge {
  margin-top: 5px;
  border-color: #9ca3af;
  background: #eef0f3;
  color: #354052;
}

.project-board-empty td {
  height: 140px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

.project-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: end;
  margin: -4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ececec;
}

.project-status-admin-field {
  min-width: 250px;
}

.admin-material-browser {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 10px;
}

.admin-material-sidebar,
.admin-material-detail {
  min-width: 0;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  background: #fff;
}

.admin-material-sidebar {
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.admin-producer-field {
  margin-bottom: 10px;
}

.admin-material-list-head,
.admin-material-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e4e4;
}

.admin-material-list-head > div,
.admin-material-detail-head > div:first-child {
  display: grid;
  gap: 2px;
}

.admin-material-list-head strong,
.admin-material-detail-head strong {
  font-size: 14px;
}

.admin-material-list-head span,
.admin-material-detail-head span {
  color: var(--muted);
  font-size: 12px;
}

.admin-material-list {
  display: grid;
  gap: 6px;
  max-height: 520px;
  overflow: auto;
  padding-top: 10px;
}

.admin-material-row {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 7px;
  border: 1px solid #dce2e8;
  border-radius: 6px;
  background: #f8fafc;
  color: #071323;
  text-align: left;
  cursor: pointer;
}

.admin-material-row:hover {
  border-color: #aeb7bf;
  background: #fff;
}

.admin-material-row.is-selected {
  border-color: #bd7617;
  box-shadow: inset 3px 0 0 #bd7617;
  background: #fff8e8;
}

.admin-material-row.is-draft {
  border-style: dashed;
}

.admin-material-row img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid #c8c8c8;
  background: #f0f0f0;
}

.admin-material-row-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.admin-material-row-body strong,
.admin-material-row-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-material-row-body strong {
  font-size: 13px;
}

.admin-material-row-body span {
  color: #4f5b66;
  font-size: 12px;
}

.admin-material-empty {
  padding: 12px;
  border: 1px dashed #cfcfcf;
  border-radius: 6px;
  background: #fafafa;
  color: #56616c;
  font-size: 13px;
}

.admin-material-detail {
  padding: 16px;
}

.admin-material-actions {
  margin-top: 0;
  flex: 0 0 auto;
}

.admin-material-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.admin-material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-image-field input {
  padding: 5px 7px;
}

.admin-material-image-preview {
  display: grid;
  gap: 6px;
  align-items: end;
}

.admin-material-image-preview img {
  width: 100%;
  height: 132px;
  object-fit: cover;
  border: 1px solid #cdd6df;
  border-radius: 6px;
  background: #f3f3f3;
}

.admin-material-status {
  min-height: 30px;
  margin-top: 10px;
  padding: 7px 9px;
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  background: #f8fafc;
  color: #4f5b66;
  font-size: 13px;
}

.admin-material-status.is-warning {
  border-color: #c88b20;
  background: #fff3c4;
  color: #3d2c0c;
}

.admin-material-status.is-success {
  border-color: #8eb784;
  background: #edf8ea;
  color: #24451f;
}

.admin-price-list-browser {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 10px;
}

.admin-price-list-sidebar,
.admin-price-list-detail {
  min-width: 0;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  background: #fff;
}

.admin-price-list-sidebar,
.admin-price-list-detail {
  padding: 16px;
}

.admin-price-list-list {
  display: grid;
  gap: 6px;
  max-height: 430px;
  overflow: auto;
  padding-top: 10px;
}

.admin-price-list-row {
  width: 100%;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 3px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dce2e8;
  border-radius: 6px;
  background: #f8fafc;
  color: #071323;
  text-align: left;
  cursor: pointer;
}

.admin-price-list-row:hover {
  border-color: #aeb7bf;
  background: #fff;
}

.admin-price-list-row.is-selected {
  border-color: #bd7617;
  box-shadow: inset 3px 0 0 #bd7617;
  background: #fff8e8;
}

.admin-price-list-row strong {
  font-size: 15px;
}

.admin-price-list-row span,
.admin-price-list-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-price-list-row small {
  grid-column: 2;
  color: #5c6670;
  font-size: 12px;
}

.admin-price-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.admin-price-list-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #dce2e8;
  border-radius: 6px;
  background: #f8fafc;
  color: #46515c;
  font-size: 13px;
}

.admin-client-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
  margin-top: 10px;
}

.admin-client-search-field,
.admin-client-select-field,
.admin-client-address-field {
  grid-column: span 2;
}

.admin-client-date-field input {
  background: #f6f6f6;
  color: #46515c;
}

.admin-client-active-field input {
  justify-self: start;
  width: 20px;
  height: 20px;
}

.admin-client-info-field {
  grid-column: span 3;
}

.admin-terms-field {
  margin-top: 10px;
}

.admin-terms-field textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
}

.terms-gate-content ul,
#homeRulesContent ul,
#authTermsPreview ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.terms-gate-content li,
#homeRulesContent li,
#authTermsPreview li {
  margin: 3px 0;
}

.admin-client-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-self: end;
}

.admin-status-list,
.admin-edge-color-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.admin-status-row,
.admin-edge-color-row {
  display: grid;
  grid-template-columns: 70px 78px 44px minmax(160px, 0.8fr) minmax(240px, 1.4fr) 150px;
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid #d8e0e8;
  border-radius: 6px;
  background: #f8fafc;
}

.admin-status-row.is-disabled {
  border-style: dashed;
  background: #f2f4f6;
  opacity: 0.72;
}

.admin-status-row > strong {
  align-self: center;
  color: #172434;
  font-size: 14px;
}

.admin-status-active-field {
  align-content: end;
}

.admin-status-active-field input {
  width: 24px;
  height: 24px;
}

.admin-edge-color-row {
  grid-template-columns: 90px 44px minmax(180px, 1fr) minmax(130px, 0.4fr);
}

.admin-edge-color-row > strong {
  align-self: center;
  color: #172434;
  font-size: 14px;
}

.admin-edge-color-row small {
  align-self: center;
  color: #5e6875;
  font-size: 12px;
}

.admin-status-row input[type="color"],
.admin-edge-color-row input[type="color"] {
  width: 44px;
  height: 34px;
  padding: 2px;
  border: 1px solid #cfcfcf;
  background: #fff;
}

.admin-status-edit-info {
  align-self: center;
  color: #5e6875;
  font-size: 12px;
}

.admin-edge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.flow-section {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid #e8e8e8;
}

.section-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-left: 12px;
}

.section-label h2 {
  margin: 2px 0 0;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}

.collapse-dot {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  color: #777;
  flex: 0 0 auto;
}

.collapse-dot svg {
  width: 18px;
  height: 18px;
}

.section-body {
  min-width: 0;
}

.project-grid {
  width: min(714px, 100%);
  border-top: 1px solid var(--line);
}

.field-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 275px minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.field-row span {
  padding-left: 10px;
  font-size: 18px;
}

.field-row input,
.field-row select {
  width: 100%;
  height: 32px;
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 10px;
  color: #071323;
  outline: none;
}

.field-row select {
  border-color: #8f8f8f;
  border-radius: 18px;
  background: var(--field);
}

.field-row input[readonly] {
  color: #394553;
}

.field-row input:focus,
.field-row select:focus,
.inline-field input:focus,
.inline-field select:focus,
.detail-row input:focus,
.editor-toolbar input:focus,
.edge-row select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(169, 107, 37, 0.15);
}

.status-row {
  background: var(--accent);
  border-bottom: 0;
}

.status-row strong {
  padding: 0 10px;
  font-weight: 400;
}

.material-panel {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  width: 100%;
  min-height: 148px;
  padding: 16px;
  background: var(--panel-strong);
}

.material-panel.needs-selection {
  border: 1px solid #bb7b2e;
  background: #fff7df;
}

.decor-thumb {
  width: 116px;
  height: 116px;
  object-fit: cover;
  border: 1px solid #d0d0d0;
}

.material-copy {
  display: grid;
  gap: 12px;
  align-content: start;
}

.material-client-summary {
  display: grid;
  gap: 6px;
  align-content: start;
}

.material-kicker {
  color: var(--muted);
  font-size: 12px;
}

.material-client-summary strong {
  color: #172434;
  font-size: 22px;
  line-height: 1.1;
}

#selectedMaterialCode,
#selectedMaterialProducer {
  color: #1f2833;
  font-size: 15px;
  font-weight: 700;
}

#selectedMaterialProducer {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

#selectedMaterialSize {
  color: var(--muted);
  font-size: 13px;
}

.selected-edge-list,
.client-edge-list,
.material-picker-edges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.material-edge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid #cfcfcf;
  background: #fff;
  color: #1f2833;
  font-size: 12px;
}

.material-edge-chip.is-selectable {
  cursor: pointer;
}

.material-edge-chip.is-selectable:hover,
.material-edge-chip.is-selected {
  border-color: #bb7b2e;
  box-shadow: inset 0 0 0 1px #bb7b2e;
}

.material-edge-chip.is-selected {
  background: #fff4cf;
}

.material-edge-chip .swatch {
  width: 14px;
  height: 14px;
}

.choose-material-action {
  justify-self: start;
  margin-top: 2px;
  min-height: 32px;
}

.choose-material-action svg {
  width: 16px;
  height: 16px;
}

.material-facts {
  display: none;
}

.inline-field {
  display: grid;
  gap: 4px;
}

.inline-field span {
  color: #233244;
  font-size: 13px;
}

.inline-field input {
  width: 100%;
  height: 32px;
  border: 1px solid #c9c9c9;
  background: var(--field);
  padding: 4px 8px;
  outline: none;
}

.inline-field select {
  width: 100%;
  height: 32px;
  border: 1px solid #c9c9c9;
  background: var(--field);
  padding: 4px 8px;
  outline: none;
}

.inline-field input[readonly] {
  background: #f7f7f7;
  color: #394553;
}

.inline-field textarea {
  width: 100%;
  min-height: 76px;
  border: 1px solid #c9c9c9;
  background: var(--field);
  padding: 6px 8px;
  outline: none;
  resize: vertical;
  font: inherit;
}

.inline-field textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(169, 107, 37, 0.15);
}

.check-field {
  align-content: end;
}

.check-field input {
  width: 24px;
  height: 24px;
  justify-self: start;
  text-align: left;
}

.inline-field.wide input {
  height: 34px;
  font-size: 18px;
  font-weight: 700;
}

.inline-field.wide select {
  height: 34px;
  font-size: 17px;
  font-weight: 700;
}

.material-settings {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid #b5b5b5;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.segmented legend {
  display: none;
}

.segmented label {
  position: relative;
  min-width: 0;
}

.segmented input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 32px;
  place-items: center;
  color: #5d6570;
  font-size: 14px;
}

.segmented input:checked + span {
  background: #333;
  color: #fff;
}

.edge-catalog {
  display: grid;
  gap: 6px;
  align-content: start;
}

.edge-catalog-head,
.edge-catalog label {
  display: grid;
  grid-template-columns: 20px 1fr 88px;
  align-items: center;
  gap: 8px;
}

.edge-catalog-head {
  grid-template-columns: 20px 1fr 88px;
  color: #2f3a45;
  font-size: 13px;
  border-bottom: 1px solid #ad7a3c;
  padding-bottom: 4px;
}

.edge-catalog-head span:first-child {
  grid-column: 1 / 3;
}

.edge-catalog label {
  font-size: 14px;
}

.edge-catalog input {
  height: 28px;
  border: 1px solid #c6c6c6;
  background: #fff;
  padding: 3px 6px;
  text-align: right;
}

.swatch {
  width: 18px;
  height: 18px;
  border: 1px solid #d2cbc3;
  background-image: url("./assets/dekor-akacja-ksiezycowa.png");
  background-size: cover;
}

.material-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.38);
}

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

.material-picker-overlay.is-required {
  background: rgba(0, 0, 0, 0.52);
}

.material-picker-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 56px));
  border: 1px solid #bdbdbd;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.material-picker-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e1e1e1;
  background: linear-gradient(#f5f5f5, #e5e5e5);
}

.material-picker-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 400;
}

.material-picker-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.material-picker-filters {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr);
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid #e2e2e2;
  background: #fafafa;
}

.material-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  overflow: auto;
  padding: 14px;
}

.material-option {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 124px;
  border: 1px solid #d2d2d2;
  background: #fff;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.material-picker-empty {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed #cfcfcf;
  background: #fafafa;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.material-option:hover,
.material-option.selected {
  border-color: #bb7b2e;
  box-shadow: inset 0 0 0 1px #bb7b2e;
}

.material-option img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border: 1px solid #d2d2d2;
}

.material-option-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.material-option-body strong,
.material-option-body span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-option-body strong {
  color: #172434;
  font-size: 15px;
}

.material-option-code {
  color: #1f2833;
  font-size: 13px;
  font-weight: 700;
}

.material-option-producer,
.material-option-size,
.material-option-mode {
  color: var(--muted);
  font-size: 12px;
}

.material-option-producer {
  font-weight: 700;
  text-transform: uppercase;
}

.hint-panel {
  display: grid;
  grid-template-columns: 210px 1fr;
  align-items: center;
  min-height: 126px;
  margin-bottom: 18px;
  padding: 22px 26px;
  border-radius: 18px;
  background: var(--accent-soft);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
}

.hint-panel svg {
  width: 44px;
  height: 44px;
  color: #555;
}

.hint-panel ul {
  margin: 0;
  padding-left: 21px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.first-part-cta {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: min(100%, 1020px);
  min-height: 64px;
  margin: 0 0 18px;
  border: 2px solid #bb7b2e;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(187, 123, 46, 0.18);
}

body.project-parts-empty:not(.project-material-missing) .first-part-cta {
  display: inline-flex;
}

body.project-edit-locked .first-part-cta {
  display: none;
}

.first-part-cta:hover {
  background: #fff5cd;
}

.first-part-cta:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

.first-part-cta-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #bb7b2e;
  background: var(--accent);
  color: #222;
}

.first-part-cta-icon svg {
  width: 23px;
  height: 23px;
  stroke-width: 2.5;
}

.formatka-editor {
  border: 1px solid #c9c9c9;
  background: #fff;
}

.editor-toolbar {
  display: grid;
  grid-template-columns: 32px 30px 76px 76px 30px 62px 34px repeat(5, 32px) minmax(96px, 1fr) minmax(96px, 1fr) repeat(4, 28px);
  gap: 4px;
  align-items: center;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid #bb7b2e;
  border-left: 0;
  border-right: 0;
  background: #fff;
}

.icon-button,
.primary-action {
  border: 1px solid #d0d0d0;
  background: #f5f5f5;
  color: #616161;
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 32px;
  padding: 0;
}

.icon-button:hover,
.primary-action:hover {
  border-color: var(--focus);
  color: #222;
}

.icon-button.selected {
  color: #526270;
  border-color: transparent;
  background: #fff;
}

.icon-button.danger:hover {
  color: var(--danger);
}

.icon-button.grain-toggle.is-active {
  color: #343434;
  border-bottom: 4px solid #c6bfb3;
  background: #f3f3f3;
}

.icon-button.grain-toggle:not(.is-active) {
  color: #27313d;
}

.icon-button.edge-toggle {
  color: #878787;
}

.icon-button.edge-toggle.is-active {
  color: #4d4d4d;
  border-bottom: 4px solid #c6bfb3;
  background: #f3f3f3;
}

.icon-button.edge-toggle:not(.is-active) {
  color: #8f8f8f;
}

.icon-button.edge-toggle:hover {
  border-color: var(--focus);
}

.icon-button.add-part-icon-action {
  border-color: #1f8f4d;
  background: #e7f7ee;
  color: #126738;
  box-shadow: inset 0 0 0 1px #65c98f;
}

.icon-button.add-part-icon-action:hover {
  border-color: #126738;
  background: #d4f1e0;
  color: #0d512b;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.25;
}

.primary-action {
  grid-auto-flow: column;
  gap: 8px;
  min-width: 150px;
  padding: 0 14px;
  border-color: #a76820;
  background: #fff;
  color: #252525;
}

.secondary-action {
  min-height: 30px;
  border: 1px solid #bdbdbd;
  background: #fff;
  color: #27313d;
  padding: 0 12px;
}

.secondary-action:hover {
  border-color: var(--focus);
}

.secondary-action:disabled,
.icon-button:disabled,
.primary-action:disabled {
  opacity: 0.45;
  cursor: default;
}

.danger-action:hover {
  color: var(--danger);
}

.primary-action svg {
  width: 18px;
  height: 18px;
}

.import-parts-action {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
}

.order-flow-action {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  min-width: 138px;
}

.import-parts-action svg,
.order-flow-action svg {
  width: 17px;
  height: 17px;
}

.part-index,
.unit {
  color: #525252;
  text-align: center;
}

.dim-input,
.qty-input,
.text-chip {
  height: 28px;
  border: 1px solid #9b9b9b;
  background: #fff;
  color: #1f2833;
  outline: none;
  padding: 2px 6px;
}

.dim-input {
  text-align: center;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px #e4e4e4;
}

.qty-input {
  font-weight: 700;
  text-align: center;
}

.dim-input.is-required-missing,
.qty-input.is-required-missing {
  background: #fff8cf;
  border-color: #d8a917;
  box-shadow: inset 0 0 0 1px #f0d984;
}

.formatka-editor.is-draft .piece-drawing {
  border-style: dashed;
}

.formatka-editor.is-empty .piece-drawing {
  background: #f4f4f4;
  border-style: dashed;
}

.formatka-editor.is-empty .grain-mark,
.formatka-editor.is-empty .edge-label,
.formatka-editor.is-empty .dimension {
  opacity: 0.35;
}

.empty-editor-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.qty-input {
  text-align: center;
}

.text-chip {
  min-width: 0;
  background: #fff;
}

.text-chip::placeholder,
.detail-row input::placeholder {
  color: #aeb4ba;
}

.editor-content {
  display: grid;
  grid-template-columns: 48% 52%;
  min-height: 448px;
}

.part-visual {
  display: grid;
  place-items: center;
  border-right: 1px solid #e2e2e2;
  padding: 32px 26px 38px;
}

.piece-drawing {
  position: relative;
  width: min(82%, 470px);
  aspect-ratio: 2 / 1;
  display: grid;
  place-items: center;
  border: 3px solid #5d5d5d;
  background: #e8e8e8;
  box-shadow: inset 0 0 0 1px #cdcdcd;
}

.piece-drawing::before,
.piece-drawing::after {
  content: "";
  position: absolute;
  inset: -8px;
  pointer-events: none;
}

.piece-drawing.edge-top {
  border-top-color: #5d5d5d;
}

.piece-drawing.edge-right {
  border-right-color: #5d5d5d;
}

.piece-drawing.edge-bottom {
  border-bottom-color: #5d5d5d;
}

.piece-drawing.edge-left {
  border-left-color: #5d5d5d;
}

.drawing-edge {
  position: absolute;
  z-index: 2;
  display: none;
  background: var(--edge);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.96),
    0 0 0 2px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.drawing-edge-top {
  top: -2px;
  left: 22px;
  right: 22px;
  height: 8px;
}

.drawing-edge-right {
  top: 22px;
  right: -2px;
  bottom: 22px;
  width: 8px;
}

.drawing-edge-bottom {
  right: 22px;
  bottom: -2px;
  left: 22px;
  height: 8px;
}

.drawing-edge-left {
  top: 22px;
  bottom: 22px;
  left: -2px;
  width: 8px;
}

.piece-drawing.edge-top .drawing-edge-top,
.piece-drawing.edge-right .drawing-edge-right,
.piece-drawing.edge-bottom .drawing-edge-bottom,
.piece-drawing.edge-left .drawing-edge-left {
  display: block;
}

.edge-label,
.dimension {
  position: absolute;
  z-index: 4;
  color: #000;
  font-size: 18px;
  line-height: 1;
  text-shadow:
    -1px 0 #fff,
    0 1px #fff,
    1px 0 #fff,
    0 -1px #fff;
}

.edge-label.top {
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
}

.edge-label.right {
  right: -22px;
  top: 50%;
  transform: translateY(-50%);
}

.edge-label.bottom {
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%);
}

.edge-label.left {
  left: -22px;
  top: 50%;
  transform: translateY(-50%);
}

.dimension.width {
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
}

.dimension.height {
  left: 5px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
}

.grain-mark svg {
  width: 28px;
  height: 28px;
  color: #27313d;
}

.grain-mark.is-free svg {
  width: 24px;
  height: 24px;
}

.part-details {
  padding: 22px 12px 24px 46px;
}

.detail-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 0;
  margin-bottom: 8px;
}

.detail-row span,
.edge-editor p,
.templates > span {
  font-size: 18px;
  color: #101010;
}

.detail-row input {
  height: 28px;
  border: 1px solid #c9c9c9;
  background: #fafafa;
  padding: 3px 6px;
  outline: none;
}

.detail-row .barcode-input {
  background: #f3f3f3;
  color: #172434;
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  font-weight: 700;
}

.edge-editor {
  margin-top: 24px;
}

.edge-editor p {
  margin: 0 0 12px;
}

.edge-row {
  display: grid;
  grid-template-columns: 44px minmax(130px, 208px) 118px;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.edge-row label {
  font-size: 18px;
}

.edge-row select {
  height: 28px;
  min-width: 0;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  background: #fbfbfb;
  color: #8f8f8f;
  padding: 2px 12px;
  outline: none;
}

.edge-row .edge-select {
  padding-left: 30px;
  background-image: url("./assets/dekor-akacja-ksiezycowa.png");
  background-size: 18px 18px;
  background-position: 10px center;
  background-repeat: no-repeat;
}

.edge-row .edge-select.raw {
  background-image: none;
  text-align: center;
  padding-left: 12px;
}

.templates {
  margin-top: 34px;
}

.template-buttons {
  display: grid;
  grid-template-columns: repeat(12, 22px);
  gap: 6px;
  margin-top: 12px;
}

.template-button {
  width: 22px;
  height: 22px;
  border: 2px solid #bcbcbc;
  background: #fff;
  position: relative;
  padding: 0;
}

.template-button.active,
.template-button:hover {
  border-color: #222;
}

.template-button::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-color: #111;
  border-style: solid;
  border-width: var(--t, 0) var(--r, 0) var(--b, 0) var(--l, 0);
}

.parts-table-wrap {
  margin-top: 18px;
  border: 1px solid #d4d4d4;
  background: #fff;
  overflow-x: auto;
}

.parts-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.parts-table th,
.parts-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e3e3e3;
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

.parts-table th {
  color: #52606f;
  background: #f6f6f6;
  font-weight: 700;
}

.parts-table tr.is-selected {
  background: #fff8cc;
}

.parts-empty-row td {
  color: #5f6670;
  background: #fbfbfb;
  font-size: 15px;
  white-space: normal;
}

.parts-table .editor-cell {
  padding: 0;
  border-top: 4px solid #151515;
  border-bottom: 4px solid #151515;
  white-space: normal;
}

.part-editor-row .formatka-editor {
  border: 0;
}

.part-editor-row .editor-toolbar {
  border-top: 0;
}

.parts-table button {
  border: 1px solid #d0d0d0;
  background: #fff;
  min-height: 28px;
  padding: 0 9px;
}

.board-preview-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed #b8b8b8;
  background: #fbfbfb;
  color: #5d6672;
  font-size: 16px;
}

.parts-import-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.24);
}

.parts-import-dialog {
  position: relative;
  width: min(1344px, calc(100vw - 36px));
  min-height: min(790px, calc(100vh - 36px));
  padding: 22px 62px 36px 68px;
  border: 1px solid #a9a9a9;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.parts-import-dialog h2 {
  margin: 0 0 22px;
  color: #666;
  font-size: 31px;
  font-weight: 400;
  letter-spacing: 0;
}

.optimization-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.42);
}

.optimization-progress-dialog {
  width: min(430px, 100%);
  padding: 28px 32px;
  border: 1px solid #bdbdbd;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.optimization-progress-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 4px solid #e4e4e4;
  border-top-color: var(--focus);
  border-radius: 50%;
  animation: optimization-spin 0.85s linear infinite;
}

.optimization-progress-dialog h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 400;
}

.optimization-progress-dialog p {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.35;
}

.optimization-progress-time {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 18px;
  border: 1px solid #d6d6d6;
  background: #fafafa;
}

.optimization-progress-time span {
  color: var(--muted);
  font-size: 13px;
}

.optimization-progress-time strong {
  min-width: 54px;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@keyframes optimization-spin {
  to {
    transform: rotate(360deg);
  }
}

.import-window-control {
  position: absolute;
  top: 13px;
  right: 22px;
  border: 0;
  background: transparent;
  color: #6d6d6d;
}

.import-grid-wrap {
  width: 100%;
  height: min(574px, calc(100vh - 212px));
  overflow: auto;
  border-top: 1px solid #d2d2d2;
  border-left: 1px solid #d2d2d2;
  background: #fff;
}

.import-grid {
  width: 100%;
  min-width: 1204px;
  border-collapse: collapse;
  table-layout: fixed;
}

.import-grid th,
.import-grid td {
  height: 28px;
  border-right: 1px solid #cfcfcf;
  border-bottom: 1px solid #cfcfcf;
  padding: 0;
  color: #272727;
  font-size: 18px;
  font-weight: 400;
}

.import-grid th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 32px;
  background: #eeeeee;
  text-align: center;
}

.import-grid .row-head,
.import-grid .row-number {
  width: 48px;
  background: #ededed;
  text-align: center;
}

.import-grid .row-number {
  color: #202020;
}

.import-grid th:nth-child(2),
.import-grid th:nth-child(3) {
  width: 100px;
}

.import-grid th:nth-child(4) {
  width: 68px;
}

.import-grid th:nth-child(5) {
  width: 112px;
}

.import-grid th:nth-child(6),
.import-grid th:nth-child(7),
.import-grid th:nth-child(8),
.import-grid th:nth-child(9) {
  width: 100px;
}

.import-grid th:nth-child(10) {
  width: 150px;
}

.import-grid th:nth-child(11) {
  width: 225px;
}

.import-grid input {
  width: 100%;
  height: 27px;
  border: 0;
  outline: none;
  background: transparent;
  padding: 2px 6px;
  color: #626262;
  text-align: right;
}

.import-grid input[data-import-col="feature"],
.import-grid input[data-import-col="description"] {
  text-align: left;
}

.import-grid input:focus {
  box-shadow: inset 0 0 0 2px #4a75ff;
  color: #e00000;
}

.import-footer {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding-top: 12px;
}

.import-footer p {
  margin: 0;
  color: #b13b35;
  font-size: 18px;
}

.import-footer p.is-error {
  font-weight: 700;
}

.import-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.import-confirm-actions .secondary-action {
  min-width: 126px;
  min-height: 38px;
  font-size: 20px;
  color: #666;
}

.soft-action {
  justify-self: end;
  min-width: 136px;
  border-radius: 16px;
  color: #777;
}

.quote-panel {
  margin: 0 0 0 310px;
  border: 1px solid #d1d1d1;
  background: #fff;
}

.quote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px;
  border-bottom: 1px solid #e1e1e1;
}

.quote-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
}

.quote-head span {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #b7b7b7;
  border-radius: 16px;
  color: #333;
  background: #f9f9f9;
  font-size: 13px;
}

.quote-metrics {
  margin: 0;
  padding: 10px 18px 0;
}

.quote-metrics div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #ededed;
}

.quote-metrics dt {
  color: #5d6570;
}

.quote-metrics dd {
  margin: 0;
  font-weight: 700;
}

.price-pending {
  color: #69717b;
  font-weight: 600;
}

.quote-note {
  margin: 8px 18px 0;
  color: #4f5b66;
  font-size: 13px;
}

.quote-note[hidden] {
  display: none;
}

.edge-breakdown {
  padding: 8px 18px 0;
}

.sheet-limit-note {
  margin: 10px 18px 0;
  padding: 8px 10px;
  border: 1px solid #dfdfdf;
  background: #fafafa;
  color: #4f5b66;
  font-size: 13px;
}

.sheet-limit-note.is-warning {
  border-color: #c88b20;
  background: #fff3c4;
  color: #3d2c0c;
}

.edge-line {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 5px 0;
  color: #4f5b66;
  font-size: 13px;
}

.edge-line small {
  display: block;
  margin-top: 2px;
  color: #6f7b86;
  font-size: 12px;
}

.total-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-top: 12px;
  padding: 16px 18px;
  background: var(--accent);
  font-size: 20px;
}

.total-row strong {
  font-size: 24px;
}

.layout-run-panel {
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e2e2;
  background: #f7f7f7;
}

.layout-run-panel .primary-action {
  min-height: 38px;
  justify-content: center;
}

.layout-run-panel span {
  color: #4f5b66;
  font-size: 13px;
}

.layout-run-panel span.is-warning {
  color: #8a4f00;
  font-weight: 700;
}

.layout-run-panel span.is-ready {
  color: #236032;
  font-weight: 700;
}

.layout-preview {
  padding: 16px 18px 18px;
}

.layout-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

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

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

.sheet-panel {
  display: grid;
  gap: 6px;
}

.sheet-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #1f2833;
  font-size: 13px;
}

.sheet-panel-head strong {
  font-size: 14px;
}

.sheet-panel-head span {
  color: var(--muted);
}

.board-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 2800 / 2070;
  border: 2px solid #767676;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    #f3eee8;
  background-size: 28px 28px;
  overflow: hidden;
}

.placed-piece {
  position: absolute;
  border: 1px solid #4f4f4f;
  background: rgba(255, 255, 255, 0.74);
  color: #1f2833;
  overflow: hidden;
}

.cut-line {
  position: absolute;
  z-index: 2;
  pointer-events: none;
}

.cut-line.horizontal {
  height: 0;
  border-top: 2px solid #1f6fb2;
}

.cut-line.vertical {
  width: 0;
  border-left: 2px solid #1f6fb2;
}

.cut-line-stage-2.horizontal {
  border-top-color: #303943;
  border-top-style: dashed;
}

.cut-line-stage-2.vertical {
  border-left-color: #303943;
  border-left-style: dashed;
}

.cut-line-stage-3.horizontal {
  border-top-color: #8b5d2a;
  border-top-style: dotted;
}

.cut-line-stage-3.vertical {
  border-left-color: #8b5d2a;
  border-left-style: dotted;
}

.cut-line b {
  position: absolute;
  top: -16px;
  left: 3px;
  min-width: 22px;
  padding: 1px 3px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.9);
  color: #1f6fb2;
  font-size: 9px;
  line-height: 1.1;
  white-space: nowrap;
}

.cut-line-stage-2 b {
  color: #303943;
}

.half-sheet-unused {
  position: absolute;
  z-index: 1;
  background:
    repeating-linear-gradient(45deg, rgba(82, 90, 98, 0.22) 0 8px, rgba(82, 90, 98, 0.34) 8px 12px),
    rgba(128, 128, 128, 0.28);
  pointer-events: none;
}

.half-sheet-cut-line {
  position: absolute;
  z-index: 4;
  color: #0f5c9e;
  pointer-events: none;
}

.half-sheet-cut-line.horizontal {
  height: 0;
  border-top: 3px solid #0f5c9e;
}

.half-sheet-cut-line.vertical {
  width: 0;
  border-left: 3px solid #0f5c9e;
}

.half-sheet-cut-line b {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 2px 6px;
  border: 1px solid #0f5c9e;
  background: #fff;
  color: #0f5c9e;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

.half-sheet-cut-line.horizontal b {
  top: -22px;
}

.cutting-thumb-board .cut-line.horizontal,
.cutting-thumb-board .cut-line.vertical {
  border-width: 1px;
}

.cutting-thumb-board .cut-line b,
.cutting-thumb-board .half-sheet-cut-line b {
  display: none;
}

.cutting-thumb-board .half-sheet-cut-line.horizontal,
.cutting-thumb-board .half-sheet-cut-line.vertical {
  border-width: 1px;
}

.piece-edge {
  position: absolute;
  z-index: 3;
  display: block;
  background: var(--edge);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.96),
    0 0 0 2px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.piece-edge-top {
  top: 0;
  left: max(4px, 8%);
  right: max(4px, 8%);
  height: 5px;
}

.piece-edge-right {
  top: max(4px, 8%);
  right: 0;
  bottom: max(4px, 8%);
  width: 5px;
}

.piece-edge-bottom {
  right: max(4px, 8%);
  bottom: 0;
  left: max(4px, 8%);
  height: 5px;
}

.piece-edge-left {
  top: max(4px, 8%);
  bottom: max(4px, 8%);
  left: 0;
  width: 5px;
}

.trim-zone {
  position: absolute;
  border: 1px dashed #b77d2f;
  background: rgba(255, 216, 75, 0.08);
  pointer-events: none;
}

.placed-piece strong {
  position: relative;
  z-index: 4;
  display: block;
  padding: 4px 5px 0;
  font-size: 11px;
  line-height: 1;
}

.placed-piece span {
  position: relative;
  z-index: 4;
  display: block;
  padding: 2px 5px;
  font-size: 10px;
  color: #52606f;
}

.placed-piece em {
  position: relative;
  z-index: 4;
  display: block;
  max-width: 100%;
  padding: 1px 5px 0;
  color: #1f2833;
  font-size: 10px;
  font-style: normal;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cut-sequence {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dedede;
  background: #fafafa;
  color: #172434;
  font-size: 12px;
}

.cut-sequence > strong {
  font-size: 13px;
}

.cut-sequence > span {
  color: var(--muted);
  line-height: 1.25;
}

.cut-sequence-stage {
  display: grid;
  gap: 4px;
}

.cut-sequence-stage b {
  font-size: 12px;
}

.cut-sequence-stage > span {
  color: #52616f;
  font-size: 11px;
  line-height: 1.3;
}

.cut-sequence ol {
  margin: 0;
  padding-left: 22px;
}

.cut-sequence li {
  margin: 2px 0;
}

.cut-sequence.compact {
  border-width: 0;
  border-top: 1px solid #e4e4e4;
  background: #fff;
  font-size: 11px;
}

.eme-cookie-banner,
.eme-cookie-modal {
  color: #102033;
  font-family: "Segoe UI", Arial, sans-serif;
}

.eme-cookie-banner[hidden],
.eme-cookie-modal[hidden] {
  display: none !important;
}

.eme-cookie-banner {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 9990;
  width: min(1120px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(37, 57, 76, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(16, 32, 51, 0.22);
}

.eme-cookie-banner__title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.eme-cookie-banner__text {
  margin: 0;
  color: #31475f;
  font-size: 14px;
  line-height: 1.45;
}

.eme-cookie-actions,
.eme-cookie-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.eme-cookie-btn {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #cfd7df;
  border-radius: 6px;
  background: #edf2f6;
  color: #102033;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.eme-cookie-btn:hover,
.eme-cookie-btn:focus-visible {
  border-color: #9db0c2;
  background: #e4ebf1;
  outline: none;
}

.eme-cookie-btn--primary {
  border-color: #2d7448;
  background: #3f8a58;
  color: #fff;
}

.eme-cookie-btn--primary:hover,
.eme-cookie-btn--primary:focus-visible {
  background: #327748;
}

.eme-cookie-btn--light {
  background: #fff8e8;
  border-color: #dca542;
}

.eme-cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(10, 16, 24, 0.68);
}

.eme-cookie-lock {
  overflow: hidden;
}

.eme-cookie-dialog {
  width: min(900px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.eme-cookie-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 30px;
  border-bottom: 1px solid #e3e8ed;
}

.eme-cookie-dialog__header h2 {
  margin: 0;
  color: #17314d;
  font-size: 22px;
}

.eme-cookie-close {
  width: 42px;
  height: 42px;
  border: 1px solid #d7dfe7;
  border-radius: 6px;
  background: #f2f5f7;
  color: #17314d;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.eme-cookie-dialog__body {
  overflow-y: auto;
  padding: 24px 30px;
}

.eme-cookie-dialog__body h3 {
  margin: 0 0 12px;
  color: #263f5a;
  font-size: 19px;
}

.eme-cookie-dialog__body p {
  margin: 0 0 18px;
  color: #31475f;
  font-size: 15px;
  line-height: 1.55;
}

.eme-cookie-category {
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid #d6e0e8;
  border-radius: 6px;
  background: #f4f7f9;
}

.eme-cookie-category__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
}

.eme-cookie-category__name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: #263f5a;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.eme-cookie-chevron {
  font-size: 22px;
  transition: transform 0.18s ease;
}

.eme-cookie-category.is-open .eme-cookie-chevron {
  transform: rotate(90deg);
}

.eme-cookie-category__description {
  display: none;
  padding: 0 18px 16px 50px;
  color: #415870;
  font-size: 14px;
  line-height: 1.45;
}

.eme-cookie-category.is-open .eme-cookie-category__description {
  display: block;
}

.eme-cookie-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 62px;
  height: 32px;
  border-radius: 999px;
  background: #96a4af;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.eme-cookie-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.eme-cookie-switch__knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(16, 32, 51, 0.2);
  transition: transform 0.18s ease;
}

.eme-cookie-switch.is-on {
  background: #3f8a58;
}

.eme-cookie-switch.is-on .eme-cookie-switch__knob {
  transform: translateX(30px);
}

.eme-cookie-switch.is-disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.eme-cookie-consent-info {
  padding: 12px 14px;
  border: 1px solid #dce4eb;
  border-radius: 6px;
  background: #f8fafc;
  color: #40576e;
  font-size: 13px;
  line-height: 1.45;
}

.eme-cookie-dialog__footer {
  padding: 16px 30px 20px;
  border-top: 1px solid #e3e8ed;
}

.admin-cookie-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(190px, 260px);
  gap: 12px;
  margin-bottom: 12px;
}

.admin-cookie-table-wrap {
  overflow: auto;
  border: 1px solid #d6dfe8;
  border-radius: 8px;
  background: #fff;
  max-height: 520px;
}

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

.admin-cookie-table th,
.admin-cookie-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
  vertical-align: top;
}

.admin-cookie-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f5f8;
  color: #31475f;
  font-weight: 700;
}

.admin-cookie-table td:nth-child(5),
.admin-cookie-table td:nth-child(10),
.admin-cookie-table td:nth-child(11) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-cookie-empty {
  height: 130px;
  color: var(--muted);
  text-align: center !important;
  vertical-align: middle !important;
}

@media (max-width: 1180px) {
  .quote-panel {
    margin-left: 0;
  }

  .management-view {
    margin-left: 0;
  }

  .scanner-view {
    margin-left: 0;
  }

  .account-shell {
    grid-template-columns: 1fr;
  }

  .scanner-result-layout {
    grid-template-columns: 1fr;
  }

  .home-panel {
    grid-template-columns: 1fr;
  }

  .material-panel {
    grid-template-columns: 116px 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100vw - 24px, 760px);
  }

  .topbar,
  .topbar-actions {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .view-tabs {
    flex-wrap: wrap;
  }

  .admin-tools,
  .cut-workbar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .admin-tools {
    margin-top: 14px;
  }

  .brand-block {
    min-width: 0;
  }

  .brand-logo {
    width: 74px;
    max-height: 52px;
  }

  .admin-logo-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .label-logo-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .scanner-form,
  .scanner-info-grid,
  .scanner-edge-list,
  .account-data-row {
    grid-template-columns: 1fr;
  }

  .account-card {
    padding: 22px 18px 28px;
  }

  .account-stats {
    grid-template-columns: 1fr;
  }

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

  .flow-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section-label {
    padding-left: 0;
  }

  .field-row {
    grid-template-columns: 1fr;
    padding: 6px 0;
  }

  .field-row span {
    padding: 0 8px 4px;
  }

  .material-panel,
  .editor-content {
    grid-template-columns: 1fr;
  }

  .material-facts {
    display: none;
  }

  .decor-thumb {
    width: min(100%, 220px);
    height: auto;
    aspect-ratio: 1;
  }

  .material-picker-overlay {
    padding: 10px;
    align-items: start;
  }

  .material-picker-dialog {
    max-height: calc(100vh - 20px);
  }

  .material-picker-head {
    padding: 14px;
  }

  .material-picker-head h2 {
    font-size: 24px;
  }

  .material-picker-filters {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .material-picker-grid {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .hint-panel {
    grid-template-columns: 54px 1fr;
    padding: 18px;
  }

  .first-part-cta {
    min-height: 56px;
    font-size: 17px;
  }

  .layout-run-panel {
    grid-template-columns: 1fr;
  }

  .editor-toolbar {
    grid-template-columns: repeat(4, minmax(32px, auto));
  }

  .parts-import-overlay {
    padding: 10px;
    align-items: start;
  }

  .parts-import-dialog {
    width: 100%;
    min-height: auto;
    padding: 20px 14px 24px;
    border-radius: 10px;
  }

  .parts-import-dialog h2 {
    padding-right: 34px;
    font-size: 24px;
  }

  .import-grid-wrap {
    height: min(560px, calc(100vh - 190px));
  }

  .import-footer {
    grid-template-columns: 1fr;
  }

  .import-confirm-actions {
    justify-content: stretch;
  }

  .import-confirm-actions .secondary-action,
  .soft-action {
    width: 100%;
  }

  .part-details {
    padding: 20px;
  }

  .admin-material-browser,
  .admin-price-list-browser,
  .admin-material-form-layout,
  .admin-material-grid,
  .admin-price-list-grid,
  .admin-client-grid,
  .admin-status-row,
  .admin-edge-grid,
  .project-filter-grid {
    grid-template-columns: 1fr;
  }

  .project-status-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-tab-panels {
    padding: 14px;
  }

  .admin-tab-panel {
    padding: 14px;
  }

  .admin-tab {
    flex: 1 1 170px;
  }

  .admin-client-search-field,
  .admin-client-select-field,
  .admin-client-address-field,
  .admin-client-info-field {
    grid-column: auto;
  }

  .admin-client-actions {
    justify-content: stretch;
  }

  .admin-client-actions .secondary-action {
    flex: 1 1 180px;
  }

  .project-board {
    max-height: 520px;
  }

  .cutting-job-bar,
  .cutting-workbench {
    grid-template-columns: 1fr;
  }

  .cutting-sheets {
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
    max-height: none;
    overflow: visible;
  }

  .cutting-piece-list {
    position: static;
    max-height: none;
  }

  .cutting-board-stage {
    min-height: auto;
  }

  .cutting-board {
    width: min(100%, 520px);
    height: auto;
  }
}
