/* Ügyfélportál – Számlázás (#portal-billing, ügyfél-adatlap Számlázás füle), Számlázási címek ellenőrzése
   (#portal-billing-review) és Központi árlista (#portal-pricelist). A portál styles.css-éből átvéve,
   „pb-” előtaggal; a közös elemek (po-note, po-tabs, po-search, po-modal) a portal-ops.css-ből jönnek. */

.pb-page .button .po-icon, .pb-tenant .button .po-icon, .pb-review-card .button .po-icon { width: 15px; height: 15px; margin-right: 2px; vertical-align: -3px; }
.pb-hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.pb-hint:empty { display: none; }
.pb-empty { min-height: 150px; align-content: center; }
.pb-read-only .po-icon { color: var(--warn); }
@keyframes pb-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* --- Állapotszűrő (a portál .segmented sávja) ----------------------------------- */
/* justify-self a max-content szélesség helyett: így mobilon sem tágítja a .po-page rácsoszlopát, hanem görgethető. */
.pb-segmented { display: flex; justify-self: start; gap: 4px; min-width: 0; max-width: 100%; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; scrollbar-width: none; }
.pb-segmented a { padding: 7px 13px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; transition: background-color .2s ease, color .2s ease; }
.pb-segmented a:hover { background: var(--blue-soft); color: var(--blue-deep); }
.pb-count { display: inline-block; min-width: 17px; margin-left: 3px; padding: 0 5px; border-radius: 999px; background: rgba(23, 63, 79, .1); font-size: 10.5px; line-height: 17px; text-align: center; }
.pb-segmented a.active .pb-count { background: rgba(255, 255, 255, .25); }
.pb-segmented a.active { background: var(--blue-deep); color: #fff; }

/* --- Automatikus és manuális számlázás egymás mellett ------------------------------- */
.pb-billing-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.pb-billing-lane { display: grid; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f7fafb; }
.pb-billing-lane > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pb-billing-lane > header h2 { margin: 2px 0 0; color: var(--ink); font-size: 16px; }
.pb-billing-lane .pb-list { gap: 10px; }
.pb-billing-lane .pb-card { padding: 14px; }
.pb-manual { background: #fffbf2; }

/* --- Ügyfél-adatlap: piszkozat frissítése ------------------------------------------ */
.pb-tenant { display: grid; gap: 12px; }
.pb-generate { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; padding: 16px 18px; }
.pb-generate > div { flex: 1 1 320px; }
.pb-generate h3 { margin: 0; font-size: 14px; }
.pb-generate label { flex: 0 1 180px; }

/* --- Időszakkártyák ------------------------------------------------------------------ */
.pb-list { display: grid; gap: 12px; }
.pb-card { display: grid; gap: 12px; padding: 16px 18px; border-left: 4px solid var(--line); animation: pb-in .35s calc(var(--pb-i, 0) * 40ms) cubic-bezier(.2, .8, .2, 1) both; transition: box-shadow .2s ease, transform .2s ease; }
.pb-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pb-card.status-draft { border-left-color: #b9c6cc; }
.pb-card.status-approved { border-left-color: var(--blue); }
.pb-card.status-issued { border-left-color: #e2b04a; }
.pb-card.status-paid { border-left-color: var(--good); }
.pb-card.status-cancelled { border-left-color: var(--bad); }
.pb-card-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pb-status { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.pb-paid-at { color: var(--good); font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pb-subline { color: var(--muted); font-size: 11px; }
.pb-period { font-size: 15px; font-weight: 800; }
.pb-figures { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.pb-figures span { display: grid; }
.pb-figures small { color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.pb-figures b { font-variant-numeric: tabular-nums; }
.pb-card .form-error { min-height: 0; margin: 0; }
.pb-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Időszak részletei ablak ---------------------------------------------------------- */
.pb-modal { width: min(720px, calc(100vw - 30px)); }
.pb-detail-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pb-detail h4 { margin: 16px 0 6px; font-size: 13px; }
.pb-detail-table { display: grid; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.pb-detail-table:empty { display: none; }
.pb-detail-table div { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; padding: 7px 11px; border-bottom: 1px solid var(--line); font-size: 12px; }
.pb-detail-table div:last-child { border-bottom: 0; }
.pb-detail-table b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Számlázási címek ellenőrzése ------------------------------------------------------ */
.pb-review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); gap: 12px; }
.pb-review-card { display: grid; gap: 10px; padding: 14px 16px; border-left: 4px solid #f1dc8e; animation: pb-in .3s calc(var(--pb-i, 0) * 30ms) ease both; }
.pb-review-card:has(.pb-badges .badge.good) { border-left-color: #8fd1a8; }
.pb-review-card:has(.pb-badges .badge.bad) { border-left-color: #efb1ad; }
.pb-review-card:has(.pb-badges .badge.po-blue:not(:only-child)) { border-left-color: var(--blue); }
.pb-review-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pb-review-card header h3 { margin: 2px 0 0; color: var(--blue-deep); font-size: 15px; }
.pb-tenant-link { color: var(--muted); font-size: 11.5px; font-weight: 800; text-decoration: none; }
.pb-tenant-link:hover { color: var(--blue-deep); text-decoration: underline; }
.pb-badges { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.pb-review-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 0; }
.pb-review-facts div { min-width: 0; }
.pb-review-facts dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
.pb-review-facts dd { display: grid; margin: 1px 0 0; overflow-wrap: anywhere; color: var(--ink); font-size: 12.5px; font-weight: 650; }
.pb-review-facts dd small { color: var(--muted); font-size: 11px; font-weight: 500; }
.pb-review-facts dd .badge { justify-self: start; }
.pb-review-note { display: grid; gap: 6px; margin: 0; padding: 8px 10px; border-radius: 8px; background: #fff7e6; color: #7a4d00; font-size: 11.5px; line-height: 1.45; }
.pb-review-note.rejected { background: var(--bad-bg); color: var(--bad); }
.pb-review-docs { display: grid; gap: 4px; }
.pb-caption { color: var(--muted); font-size: 11px; font-weight: 750; }
.pb-docs { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.pb-docs li { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; }
.pb-docs a { display: inline-flex; flex: 1 1 auto; align-items: center; gap: 5px; min-width: 0; color: var(--blue-deep); font-weight: 700; text-decoration: none; }
.pb-docs a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-docs a:hover span { text-decoration: underline; }
.pb-docs .po-icon { width: 13px; height: 13px; }
.pb-docs small { flex: none; color: var(--muted); }
.pb-review-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.pb-review-card .button.small .po-icon { width: 13px; height: 13px; }

/* --- Központi árlista --------------------------------------------------------------------- */
.pb-price-card { overflow: hidden; }
.pb-price-toolbar { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pb-price-table { display: grid; max-height: 68vh; overflow: auto; }
.pb-price-row { display: grid; grid-template-columns: minmax(220px, 1fr) 70px 56px 120px 74px 96px; gap: 8px; align-items: center; padding: 8px 17px; border-bottom: 1px solid var(--line); animation: pb-in .25s calc(var(--pb-i, 0) * 12ms) ease both; transition: background-color .2s ease; }
.pb-price-row input[type=number] { width: 100%; min-height: 34px; padding: 5px 8px; font-variant-numeric: tabular-nums; text-align: right; }
.pb-price-row input[type=checkbox] { width: 18px; height: 18px; min-height: 0; justify-self: center; margin: 0; padding: 0; accent-color: var(--blue-dark); }
.pb-price-row input:disabled { border-color: transparent; background: transparent; color: var(--ink); cursor: default; opacity: 1; }
.pb-price-head { position: sticky; z-index: 1; top: 0; background: #f7fafb; color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; animation: none; }
.pb-price-head span:nth-child(n+4):nth-child(-n+5) { text-align: right; }
.pb-price-head span:nth-child(6) { text-align: center; }
.pb-price-row.dirty { background: #fff8e8; }
.pb-price-row.staff-only strong { color: var(--muted); }
.pb-price-name { display: grid; min-width: 0; }
.pb-price-name strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.pb-price-name strong .badge { min-height: 18px; margin-left: 6px; font-size: 9.5px; vertical-align: 1px; }
.pb-price-name small { color: var(--muted); font-size: 10.5px; }
.pb-price-cell { display: grid; min-width: 0; }
.pb-price-cell small { overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.pb-import { padding: 16px 18px; }
.pb-import h3 { margin: 0; font-size: 15px; }
.pb-import-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; margin-top: 12px; }
.pb-import-row > label { flex: 0 1 240px; }

/* --- Reszponzív ------------------------------------------------------------------------------ */
@media (max-width: 760px) {
  .pb-billing-columns { grid-template-columns: 1fr; }
  .pb-review-facts { grid-template-columns: 1fr; }
  .pb-generate label, .pb-generate .button { flex: 1 1 100%; }
  .pb-price-toolbar .po-spacer { display: none; }
  .pb-price-toolbar .po-tabs { width: 100%; overflow-x: auto; }
  .pb-price-toolbar > .button { flex: 1 1 100%; }
  .pb-price-row { grid-template-columns: minmax(0, 1fr) 80px 50px 64px; gap: 6px; padding: 8px 12px; }
  .pb-price-row > :nth-child(2), .pb-price-row > :nth-child(3) { display: none; }
  .pb-detail-table div { grid-template-columns: minmax(0, 1fr) auto; }
  .pb-detail-table div > span:nth-child(2) { grid-column: 1; grid-row: 2; color: var(--muted); }
  .pb-detail-table div > b { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  .pb-card, .pb-review-card, .pb-price-row { animation: none; }
  .pb-card:hover { transform: none; }
}
