:root {
  color-scheme: dark;
  --bg-primary: #0b0f19;
  --bg-secondary: #131d31;
  --bg-tertiary: #1e293b;
  --card-bg: rgba(22, 33, 53, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(37, 211, 102, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #25d366; /* WhatsApp Emerald */
  --accent-hover: #20bd5a;
  --accent-light: rgba(37, 211, 102, 0.12);
  --accent-glow: rgba(37, 211, 102, 0.35);

  --blue-accent: #38bdf8;
  --blue-light: rgba(56, 189, 248, 0.12);
  --purple-accent: #a855f7;
  --purple-light: rgba(168, 85, 247, 0.12);

  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);

  --border: #243048;
  --border-focus: #25d366;

  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(37, 211, 102, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(56, 189, 248, 0.04) 0%, transparent 40%);
}

/* Ambient glow orbs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.glow-1 {
  top: -100px;
  left: 20%;
  width: 450px;
  height: 450px;
  background: rgba(37, 211, 102, 0.08);
}
.glow-2 {
  bottom: -150px;
  right: 15%;
  width: 500px;
  height: 500px;
  background: rgba(56, 189, 248, 0.06);
}

.app-container {
  max-width: 1380px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Glass Panels */
.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Header */
.app-header {
  padding: 20px 24px;
  margin-bottom: 24px;
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  font-size: 34px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(56, 189, 248, 0.2));
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid rgba(37, 211, 102, 0.3);
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.2);
}

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

.app-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #d1fae5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  background: var(--accent);
  color: #04260e !important;
  -webkit-text-fill-color: #04260e !important;
  padding: 3px 9px;
  border-radius: 12px;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.4);
  vertical-align: middle;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.header-exit-area {
  display: flex;
  align-items: center;
  margin-left: 12px;
}

.btn-close-program-prominent {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22) 0%, rgba(185, 28, 28, 0.38) 100%);
  border: 1.5px solid rgba(239, 68, 68, 0.65);
  color: #fee2e2;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
  white-space: nowrap;
}

.btn-close-program-prominent .btn-close-icon {
  font-size: 18px;
}

.btn-close-program-prominent:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.55);
  transform: translateY(-2px);
}

.btn-close-program-prominent:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

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

/* User Profile Header Badge */
.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 4px 10px 4px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.user-profile-badge .user-name {
  color: #ffffff;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout-pill {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout-pill:hover {
  background: #ef4444;
  color: #ffffff;
}

.btn-header-action.btn-highlight {
  background: rgba(37, 211, 102, 0.15);
  border-color: rgba(37, 211, 102, 0.4);
  color: var(--accent);
}

.btn-header-action.btn-highlight:hover {
  background: var(--accent);
  color: #03210d;
}

/* Template Select Row & Actions */
.template-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.btn-template-action {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-template-action:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-template-action.btn-danger-action {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-template-action.btn-danger-action:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ffffff;
}

.btn-header-action {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-header-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.2);
}

.btn-header-action.btn-subtle {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-header-action.btn-subtle:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-header-action.btn-danger-action {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-header-action.btn-danger-action:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.4);
}

.btn-header-action.rotating .action-icon {
  animation: spin 1s linear infinite;
}

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

.badge-pill {
  font-size: 10px;
  background: var(--accent);
  color: #04260e;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 800;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.7); }
.dot-yellow { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.7); }
.dot-red { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.7); }
.dot-blue { background: #38bdf8; box-shadow: 0 0 8px rgba(56, 189, 248, 0.7); }
.dot-gray { background: #64748b; }

/* Grid Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

.left-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Generic Card */
.card {
  padding: 24px;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* AI Settings Card */
.ai-settings-card {
  border-left: 3px solid var(--accent);
}

.card-header-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-group .card-title {
  margin-bottom: 0;
}

.card-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(37, 211, 102, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
}

.btn-collapse {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.2s;
}

.btn-collapse.collapsed {
  transform: rotate(-90deg);
}

.ai-card-body {
  margin-top: 16px;
  transition: all 0.3s;
}

.ai-card-body.collapsed {
  display: none;
}

.ai-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .ai-grid-row {
    grid-template-columns: 1fr;
  }
}

.input-with-button {
  display: flex;
  position: relative;
}

.btn-inner-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.btn-inner-toggle:hover {
  opacity: 1;
}

.key-status-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

.ai-button-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn-secondary {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--text-muted);
}

.btn-test-ai:hover {
  border-color: var(--blue-accent);
  color: var(--blue-accent);
  background: var(--blue-light);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.btn-save-ai:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.2);
}

