/* FERMA v3 — вкладка «Пополнения». Redesign calm/v3 · 2026-05-30.
 *
 * Одна страница, фокус — контроль телефонов. Один акцент (золото), без
 * цветовой семантики (никаких светофоров). Период выбирается свободно,
 * переключение не двигает layout. Анимации тонкие, ≤0.3s. Токены из
 * ferma_v3.css. */

.tp { }
.tp-fade { animation: tpFade 0.34s cubic-bezier(.2,.7,.2,1) both; }
@keyframes tpFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tp-dim    { color: var(--text-3); }

/* ── Header + период ───────────────────────────────────────────────────────── */
.tp-head { margin: 18px 0 20px; }
.tp-head-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.tp-h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.tp-upload { flex: none; border-radius: 999px; padding: 9px 18px; font-size: 13px; transition: background .2s, color .2s; }
.tp-upload.is-open { background: transparent; color: var(--text-3); border-color: var(--line); }

.tp-period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.tp-presets { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tp-preset {
  border: none; background: transparent; color: var(--text-3); cursor: pointer;
  font: inherit; font-size: 12px; padding: 6px 14px; border-radius: 999px; transition: color .15s, background .15s; white-space: nowrap;
}
.tp-preset:hover { color: var(--text); }
.tp-preset.active { background: var(--surface-2); color: var(--text); }
.tp-range { display: inline-flex; align-items: center; gap: 8px; }
.tp-range-l { font-size: 12px; color: var(--text-3); }
.tp-date-in {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 12px; outline: none;
  color-scheme: dark; transition: border-color .15s;
}
.tp-date-in:focus { border-color: var(--accent-line); }

/* ── Спорные ситуации ──────────────────────────────────────────────────────── */
.tp-amb {
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  border-radius: var(--radius); padding: 16px 18px; margin: 0 0 20px;
  animation: tpFade .3s ease both;
}
.tp-amb-h { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 12px; }
.tp-amb-sub { font-weight: 400; color: var(--text-2); font-size: 12px; margin-left: 10px; }
.tp-amb-card { padding: 10px 0; border-top: 1px solid var(--line); }
.tp-amb-card:first-of-type { border-top: none; }
.tp-amb-q { font-size: 13px; color: var(--text); margin-bottom: 9px; }
.tp-amb-q b { font-variant-numeric: tabular-nums; color: var(--accent); }
.tp-amb-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tp-amb-l { font-size: 12px; color: var(--text-3); }
.tp-amb-more { color: var(--text-3); font-size: 12px; }
.tp-amb-pick {
  background: var(--surface); color: var(--text); border: 1px solid var(--accent-line);
  border-radius: 8px; padding: 7px 13px; font: inherit; font-size: 12px; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .15s, color .15s;
}
.tp-amb-pick:hover { background: var(--accent); color: #1a1306; border-color: var(--accent); }

/* ── Summary line ──────────────────────────────────────────────────────────── */
.tp-sumline {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 22px 26px; margin-bottom: 22px; min-height: 96px;
}
.tp-sum-cap { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; }
.tp-sum-val { font-size: 38px; font-weight: 600; letter-spacing: -.02em; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.tp-sum-stats { display: flex; gap: 36px; text-align: right; }
.tp-sstat-v { font-size: 20px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }
.tp-sstat-l { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* ── Controls ──────────────────────────────────────────────────────────────── */
.tp-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.tp-controls-sp { flex: 1 1 auto; }
.tp-select, .tp-input {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px; font: inherit; font-size: 12px; outline: none; transition: border-color .15s;
}
.tp-select:focus, .tp-input:focus { border-color: var(--accent-line); }
.tp-input { min-width: 240px; flex: 0 1 280px; }
.tp-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); cursor: pointer; }

/* ── Phone table ───────────────────────────────────────────────────────────── */
.tp-phones { margin-top: 6px; }
.tp-ptable { display: flex; flex-direction: column; }
.tp-prow {
  display: grid; grid-template-columns: 168px 1fr 220px 96px 130px;
  gap: 14px; align-items: center; padding: 11px 12px; border-radius: 9px; font-size: 13px;
  cursor: pointer; transition: background .14s;
}
.tp-prow:not(.tp-prow-head):hover { background: var(--line-soft); }
.tp-prow-head {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3);
  cursor: default; border-bottom: 1px solid var(--line); border-radius: 0;
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.tp-prow-head:hover { background: var(--bg); }
.tp-prow.is-stale { box-shadow: inset 2px 0 0 var(--accent-line); }
.tp-prow.is-open { background: var(--surface); }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.tp-pcell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tp-caret { color: var(--text-3); font-size: 15px; transition: transform .18s; flex: none; }
.tp-prow.is-open .tp-caret { transform: rotate(90deg); color: var(--accent); }
.tp-ph { color: var(--text); font-variant-numeric: tabular-nums; }
.tp-srvcell { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.tp-srv { color: var(--text-2); }
.tp-loc { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); white-space: nowrap; }
.tp-last { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-ago { color: var(--text-3); }
.tp-amt { color: var(--text); font-weight: 500; }

.tp-pnote { font-size: 12px; color: var(--text-3); padding: 14px 12px 4px; border-top: 1px solid var(--line-soft); margin-top: 4px; }

/* ── Detail (раскрытый телефон) ───────────────────────────────────────────── */
.tp-detail { padding: 4px 12px 16px 34px; animation: tpDetail .26s cubic-bezier(.2,.7,.2,1) both; cursor: default; }
@keyframes tpDetail { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tp-detail-cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; }
.tp-detail-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 10px; }
.tp-hist { display: flex; flex-direction: column; gap: 1px; max-height: 260px; overflow-y: auto; }
.tp-hist-row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 8px; border-radius: 6px; font-size: 12px; }
.tp-hist-row:nth-child(odd) { background: var(--line-soft); }
.tp-hist-d { color: var(--text-2); font-variant-numeric: tabular-nums; }
.tp-hist-a { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.tp-hist-empty { font-size: 12px; padding: 6px 0; }

.tp-pi-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tp-pi-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; font-size: 12px; }
.tp-pi-t { color: var(--accent); }
.tp-pi-n { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-pi-del { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 5px; transition: color .15s, background .15s; }
.tp-pi-del:hover { color: var(--text); background: var(--line); }
.tp-pi-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tp-pi-form .tp-input { min-width: 140px; flex: 1 1 140px; }

/* ── Import ────────────────────────────────────────────────────────────────── */
.tp-import { margin: 0 0 22px; }
.tp-slide { animation: tpSlide .32s cubic-bezier(.2,.7,.2,1) both; overflow: hidden; }
@keyframes tpSlide { from { opacity: 0; transform: translateY(-6px); max-height: 0; } to { opacity: 1; transform: none; max-height: 800px; } }
.tp-drop { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 34px 20px; text-align: center; transition: border-color .2s, background .2s; }
.tp-drop.is-over { border-color: var(--accent-line); background: var(--accent-soft); }
.tp-drop-title { font-size: 14px; color: var(--text); margin-bottom: 6px; }
.tp-drop-sub { font-size: 12px; color: var(--text-3); }
.tp-link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.tp-import-report { margin-top: 16px; }
.tp-import-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.tp-import-head { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.tp-import-note { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.tp-import-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 20px; margin-bottom: 18px; }
.tp-ir { display: flex; flex-direction: column; gap: 4px; }
.tp-ir-l { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.tp-ir-v { font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text); }
.tp-import-ok { color: var(--accent); font-size: 13px; }

/* ── Footnote ──────────────────────────────────────────────────────────────── */
.tp-foot { font-size: 11px; color: var(--text-3); margin: 26px 0 8px; text-align: center; }

/* ── Empty ─────────────────────────────────────────────────────────────────── */
.tp-empty { margin: 48px auto; max-width: 600px; text-align: center; }
.tp-empty-title { font-size: 22px; font-weight: 600; margin-bottom: 10px; letter-spacing: -.01em; }
.tp-empty-sub { color: var(--text-2); font-size: 13px; line-height: 1.55; margin-bottom: 26px; }
.tp-empty .tp-import { text-align: left; }

/* ── Responsive (единая система) ───────────────────────────────────────────── */
@media (max-width: 980px) {
  .tp-sumline { flex-direction: column; align-items: flex-start; gap: 18px; }
  .tp-sum-stats { text-align: left; gap: 28px; }
  .tp-import-grid { grid-template-columns: repeat(3, 1fr); }
  .tp-prow { grid-template-columns: 150px 1fr 170px 80px 120px; }
  .tp-detail-cols { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 760px) {
  .tp-head-top { flex-direction: column; align-items: stretch; }
  .tp-upload { align-self: flex-start; }
  .tp-period { flex-direction: column; align-items: stretch; }
  .tp-presets { width: 100%; justify-content: space-between; }
  .tp-preset { flex: 1 1 0; text-align: center; }
  .tp-range { justify-content: space-between; }
  .tp-date-in { flex: 1 1 0; }
  .tp-sum-stats { flex-wrap: wrap; gap: 18px 28px; }
  .tp-controls { flex-direction: column; align-items: stretch; }
  .tp-controls .tp-input, .tp-controls .tp-select { min-width: 0; flex: 1 1 auto; width: 100%; }
  .tp-controls-sp { display: none; }
  .tp-controls .seg { width: 100%; }
  /* Телефон · сумма за период; остальное прячем */
  .tp-prow { grid-template-columns: 1fr 120px; gap: 10px; }
  .tp-prow > :nth-child(2), .tp-prow > :nth-child(3), .tp-prow > :nth-child(4) { display: none; }
  .tp-prow-head > :nth-child(2), .tp-prow-head > :nth-child(3), .tp-prow-head > :nth-child(4) { display: none; }
  .tp-detail { padding-left: 12px; }
  .tp-import-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .tp-h1 { font-size: 22px; }
  .tp-sum-val { font-size: 32px; }
  .tp-import-grid { grid-template-columns: 1fr 1fr; }
}
