:root {
  --bg: #0f1116;
  --bg2: #161922;
  --card: #1a1e29;
  --line: #2a3040;
  --text: #eef1f7;
  --muted: #8d95a8;
  --accent: #e0568a;
  --accent2: #ff8db5;
  --ok: #2fbf71;
  --danger: #ef5a5a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 18px;
}
[data-theme="light"] {
  --bg: #f3f4f8;
  --bg2: #eef0f5;
  --card: #ffffff;
  --line: #dde1ea;
  --text: #171a22;
  --muted: #646c80;
  --accent: #c23a6e;
  --shadow: 0 8px 24px rgba(30,40,70,.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, rgba(224,86,138,.14), transparent 70%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mt { margin-top: 12px; }

/* ---------- header ---------- */
.top {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  max-width: 1240px; margin: 0 auto; padding: 14px 18px;
  padding-top: max(14px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; letter-spacing: .2px; }
.brand b { color: var(--accent); }
.top-actions { display: flex; gap: 8px; justify-self: end; }
.maker-logo {
  justify-self: center; display: block; background: #fff; border-radius: 12px; padding: 5px 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18); transition: transform .12s, box-shadow .12s; line-height: 0;
}
[data-theme="light"] .maker-logo { box-shadow: 0 0 0 1px var(--line); }
.maker-logo:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(224,86,138,.35); }
.maker-logo img { height: 36px; width: auto; display: block; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); display: grid; place-items: center; font-weight: 700;
}
.icon-btn:hover, .chip:hover { border-color: var(--accent); }

main { max-width: 1240px; margin: 0 auto; padding: 0 18px 20px; }
.intro { text-align: center; margin: 4px auto 18px; max-width: 760px; }
.intro h1 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); margin: 6px 0 6px; line-height: 1.2; }
.intro p { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 16px 18px 18px; }
.panel + .panel { margin-top: 14px; }
.panel h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 9px; }
.num {
  width: 24px; height: 24px; border-radius: 8px; background: var(--accent); color: #fff;
  display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700;
}
.ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { padding: 3px 11px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); font-size: .8rem; }

.chip {
  border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 7px 11px;
  font-size: .9rem; line-height: 1.1;
}
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px; background: var(--accent); color: #fff; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn.big { padding: 14px 22px; font-size: 1.05rem; box-shadow: 0 8px 22px rgba(224,86,138,.35); }
.btn:active, .chip:active { transform: scale(.97); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- form ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid { display: grid; gap: 10px 12px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: 1.3fr 1fr 1fr; }
.span2 { grid-column: span 2; }
.grid + .grid, .seg + .grid { margin-top: 10px; }
.f { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; color: var(--muted); min-width: 0; }
.f > .swatches { margin-top: 2px; }
section > .f { margin-top: 12px; }
input, select, textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--bg2); border-radius: 10px;
  padding: 9px 11px; font-size: .95rem; color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224,86,138,.2); }