.ai-test-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.5;
  animation: fadeIn 0.25s ease-out;
}

.ai-test-box.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.ai-test-box.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
}

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

.field-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.sub-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: block;
  font-weight: 600;
}

.preset-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-preset {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-preset.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.35);
}

.dropdown-row {
  margin-bottom: 12px;
}

.select-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2325d366' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 38px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-control {
  width: 100%;
  background: rgba(11, 15, 25, 0.8);
  border: 1px solid var(--border);
  color: var(--text-primary);
  color-scheme: dark;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

/* Date and Time Picker Indicators (Guaranteed High Contrast & Visible in All Browsers) */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: brightness(0) invert(1) !important;
  cursor: pointer !important;
  opacity: 1 !important;
  background-color: rgba(37, 211, 102, 0.25) !important;
  border: 1px solid rgba(37, 211, 102, 0.5) !important;
  padding: 5px 8px !important;
  border-radius: 6px !important;
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.2) !important;
  margin-right: -2px;
  transition: all 0.2s ease !important;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  background-color: rgba(37, 211, 102, 0.45) !important;
  border-color: #25d366 !important;
  box-shadow: 0 0 16px rgba(37, 211, 102, 0.5) !important;
  transform: scale(1.08);
}

.font-mono {
  font-family: var(--font-mono) !important;
}

.link-external {
  color: var(--blue-accent);
  font-size: 11px;
  text-decoration: none;
  font-weight: 600;
}

.link-external:hover {
  text-decoration: underline;
}

/* Radio Cards */
.radio-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(11, 15, 25, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.radio-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(11, 15, 25, 0.8);
}

