:root {
  --brand-950: #082b28;
  --brand-900: #123b36;
  --brand-800: #195149;
  --brand-700: #246b60;
  --brand-100: #dceeea;
  --brand-50: #eff8f6;
  --solar-600: #d78112;
  --solar-500: #f2a52b;
  --solar-300: #f7ca75;
  --solar-100: #fdf0d2;
  --ink-950: #13201e;
  --ink-800: #263734;
  --ink-700: #3d4f4c;
  --ink-600: #596b68;
  --ink-500: #71817e;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --surface-muted: #eef3f1;
  --line: #dce5e2;
  --line-strong: #c6d3cf;
  --danger-700: #a42b2b;
  --danger-100: #fde2e2;
  --warning-700: #8a5500;
  --warning-100: #fff0cc;
  --success-700: #176b46;
  --success-100: #dcf5e8;
  --info-700: #245ba4;
  --info-100: #e1edfc;
  --shadow-xs: 0 1px 2px rgba(8, 43, 40, 0.05);
  --shadow-sm: 0 6px 18px rgba(8, 43, 40, 0.08);
  --shadow-md: 0 18px 44px rgba(8, 43, 40, 0.16);
  --radius-sm: 7px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --header-height: 68px;
  --sidebar-width: 248px;
  --content-max: 1500px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink-950);
  background: var(--surface-soft);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink-950);
  background: var(--surface-soft);
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

body.nav-open,
body.dialog-open {
  overflow: hidden;
}

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

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: var(--brand-700);
}

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

h1,
h2,
h3,
h4 {
  line-height: 1.2;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10000;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--brand-900);
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid rgba(242, 165, 43, 0.78);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.eyebrow,
.breadcrumb,
.dialog-eyebrow,
.nav-label {
  margin-bottom: 0.35rem;
  color: var(--brand-700);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(460px, 1.1fr);
  background: var(--surface);
}

.login-visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 68% 32%, rgba(255, 211, 119, 0.26), transparent 16%),
    linear-gradient(145deg, var(--brand-950), var(--brand-800) 62%, #257469);
}

.solar-sun {
  position: absolute;
  top: 18%;
  left: 50%;
  width: clamp(130px, 18vw, 230px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffd787, var(--solar-500));
  box-shadow: 0 0 80px rgba(242, 165, 43, 0.3);
}

.solar-orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 50%;
}

.solar-orbit-large {
  top: 7%;
  left: 18%;
  width: 72%;
  aspect-ratio: 1;
}

.solar-orbit-small {
  top: 14%;
  left: 35%;
  width: 43%;
  aspect-ratio: 1;
}

.solar-horizon {
  position: absolute;
  right: -12%;
  bottom: -16%;
  left: -10%;
  height: 47%;
  border-radius: 50% 50% 0 0;
  background:
    linear-gradient(168deg, transparent 0 31%, rgba(255, 255, 255, 0.06) 31.2% 32%, transparent 32.2%),
    linear-gradient(12deg, transparent 0 48%, rgba(255, 255, 255, 0.06) 48.2% 49%, transparent 49.2%),
    linear-gradient(180deg, #194a44, #0e332f);
  transform: rotate(-4deg);
}

.login-visual-copy {
  position: absolute;
  right: 10%;
  bottom: 9%;
  left: 10%;
  z-index: 1;
  max-width: 520px;
}

.login-visual-copy .eyebrow {
  color: var(--solar-300);
}

.login-statement {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3.3vw, 3.5rem);
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 3rem clamp(1.25rem, 6vw, 6rem);
}

.login-card {
  width: min(100%, 430px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  color: var(--ink-950);
  text-decoration: none;
}

.brand > span:last-child {
  display: flex;
  align-items: baseline;
  gap: 0.32rem;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--ink-500);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-900);
  box-shadow: inset 0 -5px 12px rgba(0, 0, 0, 0.12);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span::before,
.brand-mark span::after {
  position: absolute;
  width: 2px;
  height: 5px;
  border-radius: 99px;
  background: var(--solar-300);
  content: "";
}

.brand-mark::before { transform: translateY(-9px); }
.brand-mark::after { transform: translateY(9px); }
.brand-mark span::before { transform: translateX(-9px) rotate(90deg); }
.brand-mark span::after { transform: translateX(9px) rotate(90deg); }

.brand-mark span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--solar-500);
}

