/* Forge UI Theme Stylesheet */

:root {
  --bg-color: #f9fafb; /* Premium off-white gray background */
  --bg-card: #ffffff; /* Solid white card base */
  --bg-card-hover: #f3f4f6; /* Subtle hover state */
  --bg-sidebar: #ffffff; /* Solid white sidebar */
  --border-color: #e5e7eb; /* Soft border separator */
  --border-focus: #818cf8; /* Indigo-400 focus */
  
  --text-main: #374151; /* Dark gray body text */
  --text-muted: #6b7280; /* Muted gray for subtitles */
  --text-dark: #111827; /* Rich black headings */
  
  --primary: #4f46e5; /* Indigo primary button/accent */
  --primary-glow: rgba(79, 70, 229, 0.05);
  --secondary: #0d9488; /* Teal secondary accent */
  --secondary-glow: rgba(13, 148, 136, 0.05);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.05);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.05);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.05);
  
  --font-sans: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  --sidebar-width: 260px; /* Reduced for extra sleekness */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px; /* Denser, sleeker default size */
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

/* Glassmorphism utility replaced by clean card layout */
.glass {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Auth / Login Container */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-color);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-logo-icon {
  width: 44px;
  height: 44px;
  stroke: var(--primary);
  filter: drop-shadow(0 0 6px var(--primary-glow));
}

.auth-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
}

.auth-header p {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.auth-prompt {
  font-size: 13.5px;
  color: var(--text-main);
  margin-bottom: 12px;
}

.error-banner {
  background: hsla(0, 84%, 48%, 0.08);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  margin-top: 12px;
  text-align: left;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.sidebar-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-dark);
}

.app-container .logo {
  cursor: pointer;
  user-select: none;
  transition: opacity var(--transition-fast);
}

.app-container .logo:hover {
  opacity: 0.85;
}

.logo-icon {
  stroke: var(--primary);
  width: 18px;
  height: 18px;
}

.sidebar-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px 14px;
}

.sidebar-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.apps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  position: relative;
  overflow: hidden;
}

.app-item:hover {
  background: var(--bg-color);
  border-color: hsl(214, 32%, 82%);
  transform: translateY(-1px);
}

.app-item.active {
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.06);
}

.app-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--primary);
}

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

.app-item-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-dark);
}

.app-item.active .app-item-name {
  color: var(--primary);
}

.app-item-platform {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: hsl(210, 20%, 92%);
  padding: 1px 5px;
  border-radius: 4px;
}

.app-item.active .app-item-platform {
  background: hsl(263, 85%, 92%);
  color: var(--primary);
}

.app-item-goal {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-item-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.app-item-status {
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.app-item-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}

.app-item-status-dot.active {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  animation: pulse-glow 1.5s infinite;
}

.app-item-status-dot.completed {
  background: var(--success);
}

.app-item-status-dot.failed {
  background: var(--error);
}

.app-item-time {
  font-size: 9px;
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafb;
  position: relative;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 24px;
  height: 24px;
  stroke: var(--text-muted);
  background: hsl(210, 20%, 90%);
  border-radius: 50%;
  padding: 3px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

#user-display-name {
  font-size: 12px;
  font-weight: 600;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.05em;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 15px;
  color: var(--text-muted);
  text-align: center;
  gap: 10px;
}

.empty-state i {
  width: 30px;
  height: 30px;
  stroke-width: 1.5;
}

.empty-state p {
  font-size: 12px;
}

/* Main Content Area Styling */
.main-content {
  flex-grow: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  height: 100%;
}

.content-panel {
  display: none;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn var(--transition-normal);
  height: 100%;
  min-height: 0;
}

.content-panel.active {
  display: flex;
}

#panel-welcome,
#panel-settings {
  overflow-y: auto;
  padding-right: 4px;
}

#panel-app-view {
  overflow: hidden;
}

/* Form Styles */
.welcome-header {
  margin-bottom: 4px;
}

.welcome-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-dark);
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.config-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 16px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  transition: all var(--transition-fast);
}

/* Make each field fill its row (a lone field — e.g. the goal — spans full width). */
.form-row > .form-group {
  flex: 1 1 0;
  min-width: 0;
}

.form-group textarea {
  resize: vertical;
}

/* The main goal field is the focal point of the create card — give it room. */
#form-goal {
  min-height: 130px;
  line-height: 1.55;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--bg-card);
}

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

