/* ArchiFlow — «Счета» клиенту (invoices-v13.js), 18.11.2026. Поля счёта — как у сметы (.afe в estimate-v13.css),
   здесь — только своё: список, строки счёта (вид, FF&E, «%»), итоги, оплаты, «Приём оплат», просрочка. */

/* ---------- список ---------- */
.afi-late {
  display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 12px; padding: 10px 14px; border: 1px solid rgba(224,122,85,.45);
  border-radius: 14px; background: var(--conf-soft); color: #F0A487; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.afi-late i { width: 8px; height: 8px; border-radius: 50%; background: var(--conf); flex: none; }
.afi-late:hover { border-color: var(--conf); }
.afp-st.late { background: var(--conf-soft); color: #F0A487; }
.afi-rest { color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.afi-li .afe-li-t b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.afi-foot { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.afi-set {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line2); border-radius: 14px;
  background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer;
}
.afi-set b { color: var(--text); font-weight: 600; }
.afi-set:hover { color: var(--gold); border-color: var(--gold-line); }
.afi-pay { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--card); }
.afi-pay-t { display: flex; flex-direction: column; min-width: 0; font-size: 13px; font-weight: 600; }
.afi-pay-t small { color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 2px; }
.afi-pay.on .afi-pay-t small { color: var(--ok); }
.afi-pay .afg-btn, .afi-pay .afp-btn { flex: none; border: 0; cursor: pointer; font: inherit; font-size: 12.5px; }
.afi-pay .afp-btn { border: 1px solid var(--line2); background: transparent; color: var(--muted); }

/* ---------- счёт ---------- */
.afi-head { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.afi-num { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 17px; font-weight: 600; }
.afi-num span { flex: none; }
.afe .afi-num input { flex: 1; min-width: 60px; max-width: 180px; height: 38px; font-size: 17px; font-weight: 600; }
.afi-meta { align-items: flex-end; }
.afi-meta label, .afi-client label, .afi-adj label, .afi-form label, .afi-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.afi-meta label > span, .afi-client label > span, .afi-adj label > span, .afi-form label > span, .afi-txt > span { color: var(--dim); font-size: 11.5px; }
.afi-meta input[type="date"] { width: 138px; }
.afi-cur { color: var(--dim); font-size: 12px; padding-bottom: 9px; }
.afi-client { margin-top: 10px; }
.afi-client input { width: 100%; }
.afi-cmore { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.afi-cmore input[data-c="address"] { grid-column: 1 / 3; }
.afi-link { align-self: flex-start; margin-top: 4px; padding: 0; border: 0; background: none; color: var(--dim); font: inherit; font-size: 12px; cursor: pointer; }
.afi-link:hover { color: var(--gold); }

/* строки: вид + название, кол-во · ед. × цена = сумма; FF&E — себестоимость + наценка; «%» — скидка и налог строки */
.afi-namebox { display: flex; gap: 6px; min-width: 0; }
.afe .afi-type { flex: none; width: 104px; padding: 0 6px; font-size: 12.5px; color: var(--muted); }
.afi-namebox .afe-name { flex: 1; }
.afi-ffe, .afi-more { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.afi-more { flex-basis: 100%; }
.afe .afi-pct { width: 54px; text-align: right; }
.afe .afi-cost { width: 90px; text-align: right; }
.afe input[readonly] { color: var(--muted); }
.afi-mbtn { flex: none; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--dim); font: inherit; font-size: 12px; cursor: pointer; }
.afi-mbtn.on, .afi-mbtn:hover { color: var(--gold); border-color: var(--gold-line); }
.afi-adj { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.afi-pair { display: inline-flex; align-items: center; gap: 4px; }
.afi-pair i { color: var(--dim); font-style: normal; font-size: 12px; }
.afe .afi-tlabel { width: 84px; }
.afi-chk { flex-direction: row !important; align-items: center; gap: 6px !important; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.afe .afi-chk input { width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0; border-radius: 3px; -webkit-appearance: checkbox; appearance: auto; accent-color: var(--gold); }
.afi-tot { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.afi-tr { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 3px 0; color: var(--muted); font-size: 13px; }
.afi-tr b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.afi-tr.t { padding-top: 6px; }
.afi-tr.t span { color: var(--text); }
.afi-tr.t b { color: var(--gold); font-size: 19px; font-weight: 600; }
.afi-tr.b b { font-weight: 600; }

.afi-pays h3 .afp-btn { margin-left: 8px; }
.afi-payrow { display: grid; grid-template-columns: auto auto minmax(0, 1fr) 30px; align-items: center; gap: 4px 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.afg-day h3 + .afi-payrow { border-top: 0; }
.afi-payrow span { color: var(--dim); font-variant-numeric: tabular-nums; }
.afi-payrow b { font-weight: 600; white-space: nowrap; }
.afi-payrow small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afi-txt { margin-top: 10px; }
.afe textarea {
  width: 100%; min-height: 54px; box-sizing: border-box; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; resize: vertical;
  background: #242426; color: var(--text); font: inherit; font-size: 13.5px; color-scheme: dark;
}
.afe textarea:focus { outline: none; border-color: var(--gold-line); }
.afe textarea:disabled { opacity: .85; border-color: transparent; background: transparent; }
.afe-acts .afi-hot { border-color: rgba(224,122,85,.6) !important; color: #F0A487 !important; }

/* ---------- окна: новый счёт, оплата, ссылка, нумерация ---------- */
.afi-modal .afar-box { width: min(380px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-sizing: border-box; }
.afi-opts { display: flex; flex-direction: column; gap: 6px; }
.afi-opt {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 12px;
  background: transparent; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.afi-opt b { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afi-opt small { flex: none; color: var(--muted); font-size: 12px; }
.afi-opt:hover { border-color: var(--gold-line); color: var(--gold); }
.afi-dep { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--card); font-size: 13px; }
.afi-dep b { font-weight: 600; flex-basis: 100%; }
.afi-dep input, .afi-dep select {
  height: 32px; box-sizing: border-box; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #242426; color: var(--text); font: inherit; font-size: 13px; color-scheme: dark;
}
.afi-dep input { width: 56px; text-align: right; }
.afi-dep select { max-width: 170px; }
.afi-dep .afg-btn { border: 0; cursor: pointer; margin-left: auto; }
.afi-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 0; }
.afi-form input, .afi-form select { width: 100%; }
.afi-wide { grid-column: 1 / 3; }
.afi-msg { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--card); color: var(--text); font-size: 13px; line-height: 1.45; }

/* ---------- просрочка: число на вкладке, строка в «Обзоре» ---------- */
.afi-n {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; margin-left: 5px; padding: 0 4px; box-sizing: border-box;
  border-radius: 8px; background: var(--conf); color: #fff; font-size: 10.5px; font-weight: 700; font-style: normal; line-height: 1; vertical-align: 1px;
}
.afi-orow .afo-t { color: #F0A487; }

/* ---------- чат: «Отменено» вместо ссылки ---------- */
.afi-undone { color: var(--dim) !important; text-decoration: none !important; cursor: default; }

/* ---------- «Настройки → Подключения», «Площадка» ---------- */
.afi-conn .afapp-row .afg-btn { border: 0; cursor: pointer; font: inherit; font-size: 12.5px; padding: 6px 14px; }
.afi-conn .afapp-row .afp-btn { background: transparent; cursor: pointer; }
.afplat > .afi-plat { border-top: 1px solid var(--line, #3a3a3e); padding-top: 12px; margin-top: 2px; }
.afi-plat h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.afi-plat code { font-size: 11.5px; word-break: break-all; }
.afi-pk { margin-top: 8px; }

/* ---------- телефон ---------- */
@media (max-width: 420px) {
  /* телефон: название строки — во всю ширину, вид строки — маленьким выбором под ним */
  .afi-namebox { flex-direction: column-reverse; gap: 4px; }
  .afe .afi-type { width: auto; max-width: 140px; height: 28px; font-size: 12px; border-color: transparent; background: transparent; padding-left: 0; }
  .afi-meta input[type="date"] { width: 132px; }
  .afi-num { font-size: 15px; }
  .afe .afi-num input { min-width: 96px; font-size: 15px; }
  .afi-form { grid-template-columns: 1fr; }
  .afi-wide { grid-column: 1; }
  .afi-cmore { grid-template-columns: 1fr; }
  .afi-cmore input[data-c="address"] { grid-column: 1; }
}
