:root {
  --bg: #eef1f5; --panel: #ffffff; --ink: #1c2430; --muted: #66717f; --line: #dde3ea;
  --accent: #0b5cab; --danger: #c0392b; --ok: #1e8e5a; --warn: #b9770e; --nav: #0f2a44;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- Üst çubuk ---- */
#topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--nav); color: #fff; }
#topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .3px; margin-right: 4px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tb-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1; min-width: 0; }
#clock { text-align: right; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
#clock .t { font-size: 20px; font-weight: 700; }
#clock .d { font-size: 12px; opacity: .85; }
.tb-btn { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); color: #fff; padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tb-btn:hover { background: rgba(255,255,255,.22); }
.tb-btn.primary { background: #2f8cf0; border-color: #2f8cf0; font-weight: 600; }
.tb-btn.primary:hover { background: #4a9bf3; }
.sep { width: 1px; height: 22px; background: rgba(255,255,255,.25); }
.tb-pill { padding: 3px 10px; border-radius: 99px; font-size: 12px; background: #f4b942; color: #3a2a00; font-weight: 600; white-space: nowrap; }
#banner { padding: 10px 16px; background: #fdecea; color: #7a1d12; border-bottom: 1px solid #f3c2bc; font-weight: 500; }

/* ---- Düzen ---- */
#main { display: grid; grid-template-columns: minmax(520px, 700px) minmax(0, 1fr); gap: 16px; padding: 16px; align-items: start; }
@media (max-width: 1250px) { #main { grid-template-columns: minmax(0, 1fr); } }
#form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.card h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 .grow { flex: 1; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: 1fr 1fr 1fr; } .g4 { grid-template-columns: repeat(4, 1fr); }
.span2 { grid-column: span 2; }
label.f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
label.f.inline { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); min-width: 0;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.btn { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.btn:hover { background: #f4f6f9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: #e8f0fb; color: var(--accent); }
.warn { color: var(--danger); font-size: 12px; }
.ok { color: var(--ok); }
.err { color: var(--danger); }

/* ---- Kalemler ---- */
.item { border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: #fafbfd; display: grid; gap: 8px; min-width: 0; }
.item .l1 { display: grid; grid-template-columns: 30px 150px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.item .l2 { display: grid; grid-template-columns: 0.8fr 1fr 1.3fr 0.9fr 0.8fr 0.8fr 1.4fr; gap: 8px; align-items: end; }
.item .l3 { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 8px; align-items: start; }
.item .no { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.item .tot { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; padding: 7px 0; }
.item .acts { display: flex; gap: 4px; }
.item textarea.desc { min-height: 40px; }
.mini { font-size: 11px; color: var(--muted); display: block; margin-bottom: 2px; }
#totals-box { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; justify-content: end; margin-top: 10px; font-variant-numeric: tabular-nums; }
#totals-box .v { text-align: right; }
#totals-box .grand { font-size: 16px; font-weight: 800; color: var(--accent); }

/* ---- Hazır açıklama çipleri ---- */
.tsec { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.tsec:first-child { border-top: 0; padding-top: 0; }
.tsec .th { display: flex; align-items: center; gap: 8px; font-weight: 600; flex-wrap: wrap; }
.tsec .th .grow { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; max-width: 100%; text-align: left; line-height: 1.3; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on::before { content: "✓ "; }

/* ---- Kur paneli ---- */
.rates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.rate { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fafbfd; }
.rate .top { display: flex; justify-content: space-between; font-weight: 600; }

/* ---- Modal ---- */
#modal-bg { position: fixed; inset: 0; background: rgba(15,30,50,.55); z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
#modal-bg.on { display: flex; }
#modal { background: #fff; border-radius: 12px; width: min(920px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
#modal .mh { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; gap: 10px; }
#modal .mh .x { margin-left: auto; cursor: pointer; font-size: 22px; border: 0; background: none; line-height: 1; }
#modal .mb { padding: 14px 16px; max-height: 72vh; overflow: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 14px; cursor: pointer; border-bottom: 3px solid transparent; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.list td.r, table.list th.r { text-align: right; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover { background: #f4f8fd; }
.libl { display: grid; gap: 6px; }
.librow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.librow.item-only { grid-template-columns: minmax(0, 1fr) auto; }
.imgbox { border: 1px dashed var(--line); border-radius: 8px; padding: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fafbfd; }
.imgbox img { max-height: 54px; max-width: 160px; object-fit: contain; background: repeating-conic-gradient(#e4e8ee 0 25%, #fff 0 50%) 0 0 / 12px 12px; border: 1px solid var(--line); border-radius: 6px; padding: 3px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1c2430; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; }

/* ---- İlk kurulum ---- */
#wizard { position: fixed; inset: 0; z-index: 70; background: var(--bg); overflow: auto; display: none; }
#wizard.on { display: block; }
.wz { max-width: 760px; margin: 0 auto; padding: 28px 16px 60px; }
.wz h1 { margin: 0 0 4px; font-size: 24px; }
.wz .steps { display: flex; gap: 6px; margin: 16px 0; }
.wz .steps span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.wz .steps span.on { background: var(--accent); }
.wz .nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.wz .sect { margin-bottom: 14px; }
.wz .sect h4 { margin: 0 0 6px; }
.wz label.check { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 13.5px; cursor: pointer; }
.wz label.check input { margin-top: 3px; flex: none; }

/* ---- Önizleme / A4 sayfa ---- */
#preview-wrap { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; min-width: 0; }
.pv-title { display: none; margin: 4px 2px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
#sheet { --acc: var(--accent); width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; padding: 12mm 13mm; box-shadow: 0 4px 24px rgba(20,40,70,.18); color: #1a2230; font-size: 10pt; line-height: 1.35; display: flex; flex-direction: column; }
#sheet .hd { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 3px solid var(--acc); }
#sheet .firm { display: flex; gap: 12px; align-items: center; min-width: 0; }
#sheet .firm img { max-height: 18mm; max-width: 45mm; object-fit: contain; }
#sheet .firm .nm { font-size: 17pt; font-weight: 800; color: var(--acc); letter-spacing: .5px; line-height: 1.1; overflow-wrap: anywhere; }
#sheet .firm .sl { font-size: 8.5pt; color: #4b5767; letter-spacing: .6px; }
#sheet .title { text-align: right; flex: none; }
#sheet .title h1 { margin: 0; font-size: 18pt; letter-spacing: 1px; color: var(--acc); }
#sheet .meta { font-size: 9pt; margin-top: 3px; }
#sheet .meta b { display: inline-block; min-width: 88px; text-align: right; color: #4b5767; font-weight: 600; }
#sheet .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
#sheet .box { border: 1px solid #cfd8e3; border-radius: 6px; padding: 7px 10px; min-width: 0; overflow-wrap: anywhere; }
#sheet .box h4 { margin: 0 0 3px; font-size: 8pt; text-transform: uppercase; letter-spacing: .8px; color: var(--acc); }
#sheet .box .big { font-weight: 700; font-size: 10.5pt; }
#sheet .intro { margin: 2px 0 8px; white-space: pre-line; overflow-wrap: anywhere; }
#sheet table.t { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 9pt; }
#sheet table.t th { background: var(--acc); color: #fff; padding: 5px 6px; text-align: left; font-weight: 600; font-size: 8.5pt; }
#sheet table.t td { padding: 5px 6px; border-bottom: 1px solid #dfe5ec; vertical-align: top; overflow-wrap: anywhere; }
#sheet table.t tr { page-break-inside: avoid; }
#sheet table.t .r { text-align: right; white-space: nowrap; }
#sheet table.t .c { text-align: center; white-space: nowrap; }
#sheet table.t tbody tr:nth-child(even) td { background: #f7f9fc; }
#sheet .desc { color: #5a6677; font-size: 8.5pt; white-space: pre-line; }
#sheet .sum { display: flex; justify-content: flex-end; margin-top: 8px; page-break-inside: avoid; }
#sheet .sum table { border-collapse: collapse; min-width: 75mm; }
#sheet .sum td { padding: 3px 8px; }
#sheet .sum td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#sheet .sum tr.g td { background: var(--acc); color: #fff; font-weight: 800; font-size: 11pt; padding: 6px 8px; }
#sheet .words { margin-top: 6px; font-size: 8.8pt; color: #4b5767; text-align: right; font-style: italic; }
#sheet .terms { margin-top: 12px; display: grid; gap: 6px; }
#sheet .terms > div { page-break-inside: avoid; }
#sheet .terms h4 { margin: 0; font-size: 9pt; color: var(--acc); letter-spacing: .6px; border-bottom: 1px solid #cfd8e3; padding-bottom: 1px; text-transform: uppercase; }
#sheet .terms ul { margin: 2px 0 0; padding-left: 14px; font-size: 8.8pt; }
#sheet .rates-strip { margin-top: 10px; padding: 6px 10px; background: #f2f6fb; border: 1px solid #d3deec; border-radius: 6px; font-size: 8.5pt; page-break-inside: avoid; }
#sheet .rates-strip b { color: var(--acc); }
#sheet .sign { display: flex; justify-content: space-between; gap: 4%; margin-top: 18px; font-size: 9pt; page-break-inside: avoid; }
#sheet .sign > div { width: 48%; text-align: center; color: #4b5767; }
#sheet .sign .ln { border-top: 1px solid #9aa7b8; padding-top: 3px; }
#sheet .sign .stamp { height: 22mm; display: flex; align-items: flex-end; justify-content: center; }
#sheet .sign .stamp img { max-height: 22mm; max-width: 55mm; object-fit: contain; }
#sheet .grow { flex: 1; }
#sheet .ft { margin-top: 12px; padding-top: 6px; border-top: 3px solid var(--acc); font-size: 8.3pt; color: #4b5767; text-align: center; overflow-wrap: anywhere; }

@page { size: A4; margin: 12mm 13mm; }
@media print {
  body { background: #fff; }
  #topbar, #form, #toast, #modal-bg, #wizard, #banner, .pv-title { display: none !important; }
  #main { display: block; padding: 0; }
  #preview-wrap { position: static; max-height: none; overflow: visible; }
  #sheet { box-shadow: none; margin: 0; padding: 0; width: auto; min-height: 266mm; zoom: 1 !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Telefon ---- */
@media (max-width: 900px) {
  body { font-size: 15px; }
  input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea { font-size: 16px; padding: 9px; }
  #topbar { flex-wrap: wrap; padding: 8px 10px; gap: 6px; }
  #topbar .brand { order: 1; max-width: 55%; }
  #clock { order: 2; margin-left: auto; text-align: right; }
  #clock .t { font-size: 17px; }
  #tb-actions { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .tb-btn { padding: 7px 10px; font-size: 13px; flex: none; }
  .sep { display: none; }
  #main { padding: 10px; gap: 12px; }
  .card { padding: 12px; }
  .g4, .g3 { grid-template-columns: 1fr 1fr; } .g2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .item .l1 { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "no name name" "code code acts"; }
  .item .l1 .no { grid-area: no; } .item .l1 input[data-f=name] { grid-area: name; }
  .item .l1 input[data-f=code] { grid-area: code; } .item .l1 .acts { grid-area: acts; }
  .item .l2 { grid-template-columns: 1fr 1fr 1fr; }
  .item .l2 > div:last-child { grid-column: 1 / -1; }
  .item .l3 { grid-template-columns: 1fr; }
  .rates { grid-template-columns: 1fr 1fr; }
  .pv-title { display: block; }
  #preview-wrap { position: static; max-height: none; overflow: hidden; }
  #sheet { margin: 0; }
  #modal-bg { padding: 10px; } #modal .mb { overflow-x: auto; } table.list { min-width: 560px; }
  .librow { grid-template-columns: minmax(0, 1fr) auto; } .librow label { grid-column: 1 / -1; }
}

/* ---- Marka / yetkili servis rozetleri ---- */
#sheet .hd .lft { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#sheet .brands { display: flex; flex-wrap: wrap; gap: 3px 14px; align-items: center; }
#sheet .brands .bd { display: flex; align-items: center; gap: 6px; }
#sheet .brands img { max-height: 7mm; max-width: 24mm; object-fit: contain; }
#sheet .brands .bn { font-weight: 800; font-size: 8.5pt; letter-spacing: .5px; color: #2a3547; border: 1px solid #b8c3d1; border-radius: 3px; padding: 1px 6px; text-transform: uppercase; }
#sheet .brands .bt { font-size: 7.3pt; color: #5a6677; letter-spacing: .2px; max-width: 52mm; line-height: 1.2; }
.brow { border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: #fafbfd; display: grid; gap: 8px; margin-bottom: 8px; }
.bchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.bchip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 11px; cursor: pointer; font-size: 13px; }
.bchip:hover { border-color: var(--accent); }
.bchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.lock { background: #fff6e0; border: 1px solid #f0d58a; color: #7a5a00; padding: 8px 10px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.tb-btn.wa { background: #1fa855; border-color: #1fa855; font-weight: 600; }
.tb-btn.wa:hover { background: #25c061; }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; font-weight: 600; }
.btn.wa:hover { background: #25c061; }
.pubbar { position: sticky; top: 0; z-index: 10; display: flex; gap: 10px; align-items: center; padding: 8px 16px; background: #0f2a44; color: #fff; }
.pubbar .grow { flex: 1; }
#pubmsg { max-width: 560px; margin: 60px auto; padding: 0 16px; text-align: center; color: var(--muted); }
@media print { .pubbar { display: none !important; } }
body.pub { background: var(--bg); }
@media print { body.pub #preview-wrap { padding: 0 !important; } }

#topbar .brand .brand-ico { width: 28px; height: 28px; padding: 3px; background: #fff; border-radius: 8px; object-fit: contain; flex: none; }
#topbar .brand #brand { overflow: hidden; text-overflow: ellipsis; }
/* ---- Yükleme ekranı ---- */
#boot { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: #0f2a44; transition: opacity .35s; }
#boot.off { opacity: 0; pointer-events: none; }
.boot-in { text-align: center; color: #cfe0f5; }
.boot-plane { width: 96px; height: auto; animation: bootfly 1.6s ease-in-out infinite; background: #fff; border-radius: 22px; padding: 14px; }
.boot-lines { display: none; }
.boot-txt { margin-top: 18px; font-size: 14px; letter-spacing: .4px; }
.boot-txt::after { content: ''; display: inline-block; width: 1.4em; text-align: left; animation: bootdots 1.2s steps(1) infinite; }
@keyframes bootfly { 0%, 100% { transform: translate(-8px, 6px) rotate(-4deg); } 50% { transform: translate(8px, -8px) rotate(4deg); } }
@keyframes bootdots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@media (prefers-reduced-motion: reduce) { .boot-plane { animation: none; } }
@media print { #boot { display: none !important; } }
label.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; margin-right: 14px; }
#banner .btn { margin-left: 8px; }

/* ---- Sadeleştirme: katlanır kartlar ve alt işlem çubuğu ---- */
.card[data-fold] > h3 { cursor: pointer; user-select: none; margin-bottom: 0; }
.card[data-fold]:not(.collapsed) > h3 { margin-bottom: 10px; }
.card[data-fold] > h3::before { content: '▸'; color: var(--muted); font-size: 12px; width: 12px; }
.card[data-fold]:not(.collapsed) > h3::before { content: '▾'; }
.card.collapsed > :not(h3) { display: none !important; }
.csum { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 12.5px; }
.card:not(.collapsed) > h3 .csum { display: none; }
#actbar { position: sticky; bottom: 10px; z-index: 15; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px rgba(20,40,70,.18); }
#actbar .tot { flex: 1; min-width: 0; line-height: 1.15; }
#actbar .tot span { display: block; font-size: 12px; color: var(--muted); }
#actbar .tot b { font-size: 20px; color: var(--accent); font-variant-numeric: tabular-nums; }
#actbar .btns { display: flex; gap: 8px; }
#actbar .btn { padding: 9px 16px; font-weight: 700; }
@media (max-width: 900px) { #actbar { bottom: 0; border-radius: 12px 12px 0 0; margin: 0 -2px; } #actbar .btn { padding: 9px 12px; } #actbar .tot b { font-size: 17px; } }
@media print { #actbar { display: none !important; } }
#actbar .tot b { white-space: nowrap; }
@media (max-width: 900px) { #actbar .tot b { font-size: 16px; } #actbar .tot span { font-size: 11px; } #actbar { gap: 8px; padding: 8px 10px; } }

/* =====================  YENİLENEN GÖRÜNÜM  ===================== */
:root { --bg: #f3f6fb; --accent: #2563eb; --cyan: #38bdf8; --navy: #0f2a44; --radius: 16px; --line: #e2e8f2; }
body { background: radial-gradient(1200px 500px at 50% -120px, #dfeafe 0%, rgba(243,246,251,0) 70%), var(--bg); background-attachment: fixed; }
#topbar { background: linear-gradient(100deg, #0b2038 0%, #123a63 100%); box-shadow: 0 4px 18px rgba(8,25,45,.25); padding: 10px 18px; }
.tb-btn { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.18); border-radius: 10px; padding: 7px 13px; transition: background .15s, transform .1s; }
.tb-btn:hover { background: rgba(255,255,255,.2); }
.tb-btn.show { background: linear-gradient(135deg, #2563eb, #38bdf8); border-color: transparent; font-weight: 700; box-shadow: 0 4px 14px rgba(56,189,248,.35); }
.tb-btn.show:hover { transform: translateY(-1px); filter: brightness(1.06); }
#main { display: block; max-width: 900px; margin: 0 auto; padding: 22px 16px 40px; }
#form { gap: 18px; }
.card { border: 1px solid rgba(226,232,242,.9); border-radius: var(--radius); padding: 20px 22px; box-shadow: 0 1px 2px rgba(15,42,68,.04), 0 10px 30px rgba(15,42,68,.06); }
.card h3 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--navy); font-weight: 700; margin-bottom: 14px; gap: 10px; }
.card h3 .sn { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #2563eb, #38bdf8); flex: none; }
.card[data-fold] > h3::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 2px; }
.card[data-fold]:not(.collapsed) > h3::before { content: ''; transform: rotate(45deg); }
.csum { font-size: 13px; }
label.f { font-size: 12.5px; font-weight: 600; color: #5b6b82; gap: 5px; }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea { padding: 10px 12px; border: 1.5px solid #dbe3ef; border-radius: 11px; background: #fbfcfe; transition: border-color .15s, box-shadow .15s, background .15s; font-weight: 500; }
input:hover, select:hover, textarea:hover { border-color: #c4d2e6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.14); }
.btn { border-radius: 11px; padding: 8px 15px; border: 1.5px solid #d5deec; font-weight: 600; transition: transform .1s, box-shadow .15s, background .15s; }
.btn:hover { background: #f1f5fb; }
.btn.primary { background: linear-gradient(135deg, #2563eb, #3b82f6); border-color: transparent; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn.primary:hover { filter: none; background: linear-gradient(135deg, #1d4fd8, #2f74ee); transform: translateY(-1px); }
.btn.sm { padding: 4px 10px; border-radius: 9px; }
.pill { background: #e7f0ff; font-weight: 700; padding: 3px 11px; }
.item { border: 1.5px solid #e4ebf5; border-radius: 14px; background: #f9fbfe; padding: 14px; }
.item .no { background: linear-gradient(135deg, #2563eb, #38bdf8); }
#totals-box { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: #f3f7ff; border: 1px solid #dbe7fb; }
#totals-box .grand { font-size: 20px; color: var(--accent); }
.rate { border-radius: 12px; }
#actbar { border: 1px solid #dbe7fb; border-radius: 16px; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgba(15,42,68,.22); padding: 12px 16px; }
#actbar .tot b { font-size: 22px; }
#actbar .btn { padding: 10px 18px; }
.btn.wa { background: linear-gradient(135deg, #16a34a, #22c55e); border-color: transparent; box-shadow: 0 4px 12px rgba(34,197,94,.3); }
.btn.wa:hover { background: linear-gradient(135deg, #15803d, #16a34a); }

/* ---- Önizleme (tam ekran) ve filigran ---- */
#pv { position: fixed; inset: 0; z-index: 40; background: rgba(9,24,42,.82); backdrop-filter: blur(6px); overflow: auto; display: flex; flex-direction: column; }
#pv[hidden] { display: none; }
.pvbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: rgba(11,32,56,.96); color: #fff; box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.pvbar .pvt { font-weight: 700; letter-spacing: .3px; opacity: .9; }
.pvbar .grow { flex: 1; }
.pvbar .btn:not(.primary):not(.wa) { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.pvbar .btn:not(.primary):not(.wa):hover { background: rgba(255,255,255,.22); }
#preview-wrap { position: static; max-height: none; overflow: visible; padding: 26px 12px 50px; }
#sheetbox { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; overflow: hidden; border-radius: 4px; box-shadow: 0 24px 80px rgba(0,0,0,.5); }
#sheet { box-shadow: none; }
.wm { position: absolute; width: max-content; left: 50%; top: 42%; z-index: 2; pointer-events: none; user-select: none; transform: translate(-50%, -50%) rotate(-28deg); font-weight: 900; font-size: calc(60px * var(--k, 1)); letter-spacing: .12em; white-space: nowrap; color: rgba(71,85,105,.14); border: .09em solid rgba(71,85,105,.2); border-radius: .22em; padding: .05em .3em; text-transform: uppercase; }
.wm[hidden] { display: none; }
body.pv-open { overflow: hidden; }
@media (max-width: 900px) {
  #main { padding: 12px 10px 30px; }
  .card { padding: 14px; border-radius: 14px; }
  .pvbar { padding: 8px 10px; gap: 6px; } .pvbar .pvt { display: none; } .pvbar .btn { padding: 8px 10px; font-size: 13px; }
  #preview-wrap { padding: 14px 6px 40px; }
  #topbar { padding: 8px 10px; }
}
@media print {
  #pv { position: static !important; display: block !important; background: none !important; overflow: visible !important; backdrop-filter: none; }
  .pvbar, .wm { display: none !important; }
  #preview-wrap { padding: 0 !important; }
  #main { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  #sheetbox { width: auto; overflow: visible; box-shadow: none; border-radius: 0; }
  #sheet { box-shadow: none; border-radius: 0; }
  body { background: #fff !important; }
  body.pv-open { overflow: visible; }
}