.hint-block {
  margin-top: -4px;
}

.flex-row-align {
  justify-content: center;
  align-items: flex-start;
}

/* Settings Whitelist Panels */
.settings-grid {
  margin-top: 5px;
}

.settings-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 320px;
}

.card-header h3 {
  font-size: 16px;
  font-family: var(--font-heading);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
  color: var(--text-dark);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form input {
  flex-grow: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.inline-form input:focus {
  border-color: var(--primary);
}

.whitelist-list-container {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-color);
  padding: 8px;
  max-height: 180px;
}

.whitelist-ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.whitelist-li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 12.5px;
}

.whitelist-li:hover {
  background: var(--bg-color);
}

.whitelist-actions button {
  color: var(--error);
  font-size: 11px;
}

.whitelist-actions button:hover {
  color: #ff4b4b;
}

.system-info-body {
  justify-content: center;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-muted);
  font-size: 13px;
}

.info-value {
  font-weight: 600;
  font-size: 13px;
}

/* Checkbox Styling */
.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 24px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 1px;
  left: 0;
  height: 16px;
  width: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  background-color: var(--bg-color);
  border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 5px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px; /* base padding so un-sized buttons (Delete/Download/Resume) aren't cramped */
  font-size: 13px;
  font-family: var(--font-heading);
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(144, 59, 255, 0.3);
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.btn-secondary:hover {
  background: var(--bg-color);
  border-color: hsl(214, 32%, 80%);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--bg-card);
  border-color: var(--error);
  color: var(--error);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.btn-danger:hover {
  background: hsla(0, 84%, 48%, 0.05);
  border-color: var(--error);
  transform: translateY(-1px);
}

.btn-lg {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 4px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.icon-btn:hover {
  color: var(--text-dark);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

/* Feature Showcase */
.features-showcase {
  margin-top: 8px;
}

.feature-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-icon {
  width: 28px;
  height: 28px;
}

.feature-card h3 {
  font-size: 15px;
  font-family: var(--font-heading);
  color: var(--text-dark);
}

.feature-card p {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.text-cyan { color: var(--secondary); }
.text-purple { color: var(--primary); }
.text-emerald { color: var(--success); }

/* App View Panel Styles */
.app-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.app-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 55%;
}

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

.app-name-title h1 {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text-dark);
}

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--border-color);
  color: var(--text-muted);
}

#badge-platform.web,
.app-item-platform.web {
  background: hsla(340, 85%, 65%, 0.1) !important;
  color: hsl(340, 85%, 45%) !important;
}

#badge-platform.pwa,
.app-item-platform.pwa {
  background: hsla(150, 85%, 45%, 0.1) !important;
  color: hsl(150, 85%, 35%) !important;
}

#badge-platform.android,
.app-item-platform.android {
  background: hsla(215, 85%, 65%, 0.1) !important;
  color: hsl(215, 85%, 45%) !important;
}

#badge-platform.auto,
.app-item-platform.auto {
  background: hsla(270, 85%, 65%, 0.1) !important;
  color: hsl(270, 85%, 45%) !important;
}

.app-goal-text {
  color: var(--text-muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.deploy-action-container {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  gap: 8px;
  border-radius: 6px;
}

.deploy-status-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deploy-status-label a {
  color: var(--secondary);
  text-decoration: none;
  font-weight: 700;
  transition: color var(--transition-fast);
}

.deploy-status-label a:hover {
  color: hsl(190, 95%, 45%);
}

/* Metrics widget styling */
.metric-card {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left-width: 3px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.metric-card:nth-child(1) { border-left-color: var(--primary); }
.metric-card:nth-child(2) { border-left-color: var(--secondary); }
.metric-card:nth-child(3) { border-left-color: var(--warning); }
.metric-card:nth-child(4) { border-left-color: var(--success); }

.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-value-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text-dark);
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}

.status-indicator.active {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  animation: pulse-glow 1.5s infinite;
}

.status-indicator.completed {
  background: var(--success);
}

.status-indicator.failed {
  background: var(--error);
}

/* Progress track widget */
.progress-track-container {
  padding: 14px 18px;
}

.progress-track-container h3 {
  font-size: 12px;
  margin-bottom: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.progress-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 90px;
  position: relative;
  transition: all var(--transition-normal);
}

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-normal);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.step-circle i {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}

.step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-heading);
  text-align: center;
}

.step-verdict {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
}

