:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #dfe5ec;
  --primary: #145fca;
  --primary-dark: #0d4798;
  --primary-soft: #eaf2ff;
  --success: #087a55;
  --warning-bg: #fff8e8;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button, select, input { min-width: 0; }

.container {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  background: linear-gradient(135deg, #0c1f3c, #123c76 60%, #1768d9);
  color: #fff;
  padding: 30px 0;
  box-shadow: 0 8px 30px rgba(17, 48, 94, 0.2);
}
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.eyebrow, .section-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.eyebrow { color: #bfd6ff; margin-bottom: 8px; }
.section-kicker { color: var(--primary); margin-bottom: 4px; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 39px); line-height: 1.15; }
.topbar p { margin: 9px 0 0; color: #d9e7ff; }
.header-actions { display: flex; gap: 10px; flex-shrink: 0; }

.btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
  transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-secondary { background: #e9eef7; color: #26364d; }
.topbar .btn-secondary { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.full { width: 100%; }

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(410px, .8fr);
  gap: 22px;
  padding: 24px 0 50px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-panel { padding: 24px; }
.result-panel { padding: 24px; position: sticky; top: 18px; }

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.panel-title > div:first-child { display: flex; align-items: center; gap: 11px; }
.panel-title h2 { margin: 0; font-size: 22px; }
.step {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 850;
  flex: 0 0 auto;
}

.order-card, .extras-section {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px;
  background: #fbfcfe;
}
.shared-settings { background: #f7faff; border-color: #d7e5fb; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.section-heading h3, .part-header h3 { margin: 0; font-size: 18px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; max-width: 440px; text-align: right; }

.field-grid { display: grid; gap: 13px; }
.three-col-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-col-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-grid { margin-top: 14px; }
.compact-field { max-width: 180px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .mini-label { color: #344054; font-size: 13px; font-weight: 780; }
input[type="number"], input[type="text"], input[type="date"], select {
  width: 100%;
  height: 43px;
  border: 1px solid #cfd7e2;
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20,95,202,.12);
}

.option-grid { display: grid; gap: 11px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-card { display: block; position: relative; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid #cfd7e2;
  border-radius: 12px;
  background: #fff;
  min-height: 76px;
  transition: .18s ease;
}
.choice-content strong { font-size: 14px; }
.choice-content small { color: var(--muted); line-height: 1.35; }
.choice-card input:checked + .choice-content {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(20,95,202,.08);
}
.inline-field {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(180px, 1fr);
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.inline-field label { font-size: 14px; font-weight: 750; color: #344054; }
.narrow-inline { max-width: 520px; }

.part-section {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  transition: .2s ease;
}
.part-section:not(.is-disabled) { border-color: #bcd3f4; box-shadow: 0 8px 22px rgba(20,95,202,.06); }
.part-header {
  min-height: 76px;
  padding: 15px 17px;
  background: #f7f9fc;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.part-section:not(.is-disabled) .part-header { background: #f1f6ff; }
.part-title-wrap { display: flex; align-items: center; gap: 12px; }
.part-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #dfe8f5;
  color: #36506f;
  font-weight: 850;
}
.part-section:not(.is-disabled) .part-number { background: var(--primary); color: #fff; }
.part-controls { display: flex; align-items: center; gap: 14px; }
.switch-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c9d2df;
  position: relative;
  transition: .2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: .2s ease;
}
.switch-label input:checked + .switch { background: var(--primary); }
.switch-label input:checked + .switch::after { left: 21px; }
.switch-label b { font-size: 13px; color: #344054; }
.qty-input { display: flex; align-items: center; gap: 7px; }
.qty-input span { font-size: 12px; color: var(--muted); font-weight: 750; }
.qty-input input { width: 68px; text-align: center; }
.part-body { padding: 18px; transition: .2s ease; }
.part-section.is-disabled .part-body { opacity: .38; filter: grayscale(.25); pointer-events: none; }
.part-section.is-disabled .qty-input { opacity: .5; }
.compact-description p { margin: 0; color: var(--muted); line-height: 1.55; }

.fixed-structure {
  margin-bottom: 16px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 13px;
  padding: 14px;
}
.fixed-structure h4 { margin: 0 0 10px; font-size: 14px; }
.small-fixed { display: flex; align-items: center; gap: 14px; }
.small-fixed h4 { margin: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-list span { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; font-size: 12px; font-weight: 700; color: #344054; }

.conditional-box {
  margin-top: 15px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #dce3ed;
  border-radius: 13px;
}
.check-row { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 14px; cursor: pointer; }
.no-bottom { margin-bottom: 0; }
.check-row input, .check-card input { width: 19px; height: 19px; accent-color: var(--primary); margin-top: 2px; flex: 0 0 auto; }
.check-row span, .check-card span { display: flex; flex-direction: column; gap: 3px; }
.check-row small, .check-card small { color: var(--muted); line-height: 1.35; }
.check-card {
  min-height: 73px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  background: #fff;
  border: 1px solid #cfd7e2;
  border-radius: 11px;
  cursor: pointer;
}
.field-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.is-hidden { display: none !important; }

.extras-section { background: #fff; }
.extras-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.extra-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fbfcfe;
}
.extra-row span { font-size: 13px; font-weight: 720; color: #344054; }
.extra-row input { text-align: center; }
.extra-patik-row { grid-template-columns: minmax(0, 1fr) minmax(120px, .75fr) 82px; }
.custom-extras { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.custom-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.custom-title h4 { margin: 0; }
.custom-title span { color: var(--muted); font-size: 12px; font-weight: 750; }
.custom-extra-head, .custom-extra-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 100px 120px;
  gap: 9px;
  align-items: center;
}
.custom-extra-head { color: var(--muted); font-size: 11px; font-weight: 800; padding: 0 4px 7px; }
.custom-extra-row { margin-bottom: 9px; }

.result-title { border-bottom: 0; padding-bottom: 14px; }
.live-badge { color: var(--success); background: #e9f8f2; border: 1px solid #b7ead9; padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.result-order-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.result-order-info div { border: 1px solid var(--line); border-radius: 11px; padding: 11px; background: #fff; }
.result-order-info small, .summary-cards small { display: block; color: var(--muted); margin-bottom: 4px; }
.result-order-info strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 16px; }
.summary-cards div { background: #f8fafc; border: 1px solid var(--line); border-radius: 11px; padding: 11px; }
.summary-cards strong { font-size: 16px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; max-height: calc(100vh - 385px); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { position: sticky; top: 0; z-index: 2; background: #f2f5f9; color: #475467; text-align: left; padding: 11px 9px; border-bottom: 1px solid var(--line); }
tbody td { padding: 10px 9px; border-bottom: 1px solid #edf0f3; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
.qty-col, td.qty { text-align: right; font-weight: 850; }
td.no { width: 38px; color: var(--muted); }
td.unit { color: var(--muted); width: 65px; }
.item-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.empty-row td { text-align: center; color: var(--muted); padding: 30px 12px; }
.result-actions { margin-top: 14px; }
.pdf-button {
  background: linear-gradient(135deg, #145fca, #0d4798);
  color: #fff;
  padding: 14px 16px;
  letter-spacing: .025em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 8px 18px rgba(20,95,202,.2);
}
.pdf-button:hover { background: linear-gradient(135deg, #0f54b4, #0a3c84); }
.pdf-button:disabled { opacity: .65; cursor: wait; transform: none; }
.pdf-button svg { width: 22px; height: 22px; fill: currentColor; }
.calculation-note { margin-top: 14px; padding: 13px; border-radius: 11px; background: var(--warning-bg); border: 1px solid #f3dc9d; }
.calculation-note strong { font-size: 13px; }
.calculation-note p { margin: 5px 0 0; color: #6b5a2f; font-size: 12px; line-height: 1.45; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #101828;
  color: #fff;
  padding: 11px 15px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 100;
  font-size: 14px;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }



/* Şifreli giriş ekranı */
body.auth-locked { overflow: hidden; }
.app-shell { min-height: 100vh; }
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 20% 15%, rgba(42, 119, 231, .34), transparent 34%),
    radial-gradient(circle at 82% 86%, rgba(20, 95, 202, .28), transparent 32%),
    linear-gradient(135deg, #07162b, #0d2f61 54%, #1259b8);
  transition: opacity .28s ease, visibility .28s ease;
}
.login-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 24px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 28px 80px rgba(0,0,0,.3);
  text-align: center;
}
.login-card.is-shaking { animation: loginShake .34s ease; }
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.login-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 17px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), #0d3f8c);
  box-shadow: 0 12px 28px rgba(20,95,202,.28);
}
.login-icon svg { width: 31px; height: 31px; fill: #fff; }
.login-kicker {
  display: block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
}
.login-card h1 {
  margin: 7px 0 8px;
  color: #10213b;
  font-size: clamp(25px, 5vw, 34px);
}
.login-card > p {
  margin: 0 0 23px;
  color: var(--muted);
  line-height: 1.55;
}
.login-field { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.login-field span { color: #344054; font-size: 13px; font-weight: 800; }
.login-field input {
  width: 100%;
  height: 51px;
  padding: 0 15px;
  border: 1px solid #cfd8e5;
  border-radius: 12px;
  outline: 0;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(20,95,202,.12);
}
.login-error {
  min-height: 20px;
  margin: 8px 0 6px;
  color: #b42318;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}
.login-button {
  width: 100%;
  height: 51px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(20,95,202,.22);
  transition: transform .2s ease, box-shadow .2s ease;
}
.login-button:hover { transform: translateY(-1px); box-shadow: 0 15px 28px rgba(20,95,202,.3); }

.header-brand h1 { letter-spacing: .015em; }

/* Site alt telif alanı */
.site-footer { padding: 0 0 28px; }
.footer-inner { display: flex; justify-content: flex-end; }
.copyright-box {
  max-width: 760px;
  padding: 13px 16px;
  border: 1px solid #d7e0ea;
  border-radius: 12px;
  background: rgba(255,255,255,.8);
  color: #667085;
  text-align: right;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 8px 22px rgba(23,32,51,.05);
}
.copyright-box p { margin: 0; }
.copyright-box p + p { margin-top: 3px; }
.copyright-box strong {
  color: #172033;
  font-size: 15px;
  font-weight: 950;
}
.copyright-box a {
  color: var(--primary);
  font-weight: 900;
  text-decoration: none;
}
.copyright-box a:hover { text-decoration: underline; }


@media (max-width: 1120px) {
  .app-grid { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .table-wrap { max-height: none; }
}
@media (max-width: 760px) {
  .container { width: min(100% - 20px, 1480px); }
  .topbar { padding: 22px 0; }
  .topbar-inner { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions .btn { width: 100%; }
  .form-panel, .result-panel { padding: 15px; border-radius: 14px; }
  .main-panel-title h2, .result-title h2 { font-size: 18px; }
  .three-col-fields, .two-col-fields, .two-col, .extras-grid { grid-template-columns: 1fr; }
  .compact-field { max-width: none; }
  .section-heading { flex-direction: column; }
  .section-heading p { text-align: left; }
  .part-header { align-items: flex-start; flex-direction: column; }
  .part-controls { width: 100%; justify-content: space-between; }
  .inline-field { grid-template-columns: 1fr; gap: 7px; }
  .extra-patik-row { grid-template-columns: 1fr; }
  .custom-extra-head { display: none; }
  .custom-extra-row { grid-template-columns: 1fr 90px 105px; }
  .result-order-info { grid-template-columns: 1fr; }
  .summary-cards { grid-template-columns: 1fr; }
  .login-card { padding: 27px 21px; border-radius: 20px; }
  .footer-inner { justify-content: center; }
  .copyright-box { width: 100%; text-align: center; }
}
@media (max-width: 480px) {
  .custom-extra-row { grid-template-columns: 1fr 78px; }
  .custom-extra-row select { grid-column: 1 / -1; }
  .switch-label b { display: none; }
}

@media print {
  body { background: #fff; }
  .topbar, .form-panel, .result-actions, .toast, .login-screen, .site-footer { display: none !important; }
  .app-grid { display: block; padding: 0; }
  .container { width: 100%; }
  .result-panel { box-shadow: none; border: 0; padding: 0; }
  .live-badge { display: none; }
  .table-wrap { max-height: none; overflow: visible; }
  thead th { position: static; }
}

/* Canlı parça detayları */
.part-detail {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #d7e5fb;
  border-radius: 13px;
  background: #f7faff;
}
.part-detail > strong {
  display: block;
  margin-bottom: 10px;
  color: #23466f;
  font-size: 13px;
}
.detail-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.detail-chip-list span {
  padding: 6px 9px;
  border: 1px solid #cbdcf4;
  border-radius: 999px;
  background: #fff;
  color: #344054;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.25;
}

/* Dinamik serbest malzeme satırları */
.custom-extra-head,
.custom-extra-row {
  grid-template-columns: minmax(0, 1.5fr) 100px 120px 38px;
}
.btn-add-row {
  padding: 8px 12px;
  border: 1px solid #bcd3f4;
  background: #eef5ff;
  color: #145fca;
  font-size: 12px;
}
.remove-custom-row {
  width: 36px;
  height: 36px;
  border: 1px solid #f1c7c7;
  border-radius: 9px;
  background: #fff5f5;
  color: #b42318;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.remove-custom-row:hover { background: #ffe8e8; }

@media (max-width: 700px) {
  .custom-extra-head { display: none; }
  .custom-extra-row {
    grid-template-columns: minmax(0, 1fr) 82px 95px 38px;
  }
}

.custom-title > div { min-width: 0; }
.custom-title > div span { display: block; margin-top: 3px; }
