/* Mobilya Kesim Pro — tasarım sistemi
   Açık çalışma alanı, koyu metin, petrol yeşili marka rengi. Boşluklar 8 px tabanlı. */

:root {
  --brand-50: #effaf8;
  --brand-100: #d5f2ed;
  --brand-200: #a9e3da;
  --brand-500: #138a7e;
  --brand-600: #0f766e;
  --brand-700: #0b5c56;
  --brand-900: #073b38;

  --gray-0: #ffffff;
  --gray-25: #fafbfb;
  --gray-50: #f4f6f6;
  --gray-100: #e8ecec;
  --gray-200: #d6dcdc;
  --gray-300: #b9c2c2;
  --gray-500: #5c6868;
  --gray-600: #4f5a5a;
  --gray-700: #374141;
  --gray-900: #172020;

  --ok-50: #edfaf1;
  --ok-600: #1d7f45;
  --warn-50: #fff8e6;
  --warn-200: #f6dd9a;
  --warn-700: #8a5a00;
  --danger-50: #fdf0ef;
  --danger-200: #f3c3bf;
  --danger-600: #c0392b;
  --danger-700: #9c2a1f;
  --info-50: #eef5fd;
  --info-700: #1f4f8a;

  --waste: #f1d9d6;
  --offcut: #2e9d6a;
  --trim: #d9cfc0;
  --kerf: #8d99a6;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(23, 32, 32, 0.06);
  --shadow-md: 0 2px 8px rgba(23, 32, 32, 0.08), 0 1px 2px rgba(23, 32, 32, 0.05);
  --shadow-lg: 0 12px 32px rgba(23, 32, 32, 0.16);

  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 232px;
  --topbar-h: 56px;
  --focus: 0 0 0 3px rgba(19, 138, 126, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--gray-50);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.125rem;
}

h3 {
  font-size: 1rem;
}

p {
  margin: 0;
}

a {
  color: var(--brand-600);
}

.num,
td.num,
input[type="number"] {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--gray-500);
}

.small {
  font-size: 0.85rem;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Uygulama kabuğu ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3);
  background: var(--brand-900);
  color: #dcefeb;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2) var(--sp-4);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
}

.brand-full {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 210px;
  height: auto;
}

.mobile-bar .brand-logo {
  width: auto;
  height: 30px;
}

.brand small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--brand-200);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  padding: var(--sp-4) var(--sp-2) var(--sp-1);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-200);
}

.nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 40px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: #dcefeb;
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.07);
}

.nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.nav a[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.nav-project-name {
  padding: 0 var(--sp-2) var(--sp-1);
  font-size: 0.85rem;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-foot {
  margin-top: auto;
  padding: var(--sp-3) var(--sp-2) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
}

.sidebar-foot strong {
  display: block;
  color: #fff;
}

.sidebar-foot .btn {
  margin-top: var(--sp-2);
  width: 100%;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-5) var(--sp-7);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.page-head .lead {
  margin-top: var(--sp-1);
  color: var(--gray-500);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.mobile-bar {
  display: none;
}

/* ---------- Kartlar, bölümler ---------- */

.card {
  background: var(--gray-0);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
}

.card + .card,
.stack > * + * {
  margin-top: var(--sp-4);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.card-head p {
  color: var(--gray-500);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  gap: var(--sp-4);
}

.grid-stats {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stat {
  padding: var(--sp-4) var(--sp-5);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.stat-value {
  margin-top: var(--sp-1);
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-hint {
  margin-top: var(--sp-1);
  font-size: 0.8rem;
  color: var(--gray-500);
}

.empty {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--gray-500);
}

.empty h3 {
  color: var(--gray-900);
  margin-bottom: var(--sp-2);
}

.empty .btn {
  margin-top: var(--sp-4);
}

/* ---------- Butonlar ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-600);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-700);
}

.btn-secondary {
  background: var(--gray-0);
  border-color: var(--gray-200);
  color: var(--gray-900);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-danger {
  background: var(--gray-0);
  border-color: var(--danger-200);
  color: var(--danger-700);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-50);
}

.btn-on-dark {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-on-dark:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-sm {
  min-height: 32px;
  padding: var(--sp-1) var(--sp-3);
  font-size: 0.875rem;
}

.btn-icon {
  min-width: 36px;
  min-height: 36px;
  padding: var(--sp-2);
}

.btn-icon.btn-sm {
  min-width: 30px;
  min-height: 30px;
  padding: 6px;
}

.btn-lg {
  min-height: 48px;
  padding: var(--sp-3) var(--sp-5);
  font-size: 1rem;
}

.btn.is-busy::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Form ---------- */

label,
.label {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

.hint {
  margin-top: var(--sp-1);
  font-size: 0.8rem;
  color: var(--gray-500);
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
select {
  width: 100%;
  min-height: 40px;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  background: var(--gray-0);
  color: var(--gray-900);
  font: inherit;
}

input::placeholder {
  color: var(--gray-300);
}

input:hover,
select:hover {
  border-color: var(--gray-300);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus);
}

input[type="number"] {
  text-align: right;
}

input.is-invalid,
select.is-invalid {
  border-color: var(--danger-600);
  background: var(--danger-50);
}

input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.25);
}

.field + .field {
  margin-top: var(--sp-4);
}

.field-error {
  margin-top: var(--sp-1);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--danger-700);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
  align-items: start;
}

.input-title {
  min-height: 44px;
  padding: var(--sp-1) var(--sp-2);
  border-color: transparent;
  background: transparent;
  font-size: 1.5rem;
  font-weight: 650;
}

.input-title:hover {
  border-color: var(--gray-200);
}

details.advanced {
  margin-top: var(--sp-4);
  border-top: 1px solid var(--gray-100);
  padding-top: var(--sp-3);
}

details.advanced summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--gray-700);
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

details.advanced[open] summary {
  margin-bottom: var(--sp-3);
}

.check-row {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  margin-top: var(--sp-4);
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
  accent-color: var(--brand-600, #0f766e);
}

.check-row > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---------- Rozetler, durum ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-ok {
  background: var(--ok-50);
  color: var(--ok-600);
}

.badge-warn {
  background: var(--warn-50);
  color: var(--warn-700);
}

.badge-danger {
  background: var(--danger-50);
  color: var(--danger-700);
}

.badge-brand {
  background: var(--brand-50);
  color: var(--brand-700);
}

.badge-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 32px;
  font-size: 0.875rem;
  font-weight: 600;
}

.save-status[data-state="saved"] {
  color: var(--ok-600);
}

.save-status[data-state="saving"],
.save-status[data-state="dirty"],
.save-status[data-state="new"] {
  color: var(--gray-500);
}

.save-status[data-state="invalid"],
.save-status[data-state="conflict"],
.save-status[data-state="error"] {
  color: var(--danger-700);
}

.save-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.save-status[data-state="saving"]::before {
  border: 2px solid currentColor;
  border-right-color: transparent;
  background: none;
  width: 12px;
  height: 12px;
  animation: spin 0.8s linear infinite;
}

/* ---------- Bildirim kutuları (sayfa içi) ---------- */

.notice {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--gray-200);
  background: var(--gray-25);
  font-size: 0.92rem;
}

.notice + .notice {
  margin-top: var(--sp-2);
}

.notice .icon {
  margin-top: 2px;
}

.notice strong {
  display: block;
}

.notice-body {
  flex: 1;
  min-width: 0;
}

.notice-body ul {
  margin: var(--sp-2) 0 0;
  padding-left: var(--sp-5);
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.notice-ok {
  border-color: #b9e4c8;
  background: var(--ok-50);
  color: #145a32;
}

.notice-warn {
  border-color: var(--warn-200);
  background: var(--warn-50);
  color: #6b4500;
}

.notice-danger {
  border-color: var(--danger-200);
  background: var(--danger-50);
  color: var(--danger-700);
}

.notice-info {
  border-color: #c9dcf3;
  background: var(--info-50);
  color: var(--info-700);
}

/* ---------- Tablolar ---------- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th {
  padding: var(--sp-2) var(--sp-3);
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

.table th.num,
.table td.num {
  text-align: right;
}

.table tbody tr:hover {
  background: var(--gray-25);
}

.table a.row-link {
  font-weight: 600;
  color: var(--gray-900);
  text-decoration: none;
}

.table a.row-link:hover {
  color: var(--brand-600);
  text-decoration: underline;
}

/* Parça tablosu: yoğun, hızlı giriş */
.parts {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}

.parts th {
  padding: var(--sp-1) var(--sp-1) var(--sp-2);
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gray-500);
  white-space: nowrap;
}

.parts th.num {
  text-align: right;
}

.parts td {
  padding: 3px var(--sp-1);
  vertical-align: top;
}

.parts input[type="text"],
.parts input[type="number"],
.parts select {
  min-height: 36px;
  padding: 6px var(--sp-2);
}

.parts .col-name {
  width: 34%;
}

.parts .col-dim {
  width: 96px;
}

.parts .col-qty {
  width: 76px;
}

.parts .col-mat {
  width: 150px;
}

.parts .col-grain,
.parts .col-edge {
  width: 56px;
  text-align: center;
}

.parts .col-act {
  width: 72px;
  white-space: nowrap;
  text-align: right;
}

.parts.one-mat .col-mat {
  display: none;
}

.parts tr.is-blank input {
  background: var(--gray-25);
}

.parts .field-error {
  margin-top: 2px;
  font-size: 0.75rem;
}

.toggle-grain {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-sm);
  background: var(--gray-0);
  color: var(--gray-500);
  cursor: pointer;
}

.toggle-grain[aria-pressed="true"] {
  border-color: #c9a46a;
  background: #fbf3e4;
  color: #7a5214;
}

/* Kenar bandı seçici: dört kenarı tıklanabilir küçük dikdörtgen */
.edge-picker {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 30px;
  margin-top: 3px;
}

.edge-picker .edge-face {
  position: absolute;
  inset: 7px;
  border-radius: 2px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}

.edge-picker button {
  position: absolute;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.edge-picker button::after {
  content: "";
  position: absolute;
  border-radius: 2px;
  background: var(--gray-200);
}

.edge-picker button[aria-pressed="true"]::after {
  background: var(--brand-600);
}

.edge-picker .e-top,
.edge-picker .e-bottom {
  left: 7px;
  right: 7px;
  height: 7px;
}

.edge-picker .e-top {
  top: 0;
}

.edge-picker .e-bottom {
  bottom: 0;
}

.edge-picker .e-top::after,
.edge-picker .e-bottom::after {
  left: 0;
  right: 0;
  height: 4px;
}

.edge-picker .e-top::after {
  bottom: 1px;
}

.edge-picker .e-bottom::after {
  top: 1px;
}

.edge-picker .e-left,
.edge-picker .e-right {
  top: 7px;
  bottom: 7px;
  width: 7px;
}

.edge-picker .e-left {
  left: 0;
}

.edge-picker .e-right {
  right: 0;
}

.edge-picker .e-left::after,
.edge-picker .e-right::after {
  top: 0;
  bottom: 0;
  width: 4px;
}

.edge-picker .e-left::after {
  right: 1px;
}

.edge-picker .e-right::after {
  left: 1px;
}

.product {
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  background: var(--gray-0);
}

.product + .product {
  margin-top: var(--sp-4);
}

.product-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-25);
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.product-head .field-name {
  flex: 1 1 240px;
}

.product-head .field-qty {
  width: 110px;
}

.product-head .product-meta {
  margin-left: auto;
  align-self: center;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.product-body {
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  overflow-x: auto;
}

.product-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  padding: 0 var(--sp-3) var(--sp-3);
}

.undo-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0 var(--sp-3) var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--gray-700);
  color: #fff;
  font-size: 0.875rem;
}

