/* PPTG Customers hub — styles. Self-contained, same design tokens as the
   dashboard and the Routes mini-view (navy topbar, panel background,
   14px cards). Nothing here is imported by any other page. */

:root{
  --navy:#0d3b66;
  --blue:#1d6fb8;
  --panel:#f4f7fb;
  --ink:#1c2a36;
  --ink-soft:#4a5c6b;
  --border:#dbe4ee;
  --white:#ffffff;
  --ok:#1f7a5c;
  --ok-bg:#e7f5ef;
  --warn:#b8562f;
  --amber-bg:#fff6e6;
  --amber-border:#e8b95b;
  --amber-ink:#7a4e0a;
  --danger:#c0392b;
  --danger-bg:#fdecea;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{
  margin:0;
  padding:0;
  background:var(--panel);
  color:var(--ink);
  font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing:antialiased;
}

button, input, select, textarea{ font-family:inherit; }
a{ color:var(--blue); }

.page{ min-height:100vh; display:flex; flex-direction:column; }

/* ---------- Top bar ---------- */
.topbar{
  position:sticky; top:0; z-index:50;
  background:var(--navy); color:var(--white);
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; padding:10px 16px;
  box-shadow:0 2px 8px rgba(13,59,102,0.25);
}
.wordmark{
  font-weight:700; font-size:1.05rem; letter-spacing:0.2px;
  white-space:nowrap; display:flex; align-items:center; gap:8px;
}
.wordmark .page-name{ font-weight:400; color:rgba(255,255,255,0.75); }
.back-link{
  color:rgba(255,255,255,0.85); font-size:0.82rem; text-decoration:none;
  border:1px solid rgba(255,255,255,0.35); border-radius:999px;
  padding:6px 14px; white-space:nowrap;
  display:inline-flex; align-items:center; gap:6px;
}
.back-link:hover{ background:rgba(255,255,255,0.12); }

.main{
  flex:1; width:100%; max-width:880px;
  margin:0 auto; padding:18px 16px 40px;
}
.screen-title{ font-size:1.35rem; margin:6px 0 2px; color:var(--navy); }
.page-sub{ margin:0 0 16px; color:var(--ink-soft); font-size:0.88rem; }

/* ---------- Buttons ---------- */
.btn{
  border:none; border-radius:10px; padding:10px 18px;
  font-size:0.88rem; font-weight:600; cursor:pointer;
  transition:filter 0.12s ease;
}
.btn:hover{ filter:brightness(1.06); }
.btn:disabled{ opacity:0.55; cursor:default; }
.btn-primary{ background:var(--navy); color:var(--white); }
.btn-secondary{
  background:var(--white); color:var(--navy);
  border:1px solid var(--border);
}
.btn-small{ padding:6px 12px; font-size:0.78rem; }

/* ---------- Search ---------- */
.search-bar{ display:flex; gap:10px; align-items:flex-start; margin-bottom:14px; }
.search-input-wrap{ position:relative; flex:1; }
.search-input-wrap input{
  width:100%; padding:12px 14px;
  border:1px solid var(--border); border-radius:12px;
  font-size:1rem; background:var(--white); color:var(--ink);
}
.search-input-wrap input:focus{ outline:2px solid var(--blue); outline-offset:-1px; }

.ac-drop{
  position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:40;
  background:var(--white); border:1px solid var(--border); border-radius:12px;
  box-shadow:0 8px 24px rgba(13,59,102,0.14);
  max-height:340px; overflow-y:auto;
}
.ac-item{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; padding:10px 13px; cursor:pointer;
  border-bottom:1px solid var(--border);
}
.ac-item:last-child{ border-bottom:none; }
.ac-item:hover, .ac-item.active{ background:var(--panel); }
.ac-left{ min-width:0; }
.ac-name{ font-size:0.95rem; font-weight:650; color:var(--ink); overflow-wrap:anywhere; }
.ac-sub{ font-size:0.78rem; color:var(--ink-soft); overflow-wrap:anywhere; }
.ac-empty{ padding:12px 14px; font-size:0.84rem; color:var(--ink-soft); }

/* ---------- Cards ---------- */
.card{
  background:var(--white); border:1px solid var(--border);
  border-radius:14px; padding:16px; margin-bottom:14px;
}
.card-title{ font-size:0.95rem; font-weight:700; color:var(--navy); margin-bottom:10px; }
.card-title-row{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin-bottom:10px;
}
.card-title-row .card-title{ margin-bottom:0; }

/* ---------- Contact head ---------- */
.cust-head{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:12px; flex-wrap:wrap; margin-bottom:10px;
}
.cust-name{ font-size:1.35rem; font-weight:800; color:var(--navy); overflow-wrap:anywhere; }
.cust-company{ font-size:0.95rem; color:var(--ink-soft); }
.cust-actions{ display:flex; gap:8px; flex:none; }
.cust-lines{ font-size:0.92rem; line-height:1.65; }
.cust-lines a{ text-decoration:none; }
.cust-line-label{ color:var(--ink-soft); display:inline-block; min-width:64px; font-size:0.8rem; }

