:root {
  --bg: #ffffff;
  --panel: rgba(216, 123, 115, 0.16);
  --panel-strong: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: rgba(187, 51, 6, 0.24);
  --accent: #bb3306;
  --accent-dark: #bb3306;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --success: #027a48;
  --success-bg: #ecfdf3;
  --warning-bg: #fff7e8;
  --shadow: 0 18px 40px rgba(48, 37, 23, 0.12);
  --radius: 22px;
  --page-width: 1480px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell {
  min-height: 100vh;
  background: var(--bg);
}

a {
  color: inherit;
}

.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

.auth-login-stack {
  width: min(480px, 100%);
  display: grid;
  gap: 22px;
  justify-items: center;
  transform: translateY(-100px);
}

.auth-panel,
.card {
  border: 1px solid rgba(187, 51, 6, 0.1);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.lede {
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: #8f2b0a;
  font-weight: 700;
}

.brand-logo {
  width: min(300px, 100%);
  height: auto;
  display: block;
}

.brand-logo-login {
  margin: 0 auto;
}

.note-card span,
.template-item p,
.signed-in-as span,
td span,
.audit-item span,
.empty-state {
  color: var(--muted);
}

.auth-panel {
  width: min(480px, 100%);
  margin: auto;
  padding: 36px;
}

.panel-header h2,
.card-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.card-subtext {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.app-frame {
  width: min(var(--page-width), calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 16px 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.app-sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: calc(100vh - 48px);
}

.app-sidebar-brand {
  display: block;
  text-decoration: none;
  margin-bottom: 72px;
}

.app-sidebar-logo {
  width: 300px;
  max-width: 100%;
  height: auto;
  display: block;
}

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

.app-sidebar-group {
  display: grid;
  gap: 16px;
}

.app-sidebar-link {
  color: #1f2933;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
}

.app-sidebar-link-active {
  color: #bb3306;
}

.app-sidebar-subnav {
  display: grid;
  gap: 14px;
  padding-left: 16px;
}

.app-sidebar-sublink {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.app-sidebar-sublink-active {
  color: #bb3306;
}

.app-sidebar-account {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  margin-top: auto;
}

.app-sidebar-account span {
  color: var(--muted);
  font-size: 0.9rem;
}

.app-sidebar-account strong {
  font-size: 0.98rem;
}

.app-sidebar-role {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.app-sidebar-logout {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.app-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 200px;
  min-height: calc(100vh - 24px);
}

.dashboard {
  width: 100%;
  flex: 1 0 auto;
  padding: 0 0 40px;
  display: grid;
  gap: 24px;
}

.mobile-topbar {
  display: none;
}

.mobile-menu {
  display: none;
  position: relative;
}

.signed-in-as {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.signed-in-as span {
  font-size: 0.86rem;
}

.signed-in-as strong {
  font-size: 0.98rem;
}

.nav-link {
  padding: 4px 0;
  color: #1f2933;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  border-bottom: 2px solid transparent;
}

.nav-link-active {
  color: #bb3306;
  border-bottom-color: #bb3306;
}

.nav-sub-link {
  color: #1f2933;
  text-decoration: none;
  font-weight: 500;
  padding: 2px 0;
}

.nav-sub-link-active {
  color: #bb3306;
}

.mobile-menu-toggle {
  list-style: none;
  width: 54px;
  height: 54px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: box-shadow 180ms ease;
}

.mobile-menu-toggle:hover {
  box-shadow: 0 0 0 1px rgba(187, 51, 6, 0.08), 0 0 14px rgba(187, 51, 6, 0.16);
}

.mobile-menu-toggle::-webkit-details-marker {
  display: none;
}

.mobile-menu-toggle span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
}

.mobile-menu-panel {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(320px, calc(100vw - 36px));
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  display: grid;
  gap: 14px;
  z-index: 10;
}

.mobile-signed-in-as {
  justify-items: start;
}

.mobile-nav {
  display: grid;
  gap: 0;
}

.mobile-nav .nav-link {
  width: 100%;
  padding: 14px 0;
  border-bottom: 1px solid rgba(187, 51, 6, 0.12);
}

.mobile-nav-group {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(187, 51, 6, 0.12);
}

.mobile-nav-group .nav-link {
  border-bottom: none;
  padding: 0;
}

.mobile-nav-submenu {
  display: grid;
  gap: 10px;
  padding-left: 16px;
}

.header-link-button {
  appearance: none;
  border: none;
  background: transparent;
  color: #1f2933;
  font: inherit;
  font-weight: 700;
  padding: 4px 0;
  cursor: pointer;
}

.signed-out-link {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.mobile-logout-button {
  width: 100%;
  text-align: left;
  padding: 14px 0 0;
}

.two-column {
  display: grid;
  gap: 24px;
}

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

.card {
  padding: 24px;
}

.message-center-shell {
  padding: 0;
}

.single-column-card {
  max-width: 760px;
}

.settings-bottom-grid .single-column-card,
.settings-bottom-grid .narrow-form {
  max-width: none;
}

.narrow-form {
  max-width: 520px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.field span {
  font-size: 0.92rem;
}

.field-help {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 400;
  line-height: 1.5;
}

.helper-text {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.multi-select {
  min-height: 190px;
  padding-top: 10px;
  padding-bottom: 10px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(187, 51, 6, 0.18);
  border-color: var(--accent);
}

.primary-button,
.secondary-button,
.danger-button,
.link-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  background: #ffffff;
  color: #bb3306;
  border: 1px solid rgba(187, 51, 6, 0.18);
}

.primary-button:hover {
  background: #fff6f3;
}

.secondary-button,
.link-button {
  background: rgba(255, 255, 255, 0.9);
  color: #bb3306;
  border: 1px solid var(--line);
}

.compact-button {
  padding: 8px 13px;
  font-size: 0.94rem;
}

.danger-button {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.18);
}

.form-actions,
.template-item-actions,
.token-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.text-link {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.token-row code {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(187, 51, 6, 0.08);
  color: #8f2b0a;
  font-size: 0.86rem;
}

.template-token-chip {
  appearance: none;
  border: 1px solid rgba(187, 51, 6, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 248, 245, 0.88);
  color: #8f2b0a;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.template-default-grid,
.template-workspace-grid {
  display: grid;
  gap: 20px;
}

.message-library-grid {
  display: grid;
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.template-default-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
}

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

.template-catalog-panel,
.template-editor-card,
.template-preview-card {
  border: 1px solid rgba(187, 51, 6, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  padding: 18px;
}

.template-catalog-panel {
  display: grid;
  gap: 16px;
}

.assignment-panel {
  gap: 18px;
}

.message-library-grid > .template-catalog-panel {
  height: 100%;
}

.template-catalog-list {
  display: grid;
  gap: 10px;
  max-height: 860px;
  overflow: auto;
  padding-right: 4px;
}

.template-library-list {
  flex: 1;
  min-height: 100%;
  max-height: none;
}

.template-catalog-item {
  appearance: none;
  width: 100%;
  text-align: left;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(187, 51, 6, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.template-catalog-item strong {
  display: block;
  margin: 0;
  font-size: 1rem;
}

.template-catalog-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

.template-catalog-item-active {
  border-color: rgba(187, 51, 6, 0.3);
  background: rgba(255, 248, 245, 0.92);
  box-shadow: 0 10px 22px rgba(48, 37, 23, 0.06);
}

.template-catalog-topline {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.template-catalog-badges,
.template-rule-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.template-editor-shell {
  display: grid;
  gap: 18px;
}

.assignment-list {
  display: grid;
  gap: 12px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid rgba(187, 51, 6, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
}

.assignment-row-copy {
  display: grid;
  gap: 8px;
}

.assignment-row-topline {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.assignment-row-copy p {
  margin: 0;
  color: var(--muted);
}

.assignment-row-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.assignment-row-controls select {
  min-width: 170px;
}

.template-editor-card {
  display: grid;
  gap: 16px;
}

.template-editor-header,
.template-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

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

.template-preview-card {
  display: grid;
  gap: 16px;
}

.template-token-row {
  gap: 8px;
}

.flash {
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 600;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success);
}

.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.template-list,
.audit-list,
.message-event-list,
.scheduled-message-list,
.sent-message-list {
  display: grid;
  gap: 14px;
}

.template-item,
.audit-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(187, 51, 6, 0.12);
}

.status-pill {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(187, 51, 6, 0.08);
  color: #8f2b0a;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill-ready {
  background: var(--success-bg);
  color: var(--success);
}

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

.status-pill-warning,
.status-pill-running {
  background: var(--warning-bg);
  color: #b54708;
}

.status-pill-error,
.status-pill-failed,
.status-pill-undelivered,
.status-pill-reschedule,
.status-pill-opt_out {
  background: var(--danger-bg);
  color: var(--danger);
}

.template-item strong,
td strong {
  display: block;
  margin-bottom: 4px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 14px 12px;
  border-top: 1px solid rgba(187, 51, 6, 0.12);
}

th {
  color: #8f2b0a;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message-preview {
  min-width: 320px;
  line-height: 1.6;
}

.message-event {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(187, 51, 6, 0.12);
  background: rgba(255, 255, 255, 0.74);
}

.message-event-inbound {
  border-color: rgba(2, 122, 72, 0.18);
  background: rgba(236, 253, 243, 0.92);
}

.message-event-confirmed {
  border-color: rgba(2, 122, 72, 0.24);
  background: rgba(236, 253, 243, 0.96);
}

.message-event-reschedule {
  border-color: rgba(180, 35, 24, 0.42);
  background: #fbd3cf;
}

.message-event-meta {
  display: grid;
  gap: 4px;
  padding-right: 70px;
}

.message-event-meta > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.message-event-body {
  display: grid;
  gap: 10px;
}

.message-note-form {
  display: grid;
  gap: 10px;
}

.message-event-body p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
}

.message-event-foot {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.scheduled-message-card {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 24px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(187, 51, 6, 0.12);
  background: rgba(255, 255, 255, 0.82);
}

.sent-message-card {
  align-items: start;
  grid-template-columns: minmax(320px, 480px) minmax(280px, 0.9fr);
}

.scheduled-message-meta {
  display: grid;
  gap: 4px;
}

.sent-message-meta {
  gap: 18px;
}

.sent-message-field {
  display: grid;
  gap: 3px;
}

.sent-message-label,
.sent-message-label-inline {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sent-message-label-inline {
  margin-right: 6px;
}

.sent-message-topline {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.sent-message-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.status-pill-subtle,
.status-pill-office {
  background: rgba(31, 41, 51, 0.06);
  color: var(--muted);
}

.sent-message-patient {
  display: grid;
  gap: 6px;
  align-items: start;
  margin-top: 10px;
}

.sent-message-patient-row {
  display: flex;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
}

.sent-message-patient-divider {
  color: var(--muted);
}

.sent-message-patient strong {
  font-size: 1.3rem;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.sent-message-patient span {
  color: var(--muted);
  font-size: 1.02rem;
}

.sent-message-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sent-message-detail-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(187, 51, 6, 0.1);
  background: rgba(255, 248, 245, 0.72);
}

.sent-message-detail-value {
  font-size: 1rem;
  line-height: 1.45;
}

.sent-message-detail-strong {
  font-weight: 700;
  white-space: nowrap;
}

.scheduled-message-meta > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scheduled-message-body p {
  margin: 0;
  line-height: 1.65;
}

.scheduled-message-bubble {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 18px 18px 18px 20px;
  border-radius: 22px 22px 22px 10px;
  border: 1px solid rgba(187, 51, 6, 0.12);
  background: linear-gradient(180deg, #fff8f5 0%, #ffffff 100%);
  box-shadow: 0 12px 24px rgba(48, 37, 23, 0.06);
}

.sent-message-bubble {
  gap: 12px;
  padding: 22px 24px;
  border-radius: 24px 24px 24px 12px;
  background: #fffdfc;
}

.sent-message-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 245, 0.92);
  border: 1px solid rgba(187, 51, 6, 0.12);
}

.sent-message-meta-pill-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sent-message-meta-pill-value {
  font-size: 0.95rem;
  white-space: nowrap;
}

.scheduled-message-bubble::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 22px;
  width: 18px;
  height: 18px;
  background: #fff8f5;
  border-left: 1px solid rgba(187, 51, 6, 0.12);
  border-bottom: 1px solid rgba(187, 51, 6, 0.12);
  transform: rotate(45deg);
}

.scheduled-message-label {
  position: relative;
  z-index: 1;
  color: #bb3306;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.sent-messages-header {
  align-items: end;
}

.sent-messages-live-note {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.sent-messages-filter-row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: -2px 0 18px;
}

.sent-messages-filter-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.sent-messages-filter-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.sent-filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 128px;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid rgba(31, 41, 51, 0.12);
  background: rgba(31, 41, 51, 0.04);
  color: #475467;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.sent-filter-pill-active {
  background: #fff6f3;
  color: #bb3306;
  border-color: rgba(187, 51, 6, 0.18);
  box-shadow: 0 8px 20px rgba(48, 37, 23, 0.06);
}

.status-pill-live {
  position: relative;
  overflow: visible;
}

.status-pill-live::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1px solid rgba(2, 122, 72, 0.3);
  animation: live-pill-pulse 1.8s ease-out infinite;
}

@keyframes live-pill-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.96);
  }

  70% {
    opacity: 0;
    transform: scale(1.12);
  }

  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

.sent-messages-shell {
  min-height: 120px;
}

@media (max-width: 900px) {
  .template-default-grid,
  .template-workspace-grid,
  .message-library-grid,
  .template-preview-grid {
    grid-template-columns: 1fr;
  }

  .template-catalog-list {
    max-height: none;
  }

  .template-catalog-topline,
  .assignment-row,
  .assignment-row-topline,
  .template-editor-header,
  .template-preview-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .template-catalog-badges,
  .template-rule-badges,
  .assignment-row-controls,
  .sent-messages-filter-row,
  .sent-messages-filter-pills {
    justify-content: flex-start;
  }

  .scheduled-message-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sent-message-patient strong {
    font-size: 1.18rem;
  }

  .sent-message-details-grid {
    grid-template-columns: 1fr;
  }
}

.response-header {
  align-items: end;
}

.response-view-toggle {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.response-view-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  padding-bottom: 4px;
}

.response-view-link-active {
  color: #bb3306;
  border-bottom-color: #bb3306;
}

.message-event-actions {
  position: absolute;
  top: 18px;
  right: 18px;
}

.message-event-action-button {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 800;
}

.message-event-done-button {
  color: #027a48;
  background: rgba(255, 255, 255, 0.7);
}

.message-event-restore-button {
  color: #bb3306;
  background: rgba(255, 255, 255, 0.7);
}

.settings-grid {
  align-items: start;
}

.checkbox-field {
  gap: 12px;
}

.checkbox-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-weight: 400;
  color: var(--muted);
}

.checkbox-row input {
  width: auto;
  margin-top: 3px;
}

.settings-summary-grid,
.delivery-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.settings-summary-item,
.summary-card,
.run-history-card,
.alert-card {
  border: 1px solid rgba(187, 51, 6, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  padding: 18px;
}

.settings-summary-item {
  display: grid;
  gap: 6px;
}

.settings-rules-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.settings-rule-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(187, 51, 6, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  padding: 18px;
}

.users-create-form {
  gap: 20px;
}

.users-list {
  display: grid;
  gap: 14px;
}

.users-list-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(187, 51, 6, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  padding: 18px;
}

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

.users-list-copy span {
  color: var(--muted);
}

.users-role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(216, 123, 115, 0.14);
  color: #bb3306;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

.settings-token-row {
  gap: 8px;
}

.summary-card {
  display: grid;
  gap: 8px;
}

.summary-card span {
  color: var(--muted);
}

.summary-card strong {
  font-size: 1.7rem;
}

.run-history-list,
.alert-list {
  display: grid;
  gap: 14px;
}

.run-history-card,
.alert-card {
  display: grid;
  gap: 14px;
}

.run-history-top,
.alert-card-top {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.run-history-top > div,
.alert-card-top > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.run-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  color: var(--muted);
}

.run-history-grid strong {
  color: var(--text);
}

.run-history-note {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(216, 123, 115, 0.08);
}

.run-history-note p,
.alert-card p {
  margin: 0;
  line-height: 1.6;
}

.delivery-filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 14px;
  margin: 18px 0;
  align-items: end;
}

.delivery-search-field {
  grid-column: span 2;
}

.alert-card h3 {
  margin: 0;
  font-size: 1.12rem;
}

.alert-card-warning {
  border-color: rgba(181, 71, 8, 0.2);
}

.alert-card-error {
  border-color: rgba(180, 35, 24, 0.22);
}

.empty-state {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.site-footer {
  width: 100%;
  margin-top: auto;
  padding: 18px 24px 28px;
}

.site-footer-inner {
  max-width: var(--page-width);
  margin: 0 auto;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: #1f2933;
  text-decoration: none;
  font-weight: 600;
}

.footer-link {
  color: #bb3306;
}

.footer-link-button {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0;
}

.policy-card {
  max-width: 880px;
}

.policy-copy {
  display: grid;
  gap: 16px;
  line-height: 1.7;
}

.policy-copy h3,
.policy-copy p {
  margin: 0;
}

.policy-list {
  margin: 0;
  padding-left: 22px;
}

.privacy-modal {
  width: min(860px, calc(100vw - 40px));
  max-height: calc(100vh - 60px);
  border: none;
  padding: 0;
  background: transparent;
}

.privacy-modal::backdrop {
  background: rgba(20, 20, 20, 0.42);
  backdrop-filter: blur(4px);
}

.privacy-modal-shell {
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid rgba(187, 51, 6, 0.1);
  box-shadow: 0 24px 60px rgba(20, 20, 20, 0.16);
  overflow: hidden;
}

.privacy-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(187, 51, 6, 0.08);
}

.privacy-modal-body {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 24px;
}

.privacy-modal-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
  padding: 0;
}

@media (max-width: 1100px) {
  .two-column {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    width: 100%;
  }
}

@media (max-width: 980px) {
  .app-frame {
    width: 100%;
    padding: 18px 18px 0;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .app-sidebar {
    display: none;
  }

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

  .mobile-topbar-brand {
    display: block;
    text-decoration: none;
  }

  .mobile-topbar-logo {
    width: min(220px, 100%);
    height: auto;
    display: block;
  }

  .mobile-menu {
    display: block;
  }
}

@media (max-width: 720px) {
  .auth-layout,
  .dashboard {
    padding: 18px;
  }

  .auth-login-stack,
  .auth-panel,
  .card {
    padding: 20px;
  }

  .template-item,
  .audit-item {
    flex-direction: column;
    align-items: stretch;
  }

  .response-header {
    align-items: start;
  }

  .sent-messages-header {
    align-items: start;
  }

  .users-list-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .message-event-meta {
    padding-right: 56px;
  }

  .auth-login-stack {
    transform: translateY(-40px);
  }

  .site-footer {
    padding: 18px;
  }

  .site-footer-inner {
    align-items: flex-start;
  }

  .privacy-modal-header,
  .privacy-modal-body {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (max-width: 900px) {
  .delivery-filter-form {
    grid-template-columns: 1fr;
  }

  .delivery-search-field {
    grid-column: auto;
  }
}