.undo-bar .btn {
  color: #fff;
  min-height: 28px;
}

.kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--gray-200);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--gray-0);
}

/* ---------- Editör yerleşimi ---------- */

.editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.editor-head .title-wrap {
  flex: 1 1 320px;
  min-width: 0;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--sp-4);
  align-items: start;
}

.side-panel {
  position: sticky;
  top: var(--sp-4);
}

.summary-list {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
}

.summary-list div {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
}

.summary-list dt {
  color: var(--gray-500);
}

.live-preview {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--gray-200);
}

.live-preview h3 {
  margin: 0 0 var(--sp-2);
  font-size: 0.95rem;
}

.live-preview [aria-busy="true"] {
  opacity: 0.6;
}

.live-preview-sheet {
  margin-top: var(--sp-3);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
}

.live-preview-sheet svg {
  width: 100%;
  height: auto;
}

.summary-list dd.pv-bad {
  color: var(--danger-700);
}

.summary-list dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plates-table td {
  vertical-align: top;
}

/* ---------- Sekmeler (proje içi) ---------- */

.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: var(--sp-5);
  overflow-x: auto;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--gray-600);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.tabs a:hover {
  color: var(--gray-900);
}

.tabs a[aria-current="page"] {
  color: var(--brand-700);
  border-bottom-color: var(--brand-600);
}

