:root {
  --ink: #16202e;
  --muted: #5c6878;
  --line: #d9dee6;
  --bg: #f3f5f8;
  --card: #ffffff;
  --navy: #12305f;
  --navy-2: #1d4486;
  --accent: #b5892e;
  --ok: #1d7a4a;
  --ok-bg: #e5f4ec;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --err: #a12a2a;
  --err-bg: #fbe8e8;
  --radius: 10px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; line-height: 1.45; }
a { color: var(--navy-2); }
h1 { font-size: 1.35rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1.1rem 0 .6rem; color: var(--navy); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
small { font-size: .82em; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* Üst menü */
.topbar { display: flex; align-items: center; gap: 1.5rem; background: var(--navy); color: #fff; padding: .55rem 1.4rem; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,.15); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 600; line-height: 1.1; }
.brand img { width: 38px; height: 38px; border-radius: 50%; background: #fff; }
.brand small { font-weight: 400; opacity: .75; }
.topbar nav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: #dbe4f5; text-decoration: none; padding: .45rem .8rem; border-radius: 7px; }
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 99px; background: var(--accent); color: #fff; font-size: .78rem; text-align: center; font-weight: 700; }
.count.big { font-size: .95rem; padding: .1em .6em; }
.me { display: flex; align-items: center; gap: .8rem; }
.me a { color: #fff; text-decoration: none; line-height: 1.1; text-align: right; }
.me a small { display: block; opacity: .7; }
.me a.out { border: 1px solid rgba(255,255,255,.35); padding: .35rem .7rem; border-radius: 7px; }

.wrap { max-width: 1240px; margin: 1.4rem auto; padding: 0 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; box-shadow: 0 1px 2px rgba(16,32,64,.04); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.narrow { max-width: 460px; margin: 6vh auto; }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
.two-col > .card { margin: 0; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Bildirimler */
.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: .9rem; border: 1px solid; }
.f-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cf; }
.f-warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d9a4; }
.f-err { background: var(--err-bg); color: var(--err); border-color: #efc2c2; }

/* Butonlar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--navy-2); color: #fff; border: 1px solid var(--navy-2); padding: .55rem 1rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy); }
.btn.ghost { background: #fff; color: var(--navy-2); border-color: #c4cfe0; }
.btn.ghost:hover { background: #f0f4fa; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.danger.ghost { background: #fff; color: var(--err); border-color: #e5b6b6; }
.btn.sm { padding: .3rem .65rem; font-size: .85rem; font-weight: 500; }
.btn.wide { width: 100%; }
.actions { display: flex; gap: .6rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack { display: grid; gap: .5rem; margin-top: 1rem; }

/* Formlar */
.form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .85rem; }
.form input:not([type=checkbox]):not([type=file]), .form select, .form textarea, .filters input, .filters select {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; font: inherit; font-weight: 400; border: 1px solid #c8d0dc; border-radius: 8px; background: #fff; color: var(--ink);
}
.form textarea { font-family: "Times New Roman", Times, serif; font-size: 1.05rem; line-height: 1.55; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid #9db7e6; border-color: var(--navy-2); }
.form input[type=file] { margin-top: .4rem; font-weight: 400; }
.row2, .row3 { display: grid; gap: 1rem; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 180px 200px 1fr; }
@media (max-width: 760px) { .row2, .row3 { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem 1rem; }
legend { font-weight: 600; padding: 0 .4rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .3rem 1rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin: .2rem 0; cursor: pointer; }
label.check input { width: 18px; height: 18px; }
.hint { color: var(--muted); }
.sep { border-top: 1px dashed var(--line); padding-top: 1rem; margin-top: 1rem; }
details summary { cursor: pointer; color: var(--err); margin: .8rem 0 .5rem; font-weight: 600; }

/* Tablolar */
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 2px solid var(--line); padding: .5rem .6rem; }
.grid td { border-bottom: 1px solid #edf0f4; padding: .6rem; vertical-align: top; }
.grid tr:hover td { background: #fafbfd; }
.grid tr.pasif td { opacity: .5; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.no { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); white-space: nowrap; }
.ozet { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.filters { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label { font-size: .82rem; font-weight: 600; min-width: 130px; }
.filters label.grow { flex: 1; min-width: 220px; }

.badge { display: inline-block; padding: .12rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.b-taslak { background: #eceff3; color: #4a5565; }
.b-imzada { background: var(--warn-bg); color: var(--warn); }
.b-tamam { background: var(--ok-bg); color: var(--ok); }
.b-muhalif { background: var(--err-bg); color: var(--err); }
.bar { height: 6px; background: #e8ecf2; border-radius: 99px; overflow: hidden; width: 140px; margin: .35rem 0 .15rem; }
.bar span { display: block; height: 100%; background: var(--ok); }

/* Giriş */
body.center { display: block; }
.login-card { padding: 1.8rem; }
.login-head { display: flex; gap: .8rem; align-items: center; margin-bottom: 1rem; }
.login-head img { width: 64px; height: 64px; }
.kurum { font-weight: 700; color: var(--navy); }
.kurum2 { color: var(--muted); font-size: .88rem; }
.list li { margin: .25rem 0; }

/* Karar görünümü */
.karar-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
@media (max-width: 1050px) { .karar-layout { grid-template-columns: 1fr; } }
.karar-belge-alani { background: #e6e9ee; border-radius: var(--radius); padding: 1.2rem; overflow-x: auto; }
.karar-yan .card { margin-bottom: 1rem; }
.meta { display: grid; gap: .5rem; }
.meta div { display: flex; justify-content: space-between; align-items: center; }
.meta span:first-child { color: var(--muted); font-size: .88rem; }
.imza-kutusu { border-color: #c9d7f0; background: #f8fafe; }
.imza-onizleme { background: #fff; border: 1px dashed #c4cfe0; border-radius: 8px; padding: .5rem; text-align: center; margin-bottom: .8rem; }
.imza-onizleme img { max-height: 90px; max-width: 100%; }
.imzacilar { list-style: none; padding: 0; margin: 0; }
.imzacilar li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #eef1f5; }
.imzacilar .dot { width: 10px; height: 10px; border-radius: 50%; background: #c7ced8; flex: none; }
.imzacilar .d-onay .dot { background: var(--ok); }
.imzacilar .d-muhalif .dot { background: var(--err); }
.imzacilar .who { flex: 1; font-size: .9rem; line-height: 1.2; }
.imzacilar .who small, .imzacilar .when small { display: block; color: var(--muted); }
.imzacilar .when { font-size: .82rem; text-align: right; }
.imzacilar form.inline { margin: 0; }
.imzacilar .x { border: 0; background: none; color: var(--err); font-size: 1.2rem; cursor: pointer; }
.log { list-style: none; padding: 0; margin: 0; font-size: .85rem; max-height: 260px; overflow: auto; }
.log li { padding: .3rem 0; border-bottom: 1px solid #f0f2f5; }
.log small { color: var(--muted); display: block; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: .35rem .8rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }

/* İmza alanı */
.pad-wrap { position: relative; border: 2px dashed #b9c6db; border-radius: 10px; background: #fff; }
#imzaPad { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.pad-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa6b6; pointer-events: none; }

/* ---------- Resmî belge (A4) ---------- */
.belge { position: relative; width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; padding: 12mm 14mm 14mm; font-family: "Times New Roman", Times, serif; font-size: 12pt; color: #000; box-shadow: 0 2px 14px rgba(0,0,0,.12); }
.belge.taslak-filigran::before { content: attr(data-filigran); position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-30deg); font-size: 64pt; font-weight: 700; color: rgba(160, 30, 30, .09); white-space: nowrap; pointer-events: none; font-family: Arial, sans-serif; }
.belge-ust { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6mm; }
.belge-ust img { width: 24mm; height: 24mm; object-fit: contain; }
.belge-baslik { text-align: center; font-weight: 700; font-size: 11pt; line-height: 1.35; }
.belge-tablo, .imza-tablo { width: 100%; border-collapse: collapse; }
.belge-tablo > tbody > tr > td, .imza-tablo td { border: 1px solid #000; }
.belge-tablo > tbody > tr > td { padding: 3mm 3.5mm; vertical-align: top; text-align: justify; }
.belge-bilgi > td { height: 26mm; }
.bilgi-satir { display: flex; flex-wrap: wrap; gap: 2mm 9mm; margin-bottom: 2mm; }
.belge-metin > td { height: 118mm; line-height: 1.5; }
.imza-tablo { margin-top: 5mm; }
.imza-tablo td { height: 10.7mm; padding: 0 2.5mm; vertical-align: middle; }
.i-gorev { width: 34mm; white-space: nowrap; font-weight: 700; }
.i-ad { width: 94mm; }
.i-imza { text-align: center; }
.i-imza img { max-height: 10mm; max-width: 52mm; vertical-align: middle; }
.bekliyor-yazi { color: #999; font-style: italic; font-size: 9.5pt; font-family: Arial, sans-serif; }
.muhalif { font-size: 9pt; font-weight: 700; }
.serhler { margin-top: 4mm; font-size: 10.5pt; }
.serhler p { margin: 1.5mm 0; }

/* Yazdırma sayfası */
body.yazdir { background: #e6e9ee; }
.yazdir-arac { max-width: 210mm; margin: 1rem auto; display: flex; gap: 1rem; align-items: center; font-family: system-ui, sans-serif; font-size: .9rem; }
body.yazdir .belge { margin-bottom: 2rem; }
@page { size: A4; margin: 0; }
@media print {
  body, body.yazdir { background: #fff; }
  .topbar, .yazdir-arac, .karar-yan { display: none !important; }
  .belge { box-shadow: none; margin: 0; width: 210mm; min-height: 0; }
  .belge-metin > td { height: 104mm; }
  .belge { padding: 9mm 13mm 8mm; }
  .belge-ust { margin-bottom: 4mm; }
}

/* ---------- Karar metni tablo desteği ---------- */
.metin-alani { margin-bottom: .85rem; }
.metin-ust { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.metin-ust .lbl { font-weight: 600; font-size: .9rem; }
.metin-alani textarea { display: block; width: 100%; padding: .55rem .7rem; border: 1px solid #c8d0dc; border-radius: 8px; font-family: "Times New Roman", Times, serif; font-size: 1.05rem; line-height: 1.55; resize: vertical; }
.small { font-size: .82rem; margin: .35rem 0 0; }
.onizleme { margin-top: .8rem; background: #e6e9ee; border-radius: 8px; padding: .8rem; }
.belge-mini { background: #fff; padding: 1rem 1.2rem; font-family: "Times New Roman", Times, serif; font-size: 12pt; text-align: justify; line-height: 1.5; border: 1px solid #000; }

.karar-tablo { width: 100%; border-collapse: collapse; margin: 2.5mm 0; font-size: 10.5pt; line-height: 1.3; text-align: left; page-break-inside: auto; }
.karar-tablo th, .karar-tablo td { border: 1px solid #000; padding: 1.2mm 2mm; vertical-align: top; }
.karar-tablo th { background: #eceff3; font-weight: 700; text-align: center; }
.karar-tablo tr { page-break-inside: avoid; }
@media print { .karar-tablo th { background: #e6e6e6; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

.tablo-dlg { width: min(960px, 96vw); max-height: 90vh; border: 0; border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.tablo-dlg::backdrop { background: rgba(14, 26, 48, .45); }
.tablo-dlg .dlg-head, .tablo-dlg .dlg-alt { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; }
.tablo-dlg .dlg-head { border-bottom: 1px solid var(--line); }
.tablo-dlg .dlg-head h3 { margin: 0; flex: 1; }
.tablo-dlg .dlg-alt { border-top: 1px solid var(--line); }
.tablo-dlg .x { border: 0; background: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); }
.dlg-govde { padding: .9rem 1.1rem; overflow: auto; max-height: calc(90vh - 130px); }
.yapistir { margin-bottom: .8rem; }
.yapistir summary { color: var(--navy-2); }
.yapistir textarea { width: 100%; margin: .4rem 0; padding: .5rem; border: 1px solid #c8d0dc; border-radius: 8px; font: inherit; font-size: .9rem; }
.tablo-arac { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; }
.tablo-arac label.check { margin-left: auto; }
.tablo-izgara-wrap { overflow: auto; }
.tablo-izgara { border-collapse: collapse; min-width: 100%; }
.tablo-izgara td { border: 1px solid #c8d0dc; padding: 0; min-width: 110px; }
.tablo-izgara td input { width: 100%; border: 0; padding: .45rem .5rem; font: inherit; font-size: .92rem; background: transparent; }
.tablo-izgara td input:focus { outline: 2px solid #9db7e6; background: #f6f9ff; }
.tablo-izgara tr.bas td { background: #eef2f8; }
.tablo-izgara tr.bas td input { font-weight: 700; }
.tablo-izgara .no-col { background: #f3f5f8; color: var(--muted); font-size: .75rem; font-weight: 600; padding: .2rem .45rem; border: 1px solid #dde2ea; text-align: center; min-width: 0; }
[hidden] { display: none !important; }
#izgara td input { margin: 0; border: 0; border-radius: 0; display: block; width: 100%; padding: .45rem .5rem; background: transparent; }
#izgara td input:focus { outline: 2px solid #9db7e6; outline-offset: -2px; background: #f6f9ff; }
#izgara tr.bas td input { font-weight: 700; }

/* ---------- Tablonun sayfa genişliğini aşmaması ---------- */
/* Dış belge tablosu sabit genişlikte kalır; içerik onu genişletemez */
.belge-tablo { table-layout: fixed; }
.belge-metin > td, .belge-mini { overflow-wrap: anywhere; }
/* Hücrelerde uzun/boşluksuz değerler (isim, numara, e-posta) satır içinde kırılır */
.karar-tablo { max-width: 100%; }
.karar-tablo th, .karar-tablo td { overflow-wrap: anywhere; word-break: normal; hyphens: auto; }
/* Çok sütunlu tablolarda yazı ve boşluklar küçülür */
.karar-tablo.genis { font-size: 9pt; }
.karar-tablo.genis th, .karar-tablo.genis td { padding: .9mm 1.3mm; }
.karar-tablo.cok-genis { font-size: 8pt; line-height: 1.2; }
.karar-tablo.cok-genis th, .karar-tablo.cok-genis td { padding: .7mm 1mm; }
/* Başlıklar yalnızca kelime aralarından kırılır; kısa değerli sütunlar hiç kırılmaz */
.karar-tablo th { overflow-wrap: break-word; hyphens: manual; }
.karar-tablo td.nw { white-space: nowrap; overflow-wrap: normal; }
/* Çok sayfalı tabloda başlık her sayfada tekrar eder */
.karar-tablo thead { display: table-header-group; }
/* İmza tablosu sayfa arasında bölünmez */
.imza-tablo { break-inside: avoid; page-break-inside: avoid; }
.imza-tablo tr { break-inside: avoid; page-break-inside: avoid; }

/* ---------- Yazdırma: her sayfadan ve her kenar boşluğu ayarında aynı sonuç ----------
   Belge sabit 210 mm yerine sayfanın yazdırılabilir alanına uyar; ekran çerçeveleri baskıya girmez. */
@page { size: A4; margin: 10mm 12mm; }
@media print {
  html, body, body.yazdir { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  .topbar, .yazdir-arac, .karar-yan, .flash { display: none !important; }
  .wrap { max-width: none !important; margin: 0 !important; padding: 0 !important; }
  .karar-layout { display: block !important; }
  .karar-belge-alani { padding: 0 !important; background: none !important; border-radius: 0 !important; overflow: visible !important; }
  .belge { width: auto !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; box-shadow: none !important; }
  .belge-ust { margin-bottom: 4mm; }
  .belge-metin > td { height: 100mm; }
}

/* ---------- Birleştirilmiş hücreler ve kalın yazı ---------- */
.karar-tablo td.kalin { font-weight: 700; }
.karar-tablo td.tam { font-weight: 700; background: #eef0f3; text-align: left; }
.karar-tablo td[rowspan] { vertical-align: middle; }
@media print { .karar-tablo td.tam { background: #e9e9e9; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
#izgara td input.birlesik { background: #eef2f8; color: #8a94a3; text-align: center; font-weight: 700; }
.ipucu { margin-top: .6rem; }

/* ---------- Satır başına başlık ---------- */
.karar-tablo tr.ara-baslik th { background: #eceff3; }
@media print { .karar-tablo tr.ara-baslik th { background: #e6e6e6; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
#izgara th.satir-no { cursor: pointer; user-select: none; white-space: nowrap; }
#izgara th.satir-no:hover { background: #e3e9f4; color: var(--navy-2); }
#izgara th.satir-no.acik { background: var(--navy-2); color: #fff; }
#izgara tr.bas td { background: #e9eef7; }
#izgara tr.bas td input { font-weight: 700; text-align: center; }
.bas-rozet { display: inline-block; margin-left: 3px; padding: 0 4px; border-radius: 4px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.4; }
.bas-ipucu { margin-left: auto; font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
.bas-ipucu .bas-rozet { margin: 0; }
.uyari-yazi { color: var(--warn); font-weight: 600; }
