/* ============================================================
   ThaiTicketMajor Seat Helper — Premium Stylesheet v2
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Design tokens (light mode) ---------- */
:root {
  --primary:        #ff3b5c;
  --primary-dark:   #c9002a;
  --primary-light:  #ff6b84;
  --accent:         #7c3aed;
  --accent-light:   #a78bfa;

  --bg:             #f0f2f8;
  --surface:        #ffffff;
  --surface-2:      #f8f9fc;
  --border:         #e2e8f0;
  --border-focus:   #7c3aed;

  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-subtle:    #94a3b8;

  --success:        #059669;
  --success-bg:     #d1fae5;
  --success-border: #6ee7b7;
  --warning-bg:     #fef3c7;
  --warning-border: #f59e0b;
  --error-bg:       #fee2e2;
  --error-border:   #f87171;
  --error-text:     #991b1b;

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 4px 20px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08);

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --header-h: 72px;

  /* Code editor */
  --code-bg:   #0f0f1a;
  --code-fg:   #cdd6f4;
  --code-line: #1e1e2e;
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] {
  --bg:         #0b0e1a;
  --surface:    #131829;
  --surface-2:  #1a1f35;
  --border:     #2a3050;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --text-subtle:#64748b;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.20);
  --shadow:     0 4px 20px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.25);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.45), 0 4px 12px rgba(0,0,0,.3);
}

/* ---------- Base ---------- */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ---------- Sticky top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s, border-color 0.3s;
}

[data-theme="dark"] .topbar {
  background: rgba(11,14,26,0.85);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.topbar-brand .brand-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.topbar-brand .brand-sub {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme toggle button */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--border); transform: scale(1.1); }

/* Pill badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-red  { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-green { background: var(--success-bg); color: #065f46; }

[data-theme="dark"] .badge-red    { background: #450a0a; color: #fca5a5; }
[data-theme="dark"] .badge-purple { background: #2e1065; color: #c4b5fd; }
[data-theme="dark"] .badge-green  { background: #022c22; color: #6ee7b7; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,.22) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 90% 80%,  rgba(255,59,92,.18) 0%, transparent 60%),
    var(--bg);
  padding: 3.5rem 1rem 2.5rem;
  text-align: center;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: var(--text);
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  margin-top: 0.75rem;
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ---------- Disclaimer ---------- */
.disclaimer {
  background: var(--warning-bg);
  border-left: 4px solid var(--warning-border);
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  color: #78350f;
}
[data-theme="dark"] .disclaimer {
  background: #2d1f06;
  color: #fde68a;
}
.disclaimer strong { display: block; margin-bottom: 0.2rem; }

/* ---------- Container ---------- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ---------- Feature strip ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}
@media (max-width: 640px) {
  .features { grid-template-columns: 1fr; }
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.feature-icon {
  font-size: 1.6rem;
  line-height: 1;
}
.feature-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.feature-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-top: 1.5rem;
  transition: background 0.3s, border-color 0.3s;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  margin-bottom: 0;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0.3rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
}

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

.tab-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .tab-btn.active {
  background: var(--surface-2);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 580px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.5;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.3s;
}

.input-wrap input { padding-left: 2.3rem; }

input:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}

[data-theme="dark"] input,
[data-theme="dark"] select {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* Slider */
.range-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--range-pct,20%), var(--border) var(--range-pct,20%));
  border: none;
  outline: none;
  cursor: pointer;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.range-value {
  min-width: 1.8rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
}

/* Credential notice */
.credential-notice {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.82rem;
  color: #1e40af;
}
[data-theme="dark"] .credential-notice {
  background: #0f1e3d;
  border-color: #1d4ed8;
  color: #93c5fd;
}
.credential-notice .notice-icon {
  flex-shrink: 0;
  font-size: 0.95rem;
  margin-top: 0.1rem;
}

/* Toggle row */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  grid-column: 1 / -1;
}

/* Custom toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s var(--ease-spring);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 0.88rem; font-weight: 500; color: var(--text); cursor: pointer; }

/* ---------- Buttons ---------- */
.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
button:active { transform: scale(0.97) !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 0.7rem 1.6rem;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(255,59,92,.35);
  border-radius: var(--radius-sm);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255,59,92,.45);
}

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

/* Spinner inside button */
.btn-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-primary.loading .btn-spinner { display: inline-block; }
.btn-primary.loading .btn-label { opacity: 0.7; }

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  padding: 0.65rem 1.2rem;
  font-size: 0.88rem;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-subtle); color: var(--text); }

