:root {
  color-scheme: light;
  --cloud: #f4f7f6;
  --surface: #ffffff;
  --surface-muted: #edf3f2;
  --surface-sea: #e4f1f1;
  --ink: #263033;
  --muted: #69777a;
  --faint: #92a0a2;
  --line: #d9e2e1;
  --line-strong: #c5d2d1;
  --sea: #137e87;
  --sea-deep: #0f6e76;
  --sea-ink: #07555c;
  --sun: #f1c059;
  --sun-hover: #eab344;
  --danger: #96342e;
  --danger-bg: #f9e9e7;
  --success: #27735c;
  --success-bg: #e5f2ed;
  --warning: #754b10;
  --warning-bg: #fbf1d7;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 16px;
  --shadow-drawer: -14px 0 36px rgba(22, 45, 48, 0.16);
  --focus: 0 0 0 3px rgba(19, 126, 135, 0.22);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cloud);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cloud);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

button,
[role="button"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

input,
select,
textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--focus);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #758386;
  opacity: 1;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

.svg-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.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;
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--sea);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 720;
  transition:
    background-color 170ms ease-out,
    border-color 170ms ease-out,
    color 170ms ease-out,
    transform 170ms ease-out;
}

.button:active {
  transform: translateY(1px);
}

.button--wide {
  width: 100%;
}

.button--sun {
  background: var(--sun);
  color: var(--ink);
}

.button--sun:hover {
  background: var(--sun-hover);
}

.button--sea {
  background: var(--sea);
  color: #fff;
}

.button--sea:hover {
  background: var(--sea-deep);
}

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

.button--neutral:hover {
  background: var(--surface-muted);
}

.quiet-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.quiet-button:hover {
  color: var(--sea-deep);
}

.quiet-button svg {
  width: 19px;
  height: 19px;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  transition:
    background-color 170ms ease-out,
    color 170ms ease-out,
    transform 170ms ease-out;
}

.icon-button:hover {
  background: var(--surface-muted);
  color: var(--sea-deep);
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.login-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, 520px) minmax(300px, 1fr);
  background: var(--surface);
}

.login-panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 7vw, 92px);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.brand img {
  flex: 0 0 auto;
}

.brand div {
  display: grid;
  min-width: 0;
}

