:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --ink: #17223b;
  --muted: #66758f;
  --faint: #98a5ba;
  --line: #e2e8f1;
  --line-strong: #d2dae7;
  --blue: #0068ff;
  --blue-dark: #0057d6;
  --blue-soft: #eaf2ff;
  --green: #108a4a;
  --green-soft: #e9f8f0;
  --amber: #b45309;
  --amber-soft: #fff5e4;
  --red: #b91c1c;
  --red-soft: #fff0f0;
  --shadow: 0 20px 55px rgba(23, 34, 59, 0.12);
  --radius: 12px;
  --sidebar: 260px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 16px;
  background: #101827;
  color: #e2e8f0;
}

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

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #2563eb;
  color: white;
  font-weight: 800;
}

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

.brand small {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 12px;
}

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

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  font-weight: 650;
}

.nav-button:hover,
.nav-button.active {
  background: #1e293b;
  color: #ffffff;
}

.nav-glyph {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(148, 163, 184, 0.14);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 800;
}

.side-note {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.54);
}

.side-note span {
  color: #aab6c7;
  font-size: 12px;
  line-height: 1.45;
}

.main-shell {
  min-width: 0;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.top-title h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.top-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-metrics,
.top-actions,
.inline-actions,
.log-filters,
.group-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.top-metrics,
.top-actions {
  overflow-x: auto;
}

.status-chip,
.dirty-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.ok {
  border-color: #b7e3c5;
  background: var(--green-soft);
  color: var(--green);
}

.status-chip.warn,
.dirty-chip {
  border-color: #f5d39b;
  background: var(--amber-soft);
  color: var(--amber);
}

.dirty-chip.ok {
  border-color: #b7e3c5;
  background: var(--green-soft);
  color: var(--green);
}

.dirty-chip.error {
  border-color: #fecaca;
  background: var(--red-soft);
  color: var(--red);
}

.status-chip.error {
  border-color: #fecaca;
  background: var(--red-soft);
  color: var(--red);
}

.ok-text {
  color: var(--green);
}

.warn-text {
  color: var(--amber);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button {
  min-height: 36px;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 750;
}

.more-menu {
  position: relative;
}

.more-menu summary {
  list-style: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

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

.more-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 140px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.more-popover .text-button {
  justify-content: flex-start;
  text-align: left;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: white;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.secondary-button,
.icon-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover,
.icon-button:hover {
  border-color: #9eb4d3;
  background: #f8fbff;
}

.danger-button {
  border: 1px solid #fecaca;
  background: var(--red-soft);
  color: var(--red);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding-inline: 0;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  list-style: none;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

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

.account-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 240px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-popover p {
  margin: 0 0 8px;
  color: var(--muted);
  word-break: break-word;
}

.workspace {
  padding: 22px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2,
.panel h3 {
  margin: 0;
  line-height: 1.2;
}

.section-head h2 {
  font-size: 22px;
}

.section-head p,
.panel p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.checklist-panel {
  grid-row: span 2;
  padding: 10px;
}

.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.check-dot {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--faint);
  font-size: 13px;
  font-weight: 800;
}

.check-item.done .check-dot {
  border-color: #a7dcbc;
  background: var(--green-soft);
  color: var(--green);
}

.check-item.warn .check-dot {
  border-color: #f5d39b;
  background: var(--amber-soft);
  color: var(--amber);
}

.check-item strong {
  display: block;
  margin-bottom: 3px;
}

.check-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.qr-status {
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 18px;
  text-align: center;
}

.account-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
  padding: 16px 18px 0;
}

.empty-qr,
.qr-status img {
  width: min(260px, 100%);
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.empty-qr {
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 38px;
  font-weight: 850;
}

.setup-action-panel {
  padding-bottom: 16px;
}

.sepay-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 0.72fr);
  gap: 16px;
}

.sepay-main-panel,
.sepay-log-panel {
  min-width: 0;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  font-weight: 750;
  white-space: nowrap;
}

.switch-row input {
  width: 18px;
  height: 18px;
}

.sepay-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.metric-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.metric-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sepay-form {
  padding: 16px;
}

.sepay-recent-list {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
  padding: 16px;
}

.sepay-recent-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-soft);
}

.sepay-recent-item strong,
.sepay-recent-item span,
.sepay-recent-item small {
  display: block;
}

.sepay-recent-item span,
.sepay-recent-item small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sepay-recent-item small {
  margin-top: 3px;
  font-size: 12px;
}

.preview-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.preview-summary-panel,
.preview-list-panel {
  min-width: 0;
}

.preview-summary-grid {
  display: grid;
  gap: 10px;
}

.auto-preview-list {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 240px);
  overflow: auto;
  padding-right: 4px;
}

.auto-preview-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.auto-preview-card.is-sample {
  border-style: dashed;
  background: var(--surface-soft);
}

.auto-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.auto-preview-head h3 {
  margin: 8px 0 4px;
  font-size: 17px;
  line-height: 1.25;
}

.auto-preview-head p,
.auto-preview-meta {
  color: var(--muted);
}

.auto-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
  margin-bottom: 12px;
}

.zalo-message-preview {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}

.preview-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.preview-attachments span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.test-mode-banner {
  display: grid;
  gap: 4px;
  margin: 14px 16px 0;
  border: 1px solid #b9d2fb;
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--blue-soft);
  color: #17417f;
}

.test-mode-banner strong {
  color: var(--blue-dark);
}

.test-mode-banner span {
  line-height: 1.4;
}

.test-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px;
  margin-top: 10px;
}

.live-test-results {
  display: grid;
  gap: 8px;
  padding: 0 16px;
  margin-top: 10px;
}

.live-results-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.live-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}

.live-result-row:hover {
  border-color: #92b5ed;
  background: #f3f8ff;
}

.live-result-row strong,
.live-result-row small {
  display: block;
}

.live-result-row small {
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.test-attachment-list {
  display: grid;
  gap: 8px;
  padding: 0 16px;
  margin-top: 10px;
}

.field,
.search-field,
.compact-select {
  display: grid;
  gap: 6px;
}

.field {
  padding: 0 16px;
  margin-top: 14px;
}

.field span,
.search-field span,
.compact-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 94px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #7aa4e8;
  box-shadow: 0 0 0 3px rgba(29, 100, 216, 0.12);
}

.form-status {
  min-height: 20px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.field-hint {
  min-height: 18px;
  margin: 8px 16px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.field-hint.error {
  color: var(--red);
}

.program-start-form,
.program-start-helper {
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: #eff6ff;
}

.program-start-form {
  display: grid;
  gap: 10px;
  margin: 4px 0 14px;
  padding: 12px;
}

.program-start-form > strong {
  color: #17417f;
  font-size: 13px;
}

.program-start-form .form-grid-2 {
  margin: 0;
}

.program-start-form > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.program-start-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 14px;
  padding: 10px 12px;
}

.program-start-helper.missing {
  border-color: #fed7aa;
  background: #fff7ed;
}

.program-start-helper > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.program-start-helper strong {
  color: var(--ink);
  font-size: 13px;
}

.program-start-helper small {
  color: var(--muted);
  line-height: 1.4;
}

.program-start-helper code {
  width: fit-content;
  border-radius: 6px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.85);
  color: #17417f;
  font-size: 11px;
}

.form-status.ok {
  color: var(--green);
}

.form-status.error {
  color: var(--red);
}

.schedule-grid {
  display: grid;
  grid-template-columns: 280px minmax(380px, 1fr) 340px;
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.schedule-list-panel,
.message-table-panel,
.composer-panel {
  min-height: 540px;
}

.schedule-list-panel {
  padding: 14px;
}

.schedule-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 680px;
  overflow: auto;
}

