:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --text: #18201c;
  --muted: #65716b;
  --line: #dce4de;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 14px 40px rgba(24, 32, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px;
  background: #17211d;
  color: #f7faf8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: #d7f2e9;
  color: #0f3f39;
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b7c7bf;
  font-size: 12px;
  margin-top: 2px;
}

.mobile-menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  width: 42px;
  height: 42px;
  margin-left: auto;
  padding: 0;
  border: 1px solid #344b43;
  border-radius: 7px;
  background: #22312c;
}

.mobile-menu-button span {
  width: 18px;
  height: 2px;
  margin: 0;
  border-radius: 2px;
  background: #ffffff;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #dce7e2;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #22312c;
  border-color: #344b43;
  color: #ffffff;
}

.connection-box {
  margin-top: auto;
  display: grid;
  gap: 8px;
  color: #b7c7bf;
}

.connection-box input {
  width: 100%;
  border: 1px solid #344b43;
  border-radius: 7px;
  padding: 10px;
  background: #101713;
  color: #ffffff;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

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

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
  margin-bottom: 14px;
}

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

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

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.icon-button,
.secondary-button,
.primary-button {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
}

.link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.button-row,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-actions {
  flex-wrap: nowrap;
  white-space: nowrap;
}

.table-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 0 8px;
}

.table-actions button:hover {
  border-color: var(--accent);
}

.access-help {
  max-width: 760px;
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#usersTable .table-actions .secondary-button,
#invitationsTable .table-actions .secondary-button {
  min-height: 32px;
  padding: 0 11px;
  font-weight: 700;
}

#reminderLogsTable .retry-button {
  min-width: 94px;
  min-height: 32px;
  border-color: #b9d4cc;
  background: #f4faf8;
  color: #075f58;
  font-weight: 700;
}

#reminderLogsTable .retry-button:hover {
  border-color: var(--accent);
  background: #e8f5f1;
}

.table-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}

.check-row {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

.checkbox-list {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.checkbox-list .check-row {
  min-height: 28px;
}

.muted-list {
  color: var(--muted);
  line-height: 1.45;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 18px;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.text-button {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  text-align: left;
  font-weight: 700;
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 130px);
}

.login-form {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.content-panel {
  display: block;
}

.hidden {
  display: none !important;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card {
  padding: 16px;
  min-height: 98px;
  border-top: 3px solid var(--accent);
}

.metric-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-card > strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
}

.plan-metric-card {
  position: relative;
  cursor: help;
  outline: none;
}

.plan-metric-card:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}

.plan-metric-card .plan-info-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
}

.plan-summary-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 9px);
  right: 0;
  display: grid;
  width: min(380px, calc(100vw - 32px));
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 34px rgb(20 48 43 / 16%);
  color: var(--text);
  cursor: default;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.plan-summary-popover::before {
  position: absolute;
  top: -6px;
  right: 18px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
  content: "";
  transform: rotate(45deg);
}

.plan-metric-card:hover .plan-summary-popover,
.plan-metric-card:focus .plan-summary-popover,
.plan-metric-card:focus-within .plan-summary-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.plan-summary-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.plan-summary-heading div > span,
.plan-summary-title {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.plan-summary-heading div > strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
}

.plan-limit-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.plan-limit-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.plan-limit-list dt,
.plan-limit-list dd {
  margin: 0;
  font-size: 13px;
}

.plan-limit-list dd {
  font-weight: 800;
}

.plan-capability-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-capability-list li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.35;
}

.plan-capability-list li > span {
  flex: 0 0 auto;
  min-width: 26px;
  padding: 2px 5px;
  border: 1px solid #b9ded7;
  border-radius: 999px;
  background: #edf8f5;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.plan-capability-list li > strong {
  min-width: 0;
  font-weight: 700;
}

.plan-capability-list .is-disabled {
  color: var(--muted);
}