/* ---------- Optimizasyon çalışma alanı ---------- */

.plan-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: var(--sp-4);
  align-items: start;
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 2px;
}

.sheet-group-title {
  margin: var(--sp-2) 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-600);
}

.sheet-thumb {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--sp-3);
  align-items: center;
  width: 100%;
  padding: var(--sp-2);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  background: var(--gray-0);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sheet-thumb:hover {
  border-color: var(--gray-300);
}

.sheet-thumb[aria-pressed="true"] {
  border-color: var(--brand-500);
  box-shadow: inset 0 0 0 1px var(--brand-500);
  background: var(--brand-50);
}

.sheet-thumb svg {
  width: 72px;
  height: auto;
  display: block;
}

.sheet-thumb strong {
  display: block;
  font-size: 0.9rem;
}

.sheet-thumb span {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.meter {
  height: 6px;
  margin-top: var(--sp-1);
  border-radius: 3px;
  background: var(--gray-100);
  overflow: hidden;
}

.meter > i {
  display: block;
  height: 100%;
  background: var(--brand-500);
}

.viewer {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--gray-100);
}

.viewer-bar .viewer-title {
  flex: 1;
  min-width: 160px;
  font-weight: 650;
}

.viewer-bar .zoom-value {
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.viewer-canvas {
  position: relative;
  height: min(68vh, 720px);
  min-height: 320px;
  background: repeating-conic-gradient(var(--gray-50) 0% 25%, #f9fafa 0% 50%) 50% / 24px 24px;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.viewer-canvas.is-panning {
  cursor: grabbing;
}

.viewer-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
}

.viewer-canvas.hide-cuts g.cuts {
  display: none;
}

svg g.cuts {
  pointer-events: none;
}

svg .lbl-cut {
  fill: #9a3412;
  font-weight: 700;
  stroke: #fff;
  paint-order: stroke;
  pointer-events: none;
}

svg .cut-line.is-active {
  stroke: #1d4ed8;
  stroke-width: 4;
  stroke-dasharray: none;
}

svg .lbl-cut.is-active {
  fill: #1d4ed8;
}

.swatch-cut {
  background: #c2410c;
  height: 3px;
  vertical-align: 3px;
  border: 0;
}

.cut-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 340px;
  overflow: auto;
  font-size: 0.85rem;
  border: 1px solid var(--gray-100);
  border-radius: 8px;
}

.cut-steps li {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  gap: var(--sp-2);
  align-items: baseline;
  padding: 6px var(--sp-2);
  border-bottom: 1px solid var(--gray-100);
  cursor: default;
}

.cut-steps li:last-child {
  border-bottom: 0;
}

.cut-steps li.is-sub {
  padding-left: calc(var(--sp-2) + var(--indent, 0px));
}

.cut-steps li:hover,
.cut-steps li:focus-within,
.cut-steps li.is-active {
  background: var(--brand-50);
}

.cut-steps .n {
  font-weight: 700;
  color: #9a3412;
  font-variant-numeric: tabular-nums;
}

@media print {
  .cut-steps {
    max-height: none;
    overflow: visible;
  }
}

.cut-steps .size {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.viewer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--gray-100);
  font-size: 0.8rem;
  color: var(--gray-600);
}

.swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.swatch-part {
  background: linear-gradient(90deg, hsl(215 52% 85%) 50%, hsl(45 52% 85%) 50%);
}