.btn-copy {
  background: var(--success-bg);
  color: var(--success);
  border: 1.5px solid var(--success-border);
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
}
.btn-copy:hover { background: #a7f3d0; }
.btn-copy:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Validation error box ---------- */
.error-box {
  display: none;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--error-text);
}
[data-theme="dark"] .error-box {
  background: #2d0a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

/* ---------- Output section ---------- */
.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.output-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.output-lang-badge {
  padding: 0.15em 0.6em;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lang-js     { background: #fef9c3; color: #713f12; }
.lang-python { background: #e0f2fe; color: #0c4a6e; }
[data-theme="dark"] .lang-js     { background: #422006; color: #fde68a; }
[data-theme="dark"] .lang-python { background: #082f49; color: #7dd3fc; }

/* Code editor area */
.code-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #2a2a3e;
}

.code-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  background: #1a1a2e;
  border-bottom: 1px solid #2a2a3e;
}
.code-dot { width: 11px; height: 11px; border-radius: 50%; }
.code-dot-red  { background: #ff5f57; }
.code-dot-yel  { background: #ffbd2e; }
.code-dot-grn  { background: #28c840; }
.code-file {
  margin-left: 0.4rem;
  font-size: 0.76rem;
  color: #585b70;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

#script-output,
#py-script-output {
  display: block;
  width: 100%;
  min-height: 260px;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border: none;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  resize: vertical;
  white-space: pre;
  overflow: auto;
  outline: none;
  tab-size: 2;
}

.placeholder-text {
  padding: 2.5rem 1.5rem;
  background: var(--code-bg);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}
.placeholder-text .ph-icon { font-size: 2.5rem; opacity: 0.35; }
.placeholder-text p { font-size: 0.82rem; color: #585b70; max-width: 300px; }

.copy-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.6rem;
  gap: 0.55rem;
  align-items: center;
}

#copy-status, #py-copy-status {
  font-size: 0.8rem;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.3s;
}
#copy-status.visible,
#py-copy-status.visible { opacity: 1; }

/* ---------- Toast notification ---------- */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.1rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  max-width: 320px;
  animation: toastIn 0.35s var(--ease-spring) both;
  pointer-events: auto;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--primary); }
.toast.fade-out { animation: toastOut 0.3s var(--ease-out) both; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(60px) scale(0.95); }
}

/* ---------- Instructions ---------- */
.steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.steps li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  position: relative;
  padding-bottom: 1.2rem;
}

.steps li:last-child { padding-bottom: 0; }

/* Connecting vertical line */
.steps li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), var(--accent));
  opacity: 0.25;
}

.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(255,59,92,.3);
  flex-shrink: 0;
}

.step-text {
  font-size: 0.9rem;
  padding-top: 0.35rem;
  color: var(--text);
  line-height: 1.5;
}

.step-text code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.45em;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.82em;
  color: var(--accent);
}
[data-theme="dark"] .step-text code { color: var(--accent-light); }

/* ---------- Credits ---------- */
.credits {
  font-size: 0.855rem;
  color: var(--text-muted);
  line-height: 1.75;
}
.credits a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.credits a:hover { text-decoration: underline; }

.credit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.9rem;
}
@media (max-width: 480px) {
  .credit-grid { grid-template-columns: 1fr; }
}

.credit-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.2s;
}
.credit-item:hover { border-color: var(--accent-light); }
.credit-item a { font-size: 0.875rem; }
.credit-item span { font-size: 0.78rem; color: var(--text-subtle); }

/* ---------- Section divider ---------- */
.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-subtle);
  margin: 1.75rem 0 0;
}
.section-label::before, .section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-top: 2.5rem;
  padding: 1.25rem 1rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- Utility ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* ---------- Animations for card entrance ---------- */
.card {
  animation: fadeUp 0.45s var(--ease-out) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.10s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5) { animation-delay: 0.20s; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .hero { padding: 2.5rem 1rem 2rem; }
  .topbar-brand .brand-sub { display: none; }
  .card { padding: 1.25rem; }
  .tabs { flex-direction: column; }
  #script-output, #py-script-output { font-size: 0.72rem; }
}

/* ================================================================
   Electron-only / Desktop App additions
   ================================================================ */

/* ---------- Run Now button (topbar) ---------- */
.btn-run-topbar {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(255,59,92,.3);
  transition: all 0.18s var(--ease-out);
}
.btn-run-topbar:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255,59,92,.4); }
.btn-run-topbar:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-run-topbar .run-icon { font-size: 0.9rem; }

/* ---------- Run Now button (form) ---------- */
.btn-run {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  padding: 0.7rem 1.6rem;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(5,150,105,.35);
  transition: all 0.18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-run:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(5,150,105,.45); }
.btn-run:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; box-shadow: none; }
.btn-run.loading .btn-spinner { display: inline-block; }

/* ---------- Stop button ---------- */
.btn-stop {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 0.65rem 1.1rem;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-stop:hover  { background: rgba(255,59,92,.08); }
.btn-stop:disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- Status indicator ---------- */
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-subtle);
  transition: background 0.3s;
}
.status-dot.status-idle    { background: var(--text-subtle); }
.status-dot.status-running {
  background: #f59e0b;
  animation: pulse-dot 1s ease-in-out infinite;
}
.status-dot.status-done    { background: var(--success); }
.status-dot.status-error   { background: var(--primary); }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.5); }
  50%       { box-shadow: 0 0 0 5px rgba(245,158,11,0); }
}

.status-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------- Log panel ---------- */
.log-wrap {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  min-height: 180px;
  max-height: 380px;
  overflow-y: auto;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  transition: border-color 0.3s;
}

.log-section-running .log-wrap {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,.15);
}

.log-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  color: #585b70;
  font-size: 0.82rem;
  text-align: center;
  padding: 1rem;
  font-family: var(--font-sans, 'Inter', system-ui, sans-serif);
}

#log-entries {
  padding: 0.5rem 0;
  overflow-y: auto;
}

.log-row {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.2rem 0.9rem;
  line-height: 1.55;
  border-bottom: 1px solid rgba(255,255,255,.03);
}
.log-row:last-child { border-bottom: none; }

.log-ts {
  flex-shrink: 0;
  color: #585b70;
  font-size: 0.7rem;
  min-width: 5.5rem;
}

.log-icon {
  flex-shrink: 0;
  font-size: 0.82rem;
}

.log-msg { color: var(--code-fg); word-break: break-word; }

/* Type-specific row tints */
.log-success .log-msg { color: #a3e9c0; }
.log-warn    .log-msg { color: #fde68a; }
.log-error   .log-msg { color: #fca5a5; }
.log-info    .log-msg { color: #cdd6f4; }