.plan-capability-list .is-disabled > span {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.plan-expiry {
  margin: 0;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.subscription-usage {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.usage-heading,
.usage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.usage-heading h3 {
  margin: 3px 0 0;
}

.usage-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2eae5;
}

.usage-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.usage-footer {
  color: var(--muted);
  font-size: 12px;
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.report-filter-grid .primary-button {
  min-width: 148px;
}

.report-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(125px, 1fr));
  gap: 12px;
}

.report-locked {
  display: grid;
  gap: 8px;
  max-width: 680px;
  padding: 22px;
  background: #fff8e8;
  border-color: #ead3a4;
}

.report-locked h3 {
  margin: 0;
}

.report-locked p:last-child {
  color: var(--muted);
}

#reportsContent {
  display: grid;
  gap: 16px;
}

.report-chart-panel {
  min-width: 0;
}

.report-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.report-panel-heading h3 {
  margin: 4px 0 0;
}

.report-chart {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-height: 230px;
  overflow-x: auto;
  padding: 12px 4px 0;
  border-bottom: 1px solid var(--line);
}

.report-bar-item {
  display: grid;
  grid-template-rows: 20px 160px 28px;
  align-items: end;
  justify-items: center;
  flex: 1 0 30px;
  min-width: 30px;
}

.report-bar-item strong {
  align-self: center;
  font-size: 11px;
}

.report-bar-item i {
  width: min(24px, 70%);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
}

.report-bar-item span {
  align-self: start;
  padding-top: 7px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

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

.report-ranking-row {
  display: grid;
  gap: 7px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.report-ranking-row > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.report-ranking-row > div span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.report-ranking-row > i {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-2);
}

.report-ranking-row > i span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

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

.two-columns,
.split-layout {
  display: grid;
  gap: 16px;
}

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

.split-layout {
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  align-items: start;
}

.schedule-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.customers-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.customer-detail-panel {
  position: static;
}

.customer-filter-grid {
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) minmax(150px, 180px);
}

.customer-filter-grid .filter-search {
  grid-column: span 1;
}

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