.brand-login {
  margin-bottom: clamp(3.5rem, 9vh, 7rem);
}

.login-heading {
  margin-bottom: 2rem;
}

.login-heading h1 {
  max-width: 390px;
  margin-bottom: 0.8rem;
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  letter-spacing: -0.045em;
}

.login-heading > p:last-child {
  margin-bottom: 0;
  color: var(--ink-600);
}

.field-group {
  display: grid;
  gap: 0.38rem;
  margin-bottom: 1rem;
}

.field-group label,
.field-label {
  color: var(--ink-800);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-hint {
  margin: 0.3rem 0 0;
  color: var(--ink-500);
  font-size: 0.78rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.68rem 0.78rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-950);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

input:hover,
select:hover,
textarea:hover {
  border-color: #9eb0ab;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-700);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(36, 107, 96, 0.13);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly],
textarea[readonly] {
  color: var(--ink-600);
  background: var(--surface-muted);
  cursor: not-allowed;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand-700);
}

input[type="file"] {
  height: auto;
  min-height: 46px;
  padding: 0.5rem;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 4.5rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
}

.text-button {
  min-height: 34px;
  padding: 0.35rem 0.5rem;
  border-radius: 5px;
  color: var(--brand-700);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 750;
}

.text-button:hover {
  background: var(--brand-50);
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 760;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.button-primary {
  color: #fff;
  background: var(--brand-900);
  border-color: var(--brand-900);
}

.button-primary:hover:not(:disabled) {
  background: var(--brand-800);
  border-color: var(--brand-800);
}

.button-solar {
  color: #352000;
  background: var(--solar-500);
  border-color: var(--solar-500);
}

.button-secondary {
  color: var(--ink-800);
  background: var(--surface);
  border-color: var(--line-strong);
}

.button-secondary:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: #a9bab5;
}

.button-danger {
  color: var(--danger-700);
  background: var(--surface);
  border-color: #e6aaaa;
}

.button-quiet {
  color: var(--brand-700);
  background: transparent;
}

.button-block {
  width: 100%;
  margin-top: 0.45rem;
}

.button-small {
  min-height: 36px;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
}

.form-status {
  min-height: 1.4rem;
  margin: 0.75rem 0 0;
  color: var(--ink-600);
  font-size: 0.85rem;
}

.form-status.is-error {
  color: var(--danger-700);
}

.form-status.is-success {
  color: var(--success-700);
}

.login-help {
  margin: 1.5rem 0 0;
  color: var(--ink-500);
  font-size: 0.8rem;
  text-align: center;
}

/* App shell */
.app-shell {
  min-height: 100vh;
}

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.header-leading,
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.icon-button {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-grid;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-700);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--brand-800);
  background: var(--brand-50);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mobile-menu-button {
  display: none;
}

.menu-lines {
  width: 21px;
  display: grid;
  gap: 4px;
}

.menu-lines i {
  width: 100%;
  height: 2px;
  display: block;
  border-radius: 99px;
  background: currentColor;
}

.notification-count,
.nav-count {
  min-width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 99px;
  color: #fff;
  background: var(--danger-700);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1;
}

.notification-count {
  position: absolute;
  top: 2px;
  right: 1px;
}