.schedule-card {
  width: 100%;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 11px;
  text-align: left;
}

.schedule-card:hover,
.schedule-card.active {
  border-color: #92b5ed;
  background: #f7fbff;
}

.schedule-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-card .meta-line,
.message-preview,
.small-muted {
  color: var(--muted);
  font-size: 12px;
}

.schedule-editor {
  padding: 10px;
}

.schedule-overview {
  display: grid;
  gap: 14px;
}

.schedule-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.schedule-filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 160px 150px 160px auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}

.schedule-overview-list {
  display: grid;
  gap: 7px;
}

.schedule-empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 42px 16px;
  text-align: center;
}

.schedule-empty-state strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
}

.schedule-empty-state span {
  max-width: 560px;
  color: var(--muted);
}

.schedule-event-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) 112px minmax(180px, 1.1fr) 96px 126px 112px 230px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: var(--surface);
}

.schedule-event-row:not(.schedule-event-head):hover {
  border-color: #9bbcf2;
  background: #f7fbff;
}

.schedule-event-row.disabled {
  background: #f8fafc;
  opacity: 0.78;
}

.schedule-event-head {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.event-title-cell,
.event-date-cell {
  min-width: 0;
}

.event-title-cell strong,
.event-title-cell small,
.event-date-cell {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-title-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.event-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.event-actions .compact-button {
  padding-inline: 9px;
}

.schedule-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.schedule-type-badge.weekly {
  background: var(--green-soft);
  color: var(--green);
}

.event-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.event-switch input {
  appearance: none;
  width: 42px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: #cbd5e1;
  padding: 0;
  position: relative;
  transition: background 0.15s ease;
}

.event-switch input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  transition: transform 0.15s ease;
}

.event-switch input:checked {
  background: var(--green);
}

.event-switch input:checked::after {
  transform: translateX(18px);
}

.event-switch.on {
  color: var(--green);
}

.event-switch.off {
  color: var(--muted);
}

.detail-command-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 6px;
  padding: 10px;
  background: var(--surface-soft);
}

.schedule-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px 150px 150px 150px;
  gap: 10px;
  padding: 6px;
  margin-bottom: 8px;
}

.repeat-day-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 6px 10px;
}

.repeat-day-row.disabled {
  opacity: 0.55;
}

.weekday-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.weekday-chip.active {
  border-color: #9cc7ae;
  background: var(--green-soft);
  color: var(--green);
}

.weekday-chip input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.36);
}

.schedule-form-modal {
  width: min(680px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head,
.modal-actions,
.form-grid-2 {
  display: flex;
  gap: 10px;
}

.modal-head {
  align-items: flex-start;
  justify-content: space-between;
}

.modal-head h3,
.modal-head p {
  margin: 0;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
}

.form-grid-2 > * {
  flex: 1 1 0;
}

.weekly-form-block {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
}

.weekly-form-block.muted-block {
  opacity: 0.6;
}

.modal-actions {
  justify-content: flex-end;
}

.message-bulk-actions,
.schedule-group-actions,
.group-bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 6px 10px;
  padding: 8px;
  background: var(--surface-soft);
}

.message-bulk-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-right: auto;
}

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

.message-row {
  display: grid;
  grid-template-columns: 34px 78px minmax(120px, 1fr) 86px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface-soft);
}

.message-row.active {
  border-color: #92b5ed;
  background: #f3f8ff;
}

.message-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.message-status {
  justify-self: end;
  border-radius: 999px;
  padding: 5px 8px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.message-detail {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.attachment-list,
.selected-groups {
  display: grid;
  gap: 8px;
}

.media-clipboard-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #9bb9e8;
  border-radius: 10px;
  background: #edf5ff;
}

.media-clipboard-bar > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.media-clipboard-bar small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-paste-zone {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 2px dashed #9bb9e8;
  border-radius: 10px;
  background: #f5f9ff;
  color: #1f4f93;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.image-paste-zone span {
  color: var(--muted);
  font-size: 13px;
}

.image-paste-zone:hover,
.image-paste-zone:focus {
  border-color: #2673df;
  background: #edf5ff;
  box-shadow: 0 0 0 3px rgba(38, 115, 223, 0.12);
}

.image-paste-zone.uploading {
  cursor: progress;
}

.image-paste-zone.error {
  border-color: #e05252;
  background: #fff5f5;
  color: #b42318;
}

.video-r2-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #b9cdec;
  border-radius: 12px;
  background: #f7faff;
}

.video-r2-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.video-r2-head span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e3f7eb;
  color: #14783d;
  font-size: 12px;
  font-weight: 800;
}

.video-upload-button {
  display: grid;
  place-items: center;
  min-height: 74px;
  padding: 14px;
  border: 2px dashed #6f9de2;
  border-radius: 10px;
  background: #ffffff;
  color: #175cad;
  cursor: pointer;
  font-weight: 800;
  text-align: center;
}

.video-upload-button:hover {
  border-color: #1d64d8;
  background: #eef5ff;
}