.customer-kpis div {
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.customer-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.customer-kpis strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.detail-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.notice {
  padding: 10px 12px;
  border-radius: 7px;
  line-height: 1.4;
}

.notice.warning {
  border: 1px solid #f1d7a6;
  background: #fff7e8;
  color: var(--warn);
}

.provider-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.provider-configuration-panel {
  display: grid;
  gap: 24px;
  margin-bottom: 20px;
  border-top: 4px solid var(--accent);
}

.provider-configuration-heading,
.provider-form-title,
.provider-form-title > div,
.provider-options {
  display: flex;
  align-items: center;
}

.provider-configuration-heading,
.provider-form-title {
  justify-content: space-between;
  gap: 18px;
}

.provider-configuration-heading h3,
.provider-form-title strong {
  margin: 0;
}

.provider-configuration-heading > div {
  display: grid;
  gap: 4px;
}

.muted-copy,
.provider-form-title small {
  display: block;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.provider-scope {
  width: min(320px, 100%);
}

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

.provider-form {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.provider-form-title > div {
  gap: 10px;
}

.provider-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

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

.provider-field-wide {
  grid-column: 1 / -1;
}

.provider-options {
  flex-wrap: wrap;
  gap: 16px;
}

.provider-form .button-row {
  align-self: end;
  min-height: 38px;
  margin-top: auto;
}

.provider-form .button-row button {
  width: auto;
  min-height: 38px;
  height: 38px;
  padding: 7px 12px;
  white-space: nowrap;
  line-height: 1;
}

.provider-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid #66736d;
  border-radius: 8px;
  background: var(--surface);
}

.provider-status.configured {
  border-left-color: var(--primary);
}

.provider-status.pending {
  border-left-color: #b45309;
}

.provider-status span,
.provider-status p {
  color: var(--muted);
}

.invite-result {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--background);
}

.auth-card {
  width: min(100%, 460px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card .brand {
  margin-bottom: 24px;
}

.muted-copy {
  color: var(--muted);
  margin-top: -8px;
}

.profile-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.profile-list div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.profile-list dt {
  color: var(--muted);
}

.profile-list dd {
  margin: 0;
  font-weight: 700;
}

.table-secondary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.provider-status strong,
.provider-status p {
  display: block;
}

.provider-status p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 14px;
}

.settings-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.settings-section h3 {
  margin-bottom: 0;
}

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

.compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.filter-panel {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #cfe1da;
  border-radius: 8px;
  background: #eef6f3;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-header h3 {
  margin-bottom: 0;
}

.agenda-toolbar {
  display: grid;
  grid-template-columns: auto minmax(360px, 1fr) minmax(190px, 240px);
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.agenda-toolbar > * {
  min-width: 0;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.segmented-control button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(24, 32, 28, 0.12);
}

.agenda-navigation {
  display: grid;
  grid-template-columns: 36px auto 36px minmax(150px, 190px);
  justify-content: center;
  gap: 8px;
}

.agenda-employee-filter select {
  min-width: 0;
}

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

.agenda-heading > div {
  display: grid;
  gap: 3px;
}

.agenda-heading strong {
  font-size: 18px;
  text-transform: capitalize;
}

.agenda-heading span:not(.status-pill) {
  color: var(--muted);
}

.day-agenda {
  min-width: 0;
  overflow: hidden;
}

.day-agenda-header,
.day-agenda-body {
  display: grid;
  grid-template-columns: 72px repeat(var(--employee-count), minmax(180px, 1fr));
  min-width: calc(72px + var(--employee-count) * 180px);
}

.day-agenda-header {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.day-agenda-header > div {
  padding: 12px;
  border-left: 1px solid var(--line);
  font-weight: 700;
  text-align: center;
}

.day-agenda-header .time-column-heading {
  border-left: 0;
  color: var(--muted);
}

.day-agenda-scroll {
  max-height: 620px;
  overflow: auto;
}

.day-agenda-body {
  height: var(--timeline-height);
}

.time-axis,
.employee-day-column {
  position: relative;
  height: var(--timeline-height);
}

.time-axis span {
  position: absolute;
  right: 10px;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
}

.time-axis span:first-child {
  transform: translateY(0);
}

.employee-day-column {
  border-left: 1px solid var(--line);
  background: #ffffff;
}

.employee-day-column > i {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px solid var(--line);
}

.agenda-appointment {
  position: absolute;
  right: 5px;
  left: 5px;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: 2px;
  overflow: hidden;
  padding: 7px 8px;
  border: 1px solid #9acdc6;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #e6f5f2;
  color: var(--text);
  text-align: left;
}

.agenda-appointment strong,
.week-appointment strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-appointment span,
.agenda-appointment small,
.week-appointment span,
.week-appointment small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-appointment.compact {
  align-content: center;
  padding-top: 4px;
  padding-bottom: 4px;
}

.agenda-appointment.compact span {
  display: none;
}

.agenda-appointment.compact small {
  display: none;
}

.agenda-appointment small,
.week-appointment small + small {
  color: var(--warn);
  font-size: 11px;
  font-weight: 800;
}

.agenda-appointment.status-pending_confirmation,
.week-appointment.status-pending_confirmation {
  border-left-color: var(--warn);
  background: #fff9ed;
}

.agenda-appointment.deposit-pending,
.week-appointment.deposit-pending {
  border-color: #d99a00;
  border-left-color: #d99a00;
  background: #ffef9a;
}

.agenda-appointment.deposit-pending small,
.week-appointment.deposit-pending small + small {
  color: #8a5a00;
}

.agenda-appointment.deposit-received,
.week-appointment.deposit-received,
.agenda-appointment.status-confirmed,
.week-appointment.status-confirmed {
  border-color: #9acdc6;
  border-left-color: var(--accent);
  background: #e6f5f2;
}

.agenda-appointment.deposit-pending,
.week-appointment.deposit-pending {
  border-color: #d99a00;
  border-left-color: #d99a00;
  background: #ffef9a;
}

.agenda-appointment.status-cancelled,
.week-appointment.status-cancelled {
  border-left-color: var(--danger);
  background: #fff0ef;
}

.agenda-appointment.status-completed,
.week-appointment.status-completed {
  border-left-color: #4b5563;
  background: #f1f3f2;
}

.agenda-appointment.status-no_show,
.week-appointment.status-no_show {
  border-left-color: var(--warn);
  background: #fff7e8;
}

.week-agenda {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 1px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  width: 100%;
  min-width: 0;
}

#agendaCalendar {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.week-day {
  min-height: 420px;
  background: var(--surface);
}

.week-day header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-transform: capitalize;
}

.week-day header strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--text);
}