.connection-status {
  padding: 0.25rem 0.55rem;
  border-radius: 99px;
  color: var(--danger-700);
  background: var(--danger-100);
  font-size: 0.72rem;
  font-weight: 800;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.5rem;
  border-radius: 12px;
  cursor: pointer;
  list-style: none;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.account-menu summary:hover,
.account-menu[open] summary {
  background: var(--surface-muted);
}

.avatar {
  width: 36px;
  height: 36px;
  display: inline-grid;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand-700);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.avatar-large {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
}

.account-summary-copy,
.account-menu-identity > span:last-child {
  min-width: 0;
  display: grid;
}

.account-summary-copy strong,
.account-menu-identity strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-summary-copy small,
.account-menu-identity small {
  color: var(--ink-500);
  font-size: 0.72rem;
}

.summary-chevron {
  color: var(--ink-500);
}

.account-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(290px, calc(100vw - 1.25rem));
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.account-menu-identity {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.5rem 0.8rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.4rem;
}

.menu-action {
  width: 100%;
  min-height: 40px;
  padding: 0.55rem 0.65rem;
  border-radius: 7px;
  color: var(--ink-800);
  background: transparent;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 650;
  text-align: left;
}

.menu-action:hover {
  background: var(--surface-muted);
}

.menu-action-danger {
  color: var(--danger-700);
}

.app-body {
  min-height: 100vh;
  padding-top: var(--header-height);
}

.sidebar {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.8rem;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}

.nav-list {
  flex: 1;
}

.nav-label {
  margin: 1.05rem 0.65rem 0.38rem;
  color: var(--ink-500);
  font-size: 0.66rem;
}

.nav-label:first-child {
  margin-top: 0.2rem;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.12rem 0;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  color: var(--ink-600);
  background: transparent;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 680;
  text-align: left;
}

.nav-item:hover {
  color: var(--brand-800);
  background: var(--brand-50);
}

.nav-item.is-active {
  color: var(--brand-900);
  background: var(--brand-100);
  font-weight: 800;
}

.nav-icon {
  width: 23px;
  height: 23px;
  display: grid;
  flex: 0 0 23px;
  place-items: center;
  color: currentColor;
  font-size: 1.05rem;
}

.nav-item .nav-count,
.future-pill {
  margin-left: auto;
}

.future-pill {
  padding: 0.16rem 0.42rem;
  border-radius: 99px;
  color: var(--warning-700);
  background: var(--solar-100);
  font-size: 0.61rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-footer {
  padding: 0.9rem 0.7rem 0.25rem;
  border-top: 1px solid var(--line);
  color: var(--ink-500);
}

.sidebar-footer p {
  margin-bottom: 0.1rem;
  font-size: 0.75rem;
  font-weight: 750;
}

.sidebar-footer small {
  font-size: 0.68rem;
}

.main-content {
  width: calc(100% - var(--sidebar-width));
  min-height: calc(100vh - var(--header-height));
  margin-left: var(--sidebar-width);
  padding: clamp(1.15rem, 2.5vw, 2.25rem);
}

.page-heading,
.view-root,
.global-status {
  width: min(100%, var(--content-max));
  margin-right: auto;
  margin-left: auto;
}

.page-heading {
  min-height: 76px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.35rem;
}

.page-heading h1 {
  margin-bottom: 0.28rem;
  font-size: clamp(1.65rem, 2.7vw, 2.35rem);
  letter-spacing: -0.04em;
}

.page-description {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--ink-600);
  font-size: 0.9rem;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.global-status {
  min-height: 0;
}

.global-status:not(:empty) {
  margin-top: -0.55rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-700);
  background: var(--surface);
}

.global-status.is-error {
  border-color: #efb9b9;
  color: var(--danger-700);
  background: #fff8f8;
}

.view-root {
  min-height: 300px;
}

/* Shared content */
.card,
.section-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card {
  padding: 1rem;
}

.section-card {
  padding: 1.1rem;
}

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

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.section-header h2,
.section-header h3,
.section-card > h2,
.section-card > h3,
.card > h2,
.card > h3 {
  margin-bottom: 0.2rem;
  color: var(--ink-950);
  font-size: 1rem;
}

.section-header p,
.section-card > p,
.card > p {
  margin-bottom: 0;
  color: var(--ink-600);
  font-size: 0.82rem;
}

.section-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.muted {
  color: var(--ink-500) !important;
}

.small {
  font-size: 0.78rem !important;
}

.nowrap {
  white-space: nowrap;
}

.divider {
  height: 1px;
  margin: 1rem 0;
  background: var(--line);
}

.loading-state,
.empty-state,
.error-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: center;
}

.state-content {
  max-width: 480px;
}

.state-content h2 {
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
}

.state-content p {
  margin-bottom: 1rem;
  color: var(--ink-600);
  font-size: 0.86rem;
}

.spinner {
  width: 30px;
  height: 30px;
  margin: 0 auto 0.8rem;
  border: 3px solid var(--brand-100);
  border-top-color: var(--brand-700);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-badge,
.stage-badge,
.role-badge,
.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: fit-content;
  padding: 0.22rem 0.5rem;
  border-radius: 99px;
  color: var(--ink-700);
  background: var(--surface-muted);
  font-size: 0.68rem;
  font-weight: 820;
  line-height: 1.25;
  white-space: nowrap;
}

.status-badge::before,
.stage-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-success { color: var(--success-700); background: var(--success-100); }
.status-warning { color: var(--warning-700); background: var(--warning-100); }
.status-danger { color: var(--danger-700); background: var(--danger-100); }
.status-info { color: var(--info-700); background: var(--info-100); }

