.clients-page,
.client-form-page,
.client-detail-page {
  display: grid;
  gap: 18px;
}

.client-toolbar {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.client-toolbar form {
  display: flex;
  gap: 10px;
  flex: 1;
}

.search-box {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  flex: 1;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.client-toolbar select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
}

.primary-action,
.outline-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.primary-action {
  border: 0;
  background: #07264a;
  color: white;
}

.outline-button {
  border: 1px solid var(--line);
  background: white;
  color: #24425f;
}

.ghost-button {
  border: 0;
  background: transparent;
  color: #55708c;
}

.danger-button {
  border: 1px solid #f4b5b5;
  background: #fff4f4;
  color: #b42318;
}

.client-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card,
.side-stat {
  padding: 18px;
}

.stat-card strong,
.side-stat strong {
  display: block;
  color: #0b4aa0;
  font-size: 26px;
}

.stat-card span,
.side-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

.clients-table th,
.clients-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.clients-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.clients-table td strong {
  display: block;
  font-size: 13px;
}

.clients-table td span,
.ops-counts span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.type-pill {
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: #e8f8f1;
  color: #168c55;
  font-size: 11px;
}

.status-pill {
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef5ff;
  color: #0b62c8;
  font-size: 11px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions a {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #24425f;
  background: white;
}

.pagination-row {
  padding: 14px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.empty-state i {
  color: #2f75ff;
}

.empty-state strong {
  color: var(--ink);
  font-size: 18px;
}

.empty-state span {
  max-width: 420px;
  margin: 0 auto 6px;
  line-height: 1.5;
}

.form-card,
.detail-panel,
.notes-card {
  padding: 20px;
}

.form-head,
.client-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.form-head {
  margin-bottom: 18px;
}

.form-head p,
.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.form-head h2,
.client-hero h2,
.detail-panel h2,
.notes-card h2 {
  margin: 0;
  font-size: 24px;
}

.client-form {
  display: grid;
  gap: 18px;
}

.form-section {
  display: grid;
  gap: 12px;
}

.form-section h3 {
  margin: 0;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  color: #0f2238;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.span-2 {
  grid-column: 1 / -1;
}

.client-form label {
  display: grid;
  gap: 7px;
  color: #26374b;
  font-size: 12px;
  font-weight: 850;
}

.field-group {
  display: grid;
  gap: 9px;
  color: #26374b;
  font-size: 12px;
  font-weight: 850;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.client-form .check-card {
  min-height: 54px;
  border: 1px solid #cfdbea;
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: #fbfdff;
  cursor: pointer;
}

.client-form .check-card span {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.check-card input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: #1769e8;
}

.client-form input,
.client-form select,
.client-form textarea {
  width: 100%;
  border: 1px solid #cfdbea;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.client-form input,
.client-form select {
  min-height: 44px;
}

.client-form textarea {
  padding-top: 12px;
  resize: vertical;
}

.client-form small {
  color: var(--red);
}

.form-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.detail-actions form {
  margin: 0;
}

.panel-head {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.client-hero {
  padding: 22px;
}

.client-hero span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tag-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row b {
  border-radius: 999px;
  padding: 5px 9px;
  background: color-mix(in srgb, var(--tag-color, #2563eb) 14%, white);
  color: var(--tag-color, #2563eb);
  font-size: 11px;
  font-weight: 900;
}

.client-tabs {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  background: white;
}

.client-tabs a {
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  color: #24425f;
  text-decoration: none;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}

.client-tabs a:hover {
  background: #eef5ff;
  color: #0b62c8;
}

.client-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
}

.detail-list {
  display: grid;
  gap: 12px;
}

.detail-list.compact {
  gap: 10px;
}

.detail-list div {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.detail-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-list strong {
  text-align: right;
  font-size: 13px;
}

.client-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.side-action {
  padding: 18px;
  display: grid;
  gap: 9px;
}

.side-action i {
  color: #2f75ff;
}

.side-action strong {
  color: var(--ink);
  font-size: 14px;
}

.side-action span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 750;
}

.side-action a {
  color: #0b62c8;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.notes-card p {
  color: var(--muted);
  line-height: 1.6;
}

.mini-records {
  display: grid;
  gap: 10px;
}

.mini-records div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 5px;
}

.mini-records strong {
  color: var(--ink);
  font-size: 13px;
}

.mini-records span,
.muted-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.mini-records b {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e8f8f1;
  color: #168c55;
  font-size: 10px;
}

.activity-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.activity-block {
  display: grid;
  gap: 10px;
  align-content: start;
}

.activity-block h3 {
  margin: 0;
  color: #26374b;
  font-size: 13px;
}

.record-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 5px;
  color: inherit;
  text-decoration: none;
  background: #fbfdff;
}

.record-link:hover {
  border-color: #9ec3ff;
  background: #f4f8ff;
}

.record-link strong {
  color: var(--ink);
  font-size: 13px;
}

.record-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.record-link b {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef5ff;
  color: #0b62c8;
  font-size: 10px;
}

.success-message {
  border: 1px solid #b8ebcc;
  border-radius: 8px;
  padding: 12px 14px;
  color: #0d7d47;
  background: #ecfbf2;
  font-size: 13px;
  font-weight: 850;
}

@media (max-width: 980px) {
  .client-toolbar,
  .client-toolbar form,
  .form-head,
  .client-hero,
  .panel-head,
  .form-actions,
  .detail-actions {
    display: grid;
  }

  .client-stats,
  .form-grid,
  .client-detail-grid,
  .activity-columns,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

:root[data-theme='dark'] .search-box,
:root[data-theme='dark'] .client-toolbar select,
:root[data-theme='dark'] .outline-button,
:root[data-theme='dark'] .client-tabs,
:root[data-theme='dark'] .row-actions a,
:root[data-theme='dark'] .client-form input,
:root[data-theme='dark'] .client-form select,
:root[data-theme='dark'] .client-form textarea,
:root[data-theme='dark'] .client-form .check-card,
:root[data-theme='dark'] .record-link {
  background: #0f2238;
  color: #e8f1ff;
  border-color: #24425f;
}

:root[data-theme='dark'] .form-section h3,
:root[data-theme='dark'] .activity-block h3,
:root[data-theme='dark'] .client-form label,
:root[data-theme='dark'] .field-group {
  color: #e8f1ff;
}

:root[data-theme='dark'] .record-link:hover {
  background: #142b46;
  border-color: #3b82f6;
}