.video-upload-button.disabled {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.video-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.video-r2-section > small,
.video-r2-preview span {
  color: var(--muted);
  font-size: 12px;
}

.video-r2-preview {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.video-r2-preview video {
  width: 150px;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  background: #0f172a;
  object-fit: cover;
}

.video-r2-preview > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.video-r2-preview > div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-upload-status {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.video-upload-status:empty {
  display: none;
}

.video-upload-status.ok {
  color: #14783d;
}

.video-upload-status.error {
  color: #b42318;
}

.video-upload-status progress {
  width: 100%;
  height: 8px;
  accent-color: #1d64d8;
}

.preview-video-badge {
  padding: 8px 10px;
  border-radius: 8px;
  background: #e8f5ee;
  color: #14783d;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 620px) {
  .video-r2-preview {
    grid-template-columns: 1fr;
  }

  .video-r2-preview video {
    width: 100%;
  }

  .attachment-preview-item {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .attachment-thumbnail {
    width: 80px;
    height: 60px;
  }

  .attachment-preview-item .media-item-actions {
    grid-column: 1 / -1;
  }

  .media-clipboard-bar {
    align-items: stretch;
    flex-direction: column;
  }
}

.recipient-picker {
  display: grid;
  gap: 12px;
}

.recipient-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.recipient-section {
  display: grid;
  gap: 8px;
}

.recipient-section-head,
.recipient-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipient-actions {
  flex-wrap: wrap;
}

.send-now-action {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #b9cff2;
  border-radius: var(--radius);
  background: #f3f8ff;
}

.send-now-action > small {
  color: var(--muted);
  line-height: 1.45;
}

.recipient-section-head {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.recipient-section-head strong {
  color: var(--ink);
  font-size: 13px;
}

.recipient-results,
.recipient-selected-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}

.recipient-result-row,
.recipient-selected-chip {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface-soft);
}

.recipient-result-main,
.recipient-selected-chip span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.recipient-result-main strong,
.recipient-selected-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-result-main small,
.recipient-selected-chip small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.recipient-state {
  min-width: 72px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.recipient-state.ok {
  color: var(--green);
}

.compact-empty {
  min-height: 44px;
  padding: 10px;
}

.attachment-item,
.selected-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--surface-soft);
}

.attachment-preview-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  min-height: 82px;
  padding: 8px;
}

.attachment-thumbnail {
  display: block;
  width: 96px;
  height: 64px;
  overflow: hidden;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #e9eef5;
}

.attachment-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.attachment-preview-meta strong,
.attachment-preview-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-meta small {
  color: var(--muted);
  font-size: 12px;
}

.media-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.selected-group.warn {
  border-color: #f5d39b;
  background: var(--amber-soft);
}

.selected-group strong,
.selected-group small {
  display: block;
}

.selected-group small {
  margin-top: 2px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.schedule-group-head {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(160px, 1fr) 140px auto;
  align-items: end;
}

.toolbar-note {
  margin: 10px 14px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.group-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.group-toolbar .search-field {
  flex: 1 1 320px;
}

.group-filter-tabs {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 3px;
  background: var(--surface-soft);
}

.group-filter-button {
  min-height: 30px;
  border-radius: calc(var(--radius) - 2px);
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.group-filter-button.active {
  background: #ffffff;
  color: var(--blue);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.group-bulk-actions {
  margin: 10px 14px 0;
  border-color: var(--line);
}

.result-count {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.advanced-box {
  min-width: 260px;
}

.advanced-box summary {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 10px;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
}

.advanced-box .field {
  padding: 0;
  margin-top: 10px;
}

.groups-table {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.group-row {
  display: grid;
  grid-template-columns: 34px minmax(180px, 1fr) minmax(180px, 0.8fr) 86px 86px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-soft);
}

.group-row.hidden-group {
  background: #f8fafc;
  opacity: 0.82;
}

.group-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.thread-cell {
  display: grid;
  gap: 4px;
}

.thread-cell input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.status-label {
  justify-self: end;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--amber-soft);
  color: var(--amber);
}

.status-label.ok {
  background: var(--green-soft);
  color: var(--green);
}

.log-filters {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.log-filters select,
.log-filters input {
  width: auto;
  min-width: 170px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

td {
  color: #263448;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.sent,
.status-pill.queued,
.status-pill.running,
.status-pill.ready {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.failed,
.status-pill.error {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.retrying,
.status-pill.missed,
.status-pill.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.disabled {
  background: #eef2f7;
  color: var(--muted);
}

.empty-row,
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .top-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .schedule-grid {
    grid-template-columns: 260px 520px 380px;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .schedule-list-panel,
  .message-table-panel,
  .composer-panel {
    min-height: 520px;
  }
}

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

  .side-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(82vw, 300px);
    transform: translateX(-102%);
    transition: transform 160ms ease;
  }

  body.nav-open .side-nav {
    transform: translateX(0);
  }

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

  .top-bar {
    grid-template-columns: auto 1fr;
    padding: 12px;
  }

  .top-title,
  .top-metrics,
  .top-actions,
  .account-menu {
    grid-column: 1 / -1;
  }

  .top-metrics,
  .top-actions,
  .inline-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .workspace {
    padding: 14px;
  }

  .section-head,
  .panel-head {
    display: grid;
  }

  .schedule-fields,
  .message-row,
  .group-row {
    grid-template-columns: 1fr;
  }

  .schedule-grid {
    grid-template-columns: minmax(240px, 80vw) minmax(420px, 92vw) minmax(340px, 88vw);
    gap: 12px;
  }

  .recipient-search,
  .recipient-result-row,
  .recipient-selected-chip {
    grid-template-columns: 1fr;
  }

  .recipient-state {
    text-align: left;
  }

  .message-status,
  .status-label {
    justify-self: start;
  }
}

/* Workspace redesign: schedule-first layout with drawers instead of fixed 3 columns. */
body.sidebar-collapsed {
  --sidebar: 72px;
}

.side-toggle {
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.4);
  color: #cbd5e1;
  font-size: 18px;
  font-weight: 800;
}

body.sidebar-collapsed .side-nav {
  align-items: center;
  padding-inline: 12px;
}

body.sidebar-collapsed .brand {
  width: 100%;
  justify-content: center;
}

body.sidebar-collapsed .brand > span:not(.brand-mark),
body.sidebar-collapsed .nav-button > span:not(.nav-glyph),
body.sidebar-collapsed .side-note {
  display: none;
}

body.sidebar-collapsed .brand-mark {
  width: 40px;
  height: 40px;
}

body.sidebar-collapsed .side-toggle {
  position: absolute;
  top: 64px;
  right: 10px;
  width: 24px;
  height: 24px;
}

body.sidebar-collapsed .nav-button {
  justify-content: center;
  padding: 10px 0;
}

.top-bar {
  min-height: 64px;
  padding: 10px 18px;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
}

.top-title h1 {
  font-size: 18px;
}

.top-title p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-metrics {
  max-width: 360px;
  scrollbar-width: none;
}

.top-metrics::-webkit-scrollbar,
.top-actions::-webkit-scrollbar,
.inline-actions::-webkit-scrollbar {
  display: none;
}

.workspace {
  padding: 18px;
}

#scheduleView .section-head {
  position: sticky;
  top: 65px;
  z-index: 12;
  align-items: center;
  margin: -18px -18px 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.96);
  backdrop-filter: blur(10px);
}

#scheduleView .section-head h2 {
  font-size: 21px;
}

#scheduleView .section-head p {
  margin-top: 3px;
}

.schedule-toolbar {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.schedule-toolbar .compact-select {
  min-width: 210px;
}

.schedule-toolbar .project-select-field {
  min-width: 180px;
}

.schedule-toolbar .campaign-select-field {
  min-width: 230px;
}

.schedule-toolbar > button {
  white-space: nowrap;
}

@media (min-width: 901px) and (max-width: 1600px) {
  #scheduleView .section-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  #scheduleView .section-head > div:first-child {
    width: 100%;
  }

  .schedule-toolbar {
    width: 100%;
    overflow-x: visible;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

.schedule-grid {
  position: relative;
  display: block;
  min-height: calc(100vh - 160px);
  overflow: visible;
  padding: 0;
}

.message-table-panel {
  width: 100%;
  min-height: calc(100vh - 170px);
  overflow: hidden;
}

.message-table-panel > .panel-head {
  align-items: center;
  padding: 14px 16px;
}

.message-table-panel > .panel-head h3 {
  max-width: min(680px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-editor {
  padding: 14px;
}

.schedule-fields {
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 190px) minmax(130px, 170px);
  gap: 12px;
  padding: 0;
  margin-bottom: 12px;
}

.message-bulk-actions {
  margin: 0 0 12px;
  padding: 10px 12px;
}

.message-clipboard-summary {
  display: block;
  max-width: min(760px, 70vw);
  margin-top: 3px;
  overflow: hidden;
  color: #1d64d8;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-bottom: 8px;
}

.message-row {
  grid-template-columns: 58px 132px minmax(260px, 1fr) 126px minmax(300px, auto);
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border-color: #d8e2ef;
  background: #ffffff;
}

.message-row-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 40px;
  border-color: var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.message-row:hover:not(.message-row-head) {
  border-color: #a8c3ef;
  background: #f8fbff;
}

.message-row.active {
  border-color: #6ea1ef;
  background: #f3f8ff;
  box-shadow: 0 0 0 1px rgba(29, 100, 216, 0.08);
}

.message-toggle {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
  align-items: center;
  justify-self: start;
  cursor: pointer;
}

.message-toggle input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.message-toggle > span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 160ms ease;
}

.message-toggle > span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.24);
  transition: transform 160ms ease;
}

.message-toggle input:checked + span {
  background: #178a45;
}

.message-toggle input:checked + span::after {
  transform: translateX(22px);
}

.message-toggle input:focus-visible + span {
  outline: 3px solid rgba(29, 100, 216, 0.24);
  outline-offset: 2px;
}

.message-row input[type="time"] {
  min-width: 0;
}

.message-row .message-title {
  min-width: 0;
}

.message-status {
  justify-self: start;
  max-width: 100%;
  white-space: nowrap;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.message-actions .compact-button {
  min-width: 68px;
}

.message-actions .paste-message-content:disabled {
  border-color: #d7e0eb;
  background: #edf2f7;
  color: #94a3b8;
}

.test-send-guard {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #8eb4ee;
  border-radius: var(--radius);
  background: #f3f8ff;
}

.test-send-guard > small {
  color: var(--muted);
  line-height: 1.45;
}

.drawer-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.schedule-list-panel {
  position: fixed;
  top: 86px;
  left: calc(var(--sidebar) + 18px);
  z-index: 24;
  width: min(340px, calc(100vw - var(--sidebar) - 36px));
  max-height: calc(100vh - 108px);
  min-height: 0;
  padding: 14px;
  overflow: auto;
  transform: translateX(-18px);
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, opacity 160ms ease;
}

body.schedule-panel-open .schedule-list-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.schedule-list-panel .drawer-head {
  display: flex;
}

.schedule-list {
  max-height: none;
}

.schedule-card {
  min-height: 76px;
}

.composer-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 46;
  width: clamp(420px, 34vw, 520px);
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 0;
  border-block: 0;
  border-right: 0;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.16);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

body.composer-open .composer-panel {
  transform: translateX(0);
}

.composer-panel .panel-head {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 16px 18px;
}

.composer-panel .panel-head h3 {
  font-size: 18px;
}

.composer-panel .panel-head .icon-button,
.schedule-list-panel .drawer-head .icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  justify-self: end;
}

.message-detail {
  overflow: auto;
  padding: 16px 18px 28px;
}

.composer-overlay {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: none;
  background: rgba(15, 23, 42, 0.22);
}

body.composer-open .composer-overlay,
body.schedule-panel-open .composer-overlay {
  display: block;
}

body.schedule-panel-open .schedule-list-panel {
  z-index: 48;
}

body.schedule-panel-open .composer-overlay {
  z-index: 44;
}

body.composer-open.schedule-panel-open .schedule-list-panel {
  z-index: 48;
}

body.composer-open.schedule-panel-open .composer-panel {
  z-index: 46;
}

.recipient-results,
.recipient-selected-list {
  max-height: 180px;
}

@media (max-width: 1180px) {
  .top-bar {
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 10px;
  }

  .top-metrics {
    max-width: 300px;
  }

  .account-menu {
    justify-self: end;
  }

  #scheduleView .section-head {
    top: 65px;
  }

  .schedule-grid {
    display: block;
    overflow: visible;
  }

  .message-table-panel,
  .schedule-list-panel,
  .composer-panel {
    min-height: 0;
  }
}

@media (max-width: 900px) {
  body.sidebar-collapsed {
    --sidebar: 0px;
  }

  .top-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    min-height: 58px;
  }

  .top-title {
    min-width: 0;
  }

  .top-title h1 {
    font-size: 17px;
  }

  .top-metrics {
    grid-column: 1 / -1;
    max-width: 100%;
  }

  .top-actions {
    grid-column: auto;
  }

  .account-menu {
    grid-column: auto;
  }

  .workspace {
    padding: 14px;
  }

  #scheduleView .section-head {
    top: 59px;
    margin: -14px -14px 12px;
    padding: 12px 14px;
    display: grid;
  }

  .inline-actions {
    width: 100%;
  }

  .schedule-fields {
    grid-template-columns: 1fr 170px 140px;
  }

  .schedule-list-panel {
    top: 76px;
    left: 14px;
    width: min(340px, calc(100vw - 28px));
    max-height: calc(100vh - 92px);
  }

  .composer-panel {
    width: min(520px, 94vw);
  }
}