input[type="date"] { color-scheme: dark; }
[data-theme="light"] input[type="date"] { color-scheme: light; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 9px; font-weight: 600; color: var(--muted); }
.seg button.active { background: var(--accent); color: #fff; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.sw.active { box-shadow: 0 0 0 2px var(--text); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: .9rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { width: 42px; height: 24px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch em { font-style: normal; }

/* logo */
.logo-row { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.logo-drop {
  position: relative; width: 150px; height: 84px; flex: none; border: 2px dashed var(--line); border-radius: 14px;
  display: grid; place-items: center; cursor: pointer; background: var(--bg2); overflow: hidden; text-align: center;
  transition: border-color .12s;
}
.logo-drop:hover, .logo-drop.drag { border-color: var(--accent); }
.logo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logo-drop img { max-width: 88%; max-height: 74%; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px; }
.logo-drop span { display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.logo-drop b { color: var(--accent); font-size: .95rem; }
.logo-drop small { color: var(--muted); font-size: .72rem; }
.logo-side p { margin: 0 0 8px; }

/* ---------- önizleme ---------- */
.sticky { position: sticky; top: 12px; }
.prev-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.paper-wrap {
  border-radius: 14px; background: #4a5263; padding: 14px; box-shadow: var(--shadow); overflow: hidden;
  max-height: calc(100vh - 170px); overflow-y: auto;
}
[data-theme="light"] .paper-wrap { background: #cfd5e0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.actions .big { grid-column: span 2; }
#status { min-height: 1.2em; margin: 8px 0 0; }

/* ---------- alt ---------- */
.about { margin-top: 22px; }
.about h2 { margin-bottom: 8px; }
.steps { margin: 8px 0 10px; padding-left: 20px; line-height: 1.6; }
.foot { max-width: 1240px; margin: 0 auto; padding: 8px 18px 28px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.modal { position: fixed; inset: 0; background: rgba(5,8,14,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { max-width: 520px; width: 100%; padding: 22px; position: relative; }
.modal-box h2 { margin: 0 0 10px; }
.close { position: absolute; top: 12px; right: 12px; }
.help-list { margin: 0; padding-left: 20px; line-height: 1.6; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .paper-wrap { max-height: none; }
}
@media (max-width: 640px) {
  .top { grid-template-columns: auto 1fr auto; padding: 10px 12px; }
  .brand span { display: none; }
  .maker-logo img { height: 30px; }
  main { padding: 0 12px 16px; }
  .panel { padding: 14px; }
  .g3 { grid-template-columns: 1fr 1fr; }
  .g3 > :first-child { grid-column: span 2; }
  .paper-wrap { padding: 8px; }
  .logo-drop { width: 120px; height: 72px; }
}

/* ================= Nova Sözleşme ================= */
.mt2 { margin-top: 18px; }
.hint { margin: -4px 0 10px; }
.sub-h { margin: 16px 0 8px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.ro { border: 1px dashed var(--line); border-radius: 10px; padding: 9px 11px; font-size: .95rem; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.ro.neg { color: var(--danger); }

.sectors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.sec {
  border: 1px solid var(--line); background: var(--bg2); border-radius: 14px; padding: 10px 4px 9px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--muted); line-height: 1.15; text-align: center;
}
.sec i { font-style: normal; font-size: 1.5rem; line-height: 1; }
.sec:hover { border-color: var(--accent); }
.sec.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg2)); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; }

/* hizmet ve taksit satırları */
.row { display: grid; gap: 6px; align-items: center; margin-bottom: 6px; }
.item { grid-template-columns: minmax(0, 1fr) 130px 32px; }
.inst { grid-template-columns: 26px minmax(0, 1fr) 130px 32px; }
.inst .ix { color: var(--muted); font-size: .8rem; text-align: center; }
.row input { padding: 8px 9px; font-size: .92rem; }
.row .amt { text-align: right; font-variant-numeric: tabular-nums; }
.del { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--muted); line-height: 1; }
.del:hover { color: var(--danger); border-color: var(--danger); }
.add { margin-top: 4px; width: 100%; border-style: dashed !important; }
.sum-line { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-end; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sum-line b { color: var(--text); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick button { border: 1px solid var(--line); background: var(--bg2); border-radius: 99px; padding: 4px 11px; font-size: .8rem; color: var(--muted); }
.quick button:hover { border-color: var(--accent); color: var(--text); }

/* maddeler */
.nums { margin-bottom: 12px; }
.clauses { display: flex; flex-direction: column; gap: 6px; }
.cl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); }
.cl.off { opacity: .5; }
.cl.off .cl-t { text-decoration: line-through; }
.cl input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.cl-t { font-size: .87rem; line-height: 1.45; }
.cl-t .edited { display: inline-block; margin-left: 6px; font-size: .7rem; color: var(--accent); font-weight: 700; }
.cl textarea { font-size: .87rem; min-height: 70px; background: var(--card); }
.cl-b { display: flex; gap: 4px; }
.cl-b button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .9rem; }
.cl-b button:hover { border-color: var(--accent); color: var(--text); }
.cl-edit { grid-column: 2 / 4; display: flex; flex-direction: column; gap: 6px; }
.cl-edit .btn { align-self: flex-start; }

/* tanıtım bandı */
.promo {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-top: 12px; padding: 12px 14px;
  border-radius: 14px; text-decoration: none; color: var(--text);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 22%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}
.promo b { display: block; font-size: .88rem; line-height: 1.35; }
.promo small { display: block; color: var(--muted); font-size: .78rem; margin-top: 3px; }
.promo-ic { font-size: 1.6rem; }
.promo-go { background: var(--accent); color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.promo:hover { border-color: var(--accent); }
.promo.flash { animation: flash 1.2s ease 2; }
@keyframes flash { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); } }

.about details { border-top: 1px solid var(--line); padding: 10px 0; }
.about summary { cursor: pointer; font-weight: 600; }
.about details p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }

/* ---------- önizleme kâğıdı ---------- */
.paper-wrap { container-type: inline-size; }
.paper {
  --pc: #c23a6e;
  background: #fff; color: #1f2430; width: 100%; min-height: calc(100cqw * 297 / 210); border-radius: 3px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); padding: 6.5% 6.5% 4%; font-family: Roboto, "Segoe UI", Arial, sans-serif;
  font-size: 1.5cqw; line-height: 1.42; display: flex; flex-direction: column;
}
.paper + .paper { margin-top: 14px; }
.pp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 4%; }
.pp-logo { max-width: 40%; max-height: 5.5em; object-fit: contain; }
.pp-sname { font-size: 1.7em; font-weight: 700; color: var(--pc); }
.pp-title { text-align: right; max-width: 58%; }
.pp-title h3 { margin: 0; font-size: 1.45em; letter-spacing: .03em; color: var(--pc); font-weight: 800; line-height: 1.2; }
.pp-meta { margin-top: .4em; font-size: .92em; color: #5b6272; }
.pp-meta b { color: #1f2430; }
.pp-bar { height: .3em; background: var(--pc); border-radius: 1em; margin: 1em 0 1em; }
.pp-h { font-size: .95em; font-weight: 800; color: var(--pc); letter-spacing: .05em; margin: 1.3em 0 .5em; padding-bottom: .25em; border-bottom: 1px solid #e6e9ef; }
.pp-intro { color: #4a5060; margin-bottom: .8em; }
.pp-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 5%; }
.pp-lbl { font-size: .8em; text-transform: uppercase; letter-spacing: .08em; color: var(--pc); font-weight: 700; margin-bottom: .2em; }
.pp-party b { font-size: 1.08em; }
.pp-party div { color: #4a5060; }
.pp-kv { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: .3em 1em; }
.pp-kv span:nth-child(odd) { color: #6b7282; white-space: nowrap; }
.pp-kv span:nth-child(even) { font-weight: 600; }
.pp-kv .wide { grid-column: span 3; }
.pp-table { width: 100%; border-collapse: collapse; font-size: .95em; }
.pp-table th { background: var(--pc); color: #fff; font-weight: 600; text-align: left; padding: .45em .6em; }
.pp-table td { padding: .42em .6em; border-bottom: 1px solid #e6e9ef; }
.pp-table tr:nth-child(even) td { background: #f6f8fb; }
.pp-table .r { text-align: right; white-space: nowrap; }
.pp-table .c { text-align: center; }
.pp-table tr.tot td { font-weight: 700; background: #fff; }
.pp-table tr.grand td { background: var(--pc); color: #fff; font-weight: 800; }
.pp-words { font-style: italic; color: #4a5060; margin-top: .5em; }
.pp-ol { margin: 0; padding-left: 1.6em; color: #2b303c; }
.pp-ol li { margin-bottom: .3em; text-align: justify; }
.pp-close { margin-top: 1.2em; color: #2b303c; }
.pp-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 8%; margin-top: 1.4em; }
.pp-sign { border: 1px solid #d5dae3; border-radius: .4em; padding: .6em .8em; min-height: 8em; display: flex; flex-direction: column; }
.pp-sign .pp-lbl { margin-bottom: .3em; }
.pp-sign small { color: #8a91a1; margin-top: auto; }
.pp-foot { margin-top: auto; padding-top: 1.4em; display: flex; justify-content: space-between; gap: 1em; font-size: .75em; color: #9aa1b0; }
.pp-foot .sig b { color: var(--pc); font-weight: 600; }
.pp-empty { color: #aab0bd; font-style: italic; }
.pp-note { color: #4a5060; margin-top: .4em; }
.pp-note b { color: #1f2430; }
/* makbuz */
.rc { display: flex; flex-direction: column; gap: .5em; }
.rc-copy { font-size: .78em; font-weight: 700; letter-spacing: .08em; color: #fff; background: var(--pc); border-radius: 99px; padding: .15em .8em; align-self: flex-start; }
.rc-amt { border: 2px solid var(--pc); border-radius: .5em; padding: .5em .8em; display: flex; justify-content: space-between; align-items: center; font-size: 1.15em; }
.rc-amt b { font-size: 1.3em; color: var(--pc); }
.rc-cut { border: 0; border-top: 1.5px dashed #aab0bd; margin: 1.6em 0; position: relative; overflow: visible; }
.rc-cut::after { content: "\2702"; position: absolute; left: 0; top: -.75em; background: #fff; color: #8a91a1; padding-right: .4em; }
.rc .pp-signs { margin-top: .6em; }
.rc .pp-sign { min-height: 5.5em; }

@media (max-width: 640px) {
  .sectors { grid-template-columns: repeat(3, 1fr); }
  .item { grid-template-columns: minmax(0, 1fr) 104px 32px; }
  .inst { grid-template-columns: 20px minmax(0, 1fr) 104px 32px; }
  .pp-kv { grid-template-columns: auto 1fr; }
  .pp-kv .wide { grid-column: auto; }
  .promo { grid-template-columns: auto 1fr; }
  .promo-go { grid-column: span 2; text-align: center; }
}
