  :root {
    --bg: #FAF8F4;
    --surface: #ffffff;
    --surface-warm: #F0ECE4;
    --border: #E0DCD4;
    --text: #1A1A1A;
    --text-muted: #6B6560;
    --accent: #F1A636;
    --accent-hover: #E09520;
    --dark: #1A1A1A;
    --dark-soft: #2A2A2A;
    --danger: #c0392b;
    --shadow: 0 1px 3px rgba(26,26,26,0.06);
    --radius: 0px;
    --font-body: 'DM Sans', Helvetica, Arial, sans-serif;
    --font-serif: 'Instrument Serif', Georgia, serif;
  }

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

  body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
  }

  /* ── Header ── */
  header {
    background: var(--dark);
    color: white;
    padding: 0 32px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 500;
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .header-logo {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    flex-shrink: 0;
  }
  .header-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.15);
  }
  .header-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.2px;
  }
  .header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 11px;
    color: rgba(255,255,255,0.35);
  }
  .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
  }
  .header-actions { display: flex; gap: 6px; align-items: center; }
  .header-actions button {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 6px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
    letter-spacing: 0.2px;
  }
  .header-actions button:hover:not(:disabled) { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.3); color: white; }
  .header-actions button:disabled { opacity: 0.25; cursor: not-allowed; }
  .header-actions button.primary { background: var(--accent); color: var(--dark); border-color: var(--accent); font-weight: 600; }
  .header-actions button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
  .header-actions button.primary:disabled { opacity: 0.25; cursor: not-allowed; }

  /* ── Layout ── */
  .app { max-width: 1400px; margin: 0 auto; padding: 24px; }

  /* ── Project Bar ── */
  .project-bar {
    display: flex;
    gap: 16px;
    align-items: end;
    margin-bottom: 24px;
    flex-wrap: wrap;
  }
  .field { display: flex; flex-direction: column; gap: 4px; }
  .field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); font-weight: 500; }
  .field input, .field select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
  }
  .field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(241,166,54,0.15); }
  .swap-btn {
    background: var(--surface-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 9px;
    padding: 2px 5px;
    color: var(--text);
    align-self: end;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.15s;
  }
  .swap-btn:hover { background: var(--accent); color: var(--dark); border-color: var(--accent); }
  .field input.sm { width: 120px; }
  .field input.md { width: 200px; }
  .field input.lg { width: 280px; }

  /* ── Recipes tab bar ── */
  .recipes-tabs {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  .recipe-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .recipe-tab:hover { border-color: var(--accent); }
  .recipe-tab.active { background: var(--dark); color: white; border-color: var(--dark); }
  .tab-actions { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
  .recipe-tab .dup-tab,
  .recipe-tab .close-tab {
    font-size: 14px;
    opacity: 0.4;
    cursor: pointer;
    line-height: 1;
  }
  .recipe-tab .dup-tab:hover,
  .recipe-tab .close-tab:hover { opacity: 1; }
  .recipe-tab.dragging { opacity: 0.4; }
  .recipe-tab.drag-over-tab { border-color: var(--accent); border-style: dashed; }
  .add-recipe-btn {
    padding: 8px 12px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
    transition: all 0.15s;
  }
  .add-recipe-btn:hover { border-color: var(--accent); color: var(--dark); }

  /* ── Recipe Panel ── */
  .recipe-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
  }

  .duration-display {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    line-height: 20px;
    margin-top: 4px;
  }

  .recipe-name-bar { margin-bottom: 20px; }
  .recipe-name-input {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    color: var(--text);
    border: none;
    border-bottom: 2px solid var(--border);
    background: transparent;
    width: 100%;
    padding: 8px 0;
    outline: none;
    transition: border-color 0.2s;
  }
  .recipe-name-input:focus { border-bottom-color: var(--accent); }
  .recipe-name-input::placeholder { color: var(--border); }

  .recipe-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
  }
  .recipe-header-left {
    display: flex;
    align-items: end;
    gap: 12px;
  }
  .recipe-header-right {
    display: flex;
    align-items: end;
    gap: 16px;
  }
  .header-sep {
    width: 1px;
    height: 28px;
    background: var(--border);
    margin-bottom: 4px;
  }

  .dimension-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: end;
    margin-bottom: 6px;
  }
  .dimension-chip-preview {
    border: 1.5px solid var(--dark);
    background: var(--surface-warm);
    flex-shrink: 0;
    transition: all 0.3s;
  }
  .dimension-chip-label {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1.2;
  }
  .dimension-chip-label strong {
    display: block;
    font-size: 12px;
    color: var(--text);
    font-weight: 600;
  }

  /* ── Section headers ── */
  .section-bar {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
  }
  .section-bar .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
  }
  .section-bar.playback-bar { background: var(--dark); color: white; }
  .section-bar.playback-bar .dot { background: var(--accent); }
  .section-bar.recording-bar { background: var(--accent); color: var(--dark); }
  .section-bar.recording-bar .dot { background: var(--dark); }

  /* ── Filmstrip: horizontal scrolling clip row ── */
  .filmstrip-wrap {
    padding: 16px;
    overflow-x: auto;
  }
  .filmstrip {
    display: flex;
    gap: 16px;
    min-height: 80px;
    padding-bottom: 8px;
  }

  /* ── Clip Card (vertical filmstrip style) ── */
  .clip-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    cursor: grab;
    transition: box-shadow 0.15s, border-color 0.15s;
    position: relative;
    min-width: 180px;
    max-width: 220px;
    flex-shrink: 0;
  }
  .clip-card:hover { border-color: #bbb; box-shadow: 0 2px 6px rgba(0,0,0,0.06); }
  .clip-card.dragging { opacity: 0.4; }
  .clip-card.drag-over { border-color: var(--accent); border-style: dashed; }

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

  .clip-number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--dark);
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .clip-thumb-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #fafafa;
    transition: border-color 0.15s;
    width: 100%;
  }
  .clip-thumb-zone:hover { border-color: #aaa; }
  .clip-thumb-zone.has-image { border-style: solid; border-color: var(--border); }
  .clip-thumb-zone img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .clip-thumb-zone .upload-hint {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    padding: 4px;
    line-height: 1.3;
  }
  .clip-thumb-zone .remove-img {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  .clip-thumb-zone:hover .remove-img { display: flex; }

  .clip-details { display: flex; flex-direction: column; gap: 6px; }
  .clip-details .clip-field { display: flex; flex-direction: column; gap: 2px; }
  .clip-details .clip-field-row { display: flex; gap: 6px; align-items: center; min-height: 31px; }
  .clip-details input, .clip-details select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px 8px;
    font-family: var(--font-body);
    font-size: 13px;
    background: var(--surface);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
  }
  .clip-details input:focus, .clip-details select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(241,166,54,0.15); }
  .clip-details input.clip-name { font-weight: 500; }
  .clip-details input.clip-duration { width: 100%; }
  .duration-wrap {
    position: relative;
    display: flex;
    align-items: center;
  }
  .duration-wrap input { flex: 1; }
  .duration-unit {
    position: absolute;
    right: 28px;
    font-size: 11px;
    color: var(--border);
    pointer-events: none;
  }
  .clip-details select.clip-slo-mo { width: 100%; }
  .clip-label { font-size: 11px; color: var(--text-muted); }

  .clip-actions { display: flex; align-items: center; }
  .clip-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
  }
  .clip-actions button:hover { color: var(--danger); background: #fdecea; }

  .add-clip-card {
    min-width: 180px;
    max-width: 220px;
    flex-shrink: 0;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.15s;
    min-height: 200px;
  }
  .add-clip-card:hover { border-color: var(--accent); color: var(--dark); background: rgba(241,166,54,0.06); }

  /* ── Recording order table ── */
  .rec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  .rec-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--dark);
  }
  .rec-table th.center, .rec-table td.center { text-align: center; }
  .rec-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }
  .rec-table tr { cursor: grab; transition: background 0.1s; }
  .rec-table tr:hover { background: var(--surface-warm); }
  .rec-table tr.dragging { opacity: 0.4; }
  .rec-table tr.drag-over td { border-bottom: 2px solid var(--accent); }
  .rec-table .rec-thumb {
    border-radius: 3px;
    overflow: hidden;
    background: #eee;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
  }
  .rec-table .rec-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .rec-table .rec-num {
    font-size: 10px;
    background: var(--dark);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
  }

  /* ── Toggle switch ── */
  .format-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 4px;
    height: 20px;
  }
  .format-toggle button {
    padding: 0 10px;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    border: none;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.3px;
    line-height: 20px;
  }
  .format-toggle button + button { border-left: 1px solid var(--border); }
  .format-toggle button.active { background: var(--dark); color: white; }
  .format-toggle button:hover:not(.active) { background: var(--border); }

  .toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
  }
  .toggle-switch input { opacity: 0; width: 0; height: 0; }
  .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 20px;
    transition: background 0.2s;
  }
  .toggle-slider:before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
  }
  .toggle-switch input:checked + .toggle-slider { background: var(--dark); }
  .toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }
  .as-shot-label {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    padding: 5px 8px;
    border: 1px solid transparent;
    height: 31px;
    display: flex;
    align-items: center;
  }

  /* ── Print / Export ── */
  .export-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
  }

  /* ── Print-only guide ── */
  #printGuide { display: none; }

  @media print {
    @page { size: A4; margin: 12mm; }
    header, .app, .guide-overlay { display: none !important; }
    #printGuide {
      display: block !important;
      padding: 0;
      font-size: 11px;
    }
    #printGuide .guide-top-actions { display: none !important; }
    body { background: white; }
  }

  /* ── Empty state ── */
  .empty-state {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
  }

  /* ── Drag handle visual ── */
  .drag-handle {
    color: #ccc;
    font-size: 16px;
    cursor: grab;
    user-select: none;
    margin-right: 4px;
    flex-shrink: 0;
  }

  /* ── Responsive ── */
  @media (max-width: 900px) {
    .recipe-header { flex-direction: column; align-items: start; }
    .clip-card { min-width: 160px; }
  }

  /* ── Landing screen ── */
  .landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    text-align: center;
  }
  .landing-logo {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
  }
  .landing-title {
    font-family: var(--font-serif);
    font-size: 42px;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 12px;
  }
  .landing-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 400px;
  }
  .landing-actions {
    display: flex;
    gap: 16px;
  }
  .landing-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
  }
  .landing-btn:hover { border-color: var(--accent); }
  .landing-btn.primary {
    background: var(--dark);
    color: white;
    border-color: var(--dark);
  }
  .landing-btn.primary:hover { background: var(--dark-soft); }
  .landing-btn-icon { font-size: 20px; }
  .landing-note {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
  }

  /* ── Save status ── */
  #saveStatus {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-left: 12px;
  }

  /* ── Help overlay ── */
  .help-scrim {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26,26,26,0.55);
    z-index: 400;
    cursor: pointer;
  }
  .help-scrim.active { display: block; }

  .help-bubble {
    position: absolute;
    z-index: 401;
    background: var(--dark);
    color: white;
    padding: 10px 14px;
    max-width: 220px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    box-shadow: 0 8px 30px rgba(0,0,0,0.35);
    pointer-events: none;
    animation: bubbleIn 0.3s ease both;
  }
  .help-bubble strong {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    margin-bottom: 3px;
  }
  .help-bubble::after {
    content: '';
    position: absolute;
    border: 6px solid transparent;
  }
  .help-bubble.arrow-down::after { top: 100%; left: 16px; border-top-color: var(--dark); }
  .help-bubble.arrow-up::after { bottom: 100%; left: 16px; border-bottom-color: var(--dark); }
  .help-bubble.arrow-down-right::after { top: 100%; right: 16px; border-top-color: var(--dark); }

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

  /* ── Client Guide ── */
  .guide-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26,26,26,0.7);
    z-index: 500;
    display: none;
    overflow-y: auto;
  }
  .guide-overlay.active { display: flex; align-items: start; justify-content: center; padding: 40px 20px; }
  .guide-page {
    background: white;
    width: 1000px;
    max-width: 100%;
    padding: 60px;
    position: relative;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  }
  .guide-top-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 510;
  }
  .guide-action-btn {
    background: none;
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.15s;
  }
  .guide-action-btn:hover { color: var(--text); border-color: var(--text); }
  .guide-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 48px;
    border-bottom: 2px solid var(--dark);
    padding-bottom: 24px;
  }
  .guide-brand {
    font-family: var(--font-serif);
    font-size: 28px;
  }
  .guide-brand-sub {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 4px;
  }
  .guide-section-title {
    font-family: var(--font-serif);
    font-size: 24px;
    margin-bottom: 24px;
    color: var(--text);
  }
  .guide-diagram {
    border: 1px solid var(--border);
    padding: 32px;
    margin-bottom: 32px;
    position: relative;
    background: #fafafa;
  }
  .guide-diagram-row {
    display: flex;
    gap: 16px;
    align-items: start;
    flex-wrap: wrap;
  }
  .guide-clip-box {
    border: 1px solid var(--border);
    background: white;
    text-align: center;
    padding: 8px;
    flex: 1;
    min-width: 100px;
  }
  .guide-clip-box .clip-placeholder {
    background: var(--surface-warm);
    margin-bottom: 8px;
  }
  .guide-clip-box .clip-label {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: left;
  }
  .guide-meta-table {
    margin-bottom: 32px;
  }
  .guide-meta-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
  }
  .guide-meta-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
  }
  .guide-meta-table td:first-child {
    font-weight: 600;
    width: 160px;
    color: var(--text);
  }
  .guide-meta-table td:last-child {
    color: var(--text-muted);
  }

  @media print {
    .guide-top-actions { display: none !important; }
    .guide-overlay { position: static; background: none; display: block !important; padding: 0; }
    .guide-page { box-shadow: none; padding: 20px; }
  }

  /* ── Help button in header ── */
  .help-btn {
    width: 26px;
    height: 26px;
    border-radius: 50% !important;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0 !important;
  }
  .help-btn:hover { background: rgba(255,255,255,0.12); color: white; }
  .help-btn.active {
    background: var(--accent) !important;
    color: var(--dark) !important;
    border-color: var(--accent) !important;
  }

  /* hidden file inputs */
  .hidden-input { display: none; }