@media (max-width: 720px) {
  .top-bar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .top-actions,
  .account-menu {
    grid-column: 1 / -1;
  }

  .schedule-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .schedule-toolbar .compact-select {
    min-width: 0;
  }

  .schedule-toolbar .compact-select span {
    display: none;
  }

  .schedule-toolbar .secondary-button,
  .schedule-toolbar .primary-button {
    padding-inline: 10px;
  }

  .schedule-toolbar .project-select-field {
    grid-row: 1;
    grid-column: 1 / -1;
  }

  #newProjectBtn {
    grid-row: 2;
    grid-column: 1;
  }

  #renameProjectBtn {
    grid-row: 2;
    grid-column: 2;
  }

  .schedule-toolbar .campaign-select-field {
    grid-row: 3;
    grid-column: 1 / -1;
  }

  #renameCampaignBtn {
    grid-row: 4;
    grid-column: 1;
  }

  #newCampaignBtn {
    grid-row: 4;
    grid-column: 2;
  }

  #deleteCampaignBtn {
    grid-row: 5;
    grid-column: 1 / -1;
  }

  #schedulePanelToggleBtn {
    grid-row: 6;
    grid-column: 1;
  }

  #addScheduleBtn {
    grid-row: 6;
    grid-column: 2;
  }

  #rotationJumpBtn {
    grid-row: 7;
    grid-column: 1 / -1;
  }

  #scheduleBackPinnedBtn {
    grid-row: 8;
    grid-column: 1 / -1;
  }

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

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

  .message-bulk-actions span {
    grid-column: 1 / -1;
  }

  .message-row,
  .message-row-head {
    grid-template-columns: 54px minmax(96px, 116px) minmax(0, 1fr);
    gap: 8px;
  }

  .message-row-head span:nth-child(4),
  .message-row-head span:nth-child(5) {
    display: none;
  }

  .message-status,
  .message-actions {
    grid-column: 2 / -1;
  }

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

  .message-table-panel > .panel-head {
    display: grid;
  }

  .message-table-panel > .panel-head h3 {
    max-width: 100%;
  }

  .composer-panel {
    width: 100vw;
  }

  .recipient-search,
  .recipient-result-row,
  .recipient-selected-chip {
    grid-template-columns: 1fr;
  }

  .recipient-state {
    text-align: left;
  }
}