.progress-step-connector {
  flex-grow: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 8px;
  margin-top: 13px;
  transition: background var(--transition-normal);
}

/* Active & complete styles for track */
.progress-step.completed .step-circle {
  background: hsla(145, 80%, 35%, 0.08);
  border-color: var(--success);
  color: var(--success);
}

.progress-step.completed .step-label {
  color: var(--text-dark);
}

.progress-step.completed .step-verdict {
  color: var(--success);
}

.progress-step.active .step-circle {
  background: hsla(263, 85%, 50%, 0.08);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.05);
  animation: pulse-glow-border 1.5s infinite;
}

.progress-step.active .step-label {
  color: var(--text-dark);
  font-weight: 700;
}

.progress-step.failed .step-circle {
  background: hsla(0, 84%, 48%, 0.08);
  border-color: var(--error);
  color: var(--error);
}

.progress-step.failed .step-verdict {
  color: var(--error);
}

.progress-step-connector.completed {
  background: var(--success);
}

.progress-step-connector.active {
  background: linear-gradient(90deg, var(--success) 0%, var(--primary) 100%);
  animation: sweep 2s linear infinite;
  background-size: 200% 100%;
}

/* Tabs structure styling */
.tabs-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
  overflow: hidden;
}

.tabs-header {
  display: flex;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0 8px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.tabs-header::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari/Edge */
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-dark);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tabs-content {
  flex-grow: 1;
  overflow: hidden;
  position: relative;
}

.tab-pane {
  display: none;
  height: 100%;
  width: 100%;
  overflow-y: auto;
  padding: 16px;
  position: absolute;
  top: 0;
  left: 0;
}

.tab-pane.active {
  display: block;
}

/* Combined Docs tab — labelled sections */
.doc-section { margin-bottom: 8px; }
.doc-section-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 18px;
  margin: 2px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.doc-section-hint {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}
.doc-divider {
  border: none;
  border-top: 1px dashed var(--border-color);
  margin: 28px 0;
}

/* Monospace terminal styling - remains dark */
#tab-logs {
  /* NOTE: don't set `display` here — an ID rule would beat `.tab-pane`/`.tab-pane.active`
     and keep the logs pane permanently visible, hiding every other tab. */
  background-color: #05070f;
  padding: 0;
  flex-direction: column;
}

/* Logs pane uses a column flex layout, but only when it's the active tab. */
#tab-logs.active {
  display: flex;
}

/* Play App Tab & Empty State Styling */
#tab-play {
  padding: 0;
  flex-direction: column;
}

#tab-play.active {
  display: flex;
}

#tab-play-empty {
  flex-grow: 1;
  height: 100% !important;
}

.terminal-controls {
  padding: 8px 14px;
  background: #0d1222;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.terminal-title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: hsl(215, 20%, 65%);
}

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

.text-xs { font-size: 11px; }

.terminal-viewport {
  flex-grow: 1;
  overflow-y: auto;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: #ced9ee;
  background-color: #05070f;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Markdown Documents Stylings */
.markdown-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-main);
  padding: 16px 20px;
  background-color: var(--bg-card);
}

.markdown-body h1, 
.markdown-body h2, 
.markdown-body h3, 
.markdown-body h4 {
  color: var(--text-dark);
  margin-top: 18px;
  margin-bottom: 8px;
}

.markdown-body h1 { font-size: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.markdown-body h2 { font-size: 16px; }
.markdown-body h3 { font-size: 14px; }

.markdown-body p {
  margin-bottom: 10px;
}

.markdown-body ul,
.markdown-body ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background-color: hsl(210, 20%, 94%);
  padding: 2px 4px;
  border-radius: 4px;
  color: hsl(263, 85%, 40%);
}

.markdown-body pre {
  background-color: hsl(210, 20%, 96%);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: var(--text-main);
  font-size: 12px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--primary);
  background: hsla(263, 90%, 50%, 0.04);
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 0 4px 4px 0;
}

/* Alert calls formatted like blockquotes */
.markdown-body blockquote.alert-note { border-left-color: var(--secondary); background: hsla(190, 95%, 35%, 0.04); }
.markdown-body blockquote.alert-tip { border-left-color: var(--success); background: hsla(145, 80%, 35%, 0.04); }
.markdown-body blockquote.alert-important { border-left-color: var(--primary); background: hsla(263, 90%, 50%, 0.04); }
.markdown-body blockquote.alert-warning { border-left-color: var(--warning); background: hsla(38, 92%, 40%, 0.04); }

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  text-align: left;
}

