:root {
  color-scheme: light;
  --ink: #20231f;
  --muted: #667064;
  --line: #dfe5dc;
  --panel: #ffffff;
  --paper: #f6f8f4;
  --accent: #2f6f4e;
  --accent-2: #b98032;
  --danger: #b33a3a;
  --warn: #946110;
  --ok: #2b7252;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  display: grid;
  grid-template-columns: 256px 1fr;
}
body:not(.is-authenticated) {
  grid-template-columns: 1fr;
  overflow: hidden;
}
body:not(.is-authenticated) .sidebar,
body:not(.is-authenticated) .shell {
  display: none;
}
body:not(.is-authenticated)::after {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #17241d 0%, #2f6f4e 58%, #b98032 100%);
}
body.is-authenticated .login-screen {
  display: none;
}
.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}
.login-brand {
  color: var(--ink);
  margin-bottom: 4px;
}
.login-brand span {
  color: var(--muted);
}
.login-error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--danger);
  font-weight: 700;
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button, .import {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 7px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
button:disabled {
  cursor: not-allowed;
  opacity: .55;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 7px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  text-decoration: none;
}
.ghost { background: #eef3eb; color: var(--ink); }
.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  background: #eef3eb;
  color: var(--ink);
}

.sidebar {
  background: #17241d;
  color: white;
  min-height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}
.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}
.brand-mark {
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-2);
  font-weight: 900;
}
.brand span { display: block; color: #bac9bd; font-size: 12px; margin-top: 3px; }
nav { display: grid; gap: 8px; }
.nav-group {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}
.nav-group summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  color: #b8c8bd;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.nav-group summary::-webkit-details-marker {
  display: none;
}
.nav-group summary::after {
  content: "+";
  float: right;
  color: #dbe7dc;
}
.nav-group[open] summary::after {
  content: "-";
}
.nav-group[open] summary {
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.nav-group-items {
  display: grid;
  gap: 4px;
  padding: 6px;
}
.nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #dbe7dc;
  border-radius: 6px;
  padding: 9px 10px;
}
.nav-btn.active, .nav-btn:hover { background: #2b3b32; color: white; }

.shell { min-width: 0; }
.topbar {
  min-height: 92px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 244, .88);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
}
#eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; }
.actions { display: flex; gap: 10px; align-items: center; }
.mobile-menu-btn {
  display: none;
}
.save-status {
  border: 1px solid #cfe2d4;
  border-radius: 999px;
  background: #eef7ef;
  color: #24653f;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  white-space: nowrap;
}
.save-status[data-status="saving"] {
  background: #fff8e7;
  border-color: #efd89a;
  color: #805b00;
}
.save-status[data-status="error"] {
  background: #fdecec;
  border-color: #efb9b9;
  color: #9a2828;
}
.import input { display: none; }
.content { padding: 24px 28px 40px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi, .panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.kpi { padding: 16px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { display: block; font-size: 25px; margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { padding: 18px; min-width: 0; }
.panel h2 { font-size: 18px; margin-bottom: 12px; }
.toolbar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search {
  min-width: min(420px, 100%);
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: white;
}
.compact-select {
  width: auto;
  min-width: 220px;
}
.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.segmented button {
  background: #eef3eb;
  color: var(--ink);
  padding: 9px 12px;
}
.segmented button.active {
  background: var(--accent);
  color: white;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}
th {
  color: #435045;
  background: #eef3eb;
  position: sticky;
  top: 0;
}
tr:hover td { background: #fafbf9; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.mini { padding: 7px 9px; font-size: 13px; }
.danger { background: #f5e8e8; color: var(--danger); }
.danger-zone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  border: 1px solid #e8bcbc;
  background: #fff8f8;
}
.danger-zone h2 {
  color: var(--danger);
}
.danger-zone p {
  max-width: 760px;
}
.pay { background: #e2f0e9; color: var(--ok); }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}
.status.pago { color: var(--ok); background: #e7f3ed; }
.status.atraso { color: var(--danger); background: #f7e9e9; }
.status.hoje { color: var(--warn); background: #fff2d7; }
.status.prazo { color: #31547a; background: #e8f0f9; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; }
.card { padding: 16px; }
.card strong { display: block; margin-bottom: 6px; }
.finance-hub-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 12px;
}
.finance-hub-card {
  display: grid;
  gap: 6px;
  text-align: left;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  box-shadow: none;
}
.finance-hub-card:hover,
.finance-hub-card:focus {
  border-color: #2f7654;
  background: #f4f8f1;
}
.finance-hub-card span {
  color: var(--accent);
  font-weight: 900;
}
.finance-hub-card strong {
  font-size: 22px;
}
.finance-hub-card small {
  color: var(--muted);
}
.finance-hub-card em {
  margin-top: 4px;
  color: #2f7654;
  font-style: normal;
  font-weight: 900;
}
.muted { color: var(--muted); }
.form-message {
  min-height: 20px;
  margin: -2px 0 12px;
  color: var(--danger);
  font-weight: 700;
  font-size: 14px;
}
.rt-result {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px;
  margin: 4px 0 14px;
  border-radius: 8px;
  background: #eef3eb;
}
.rt-result span {
  color: var(--muted);
  font-weight: 700;
}
.rt-result strong {
  font-size: 24px;
}
.rt-history {
  margin-top: 16px;
}
.print-title {
  display: none;
}
.hr-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}
.employee-register-panel {
  align-self: start;
  padding: 0;
  width: 100%;
}
.employee-register summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 800;
  color: var(--accent);
}
.employee-register[open] {
  padding: 0 16px 14px;
}
.employee-register[open] summary {
  margin: 0 -16px;
}
.compact-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 8px 0 10px;
}
.time-clock-panel {
  margin-bottom: 16px;
}
.time-clock-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: stretch;
}
.time-clock-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3eb;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 150px;
}
.time-clock-card strong {
  font-size: 34px;
}
.point-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
}
.point-summary-table {
  margin-top: 12px;
}
.point-map-link {
  display: inline-flex;
  margin-right: 6px;
  text-decoration: none;
}
.point-map-link + small {
  color: var(--muted);
  white-space: nowrap;
}
.point-report-panel {
  margin-top: 16px;
}
.point-report-toolbar {
  align-items: end;
}
.inline-field {
  display: grid;
  gap: 4px;
}
.inline-field span {
  color: var(--muted);
  font-size: 12px;
}
.payroll-point-tools {
  justify-content: flex-start;
  margin: 8px 0 12px;
}
.payroll-point-tools .muted {
  align-self: center;
}
.field-control-grid {
  align-items: start;
}
.field-subtable {
  margin-top: 12px;
}
.field-media-list figure {
  display: grid;
  grid-template-rows: auto auto auto;
}
.field-media-action {
  padding: 6px;
}
.field-media-action .mini {
  width: 100%;
}
.team-agenda-panel {
  display: grid;
  gap: 14px;
}
.agenda-task-panel {
  padding: 0;
}
.agenda-register {
  border: 0;
  background: transparent;
}
.agenda-task-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding-top: 12px;
}
.agenda-address-preview {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf5;
}
.agenda-address-preview span {
  color: var(--muted);
  font-size: 13px;
}
.agenda-address-preview strong {
  font-size: 14px;
  line-height: 1.35;
}
.agenda-map-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  text-decoration: none;
}
.is-hidden {
  display: none !important;
}
.agenda-task-form textarea {
  min-height: 72px;
}
.agenda-internal-steps {
  display: grid;
  gap: 8px;
  align-content: start;
}
.agenda-internal-steps > span,
.agenda-employees-box > span {
  color: var(--muted);
  font-size: 13px;
}
.agenda-employees-box {
  display: grid;
  gap: 8px;
}
.compact-checks {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  padding: 0;
  border: 0;
  background: transparent;
}
.agenda-employee-checks {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.agenda-toolbar {
  align-items: end;
}
.agenda-toolbar label {
  min-width: 170px;
}
.agenda-timeline {
  display: grid;
  gap: 12px;
}
.agenda-day {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.agenda-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: #eef3eb;
  color: var(--accent);
}
.agenda-date span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.agenda-items {
  display: grid;
}
.agenda-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
}
.agenda-item strong,
.agenda-item p,
.agenda-item small {
  display: block;
}
.agenda-item p {
  margin: 4px 0 0;
}
.agenda-item small {
  margin-top: 4px;
  color: var(--muted);
}
.agenda-type {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.agenda-meta {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 7px;
  min-width: 132px;
}
.agenda-status-select {
  min-width: 150px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 9px;
}
.agenda-assistencia {
  border-left: 4px solid var(--danger);
}
.agenda-checklist,
.agenda-montagem {
  border-left: 4px solid var(--accent);
}
.agenda-producao {
  border-left: 4px solid var(--accent-2);
}
.routine-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}
.routine-hero h2 {
  margin: 0 0 4px;
}
.routine-shortcuts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.routine-shortcuts button {
  min-height: 44px;
}
.routine-kpis {
  margin-bottom: 14px;
}
.routine-section {
  display: grid;
  gap: 12px;
}
.routine-list {
  display: grid;
  gap: 10px;
}
.routine-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.routine-card strong,
.routine-card p,
.routine-card small {
  display: block;
}
.routine-card p {
  margin: 4px 0 0;
}
.routine-card small {
  margin-top: 4px;
  color: var(--muted);
}
.routine-card-actions {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 7px;
  min-width: 130px;
}
.routine-bottom {
  align-items: start;
}
.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}
.premium-shell {
  display: grid;
  gap: 14px;
}
.premium-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.premium-frame {
  width: 100%;
  min-height: calc(100vh - 220px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.premium-commercial-control {
  display: grid;
  gap: 14px;
}
.premium-commercial-control .section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.premium-commercial-control .section-title h2 {
  margin: 0 0 4px;
}
.premium-alert-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #a7d7b5;
  background: #eefbf1;
  color: #1f6b38;
  font-weight: 800;
}
.premium-approved-list {
  display: grid;
  gap: 10px;
}
.premium-approved-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid #a7d7b5;
  border-radius: 8px;
  background: #f4fff6;
}
.premium-approved-alert strong,
.premium-approved-alert span,
.premium-approved-alert small {
  display: block;
}
.premium-approved-alert span,
.premium-approved-alert small {
  color: var(--muted);
  margin-top: 3px;
}
.premium-row-approved td {
  background: #f7fff8;
}
.premium-commercial-table td {
  vertical-align: middle;
}
.project-register,
.project-register[open] {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
.project-register > summary {
  display: none;
}
.project-fast-entry {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}
.employee-register:not(.project-register) .project-fast-entry,
.employee-register:not(.project-register) .project-dimensions-title {
  display: none;
}
.project-column-title {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3eb;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}
.project-piece-title,
.project-machining-title {
  margin-bottom: -8px;
}
.project-dimensions-title {
  grid-column: 1;
  grid-row: 2;
}
.project-piece-title {
  grid-column: 1;
}
.project-machining-title {
  grid-column: 1;
  grid-row: auto;
}
.project-register > .compact-form,
.project-register > .project-advanced,
.project-register > .wide-field,
.project-register > button {
  grid-column: 1;
}
.project-register > .project-tool-grid {
  grid-column: 1;
  grid-row: auto;
}
.project-info-row {
  grid-column: 1 !important;
  margin-top: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
}
.project-info-row > .compact-form {
  grid-template-columns: minmax(260px, 1.5fr) minmax(180px, 1fr) minmax(150px, .7fr) minmax(220px, 1.1fr) !important;
  gap: 8px;
  margin: 8px 0 0 !important;
}
.hidden-project-info {
  display: none;
}
.project-register > .compact-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
}
.project-register > .old-project-piece-form,
.project-register > .project-machining-title,
.project-register > .project-tool-grid,
.project-register > #saveProjectPiece,
.project-register > .wide-field {
  display: none;
}
.project-register > .compact-form {
  grid-template-columns: minmax(220px, 1.25fr) minmax(68px, .36fr) minmax(96px, .52fr) minmax(96px, .52fr) minmax(106px, .55fr) minmax(300px, 1.85fr);
  gap: 8px;
  margin: 0;
  align-items: end;
}
.project-register > .compact-form .wide-field {
  grid-column: auto;
}
.project-register > .project-advanced {
  margin-top: 0;
}
.project-register > .project-advanced .compact-form {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 6px 0 0;
}
.project-register textarea {
  min-height: 72px;
}

