/* ==============================================================================
   gmpro-app: 3-Column SPA Styles
   Tailwind-inspired minimal clean UI (Vendored / Zero external dependencies)
   ============================================================================== */

:root {
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-input: #ffffff;

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

  --border-light: #e2e8f0;
  --border-focus: #3b82f6;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-text: #ffffff;

  --secondary: #475569;
  --secondary-hover: #334155;
  --secondary-text: #ffffff;

  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;

  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --warning-border: #fcd34d;

  --info-bg: #eff6ff;
  --info-text: #1e40af;
  --info-border: #bfdbfe;

  --success-bg: #d1fae5;
  --success-text: #065f46;

  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  --sidebar-width: 320px;
  --sidebar-width-collapsed: 44px;
}

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

[hidden] {
  display: none !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.layout-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ==============================================================================
   Global Alert / Notification
   ============================================================================== */
.global-alert {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border-bottom: 1px solid #fca5a5;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 100;
}

.global-alert.alert-error {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border-bottom: 1px solid #fca5a5;
}

.global-alert.alert-info {
  background-color: var(--info-bg);
  color: var(--info-text);
  border-bottom: 1px solid var(--info-border);
}

.global-alert.alert-success {
  background-color: var(--success-bg);
  color: var(--success-text);
  border-bottom: 1px solid #a7f3d0;
}

.btn-icon {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}
.btn-icon:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* ==============================================================================
   Header
   ============================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.header-brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1e3a8a;
}

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

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--warning-bg);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--warning-border);
}

.auth-warning-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--warning-text);
}

.token-input-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.status-bar {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

/* ==============================================================================
   3-Column Grid Layout
   ============================================================================== */
.three-column-grid {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1.25fr 1fr;
  flex: 1;
  overflow: hidden;
  transition: grid-template-columns 0.2s ease;
}

.three-column-grid.sidebar-collapsed {
  grid-template-columns: var(--sidebar-width-collapsed) 1.25fr 1fr;
}

.three-column-grid.no-transition,
.three-column-grid.no-transition * {
  transition: none !important;
}

.column {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  overflow: hidden;
  height: 100%;
  min-width: 0;
}

.column-left {
  min-width: 0;
}

.column-right {
  border-right: none;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  background-color: #fafaf9;
  flex-shrink: 0;
}

.column-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

/* 左カラムヘッダー & トグルボタン */
.column-header-left {
  padding: 0.6rem 0.75rem;
  gap: 0.5rem;
}

.sidebar-header-title-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex: 1;
}

.btn-toggle-sidebar {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
}

.btn-toggle-sidebar:hover {
  color: var(--text-main);
  background-color: rgba(0, 0, 0, 0.05);
}

.btn-toggle-sidebar:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.sidebar-toggle-icon {
  display: inline-block;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

/* セクション見出し & ボタン (WAI-ARIA Accordion/Disclosure) */
.sidebar-section-heading {
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.column-header-left .sidebar-section-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

.section-title .sidebar-section-heading {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.btn-section-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
  color: inherit;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  min-width: 0;
  white-space: nowrap;
}

.btn-section-toggle:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.btn-section-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.section-toggle-icon {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.btn-section-toggle[aria-expanded="false"] .section-toggle-icon {
  transform: rotate(-90deg);
}

#btn-new-scenario {
  white-space: nowrap;
  flex-shrink: 0;
}

/* 左カラムが折りたたまれた状態（細いレール） */
.column-left.collapsed {
  overflow: hidden;
}

.column-left.collapsed .column-header-left {
  padding: 0.6rem 0;
  justify-content: center;
  border-bottom: none;
}

.column-left.collapsed .sidebar-header-title-group {
  justify-content: center;
  flex: 0 0 auto;
}

.column-left.collapsed .sidebar-section-heading,
.column-left.collapsed #btn-new-scenario,
.column-left.collapsed .scenario-list-container,
.column-left.collapsed .run-history-section {
  display: none !important;
}

.column-left.collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

.header-with-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.mode-new {
  background-color: #dbeafe;
  color: #1e40af;
}

.mode-edit {
  background-color: #fef3c7;
  color: #92400e;
}

.mode-snapshot {
  background-color: #f1f5f9;
  color: #475569;
}

.scrollable {
  overflow-y: auto;
  padding: 1rem;
  flex: 1;
}

/* ==============================================================================
   Left Column: Scenarios & Run History
   ============================================================================== */
.scenario-list-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.run-history-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #fafbfc;
  min-height: 0;
  border-top: 1px solid var(--border-light);
}

.run-history-section.section-collapsed {
  flex: 0 0 auto;
}

.run-history-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-muted);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.section-title h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.count-badge {
  font-size: 0.75rem;
  background-color: #cbd5e1;
  color: #334155;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  font-weight: 600;
}

.item-list {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.list-item {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
}

.list-item:hover {
  border-color: #93c5fd;
  background-color: #f0f7ff;
}

.list-item.selected {
  border-color: var(--primary);
  background-color: #eff6ff;
  box-shadow: 0 0 0 1px var(--primary);
}

.item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.list-item:hover .item-actions {
  opacity: 1;
}

.btn-delete-item {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.btn-delete-item:hover {
  color: var(--danger);
  background-color: var(--danger-bg);
}

.placeholder-text, .placeholder-text-muted {
  font-size: 0.85rem;
  color: var(--text-subtle);
  text-align: center;
  padding: 2rem 1rem;
}

/* ==============================================================================
   Center Column: Input Form
   ============================================================================== */
.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--info-border);
  background-color: var(--info-bg);
  font-size: 0.85rem;
}