.swatch-offcut {
  background: repeating-linear-gradient(45deg, #e5f5ec 0 4px, #cfeedd 4px 8px);
  border-color: var(--offcut);
}

.swatch-waste {
  background: var(--waste);
}

.swatch-trim {
  background: var(--trim);
}

.swatch-edge {
  background: var(--gray-900);
  height: 4px;
  vertical-align: 2px;
}

.tooltip {
  position: absolute;
  z-index: 5;
  max-width: 260px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--gray-900);
  color: #fff;
  font-size: 0.82rem;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.tooltip strong {
  display: block;
}

.tooltip .muted {
  color: var(--gray-200);
}

.part-rect {
  cursor: pointer;
}

.part-rect:hover rect.part,
.part-rect.is-highlighted rect.part {
  stroke: var(--gray-900);
  stroke-width: 2.5;
}

.breakdown {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--gray-100);
}

.breakdown > i {
  display: block;
  height: 100%;
}

.breakdown-legend {
  display: grid;
  gap: var(--sp-1);
  margin: var(--sp-3) 0 0;
  font-size: 0.875rem;
}

.breakdown-legend div {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--sp-2);
  align-items: center;
}

.breakdown-legend dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.breakdown-legend dd.pct {
  min-width: 48px;
  font-weight: 600;
}

.c-parts {
  background: var(--brand-500);
}

.c-kerf {
  background: var(--kerf);
}

.c-trim {
  background: var(--trim);
}

.c-offcut {
  background: var(--offcut);
}

.c-waste {
  background: #d98b80;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  color: var(--gray-700);
}

.loading-overlay span {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.loading-overlay span::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 3px solid var(--brand-500);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Üretim ---------- */

.phase-note {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-500);
}

.print-only {
  display: none;
}

.doc-actions,
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.doc-actions + .hint {
  margin-top: var(--sp-3);
}

.badge-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}

/* ---------- Plan geçmişi ---------- */

.history {
  margin-top: var(--sp-4);
}

.history-table tr.is-current {
  background: var(--brand-50);
}

.history-table .cell-actions {
  text-align: right;
  white-space: nowrap;
}

.history-table [aria-pressed="true"] {
  background: var(--brand-50);
  color: var(--brand-700);
}

.compare {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--gray-100);
}

.compare h3 {
  margin-bottom: var(--sp-2);
}

.diff.is-better {
  color: var(--ok-600);
  font-weight: 600;
}

.diff.is-worse {
  color: var(--danger-700);
  font-weight: 600;
}

/* ---------- İçe aktarma ---------- */

dialog.dialog-wide {
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

dialog.dialog-wide .dialog-body {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.file-pick {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
  padding: var(--sp-3);
  border: 1px dashed var(--gray-300);
  border-radius: var(--r-md);
  background: var(--gray-25);
}

.file-pick label {
  font-weight: 600;
}

.file-pick input[type="file"] {
  min-width: 0;
  max-width: 100%;
}

.imp-status .notice p {
  margin: var(--sp-1) 0 0;
  color: inherit;
}

.imp-target {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin: var(--sp-4) 0 var(--sp-2);
}

.imp-target label {
  font-weight: 600;
}

.imp-table-wrap {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
}

.imp-table thead th {
  position: sticky;
  top: 0;
  background: var(--gray-25);
}

.imp-table tr.is-error {
  background: var(--danger-50);
}

.imp-errors {
  color: var(--danger-700);
  font-size: 0.85rem;
}

.watermark {
  display: none;
}

/* ---------- Diyalog ---------- */

dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: none;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  color: var(--gray-900);
}

dialog::backdrop {
  background: rgba(23, 32, 32, 0.45);
}

.dialog-body {
  padding: var(--sp-5);
}

.dialog-body p {
  margin-top: var(--sp-2);
  color: var(--gray-600);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  background: var(--gray-25);
  border-top: 1px solid var(--gray-100);
}

/* ---------- Giriş sayfası ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5) var(--sp-4);
  background: linear-gradient(160deg, var(--brand-50), var(--gray-50) 60%);
}

.auth-card {
  width: min(400px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  color: var(--brand-900);
  font-weight: 700;
  font-size: 1.15rem;
}

.auth-brand img {
  display: block;
  width: min(300px, 100%);
  height: auto;
}

.auth h1 {
  font-size: 1.35rem;
}

.auth .lead {
  margin: var(--sp-1) 0 var(--sp-5);
  color: var(--gray-500);
}

.auth .btn-primary {
  width: 100%;
  margin-top: var(--sp-5);
}

.auth .notice {
  margin-bottom: var(--sp-4);
}

.auth-links {
  margin: var(--sp-4) 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--gray-600);
}

.auth-links a {
  color: var(--brand-700);
  font-weight: 600;
}

.field-hint {
  margin: var(--sp-1) 0 0;
  font-size: 0.8rem;
  color: var(--gray-500);
}

/* ---------- Abonelik, hesap ve yönetim ---------- */

.account-banner {
  padding: var(--sp-4) var(--sp-6) 0;
}

.usage + .usage,
.summary-list + .usage {
  margin-top: var(--sp-4);
}

.usage-head {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: 0.9rem;
}

.usage-bar {
  height: 8px;
  margin-top: var(--sp-1);
  border-radius: 999px;
  background: var(--gray-100);
  overflow: hidden;
}

.usage-bar span {
  display: block;
  height: 100%;
  background: var(--brand-500);
}

.usage-bar.is-high span {
  background: var(--warn-700);
}

.usage-bar.is-full span {
  background: var(--danger-600);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-3);
}