@media (max-width: 1180px) {
  .preview-workspace {
    grid-template-columns: 1fr;
  }

  .auto-preview-list {
    max-height: none;
  }

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

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

  .schedule-event-row {
    grid-template-columns: minmax(220px, 1.3fr) 112px minmax(180px, 1fr) 96px 126px 112px 230px;
    min-width: 1080px;
  }

  .schedule-overview-list {
    overflow-x: auto;
    padding-bottom: 4px;
  }

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

@media (max-width: 820px) {
  .auto-preview-head {
    display: grid;
  }

  .auto-preview-meta {
    display: grid;
  }

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

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

  .schedule-event-head {
    display: none;
  }

  .schedule-event-row {
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .event-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .schedule-fields,
  .form-grid-2 {
    grid-template-columns: 1fr;
    display: grid;
  }

  .modal-head,
  .modal-actions {
    flex-direction: column;
  }

  .schedule-form-modal .modal-head {
    flex-direction: row;
  }
}
.rotation-workspace {
  margin-top: 18px;
  scroll-margin-top: 154px;
  overflow: hidden;
}
.cycle-setup-card {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid #acd0ff;
  border-radius: 18px;
  background:
    radial-gradient(circle at 96% 0%, rgb(17 105 234 / 10%), transparent 19rem),
    linear-gradient(145deg, #f8fbff, #ffffff 62%);
  box-shadow: 0 12px 30px rgb(40 92 160 / 8%);
}
.cycle-setup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.cycle-setup-head > div {
  display: grid;
  gap: 4px;
}
.cycle-setup-head h4 {
  margin: 0;
  color: #102b4d;
  font-size: 20px;
}
.cycle-setup-head p {
  margin: 0;
  color: #5c7088;
}
.cycle-eyebrow {
  color: #1769d2;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.cycle-setup-steps {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(360px, 1.25fr) minmax(300px, 1fr);
  gap: 12px;
}
.cycle-step {
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid #d9e6f5;
  border-radius: 14px;
  background: rgb(255 255 255 / 88%);
}
.cycle-step > div {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 9px;
}
.cycle-step-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #e5f0ff;
  color: #1769d2;
  font-weight: 850;
}
.cycle-step small {
  color: #6b7c91;
  line-height: 1.4;
}
.cycle-step.is-flexible {
  border-style: dashed;
  background: #f9fbfd;
}
.cycle-schedule-fields {
  display: grid;
  grid-template-columns: 1fr 1fr .75fr;
  gap: 9px;
}
.cycle-enabled-toggle {
  grid-column: 1 / -1;
  width: fit-content;
  padding: 5px 0 2px;
  color: #294b70;
  font-weight: 750;
}
.cycle-schedule-fields[hidden] {
  display: none;
}
.cycle-help-text {
  margin: 0;
  color: #46617e;
  font-size: .9rem;
  line-height: 1.45;
}
.cycle-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.cycle-actions .primary-button {
  min-width: 220px;
}
.cycle-setup-card > .form-status {
  margin-bottom: 0;
}
.rotation-workspace-head {
  padding-bottom: 16px;
  border-bottom: 1px solid #dce5ef;
}
.rotation-workspace-head h3 {
  color: #10233f;
  font-size: 20px;
}
.rotation-running-groups {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #d8e3f1;
  border-radius: 12px;
  background: #f7faff;
  color: #31506f;
}
.rotation-running-groups.has-groups {
  border-color: #9bd5b8;
  background: #eefbf4;
  color: #0d5137;
}
.rotation-running-groups > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rotation-running-groups a,
.rotation-running-groups > div > span {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  color: inherit;
  font-weight: 750;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgb(49 80 111 / 14%);
}
.rotation-list-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 18px 0 14px;
}
.rotation-list-head > div { display: grid; gap: 4px; }
.rotation-list-head h4 { margin: 0; color: #10233f; font-size: 16px; }
.rotation-list-head p { margin: 0; color: #66758a; }
.rotation-cycle-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.rotation-cycle-flow > div {
  position: relative;
  min-width: 0;
  padding: 13px 13px 13px 46px;
  border: 1px solid #d9e6f5;
  border-radius: 13px;
  background: linear-gradient(145deg, #f9fcff, #f2f7ff);
  display: grid;
  gap: 3px;
}
.rotation-cycle-flow span {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #e3efff;
  color: #1769d2;
  font-size: .82rem;
  font-weight: 850;
}
.rotation-cycle-flow strong { color: #193857; font-size: .91rem; }
.rotation-cycle-flow small { color: #687c91; line-height: 1.35; }
.rotation-schedule-list { display: grid; gap: 14px; }
.rotation-global-tools {
  margin-top: 20px;
  border: 1px solid #d8e3f1;
  border-radius: 14px;
  background: #f8fafc;
}
.rotation-global-tools > summary {
  padding: 14px 16px;
  color: #29415f;
  font-weight: 800;
  cursor: pointer;
}
.rotation-global-tools-body {
  padding: 0 16px 16px;
}
.rotation-advanced-tools {
  margin-top: 16px;
}
.rotation-advanced-tools > summary {
  list-style-position: inside;
}
.rotation-advanced-actions {
  justify-content: flex-end;
  margin-top: 14px;
}
.manual-group-switch-card { margin: 16px 0; padding: 16px; border: 1px solid #d8e3f1; border-radius: 14px; background: #f7faff; display: grid; gap: 12px; }
.manual-group-switch-card > div:first-child { display: grid; gap: 4px; }
.manual-group-switch-card > div:first-child span { color: #66758a; }
.manual-group-actions { display: grid; grid-template-columns: auto minmax(190px, .8fr) minmax(260px, 1fr) auto; gap: 10px; align-items: center; }
@media (max-width: 820px) { .manual-group-actions { grid-template-columns: 1fr; } }
.live-workshop-section-head {
  align-items: center;
  margin-bottom: 18px;
}
.live-workshop-overview {
  overflow: hidden;
  padding: 0;
  border-color: #bed9ff;
  background:
    radial-gradient(circle at 92% 0%, rgba(0, 104, 255, .16), transparent 24rem),
    linear-gradient(145deg, #ffffff 0%, #f7fbff 58%, #eff6ff 100%);
}
.live-workshop-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 20px 0;
}
.live-workshop-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px 22px;
}
.live-workshop-hero-row > div:first-child {
  min-width: 0;
}
.live-workshop-kicker {
  display: block;
  margin-bottom: 6px;
  color: #3470bb;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.live-workshop-hero-row h3 {
  margin: 0;
  color: #10233f;
  font-size: clamp(22px, 2.1vw, 32px);
  line-height: 1.18;
  letter-spacing: -.035em;
}
.live-workshop-hero-row p {
  max-width: 820px;
  margin: 9px 0 0;
  color: #5f7188;
  line-height: 1.55;
}
.live-workshop-primary-actions,
.live-workshop-control-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.live-workshop-primary-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}
.live-workshop-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #d7e6fa;
  background: rgba(255, 255, 255, .72);
}
.live-workshop-facts article {
  min-width: 0;
  padding: 17px 20px 19px;
  border-right: 1px solid #e0e9f5;
}
.live-workshop-facts article:last-child {
  border-right: 0;
}
.live-workshop-facts span,
.live-workshop-facts strong,
.live-workshop-facts small {
  display: block;
}
.live-workshop-facts span {
  margin-bottom: 7px;
  color: #78879b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.live-workshop-facts strong {
  overflow-wrap: anywhere;
  color: #142743;
  font-size: 16px;
  line-height: 1.35;
}
.live-workshop-facts small {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: #687a91;
  line-height: 1.4;
}
.live-workshop-control,
.live-workshop-delivery {
  margin-top: 18px;
}
.live-workshop-control .panel-head,
.live-workshop-delivery .panel-head {
  align-items: flex-start;
}
.live-workshop-no-send {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid #c8d7ea;
  border-radius: 999px;
  background: #f7faff;
  color: #48627e;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.live-workshop-control-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(220px, 1fr) minmax(150px, .7fr) minmax(130px, .55fr);
  gap: 13px;
}
.live-workshop-group-field {
  grid-column: 1 / -1;
}
.live-workshop-mode-help {
  margin-top: 13px;
  padding: 11px 13px;
  border-radius: 11px;
  background: #edf5ff;
  color: #315777;
  line-height: 1.45;
}
.live-workshop-safety {
  display: flex;
  gap: 8px;
  margin-top: 13px;
  padding: 13px 15px;
  border: 1px solid #bfe3d2;
  border-radius: 12px;
  background: #eefbf4;
  color: #285f47;
  line-height: 1.5;
}
.live-workshop-safety strong {
  flex: 0 0 auto;
  color: #0d5137;
}
.live-workshop-control-actions {
  justify-content: flex-end;
  margin-top: 16px;
}
.live-workshop-control > .form-status {
  margin-bottom: 0;
}
.live-workshop-delivery-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.live-workshop-delivery-flow > div {
  position: relative;
  min-width: 0;
  padding: 15px 14px 15px 49px;
  border: 1px solid #dce6f2;
  border-radius: 14px;
  background: #f8fbff;
}
.live-workshop-delivery-flow span {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #e2efff;
  color: #1769d2;
  font-weight: 900;
}
.live-workshop-delivery-flow strong,
.live-workshop-delivery-flow small {
  display: block;
}
.live-workshop-delivery-flow strong {
  color: #193857;
  font-size: .93rem;
}
.live-workshop-delivery-flow small {
  margin-top: 4px;
  color: #687c91;
  line-height: 1.38;
}
.active-zalo-group-card { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 18px; margin-bottom: 20px; border-radius: 16px; background: linear-gradient(135deg, #edf8ff, #effcf5); border: 1px solid #bfe3d2; }
.active-zalo-group-card > div { display: grid; gap: 5px; }
.active-zalo-group-card span { color: #557087; font-size: 13px; font-weight: 700; text-transform: uppercase; }
.active-zalo-group-card strong { color: #0d5137; font-size: 19px; }
.active-zalo-group-card small { color: #586b7d; }
.rotation-card { border: 1px solid #dce5ef; border-radius: 16px; padding: 18px; background: #fff; }
.rotation-card-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.rotation-card-head > div { display: grid; gap: 4px; }
.rotation-card-head strong { font-size: 17px; color: #10233f; }
.rotation-card-head span { color: #66758a; }
.rotation-fields { display: grid; grid-template-columns: minmax(240px, 1.35fr) repeat(4, minmax(130px, 1fr)); gap: 12px; }
.rotation-group-policy { margin-top: 14px; padding: 14px; border: 1px solid #d8e3f1; border-radius: 12px; background: #fbfdff; display: grid; gap: 10px; }
.rotation-policy-fields { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(320px, 1.4fr); gap: 12px; }
.rotation-fixed-group-field.is-hidden { display: none; }
.rotation-policy-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: #eef7ff; color: #31506f; line-height: 1.45; }
.rotation-policy-note.is-fixed { background: #fff7e8; color: #6e4a12; }
.rotation-policy-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.rotation-policy-actions > span { color: #63758c; font-size: .9rem; }
.rotation-assigned { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #f4f8ff; display: grid; gap: 8px; color: #29415f; }
.rotation-assigned.has-groups { background: #eefbf4; color: #0d5137; box-shadow: inset 0 0 0 1px #bfe3d2; }
.rotation-assigned > div { display: flex; flex-wrap: wrap; gap: 8px; }
.rotation-group-chip { display: inline-flex; gap: 7px; align-items: center; padding: 7px 10px; border-radius: 999px; background: #e2efff; color: #1359b6; font-weight: 700; text-decoration: none; }
.rotation-group-chip span { color: #55708f; font-weight: 600; }
.rotation-no-group { color: #718096; }
@media (max-width: 1100px) {
  .live-workshop-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-workshop-facts article:nth-child(2) { border-right: 0; }
  .live-workshop-facts article:nth-child(-n+2) { border-bottom: 1px solid #e0e9f5; }
  .live-workshop-control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live-workshop-delivery-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cycle-setup-steps { grid-template-columns: 1fr; }
  .rotation-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rotation-policy-fields { grid-template-columns: 1fr; }
  .rotation-cycle-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .live-workshop-section-head,
  .live-workshop-hero-row,
  .live-workshop-control .panel-head,
  .live-workshop-delivery .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .live-workshop-primary-actions,
  .live-workshop-primary-actions > a {
    width: 100%;
  }
  .live-workshop-primary-actions > a {
    justify-content: center;
  }
  .live-workshop-safety {
    display: grid;
  }
  .cycle-setup-card { padding: 16px; }
  .cycle-setup-head { align-items: flex-start; }
  .rotation-workspace { scroll-margin-top: 16px; }
  .rotation-workspace-head,
  .rotation-list-head { align-items: flex-start; }
  .rotation-workspace-head { display: grid; }
  .rotation-workspace-head .inline-actions { width: 100%; }
}
@media (max-width: 520px) {
  .live-workshop-facts,
  .live-workshop-control-grid,
  .live-workshop-delivery-flow {
    grid-template-columns: 1fr;
  }
  .live-workshop-facts article {
    border-right: 0;
    border-bottom: 1px solid #e0e9f5;
  }
  .live-workshop-facts article:last-child {
    border-bottom: 0;
  }
  .live-workshop-control-actions {
    display: grid;
  }
  .cycle-setup-head { flex-direction: column; }
  .cycle-schedule-fields { grid-template-columns: 1fr; }
  .cycle-actions { display: grid; }
  .cycle-actions .primary-button { min-width: 0; }
  .rotation-fields { grid-template-columns: 1fr; }
  .rotation-cycle-flow { grid-template-columns: 1fr; }
  .rotation-card-head,
  .rotation-list-head { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 820px) {
  .top-bar,
  #scheduleView .section-head {
    position: static;
    top: auto;
  }
}

/* 2026 workspace visual refresh: clearer hierarchy without changing behavior. */
body {
  background:
    radial-gradient(circle at 88% 4%, rgba(0, 104, 255, 0.055), transparent 25rem),
    var(--bg);
  color: var(--ink);
}

button,
summary,
input,
select,
textarea {
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(0, 104, 255, 0.18);
  outline-offset: 2px;
}

.side-nav {
  gap: 22px;
  padding: 18px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(circle at 16% 0%, rgba(40, 112, 255, 0.19), transparent 16rem),
    linear-gradient(180deg, #101c32 0%, #0b1426 100%);
}

.brand {
  min-height: 50px;
  padding: 2px 6px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #2283ff, #005ce5);
  box-shadow: 0 10px 26px rgba(0, 104, 255, 0.34);
  font-size: 17px;
}

.brand strong {
  color: #f8fbff;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand small {
  color: #8fa1bb;
  font-size: 12px;
}

.nav-stack {
  gap: 7px;
}

.nav-button {
  position: relative;
  min-height: 48px;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 8px 10px;
  color: #aebbd0;
  font-weight: 700;
}

.nav-button:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-button.active {
  border-color: rgba(111, 166, 255, 0.2);
  background: linear-gradient(135deg, rgba(54, 125, 238, 0.23), rgba(31, 66, 120, 0.36));
  color: #ffffff;
  box-shadow: inset 3px 0 0 #4d95ff;
}

.nav-glyph {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(145, 165, 196, 0.1);
  color: #8dbdff;
}

.nav-glyph svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-button.active .nav-glyph {
  background: rgba(255, 255, 255, 0.11);
  color: #d4e6ff;
}

.side-note {
  gap: 7px;
  padding: 14px;
  border-color: rgba(158, 181, 216, 0.14);
  border-radius: 14px;
  background: rgba(8, 17, 33, 0.5);
}

.side-note strong {
  color: #eaf1fb;
}

.top-bar {
  min-height: 72px;
  padding: 10px 20px;
  border-bottom-color: rgba(210, 218, 231, 0.82);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 5px 22px rgba(23, 34, 59, 0.035);
}

.top-title h1 {
  color: #111c34;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.top-title p {
  color: #71809a;
}

.status-chip,
.dirty-chip {
  min-height: 32px;
  gap: 7px;
  border-color: #e0e6ef;
  background: #f7f9fc;
  font-weight: 750;
}

.status-chip::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #a4afc0;
  content: "";
}

.status-chip.ok::before {
  background: #20a65a;
  box-shadow: 0 0 0 4px rgba(32, 166, 90, 0.1);
}

.status-chip.warn::before {
  background: #d98b19;
}

.status-chip.error::before {
  background: #dc4848;
}

.primary-button,
.secondary-button,
.danger-button,
.quiet-button,
.text-button,
.icon-button,
.more-menu summary,
.account-menu summary {
  min-height: 40px;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 750;
}

.primary-button {
  border-color: var(--blue);
  background: linear-gradient(180deg, #1478ff, var(--blue));
  box-shadow: 0 7px 16px rgba(0, 104, 255, 0.18);
}

.primary-button:hover {
  border-color: var(--blue-dark);
  background: linear-gradient(180deg, #076beb, var(--blue-dark));
  box-shadow: 0 9px 20px rgba(0, 87, 214, 0.24);
  transform: translateY(-1px);
}

.secondary-button,
.icon-button,
.more-menu summary,
.account-menu summary {
  border-color: #d9e1ec;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(23, 34, 59, 0.03);
}

.secondary-button:hover,
.icon-button:hover,
.more-menu summary:hover,
.account-menu summary:hover {
  border-color: #b8c9df;
  background: #f8fbff;
  color: #005bd8;
}

.danger-button {
  border-color: #ffd0d0;
  background: #fff5f5;
  color: #c53737;
}

.danger-button:hover {
  border-color: #f5aeae;
  background: #ffebeb;
}

.quiet-button {
  border: 1px solid transparent;
  background: transparent;
  color: #45617f;
  cursor: pointer;
}

.quiet-button:hover {
  border-color: #d9e5f4;
  background: #edf5ff;
  color: #005bd8;
}

.panel {
  border-color: #e1e7f0;
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(23, 34, 59, 0.035),
    0 12px 36px rgba(23, 34, 59, 0.035);
}

.workspace {
  padding: 18px 20px 34px;
}

#scheduleView .section-head {
  top: 72px;
  min-height: 96px;
  margin: -18px -20px 0;
  padding: 21px 22px 18px;
  border-bottom: 0;
  background: linear-gradient(180deg, rgba(243, 246, 251, 0.98), rgba(243, 246, 251, 0.93));
}

#scheduleView .section-head > div:first-child {
  min-width: 0;
}

#scheduleView .section-head h2 {
  color: #111c34;
  font-size: 26px;
  font-weight: 850;
  letter-spacing: -0.035em;
}

#scheduleView .section-head p {
  margin-top: 5px;
  color: #6d7c94;
}

.section-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #3173cc;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.schedule-head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.add-schedule-button::before {
  margin-right: 7px;
  content: "+";
  font-size: 18px;
  font-weight: 500;
  line-height: 0;
}

.schedule-command-center {
  position: relative;
  z-index: 13;
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid #dfe6f0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 1px 2px rgba(23, 34, 59, 0.04),
    0 14px 40px rgba(23, 34, 59, 0.055);
}

.schedule-command-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 3px;
}

.command-nav-label {
  color: #75839a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.schedule-view-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #e1e7f0;
  border-radius: 11px;
  background: #f3f6fa;
}

.workspace-tab {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 7px 13px;
  background: transparent;
  color: #65748b;
  font-size: 12px;
  font-weight: 800;
}

.workspace-tab::before {
  display: inline-grid;
  place-items: center;
  width: 18px;
  margin-right: 5px;
  color: #7e8da5;
  content: "▦";
}

#rotationJumpBtn::before {
  content: "↻";
}

.workspace-tab:hover,
.workspace-tab.active {
  background: #ffffff;
  color: #005edc;
  box-shadow: 0 2px 7px rgba(23, 34, 59, 0.09);
}

.workspace-tab.active::before,
.workspace-tab:hover::before {
  color: #0068ff;
}

.schedule-context-flow {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) auto minmax(390px, 1.15fr);
  gap: 12px;
  align-items: stretch;
}

.context-picker {
  display: grid;
  grid-template-columns: 34px minmax(170px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 78px;
  padding: 11px 12px;
  border: 1px solid #e5eaf2;
  border-radius: 14px;
  background: linear-gradient(145deg, #fafcff, #f6f8fb);
}

.context-picker:focus-within {
  border-color: #a9c9f7;
  box-shadow: 0 0 0 3px rgba(0, 104, 255, 0.07);
}

.context-step {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #e8f1ff;
  color: #0068ff;
  font-size: 12px;
  font-weight: 900;
}

.context-picker .compact-select {
  min-width: 0;
}

.context-picker .compact-select > span {
  margin-bottom: 5px;
  color: #728097;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.context-picker select {
  min-height: 37px;
  border: 0;
  border-radius: 8px;
  padding: 4px 32px 4px 0;
  background-color: transparent;
  color: #17223b;
  font-size: 15px;
  font-weight: 780;
}

.context-picker select:hover {
  color: #005edc;
}

.context-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  white-space: nowrap;
}

.context-actions .quiet-button {
  min-height: 34px;
  padding: 7px 8px;
  font-size: 12px;
}

.context-flow-arrow {
  align-self: center;
  color: #a3afc0;
  font-size: 19px;
}

.context-more-menu,
.row-actions-menu {
  position: relative;
}

.context-more-menu > summary,
.row-actions-menu > summary {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #67768d;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  list-style: none;
  cursor: pointer;
}

.context-more-menu > summary::-webkit-details-marker,
.row-actions-menu > summary::-webkit-details-marker {
  display: none;
}

.context-more-menu > summary:hover,
.context-more-menu[open] > summary,
.row-actions-menu > summary:hover,
.row-actions-menu[open] > summary {
  border-color: #d5e0ee;
  background: #edf4fd;
  color: #005edc;
}

.context-more-popover,
.row-actions-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 25;
  width: 188px;
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid #dfe6ef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(23, 34, 59, 0.16);
}

.context-more-popover > span {
  padding: 3px 4px 5px;
  color: #8995a7;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.context-more-popover button,
.row-actions-popover button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.message-table-panel {
  min-height: calc(100vh - 278px);
  border-radius: 18px;
}

.message-table-panel > .panel-head {
  min-height: 76px;
  padding: 17px 20px;
  border-bottom-color: #e7ebf2;
  background: linear-gradient(180deg, #ffffff, #fcfdff);
}

.message-table-panel > .panel-head h3 {
  color: #16213a;
  font-size: 18px;
  font-weight: 820;
  letter-spacing: -0.02em;
}

.message-table-panel > .panel-head p {
  margin-top: 4px;
  color: #7a879b;
  font-size: 12px;
}

.schedule-editor {
  padding: 17px 19px 21px;
}

.schedule-overview {
  gap: 16px;
}

.schedule-stats-grid {
  gap: 11px;
}

.schedule-stats-grid .metric-card {
  position: relative;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 1px 10px;
  min-height: 98px;
  overflow: hidden;
  border-color: #e5eaf2;
  border-radius: 14px;
  padding: 13px;
  background: linear-gradient(150deg, #ffffff 10%, #f8faff 100%);
  box-shadow: 0 4px 18px rgba(23, 34, 59, 0.035);
}

.schedule-stats-grid .metric-card::after {
  position: absolute;
  right: -20px;
  bottom: -28px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 104, 255, 0.045);
  content: "";
}

.schedule-stats-grid .metric-card > .metric-icon {
  grid-row: 1 / -1;
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: #edf4ff;
  color: #2474df;
  font-size: 14px;
  font-weight: 900;
}

.schedule-stats-grid .metric-card > span:not(.metric-icon) {
  color: #748198;
  font-size: 11px;
  font-weight: 800;
}

.schedule-stats-grid .metric-card > strong {
  font-size: 23px;
  font-weight: 850;
  line-height: 1.15;
}

.schedule-stats-grid .metric-card > small {
  overflow: hidden;
  color: #9aa5b5;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-stats-grid .metric-enabled .metric-icon {
  background: #e9f8f0;
  color: #139352;
}

.schedule-stats-grid .metric-paused .metric-icon {
  background: #fff4e4;
  color: #c37a17;
}

.schedule-stats-grid .metric-weekly .metric-icon {
  background: #f0edff;
  color: #7656d6;
}

.schedule-stats-grid .metric-once .metric-icon {
  background: #eaf8fb;
  color: #24849a;
}

.schedule-filter-bar {
  grid-template-columns: minmax(240px, 1.35fr) repeat(4, minmax(130px, 0.65fr)) auto;
  gap: 10px;
  padding: 14px;
  border-color: #e4e9f1;
  border-radius: 14px;
  background: #f8fafc;
}

.schedule-filter-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 1px 3px;
}

.schedule-filter-title strong {
  color: #23324d;
  font-size: 13px;
}

.schedule-filter-title span {
  color: #8a96a8;
  font-size: 11px;
}

.schedule-filter-bar label > span {
  margin-bottom: 6px;
  color: #6e7c92;
  font-size: 11px;
}

.schedule-filter-bar input,
.schedule-filter-bar select {
  min-height: 42px;
  border-color: #dce4ee;
  border-radius: 10px;
  background-color: #ffffff;
}

.schedule-filter-bar input:hover,
.schedule-filter-bar select:hover {
  border-color: #b9cae0;
}

.reset-filter-button {
  min-height: 42px;
  border-color: #dfe6ef;
  background: #ffffff;
}

.schedule-overview-list {
  gap: 8px;
}

.schedule-event-row {
  grid-template-columns: minmax(220px, 1.55fr) 112px minmax(170px, 1.1fr) 100px 120px 110px 178px;
  gap: 11px;
  min-height: 70px;
  border-color: #e4e9f1;
  border-radius: 13px;
  padding: 12px 13px;
  box-shadow: 0 2px 8px rgba(23, 34, 59, 0.025);
}

.schedule-event-row:not(.schedule-event-head):hover {
  border-color: #b7cef0;
  background: #fbfdff;
  box-shadow: 0 7px 20px rgba(23, 77, 144, 0.07);
  transform: translateY(-1px);
}

.schedule-event-row.disabled {
  background: #fafbfd;
  opacity: 1;
}

.schedule-event-row.disabled .event-title-cell,
.schedule-event-row.disabled > span:not(.event-actions) {
  opacity: 0.72;
}

.schedule-event-head {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding-block: 8px;
  background: #f6f8fb;
  box-shadow: none;
  color: #748198;
  letter-spacing: 0.01em;
}

.event-title-cell strong {
  color: #26334b;
  font-size: 14px;
  font-weight: 820;
}

.event-title-cell small {
  margin-top: 4px;
  color: #8894a7;
}

.schedule-type-badge {
  min-height: 27px;
  padding: 5px 9px;
  background: #eaf2ff;
  color: #1c67ca;
  font-weight: 800;
}

.event-switch input {
  width: 40px;
  height: 23px;
  background: #d7deea;
}

.event-switch input::after {
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
}

.event-switch input:checked {
  background: #14a05a;
}

.event-switch input:checked::after {
  transform: translateX(17px);
}

.event-actions {
  position: relative;
  flex-wrap: nowrap;
  align-items: center;
}

.open-schedule-button {
  min-width: 125px;
  box-shadow: none;
}

.row-actions-menu > summary {
  width: 39px;
  min-height: 38px;
  border-color: #dce4ee;
  background: #ffffff;
}

.row-actions-popover {
  top: calc(100% + 5px);
  width: 175px;
}

.rotation-workspace {
  border-radius: 18px;
}

@media (max-width: 1400px) {
  .schedule-context-flow {
    grid-template-columns: minmax(300px, 0.8fr) auto minmax(360px, 1.2fr);
  }

  .context-picker {
    grid-template-columns: 32px minmax(150px, 1fr);
  }

  .context-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .schedule-filter-bar {
    grid-template-columns: minmax(240px, 1.4fr) repeat(2, minmax(140px, 0.7fr));
  }

  .reset-filter-button {
    align-self: end;
  }
}

@media (min-width: 901px) and (max-width: 1600px) {
  #scheduleView .section-head {
    flex-wrap: nowrap;
    align-items: center;
  }

  #scheduleView .section-head > div:first-child {
    width: auto;
  }
}

@media (max-width: 1180px) {
  #scheduleView .section-head {
    top: 72px;
  }

  .schedule-context-flow {
    grid-template-columns: 1fr;
  }

  .context-flow-arrow {
    display: none;
  }

  .context-picker {
    grid-template-columns: 34px minmax(190px, 1fr) auto;
  }

  .context-actions {
    grid-column: auto;
    justify-content: flex-end;
  }

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

  .schedule-event-row {
    min-width: 1030px;
  }
}

@media (max-width: 900px) {
  .top-bar {
    min-height: 64px;
  }

  #scheduleView .section-head {
    top: 64px;
    margin-inline: -14px;
    padding-inline: 16px;
  }

  .schedule-command-center {
    border-radius: 16px;
  }

  .context-picker {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .context-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .context-actions #newProjectBtn,
  .context-actions #renameProjectBtn,
  .context-actions #renameCampaignBtn,
  .context-actions #newCampaignBtn,
  .context-actions #deleteCampaignBtn {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 820px) {
  #scheduleView .section-head {
    min-height: 0;
    margin-top: -14px;
  }

  #scheduleView .section-head h2 {
    font-size: 23px;
  }

  .schedule-command-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .schedule-view-switch {
    width: 100%;
  }

  .workspace-tab {
    flex: 1 1 0;
  }

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

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

  .schedule-filter-title {
    display: grid;
    gap: 2px;
  }

  .schedule-event-row:not(.schedule-event-head) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 16px;
    min-width: 0;
    padding: 15px;
  }

  .schedule-event-row > .event-title-cell,
  .schedule-event-row > .event-actions {
    grid-column: 1 / -1;
  }

  .schedule-event-row [data-mobile-label] {
    display: grid;
    gap: 4px;
  }

  .schedule-event-row [data-mobile-label]::before {
    color: #8a96a8;
    content: attr(data-mobile-label);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

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

  .row-actions-popover {
    right: auto;
    left: 0;
  }
}

@media (max-width: 620px) {
  .top-bar {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 9px 10px;
    padding: 10px 14px 12px;
  }

  #mobileNavBtn {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    display: inline-grid;
    place-items: center;
    width: 38px;
    padding: 0;
  }

  .top-title {
    grid-column: 2;
    grid-row: 1;
  }

  .top-title h1 {
    font-size: 16px;
  }

  .top-title p {
    margin-top: 2px;
    font-size: 11px;
  }

  .top-metrics {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .top-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    padding-right: 104px;
  }

  .account-menu {
    grid-column: 2;
    grid-row: 3;
    justify-self: end;
  }

  .section-eyebrow {
    display: none;
  }

  #scheduleView .section-head {
    gap: 12px;
  }

  #scheduleView .section-head p {
    font-size: 12px;
  }

  .schedule-head-actions,
  .schedule-head-actions .primary-button {
    width: 100%;
  }

  .schedule-context-flow {
    gap: 9px;
  }

  .context-picker {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 10px;
  }

  .context-step {
    width: 28px;
    height: 28px;
  }

  .context-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .context-actions .quiet-button {
    width: 100%;
  }

  .context-more-menu > summary {
    width: 100%;
  }

  .context-more-popover {
    right: auto;
    left: 0;
  }

  .schedule-stats-grid .metric-card {
    grid-template-columns: 36px minmax(0, 1fr);
    min-height: 91px;
    padding: 11px;
  }

  .schedule-stats-grid .metric-card > .metric-icon {
    width: 34px;
    height: 34px;
  }

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

  .schedule-filter-title {
    grid-column: 1;
  }

  .schedule-event-row:not(.schedule-event-head) {
    grid-template-columns: 1fr;
  }

  .schedule-event-row > .event-title-cell,
  .schedule-event-row > .event-actions {
    grid-column: 1;
  }

  .open-schedule-button {
    flex: 1 1 auto;
  }
}
