/* Zemes Portfelis - īpašuma kartiņa (spec v2 2.2): nekustīga galva ar žetoniem un
   2x3 faktu režģi, cilnes un ritināms ciļņu saturs. Ielādējas pēc styles.css,
   tāpēc pārraksta vecā paneļa ritināšanas uzvedību. Krāsas un fonti no styles.css :root. */

/* paneļa karkass: ritinās tikai .card-panes */
.detail { overflow: hidden; display: flex; flex-direction: column; }
.detail-close { position: absolute; top: 10px; right: 12px; float: none; margin: 0; }
#detail-body {
  padding: 0;
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}

/* ---------- galva ---------- */

.card-head {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  flex: none;
}
.ch-code {
  font-size: 11.5px; letter-spacing: .08em; color: var(--ink-soft);
  padding-right: 34px;
}
.ch-link { background: none; border: none; font-size: 12px; padding: 0 2px; opacity: .65; }
.ch-link:hover { opacity: 1; }
.ch-copied { font-size: 11px; color: var(--green-bright); margin-left: 4px; }
.ch-name {
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  line-height: 1.2; margin: 3px 0 2px; padding-right: 34px;
}
.ch-sub { color: var(--ink-soft); font-size: 12.5px; }

.ch-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.ch-chips:empty { display: none; }
.ch-chip {
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  background: var(--paper-2); color: var(--ink-soft); white-space: nowrap;
  border: none; font-family: inherit;
}
/* Daļa žetonu ved uz cilni (skat. CHIP_TAB card-head.js) - tie ir <button>, pārējie <span> */
button.ch-chip { cursor: pointer; }
button.ch-chip:hover { filter: brightness(0.93); }
.ch-chip.active { background: #dcefe2; color: var(--green); }
.ch-chip.expiring { background: #f6e8d3; color: var(--amber); }
.ch-chip.expired { background: #f4ddd8; color: var(--red); }
.ch-chip.vacant { background: #e5e9ec; color: #5a6a77; }
.ch-chip.upcoming { background: #f0e9d4; color: #8a6d25; }
.ch-chip.sold { background: #ece7dc; color: #6b5b3a; }
.ch-chip.risk { background: #f7e3de; color: var(--red); }
.ch-chip.pending { background: #e7edf1; color: #5a6a77; }

.ch-warn { margin-top: 9px; }
.ch-warn-line { display: block; }
.ch-warn-line + .ch-warn-line { margin-top: 6px; }
.ch-warn-line .warn-seen-btn {
  margin-left: 8px; font-size: 11px; padding: 3px 9px;
  vertical-align: middle; white-space: nowrap;
}

/* 2x3 faktu režģis: trīs kolonnas, divas rindas, arī telefonā */
.ch-facts {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; margin-top: 12px;
  background: var(--line); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden;
}
.ch-fact { background: #fff; padding: 8px 9px 9px; min-width: 0; overflow-wrap: anywhere; }
.chf-k {
  font-size: 9px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-soft); line-height: 1.25;
}
.chf-v {
  font-family: var(--font-display); font-size: 17.5px; font-weight: 600;
  letter-spacing: normal; line-height: 1.2; margin-top: 3px;
  text-wrap: balance;
}
.chf-s { font-size: 12.5px; color: var(--ink-soft); line-height: 1.3; margin-top: 2px; }

/* ---------- cilnes ---------- */

.card-tabs {
  display: flex; gap: 2px; flex: none;
  padding: 0 12px; border-bottom: 1px solid var(--line);
  background: var(--paper);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.card-tabs::-webkit-scrollbar { display: none; }
.card-tabs button {
  border: none; background: none; white-space: nowrap;
  padding: 10px 9px 9px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); border-bottom: 2px solid transparent;
}
.card-tabs button:hover { color: var(--green); }
.card-tabs button.active { color: var(--green); border-bottom-color: var(--green); }
.card-tabs button[hidden] { display: none; }

.card-panes { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 22px 26px; }
.card-pane { display: block; }
.card-pane[hidden] { display: none !important; }
.card-pane > .d-section:first-child { margin-top: 16px; }

/* Pārskata kompaktās teritorijas datu rindas (bez izvēršanas) */
.fact-line { font-size: 12.5px; line-height: 1.5; padding: 4px 0; border-bottom: 1px dashed var(--line); color: var(--ink); }
.fact-line:last-of-type { border-bottom: none; }
.fc-more { font-size: 12px; padding: 5px 10px; margin-top: 8px; }

/* Vēstures cilnes rindas */
.hist-row { font-size: 12.5px; line-height: 1.5; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.hist-row:last-of-type { border-bottom: none; }
/* Neredzēta kadastra izmaiņa vēsturē - smalks izcēlums, nevis pilns brīdinājuma fons */
.hist-row.hist-unseen { font-weight: 600; border-bottom-color: var(--amber, #c77b28); }

@media (max-width: 768px) {
  .card-head { padding: 14px 16px 10px; }
  .ch-name { font-size: 19px; }
  .ch-sub { font-size: 12px; }
  .ch-facts { margin-top: 10px; }
  .chf-v { font-size: 15.5px; }
  .chf-s { font-size: 11.5px; }
  .card-tabs { padding: 0 8px; }
  .card-panes { padding: 4px 16px 70px; }
}