.week-day.today header strong {
  background: var(--accent);
  color: #ffffff;
}

.week-day-content {
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 8px;
}

.week-appointment {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #eef8f6;
  color: var(--text);
  text-align: left;
}

.week-empty {
  padding: 12px 4px;
  color: var(--muted);
  font-size: 12px;
}

.appointment-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(420px, 100%);
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 45px rgba(24, 32, 28, 0.16);
}

.appointment-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.appointment-detail-header h3 {
  margin-top: 5px;
  font-size: 22px;
}

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

.appointment-detail-list > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.appointment-detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.appointment-detail-list dd {
  margin: 0;
}

.appointment-status-audit {
  margin-top: 16px;
  padding: 14px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface-soft);
}

.appointment-status-audit > p {
  margin: 0 0 8px;
}

.appointment-status-audit dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.appointment-status-audit dl > div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
}

.appointment-status-audit dt {
  color: var(--muted);
  font-weight: 700;
}

.appointment-status-audit dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.appointment-audit-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.appointment-audit-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.appointment-audit-heading h4 {
  margin: 3px 0 0;
  font-size: 16px;
}

.appointment-audit-timeline {
  display: grid;
}

.appointment-audit-event {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding-bottom: 16px;
}

.appointment-audit-event:not(:last-child)::before {
  position: absolute;
  top: 9px;
  bottom: -1px;
  left: 5px;
  width: 1px;
  background: var(--line);
  content: "";
}

.appointment-audit-event > i {
  position: relative;
  z-index: 1;
  width: 11px;
  height: 11px;
  margin-top: 4px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.appointment-audit-event strong,
.appointment-audit-event small,
.appointment-audit-event span {
  display: block;
}

.appointment-audit-event small,
.appointment-audit-event span {
  margin-top: 3px;
  color: var(--muted);
}

.appointment-audit-event p {
  margin: 7px 0 0;
  padding: 7px 9px;
  border-radius: 5px;
  background: var(--surface-soft);
}

.appointment-notification-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.appointment-notification-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.appointment-notification-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: #9b2c24;
  font-size: 12px;
}

.appointment-manual-reminders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.appointment-manual-reminders button {
  min-height: 36px;
}

.appointment-detail-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.appointment-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.appointment-detail-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(4, minmax(132px, 1fr));
  gap: 12px;
  align-items: end;
}

.filter-search {
  grid-column: span 2;
}

.filter-actions {
  display: flex;
  align-items: center;
  min-height: 38px;
}

.filter-actions .secondary-button {
  width: 100%;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
}

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

.admin-table-wrap {
  padding: 4px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  min-width: 640px;
}

#usersTable table {
  min-width: 0;
}

#servicesTable table,
#usersTable table,
#remindersTable table {
  min-width: 560px;
}

#employeesTable table {
  min-width: 600px;
}

#employeesTable .identity-cell {
  min-width: 140px;
}

#employeesTable .table-actions {
  flex-direction: column;
  align-items: stretch;
}