.radio-card input[type="radio"] {
  margin-top: 4px;
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.radio-card:has(input[type="radio"]:checked) {
  border-color: var(--accent);
  background: rgba(37, 211, 102, 0.06);
  box-shadow: 0 0 15px rgba(37, 211, 102, 0.15);
}

.radio-content {
  flex: 1;
}

.radio-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.radio-icon {
  font-size: 16px;
}

.radio-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.radio-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Custom Filter Panel */
.custom-filter-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-panel {
  background: rgba(11, 15, 25, 0.85);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-left: 10px;
  animation: panelSlideDown 0.25s ease-out;
}

@keyframes panelSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Template Sub-Panel (User Request #3: Preserve format or upload/change) */
.format-option-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-sub-panel {
  background: rgba(11, 15, 25, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.template-mode-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.sub-radio-label input[type="radio"] {
  accent-color: var(--accent);
}

/* Template Dropzone */
.template-dropzone {
  border: 2px dashed rgba(37, 211, 102, 0.4);
  background: rgba(37, 211, 102, 0.03);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.template-dropzone:hover {
  border-color: var(--accent);
  background: rgba(37, 211, 102, 0.08);
}

.dropzone-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 6px;
}

.dropzone-title {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dropzone-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.template-active-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  font-size: 12px;
}

.btn-badge-clear {
  background: transparent;
  border: none;
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
}

/* Progress Tracker (Bug Fix: Freeze protection & visual progress) */
.progress-section {
  margin-top: 16px;
  margin-bottom: 10px;
  background: rgba(11, 15, 25, 0.7);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  animation: fadeIn 0.25s ease-out;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.progress-label {
  color: var(--accent);
}

.progress-percent {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #25d366, #38bdf8);
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.6);
  transition: width 0.4s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background-image: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  background-size: 20px 20px;
  animation: moveStripes 1s linear infinite;
}

@keyframes moveStripes {
  0% { background-position: 0 0; }
  100% { background-position: 20px 20px; }
}

.progress-cancel-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.btn-cancel-task {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.btn-cancel-task:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-cancel-task:active {
  transform: translateY(0);
}

.btn-cancel-task:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Action Button */
.action-area {
  margin-top: 14px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #25d366 0%, #10b981 100%);
  color: #04260e;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.35);
  letter-spacing: -0.01em;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2ae06e 0%, #059669 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.45);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(37, 211, 102, 0.3);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* QR Card */
.qr-card {
  text-align: center;
  border-color: rgba(245, 158, 11, 0.4);
}

.qr-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.4;
}

.qr-image-wrapper {
  display: inline-block;
  background: white;
  padding: 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.qr-image-wrapper img {
  display: block;
  width: 240px;
  height: 240px;
}

/* Console Card */
.console-card {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

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

.console-header .card-title {
  margin-bottom: 0;
}

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

.console-pulse-indicator {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.btn-text-only {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-text-only:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.console-output {
  flex: 1;
  background: rgba(7, 10, 18, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.console-output::-webkit-scrollbar {
  width: 6px;
}
.console-output::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.log-line {
  word-break: break-word;
}
.log-info { color: #94a3b8; }
.log-success { color: #34d399; font-weight: 500; }
.log-warn { color: #fbbf24; }
.log-error { color: #f87171; font-weight: 600; }

/* Result Card */
.result-card {
  border-color: rgba(37, 211, 102, 0.4);
  animation: fadeIn 0.3s ease-out;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.result-header .card-title {
  margin-bottom: 2px;
}

.result-file-path {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action-pill {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.2);
}

.result-preview {
  background: rgba(7, 10, 18, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  color: #e2e8f0;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.glass-modal {
  background: rgba(19, 29, 49, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  max-width: 580px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-large {
  max-width: 720px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon {
  font-size: 28px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
}

.terms-scroll::-webkit-scrollbar {
  width: 6px;
}
.terms-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.terms-section {
  margin-bottom: 18px;
}

.terms-section h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.terms-section p {
  color: var(--text-secondary);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(11, 15, 25, 0.4);
}

.btn-deny {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-deny:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
}

.btn-allow {
  width: auto;
  padding: 10px 24px;
}

/* Release Notes */
.release-item {
  margin-bottom: 24px;
}

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

.version-badge {
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 3px 10px;
  border-radius: 12px;
}

.version-badge.badge-latest {
  background: var(--accent);
  color: #04260e;
}

.release-date {
  font-size: 12px;
  color: var(--text-muted);
}

.release-list {
  padding-left: 20px;
  color: var(--text-secondary);
}

.release-list li {
  margin-bottom: 8px;
}

/* Shutdown Overlay */
.shutdown-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3, 7, 18, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.shutdown-card {
  text-align: center;
  padding: 36px 32px;
  max-width: 480px;
  border-color: rgba(239, 68, 68, 0.3);
}

.shutdown-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.shutdown-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.shutdown-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.shutdown-sub {
  color: var(--text-muted) !important;
  font-size: 12px !important;
}

/* Locked UI helper */
.ui-denied-lock {
  pointer-events: none;
  opacity: 0.4;
  filter: grayscale(0.8);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* Dedicated Individual Program Exit Section */
.app-footer {
  margin-top: 40px;
  margin-bottom: 24px;
}

.footer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.footer-info {
  flex: 1;
}

.footer-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.footer-icon {
  font-size: 22px;
}

.footer-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.footer-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.btn-close-program-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 36px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border: 2px solid rgba(254, 202, 202, 0.4);
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.45);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-close-program-large .btn-close-icon {
  font-size: 22px;
}

.btn-close-program-large:hover {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  border-color: #ffffff;
  box-shadow: 0 10px 32px rgba(239, 68, 68, 0.7);
  transform: translateY(-3px) scale(1.02);
}

.btn-close-program-large:active {
  transform: translateY(0) scale(1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

@media (max-width: 768px) {
  .footer-card {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }
  .footer-title-row {
    justify-content: center;
  }
  .btn-close-program-large {
    width: 100%;
    justify-content: center;
  }
}

