/* ZeyPam — uygulama kabuğu.
   Teklif belgesinin (A4) stilleri offer.css içindedir. */

:root {
  --ink: #14263d;
  --muted: #68778b;
  --line: #dce3ea;
  --bg: #f3f6f8;
  --card: #fff;
  --yellow: #ffd21f;
  --navy: #12263f;
  --danger: #bd2c35;
  --ok: #11835c;
  --shadow: 0 18px 50px rgba(18, 38, 63, .09);
  color: var(--ink);
}

html, body, button, input, select, textarea {
  font-family: "Nunito", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box }
body { margin: 0; background: var(--bg) }
button, input, select, textarea { font: inherit }

/* ---------- Kabuk ---------- */

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh }

.side {
  background: var(--navy);
  color: #fff;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex; gap: 12px; align-items: center;
  font-weight: 800; font-size: 20px; padding: 0 8px 28px;
}
.mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: #fff; color: var(--navy);
  border-radius: 12px;
}

.nav button {
  display: flex; width: 100%;
  border: 0; background: transparent; color: #b9c4d1;
  padding: 13px 14px; border-radius: 10px;
  text-align: left; cursor: pointer; margin: 3px 0;
}
.nav button.active, .nav button:hover { background: #203a59; color: #fff }
.nav small {
  display: block; color: #7f91a5; margin: 28px 14px 8px;
  text-transform: uppercase; letter-spacing: .1em;
}

/* Oturum kartı — kenar çubuğunun altına yapışır */
.side-user { margin-top: auto; border-top: 1px solid #23405f; padding-top: 14px }
.side-user b { display: block; font-size: 14px }
.side-user span { display: block; color: #8ea0b4; font-size: 12px; margin: 2px 0 10px; word-break: break-all }
.side-user .btn { width: 100%; justify-content: center }

.main { padding: 34px; max-width: 1500px; width: 100%; margin: auto }
.view { display: none }
.view.active { display: block }

.top {
  display: flex; justify-content: space-between;
  gap: 20px; align-items: flex-start; margin-bottom: 24px;
}

h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.03em }
h2 { margin: 0 0 18px; font-size: 20px }
h3 { margin: 0 0 12px }
.sub { color: var(--muted); margin: 0 }

/* ---------- Bileşenler ---------- */

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 15px; border-radius: 9px;
  font-weight: 700; cursor: pointer;
  transition: transform .12s;
}
.btn:hover { transform: translateY(-1px) }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none }
.btn.primary { background: var(--yellow); border-color: var(--yellow) }
.btn.dark { background: var(--navy); color: #fff; border-color: var(--navy) }
.btn.danger { color: var(--danger) }
.btn.sm { padding: 7px 10px; font-size: 13px }

.card {
  background: #fff; border: 1px solid #e4e9ee;
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 18px;
}

.grid { display: grid; gap: 16px }
.grid.two   { grid-template-columns: repeat(2, minmax(0, 1fr)) }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.grid.four  { grid-template-columns: repeat(4, minmax(0, 1fr)) }
.grid.five  { grid-template-columns: repeat(5, minmax(0, 1fr)) }

.stat b { font-size: 30px; display: block }
.stat span { color: var(--muted) }
.stat .stat-extra { display: block; font-size: 13px; color: var(--muted); margin-top: 4px }

label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px }
input, select, textarea {
  width: 100%; padding: 10px 11px;
  border: 1px solid #ccd5df; border-radius: 8px;
  background: #fff; color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { width: auto }
textarea { min-height: 110px; resize: vertical }
.field { margin-bottom: 14px }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px }