.markdown-body th {
  background: hsl(210, 20%, 96%);
  font-weight: 600;
  color: var(--text-dark);
}

.doc-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-glow-border {
  0% { box-shadow: 0 0 6px var(--primary-glow); }
  50% { box-shadow: 0 0 14px hsla(263, 85%, 50%, 0.4); border-color: hsl(263, 85%, 70%); }
  100% { box-shadow: 0 0 6px var(--primary-glow); }
}

@keyframes sweep {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: hsl(210, 8%, 85%);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: hsl(210, 8%, 75%);
}

/* Terminal search styles - dark container */
.search-box-container {
  display: flex;
  align-items: center;
  position: relative;
  margin-right: 8px;
}

.search-icon {
  width: 12px !important;
  height: 12px !important;
  stroke: hsl(215, 20%, 65%);
  position: absolute;
  left: 8px;
}

.terminal-search-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 4px 8px 4px 24px;
  color: #ced9ee;
  font-size: 11px;
  width: 120px;
  transition: all var(--transition-fast);
  outline: none;
}

.terminal-search-input:focus {
  border-color: var(--primary);
  width: 170px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Integrated Browser Simulator */
.browser-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  overflow: hidden;
}

.browser-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.browser-dots {
  display: flex;
  gap: 5px;
}

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

.dot.red { background-color: #ef4444; }
.dot.yellow { background-color: #f59e0b; }
.dot.green { background-color: #10b981; }

.browser-address-bar {
  display: flex;
  align-items: center;
  flex-grow: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 3px 10px;
  gap: 6px;
  max-width: 60%;
}

.address-lock-icon {
  width: 11px !important;
  height: 11px !important;
  stroke: var(--success);
}

#browser-url-input {
  background: none;
  border: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 11px;
  width: 100%;
  outline: none;
}

.browser-viewports {
  display: flex;
  gap: 4px;
  background: hsl(210, 20%, 92%);
  padding: 2px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.viewport-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.viewport-btn:hover {
  color: var(--text-dark);
  background: var(--bg-card);
}

.viewport-btn.active {
  color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.viewport-btn i {
  width: 12px !important;
  height: 12px !important;
}

.browser-viewport-wrapper {
  flex-grow: 1;
  background: hsl(210, 20%, 94%);
  display: flex;
  /* Centering flex items safely without cut-off using margin: auto on the item */
  padding: 12px;
  overflow: auto;
  min-height: 400px;
}

#app-preview-iframe {
  margin: auto; /* Centering helper inside browser-viewport-wrapper */
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-normal);
}

/* Viewport sizes */
.browser-viewport-wrapper.desktop #app-preview-iframe {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.browser-viewport-wrapper.tablet #app-preview-iframe {
  width: 768px;
  height: 100%;
  min-height: 500px;
  max-height: 100%;
  border: 6px solid #1e293b;
  border-radius: 12px;
}

.browser-viewport-wrapper.mobile #app-preview-iframe {
  width: 375px;
  height: 100%;
  min-height: 500px;
  max-height: 100%;
  border: 6px solid #1e293b;
  border-radius: 16px;
}

.icon-spin {
  animation: spin 1s linear infinite;
}

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

/* Responsive Styling for Mobile Views */
.mobile-header {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  body {
    overflow: auto;
    height: auto;
  }

  .app-container {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
    height: 56px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.08);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    padding: 16px 14px;
    overflow-y: visible;
    height: auto;
  }

  /* Compact grid structures on mobile */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .dashboard-metrics.grid-4 {
    grid-template-columns: 1fr 1fr; /* Display metrics side-by-side but compact */
    gap: 10px;
  }

  .app-view-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .app-title-group {
    max-width: 100%;
  }

  .app-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .app-actions button, 
  .deploy-action-container {
    flex-grow: 1;
    justify-content: center;
  }

  .deploy-action-container {
    flex-basis: 100%; /* Force wrap or expand fully */
    justify-content: space-between;
  }

  /* Stepper track scrolling */
  .progress-track-container {
    overflow-x: auto;
    padding: 12px 14px;
  }

  .progress-steps {
    width: 580px; /* Force minimum width to prevent shrinking */
  }

  /* Tabs heading responsiveness */
  .tabs-container {
    height: auto; /* Allow natural expansion instead of rigid scrolling */
    max-height: none;
  }

  .tabs-header {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 12.5px;
  }

  .tab-pane {
    position: static;
    height: auto;
    overflow-y: visible;
    padding: 12px 6px;
  }

  /* Browser preview responsive fixes */
  .browser-container {
    height: 520px;
  }

  .browser-address-bar {
    max-width: 100%;
  }

  .browser-viewport-wrapper {
    min-height: 350px;
  }

  /* Auth page responsive tweaks */
  .auth-card {
    padding: 24px 16px;
  }
}

