:root {
      --bg: #f7f7f5;
      --surface: #ffffff;
      --border: #e4e4e0;
      --text: #1f2328;
      --text-muted: #6b7280;
      --primary: #4f46e5;
      --primary-hover: #4338ca;
      --secondary: #0ea5e9;
      --success: #10b981;
      --warning: #f59e0b;
      --error: #ef4444;
      --radius: 10px;
      --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
      --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
      --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      line-height: 1.5;
      font-size: 15px;
    }

    .app-container {
      max-width: 960px;
      margin: 0 auto;
      padding: 24px 20px 80px;
    }

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

    .app-header h1 {
      margin: 0 0 4px;
      font-size: 28px;
      font-weight: 700;
    }

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

    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      margin-bottom: 20px;
      overflow: hidden;
    }

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

    .card-header h2 {
      margin: 0;
      font-size: 17px;
      font-weight: 600;
    }

    .card-body {
      padding: 20px;
    }

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

    .hint {
      color: var(--text-muted);
      font-weight: normal;
      font-size: 12px;
    }

    /* Buttons */
    .btn {
      display: inline-block;
      padding: 8px 16px;
      font-size: 14px;
      font-weight: 500;
      border: 1px solid transparent;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.15s;
      text-decoration: none;
      font-family: inherit;
      line-height: 1.4;
    }
    .btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }
    .btn-primary {
      background: var(--primary);
      color: #fff;
    }
    .btn-primary:hover:not(:disabled) {
      background: var(--primary-hover);
    }
    .btn-secondary {
      background: var(--surface);
      color: var(--primary);
      border-color: var(--primary);
    }
    .btn-secondary:hover:not(:disabled) {
      background: #eef2ff;
    }
    .btn-ghost {
      background: transparent;
      color: var(--text-muted);
      border-color: transparent;
    }
    .btn-ghost:hover:not(:disabled) {
      background: var(--bg);
      color: var(--text);
    }
    .btn-sm {
      padding: 4px 10px;
      font-size: 12px;
    }

    /* Forms */
    .form-group {
      margin-bottom: 12px;
    }
    .form-group label {
      display: block;
      margin-bottom: 4px;
      font-size: 13px;
      font-weight: 500;
    }
    select, input, textarea {
      width: 100%;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--surface);
      font-family: inherit;
      font-size: 14px;
      color: var(--text);
    }
    select:focus, input:focus, textarea:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
    }

    .model-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }
    @media (max-width: 600px) {
      .model-grid { grid-template-columns: 1fr; }
    }

    /* Steps */
    .step-list {
      list-style: none;
      margin: 0;
      padding: 0;
    }
    .step {
      display: flex;
      gap: 16px;
      padding: 16px 0;
      border-bottom: 1px solid var(--border);
    }
    .step:last-child { border-bottom: none; }

    .step-badge {
      flex-shrink: 0;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      font-size: 14px;
    }

    .step-content { flex: 1; }
    .step-content h3 {
      margin: 0 0 4px;
      font-size: 15px;
      font-weight: 600;
    }
    .step-content p {
      margin: 0 0 10px;
      color: var(--text-muted);
      font-size: 13px;
    }

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

    /* Badges */
    .badge {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 500;
    }
    .badge-pending {
      background: #f3f4f6;
      color: #6b7280;
    }
    .badge-running {
      background: #fef3c7;
      color: #92400e;
      animation: pulse 1.5s infinite;
    }
    .badge-done {
      background: #d1fae5;
      color: #065f46;
    }
    .badge-error {
      background: #fee2e2;
      color: #991b1b;
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.6; }
    }

    /* Session links */
    .session-link-container {
      margin-top: 10px;
      font-size: 13px;
    }
    .session-link-container a {
      color: var(--secondary);
      text-decoration: none;
    }
    .session-link-container a:hover {
      text-decoration: underline;
    }
    .session-link-pulse::before {
      content: '●';
      color: var(--warning);
      margin-right: 6px;
      animation: pulse 1.2s infinite;
    }

    /* Activity log */
    .activity-log {
      max-height: 300px;
      overflow-y: auto;
      font-family: 'SF Mono', Monaco, Menlo, monospace;
      font-size: 12px;
      background: #fafaf8;
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 10px;
    }
    .log-entry {
      padding: 4px 0;
      border-bottom: 1px solid rgba(0,0,0,0.04);
    }
    .log-entry:last-child { border-bottom: none; }
    .log-info { color: var(--text); }
    .log-success { color: var(--success); }
    .log-error { color: var(--error); }
    .log-warning { color: var(--warning); }

    /* Files list */
    .files-list {
      display: grid;
      gap: 6px;
    }
    .file-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: var(--surface);
      font-size: 13px;
    }
    .file-item a {
      color: var(--primary);
      text-decoration: none;
      flex: 1;
    }
    .file-item a:hover { text-decoration: underline; }
    .file-size {
      color: var(--text-muted);
      font-size: 12px;
    }

    /* Toasts */
    #toast-container {
      position: fixed;
      top: 20px;
      right: 20px;
      z-index: 1000;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .toast {
      padding: 10px 16px;
      border-radius: 6px;
      box-shadow: var(--shadow-lg);
      background: var(--surface);
      border-left: 4px solid var(--secondary);
      font-size: 14px;
      min-width: 240px;
      animation: slideIn 0.25s;
    }
    .toast-success { border-left-color: var(--success); }
    .toast-error { border-left-color: var(--error); }
    .toast-warning { border-left-color: var(--warning); }

    @keyframes slideIn {
      from { transform: translateX(100%); opacity: 0; }
      to { transform: translateX(0); opacity: 1; }
    }

    .app-footer {
      margin-top: 40px;
      padding-top: 20px;
      border-top: 1px solid var(--border);
      text-align: center;
      font-size: 12px;
    }