dialog {
  border: 0;
  padding: 0;
  border-radius: 8px;
  width: min(760px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(18, 27, 22, .38); }
.modal-card { padding: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin-bottom: 0; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.form-section-title {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
}
.form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.wide-field {
  grid-column: 1 / -1;
}
label span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 5px; }
.product-search-wrap {
  position: relative;
}
.field-note {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: -4px;
}
.suggestions {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 290px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 16px 38px rgba(23, 36, 29, .16);
}
.suggestions:empty {
  display: none;
}
.suggestion-item {
  width: 100%;
  display: block;
  text-align: left;
  border-radius: 0;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.suggestion-item:hover,
.suggestion-item:focus {
  background: #eef3eb;
}
.suggestion-item strong,
.suggestion-item span {
  display: block;
}
.suggestion-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.suggestion-empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: white;
}
.project-register input,
.project-register select,
.project-register textarea {
  padding: 8px 9px;
}
.project-register label span {
  font-size: 12px;
  margin-bottom: 3px;
  min-height: 15px;
  white-space: nowrap;
}
textarea { min-height: 90px; resize: vertical; }
menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; margin: 0; }

.doc {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
.doc-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.report-actions {
  display: flex;
  align-items: start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.doc h2 { margin-bottom: 4px; }
.doc table { min-width: 0; }
.doc-mini-input {
  width: 58px;
  padding: 5px 6px;
}
.doc-note-input,
.doc-description-input {
  width: 100%;
  min-width: 130px;
  padding: 5px 6px;
}
.doc-description-input {
  min-width: 260px;
}
.doc-total { text-align: right; font-size: 22px; font-weight: 900; margin-top: 12px; }
.proposal-doc {
  line-height: 1.45;
}
.proposal-doc h2 {
  font-size: 24px;
}
.proposal-preview-stack {
  display: grid;
  gap: 14px;
}
.proposal-history-panel {
  margin: 0;
}
.proposal-history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.proposal-history-head .proposal-section-title {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.proposal-history-head p {
  margin: 4px 0 0;
}
.proposal-terms {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.proposal-terms p {
  margin-bottom: 8px;
}
.proposal-items-editor {
  display: grid;
  gap: 8px;
}
.proposal-section-title {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-weight: 900;
}
.proposal-add-item {
  display: grid;
  grid-template-columns: 1.3fr .65fr 1fr;
  gap: 10px;
}
.proposal-add-item button {
  grid-column: 1 / -1;
}
.proposal-item-list {
  display: grid;
  gap: 10px;
}
.proposal-item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf6;
  padding: 10px;
}
.proposal-item-head,
.proposal-item-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.proposal-item-grid {
  display: grid;
  grid-template-columns: 1.3fr .65fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.proposal-item-total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.proposal-item-total span {
  color: var(--muted);
}
.project-tool-grid {
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(260px, .55fr) minmax(340px, 1fr);
  gap: 10px;
  margin: 0;
}
.project-tool-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8faf6;
}
.project-tool-box h3 {
  margin: 0 0 8px;
  font-size: 14px;
}
.project-preset-note {
  margin: 10px 0 0;
}
.project-advanced {
  margin-top: 8px;
}
.project-advanced summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--accent);
}
.module-generator {
  border: 1px solid #dce8d9;
  border-radius: 8px;
  background: #fbfdf9;
  padding: 10px;
}
.module-page-panel {
  max-width: 1180px;
}
.module-generator-standalone {
  margin-top: 12px;
}
.module-generated-summary {
  margin-top: 14px;
}
.module-list-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.module-list-toolbar label {
  max-width: 360px;
  width: 100%;
}
.module-group-list {
  display: grid;
  gap: 8px;
}
.module-piece-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
  overflow: hidden;
}
.module-piece-group summary {
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 150px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  color: var(--accent);
  font-weight: 800;
}
.module-piece-group summary span {
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}
.module-piece-group .table-wrap {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}
.module-generator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
  margin-top: 10px;
}
.module-form {
  align-content: start;
}
.module-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  display: grid;
  gap: 10px;
}
.module-preview {
  min-height: 220px;
  display: grid;
  place-items: center;
}
.module-preview svg {
  width: 100%;
  max-height: 240px;
}
.module-preview text {
  fill: #213027;
  font-size: 12px;
  font-weight: 800;
}
.module-box {
  fill: rgba(42, 117, 77, .12);
  stroke: #2f7650;
  stroke-width: 3;
}
.module-center-line,
.module-shelf-line {
  stroke: #2f7650;
  stroke-width: 2;
}
.module-hinge {
  fill: rgba(180, 52, 52, .18);
  stroke: #b43434;
  stroke-width: 2;
}
.visual3d-panel {
  max-width: 1280px;
}
.visual3d-layout {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(520px, 1fr);
  gap: 16px;
  align-items: stretch;
}
.visual3d-controls {
  display: grid;
  align-content: start;
  gap: 12px;
}
.visual3d-actions {
  justify-content: start;
}
.visual3d-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
  padding: 12px;
  display: grid;
  gap: 4px;
}
.visual3d-summary span {
  color: var(--muted);
}
.visual3d-piece-table {
  max-height: 260px;
  overflow: auto;
}
.visual3d-piece-table table {
  min-width: 640px;
}
.visual3d-piece-table th,
.visual3d-piece-table td {
  font-size: 12px;
  padding: 8px 10px;
}
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.check-line input {
  width: auto;
}
.checklist-layout-panel {
  padding: 18px;
}
.checklist-main-grid {
  align-items: start;
}
.checklist-box,
.attachment-box,
.signature-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
  padding: 12px;
  margin: 10px 0;
}
.checklist-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px 14px;
}
.signature-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.signature-box canvas {
  width: 100%;
  max-width: 100%;
  height: 180px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  touch-action: none;
}
.photo-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.photo-preview-list figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}
.photo-preview-list img {
  width: 100%;
  height: 96px;
  display: block;
  object-fit: cover;
}
.photo-preview-list figcaption {
  padding: 6px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-download-btn {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 6px;
  background: #eef5eb;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.photo-download-btn:hover {
  background: #e2ecde;
}
.checklist-tables-grid {
  align-items: start;
}
.checklist-tables-grid table {
  min-width: 760px;
}
.checklist-report {
  margin-top: 16px;
}
.checklist-print-card {
  background: white;
}
.signature-preview {
  display: grid;
  gap: 8px;
  max-width: 520px;
}
.signature-preview img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.report-photos img {
  height: 140px;
}
.visual3d-stage-wrap {
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbf5 0%, #eef4ec 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.visual3d-stage {
  width: 100%;
  height: 100%;
  min-height: 520px;
  display: grid;
  place-items: center;
}
.visual3d-svg {
  width: 100%;
  height: 100%;
  min-height: 500px;
}
.visual3d-svg polygon {
  stroke: rgba(31, 48, 38, .32);
  stroke-width: 1.2;
}
.visual3d-floor {
  fill: rgba(50, 86, 60, .11);
}
.visual3d-svg text {
  fill: #213027;
  font-size: 13px;
  font-weight: 900;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(248, 251, 245, .9);
  stroke-width: 4px;
}
.visual3d-svg .visual3d-measure {
  font-size: 16px;
}
.cut-plan-result {
  margin-top: 10px;
}
.cut-plan-cards {
  margin-bottom: 10px;
}
.cut-plan-stack {
  display: grid;
  gap: 14px;
}
.cut-plan-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
  padding: 12px;
}
.project-sheet-register {
  display: none;
}
.content:has(.project-entry-panel) {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.project-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.project-section-head strong {
  color: var(--accent);
  font-size: 15px;
}
.project-section-head span {
  color: var(--muted);
  font-size: 12px;
}
.project-entry-panel { order: 1; }
.project-pieces-panel { order: 2; }
.project-cut-panel { order: 3; }
.project-config-panel {
  display: block;
  order: 4;
}
.project-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.project-rules-grid h3 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 14px;
}
.saved-projects-panel { order: 5; }
.saved-projects-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.saved-projects-head p {
  margin: 4px 0 0;
}
.saved-projects-table table {
  min-width: 860px;
}
.cut-plan-group-head,
.cut-sheet-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}
.cut-plan-group-head strong,
.cut-sheet-title strong {
  display: block;
  color: var(--accent);
}
.cut-plan-group-head span,
.cut-sheet-title span {
  color: var(--muted);
  font-size: 12px;
}
.cut-plan-workspace {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.cut-plan-sheet-list {
  display: grid;
  gap: 8px;
}
.cut-sheet-tab {
  border: 1px solid #d8e3d8;
  background: #fff;
  border-radius: 6px;
  padding: 6px;
  text-align: center;
}
.cut-sheet-tab svg {
  width: 44px;
  height: 64px;
  display: block;
  margin: 0 auto 4px;
  background: #f8faf6;
}
.cut-sheet-tab strong {
  display: block;
  font-size: 12px;
}
.cut-sheet-tab span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.cut-sheet-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.cut-sheet-card {
  border: 1px solid #d8e3d8;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  width: min(100%, 720px);
}
.cut-sheet-body {
  display: grid;
  grid-template-columns: 150px minmax(230px, 420px);
  gap: 10px;
  align-items: center;
}
.cut-sheet-svg {
  display: block;
  width: 100%;
  max-height: 440px;
  border: 1px solid #dfe8dc;
  background: #f8faf6;
}
.cut-piece-legend {
  display: grid;
  align-content: start;
  gap: 4px;
  max-height: 430px;
  overflow: auto;
  font-size: 11px;
}
.cut-legend-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 5px;
  align-items: center;
}
.cut-legend-row span {
  border: 1px solid #d6d6c5;
  padding: 2px 3px;
  text-align: center;
  font-size: 10px;
}
.cut-legend-row small {
  grid-column: 2;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cut-legend-symbol i {
  display: block;
  width: 24px;
  height: 10px;
  margin-inline: auto;
}
.legend-edge { border-top: 4px solid #1d4ed8; }
.legend-machining {
  border: 2px solid #b43434;
  border-radius: 999px;
}
.cut-project-info {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.cut-board {
  fill: #fffdf7;
  stroke: #7d8c7a;
  stroke-width: 2;
}
.cut-piece {
  stroke: #2f7650;
  stroke-width: 10;
}
.cut-piece-too-large {
  fill: rgba(180, 52, 52, .18);
  stroke: #b43434;
  stroke-width: 12;
}
.cut-edge-band {
  stroke: #1d4ed8;
  stroke-width: 18;
}
.cut-machining-hole {
  fill: rgba(180, 52, 52, .25);
  stroke: #b43434;
  stroke-width: 9;
}
.cut-machining-slot {
  fill: rgba(169, 112, 35, .28);
  stroke: #a97023;
  stroke-width: 8;
}
.cut-sheet-svg text {
  fill: #213027;
  font-size: 54px;
  font-weight: 800;
  pointer-events: none;
}
.cut-sheet-svg .cut-piece-name {
  font-size: 66px;
}
.cut-sheet-svg .cut-piece-size {
  font-size: 76px;
}
.cut-sheet-svg .cut-piece-code,
.cut-sheet-svg .cut-board-measure {
  font-size: 42px;
}
.cut-sheet-svg .cut-machining-label {
  fill: #b43434;
  font-size: 38px;
}
.cut-label-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  margin-top: 12px;
}
.cut-label-preview > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
  margin-bottom: 10px;
}
.labels-print-area {
  display: none;
}
.labels-print-grid {
  display: grid;
  grid-template-columns: repeat(3, 70mm);
  gap: 3mm;
  align-items: start;
}
.labels-screen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.piece-label {
  border: 1px solid #111;
  padding: 6px;
  min-height: 32mm;
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 5px;
  font-size: 9px;
  background: white;
  break-inside: avoid;
}
.piece-label strong {
  display: block;
  font-size: 10px;
  margin-bottom: 2px;
}
.piece-label span {
  display: block;
  line-height: 1.25;
}
.label-piece-drawing {
  width: 72px;
  height: 48px;
  align-self: start;
}
.edge-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.edge-selector label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: white;
}
.edge-selector input {
  width: auto;
}
.drill-list {
  margin-top: 10px;
}
.hidden-file-input {
  display: none;
}
.project-table-wrap table {
  min-width: 1320px;
}
.project-fast-entry .project-table-wrap {
  overflow: visible;
}
.project-fast-entry .project-entry-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}
.project-fast-entry .project-entry-table th,
.project-fast-entry .project-entry-table td {
  padding: 6px 5px;
}
.project-fast-entry .project-entry-table th:nth-child(1),
.project-fast-entry .project-entry-table td:nth-child(1) {
  width: 48px;
}
.project-fast-entry .project-entry-table th:nth-child(2),
.project-fast-entry .project-entry-table td:nth-child(2) {
  width: 190px;
}
.project-fast-entry .project-entry-table th:nth-child(3),
.project-fast-entry .project-entry-table td:nth-child(3),
.project-fast-entry .project-entry-table th:nth-child(4),
.project-fast-entry .project-entry-table td:nth-child(4) {
  width: 125px;
}
.project-fast-entry .project-entry-table th:nth-child(5),
.project-fast-entry .project-entry-table td:nth-child(5) {
  width: 112px;
}
.project-fast-entry .project-entry-table th:nth-child(6),
.project-fast-entry .project-entry-table td:nth-child(6) {
  width: 210px;
}
.project-fast-entry .project-entry-table th:nth-child(7),
.project-fast-entry .project-entry-table td:nth-child(7) {
  width: 185px;
}
.project-fast-entry .project-entry-table th:nth-child(8),
.project-fast-entry .project-entry-table td:nth-child(8) {
  width: 80px;
}
.project-fast-entry .project-entry-table th:nth-child(9),
.project-fast-entry .project-entry-table td:nth-child(9) {
  width: 100px;
}
.project-fast-entry .project-entry-table th:nth-child(10),
.project-fast-entry .project-entry-table td:nth-child(10) {
  width: 120px;
}
.project-fast-entry .project-entry-table th:nth-child(11),
.project-fast-entry .project-entry-table td:nth-child(11) {
  width: 86px;
}
.project-grid-table th {
  background: #edf4f9;
  color: #27405a;
  font-size: 12px;
  white-space: nowrap;
}
.project-grid-table td {
  padding: 7px 8px;
  font-size: 13px;
  vertical-align: middle;
}
.project-entry-table input,
.project-entry-table select {
  min-width: 86px;
  padding: 6px 7px;
}
.project-fast-entry .project-entry-table input,
.project-fast-entry .project-entry-table select,
.project-fast-entry .operation-picker-button {
  min-width: 0;
}
.project-auto-id {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.project-entry-table td:nth-child(2) input {
  min-width: 190px;
}
.project-entry-table td:nth-child(6) select,
.project-entry-table td:nth-child(7) select {
  min-width: 190px;
}
.operation-picker-button {
  width: 100%;
  min-width: 190px;
  justify-content: center;
  background: #f6fbf5;
  color: var(--accent);
  border: 1px solid #c7dcc9;
}
.quick-operation-dialog {
  width: min(860px, calc(100vw - 32px));
}
.quick-operation-grid {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(300px, .86fr);
  gap: 14px;
  margin: 16px 0 10px;
}
.quick-operation-grid fieldset,
.quick-operation-section,
.quick-hole-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdf9;
}
.quick-operation-section {
  display: grid;
  gap: 10px;
}
.quick-operation-title {
  color: var(--accent);
  font-weight: 900;
}
.operation-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.operation-choice-grid button {
  text-align: left;
  display: grid;
  gap: 3px;
  padding: 10px;
  min-height: 70px;
  border: 1px solid #d6e2d5;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
.operation-choice-grid button strong {
  font-size: 14px;
}
.operation-choice-grid button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.operation-choice-grid button.is-active {
  border-color: var(--accent);
  background: #eef8f1;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.quick-edge-section {
  align-self: stretch;
}
.quick-edge-section .edge-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
.quick-operation-grid legend,
.quick-operation-title,
.quick-hole-fields strong {
  color: var(--accent);
  font-weight: 900;
}
.quick-operation-grid label {
  margin: 0;
}
.edge-choice-grid label {
  cursor: pointer;
}
.edge-choice-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.edge-choice-grid label span {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  min-height: 42px;
  border: 1px solid #d6e2d5;
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}
.edge-choice-grid label strong {
  font-size: 15px;
  line-height: 1;
}
.edge-choice-grid label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.edge-choice-grid input:checked + span {
  border-color: var(--accent);
  background: #eef8f1;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.edge-choice-grid input:checked + span small {
  color: var(--accent);
}
.quick-hole-fields {
  display: none;
  grid-column: 1 / -1;
}
.quick-hole-fields.is-visible {
  display: block;
}
.quick-hole-fields .compact-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 8px 0 0;
}
.quick-operation-preview {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #c7dcc9;
  border-radius: 8px;
  padding: 10px 12px;
  background: #eef8f1;
}
.quick-operation-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.quick-operation-preview strong {
  color: var(--accent);
  text-align: right;
}
.quick-piece-preview-card {
  grid-column: 2;
  grid-row: 1 / span 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdf9;
  display: grid;
  gap: 10px;
  align-content: start;
}
.quick-piece-preview {
  min-height: 285px;
}
.quick-piece-preview svg {
  max-height: 280px;
}
.aspire-preview-dialog {
  width: min(1120px, calc(100vw - 28px));
}
.aspire-preview-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 14px;
  margin: 16px 0 10px;
}
.aspire-piece-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 610px;
  overflow: auto;
  padding-right: 4px;
}
.aspire-piece-list button {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid #d6e2d5;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px;
}
.aspire-piece-list button.is-active {
  border-color: var(--accent);
  background: #eef8f1;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.aspire-piece-list span {
  color: var(--muted);
  font-size: 12px;
}
.aspire-piece-stage {
  display: grid;
  gap: 12px;
}
.aspire-piece-drawing {
  min-height: 360px;
}
.aspire-piece-details {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.aspire-piece-details div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdf9;
  padding: 10px;
}
.aspire-piece-details .wide {
  grid-column: 1 / -1;
}
.aspire-piece-details span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.aspire-piece-details strong {
  color: var(--text);
  font-size: 13px;
}
.aspire-operation-list p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.action-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.project-grid-table .numeric {
  text-align: right;
  white-space: nowrap;
}
.operation-pill {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #b8d7c2;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef8f1;
  color: #126c43;
  font-weight: 800;
}
.project-grain {
  text-align: center;
  color: #315c88;
  font-size: 18px;
  font-weight: 900;
}
.project-preview-box {
  grid-column: 3;
  grid-row: 1 / span 2;
}
.piece-preview {
  min-height: 230px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: white;
  padding: 8px;
}
.piece-preview svg {
  display: block;
  width: 100%;
  max-height: 250px;
}
.piece-board {
  fill: #f5f1e7;
  stroke: #8b7355;
  stroke-width: 2;
}
.piece-edge-active {
  stroke: #126c43;
  stroke-width: 8;
  stroke-linecap: round;
}
.piece-hole circle {
  fill: rgba(20, 92, 150, .2);
  stroke: #145c96;
  stroke-width: 2;
}
.piece-machining rect {
  fill: rgba(161, 91, 31, .22);
  stroke: #a15b1f;
  stroke-width: 2;
}
.piece-hole text,
.piece-machining text {
  fill: #12372a;
  font-size: 12px;
  font-weight: 900;
  text-anchor: middle;
}
.piece-title,
.piece-measure {
  fill: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-anchor: middle;
}
.payslip-panel {
  margin-top: 16px;
}
.payslip-doc h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
.payslip-person {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
.payslip-tables {
  align-items: start;
}
.payslip-note {
  min-height: 20px;
  margin-top: 14px;
}
.production-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding: 2px 0 14px;
}
.production-column {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf6;
  padding: 10px;
}
.production-column h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14px;
}
.production-column h3 span {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #eef3eb;
  color: var(--accent);
}
.production-cards {
  display: grid;
  gap: 8px;
}
.production-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}
.production-card strong,
.production-card span,
.production-card small {
  display: block;
}
.production-card span,
.production-card small,
.production-card p {
  color: var(--muted);
  font-size: 12px;
}
.production-card p {
  margin: 8px 0 0;
}
.production-table {
  margin-top: 12px;
}
.totals {
  display: grid;
  gap: 8px;
  max-width: 360px;
  margin: 14px 0 0 auto;
}
.totals div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.totals span {
  color: var(--muted);
}
.totals strong {
  white-space: nowrap;
}
.totals .final-total {
  font-size: 20px;
  font-weight: 900;
  border-bottom: 0;
}
.totals .final-total span {
  color: var(--ink);
}
.builder {
  display: grid;
  grid-template-columns: minmax(240px, 340px) 1fr;
  gap: 16px;
  align-items: start;
}
.purchase-order-page {
  display: grid;
  gap: 16px;
}
.purchase-order-fields {
  grid-template-columns: minmax(180px, 220px) minmax(260px, 360px) minmax(320px, 1fr);
  align-items: end;
  margin-bottom: 12px;
}
.budget-order-fields {
  grid-template-columns: minmax(320px, 1fr) minmax(180px, 240px);
  align-items: end;
  margin-bottom: 12px;
}
.purchase-order-actions {
  justify-content: flex-start;
}
.purchase-order-doc {
  min-height: 320px;
}
.purchase-item-dialog {
  width: min(760px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 20px 70px rgba(18, 27, 22, .22);
}
.purchase-item-dialog .modal-card {
  display: grid;
  gap: 14px;
}
.field-dialog {
  width: min(980px, calc(100vw - 28px));
}
.saved-projects-box {
  display: grid;
  gap: 14px;
  padding: 14px;
}
.stack { display: grid; gap: 10px; }
.contract-builder {
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
}
.contract-doc {
  line-height: 1.45;
  font-size: 13px;
}
.contract-doc h2 {
  text-align: center;
  font-size: 18px;
  margin-bottom: 18px;
}
.contract-doc h3 {
  font-size: 14px;
  margin: 16px 0 8px;
  text-align: center;
}
.contract-doc p {
  margin-bottom: 9px;
}
.contract-doc ul {
  margin: 0 0 10px 20px;
  padding: 0;
}
.signature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 42px;
  margin-top: 48px;
  text-align: center;
}
.signature-row span {
  display: block;
  border-top: 1px solid var(--ink);
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  body {
    display: block;
    min-height: 100vh;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 320px);
    min-height: 100vh;
    z-index: 20;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 18px 0 42px rgba(0, 0, 0, .22);
  }
  body.mobile-menu-open .sidebar {
    transform: translateX(0);
  }
  body.mobile-menu-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(15, 25, 19, .42);
  }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  nav { grid-template-columns: 1fr; }
  .nav-group { align-content: start; }
  .nav-btn,
  .nav-group summary {
    min-height: 46px;
    font-size: 15px;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
    gap: 10px;
  }
  .topbar > div:first-of-type {
    min-width: 0;
  }
  h1 {
    font-size: 22px;
    line-height: 1.15;
  }
  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .actions .save-status,
  .actions .import {
    grid-column: 1 / -1;
  }
  .actions button,
  .actions .import {
    min-height: 44px;
    text-align: center;
  }
  .content {
    padding: 14px;
  }
  .panel {
    padding: 14px;
  }
  .kpis, .grid-2, .cards, .builder, .finance-hub-grid { grid-template-columns: 1fr; }
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .agenda-item {
    grid-template-columns: 1fr;
  }
  .routine-hero,
  .routine-card {
    grid-template-columns: 1fr;
    display: grid;
  }
  .routine-shortcuts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
  }
  .routine-card-actions {
    justify-items: start;
  }
  .agenda-task-form {
    grid-template-columns: 1fr;
  }
  .agenda-date,
  .agenda-meta {
    align-items: start;
    justify-items: start;
  }
  .agenda-toolbar label {
    min-width: 0;
  }
  .search,
  .compact-select {
    min-width: 0;
    width: 100%;
  }
  .form-grid,
  .compact-form {
    grid-template-columns: 1fr !important;
  }
  .time-clock-grid,
  .point-actions {
    grid-template-columns: 1fr;
  }
  .premium-toolbar {
    display: grid;
  }
  .premium-commercial-control .section-title,
  .premium-approved-alert {
    flex-direction: column;
    align-items: stretch;
  }
  .premium-frame {
    min-height: calc(100vh - 260px);
  }
  .time-clock-card {
    min-height: 110px;
  }
  input,
  select,
  textarea,
  button,
  .import {
    min-height: 44px;
  }
  .production-board {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 12px;
  }
  .production-column {
    min-width: 82vw;
    scroll-snap-align: start;
  }
  .checklist-box { grid-template-columns: 1fr; }
  .compact-checks {
    grid-template-columns: 1fr 1fr;
  }
  .checklist-main-grid {
    gap: 12px;
  }
  .employee-register[open] {
    padding: 0 12px 12px;
  }
  .employee-register summary {
    padding: 12px;
  }
  .signature-box canvas {
    height: 220px;
  }
  .photo-preview-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .checklist-tables-grid {
    grid-template-columns: 1fr;
  }
  .table-wrap {
    border-radius: 8px;
    max-width: 100%;
  }
  table {
    min-width: 680px;
  }
  th,
  td {
    padding: 9px;
    font-size: 13px;
  }
  .row-actions {
    flex-wrap: wrap;
  }
  .project-register[open] { display: block; }
  .project-tool-grid { grid-template-columns: 1fr; }
  .project-preview-box { grid-column: auto; grid-row: auto; }
  .aspire-preview-layout { grid-template-columns: 1fr; }
  .aspire-piece-list { max-height: 220px; }
  .aspire-piece-details { grid-template-columns: 1fr; }
  .visual3d-layout { grid-template-columns: 1fr; }
  .visual3d-stage-wrap { min-height: 420px; }
  .visual3d-stage { min-height: 400px; }
  .visual3d-svg { min-height: 390px; }
}