.banner-content {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.banner-icon {
  font-size: 1.1rem;
}

.banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #334155;
}

.required {
  color: var(--danger);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  background-color: var(--bg-input);
  color: var(--text-main);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-group textarea {
  resize: vertical;
}

.input-readonly {
  background-color: var(--bg-muted) !important;
  color: #475569 !important;
  cursor: not-allowed;
}

/* Tag Insertion Bar */
.label-with-tags, .label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.tag-button-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.tag-group-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-tag {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #1e40af;
  cursor: pointer;
  transition: all 0.1s;
}

.btn-tag:hover {
  background-color: #dbeafe;
  border-color: #93c5fd;
}

/* Asset Section */
.asset-section {
  background-color: #fafbfc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.upload-progress-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--info-text);
}

.upload-progress-container progress {
  width: 100%;
  height: 0.5rem;
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.asset-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.asset-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: #e2e8f0;
  flex-shrink: 0;
}

.asset-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.asset-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.asset-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.asset-role-select {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #fff;
}

.asset-checkbox-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Parameters Fieldset */
.param-fieldset {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background-color: #fafbfc;
}

.param-fieldset legend {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  padding: 0 0.35rem;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.col-half {
  flex: 1;
}

/* Cost Estimate Card */
.cost-estimate-card {
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cost-info {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.cost-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.cost-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e3a8a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.cost-breakdown {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cost-billing-notice {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--warning-text);
  background-color: var(--warning-bg);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warning-border);
  display: inline-flex;
  align-items: center;
}

.cost-limit-warning {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--danger);
  background-color: var(--danger-bg);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid #fca5a5;
}

.cost-edit-notice {
  font-size: 0.8rem;
  color: #1e40af;
  background-color: #eff6ff;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid #bfdbfe;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}

/* ==============================================================================
   Right Column: Output, Video, Logs
   ============================================================================== */
.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh;
}

.output-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.alert-box {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.alert-error {
  background-color: var(--danger-bg);
  border: 1px solid #fca5a5;
  color: var(--danger-text);
}

.alert-header {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.alert-body {
  word-break: break-word;
}

/* Video Player */
.video-container {
  background-color: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #09090b;
}

.video-element {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: #a1a1aa;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Metadata Grid */
.metadata-section h3,
.thought-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.5rem;
}

.metadata-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 0.5rem 0.75rem;
  background-color: #fafbfc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
}

.metadata-grid dt {
  font-weight: 600;
  color: #64748b;
}

.metadata-grid dd {
  color: #1e293b;
}

.code-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  word-break: break-all;
}

/* Thought Card */
.thought-card {
  background-color: #fafaf9;
  border: 1px solid var(--border-light);
  border-left: 3px solid #6366f1;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.825rem;
  color: #334155;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* Interpretation Section */
.interpret-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: #fafbfc;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
}

.badge-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  background-color: var(--bg-muted);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Logs Section */
.log-details {
  background-color: #fafbfc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.log-details summary {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  background-color: var(--bg-muted);
  border-bottom: 1px solid var(--border-light);
  user-select: none;
}

.log-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  background-color: #ffffff;
}

.log-entries {
  padding: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background-color: #ffffff;
}

.log-entry {
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  border-left: 3px solid #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.log-entry.kind-submitted { border-left-color: #3b82f6; }
.log-entry.kind-response { border-left-color: #10b981; }
.log-entry.kind-error { border-left-color: #ef4444; background-color: #fef2f2; }

.log-entry-header {
  display: flex;
  justify-content: space-between;
  color: #64748b;
}

.log-entry-kind {
  font-weight: 700;
  color: #334155;
}

.log-entry-body {
  word-break: break-all;
  white-space: pre-wrap;
  color: #1e293b;
}

/* ==============================================================================
   Badges & Buttons
   ============================================================================== */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-default { background: #e2e8f0; color: #475569; }
.status-queued { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }
.status-running { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.status-succeeded { background: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.status-failed { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #fca5a5; }
.status-blocked { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

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

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-text);
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-text);
}
.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
}

.btn-outline {
  background-color: transparent;
  border-color: #cbd5e1;
  color: #334155;
}
.btn-outline:hover:not(:disabled) {
  background-color: var(--bg-muted);
  border-color: #94a3b8;
}

.btn-text {
  background-color: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-text:hover:not(:disabled) {
  color: var(--text-main);
  background-color: rgba(0, 0, 0, 0.05);
}

.btn-sm {
  font-size: 0.775rem;
  padding: 0.35rem 0.65rem;
}

.btn-xs {
  font-size: 0.725rem;
  padding: 0.2rem 0.45rem;
}

.input-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
}

.input-xs {
  padding: 0.2rem 0.4rem;
  font-size: 0.725rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
}

/* ==============================================================================
   Native HTML5 Dialog
   ============================================================================== */
.app-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  margin: auto;
}

.app-dialog::backdrop {
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.dialog-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.dialog-content p {
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==============================================================================
   Responsive Adjustments & Reduced Motion
   ============================================================================== */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 280px;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 250px;
  }
  .column-header-left {
    padding: 0.5rem 0.5rem;
    gap: 0.25rem;
  }
  .sidebar-header-title-group {
    gap: 0.25rem;
  }
  #btn-new-scenario {
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .three-column-grid,
  .column-left,
  .btn-toggle-sidebar,
  .sidebar-toggle-icon,
  .section-toggle-icon {
    transition: none !important;
    animation: none !important;
  }
}