.plan-option {
  padding: var(--sp-4);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
}

.plan-option.is-current {
  border-color: var(--brand-500);
  background: var(--brand-50);
}

.plan-option h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin: 0;
  font-size: 1.05rem;
}

.plan-price {
  margin: var(--sp-2) 0 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.plan-option ul {
  margin: var(--sp-3) 0 0;
  padding-left: var(--sp-5);
  font-size: 0.9rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}

.form-grid .field + .field {
  margin-top: 0;
}

.invite-form {
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--gray-100);
}

.invite-form h3 {
  margin: 0 0 var(--sp-3);
  font-size: 1rem;
}

.search-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.search-row input {
  flex: 1;
}

.tabs {
  flex-wrap: wrap;
}

.audit-list {
  margin: 0;
  padding-left: var(--sp-5);
  font-size: 0.9rem;
}

.audit-list li + li {
  margin-top: var(--sp-1);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: 0.9rem;
}

.check input {
  width: auto;
  min-height: 0;
}

.input-narrow {
  width: 90px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.filter-row select {
  width: auto;
  min-width: 200px;
}

.stock-hint {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.stock-hint:empty {
  display: none;
}

.stock-hint.is-low {
  color: var(--warn-700);
  font-weight: 600;
}

.error-text {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  word-break: break-word;
}

.unplaced-list,
.offcut-list {
  margin: var(--sp-2) 0 0;
  padding-left: var(--sp-5);
}

.offcut-list {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.section-title {
  margin-top: var(--sp-6);
}

.sheet-drawing {
  margin-bottom: var(--sp-4);
}

.sheet-drawing svg {
  display: block;
  width: 100%;
  max-height: 70vh;
}

.plan-side details summary {
  cursor: pointer;
  font-weight: 600;
}

/* ---------- Duyarlı yerleşim ---------- */

@media (max-width: 1180px) {
  .plan-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .plan-layout .plan-side {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-4);
  }

  .plan-layout .plan-side > .card + .card {
    margin-top: 0;
  }

  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-panel {
    position: static;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 20;
    height: auto;
    flex-direction: row;
    gap: 0;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
  }

  .sidebar .brand,
  .sidebar .nav-label,
  .sidebar .nav-project-name,
  .sidebar-foot {
    display: none;
  }

  .sidebar .nav {
    flex: 1;
    flex-direction: row;
    justify-content: space-around;
  }

  .sidebar .nav a {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    min-height: 56px;
    padding: var(--sp-1);
    font-size: 0.7rem;
    border-radius: 0;
  }

  .sidebar .nav a[aria-disabled="true"] {
    display: none;
  }

  .mobile-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
    min-height: var(--topbar-h);
    padding: 0 var(--sp-4);
    background: var(--brand-900);
    color: #fff;
  }

  .mobile-bar .brand {
    padding: 0;
  }

  .page {
    padding: var(--sp-4) var(--sp-3) calc(88px + env(safe-area-inset-bottom));
  }

  .account-banner {
    padding: var(--sp-3) var(--sp-3) 0;
  }

  .card {
    padding: var(--sp-4);
  }

  .plan-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet-list {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    padding-bottom: var(--sp-2);
  }

  .sheet-thumb {
    flex: 0 0 200px;
  }

  .sheet-group-title {
    display: none;
  }

  .viewer-canvas {
    height: auto;
    min-height: 220px;
    max-height: 70vh;
    aspect-ratio: var(--sheet-ratio, 4 / 3);
  }

  .viewer-bar .viewer-title {
    order: -1;
    flex-basis: 100%;
  }

  .viewer-bar .zoom-value {
    margin-left: auto;
  }

  .page-head h1 {
    font-size: 1.3rem;
  }

  .input-title {
    font-size: 1.25rem;
  }
}

/* ---------- Dolap şablonları ve 3D görünüm ---------- */

dialog.cabinet-dialog {
  width: min(1100px, calc(100vw - 24px));
}

.cab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-5);
  margin-top: var(--sp-4);
}