.brand strong {
  color: var(--ink);
  font-size: 16px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.brand--login {
  position: absolute;
  top: 34px;
  left: clamp(36px, 7vw, 92px);
}

.brand--login strong {
  font-size: 18px;
}

.login-copy {
  max-width: 420px;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.login-copy > p:last-child {
  max-width: 38ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.login-form {
  display: grid;
  max-width: 420px;
  gap: 17px;
  margin-top: 38px;
}

.auth-flow {
  max-width: 420px;
}

.auth-flow h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.auth-flow > p:not(.section-kicker) {
  max-width: 42ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.auth-link {
  width: fit-content;
  margin: -2px auto 0;
  padding: 5px 2px;
  border: 0;
  background: transparent;
  color: var(--sea-deep);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link:disabled {
  cursor: default;
  opacity: 0.55;
}

.form-message {
  margin: -3px 0 0;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--surface-sea);
  color: var(--sea-ink);
  font-size: 13px;
  font-weight: 650;
}

.login-form label,
.form-field {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.login-form input,
.form-field input,
.form-field select,
.form-field textarea {
  min-height: 46px;
  padding: 10px 13px;
  font-weight: 520;
}

.form-field textarea {
  min-height: 94px;
  resize: vertical;
}

.form-error {
  margin: -3px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 650;
}

.login-note {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: flex-end;
  overflow: hidden;
  padding: clamp(36px, 6vw, 80px);
  background: var(--surface-sea);
}

.login-note::before {
  position: absolute;
  top: 12%;
  right: -8%;
  width: min(46vw, 620px);
  aspect-ratio: 1;
  border: 1px solid rgba(19, 126, 135, 0.22);
  border-radius: 50%;
  content: "";
}

.login-note::after {
  position: absolute;
  top: 29%;
  right: 13%;
  width: min(24vw, 310px);
  aspect-ratio: 1;
  border: 46px solid rgba(241, 192, 89, 0.62);
  border-radius: 50%;
  content: "";
}

.login-note p {
  position: relative;
  z-index: 1;
  max-width: 44ch;
  margin: 0;
  color: var(--sea-ink);
  font-size: 15px;
}

.login-note__marker {
  position: absolute;
  bottom: calc(clamp(36px, 6vw, 80px) + 62px);
  left: clamp(36px, 6vw, 80px);
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--sea);
}

.app-shell {
  display: grid;
  height: 100dvh;
  min-height: 620px;
  grid-template-columns: 214px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100dvh;
  flex-direction: column;
  padding: 18px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar .brand {
  min-height: 48px;
  padding: 0 7px;
}

.main-nav {
  display: grid;
  gap: 5px;
  margin-top: 28px;
}

.nav-item {
  display: grid;
  min-height: 44px;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-weight: 680;
  text-align: left;
  transition:
    background-color 160ms ease-out,
    color 160ms ease-out;
}

.nav-item:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--surface-sea);
  color: var(--sea-deep);
}

.nav-item svg {
  width: 21px;
  height: 21px;
}

.nav-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--sea-deep);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.nav-count--alert {
  background: var(--warning-bg);
  color: var(--warning);
}

.sidebar-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 16px 7px 0;
  border-top: 1px solid var(--line);
}

.sidebar-foot p {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
}

.workspace {
  display: grid;
  height: 100dvh;
  min-width: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.workspace:has(.page-error:not([hidden])) {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.workspace > *,
.topbar,
.filter-strip,
.content {
  min-width: 0;
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px clamp(18px, 2.2vw, 30px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 246, 0.96);
}

.topbar > div:first-of-type {
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.topbar-context {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.freshness {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-avatar {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--sea);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.filter-strip {
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 8px clamp(18px, 2.2vw, 30px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.filter-strip.is-clients-mode .period-presets,
.filter-strip.is-clients-mode .period-picker-shell,
.filter-strip.is-clients-mode > .button,
.filter-strip.is-clients-mode > #clear-filters {
  display: none;
}

.filter-strip.is-clients-mode .filter-field--client {
  max-width: 720px;
  flex: 1 1 520px;
}

.period-presets {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-muted);
}

.period-presets button {
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.period-presets button.is-active {
  background: var(--surface);
  color: var(--sea-deep);
  box-shadow: 0 2px 5px rgba(37, 65, 68, 0.08);
}

.period-picker-shell {
  position: relative;
  flex: 0 0 auto;
}

.period-picker-trigger {
  display: grid;
  min-width: 258px;
  min-height: 42px;
  grid-template-columns: 19px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--sea-deep);
  text-align: left;
  transition:
    border-color 160ms var(--ease-out),
    background-color 160ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.period-picker-trigger:hover,
.period-picker-trigger[aria-expanded="true"] {
  border-color: var(--sea);
  background: var(--surface-sea);
}

.period-picker-trigger:active {
  transform: scale(0.98);
}

.period-picker-trigger > svg {
  width: 19px;
  height: 19px;
}

.period-picker-trigger > span {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.period-picker-trigger small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.period-picker-trigger strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-picker-trigger__chevron {
  transition: transform 180ms var(--ease-out);
}

.period-picker-trigger[aria-expanded="true"]
  .period-picker-trigger__chevron {
  transform: rotate(180deg);
}

.period-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 45;
  width: min(650px, calc(100vw - 250px));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 20px 52px rgba(22, 45, 48, 0.18);
  transform-origin: 112px 0;
  animation: period-picker-in 170ms var(--ease-out);
}

@keyframes period-picker-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.period-picker__head {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.period-picker__head > div:first-child {
  display: grid;
}

.period-picker__head strong {
  font-size: 13px;
}

.period-picker__head span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.period-picker__nav {
  display: flex;
  gap: 6px;
}

.period-picker__nav .icon-button {
  width: 34px;
  height: 34px;
}

.period-picker__nav button:first-child svg {
  transform: rotate(90deg);
}

.period-picker__nav button:last-child svg {
  transform: rotate(-90deg);
}

.calendar-months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 15px;
}

.calendar-month {
  min-width: 0;
}

.calendar-month h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
  text-transform: capitalize;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
}

.calendar-weekdays span {
  padding: 4px 0;
}

.calendar-day {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  transition:
    background-color 130ms var(--ease-out),
    color 130ms var(--ease-out),
    transform 130ms var(--ease-out);
}

.calendar-day:not(.calendar-day--empty):hover {
  background: var(--surface-sea);
  color: var(--sea-deep);
}

.calendar-day:not(.calendar-day--empty):active {
  transform: scale(0.92);
}

.calendar-day.is-in-range {
  border-radius: 0;
  background: var(--surface-sea);
  color: var(--sea-ink);
}

.calendar-day.is-selected {
  border-radius: 9px;
  background: var(--sea);
  color: #fff;
  font-weight: 800;
}

.calendar-day.is-today:not(.is-selected)::after {
  position: absolute;
  bottom: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--sea);
  content: "";
}

.period-picker__foot {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--cloud);
}

.filter-field {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.filter-field input {
  width: 118px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.filter-field--client {
  min-width: 220px;
  flex: 1 1 280px;
}

.filter-field--client svg {
  width: 18px;
  height: 18px;
}

.filter-field--client input {
  width: 100%;
}

.content {
  grid-row: -2 / -1;
  width: min(100%, 1540px);
  min-width: 0;
  min-height: 0;
  margin: 0 auto;
  overflow-y: auto;
  padding: 18px clamp(18px, 2.2vw, 30px) 30px;
}

.page-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px clamp(20px, 3vw, 42px) 0;
  padding: 14px 16px;
  border: 1px solid #eac7c2;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
}

.page-error strong,
.page-error p {
  margin: 0;
}

.page-error p {
  margin-top: 2px;
  font-size: 13px;
}

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

.view-intro h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.028em;
}

.view-intro p {
  max-width: 70ch;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.data-note {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 9px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.data-note svg {
  width: 16px;
  height: 16px;
}

.metric-ledger {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.metric {
  min-width: 0;
  padding: 18px 18px 17px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric__label {
  display: flex;
  min-height: 34px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.metric__label svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--faint);
}

.metric strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: clamp(22px, 1.7vw, 29px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric small {
  display: block;
  min-height: 18px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.metric--attention strong {
  color: var(--warning);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel__head {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel__head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.015em;
}

.panel__head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.panel__body {
  padding: 18px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--sea);
}

.chart-legend span:nth-child(2) i {
  background: var(--sun);
}

.trend-chart {
  position: relative;
  min-height: 270px;
}

.trend-chart svg {
  display: block;
  width: 100%;
  height: 270px;
  overflow: visible;
}

.trend-chart .grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.trend-chart .axis-label {
  fill: var(--muted);
  stroke: none;
  font-size: 10px;
}

.trend-chart .area {
  fill: rgba(19, 126, 135, 0.08);
  stroke: none;
}

.trend-chart .line {
  fill: none;
  stroke: var(--sea);
  stroke-width: 2.5;
}

.trend-chart .application-bar {
  fill: var(--sun);
  stroke: none;
}

.action-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.action-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.action-item:last-child {
  border-bottom: 0;
}

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

.action-item__main {
  min-width: 0;
}

.action-item__main strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-item__main p {
  display: -webkit-box;
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.action-item__meta {
  display: grid;
  align-content: space-between;
  justify-items: end;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.action-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--sea-deep);
  font-size: 12px;
  font-weight: 720;
}

.action-link svg {
  width: 15px;
  height: 15px;
}

.empty-inline {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-inline strong {
  display: block;
  color: var(--ink);
}

.empty-inline p {
  max-width: 38ch;
  margin: 6px 0 0;
  font-size: 12px;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.breakdown-list {
  display: grid;
  gap: 13px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(90px, 150px) minmax(80px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.breakdown-row__label {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breakdown-row__track {
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: var(--surface-muted);
  appearance: none;
}

.breakdown-row__track::-webkit-progress-bar {
  border-radius: inherit;
  background: var(--surface-muted);
}

.breakdown-row__track::-webkit-progress-value {
  border-radius: inherit;
  background: var(--sea);
}

.breakdown-row__track::-moz-progress-bar {
  border-radius: inherit;
  background: var(--sea);
}

.breakdown-row:nth-child(even) .breakdown-row__track::-webkit-progress-value {
  background: #6aa9ae;
}

.breakdown-row:nth-child(even) .breakdown-row__track::-moz-progress-bar {
  background: #6aa9ae;
}

.breakdown-row strong {
  min-width: 42px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.coverage-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: var(--radius);
  background: var(--surface-sea);
  color: var(--sea-ink);
}

.coverage-callout svg {
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.coverage-callout strong,
.coverage-callout p {
  margin: 0;
}

.coverage-callout p {
  max-width: 90ch;
  margin-top: 3px;
  font-size: 12px;
}

.table-panel {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.table-panel > .panel__body {
  min-height: 0;
  overflow-y: auto;
}

.content:has(> .table-panel),
.content:has(> .chat-layout) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar--clients {
  justify-content: flex-end;
}

.table-toolbar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.toolbar-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.view-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-muted);
}

.view-switch__button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.view-switch__button:hover {
  color: var(--ink);
}

.view-switch__button.is-active {
  background: var(--surface);
  color: var(--sea-deep);
  box-shadow: 0 2px 7px rgba(22, 45, 48, 0.08);
}

.view-switch__button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.select-control,
.search-control {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 620;
}

.search-control {
  min-width: 260px;
}

.table-wrap {
  width: 100%;
  min-height: 0;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table--applications {
  table-layout: fixed;
}

.table-panel:has(.data-table--applications) .table-wrap {
  overflow-x: hidden;
}

.data-table--applications .col-reference {
  width: 16%;
}

.data-table--applications .col-client {
  width: 14%;
}

.data-table--applications .col-service {
  width: 24%;
}

.data-table--applications .col-status {
  width: 9%;
}

.data-table--applications .col-money {
  width: 9%;
}

.data-table--applications .col-date {
  width: 10%;
}

.data-table--applications .col-action {
  width: 9%;
}

.data-table--applications th:last-child,
.data-table--applications td:last-child {
  padding-right: 8px;
  padding-left: 6px;
  text-align: right;
}

.data-table--applications .cell-action {
  overflow: hidden;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 36px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.025em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  height: 54px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--surface-muted);
}

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

.cell-primary {
  display: block;
  max-width: 360px;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 690;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-secondary {
  display: block;
  max-width: 360px;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.money {
  font-variant-numeric: tabular-nums;
  font-weight: 730;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.status--new,
.status--waiting-manager,
.status--pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.status--manager-review,
.status--waiting-customer {
  background: var(--surface-sea);
  color: var(--sea-deep);
}

.status--confirmed,
.status--completed,
.status--paid {
  background: var(--success-bg);
  color: var(--success);
}

.status--cancelled,
.status--rejected,
.status--failed {
  background: var(--danger-bg);
  color: var(--danger);
}

.row-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--sea-deep);
  font-size: 11px;
  font-weight: 720;
}

.row-button:hover {
  border-color: var(--sea);
  background: var(--surface-sea);
}

.row-button--table {
  width: 100%;
  max-width: 86px;
  padding-inline: 6px;
}

.pagination {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.pagination__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination__button {
  display: inline-grid;
  min-width: 32px;
  height: 32px;
  place-items: center;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  transition:
    background-color 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.pagination__button:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--sea-deep);
}

.pagination__button:active:not(:disabled) {
  transform: scale(0.94);
}

.pagination__button.is-current {
  border-color: var(--sea);
  background: var(--surface-sea);
  color: var(--sea-deep);
}

.pagination__button--arrow {
  border-color: var(--line);
  background: var(--surface);
}

.pagination__ellipsis {
  min-width: 20px;
  color: var(--faint);
  text-align: center;
}

.pagination__page-count {
  min-width: 96px;
  text-align: right;
}

.skeleton-stack {
  display: grid;
  gap: 18px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(19, 126, 135, 0.08),
    transparent
  );
  content: "";
  transform: translateX(-100%);
  animation: skeleton-pass 1.2s ease-in-out infinite;
}

.skeleton--metrics {
  height: 116px;
}

.skeleton--main {
  height: 350px;
}

@keyframes skeleton-pass {
  to {
    transform: translateX(100%);
  }
}

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

.client-grid--list {
  display: grid;
  gap: 4px;
}

.client-grid--list .client-record {
  min-height: 78px;
  grid-template-columns: minmax(250px, 1.3fr) minmax(450px, 2.2fr) minmax(310px, auto);
  align-items: center;
  gap: 24px;
  padding: 13px 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  transition: background-color 160ms ease-out;
}

.client-grid--list .client-record:hover {
  background: var(--surface-muted);
}

.client-grid--list .client-facts {
  grid-template-columns: minmax(126px, 1.2fr) minmax(54px, 0.45fr) minmax(96px, 0.8fr) minmax(118px, 1fr);
  align-items: center;
  gap: 18px;
}

.client-grid--list .client-record__head {
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: 6px;
}

.client-grid--list .client-record__head > .status {
  width: fit-content;
  margin-left: 48px;
}

.client-grid--list .client-facts div {
  padding-top: 0;
  border-top: 0;
}

.client-grid--list .client-fact--interest,
.client-grid--list .client-fact--last-application {
  display: none;
}

.client-grid--cards .client-record__interest {
  display: none;
}

.client-grid--list .drawer-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 0;
}

.client-grid--list .row-button {
  white-space: nowrap;
}

.client-record {
  display: grid;
  min-width: 0;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.client-record__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.client-record__person {
  display: grid;
  min-width: 0;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.client-record__identity {
  min-width: 0;
}

.client-initials {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-sea);
  color: var(--sea-deep);
  font-size: 11px;
  font-weight: 800;
}

.client-record h3 {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-record__handle {
  overflow: hidden;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-record__interest {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--sea-deep);
  font-size: 10px;
  font-weight: 660;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
}

.client-facts div {
  min-width: 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.client-facts dt {
  color: var(--muted);
  font-size: 10px;
}

.client-facts dd {
  overflow: hidden;
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.activity-summary > div {
  min-width: 0;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--surface-muted);
}

.activity-summary dt {
  color: var(--muted);
  font-size: 10px;
}

.activity-summary dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.activity-breakdown,
.activity-timeline {
  display: grid;
  gap: 4px;
}

.activity-breakdown__row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
}

.activity-breakdown__row + .activity-breakdown__row {
  border-top: 1px solid var(--line);
}

.activity-breakdown__row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.activity-breakdown__row strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-breakdown__row span {
  color: var(--muted);
  font-size: 10px;
}

.activity-breakdown__row > span {
  flex: none;
  color: var(--sea-deep);
  font-size: 12px;
  font-weight: 720;
}

.activity-timeline__item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 9px 0;
}

.activity-timeline__mark {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--sea);
}

.activity-timeline__item strong {
  display: block;
  font-size: 11px;
}

.activity-timeline__item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.activity-timeline__item time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.activity-empty {
  display: grid;
  min-height: 360px;
  place-content: center;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.activity-empty__icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-sea);
  color: var(--sea-deep);
}

.activity-empty__icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.activity-empty strong {
  font-size: 15px;
}

.activity-empty p {
  max-width: 38ch;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.chat-layout {
  display: grid;
  min-height: 0;
  height: 100%;
  grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.chat-list-pane {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.chat-list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.8fr);
  gap: 7px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.chat-list {
  min-height: 0;
  overflow-y: auto;
}

.chat-list-item {
  display: grid;
  width: 100%;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.chat-list-item:hover {
  background: var(--surface-muted);
}

.chat-list-item.is-active {
  background: var(--surface-sea);
}

.chat-list-item__body {
  min-width: 0;
}

.chat-list-item__name {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-item__message {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-item__time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.chat-sync-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--sea-deep);
  font-size: 10px;
  font-weight: 700;
}

.chat-sync-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: sync-pulse 1.2s ease-in-out infinite;
}

@keyframes sync-pulse {
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

.unread-dot {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--warning);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.chat-thread {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-thread__head {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.chat-thread__head h3,
.chat-thread__head p {
  margin: 0;
}

.chat-thread__head h3 {
  font-size: 14px;
}

.chat-thread__head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.chat-messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 18px;
  background: var(--cloud);
}

.message {
  max-width: min(72%, 620px);
  padding: 10px 12px;
  border-radius: 13px 13px 13px 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.message--outbound {
  align-self: flex-end;
  border-radius: 13px 13px 4px;
  background: var(--surface-sea);
  color: var(--sea-ink);
}

.message p {
  margin: 0;
  white-space: pre-wrap;
}

.message time {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 13px;
  border-top: 1px solid var(--line);
}

.reply-form textarea {
  min-height: 46px;
  max-height: 140px;
  padding: 11px 12px;
  resize: vertical;
}

.reply-form .button svg {
  width: 18px;
  height: 18px;
}

.chat-placeholder {
  display: grid;
  height: 100%;
  min-height: 0;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.chat-placeholder strong {
  display: block;
  color: var(--ink);
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  display: grid;
  width: min(520px, 100vw);
  height: 100vh;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--surface);
  box-shadow: var(--shadow-drawer);
  transform: translateX(104%);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

.detail-drawer__head {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.detail-drawer__head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.detail-drawer__content {
  overflow-y: auto;
  padding: 20px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(11, 20, 22, 0.38);
}

.drawer-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-section:first-child {
  padding-top: 0;
}

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

.drawer-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
}

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

.drawer-facts dt {
  color: var(--muted);
  font-size: 10px;
}

.drawer-facts dd {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 680;
  word-break: break-word;
}

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

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

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 4px;
}

.mobile-only {
  display: none;
}

.phone-only {
  display: none;
}

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

  .metric {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(3n) {
    border-right: 0;
  }

  .metric:nth-last-child(-n + 3) {
    border-bottom: 0;
  }

  .filter-field--client {
    min-width: 180px;
  }

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

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

  .client-grid--list .client-record {
    grid-template-columns: minmax(200px, 0.9fr) minmax(330px, 1.5fr);
  }

  .client-grid--list .client-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .client-grid--list .drawer-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

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

  .sidebar {
    position: fixed;
    left: 0;
    z-index: 50;
    width: 230px;
    transform: translateX(-105%);
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 14px 0 36px rgba(22, 45, 48, 0.14);
  }

  .mobile-only {
    display: inline-grid;
  }

  .topbar {
    justify-content: flex-start;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .freshness {
    display: none;
  }

  .filter-strip {
    flex-wrap: wrap;
  }

  .period-picker-shell {
    flex: 1 1 258px;
  }

  .period-picker-trigger {
    width: 100%;
  }

  .dashboard-grid,
  .breakdown-grid {
    grid-template-columns: 1fr;
  }

  .chat-layout {
    grid-template-columns: minmax(250px, 330px) minmax(0, 1fr);
  }

  .period-picker {
    width: min(650px, calc(100vw - 36px));
  }
}

@media (max-width: 720px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 100vh;
    padding: 116px 24px 40px;
    border: 0;
  }

  .brand--login {
    top: 28px;
    left: 24px;
  }

  .login-note {
    display: none;
  }

  .topbar {
    min-height: 70px;
    padding: 10px 15px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .admin-avatar {
    display: none;
  }

  .filter-strip {
    align-items: stretch;
    padding: 11px 15px;
  }

  .period-presets {
    width: 100%;
  }

  .period-presets button {
    flex: 1;
  }

  .period-picker-shell,
  .period-picker-trigger {
    width: 100%;
  }

  .period-picker-trigger {
    min-width: 0;
  }

  .period-picker {
    position: fixed;
    top: 132px;
    right: 15px;
    left: 15px;
    width: auto;
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
    transform-origin: top center;
  }

  .calendar-months {
    grid-template-columns: 1fr;
  }

  .calendar-month--secondary {
    display: none;
  }

  .filter-field--client {
    min-width: 100%;
  }

  .filter-strip > .button {
    flex: 1;
  }

  .content {
    padding: 20px 15px 42px;
  }

  .view-intro {
    display: grid;
  }

  .view-intro h2 {
    font-size: 21px;
  }

  .data-note {
    width: fit-content;
    white-space: normal;
  }

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

  .metric:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .metric {
    padding: 15px;
  }

  .metric strong {
    font-size: 23px;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination__summary,
  .pagination__page-count {
    min-width: 0;
    flex: 1 1 auto;
  }

  .pagination__actions {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .table-toolbar__filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-control {
    min-width: 0;
    width: 100%;
  }

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

  .chat-layout {
    display: block;
    min-height: 0;
  }

  .chat-list-pane {
    display: grid;
    border-right: 0;
  }

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

  .chat-thread {
    display: none;
  }

  .chat-layout.has-thread .chat-list-pane {
    display: none;
  }

  .chat-layout.has-thread .chat-thread {
    display: grid;
  }

  .chat-messages {
    max-height: none;
    min-height: 50vh;
  }

  .message {
    max-width: 88%;
  }

  .detail-drawer__content {
    padding: 18px 15px;
  }

  .drawer-form-row,
  .drawer-facts {
    grid-template-columns: 1fr;
  }

  .page-error {
    align-items: stretch;
    flex-direction: column;
    margin: 14px 15px 0;
  }

  .app-shell {
    height: 100dvh;
    min-height: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .workspace {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .workspace:has(.page-error:not([hidden])) {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .sidebar {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 5px 8px max(5px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(22, 45, 48, 0.08);
    transform: none;
  }

  .sidebar.is-open {
    box-shadow: 0 -8px 24px rgba(22, 45, 48, 0.08);
    transform: none;
  }

  .sidebar .brand,
  .sidebar-foot,
  #mobile-nav-button {
    display: none;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 3px;
    margin: 0;
  }

  .nav-item {
    position: relative;
    min-height: 52px;
    grid-template-columns: 1fr;
    grid-template-rows: 21px auto;
    place-items: center;
    gap: 2px;
    padding: 5px 2px 4px;
    border-radius: 10px;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .nav-count {
    position: absolute;
    top: 3px;
    left: calc(50% + 7px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 9px;
  }

  .topbar {
    width: 100%;
    min-height: 62px;
    gap: 10px;
    padding: 9px 15px;
  }

  .topbar > div:first-of-type {
    min-width: 0;
  }

  .topbar-context {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    flex: 0 0 auto;
  }

  .filter-strip {
    display: none;
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    padding: 10px 15px;
  }

  .filter-strip.is-mobile-open {
    display: grid;
  }

  .phone-only {
    display: inline-grid;
  }

  .period-presets {
    grid-column: 1 / -1;
  }

  .period-presets button,
  .period-picker-trigger,
  .filter-field--client,
  .filter-strip > .button,
  .filter-strip > .quiet-button {
    min-height: 44px;
  }

  .filter-strip > .button,
  .filter-strip > .quiet-button {
    width: 100%;
    justify-content: center;
    margin: 0;
  }

  .filter-field--client {
    min-width: 0;
    width: 100%;
  }

  .filter-field--client input,
  .search-control,
  .select-control,
  .form-field input,
  .form-field select,
  .form-field textarea,
  .reply-form textarea {
    font-size: 16px;
  }

  .period-picker {
    top: auto;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    max-height: calc(100dvh - 80px - env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 18px 18px 0 0;
    transform-origin: bottom center;
  }

  .period-picker__head {
    min-height: 64px;
    padding: 10px 15px;
  }

  .calendar-months {
    padding: 14px 15px 18px;
  }

  .calendar-day {
    min-height: 42px;
  }

  .period-picker__foot {
    position: sticky;
    bottom: 0;
    min-height: 60px;
    padding: 8px 15px;
  }

  .period-picker__foot .button,
  .period-picker__foot .quiet-button {
    min-height: 44px;
  }

  .content {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    padding: 16px 15px 28px;
  }

  .content:has(> .table-panel),
  .content:has(> .chat-layout) {
    min-width: 0;
    overflow: hidden;
  }

  .view-intro {
    min-width: 0;
    gap: 10px;
    margin-bottom: 14px;
  }

  .view-intro > div,
  .view-intro p {
    min-width: 0;
    max-width: 100%;
  }

  .view-intro p {
    font-size: 13px;
    line-height: 1.45;
  }

  .data-note {
    width: 100%;
    min-height: 42px;
    padding: 8px 11px;
  }

  .metric-ledger,
  .dashboard-grid,
  .breakdown-grid,
  .panel,
  .coverage-callout {
    min-width: 0;
    max-width: 100%;
  }

  .metric {
    min-height: 132px;
  }

  .metric__label {
    min-height: 38px;
    font-size: 11px;
  }

  .metric strong {
    font-size: clamp(21px, 6.2vw, 25px);
  }

  .panel__head {
    min-height: 0;
    flex-wrap: wrap;
    padding: 14px 15px;
  }

  .panel__body {
    padding: 15px;
  }

  .trend-chart {
    min-height: 220px;
  }

  .trend-chart svg {
    height: 220px;
  }

  .action-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 14px 15px;
  }

  .action-item__meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .coverage-callout {
    padding: 14px 15px;
  }

  .table-panel {
    min-width: 0;
  }

  .table-toolbar {
    gap: 9px;
    padding: 11px;
  }

  .select-control,
  .search-control {
    width: 100%;
    min-height: 44px;
  }

  .table-wrap,
  .table-panel:has(.data-table--applications) .table-wrap {
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--cloud);
  }

  .data-table,
  .data-table tbody {
    display: block;
    width: 100%;
  }

  .data-table colgroup,
  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .data-table tbody tr {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .data-table td {
    display: block;
    min-width: 0;
    height: auto;
    padding: 0;
    border: 0;
  }

  .data-table td[data-label]:not([data-label=""])::before {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
  }

  .data-table td.mobile-card-wide,
  .data-table td[colspan] {
    grid-column: 1 / -1;
  }

  .data-table tbody tr:has(td[colspan]) {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .data-table .cell-primary,
  .data-table .cell-secondary {
    max-width: 100%;
  }

  .data-table .row-button,
  .data-table .row-button--table {
    width: 100%;
    max-width: none;
    min-height: 44px;
  }

  .pagination {
    padding: 9px 11px;
  }

  .pagination__button {
    min-width: 42px;
    height: 42px;
  }

  .client-record {
    padding: 15px;
  }

  .client-grid--list .client-record {
    grid-template-columns: 1fr;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .client-grid--list .client-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .client-grid--list .drawer-actions {
    grid-column: auto;
    justify-content: stretch;
  }

  .client-record__head {
    grid-template-columns: minmax(0, 1fr);
  }

  .client-record__head > .status {
    grid-column: 1 / -1;
    width: fit-content;
  }

  .client-record .drawer-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .client-record .row-button {
    min-height: 44px;
  }

  .chat-layout,
  .chat-list-pane,
  .chat-thread {
    width: 100%;
    min-width: 0;
    height: 100%;
  }

  .chat-list-tools {
    gap: 8px;
    padding: 10px;
  }

  .chat-list-item {
    min-height: 66px;
    padding: 12px;
  }

  .chat-thread__head {
    min-height: 74px;
    align-items: flex-start;
    padding: 11px 12px;
  }

  .chat-thread__head .quiet-button {
    min-height: 32px;
    padding-left: 0;
  }

  .chat-messages {
    min-height: 0;
    padding: 13px;
  }

  .reply-form {
    gap: 8px;
    padding: 10px;
  }

  .reply-form .button {
    min-height: 46px;
    padding-inline: 13px;
  }

  .detail-drawer {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .detail-drawer__head {
    min-height: 68px;
    padding: 10px 15px;
  }

  .detail-drawer__head h2 {
    font-size: 17px;
  }

  .drawer-actions .button,
  .drawer-actions .row-button {
    min-height: 44px;
  }
}

@media (max-width: 360px) {
  .topbar h1 {
    font-size: 18px;
  }

  .filter-strip,
  .content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .metric {
    min-height: 126px;
    padding: 13px 12px;
  }

  .metric strong {
    font-size: 20px;
  }

  .data-table tbody {
    padding: 8px;
  }

  .data-table tbody tr {
    gap: 12px 10px;
    padding: 12px;
  }

  .client-record .drawer-actions,
  .reply-form {
    grid-template-columns: 1fr;
  }

  .nav-item {
    font-size: 9px;
  }
}

@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;
  }
}
