:root {
  --purple: #140054;
  --lavender: #d4d2ff;
  --teal: #62e4d3;
  --deep-teal: #246a73;
  --white: #ffffff;
  --ink: #171322;
  --muted: #665f78;
  --line: #dedaf4;
  --panel: #fbfbff;
  --danger: #9f1f39;
  --shadow: 0 18px 40px rgba(20, 0, 84, 0.08);
  --body: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    linear-gradient(90deg, rgba(98, 228, 211, 0.18) 0 2px, transparent 2px 96px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.12) 0 2px, transparent 2px 96px),
    var(--purple);
}

.login-shell {
  width: min(100% - 32px, 440px);
}

.login-panel {
  padding: 34px;
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: 28px;
}

.login-brand img {
  width: min(310px, 100%);
  height: auto;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--deep-teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: var(--purple);
  font-size: 34px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 16px;
  color: var(--purple);
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 14px;
  color: var(--purple);
  font-size: 17px;
  line-height: 1.25;
}

.login-copy {
  margin-bottom: 24px;
  color: var(--muted);
}

.alert,
.dev-note {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 6px;
}

.alert {
  border: 1px solid rgba(159, 31, 57, 0.25);
  background: #fff2f5;
  color: var(--danger);
}

.dev-note {
  border: 1px solid rgba(98, 228, 211, 0.45);
  background: #effffb;
  color: var(--purple);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--purple);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--white);
  color: var(--ink);
}

input,
select {
  min-height: 48px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.primary-button,
.logout-form button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  min-height: 50px;
  border-radius: 6px;
  background: var(--purple);
  color: var(--white);
  font-weight: 700;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--purple);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--white);
  padding: 20px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
  color: var(--purple);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-brand img {
  width: 44px;
  height: 44px;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--lavender);
  color: var(--purple);
}

.logout-form {
  margin-top: auto;
  padding-top: 20px;
}

.logout-form button {
  width: 100%;
  min-height: 42px;
  border-radius: 6px;
  background: #f1effb;
  color: var(--purple);
  font-weight: 700;
}

.main-panel {
  min-width: 0;
  padding: 32px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin-bottom: 0;
}

.account-chip {
  min-width: 96px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--white);
  color: var(--purple);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.summary-band,
.table-panel,
.work-panel,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.summary-band {
  margin-bottom: 20px;
  padding: 22px 24px;
}

.summary-band p {
  max-width: 840px;
  margin-bottom: 0;
  color: var(--muted);
}

.action-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.client-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: min(100%, 380px);
}

.client-search {
  min-width: 0;
  width: min(280px, 100%);
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--purple);
  color: var(--white);
  text-decoration: none;
}

.icon-action:hover {
  background: #24106b;
}

.icon-action:focus {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.icon-action svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  min-height: 132px;
  padding: 20px;
}

.stat-card p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--purple);
  font-size: 34px;
  line-height: 1;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

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

.work-panel {
  padding: 22px 24px;
}

.work-panel ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.work-panel li {
  color: var(--muted);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--purple);
  font-size: 13px;
  text-transform: uppercase;
}

td {
  color: var(--muted);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.client-no-results td {
  color: var(--muted);
  text-align: center;
}

.client-row {
  cursor: pointer;
}

.client-row:hover {
  background: #f8f7ff;
}

.client-row:focus {
  outline: 2px solid var(--teal);
  outline-offset: -2px;
}

.client-table td {
  vertical-align: top;
}

.client-table {
  min-width: 1120px;
}

.client-table strong,
.client-table span {
  display: block;
}

.client-table strong {
  color: var(--ink);
}

.client-table span {
  color: var(--muted);
  font-size: 13px;
}

.client-name-link {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--purple);
  font-weight: 700;
  text-decoration: none;
}

.client-name-link:hover {
  text-decoration: underline;
}

.contact-link {
  display: block;
  color: var(--deep-teal);
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e9fff9;
  color: var(--deep-teal);
  font-size: 13px;
  font-weight: 700;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(23, 19, 34, 0.34);
}

.drawer-shell {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 21;
  width: min(100%, 720px);
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--white);
  box-shadow: -24px 0 48px rgba(20, 0, 84, 0.16);
  animation: drawer-in 260ms ease-out;
}

.drawer-shell.is-closing {
  animation: drawer-out 240ms ease-in forwards;
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes drawer-out {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
  padding: 28px 30px 22px;
}

.drawer-header h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.icon-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #f1effb;
  color: var(--purple);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.drawer-section,
.drawer-form {
  border-bottom: 1px solid var(--line);
  padding: 24px 30px;
}

.drawer-section:last-child {
  border-bottom: 0;
}

.drawer-form {
  display: grid;
  gap: 20px;
}

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

.form-grid.compact {
  gap: 12px;
}

.form-wide {
  grid-column: 1 / -1;
}

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

.detail-grid div {
  min-width: 0;
}

.detail-wide {
  grid-column: 1 / -1;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.inline-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.notes-form {
  margin-top: 18px;
  margin-bottom: 0;
}

.inline-form .primary-button,
.drawer-form .primary-button {
  justify-self: start;
  min-width: 160px;
  padding: 0 18px;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.activity-list p {
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 700;
}

.activity-list span,
.activity-list small,
.empty-state {
  color: var(--muted);
  font-size: 14px;
}

.activity-list small {
  display: block;
  margin-top: 6px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-panel {
    padding: 24px 18px;
  }

  .topbar {
    flex-direction: column;
  }

  .stat-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .drawer-shell {
    width: min(100%, 640px);
  }
}

@media (max-width: 520px) {
  .login-panel {
    padding: 26px 20px;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .account-chip {
    width: 100%;
  }

  .action-band {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-link {
    width: 100%;
  }

  .client-toolbar {
    width: 100%;
  }

  .client-search {
    width: 100%;
  }

  .drawer-header,
  .drawer-section,
  .drawer-form {
    padding-right: 20px;
    padding-left: 20px;
  }

  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