.cab-types {
  border: none;
  padding: 0;
  margin: 0 0 var(--sp-4);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

.cab-types legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: var(--sp-2);
}

.cab-type {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  cursor: pointer;
  font-weight: 400;
}

.cab-type:has(input:checked) {
  border-color: var(--brand-500);
  background: var(--brand-50);
}

.cab-type input {
  margin-top: 3px;
  accent-color: var(--brand-600);
}

.cab-type span {
  display: grid;
}

.cab-type small {
  color: var(--gray-500);
  font-size: 0.8rem;
}

.cab-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
}

.cab-grid .field input,
.cab-grid .field select {
  width: 100%;
}

.cab-3d-wrap {
  position: relative;
}

.cab-3d-wrap > .btn {
  position: absolute;
  right: var(--sp-2);
  bottom: var(--sp-2);
  background: rgba(255, 255, 255, 0.9);
}

.cab-3d,
.scene-3d {
  height: 320px;
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  background: #f1f4f4;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.scene-3d {
  height: min(62vh, 620px);
  margin: var(--sp-3) 0;
}

.cab-3d canvas,
.scene-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

.cab-3d > p,
.scene-3d > p {
  padding: var(--sp-4);
  text-align: center;
}

.cab-desc {
  margin: var(--sp-3) 0 var(--sp-2);
  font-weight: 600;
}

.cab-table {
  font-size: 0.875rem;
}

.product-template {
  border-color: var(--brand-200);
}

.template-summary {
  margin: 0;
  padding: var(--sp-2) var(--sp-4);
  font-size: 0.875rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}

.parts-readonly {
  font-size: 0.875rem;
}

.scene-legend {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: var(--sp-1);
}

@media (max-width: 860px) {
  .cab-layout {
    grid-template-columns: 1fr;
  }

  .cab-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cab-3d {
    height: 240px;
  }
}

/* ---------- Yönlendirme: başlangıç kartı, (?) yardım, tanıtım turu ---------- */

.guide {
  border-color: var(--brand-200);
  background: linear-gradient(180deg, var(--brand-50), var(--gray-0) 70%);
  margin-top: var(--sp-4);
}

.guide.welcome h2 {
  font-size: 1.35rem;
  margin-bottom: var(--sp-2);
}

.guide-steps {
  list-style: none;
  margin: 0 0 var(--sp-4);
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3);
}

.guide-steps li {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-md);
  background: var(--gray-0);
}

.guide-steps li p {
  margin: var(--sp-1) 0 0;
  font-size: 0.875rem;
  color: var(--gray-600);
}

.guide-num {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--gray-100);
  color: var(--gray-700);
}

.guide-steps li.is-current {
  border-color: var(--brand-500);
  box-shadow: var(--focus);
}

.guide-steps li.is-current .guide-num,
.welcome .guide-num {
  background: var(--brand-600);
  color: #fff;
}

.guide-steps li.is-done .guide-num {
  background: var(--ok-600);
  color: #fff;
}

.guide-steps li.is-done strong {
  color: var(--ok-600);
}

.welcome .hint {
  margin-top: var(--sp-3);
}