.stage-new-lead { color: #315f87; background: #e6f1fb; }
.stage-appointment-scheduled { color: #5b4aa1; background: #ede9fe; }
.stage-appointment-completed { color: #147260; background: #dff5ef; }
.stage-needs-reschedule { color: #a05b00; background: #fff0d2; }
.stage-follow-up { color: #8b477f; background: #f9e8f6; }
.stage-contracts-sent { color: #2c639e; background: #e3effc; }
.stage-closed-won { color: #176b46; background: #dcf5e8; }
.stage-closed-lost { color: #8b3a3a; background: #f8e4e4; }

/* Static stage accents keep runtime UI compatible with the production CSP. */
.stage-new-lead { --stage-accent: #4c82ad; }
.stage-appointment-scheduled { --stage-accent: #7663bd; }
.stage-appointment-completed { --stage-accent: #278875; }
.stage-needs-reschedule { --stage-accent: #d78318; }
.stage-follow-up { --stage-accent: #a75b98; }
.stage-contracts-sent { --stage-accent: #3f79b6; }
.stage-closed-won { --stage-accent: #28845b; }
.stage-closed-lost { --stage-accent: #a65454; }

/* Dashboard */
.dashboard-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.05rem 1.2rem;
  border: 1px solid #d4e5df;
  border-radius: var(--radius-md);
  background: linear-gradient(110deg, var(--brand-50), #fff9eb);
}

.dashboard-intro h2 {
  margin-bottom: 0.25rem;
  font-size: 1.12rem;
}

.dashboard-intro p {
  margin-bottom: 0;
  color: var(--ink-600);
  font-size: 0.83rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.metric-card {
  position: relative;
  min-height: 120px;
  display: grid;
  align-content: space-between;
  gap: 0.7rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-950);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}

.metric-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--stage-accent, var(--brand-700));
  content: "";
}

.metric-card:hover {
  border-color: var(--stage-accent, var(--brand-700));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dashboard-card-stack {
  display: grid;
  gap: 1rem;
}

.metric-label {
  color: var(--ink-600);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.metric-foot {
  color: var(--ink-500);
  font-size: 0.7rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr);
  gap: 1rem;
}

.dashboard-list,
.compact-list {
  display: grid;
  gap: 0;
}

.dashboard-list-item,
.compact-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.78rem 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-list-item:last-child,
.compact-list-item:last-child {
  border-bottom: 0;
}

.dashboard-list-item button,
.compact-list-item button {
  min-width: 0;
  padding: 0;
  color: var(--ink-950);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.list-primary {
  min-width: 0;
}

.list-primary strong,
.list-primary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-primary span {
  margin-top: 0.14rem;
  color: var(--ink-500);
  font-size: 0.74rem;
}

/* Filters and tables */
.filter-card {
  margin-bottom: 0.85rem;
  padding: 0.85rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(2, minmax(160px, 0.65fr)) auto;
  gap: 0.65rem;
  align-items: end;
}

.filter-bar-users {
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 0.4fr);
}

.filter-control {
  display: grid;
  gap: 0.3rem;
}

.filter-control label {
  color: var(--ink-600);
  font-size: 0.72rem;
  font-weight: 780;
}

.search-field {
  position: relative;
}

.search-field input {
  padding-left: 2.25rem;
}

.search-field::before {
  position: absolute;
  top: 50%;
  left: 0.78rem;
  z-index: 1;
  color: var(--ink-500);
  content: "⌕";
  font-size: 1rem;
  transform: translateY(-50%);
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-500);
  font-size: 0.78rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-wrap-always {
  display: block !important;
}

.data-table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.72rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--ink-500);
  background: var(--surface-soft);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.data-table tbody tr:hover td {
  background: #fbfdfc;
}

.row-link {
  padding: 0;
  color: var(--brand-800);
  background: transparent;
  cursor: pointer;
  font-weight: 780;
  text-align: left;
}

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

.cell-primary {
  display: block;
  color: var(--ink-950);
  font-weight: 720;
}

.cell-secondary {
  display: block;
  margin-top: 0.16rem;
  color: var(--ink-500);
  font-size: 0.7rem;
}

.mobile-card-list {
  display: none;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
}

.pagination p {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.75rem;
}

/* Pipeline */
.pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.pipeline-help {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.77rem;
}

.pipeline-board-wrap {
  margin: 0 calc(clamp(1.15rem, 2.5vw, 2.25rem) * -1);
  padding: 0 clamp(1.15rem, 2.5vw, 2.25rem) 1rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.pipeline-board {
  min-width: 2180px;
  display: grid;
  grid-template-columns: repeat(8, minmax(250px, 1fr));
  gap: 0.7rem;
}

.pipeline-column {
  min-height: 560px;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  transition: border 0.15s ease, background 0.15s ease;
}

.pipeline-column.is-drag-over {
  border-color: var(--brand-700);
  background: var(--brand-50);
}

.pipeline-column-header {
  min-height: 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin: -0.05rem 0 0.55rem;
  padding: 0.35rem 0.25rem 0.55rem;
  border-bottom: 2px solid var(--stage-accent, var(--brand-700));
}

.pipeline-column-header h2 {
  margin: 0;
  font-size: 0.78rem;
}

.pipeline-column-header span {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  color: var(--ink-600);
  background: var(--surface);
  font-size: 0.7rem;
  font-weight: 800;
}

.pipeline-card-list {
  display: grid;
  gap: 0.55rem;
}

.pipeline-card {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.pipeline-card[draggable="true"] {
  cursor: grab;
}

.pipeline-card.is-dragging {
  opacity: 0.48;
  cursor: grabbing;
}

.pipeline-card-title {
  width: 100%;
  padding: 0;
  color: var(--ink-950);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 780;
  text-align: left;
}

.pipeline-card-title:hover {
  color: var(--brand-700);
}

.pipeline-card-meta {
  display: grid;
  gap: 0.16rem;
  margin: 0.42rem 0 0.55rem;
  color: var(--ink-500);
  font-size: 0.69rem;
}

.pipeline-stage-select {
  min-height: 36px;
  padding: 0.4rem 0.48rem;
  font-size: 0.7rem;
}

.column-empty {
  padding: 1.1rem 0.5rem;
  color: var(--ink-500);
  font-size: 0.72rem;
  text-align: center;
}

/* Lead workspace */
.lead-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(115deg, #fff, var(--brand-50));
}

.lead-identity {
  min-width: 0;
}

.lead-identity h2 {
  margin: 0.35rem 0 0.3rem;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  letter-spacing: -0.03em;
}

.lead-identity p {
  margin-bottom: 0;
  color: var(--ink-600);
  font-size: 0.82rem;
}

.lead-quick-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.lead-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.72fr);
  gap: 0.9rem;
  align-items: start;
}

.lead-main-column,
.lead-side-column {
  display: grid;
  gap: 0.9rem;
}

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

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-span-full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.read-only-note {
  margin: 0 0 0.8rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--ink-600);
  background: var(--surface-muted);
  font-size: 0.78rem;
}

.detail-list {
  display: grid;
  gap: 0;
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.6fr) minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-label {
  color: var(--ink-500);
  font-size: 0.72rem;
}

.detail-value {
  min-width: 0;
  color: var(--ink-950);
  font-size: 0.78rem;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.address-links {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.address-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--brand-700);
  background: var(--surface);
  font-size: 0.73rem;
  font-weight: 750;
  text-decoration: none;
}

.address-link:hover {
  background: var(--brand-50);
}

.note-composer {
  margin-bottom: 0.6rem;
}

.note-composer textarea {
  min-height: 86px;
}

.note-list,
.timeline {
  display: grid;
  gap: 0;
}

.note-item,
.timeline-item {
  position: relative;
  padding: 0.75rem 0 0.75rem 1.3rem;
  border-left: 2px solid var(--line);
  margin-left: 0.3rem;
}

.note-item::before,
.timeline-item::before {
  position: absolute;
  top: 1rem;
  left: -5px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--brand-700);
  box-shadow: 0 0 0 1px var(--brand-700);
  content: "";
}

.note-item:last-child,
.timeline-item:last-child {
  padding-bottom: 0;
}

.note-meta,
.timeline-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  color: var(--ink-500);
  font-size: 0.68rem;
  flex-wrap: wrap;
}

.note-meta strong,
.timeline-meta strong {
  color: var(--ink-800);
}

.note-body,
.timeline-body {
  margin: 0;
  color: var(--ink-800);
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.document-list {
  display: grid;
  gap: 0.45rem;
}

.document-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.document-copy {
  min-width: 0;
}

.document-copy strong,
.document-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-copy strong {
  font-size: 0.76rem;
}

.document-copy span {
  margin-top: 0.12rem;
  color: var(--ink-500);
  font-size: 0.66rem;
}

.upload-box {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.7rem;
  padding: 0.75rem;
  border: 1px dashed #aebeba;
  border-radius: 9px;
  background: var(--surface-soft);
}

.workflow-status {
  display: grid;
  gap: 0.6rem;
}

.workflow-status-item {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.workflow-status-item h4 {
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
}

.workflow-status-item p {
  margin: 0.38rem 0 0;
  color: var(--ink-500);
  font-size: 0.7rem;
}

/* Notifications */
.notification-list {
  display: grid;
  gap: 0.55rem;
}

.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.notification-item.is-unread {
  border-color: #b8d8cf;
  background: var(--brand-50);
}

.notification-dot {
  width: 10px;
  height: 10px;
  margin-top: 0.28rem;
  border-radius: 50%;
  background: var(--line-strong);
}

.notification-item.is-unread .notification-dot {
  background: var(--solar-500);
}

.notification-copy button {
  padding: 0;
  color: var(--ink-950);
  background: transparent;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 750;
  text-align: left;
}

.notification-copy p {
  margin: 0.25rem 0 0;
  color: var(--ink-600);
  font-size: 0.76rem;
}

.notification-time {
  color: var(--ink-500);
  font-size: 0.67rem;
  white-space: nowrap;
}

/* Admin */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.integration-card {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
}

.integration-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.integration-head h2 {
  margin-bottom: 0.22rem;
  font-size: 1rem;
}

.integration-head p {
  margin-bottom: 0;
  color: var(--ink-600);
  font-size: 0.77rem;
}

.toggle-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.toggle-row label {
  font-size: 0.8rem;
  font-weight: 720;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 0.9rem;
}

.stage-order-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.8rem;
}

.stage-order-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 0.77rem;
  font-weight: 680;
}

.stage-order-number {
  width: 23px;
  height: 23px;
  display: grid;
  flex: 0 0 23px;
  place-items: center;
  border-radius: 50%;
  color: var(--brand-900);
  background: var(--brand-100);
  font-size: 0.67rem;
  font-weight: 850;
}

.permission-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
}

.permission-table th,
.permission-table td {
  padding: 0.55rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  text-align: left;
}

.permission-table th {
  color: var(--ink-500);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.permission-yes {
  color: var(--success-700);
  font-weight: 800;
}

.permission-no {
  color: var(--ink-500);
}

.future-panel {
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 18%, rgba(242, 165, 43, 0.18), transparent 27%),
    linear-gradient(160deg, #fff, var(--brand-50));
  text-align: center;
}

.future-panel-content {
  max-width: 620px;
}

.future-symbol {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 1rem;
  border-radius: 24px;
  color: var(--warning-700);
  background: var(--solar-100);
  font-size: 2rem;
}

.future-panel h2 {
  margin-bottom: 0.6rem;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.future-panel p {
  margin-bottom: 0;
  color: var(--ink-600);
}

.future-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 1.35rem;
}

.future-list span {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-600);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 650;
}

/* Dialogs */
dialog {
  padding: 0;
  border: 0;
  color: var(--ink-950);
  background: transparent;
}

dialog::backdrop {
  background: rgba(5, 28, 26, 0.56);
  backdrop-filter: blur(3px);
}

.app-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.dialog-shell {
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.dialog-eyebrow:empty {
  display: none;
}

.dialog-close {
  margin: -0.3rem -0.35rem 0 0;
  font-size: 1.5rem;
}

.dialog-content {
  min-height: 0;
  padding: 1rem 1.1rem;
  overflow-y: auto;
}

.dialog-status {
  margin: 0;
  padding: 0 1.1rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem calc(0.85rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.confirm-dialog {
  width: min(440px, calc(100vw - 2rem));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.confirm-shell {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
}

.confirm-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  color: var(--warning-700);
  background: var(--warning-100);
  font-size: 1.2rem;
  font-weight: 850;
}

.confirm-shell h2 {
  margin-bottom: 0.45rem;
  font-size: 1.1rem;
}

.confirm-shell > p {
  margin-bottom: 0.9rem;
  color: var(--ink-600);
  font-size: 0.83rem;
}

.confirm-shell .dialog-actions {
  padding: 0.75rem 0 0;
}

/* Toast */
.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 200;
  width: min(390px, calc(100vw - 2rem));
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-700);
  border-radius: var(--radius-sm);
  color: var(--ink-800);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  animation: toast-in 0.2s ease-out;
}

.toast.is-error {
  border-left-color: var(--danger-700);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.noscript-message {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: #fff;
  background: var(--brand-950);
  text-align: center;
}

/* Responsive */
@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .lead-workspace-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .lead-side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .filter-bar {
    grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 0.55fr));
  }

  .filter-bar > .button {
    grid-column: 1 / -1;
    width: fit-content;
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 62px;
  }

  .mobile-menu-button {
    display: inline-grid;
  }

  .app-header {
    padding: 0 0.65rem;
  }

  .account-summary-copy,
  .summary-chevron {
    display: none;
  }

  .account-menu summary {
    padding: 0.3rem;
  }

  .sidebar {
    top: var(--header-height);
    width: min(86vw, 300px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .nav-scrim {
    position: fixed;
    inset: var(--header-height) 0 0;
    z-index: 35;
    background: rgba(5, 28, 26, 0.42);
  }

  .main-content {
    width: 100%;
    margin-left: 0;
    padding: 1rem;
  }

  .page-heading {
    min-height: auto;
  }

  .pipeline-board-wrap {
    margin-right: -1rem;
    margin-left: -1rem;
    padding-right: 1rem;
    padding-left: 1rem;
  }

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

  .filter-bar .filter-control:first-child {
    grid-column: 1 / -1;
  }

  .filter-bar > .button {
    grid-column: auto;
    width: 100%;
  }
}

@media (max-width: 760px) {
  .login-screen {
    display: block;
  }

  .login-visual {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 2rem 1.2rem;
    background:
      radial-gradient(circle at 85% 4%, rgba(242, 165, 43, 0.19), transparent 24%),
      var(--surface);
  }

  .brand-login {
    margin-bottom: 3.5rem;
  }

  .page-heading {
    display: grid;
    gap: 0.85rem;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .page-actions .button {
    flex: 1 1 auto;
  }

  .dashboard-intro {
    display: grid;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .metric-card {
    min-height: 112px;
    padding: 0.78rem;
  }

  .metric-label {
    font-size: 0.66rem;
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .card-grid,
  .admin-grid,
  .lead-side-column {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    display: none;
  }

  .mobile-card-list {
    display: grid;
    gap: 0.55rem;
    padding: 0.7rem;
  }

  .mobile-data-card {
    display: grid;
    gap: 0.58rem;
    padding: 0.78rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
  }

  .mobile-data-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
  }

  .mobile-data-card-head button {
    padding: 0;
    color: var(--brand-800);
    background: transparent;
    cursor: pointer;
    font-weight: 780;
    text-align: left;
  }

  .mobile-data-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .mobile-data-card-grid span {
    min-width: 0;
    color: var(--ink-500);
    font-size: 0.67rem;
  }

  .mobile-data-card-grid strong {
    display: block;
    margin-top: 0.08rem;
    color: var(--ink-800);
    font-size: 0.73rem;
    overflow-wrap: anywhere;
  }

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

  .lead-hero {
    display: grid;
  }

  .lead-quick-actions {
    justify-content: flex-start;
  }

  .notification-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .notification-time {
    grid-column: 2;
  }

  .future-list {
    grid-template-columns: 1fr;
  }

  .app-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 94dvh;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }

  .dialog-shell {
    max-height: 94dvh;
    border-radius: 18px 18px 0 0;
  }

  .dialog-actions {
    position: sticky;
    bottom: 0;
  }

  .dialog-actions .button {
    flex: 1 1 0;
  }
}

@media (max-width: 520px) {
  .brand > span:last-child {
    display: grid;
    gap: 0;
  }

  .brand small {
    display: none;
  }

  .header-actions {
    gap: 0.2rem;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 100px;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .filter-bar .filter-control:first-child,
  .filter-bar > .button {
    grid-column: auto;
  }

  .page-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .section-header {
    display: grid;
  }

  .section-actions .button {
    flex: 1 1 auto;
  }

  .lead-quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .pagination {
    display: grid;
  }

  .pagination .inline-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .confirm-shell .dialog-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .app-header,
  .sidebar,
  .page-actions,
  .lead-quick-actions,
  .form-actions,
  .note-composer,
  .upload-box {
    display: none !important;
  }

  .main-content {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .card,
  .section-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
