/* ============================================================
   CLIENTS — two-column layout: table + slide panel
   ============================================================ */

/* ---- Page layout ---------------------------------------- */
.clients-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - var(--header-h) - 97px);
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.clients-table-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--card);
}

/* Highlighted row */
.row-selected { background: #EFF6FF !important; }
.row-selected td { border-color: #BFDBFE; }

/* ---- Slide panel ---------------------------------------- */

/* ---- Panel header --------------------------------------- */
.panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.panel-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.25;
  word-break: break-word;
}
.panel-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 5px;
  flex-wrap: wrap;
}
.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.panel-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: var(--text-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.panel-close:hover { background: var(--bg); color: var(--text-1); }

/* ---- Panel tabs ----------------------------------------- */
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-tab-btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.panel-tab-btn:hover { color: var(--primary); }
.panel-tab-btn.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}

/* ---- Panel content -------------------------------------- */
.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}
.panel-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.panel-section:last-child { border-bottom: none; }
.panel-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 10px;
}

/* ---- KV rows (key-value pairs) -------------------------- */
.kv-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 13.5px;
  line-height: 1.4;
}
.kv-row:last-child { margin-bottom: 0; }
.kv-k {
  color: var(--text-2);
  font-weight: 500;
  min-width: 120px;
  flex-shrink: 0;
}
.kv-v { color: var(--text-1); flex: 1; }

/* ---- Contact cards -------------------------------------- */
.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.contact-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.contact-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.contact-role  { font-size: 12px;   color: var(--text-2); margin-bottom: 4px; }
.contact-detail{ font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.contact-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ---- Activity log --------------------------------------- */
.activity-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-desc { font-size: 13px;   color: var(--text-1); line-height: 1.4; }
.activity-time { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ---- Search bar ----------------------------------------- */
.clients-search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.clients-search .form-control { max-width: 280px; }

/* One currency's figures in the client financial summary (audit G22). A client
   billed in CAD and LKR gets one of these per currency — there is no honest
   single number, so the block is the unit rather than the row. */
.client-fin-block {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.client-fin-block:last-child { border-bottom: none; }

/* ---- Client 360 tabs (3.5) ------------------------------- */

/* Three tabs could each take an equal share of the panel. Eight cannot:
   `.panel-tab-btn { flex: 1 }` divides a 480px panel into 60px columns and
   "Documents" becomes "Docu…". These wrap onto a second line and size to their
   own text instead, which is why the modifier exists rather than a change to
   `.panel-tabs` — every other module still has three or four. */
.panel-tabs-wrap { flex-wrap: wrap; }
.panel-tabs-wrap .panel-tab-btn {
  flex: 0 1 auto;
  padding: 10px 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* No badge is rendered at all when the count is unknown, so this never shows a
   zero standing in for "not loaded yet". */
.panel-tab-count {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 8px;
  color: var(--text-2);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
.panel-tab-btn.active .panel-tab-count {
  color: #fff;
  background: var(--primary);
}

.c360-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
}
.c360-row:last-of-type { border-bottom: none; }
.c360-row-main  { flex: 1; min-width: 0; }
.c360-row-title {
  font-size: 13px;
  color: var(--text-1);
  font-weight: 500;
  /* A document name or a proposal title can be long and the panel is narrow.
     Wrapping is right here — truncating a filename hides the end, which is the
     half that says what it is. */
  overflow-wrap: anywhere;
}
.c360-row-meta  { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.c360-row-right {
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.c360-row-link { cursor: pointer; border-radius: 4px; }
.c360-row-link:hover { background: var(--bg); }
.c360-row-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.c360-note {
  font-size: 12.5px;
  color: var(--text-2);
  margin: 8px 0 0;
  line-height: 1.45;
}
.c360-note-bad { color: var(--danger); }
.c360-open { margin-top: 12px; }
