/* MAM Literary Agency CRM — square Material staff interface.
   Visual language shared with the MAM Availability Portal staff theme. */
:root {
  --ink: #1f2933;
  --muted: #66727f;
  --line: rgba(98, 112, 128, 0.18);
  --surface: rgba(233, 237, 241, 0.97);
  --surface-raised: #eef2f5;
  --field: #f3f5f7;
  --blue: #1976d2;
  --blue-dark: #125ba4;
  --danger: #a33d38;
  --success: #2f6e49;
  --warn: #8a5a1a;
  --shadow: 0 1px 3px rgba(15, 23, 30, 0.08), 0 10px 24px rgba(15, 23, 30, 0.05);
  --shadow-action: 0 3px 10px rgba(25, 118, 210, 0.28);
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #d9e0e7 0%, #d1d8df 52%, #c7cfd7 100%);
}

.background {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0.3;
}

.orb-a {
  width: 26rem;
  height: 26rem;
  right: -8rem;
  top: -6rem;
  background: radial-gradient(circle, rgba(108, 133, 156, 0.2), transparent 68%);
}

.orb-b {
  width: 30rem;
  height: 30rem;
  left: -9rem;
  bottom: -10rem;
  background: radial-gradient(circle, rgba(116, 124, 132, 0.16), transparent 65%);
}

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 0.75rem 2.5rem;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.015em; }
h1 { margin-bottom: 0.85rem; font-size: clamp(1.75rem, 2.4vw, 2.5rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
a { color: #0b63b6; }
a:hover { color: #084d8e; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow {
  margin: 0 0 0.35rem;
  color: #697888;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Dark staff header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr) minmax(180px, 250px);
  align-items: center;
  gap: 1.25rem;
  min-height: 138px;
  margin: 0 0 1.5rem;
  padding: 1.15rem 2.5rem;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.18) 0 1px, transparent 2px),
    radial-gradient(circle at 36% 16%, rgba(255, 255, 255, 0.14) 0 1px, transparent 2px),
    radial-gradient(circle at 62% 20%, rgba(255, 255, 255, 0.16) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 14%, rgba(255, 255, 255, 0.12) 0 1px, transparent 2px),
    radial-gradient(ellipse at 50% 118%, rgba(145, 222, 255, 0.55) 0%, rgba(78, 161, 210, 0.22) 22%, rgba(5, 15, 24, 0) 48%),
    linear-gradient(180deg, #02070d 0%, #051321 58%, #071b2d 100%);
  box-shadow: 0 2px 10px rgba(17, 24, 31, 0.24);
}

.brand, .brand a { display: flex; align-items: center; }
.brand a { color: #edf4fb; text-decoration: none; }
.brand-logo { display: block; width: auto; height: 72px; object-fit: contain; }

.mainnav {
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.4rem;
  flex-wrap: wrap;
}

.mainnav a {
  padding: 0.72rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #eaf0f6;
  font-size: 0.91rem;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.mainnav a:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.mainnav a.active {
  border-color: transparent;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.32);
}

.userbox {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
}

.other-apps-menu, .settings-menu { position: relative; }

.topbar-apps-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 48px;
  padding: 0.72rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #eaf0f6;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
}

.topbar-apps-button:hover,
.topbar-apps-button[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.topbar-apps-chevron {
  width: 20px;
  height: 20px;
  transition: transform 140ms ease;
}

.topbar-apps-button[aria-expanded="true"] .topbar-apps-chevron { transform: rotate(180deg); }

.other-apps-dropdown[hidden] { display: none; }
.other-apps-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 50;
  width: max-content;
  min-width: 230px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0;
  background: #071725;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

.other-apps-dropdown [role="menuitem"] {
  display: block;
  width: 100%;
  padding: 0.82rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  color: #edf4fb;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}
.other-apps-dropdown [role="menuitem"]:last-child { border-bottom: 0; }
.other-apps-dropdown [role="menuitem"]:hover,
.other-apps-dropdown [role="menuitem"]:focus-visible { background: var(--blue); color: #fff; outline: 0; }
.settings-dropdown { min-width: 190px; }

.topbar-action-form { display: inline-flex; margin: 0; }

.topbar-icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.06);
  color: #edf4fb;
  cursor: pointer;
  text-decoration: none;
}

.topbar-icon-button svg { width: 24px; height: 24px; }
.topbar-icon-button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.topbar-icon-button.active { border-color: var(--blue); background: var(--blue); box-shadow: 0 4px 12px rgba(25, 118, 210, 0.32); }
.topbar-icon-button:focus-visible, .topbar-apps-button:focus-visible { outline: 3px solid rgba(145, 222, 255, 0.42); outline-offset: 2px; }
.topbar-utility-icon { width: 44px; border-color: transparent; background: transparent; color: #aab8c5; }
.topbar-utility-icon:hover, .topbar-utility-icon[aria-expanded="true"] { border-color: transparent; background: rgba(255, 255, 255, 0.08); color: #fff; }
.topbar-notification-button { position: relative; }
.notification-badge {
  position: absolute;
  top: -5px;
  right: -7px;
  display: grid;
  min-width: 23px;
  height: 23px;
  padding: 0 6px;
  place-items: center;
  border: 2px solid #071725;
  border-radius: 999px;
  background: #ff5b45;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 5px 14px rgba(255, 91, 69, 0.38);
}

/* Staff account management modal */
body.modal-open { overflow: hidden; }
.staff-modal-backdrop[hidden] { display: none !important; }
.staff-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 18, 25, 0.58);
  backdrop-filter: blur(6px);
}
.staff-modal-backdrop-nested { z-index: 1010; }
.staff-modal-panel {
  width: min(920px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.7rem;
  border: 1px solid rgba(108, 122, 137, 0.18);
  border-radius: 0;
  background: #e6ebef;
  box-shadow: 0 24px 70px rgba(4, 12, 22, 0.32);
}
.staff-modal-panel-wide { width: min(1220px, 100%); }
.staff-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.staff-modal-head h2 { margin-bottom: 0; font-size: 1.75rem; }
.staff-form-section {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border: 1px solid rgba(108, 122, 137, 0.13);
  background: rgba(238, 242, 245, 0.94);
  box-shadow: var(--shadow);
}
.staff-form-grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.staff-form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.staff-form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.staff-form-grid label { font-weight: 600; }
.staff-form-grid label input, .staff-form-grid label select { margin-top: 0.4rem; }
.staff-field-note { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.9rem; }
.staff-form-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.1rem; }
.staff-table-shell { overflow-x: auto; }
.staff-account-table { min-width: 850px; margin-bottom: 0; }
.staff-row-actions { display: flex; justify-content: flex-end; gap: 0.4rem; }
.staff-row-actions .btn { min-width: 38px; }
.staff-row-actions .btn:disabled { opacity: 0.38; cursor: not-allowed; }

/* Manage Clients */
.client-management-head { align-items: flex-end; }
.client-management-head h1 { margin-bottom: 0.35rem; }
.client-management-head p:last-child { margin-bottom: 0; }
.client-head-actions { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.client-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1.6fr) repeat(2, minmax(190px, 0.75fr)) auto auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(108, 122, 137, 0.12);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.client-toolbar label { display: grid; gap: 0.4rem; font-weight: 600; }
.client-toolbar label > span { font-size: 0.9rem; }
.client-result-count { align-self: center; justify-self: end; white-space: nowrap; }
.client-table-shell { overflow-x: auto; box-shadow: var(--shadow); }
.client-management-table { min-width: 1080px; margin: 0; box-shadow: none; }
.client-management-table td { vertical-align: middle; }
.client-name-cell { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--ink); font-weight: 500; text-decoration: none; }
.client-name-cell:hover { color: var(--blue-dark); }
.client-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid rgba(98, 112, 128, 0.2);
  border-radius: 50%;
  background: #d8e0e7;
  object-fit: cover;
}
.client-avatar-placeholder { display: grid; place-items: center; color: #607080; font-size: 1rem; font-weight: 700; }
.client-avatar-large { width: 64px; height: 64px; flex-basis: 64px; }
.client-show-title { display: flex; align-items: center; gap: 1rem; }
.client-show-title h1 { margin: 0; }
.client-type-label { text-transform: capitalize; }
.client-row-actions { display: flex; justify-content: flex-end; gap: 0.4rem; white-space: nowrap; }
.client-icon-action { width: 38px; min-width: 38px; padding-inline: 0; font-size: 1rem; }
.client-imdb-action { min-width: 50px; padding-inline: 0.55rem; border-color: #c6a800; background: #f5c518; color: #171717; font-weight: 800; }
.client-imdb-action:hover { border-color: #ae9400; background: #e1b500; color: #111; }
.client-modal-panel { width: min(980px, 100%); }
.client-modal-panel h3 { margin-bottom: 0.8rem; }
.client-modal-wide-field { display: block; margin-top: 0.9rem; font-weight: 600; }
.client-modal-wide-field input, .client-modal-wide-field textarea { margin-top: 0.4rem; }
.client-checkbox-field { display: inline-flex; align-items: center; gap: 0.55rem; margin: 0.6rem 0; font-weight: 600; }
.client-checkbox-field input { width: auto; }
.client-login-setup { margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid rgba(98, 112, 128, 0.16); }
.client-profile-image-layout { display: grid; grid-template-columns: minmax(280px, 1fr) 330px; gap: 1.5rem; align-items: start; }
.client-profile-image-fields label:first-child { display: grid; gap: 0.45rem; font-weight: 600; }
.client-profile-image-fields input[type="file"] { padding: 0.7rem; background: var(--field); }
.client-profile-crop {
  position: relative;
  width: 300px;
  height: 300px;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(98, 112, 128, 0.2);
  border-radius: 50%;
  background: #dfe6ec;
  cursor: move;
  touch-action: none;
  user-select: none;
}
.client-profile-crop img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.client-profile-crop-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: #9aa8b5; font-size: 5rem; font-weight: 700; }

.main-content { position: relative; min-width: 0; }

.page-head,
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 1.45rem 1.65rem;
  border: 1px solid rgba(108, 122, 137, 0.12);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.page-head { flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.dashboard-hero { display: block; }
.dashboard-hero h1 { margin-bottom: 0.45rem; font-size: clamp(2rem, 3vw, 3rem); }
.dashboard-hero p:last-child { max-width: 760px; margin-bottom: 0; font-size: 1.02rem; }

/* Square Material surfaces */
.card {
  margin-bottom: 1.25rem;
  padding: 1.45rem;
  border: 1px solid rgba(108, 122, 137, 0.12);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card.narrow { max-width: 620px; margin-inline: auto; }
.card-alert { border-left: 4px solid var(--danger); background: #f2e9e9; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1rem; }
.hub-panel { min-width: 0; padding: 1rem; border: 1px solid var(--line); background: rgba(239, 243, 247, 0.48); }
.subsection-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.subsection-head h2, .subsection-head h3 { margin: 0; }
.hub-panel > h3 { margin-top: 0; }
.section-actions { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.compact-table th, .compact-table td { padding: 0.65rem; }
.compact-list li { padding: 0.45rem 0; }
.record-type-nav { display: flex; gap: 0.5rem; margin: 0 0 1rem; overflow-x: auto; padding-bottom: 0.2rem; }
.record-type-nav a { flex: 0 0 auto; padding: 0.65rem 0.9rem; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; text-decoration: none; }
.record-type-nav a:hover { border-color: var(--blue); color: var(--blue); }
.record-type-nav a.active { border-color: var(--blue); background: var(--blue); color: #fff; }

/* Notification centre */
.notifications-page { width: min(1080px, 100%); margin-inline: auto; }
.notifications-head { align-items: flex-end; margin-bottom: 1rem; }
.notifications-head > div:first-child { max-width: 720px; }
.notifications-head h1 { margin-bottom: 0.35rem; }
.notifications-head p:last-child { margin-bottom: 0; line-height: 1.55; }
.notifications-summary { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.notifications-summary form, .notification-actions form { margin: 0; }
.notifications-count { display: inline-flex; align-items: baseline; gap: 0.32rem; color: var(--muted); }
.notifications-count strong { color: var(--ink); font-size: 1.45rem; }
.notification-filters { margin-bottom: 0.85rem; }
.notification-filters a { display: inline-flex; align-items: center; gap: 0.45rem; }
.notification-filters a span { min-width: 1.45rem; padding: 0.12rem 0.4rem; border-radius: 999px; background: rgba(102, 114, 127, 0.14); font-size: 0.74rem; text-align: center; }
.notification-filters a.active span { background: rgba(255, 255, 255, 0.2); }
.notification-list { display: grid; gap: 0.65rem; }
.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  background: rgba(238, 242, 245, 0.94);
  box-shadow: 0 1px 3px rgba(15, 23, 30, 0.06);
}
.notification-item-unread { border-left-color: var(--blue); background: rgba(242, 247, 252, 0.98); box-shadow: 0 5px 18px rgba(25, 80, 125, 0.08); }
.notification-type-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: #dfe7ee; color: #4f6374; }
.notification-type-icon svg { width: 23px; height: 23px; }
.notification-type-warning { background: #f4e8d8; color: #8a5a1a; }
.notification-type-submission, .notification-type-message { background: #dcebf8; color: #1768a8; }
.notification-type-document { background: #e7e1f2; color: #66528d; }
.notification-type-gate, .notification-type-task { background: #dcecdf; color: #2f6e49; }
.notification-content { min-width: 0; }
.notification-content h2 { margin: 0.3rem 0 0.35rem; font-size: 1.05rem; line-height: 1.35; }
.notification-content h2 a { color: var(--ink); text-decoration: none; }
.notification-content h2 a:hover { color: var(--blue-dark); text-decoration: underline; }
.notification-content > p { margin: 0; color: var(--muted); line-height: 1.45; }
.notification-meta { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.78rem; }
.notification-type-label { color: #506273; font-weight: 700; letter-spacing: 0.025em; text-transform: uppercase; }
.notification-unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.12); }
.notification-meta time::before { content: '·'; margin-right: 0.5rem; }
.notification-context { display: inline-flex; margin-top: 0.65rem; padding: 0.24rem 0.5rem; background: rgba(102, 114, 127, 0.09); color: #506273; font-size: 0.78rem; font-weight: 600; }
.notification-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.65rem; padding-top: 0.2rem; white-space: nowrap; }
.notification-read-button { padding: 0; border: 0; background: transparent; color: #526a7d; cursor: pointer; font: inherit; font-size: 0.82rem; text-decoration: underline; text-underline-offset: 2px; }
.notification-read-button:hover { color: var(--blue-dark); }
.notification-read-button:focus-visible { outline: 3px solid rgba(25, 118, 210, 0.24); outline-offset: 3px; }
.notification-empty { display: grid; min-height: 340px; place-items: center; align-content: center; padding: 2.5rem 1.5rem; border: 1px solid var(--line); background: var(--surface); text-align: center; box-shadow: var(--shadow); }
.notification-empty-icon { display: grid; width: 72px; height: 72px; margin-bottom: 1rem; place-items: center; border-radius: 50%; background: #dfeae3; color: var(--success); }
.notification-empty-icon svg { width: 38px; height: 38px; }
.notification-empty h2 { margin-bottom: 0.4rem; font-size: 1.4rem; }
.notification-empty p { max-width: 460px; margin-bottom: 1.25rem; }

/* Tables */
.table {
  width: 100%;
  margin: 0.4rem 0 1rem;
  border: 1px solid rgba(108, 122, 137, 0.16);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table th,
.table td {
  padding: 0.9rem 0.8rem;
  border: 0;
  border-bottom: 1px solid rgba(98, 112, 128, 0.16);
  text-align: left;
  vertical-align: top;
}

.table th {
  background: #e8edf1;
  color: #667483;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.table tbody td { background: rgba(239, 243, 247, 0.98); }
.table tbody tr:nth-child(even) td { background: rgba(223, 230, 236, 0.98); }
.table tbody tr:hover td { background: rgba(207, 218, 228, 0.98); }
.table tbody tr[data-row-href] { cursor: pointer; }
.table tbody tr[data-row-href] td { transition: background-color 130ms ease, box-shadow 130ms ease; }
.table tbody tr[data-row-href]:hover td { background: rgba(197, 213, 226, 0.98); }
.table tbody tr[data-row-href]:focus { outline: 0; }
.table tbody tr[data-row-href]:focus-visible td { background: rgba(213, 228, 241, 0.98); }
.table tbody tr[data-row-href]:focus-visible td:first-child { box-shadow: inset 4px 0 0 var(--blue); }
.table tr:last-child td { border-bottom: 0; }

.list { margin: 0.3rem 0; padding: 0; list-style: none; }
.list li { padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: 0.88rem; }
.kv dd { margin: 0; }
.checks { margin: 0.3rem 0; padding: 0; list-style: none; }
.checks li { padding: 0.35rem 0; }
.inline-stats { display: flex; gap: 1.4rem; padding: 0; flex-wrap: wrap; list-style: none; }
.approver { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

/* Material status chips intentionally retain the conventional pill shape. */
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0.25rem 0.68rem;
  border-radius: 999px;
  background: rgba(86, 101, 115, 0.12);
  color: #42515d;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.pill-good { background: rgba(47, 110, 73, 0.14); color: var(--success); }
.pill-warn { background: rgba(218, 154, 28, 0.2); color: #7f5208; }
.pill-bad { background: rgba(159, 45, 36, 0.14); color: #8f3d36; }
.pill-neutral { background: rgba(86, 101, 115, 0.12); color: #42515d; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0.68rem 1.05rem;
  border: 1px solid rgba(98, 112, 128, 0.22);
  border-radius: 0;
  background: transparent;
  color: #41505f;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.btn:hover {
  border-color: rgba(25, 118, 210, 0.3);
  background: rgba(25, 118, 210, 0.06);
  color: #174d7e;
}

.btn:focus-visible,
.btn-link:focus-visible {
  outline: 3px solid rgba(25, 118, 210, 0.24);
  outline-offset: 2px;
}

.btn-primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow-action);
}
.btn-primary:hover { border-color: var(--blue-dark); background: var(--blue-dark); color: #fff; }
.btn-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-small { min-height: 34px; padding: 0.38rem 0.7rem; font-size: 0.82rem; }
.btn-link { border: 0; background: none; color: #0b63b6; text-decoration: underline; cursor: pointer; }
.inline { display: inline; }
.inline-mini { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0.2rem 0.3rem 0.2rem 0; }

/* Forms */
form.entity-form label,
.stack label,
.login-card label {
  display: block;
  margin: 0.75rem 0 0.32rem;
  font-weight: 600;
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.78rem 0.9rem;
  border: 1px solid rgba(98, 112, 128, 0.18);
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
  font: inherit;
}

textarea { min-height: 112px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(25, 118, 210, 0.42);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.14);
}

input[type="checkbox"],
input[type="radio"] { accent-color: var(--blue); }

form.entity-form button { margin-top: 1.1rem; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.filterbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid rgba(108, 122, 137, 0.12);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.filterbar input, .filterbar select { width: auto; min-width: 210px; }
.inline-mini input, .inline-mini select { width: auto; min-width: 110px; min-height: 34px; padding: 0.38rem 0.55rem; font-size: 0.85rem; }

/* Messages */
.alert {
  margin-bottom: 0.9rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 0;
}
.alert-success { border-left-color: var(--success); background: #e7f0ea; color: #285d3e; }
.alert-error { border-left-color: var(--danger); background: #f3e8e7; color: #8d302b; }
.alert-info { border-left-color: var(--blue); background: #e7f0fa; color: #174d7e; }

/* Dashboard */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.tile {
  min-height: 145px;
  padding: 1.3rem 1.2rem;
  border: 1px solid rgba(108, 122, 137, 0.12);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}
.tile-num { display: block; margin-bottom: 0.65rem; color: var(--ink); font-size: 2.4rem; font-weight: 500; }
.tile-label { color: var(--muted); font-size: 0.9rem; }

details summary { margin-top: 0.6rem; color: #0b63b6; font-weight: 600; cursor: pointer; }
.pagination { margin-top: 0.75rem; color: var(--muted); font-size: 0.9rem; }

/* Standalone login */
.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(180deg, #d9e0e7 0%, #cbd3db 100%);
}

.login-card {
  width: min(760px, 96vw);
  border: 1px solid rgba(108, 122, 137, 0.16);
  border-radius: 0;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(15, 23, 30, 0.2);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  min-height: 145px;
  padding: 1.5rem 2rem;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(145, 222, 255, 0.46), transparent 48%),
    linear-gradient(180deg, #02070d, #071b2d);
  color: #fff;
}
.login-brand .brand-logo { height: 78px; }
.login-brand .eyebrow { color: #aebdca; }
.login-brand h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.2rem); }
.login-form-panel { padding: 1.75rem 2rem 2rem; }
.login-form-panel h2 { margin-bottom: 1rem; font-size: 1.65rem; }
.login-card form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1rem; }
.login-card form > input[type="hidden"] { display: none; }
.login-card form label:nth-of-type(1) { grid-column: 1; }
.login-card form #email { grid-column: 1; }
.login-card form label:nth-of-type(2) { grid-column: 2; grid-row: 1; }
.login-card form #password { grid-column: 2; grid-row: 2; }
.login-card form button { grid-column: 1 / -1; justify-self: end; min-width: 150px; margin-top: 1.1rem; }

/* Authentication and account recovery */
.auth-body { min-height: 100vh; background: linear-gradient(145deg, #d9e0e7, #f5f7f8 55%, #dce4e8); }
.auth-shell { position: relative; z-index: 1; width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1rem 0 4rem; }
.auth-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 145px;
  margin-bottom: 1.25rem;
  padding: 1.5rem 2rem;
  border: 1px solid rgba(180, 226, 255, 0.18);
  background:
    radial-gradient(ellipse at 50% 118%, rgba(145, 222, 255, 0.5), transparent 48%),
    linear-gradient(180deg, #02070d 0%, #051321 58%, #071b2d 100%);
  box-shadow: 0 14px 38px rgba(4, 12, 22, 0.28);
  color: #fff;
}
.auth-logo { display: block; width: auto; height: 82px; object-fit: contain; }
.auth-header .eyebrow { color: #aebdca; }
.auth-header h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.3rem); }
.auth-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 1rem; }
.auth-hero, .auth-panel {
  padding: 1.7rem;
  border: 1px solid rgba(108, 122, 137, 0.14);
  background: rgba(238, 242, 245, 0.94);
  box-shadow: var(--shadow);
}
.auth-hero { min-height: 310px; background: linear-gradient(135deg, rgba(232, 239, 244, 0.98), rgba(247, 249, 250, 0.96)); }
.auth-hero h2 { max-width: 600px; margin-top: 1rem; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1.02; }
.auth-hero p:last-child { max-width: 620px; font-size: 1.02rem; line-height: 1.6; }
.auth-panel h2 { margin-bottom: 0.8rem; font-size: 1.75rem; }
.auth-panel-narrow { width: min(680px, 100%); margin-inline: auto; }
.auth-form { display: grid; gap: 1rem; }
.auth-form label { display: grid; gap: 0.4rem; font-weight: 600; }
.auth-form .btn { justify-self: start; min-width: 150px; }
.auth-form-help { margin: 0; }
.auth-actions { display: flex; align-items: center; gap: 0.65rem; margin-top: 1rem; flex-wrap: wrap; }
.auth-actions form { margin: 0; }
.client-portal-heading { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.3rem; }
.client-portal-heading h2, .client-portal-heading p { margin-bottom: 0.3rem; }

@media (max-width: 1180px) {
  .topbar { grid-template-columns: 160px 1fr; padding-inline: 1.5rem; }
  .brand-logo { height: 62px; }
  .userbox { grid-column: 1 / -1; justify-content: flex-end; }
  .topbar { min-height: auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-toolbar { grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(170px, 0.65fr)); }
  .client-toolbar .btn, .client-result-count { justify-self: start; }
}

@media (max-width: 820px) {
  .shell { padding-inline: 0.5rem; }
  .topbar { position: relative; grid-template-columns: 1fr; justify-items: center; padding: 1rem; text-align: center; }
  .mainnav { width: 100%; }
  .mainnav a { padding: 0.65rem 0.75rem; font-size: 0.86rem; }
  .userbox { grid-column: auto; justify-content: center; flex-wrap: wrap; }
  .topbar-apps-button { text-align: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .hub-grid { grid-template-columns: 1fr; }
  .page-head, .dashboard-hero, .card { padding: 1.15rem; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .staff-modal-backdrop { align-items: stretch; padding: 0; }
  .staff-modal-panel { width: 100%; max-height: 100vh; min-height: 100vh; padding: 1.1rem; }
  .staff-form-grid-three, .staff-form-grid-two { grid-template-columns: 1fr; }
  .client-toolbar { grid-template-columns: 1fr; }
  .client-result-count { justify-self: start; }
  .client-profile-image-layout { grid-template-columns: 1fr; }
  .client-profile-crop { width: min(300px, 100%); height: auto; aspect-ratio: 1; }
  .auth-grid { grid-template-columns: 1fr; }
  .notification-item { grid-template-columns: 44px minmax(0, 1fr); }
  .notification-actions { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .tiles { grid-template-columns: 1fr; }
  .filterbar { align-items: stretch; flex-direction: column; }
  .filterbar input, .filterbar select, .filterbar .btn { width: 100%; }
  .login-body { padding: 0; place-items: stretch; }
  .login-card { width: 100%; min-height: 100vh; border: 0; }
  .login-brand { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .login-card form { grid-template-columns: 1fr; }
  .login-card form label:nth-of-type(1),
  .login-card form #email,
  .login-card form label:nth-of-type(2),
  .login-card form #password,
  .login-card form button { grid-column: 1; grid-row: auto; }
  .login-card form button { width: 100%; }
  .auth-shell { width: 100%; padding: 0; }
  .auth-header { align-items: flex-start; flex-direction: column; margin-bottom: 0; padding: 1.25rem; }
  .auth-main { padding: 0; }
  .auth-hero, .auth-panel { padding: 1.25rem; }
  .auth-actions, .auth-actions .btn, .auth-form .btn { width: 100%; }
  .notifications-summary { width: 100%; justify-content: space-between; }
  .notification-item { grid-template-columns: 38px minmax(0, 1fr); gap: 0.75rem; padding: 1rem 0.85rem; }
  .notification-type-icon { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