@media (min-width: 981px) {
  #servicesTable table,
  #remindersTable table,
  #businessHoursTable table,
  #employeesTable table {
    table-layout: fixed;
    min-width: 0;
  }

  #employeesTable th:nth-child(1) { width: 27%; }
  #employeesTable th:nth-child(2) { width: 20%; }
  #employeesTable th:nth-child(3) { width: 25%; }
  #employeesTable th:nth-child(4) { width: 12%; }
  #employeesTable th:nth-child(5) { width: 16%; }

  #servicesTable th:nth-child(1) { width: 32%; }
  #servicesTable th:nth-child(2) { width: 14%; }
  #servicesTable th:nth-child(3) { width: 16%; }
  #servicesTable th:nth-child(4) { width: 14%; }
  #servicesTable th:nth-child(5) { width: 24%; }

  #remindersTable th:nth-child(1) { width: 15%; }
  #remindersTable th:nth-child(2) { width: 19%; }
  #remindersTable th:nth-child(3) { width: 32%; }
  #remindersTable th:nth-child(4) { width: 14%; }
  #remindersTable th:nth-child(5) { width: 20%; }

  #businessHoursTable th:nth-child(1) { width: 20%; }
  #businessHoursTable th:nth-child(2) { width: 17%; }
  #businessHoursTable th:nth-child(3) { width: 23%; }
  #businessHoursTable th:nth-child(4) { width: 16%; }
  #businessHoursTable th:nth-child(5) { width: 24%; }

  #remindersTable .table-actions,
  #businessHoursTable .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

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

tbody td {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

tbody td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
}

tbody td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
}

tbody tr:hover td {
  border-color: #bad5cc;
  background: #f7fbf9;
}

.identity-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}

.identity-avatar {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #dceee8;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.identity-cell small,
.primary-table-cell small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.primary-table-cell {
  min-width: 180px;
}

.deposit-cell.pending small {
  color: var(--warn);
  font-weight: 800;
}

.deposit-cell.received small {
  color: var(--accent);
  font-weight: 800;
}

.compact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 150px;
}

.compact-tags span,
.value-chip,
.channel-chip,
.day-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eaf3ef;
  color: #28483d;
  font-size: 12px;
  font-weight: 700;
}

.channel-chip.whatsapp {
  background: #e3f5e9;
  color: #176b39;
}

.channel-chip.both {
  background: #eef0f7;
  color: #44506b;
}

.money-value {
  white-space: nowrap;
}

.table-muted,
.table-contact {
  color: var(--muted);
  white-space: nowrap;
}

.template-preview {
  display: block;
  max-width: 360px;
  overflow: hidden;
  color: #3e514a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-range {
  display: inline-grid;
  grid-template-columns: auto 28px auto;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.schedule-range i {
  height: 1px;
  background: var(--line);
}

.metric-list {
  display: grid;
  gap: 8px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.metric-row i {
  grid-column: 1 / -1;
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-2);
}

.metric-row i span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.table-panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.table-panel-heading h3 {
  margin: 3px 0 0;
}

.compact-search {
  width: min(360px, 100%);
}

#reminderLogsTable table,
#businessHoursTable table {
  min-width: 760px;
}

@media (min-width: 981px) {
  #businessHoursTable table {
    table-layout: fixed;
    min-width: 0;
  }
}

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

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
}

.marketing-subnav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf7f3;
}

.marketing-subnav-button {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.marketing-subnav-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.marketing-subnav-button.active {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: inset 0 3px 0 var(--primary);
}

.marketing-subnav-button strong {
  font-size: 14px;
}

.marketing-subnav-button span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.marketing-section-panel {
  display: grid;
  gap: 14px;
}

.marketing-module-grid,
.marketing-segment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.marketing-module,
.marketing-segment-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.marketing-module > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.marketing-module-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #d7f2e9;
  color: var(--accent-strong);
  font-weight: 800;
}

.marketing-module h3 {
  margin: 14px 0 6px;
}

.marketing-module p,
.marketing-segment-card small {
  color: var(--muted);
  line-height: 1.45;
}

.marketing-module.disabled {
  opacity: 0.65;
  background: var(--surface-2);
}