/* Custom Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn var(--transition-fast);
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp var(--transition-normal);
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
}

.modal-icon {
  width: 20px;
  height: 20px;
  stroke: var(--primary);
  display: inline-flex;
  align-items: center;
}

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

.modal-body {
  padding: 20px;
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.5;
}

.modal-footer {
  padding: 12px 20px;
  background: var(--bg-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Hunch Theme Styles (Dark Cyberpunk / Vibrant Mode) */
body.theme-hunch {
  --bg-color: #090d16;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --bg-sidebar: #0b0f19;
  --border-color: #1e293b;
  --border-focus: #ec4899;
  
  --text-main: #94a3b8;
  --text-muted: #64748b;
  --text-dark: #f8fafc;
  
  --primary: #d946ef;
  --primary-glow: rgba(217, 70, 239, 0.15);
  --secondary: #06b6d4;
  --secondary-glow: rgba(6, 182, 212, 0.15);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --warning: #fbbf24;
  --warning-glow: rgba(251, 191, 36, 0.15);
  --error: #f43f5e;
  --error-glow: rgba(244, 63, 94, 0.15);
}

body.theme-hunch .glass {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.theme-hunch .sidebar-footer {
  background: #0b0f19;
}

body.theme-hunch .terminal-viewport {
  background-color: #06080e;
  color: #a5b4fc;
}

body.theme-hunch .terminal-controls {
  background: #0b0f19;
}

body.theme-hunch .modal-footer {
  background: #0b0f19;
}

body.theme-hunch .app-item.active {
  box-shadow: 0 4px 16px rgba(217, 70, 239, 0.1);
}

body.theme-hunch .btn-primary {
  background: linear-gradient(135deg, #d946ef 0%, #ec4899 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 70, 239, 0.3);
}

body.theme-hunch .btn-primary:hover {
  box-shadow: 0 6px 20px rgba(217, 70, 239, 0.5);
  filter: brightness(1.1);
}

/* Nordic Theme Styles (Dark Frost / Icy Mode) */
body.theme-nordic {
  --bg-color: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-sidebar: #0f172a;
  --border-color: #334155;
  --border-focus: #38bdf8;
  
  --text-main: #cbd5e1;
  --text-muted: #64748b;
  --text-dark: #f8fafc;
  
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.15);
  --secondary: #0ea5e9;
  --secondary-glow: rgba(14, 165, 233, 0.15);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.15);
  --error: #ef4444;
  --error-glow: rgba(239, 68, 68, 0.15);
}

body.theme-nordic .glass {
  background: rgba(30, 41, 59, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.theme-nordic .sidebar-footer {
  background: #0f172a;
}

body.theme-nordic .terminal-viewport {
  background-color: #0b0f19;
  color: #bae6fd;
}

body.theme-nordic .terminal-controls {
  background: #0f172a;
}

body.theme-nordic .modal-footer {
  background: #0f172a;
}

body.theme-nordic .app-item.active {
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.1);
}

body.theme-nordic .btn-primary {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

body.theme-nordic .btn-primary:hover {
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
  filter: brightness(1.1);
}



/* Desert Amber Theme Styles (Warm Sandy Light / Amber Mode) */
body.theme-desert {
  --bg-color: #fbf7f0;
  --bg-card: #ffffff;
  --bg-card-hover: #f5eedc;
  --bg-sidebar: #faf5eb;
  --border-color: #e6dfd3;
  --border-focus: #d97706;
  
  --text-main: #4a3e3d;
  --text-muted: #7c6e65;
  --text-dark: #1e1b18;
  
  --primary: #d97706;
  --primary-glow: rgba(217, 119, 6, 0.1);
  --secondary: #0d9488;
  --secondary-glow: rgba(13, 148, 136, 0.1);
  
  --success: #16a34a;
  --success-glow: rgba(22, 163, 74, 0.1);
  --warning: #ea580c;
  --warning-glow: rgba(234, 88, 12, 0.1);
  --error: #dc2626;
  --error-glow: rgba(220, 38, 38, 0.1);
}

body.theme-desert .glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

body.theme-desert .sidebar-footer {
  background: #faf5eb;
}

body.theme-desert .terminal-viewport {
  background-color: #efe8da;
  color: #3a2f2e;
}

body.theme-desert .terminal-controls {
  background: #faf5eb;
}

body.theme-desert .modal-footer {
  background: #faf5eb;
}

body.theme-desert .app-item.active {
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.15);
}

body.theme-desert .btn-primary {
  background: linear-gradient(135deg, #d97706 0%, #ea580c 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25);
}

body.theme-desert .btn-primary:hover {
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.4);
  filter: brightness(1.08);
}



/* Theme picker popover */
.theme-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 14px;
  width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 100;
  padding: 6px;
  display: flex;
  flex-direction: column;
}