.label-row {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.label-row label {
  margin-bottom: var(--sp-1);
}

.help {
  display: inline-block;
  vertical-align: middle;
}

.help-tip {
  width: 18px;
  height: 18px;
  margin: 0 0 1px 4px;
  padding: 0;
  border: 1px solid var(--gray-300);
  border-radius: 50%;
  background: var(--gray-0);
  color: var(--gray-600);
  font: 700 11px/16px var(--font);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.help-tip:hover,
.help-tip[aria-expanded="true"] {
  border-color: var(--brand-600);
  color: var(--brand-700);
  background: var(--brand-50);
}

.help-tip:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.help-pop {
  position: fixed;
  z-index: 60;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--gray-900);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  box-shadow: var(--shadow-lg);
}

.help-pop[hidden] {
  display: none;
}

.tour-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.tour-spot {
  position: fixed;
  z-index: 1001;
  border-radius: var(--r-md);
  box-shadow: 0 0 0 3px var(--brand-500), 0 0 0 9999px rgba(7, 20, 20, 0.55);
  pointer-events: none;
  transition: top 0.2s, left 0.2s, width 0.2s, height 0.2s;
}

.tour-pop {
  position: fixed;
  z-index: 1002;
  width: min(380px, calc(100vw - 24px));
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--gray-0);
  box-shadow: var(--shadow-lg);
}

.tour-pop h2 {
  font-size: 1.05rem;
  margin: var(--sp-1) 0 var(--sp-2);
}

.tour-pop p {
  margin: 0;
  color: var(--gray-700);
  font-size: 0.925rem;
  line-height: 1.5;
}

.tour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tour-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-700);
}

.tour-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot {
    transition: none;
  }
}

@media print {
  .guide,
  .help,
  .tour-backdrop,
  .tour-spot,
  .tour-pop,
  [data-act="tour"] {
    display: none !important;
  }
}

/* Parça tablosu → kart görünümü */
@media (max-width: 720px) {
  .parts thead {
    display: none;
  }

  .parts,
  .parts tbody {
    display: block;
  }

  .parts tr {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--sp-2);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--gray-100);
  }

  .parts td {
    display: block;
    width: auto !important;
    padding: 0;
  }

  .parts td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
  }

  .parts td.col-name {
    grid-column: 1 / -1;
  }

  .parts td.col-mat {
    grid-column: 1 / 3;
  }

  .parts td.col-act {
    grid-column: 3;
    text-align: right;
    align-self: end;
  }

  .parts td.col-act::before {
    content: none;
  }

  .parts td.col-grain,
  .parts td.col-edge {
    text-align: left;
  }

  .parts input[type="text"],
  .parts input[type="number"],
  .parts select {
    min-height: 44px;
  }

  .toggle-grain {
    width: 44px;
    height: 44px;
  }

  .edge-picker {
    width: 52px;
    height: 40px;
  }

  .product-head .field-qty {
    width: 96px;
  }

  .table.responsive thead {
    display: none;
  }

  .table.responsive tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--sp-1) var(--sp-3);
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--gray-100);
  }

  .table.responsive td {
    display: block;
    padding: 0;
    border: none;
    text-align: left !important;
  }

  .table.responsive td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--gray-500);
    font-size: 0.8rem;
  }

  .table.responsive td.cell-main,
  .table.responsive td.cell-actions {
    grid-column: 1 / -1;
  }

  .filter-row select {
    flex: 1;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition: none !important;
  }
}

/* ---------- Yazdırma ---------- */

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: #fff;
    font-size: 10pt;
  }

  .sidebar,
  .mobile-bar,
  .tabs,
  .page-actions,
  .no-print,
  .viewer-bar,
  .plan-layout .sheet-list {
    display: none !important;
  }

  .app {
    display: block;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .card {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .print-only {
    display: block;
  }

  .notice {
    display: none;
  }

  .sheet-drawing svg {
    max-height: 150mm;
  }

  .print-sheet {
    break-before: page;
  }

  .print-sheet:first-of-type {
    break-before: auto;
  }

  .print-sheet svg {
    width: 100%;
    max-height: 150mm;
  }

  .table {
    font-size: 9pt;
  }

  .table tr {
    break-inside: avoid;
  }

  .watermark {
    display: block;
    position: fixed;
    top: 40%;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 48pt;
    font-weight: 800;
    color: rgba(192, 57, 43, 0.18);
    transform: rotate(-18deg);
    pointer-events: none;
  }
}