.table-wrap { overflow: auto }
table { border-collapse: collapse; width: 100%; font-size: 14px }
th {
  text-align: left; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; background: #f7f9fa;
}
th, td { padding: 12px 10px; border-bottom: 1px solid #e7ebef; vertical-align: middle }
td input, td select { min-width: 92px; padding: 7px }

.badge { display: inline-block; padding: 5px 8px; border-radius: 20px; background: #edf2f6; font-size: 12px }
.badge.ok     { color: var(--ok); background: #e8f7f1 }
.badge.draft  { color: #6b5710; background: #fff4cf }
.badge.sent   { color: #1b4f8a; background: #e6f0fb }
.badge.won    { color: var(--ok); background: #e8f7f1 }
.badge.lost   { color: var(--danger); background: #fbeaec }

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

.notice { padding: 12px; border-radius: 9px; background: #fff8d7; color: #6b5710; margin-bottom: 14px }
.notice.bad { background: #fbeaec; color: #8d2028 }
.error { color: var(--danger); font-size: 12px; margin-top: 4px }

/* ---------- Sihirbaz ---------- */

.steps { display: flex; gap: 8px; margin-bottom: 18px }
.step {
  flex: 1; padding: 10px; border-bottom: 3px solid #dfe5eb;
  color: var(--muted); font-weight: 700;
}
.step.active { border-color: var(--yellow); color: var(--ink) }
.wizard-pane { display: none }
.wizard-pane.active { display: block }

.product-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px }
.pick { border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer }
.pick.selected { border-color: #e3b900; background: #fffbed }
.pick input { width: auto }

.totals { margin-left: auto; max-width: 430px }
.total-row { display: flex; justify-content: space-between; padding: 9px 0 }
.total-row.grand { font-size: 20px; font-weight: 800; border-top: 2px solid var(--ink) }

/* ---------- Modal ---------- */

.modal {
  position: fixed; inset: 0;
  background: rgba(10, 24, 40, .65);
  display: none; align-items: center; justify-content: center;
  padding: 22px; z-index: 10;
}
.modal.open { display: flex }
.dialog {
  background: #fff; border-radius: 16px; padding: 22px;
  width: min(1000px, 96vw); max-height: 92vh; overflow: auto;
}
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px }
.close { font-size: 22px; border: 0; background: none; cursor: pointer }

.ranges { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px }
.range { background: #f5f7f9; padding: 10px; border-radius: 10px }
.range .grid { grid-template-columns: 1fr 1fr }
.range input { padding: 7px }
.range b { display: block; margin-bottom: 8px; font-size: 12px }

.toast {
  position: fixed; right: 25px; bottom: 25px;
  background: #14263d; color: #fff;
  padding: 13px 18px; border-radius: 10px; z-index: 30;
  opacity: 0; transform: translateY(10px); transition: .2s;
  pointer-events: none; max-width: min(420px, 90vw);
}
.toast.show { opacity: 1; transform: none }
.toast.bad { background: var(--danger) }

/* ---------- Kartlar / listeler ---------- */

.logo-preview {
  max-width: 210px; max-height: 80px; object-fit: contain;
  border: 1px dashed var(--line); padding: 8px; border-radius: 8px;
}

.saved-card {
  display: flex; justify-content: space-between; gap: 15px; align-items: center;
  padding: 15px; border: 1px solid var(--line); border-radius: 11px; margin: 8px 0;
}
.saved-card p { margin: 4px 0; color: var(--muted); font-size: 13px }

.danger-zone { border-color: #efd5d7 }

/* Genel bakış — aylık analiz */
.chart-grid {
  display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px; min-height: 0; padding-top: 16px;
}
.month-card { border: 1px solid #e0e6ec; border-radius: 13px; padding: 15px; background: #f8fafb }
.month-card small {
  display: block; color: var(--muted); font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 9px;
}
.month-card strong { display: block; font-size: 19px; color: var(--navy) }
.month-card span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px }

/* Kapak teması seçici */
.theme-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px }
.theme-choice { border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer }
.theme-choice:has(input:checked) { border-color: var(--yellow); background: #fffbed }
.theme-choice input { width: auto }
.theme-thumb { height: 78px; border-radius: 8px; margin-bottom: 8px; position: relative; overflow: hidden }
.theme-thumb:after {
  content: "Aa"; position: absolute; font-size: 24px; font-weight: 900;
  left: 14px; bottom: 10px;
}
.theme-thumb.dark { background: #12263f; color: #fff }
.theme-thumb.classic { background: #fff; border: 1px solid #e3e8ed; color: #1769aa }
.theme-thumb.classic:before {
  content: ""; position: absolute; width: 55px; height: 55px;
  border-radius: 50%; background: #11bdc7; right: 14px; top: 12px;
}
.theme-thumb.yellow { background: #ffd21f; color: #12263f }

.word-note { font-size: 12px; color: var(--muted) }
.import-summary { max-height: 180px; overflow: auto; font-size: 12px }

/* Tam sayfa yükleme perdesi */
.boot {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--bg); color: var(--muted); gap: 14px;
}
.boot[hidden] { display: none }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--navy);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- Duyarlı ---------- */

@media (max-width: 950px) {
  .shell { display: block }
  .side { height: auto; position: static; padding: 14px; display: block }
  .brand { padding-bottom: 10px }
  .nav { display: flex; overflow: auto }
  .nav small { display: none }
  .nav button { white-space: nowrap; width: auto }
  .side-user { display: flex; align-items: center; gap: 12px; margin-top: 12px }
  .side-user span { margin: 0 }
  .side-user .btn { width: auto }
  .main { padding: 20px }
  .grid.four, .grid.three, .grid.five, .product-pick { grid-template-columns: 1fr 1fr }
  .ranges { grid-template-columns: 1fr 1fr }
  .chart-grid { grid-template-columns: repeat(2, 1fr) }
}

@media (max-width: 700px) {
  .theme-choices { grid-template-columns: 1fr }
}

@media (max-width: 600px) {
  .grid.two, .grid.three, .grid.four, .grid.five, .product-pick { grid-template-columns: 1fr }
  .top { display: block }
  .actions { margin-top: 14px }
  .ranges { grid-template-columns: 1fr }
  .main { padding: 14px }
  .chart-grid { grid-template-columns: 1fr }
}

/* Yazdırırken yalnızca #printArea görünür — kuralların tamamı offer.css'te */
@media print {
  .shell, .modal, .toast, .boot { display: none !important }
}