.tag-row{ display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.tag-chip{
  font-size:0.72rem; font-weight:600; color:var(--navy);
  background:var(--panel); border:1px solid var(--border);
  border-radius:999px; padding:3px 10px;
}
.tag-chip.hold{ color:var(--danger); background:var(--danger-bg); border-color:var(--danger); }

/* ---------- Form ---------- */
.form-grid{
  display:grid; grid-template-columns:repeat(3, 1fr); gap:10px 12px;
}
.form-grid label{
  display:flex; flex-direction:column; gap:4px;
  font-size:0.78rem; font-weight:600; color:var(--ink-soft);
}
.form-grid label.wide{ grid-column:span 3; }
.form-grid input{
  padding:9px 11px; border:1px solid var(--border); border-radius:9px;
  font-size:0.9rem; color:var(--ink); background:var(--white);
}
.form-grid input:focus{ outline:2px solid var(--blue); outline-offset:-1px; }
.form-actions{ display:flex; justify-content:flex-end; gap:8px; margin-top:12px; }
@media (max-width:560px){
  .form-grid{ grid-template-columns:1fr 1fr; }
  .form-grid label.wide{ grid-column:span 2; }
}

/* ---------- Row lists (invoices / orders) ---------- */
.row-list{ display:flex; flex-direction:column; }
.list-row{
  display:flex; align-items:center; gap:12px;
  padding:10px 0; border-bottom:1px solid var(--border);
}
.list-row:last-child{ border-bottom:none; }
.row-main{ flex:1; min-width:0; }
.row-title{ font-size:0.92rem; font-weight:650; color:var(--ink); overflow-wrap:anywhere; }
.row-sub{ font-size:0.78rem; color:var(--ink-soft); margin-top:2px; overflow-wrap:anywhere; }
.row-amount{ font-size:0.95rem; font-weight:700; color:var(--ink); white-space:nowrap; }
.row-actions{ display:flex; gap:6px; flex:none; }
/* D59: an invoice row with the dashboard's shared menu — title / status / amount on the first line, the menu
   (wrapping) and its details panel each on a full-width line below */
.list-row.hub-ia-row{ flex-wrap:wrap; }
.hub-ia-row > .hub-ia, .hub-ia-row > .pay-detail{ flex:1 1 100%; min-width:0; }
.hub-ia .pay-row-actions{ display:flex; flex-wrap:wrap; gap:6px; margin-top:2px; }
.hub-ia .pay-row-actions .btn{ margin-left:0 !important; padding:6px 12px; font-size:0.8rem; }

.status-chip{
  font-size:0.7rem; font-weight:700; text-transform:uppercase;
  letter-spacing:0.4px; border-radius:999px; padding:3px 10px; flex:none;
}
.st-paid{ background:var(--ok-bg); color:var(--ok); }
.st-sent{ background:#e8f1fb; color:var(--blue); }
.st-draft{ background:var(--panel); color:var(--ink-soft); }
.st-void{ background:var(--panel); color:var(--ink-soft); text-decoration:line-through; }
.st-overdue{ background:var(--danger-bg); color:var(--danger); }
.st-partial{ background:var(--amber-bg); color:var(--amber-ink); }
.st-other{ background:var(--panel); color:var(--ink-soft); }

/* ---------- Misc ---------- */
.inline-error{
  display:none; background:var(--danger-bg); color:var(--danger);
  border:1px solid var(--danger); border-radius:10px;
  padding:9px 13px; font-size:0.83rem; margin:8px 0;
}
.inline-error.show{ display:block; }
.empty-card{
  background:var(--white); border:1px dashed var(--border); border-radius:14px;
  padding:22px; text-align:center; color:var(--ink-soft); font-size:0.88rem;
}
.loading-note{ color:var(--ink-soft); font-size:0.84rem; padding:8px 0; }
.footer{
  text-align:center; color:var(--ink-soft); font-size:0.74rem;
  padding:14px 0 20px;
}

/* ---------- Expandable invoice details (read-only mirror of Payments) ---------- */
.inv-detail{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--border);
  font-size:0.82rem;
  color:var(--ink);
}
.inv-detail-head{
  font-weight:700;
  color:var(--navy);
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:6px;
}
.inv-detail-line{
  color:var(--ink-soft);
  font-size:0.78rem;
  margin-bottom:8px;
}
.inv-detail-items{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin-bottom:8px;
}
.inv-detail-item{
  display:flex;
  justify-content:space-between;
  gap:12px;
}
.inv-detail-totals{
  font-weight:700;
  color:var(--navy);
  margin-bottom:10px;
}

/* D62: profile history + extra edit fields */
.hist-search{ width:100%; box-sizing:border-box; margin:6px 0 8px; padding:8px 10px; border:1px solid #d6dde6; border-radius:8px; font:inherit; }
.hist-note-add{ display:flex; gap:8px; margin:0 0 10px; }
.hist-note-add input{ flex:1; min-width:0; padding:8px 10px; border:1px solid #d6dde6; border-radius:8px; font:inherit; }
.hist-row{ display:flex; gap:10px; align-items:baseline; padding:7px 0; border-bottom:1px solid #eef1f5; font-size:0.92rem; }
.hist-row:last-child{ border-bottom:0; }
.hist-date{ flex:0 0 92px; color:#6b7a90; font-size:0.82rem; }
.hist-kind{ flex:0 0 auto; font-size:0.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.03em; padding:1px 6px; border-radius:4px; background:#eef3f8; color:#0d3b66; }
.hist-kind.k-pay{ background:#e8f6ec; color:#1c6b3a; } .hist-kind.k-refund, .hist-kind.k-void{ background:#fdecec; color:#c0392b; }
.hist-kind.k-msg, .hist-kind.k-reminder{ background:#fdf3dd; color:#8a6413; } .hist-kind.k-recurring{ background:#efe9fb; color:#5b3fa0; }
.hist-text{ flex:1; min-width:0; overflow-wrap:anywhere; }
.hist-link{ background:none; border:0; padding:0; color:#1f5fa8; text-decoration:underline; cursor:pointer; font:inherit; }
.tax-row{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.tax-row .check{ display:flex; gap:6px; align-items:center; }
@media (max-width: 520px){ .hist-date{ flex-basis:72px; } }