.marketing-dashboard {
  display: grid;
  gap: 16px;
  margin: 14px 0 18px;
  border-top: 4px solid var(--primary);
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf9 100%);
}

.marketing-dashboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.marketing-dashboard-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.marketing-dashboard-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.marketing-dashboard-controls select {
  min-height: 36px;
  padding: 6px 30px 6px 10px;
}

.marketing-dashboard-heading h3,
.marketing-dashboard-empty h3,
.marketing-insights h4 {
  margin: 0;
}

.marketing-dashboard-empty {
  display: grid;
  gap: 8px;
}

.marketing-dashboard-empty p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.marketing-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.marketing-kpi {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.marketing-kpi span,
.marketing-rate-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.marketing-kpi strong {
  font-size: 24px;
}

.marketing-kpi small {
  color: var(--muted);
  line-height: 1.35;
}

.marketing-rate-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.marketing-rate-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #c6ded6;
  border-radius: 8px;
  background: #edf7f3;
}

.marketing-rate-grid strong {
  white-space: nowrap;
}

.marketing-insights {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e4d7a8;
  border-radius: 8px;
  background: #fff9e8;
}

.marketing-insights ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.marketing-insights p {
  margin: 0;
  color: var(--muted);
}

.marketing-campaign-comparison {
  display: grid;
  gap: 10px;
}

.marketing-campaign-comparison h4 {
  margin: 0;
}