.theme-menu.hidden {
  display: none !important;
}

.theme-menu-title {
  font-family: var(--font-heading);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.theme-menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.theme-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-dark);
}

.theme-item.active {
  border-color: var(--primary);
  background: var(--primary-glow);
  color: var(--text-dark);
}

.theme-swatch {
  display: inline-flex;
  width: 30px;
  height: 15px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.theme-swatch span {
  display: block;
  flex: 1;
  height: 100%;
}

.theme-item .label {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 12px;
}

.theme-item .check {
  margin-left: auto;
  color: var(--primary);
  font-size: 10px;
  opacity: 0;
}

.theme-item.active .check {
  opacity: 1;
}

/* ============================================================
   Focused responsive polish — concise & touch-friendly on mobile,
   untouched on desktop. (Loaded last so these win on small screens.)
   ============================================================ */
@media (max-width: 768px) {
  /* Trim decorative weight so the working area dominates */
  .features-showcase { display: none; }
  .welcome-header h1 { font-size: 22px; }
  .welcome-header .subtitle { font-size: 13px; }
  .config-form { padding: 16px; }
  .app-goal-text { font-size: 13px; }

  /* Comfortable tap targets (Apple/Material ~44px) */
  .icon-btn { min-width: 40px; min-height: 40px; }
  .btn-sm, .btn-xs { min-height: 36px; }
  .tab-btn { scroll-snap-align: start; }
  .tabs-header { scroll-snap-type: x proximity; }
}

@media (max-width: 480px) {
  body { font-size: 13px; }
  .main-content { padding: 12px 10px; }

  .dashboard-metrics.grid-4 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 10px 12px; }
  .metric-value { font-size: 15px; }

  .app-name-title h1, .welcome-header h1 { font-size: 20px; }
  .app-actions button { flex-grow: 1; justify-content: center; font-size: 12.5px; padding: 8px 10px; }

  /* Iterate row: let the button wrap full-width under the input on tiny screens */
  #form-iterate-app > div { flex-wrap: wrap; }
  #form-iterate-app #btn-submit-iterate { flex-grow: 1; }

  .auth-card { padding: 20px 14px; }
  .modal-card { max-width: 100%; }
  .browser-container { height: 60vh; }
  .progress-steps { width: 520px; } /* a touch narrower; still scrolls */
}

/* Disabled states styling */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed !important;
  pointer-events: none;
  box-shadow: none !important;
  transform: none !important;
}

.checkbox-container:has(input:disabled) {
  color: var(--text-muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-container input:disabled ~ .checkmark {
  background-color: var(--border-color);
  opacity: 0.5;
  cursor: not-allowed;
}

/* Button colors */
.btn-success {
  background: var(--success);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px var(--success-glow);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  filter: brightness(1.08);
}

.btn-success:active {
  transform: translateY(1px);
}

.btn-danger-solid {
  background: var(--error);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px var(--error-glow);
}

.btn-danger-solid:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  filter: brightness(1.08);
}

.btn-danger-solid:active {
  transform: translateY(1px);
}

/* Telegram login widget: fade the iframe in over the held spinner */
#telegram-widget-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  width: 100%;
}

.tg-spinner {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.tg-spinner-icon {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: tg-spin 0.8s linear infinite;
}

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

#telegram-widget-container iframe {
  opacity: 0;
  transition: opacity 0.3s ease;
}

#telegram-widget-container.tg-loaded iframe {
  opacity: 1;
}
