/* ============================================================
   Page: resmi_hesap — Resmi (KDV/Fatura) Defteri
   ============================================================ */
.rh-page { padding: var(--space-5); }
.rh-head { margin-bottom: var(--space-4); }
.rh-title { font-size: var(--fs-lg); font-weight: 700; }

/* Özet kartları (adaptif) */
.rh-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
/* Köşeli (yuvarlatılmamış) — soldaki renkli çizgi daha keskin/hoş görünsün (sidebar gibi) */
.rh-card { background: var(--surface); border: 1px solid var(--border); border-left-width: 4px; border-radius: 0; padding: var(--space-4); }
.rh-card--red { border-left-color: var(--red); }
.rh-card--green { border-left-color: var(--green); }
.rh-card--yellow { border-left-color: var(--yellow); }
.rh-card--blue { border-left-color: var(--blue); }
.rh-card-t { font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); }
.rh-card-v { font-size: var(--fs-xl); font-weight: 800; color: var(--navy); margin: 4px 0 2px; }
.rh-card-s { font-size: var(--fs-xs); color: var(--text-muted); }

/* Sekmeler */
/* Sekme stili = Hesaplar (dolgulu segment: aktif koyu zemin + beyaz, pasif açık) */
.rh-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-3); flex-wrap: wrap; }
.rh-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px var(--space-3); cursor: pointer;
  background: var(--navy-tint); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.rh-tab:hover { background: var(--border-strong); border-color: var(--navy-light); }
.rh-tab.active, .rh-tab.active:hover { background: var(--text); border-color: var(--text); color: #fff; }

.rh-listbar { display: flex; justify-content: flex-end; margin-bottom: var(--space-3); }
.rh-empty { text-align: center; padding: var(--space-6); color: var(--text-muted); font-size: var(--fs-sm); }

.rh-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rh-table th { text-align: left; padding: 9px 12px; font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); background: var(--surface-alt); border-bottom: 1px solid var(--border); }
.rh-table td { padding: 9px 12px; font-size: var(--fs-sm); border-bottom: 1px solid var(--border); }
.rh-table tr:last-child td { border-bottom: none; }
/* Hizalama: th.rh-r/.rh-c, jenerik th(sol) kuralını özgüllükle yenmeli → başlık + veri aynı hizada */
.rh-table th.rh-r, .rh-table td.rh-r, .rh-r { text-align: right; }
.rh-table th.rh-c, .rh-table td.rh-c, .rh-c { text-align: center; }
.rh-b { font-weight: 800; }
.rh-src { display: inline-block; font-size: 10px; font-weight: 700; color: var(--blue); background: var(--surface-alt); padding: 1px 5px; border-radius: var(--radius-full); }
.rh-del { border: none; background: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.rh-del svg { width: 15px; height: 15px; }
.rh-del:hover { color: var(--red); background: var(--surface-alt); }

/* Stok rozeti + eksi stok satırı + tablo dipi */
.rh-stokb { display: inline-block; font-size: 10px; font-weight: 700; color: var(--green); background: var(--surface-alt); padding: 1px 6px; border-radius: var(--radius-full); }
.rh-pending { display: inline-block; font-size: 10px; font-weight: 700; color: var(--yellow); background: var(--surface-alt); padding: 1px 6px; border-radius: var(--radius-full); }
.rh-neg td { color: var(--red); }
.rh-warn-pill { display: inline-block; font-size: 10px; font-weight: 800; color: #fff; background: var(--red); padding: 0 6px; border-radius: var(--radius-full); }
.rh-foot td { background: var(--surface-alt); }

/* Fatura modalı */
.rh-modal { display: flex; flex-direction: column; gap: var(--space-3); min-width: 320px; max-width: 560px; }
.rh-mrow { display: flex; flex-direction: column; gap: 4px; }
.rh-mrow > label { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); }
.rh-mtot { padding: 8px 10px; background: var(--brand-tint); border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--navy); text-align: right; }
.rh-matrah-hint { font-weight: 400; color: var(--brand); text-transform: none; }
#rhMatrah.is-locked { background: var(--surface-alt); color: var(--text-muted); }

/* Kalem editörü */
.rh-kalem-sec { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); }
.rh-kalem-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); font-size: var(--fs-sm); font-weight: 700; }
.rh-kalem-empty { font-size: var(--fs-xs); color: var(--text-muted); padding: 4px 0; }
.rh-kalem-table { width: 100%; border-collapse: collapse; }
.rh-kalem-table th { text-align: left; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); padding: 2px 4px; }
.rh-kalem-table td { padding: 2px 4px; vertical-align: middle; }
.rh-kalem-table .input { padding: 4px 6px; font-size: var(--fs-xs); }
.rh-kalem-table .rh-k-kod { width: 80px; }
.rh-kalem-table .rh-k-ad { min-width: 110px; }
.rh-kalem-table .rh-k-mik { width: 64px; }
.rh-kalem-table .rh-k-bir { width: 90px; }
.rh-k-tut { white-space: nowrap; font-size: var(--fs-sm); }

/* Hedef tutar rozeti (satıştan kesim) + fark */
.rh-target { padding: 8px 10px; background: var(--navy); color: #fff; border-radius: var(--radius-sm); font-size: var(--fs-xs); line-height: 1.5; }
.rh-target b { color: #fff; }
.rh-diff { font-weight: 700; }
.rh-diff.ok { color: var(--green); }
.rh-diff.warn { color: var(--brand); }

/* Resmi stoktan ürün arama (çıkış faturası) */
.rh-stok-search { position: relative; margin-bottom: var(--space-2); }
.rh-stok-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 220px; overflow-y: auto; margin-top: 2px; }
.rh-stok-res-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 7px 10px; cursor: pointer; font-size: var(--fs-sm); border-bottom: 1px solid var(--border); }
.rh-stok-res-item:last-child { border-bottom: none; }
.rh-stok-res-item:hover { background: var(--surface-alt); }
.rh-avail-inline { font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.rh-stok-res-empty { padding: 8px 10px; font-size: var(--fs-xs); color: var(--text-muted); }
.rh-avail { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.rh-avail.over { color: var(--red); font-weight: 700; }

/* Cari (müşteri/tedarikçi) arama — serbest/gelen fatura */
.rh-party-search { position: relative; }
.rh-party-results { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; margin-top: 2px; }
.rh-party-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 7px 10px; cursor: pointer; font-size: var(--fs-sm); border-bottom: 1px solid var(--border); }
.rh-party-item:last-child { border-bottom: none; }
.rh-party-item[data-id]:hover { background: var(--surface-alt); }
.rh-party-item.is-incomplete { cursor: default; background: var(--surface-alt); }
.rh-party-warn { display: inline-block; font-size: 10px; font-weight: 700; color: var(--red); background: #fde8e8; padding: 0 6px; border-radius: var(--radius-full); margin-left: 4px; }
.rh-party-edit { font-size: var(--fs-xs); font-weight: 700; color: var(--brand); cursor: pointer; white-space: nowrap; }
.rh-party-edit:hover { text-decoration: underline; }

/* KDV havuzu uyarısı */
.rh-pool-warn { padding: 8px 10px; background: #fff4e6; border: 1px solid var(--brand); border-radius: var(--radius-sm); font-size: var(--fs-xs); color: var(--navy); line-height: 1.5; }