.marketing-campaign-ranking {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.marketing-campaign-ranking article {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.marketing-campaign-ranking article > span {
  color: var(--muted);
  font-size: 12px;
}

.marketing-campaign-ranking dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 0;
}

.marketing-campaign-ranking div {
  display: grid;
  gap: 2px;
}

.marketing-campaign-ranking dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.marketing-campaign-ranking dd {
  margin: 0;
  font-weight: 800;
}

.marketing-segment-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.marketing-segment-card {
  display: grid;
  gap: 5px;
  color: var(--text);
  text-align: left;
}

.marketing-segment-card:hover {
  border-color: var(--accent);
  background: #f4faf8;
}

.marketing-segment-card strong {
  font-size: 28px;
}

.marketing-segment-card span {
  font-weight: 800;
}

.marketing-customer-results {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.campaign-preview { display:grid; gap:5px; padding:14px; border:1px solid #b9d4cc; border-radius:8px; background:#f4faf8; }
.campaign-preview span,.campaign-preview small { color:var(--muted); }
.message-preview { margin-top:8px; padding:14px; border-left:4px solid var(--primary); background:#fff; }
.message-preview p { margin:8px 0 0; line-height:1.55; }
.consent-options { display:grid; gap:8px; margin:0; padding:14px; border:1px solid var(--border); border-radius:8px; background:#f7faf9; }
.consent-options legend { padding:0 6px; font-weight:700; }
.consent-options small { color:var(--muted); line-height:1.4; }
.loyalty-layout { align-items:start; }
.loyalty-summary-panel { display:grid; gap:16px; }
.loyalty-metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.loyalty-ready { border-color:#8fc8b5; background:#e5f5ef; color:#075f4e; }
.positive-points { color:#08745f; }
.negative-points { color:#a53a32; }
.compact-search { width:min(320px,100%); }

.compact-marketing-settings {
  padding: 14px;
}

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

.automation-rule-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
}

.automation-rule-title,
.automation-rule-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.automation-rule-title h4 {
  margin: 0;
}

.automation-rule-footer span {
  color: var(--muted);
  font-size: 13px;
}

.automation-run-heading {
  margin-top: 18px;
}

.marketing-metric-grid {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  margin-bottom: 16px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #17211d;
  color: #ffffff;
  box-shadow: var(--shadow);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.toast.error {
  background: var(--danger);
}

@media (max-width: 1280px) {
  .marketing-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .customers-layout {
    grid-template-columns: 1fr;
  }

  .customer-detail-panel {
    position: static;
  }

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

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(16, 23, 19, 0.16);
  }

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

  .nav-list {
    display: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding-top: 4px;
  }

  .sidebar.menu-open .nav-list {
    display: grid;
    position: absolute;
    top: 70px;
    right: 12px;
    left: 12px;
    z-index: 6;
    padding: 10px;
    border: 1px solid #344b43;
    border-radius: 8px;
    background: #17211d;
    box-shadow: 0 16px 36px rgba(16, 23, 19, 0.3);
  }

  .connection-box {
    display: none;
  }

  .metric-grid,
  .two-columns,
  .split-layout,
  .schedule-grid,
  .customers-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .provider-forms-grid {
    grid-template-columns: 1fr;
  }

  .marketing-module-grid,
  .marketing-segment-grid,
  .marketing-subnav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .marketing-kpi-grid,
  .marketing-rate-grid,
  .marketing-campaign-ranking,
  .automation-rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .customer-detail-panel {
    position: static;
  }

  .report-breakdowns {
    grid-template-columns: 1fr;
  }

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

  .filter-search {
    grid-column: span 2;
  }

  .agenda-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .agenda-navigation {
    justify-content: start;
  }

  .agenda-employee-filter {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .marketing-subnav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-snap-type: x proximity;
  }

  .marketing-subnav-button {
    flex: 0 0 170px;
    scroll-snap-align: start;
  }

  .marketing-dashboard-heading {
    display: grid;
  }

  .marketing-dashboard-controls {
    justify-content: stretch;
  }

  .marketing-dashboard-controls label,
  .marketing-dashboard-controls select {
    width: 100%;
  }

  .marketing-kpi-grid,
  .marketing-rate-grid,
  .marketing-campaign-ranking,
  .automation-rule-grid {
    grid-template-columns: 1fr;
  }

  .automation-rule-title,
  .automation-rule-footer {
    display: grid;
  }

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

  .filter-search {
    grid-column: span 1;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-actions .status-pill {
    margin-right: auto;
  }

  .topbar-actions .secondary-button,
  .topbar-actions .link-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .usage-heading,
  .usage-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .provider-configuration-heading,
  .provider-form-title {
    align-items: stretch;
    flex-direction: column;
  }

  .provider-fields-grid {
    grid-template-columns: 1fr;
  }

  .provider-field-wide {
    grid-column: auto;
  }

  .nav-list {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 82px);
    overflow-y: auto;
  }

  .nav-item {
    min-height: 44px;
  }

  .login-panel {
    min-height: calc(100vh - 190px);
  }

  .login-form {
    padding: 20px;
  }

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

  .marketing-module-grid,
  .marketing-segment-grid {
    grid-template-columns: 1fr;
  }

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

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

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

  .report-panel-heading,
  .report-ranking-row > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-ranking-row > div span {
    text-align: left;
  }

  .agenda-toolbar {
    grid-template-columns: 1fr;
  }

  .agenda-navigation {
    grid-template-columns: 36px 1fr 36px;
  }

  .agenda-navigation input {
    grid-column: 1 / -1;
  }

  .agenda-employee-filter {
    grid-column: auto;
  }

  .agenda-heading {
    align-items: flex-start;
  }

  .agenda-heading strong {
    font-size: 16px;
  }

  .appointment-detail-panel {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    padding: 18px;
    border-left: 0;
  }

  .appointment-detail-list > div {
    grid-template-columns: minmax(86px, 34%) 1fr;
  }

  .segmented-control {
    display: grid;
    width: 100%;
  }

  .table-wrap,
  .admin-table-wrap {
    overflow: visible;
    padding: 0;
  }

  .table-wrap table {
    min-width: 0 !important;
    border-spacing: 0;
  }

  .table-wrap thead {
    display: none;
  }

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

  .table-wrap tr {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-width: 0;
    padding: 11px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    overflow-wrap: anywhere;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
  }

  .table-wrap .table-actions {
    flex-wrap: wrap;
    white-space: normal;
  }

  .table-wrap .table-actions button {
    min-height: 36px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }
}
