:root {
  /* Brand Palette from color_palette.md */
  --brand-primary: #304060;
  --brand-primary-light: #506890;
  --brand-dark: #1f2c44;
  --brand-accent: #b05030;
  --brand-accent-hover: #9c3f22;
  --brand-accent-light: #f8e8d8;
  
  /* Light Mode Surfaces */
  --bg-light: #f0f4f8;
  --panel-bg: #ffffff;
  --panel-sub: #f8fafc;
  --panel-inner: #f1f5f9;
  
  /* Borders */
  --border-light: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-focus: #506890;
  
  /* Text */
  --text-primary: #1e2a3a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  /* Status */
  --status-success: #059669;
  --status-success-bg: #ecfdf5;
  --status-error: #dc2626;
  --status-error-bg: #fef2f2;
  --status-warn: #d97706;
  --status-warn-bg: #fffbeb;
  
  /* Radii & Shadows */
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 4px 16px -2px rgba(30, 42, 58, 0.06), 0 2px 6px -1px rgba(30, 42, 58, 0.04);
  --shadow-hover: 0 8px 24px -4px rgba(30, 42, 58, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.theme-light {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 32px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  -webkit-font-smoothing: antialiased;
}

.app-wrapper {
  width: 100%;
  max-width: 1140px;
}

/* Header */
.app-header {
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--brand-primary);
  overflow: hidden;
  background: var(--panel-sub);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand-accent);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-sub);
  border: 1px solid var(--border-light);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pulsing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-warn);
  transition: all 0.3s;
}

.pulsing-dot.online {
  background: var(--status-success);
}

.pulsing-dot.offline {
  background: var(--status-error);
}

.btn-outline-icon {
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline-icon:hover {
  color: var(--brand-primary);
  border-color: var(--border-focus);
  background: var(--panel-sub);
}


/* Main Layout Grid - Symmetrical & Balanced */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: stretch;
}

@media (max-width: 960px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.content-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.form-panel {
  display: flex;
  flex-direction: column;
}

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

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: -0.01em;
}

.panel-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Form Styles */
#dispatchForm {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.form-row {
  margin-bottom: 16px;
}

.form-row.form-row-caption {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}

.form-row.form-row-caption .textarea-wrapper {
  flex: 1;
  display: flex;
  min-height: 120px;
}

.form-row.form-row-caption textarea {
  flex: 1;
  min-height: 120px;
  height: 100%;
}

.label-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.required-star {
  color: var(--brand-accent);
}

.btn-inline-action {
  background: var(--panel-sub);
  border: 1px solid var(--border-light);
  color: var(--brand-primary);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  transition: all 0.2s;
}

.btn-inline-action:hover {
  background: #e2e8f0;
  color: var(--brand-dark);
}

/* Multi-Target Checklist / Unchecklist System */
/* Target Picker Trigger Card (Opens Pop-Up) */
.target-picker-trigger {
  background: #ffffff;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s ease;
  user-select: none;
}

.target-picker-trigger:hover {
  border-color: var(--brand-primary);
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.target-picker-trigger:focus-visible {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(48, 64, 96, 0.15);
}

.target-picker-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.target-picker-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--panel-sub);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.target-picker-text {
  min-width: 0;
}

.target-picker-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.target-picker-summary {
  font-size: 0.77rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  margin-top: 2px;
}

.btn-picker-action {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  background: var(--panel-inner);
  border: 1px solid var(--border-subtle);
  color: var(--brand-primary);
  flex-shrink: 0;
  transition: all 0.2s;
}

.target-picker-trigger:hover .btn-picker-action {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

/* Modal Group Picker Specifics */
.modal-card.modal-group-picker {
  max-width: 540px;
  width: 100%;
  text-align: left;
  padding: 20px 22px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-mini-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--panel-sub);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-heading-sm {
  font-size: 1rem;
  font-weight: 800;
  color: var(--brand-dark);
  margin: 0;
  line-height: 1.2;
}

.modal-btn-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-btn-close:hover {
  color: var(--brand-dark);
  background: var(--panel-sub);
}

.modal-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.modal-toolbar .group-search-wrapper {
  margin-bottom: 0;
}

.modal-quick-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-tool-pill {
  background: var(--panel-inner);
  border: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.btn-tool-pill:hover {
  background: #ffffff;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.checklist-container.modal-checklist {
  max-height: 340px;
  min-height: 180px;
  flex: 1;
}

.custom-target-row.modal-custom-row {
  margin-top: 8px;
  flex-shrink: 0;
}

.modal-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  margin-top: 10px;
  flex-shrink: 0;
}

.modal-footer-hint {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand-primary);
}

