:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --border: #d9dee7;
  --accent: #2457d6;
  --accent-strong: #1846b5;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 4vw, 3rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.5rem, 3vw, 2rem); }
h2 { margin-bottom: .2rem; font-size: 1.2rem; }
.eyebrow { margin-bottom: .25rem; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.muted { color: var(--muted); }

.layout {
  width: min(1200px, calc(100% - 2rem));
  margin: 1.5rem auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  gap: 1.25rem;
}

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--border); }
.panel-heading p { margin-bottom: 0; }
.search-wrap { width: min(320px, 50%); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .72rem .8rem;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 87, 214, .12); }
textarea { resize: vertical; }

.client-list { display: grid; gap: .75rem; padding: 1rem; max-height: calc(100vh - 190px); overflow: auto; }
.client-card { border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; background: #fff; transition: border-color .15s ease, transform .15s ease; }
.client-card:hover, .client-card:focus { border-color: var(--accent); transform: translateY(-1px); outline: none; }
.client-card-main, .client-meta { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.client-card h3 { margin-bottom: .2rem; font-size: 1rem; }
.client-card p { margin-bottom: 0; }
.client-meta { margin-top: .7rem; font-size: .86rem; color: var(--muted); }
.client-email { overflow-wrap: anywhere; }
.status-pill { border-radius: 999px; padding: .3rem .55rem; font-size: .72rem; font-weight: 700; background: #eef2ff; color: #3538cd; text-transform: capitalize; white-space: nowrap; }

#clientForm { padding: 1.2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid label { display: grid; gap: .4rem; color: #344054; font-size: .88rem; font-weight: 600; }
.full-width { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.2rem; }
.form-error { padding: .75rem; border-radius: 10px; background: var(--danger-bg); color: var(--danger); margin: 1rem 0 0; }

.button { border: 1px solid transparent; border-radius: 10px; padding: .68rem .95rem; font-weight: 700; }
.button.primary { color: #fff; background: var(--accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.ghost { color: var(--text); background: #fff; border-color: var(--border); }
.button.danger { color: var(--danger); background: var(--danger-bg); border-color: #fecdca; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.notice { margin: 1rem 1rem 0; padding: .75rem .9rem; background: #ecfdf3; color: #067647; border-radius: 10px; }
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .client-list { max-height: none; }
  .topbar { position: static; }
}

@media (max-width: 560px) {
  .topbar, .panel-heading, .client-card-main, .client-meta { align-items: stretch; }
  .topbar, .panel-heading { flex-direction: column; }
  .search-wrap { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .form-actions { flex-direction: column; }
  .button { width: 100%; }
}