@media print {
  body { display: block; background: white; }
  .sidebar, .topbar, .toolbar, .builder > .panel, .proposal-history-panel { display: none; }
  .no-print { display: none !important; }
  .content { padding: 0; }
  .doc { border: 0; border-radius: 0; }
  body.printing-cut-plan .panel,
  body.printing-labels .panel { display: none; }
  body.printing-cut-plan .cut-plan-panel,
  body.printing-labels .cut-plan-panel {
    display: block;
    border: 0;
    padding: 0;
    margin: 0;
  }
  body.printing-cut-plan .cut-plan-result {
    display: block;
  }
  body.printing-cut-plan .cut-plan-workspace {
    grid-template-columns: 90px 1fr;
  }
  body.printing-cut-plan .cut-sheet-grid {
    display: block;
  }
  body.printing-cut-plan .cut-sheet-card {
    width: 100%;
    page-break-inside: avoid;
    margin-bottom: 10mm;
  }
  body.printing-cut-plan .cut-label-preview {
    display: none;
  }
  body.printing-labels .cut-plan-result {
    display: none;
  }
  body.printing-labels .labels-print-area {
    display: block;
  }
  body.printing-labels .piece-label {
    width: 70mm;
    min-height: 32mm;
    font-size: 8px;
  }
  body.printing-rt .panel:not(.rt-history) { display: none; }
  body.printing-rt .rt-history {
    display: block;
    border: 0;
    padding: 0;
    margin: 0;
  }
  body.printing-rt .print-title {
    display: block;
    margin-bottom: 18px;
  }
  body.printing-rt .table-wrap {
    border: 0;
    overflow: visible;
  }
  body.printing-rt table {
    width: 100%;
    font-size: 11px;
  }
  body.printing-rt th:last-child,
  body.printing-rt td:last-child {
    display: none;
  }
  body.printing-payslip .panel:not(.print-panel) { display: none; }
  body.printing-payslip .print-panel { display: block; border: 0; padding: 0; }
  body.printing-payslip .no-print { display: none; }
  body.printing-payslip .payslip-doc { padding: 18px; }
  body.printing-financial-report .panel:not(.financial-report-panel):not(.report-mini-panel) { display: none; }
  body.printing-financial-report .financial-report-panel,
  body.printing-financial-report .report-mini-panel {
    display: block;
    border: 0;
    padding: 0;
    margin: 0 0 12px;
  }
  body.printing-financial-report .toolbar { display: none; }
  body.printing-financial-report .grid-2 { display: block; }
  body.printing-financial-report .table-wrap { overflow: visible; border: 0; }
  body.printing-financial-report table { font-size: 10px; }
}