.modal-save-btn {
  width: auto;
  padding: 8px 18px;
  font-size: 0.84rem;
  margin-top: 0;
}

.label-with-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selection-counter {
  background: var(--brand-accent-light);
  color: var(--brand-accent);
  border: 1px solid rgba(176, 80, 48, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}


.group-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
}

.group-search-wrapper .search-icon {
  margin-left: 10px;
  color: var(--text-dim);
}

.group-search-wrapper input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
}

/* Scrollable Checklist Box */
.checklist-container {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  max-height: 250px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.checklist-container::-webkit-scrollbar {
  width: 5px;
}
.checklist-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}

.checklist-loading {
  padding: 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.checklist-category-header {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-primary);
  padding: 6px 8px 2px 8px;
  margin-top: 4px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  background: var(--panel-sub);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.checklist-item:hover {
  background: #f1f5f9;
  border-color: var(--border-light);
}

.checklist-item.selected {
  background: rgba(48, 64, 96, 0.05);
  border-color: rgba(48, 64, 96, 0.15);
}

.checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.checklist-item-info {
  flex: 1;
  overflow: hidden;
}

.checklist-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-badge {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  background: #e2e8f0;
  color: var(--brand-dark);
}

.item-badge.env {
  background: var(--brand-accent-light);
  color: var(--brand-accent);
}

.checklist-item-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Custom Target Row */
.custom-target-row {
  margin-top: 8px;
}

.btn-toggle-custom {
  background: none;
  border: none;
  color: var(--brand-primary);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-toggle-custom:hover {
  color: var(--brand-dark);
}

.custom-input-box {
  margin-top: 6px;
}

/* Inputs */
.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--panel-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(80, 104, 144, 0.15);
}

.input-prefix {
  padding-left: 12px;
  color: var(--text-muted);
}

.input-wrapper input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
}

.btn-inside-input {
  background: #e2e8f0;
  border: none;
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 10px;
  margin-right: 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-inside-input:hover {
  background: #cbd5e1;
}

.input-helper {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.input-helper code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--brand-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
}

/* Group Drawer */
.group-select-drawer {
  margin-top: 8px;
  background: var(--panel-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drawer-close {
  cursor: pointer;
  font-size: 1.1rem;
}

.group-select-drawer select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

/* Drop Zone */
.drop-zone {
  position: relative;
  background: var(--panel-sub);
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.drop-zone:hover {
  border-color: var(--brand-primary-light);
  background: #f1f5f9;
}

.drop-zone.dragover {
  border-color: var(--brand-accent);
  background: var(--brand-accent-light);
}

.file-input-hidden {
  display: none;
}

.cloud-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.drop-text-main {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.accent-link {
  color: var(--brand-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.drop-text-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* File Preview Card */
.file-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: left;
}

.preview-media {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xs);
  background: var(--panel-sub);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.file-type-icon {
  color: var(--brand-primary);
}

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

.preview-meta {
  flex: 1;
  overflow: hidden;
}

.preview-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.preview-tags {
  display: flex;
  gap: 6px;
}

.badge-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  background: #e2e8f0;
  color: var(--brand-dark);
}

.badge-tag.size {
  background: var(--panel-sub);
  color: var(--text-muted);
}

.btn-cancel-file {
  background: #fee2e2;
  border: none;
  color: var(--status-error);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-cancel-file:hover {
  background: var(--status-error);
  color: #fff;
}

/* Formatting Toolbar */
.formatting-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--panel-sub);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
}

.btn-tool {
  background: #fff;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-tool:hover {
  border-color: var(--border-focus);
  background: var(--panel-sub);
}

.tool-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.btn-tag {
  background: #fff;
  border: 1px solid var(--border-light);
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-tag:hover {
  border-color: var(--brand-primary);
  background: rgba(48, 64, 96, 0.05);
}

.char-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.textarea-wrapper {
  background: var(--panel-sub);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  transition: all 0.2s;
}

.textarea-wrapper:focus-within {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(80, 104, 144, 0.15);
}

textarea {
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  min-height: 110px;
}

/* Submit Button */
.btn-submit-primary {
  width: 100%;
  background: var(--brand-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(176, 80, 48, 0.2);
  transition: all 0.2s;
  margin-top: 4px;
}

.btn-submit-primary:hover:not(:disabled) {
  background: var(--brand-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(176, 80, 48, 0.35);
}

.btn-submit-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Logs Panel */
.logs-panel {
  display: flex;
  flex-direction: column;
}

.btn-outline-text {
  background: var(--panel-sub);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline-text:hover {
  color: var(--status-error);
  border-color: #fca5a5;
  background: #fef2f2;
}

.filter-tab-bar {
  display: flex;
  gap: 6px;
  background: var(--panel-sub);
  padding: 4px;
  border-radius: var(--radius-xs);
  margin-bottom: 14px;
  border: 1px solid var(--border-light);
}

.filter-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.log-container {
  flex: 1;
  background: var(--panel-sub);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  min-height: 380px;
  max-height: 440px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.empty-icon-svg {
  color: var(--text-dim);
  margin-bottom: 10px;
}

.empty-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 0.76rem;
  color: var(--text-dim);
  max-width: 260px;
}

/* Log Card Element - Modern Dashboard */
.log-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-left: 3.5px solid var(--status-success);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: all 0.2s ease;
}

.log-card:hover {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
  border-color: var(--border-subtle);
}

.log-card.error {
  border-left-color: var(--status-error);
}

.log-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.log-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.log-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

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

.log-status-pill.error {
  background: var(--status-error-bg);
  color: var(--status-error);
}

.log-target-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--brand-primary);
  background: var(--panel-inner);
  border: 1px solid var(--border-light);
  padding: 2px 7px;
  border-radius: 999px;
}

.log-timestamp {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

.log-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-dark);
  word-break: break-word;
}

.log-title-icon {
  color: var(--brand-accent);
  flex-shrink: 0;
}

.log-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.log-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 5px;
  border-top: 1px dashed var(--border-light);
  margin-top: 1px;
}

.log-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  cursor: help;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #fff;
  border: 1px solid var(--border-light);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 400px;
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 500;
}

.toast.success { border-left: 4px solid var(--status-success); }
.toast.error { border-left: 4px solid var(--status-error); }
.toast.info { border-left: 4px solid var(--brand-primary); }

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 58, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.modal-icon-badge {
  color: var(--status-warn);
  margin-bottom: 12px;
}

.modal-heading {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 6px;
}

.modal-text {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.code-preview {
  margin: 16px 0;
  background: var(--panel-sub);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  text-align: left;
  overflow: hidden;
}

.code-header {
  background: #e2e8f0;
  padding: 4px 10px;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}

.code-preview code {
  display: block;
  padding: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--brand-primary);
  line-height: 1.5;
}

.modal-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn-modal-action {
  width: 100%;
  background: var(--brand-accent);
  color: #fff;
  border: none;
  padding: 11px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-modal-action:hover {
  background: var(--brand-accent-hover);
}

/* ==========================================
   Dynamic SOP Input & Chips
   ========================================== */
.sop-input-wrapper {
  margin-bottom: 8px;
}

.sop-input-wrapper input {
  width: 100%;
  padding: 11px 14px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

.sop-input-wrapper input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(48, 64, 96, 0.12);
}

/* ==========================================
   Right Panel Section Navigation Tabs
   ========================================== */
.panel-section-nav {
  display: flex;
  background: var(--panel-inner);
  padding: 3px;
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  gap: 3px;
}

.nav-section-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.nav-section-tab:hover {
  color: var(--text-primary);
}

.nav-section-tab.active {
  background: #ffffff;
  color: var(--brand-primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ==========================================
   Follow-Up Schedules Cards
   ========================================== */
.schedules-header-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.schedules-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 380px;
  max-height: 440px;
  overflow-y: auto;
}

.schedule-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.schedule-badge-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.schedule-badge-pill.pending {
  background: var(--status-warn-bg);
  color: var(--status-warn);
}

.schedule-badge-pill.completed {
  background: var(--status-success-bg);
  color: var(--status-success);
}

.schedule-badge-pill.cancelled {
  background: var(--status-error-bg);
  color: var(--status-error);
}

.schedule-date-time {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.schedule-doc-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.schedule-sop-target {
  font-size: 0.78rem;
  color: var(--brand-accent);
  font-weight: 600;
}

.schedule-outlet-target {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.schedule-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
}

.btn-schedule-action {
  background: var(--panel-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-schedule-action:hover {
  background: #ffffff;
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-schedule-action.primary {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.btn-schedule-action.primary:hover {
  background: #243048;
}

/* ==========================================
   Rekap Preview & Dry Run
   ========================================== */
.preview-controls-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.preview-select {
  flex: 1;
  padding: 7px 10px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
}

.preview-messages-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
}

.preview-outlet-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.preview-outlet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.preview-outlet-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.preview-chat-body {
  white-space: pre-wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  background: var(--panel-inner);
  padding: 10px;
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  max-height: 220px;
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

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