@layer components {
  .git-workspace-preview {
    container-type: inline-size;
    container-name: git-preview;
    margin: 0;
    min-width: 0;
  }

  .gp-view-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
  .gp-view-picker > button { min-height: 44px; padding: 0 15px; border: 1px solid #ffffff1a; border-radius: 6px; background: #15181d; color: #9aa3ae; font: 13px/1.5 'Segoe UI', 'Segoe UI Variable', sans-serif; cursor: pointer; }
  .gp-view-picker > button[aria-pressed="true"] { background: #2a303a; color: #e8ebef; border-color: #e8ebef4d; }
  .gp-view-picker > button:hover { color: #e8ebef; border-color: #e8ebef66; }
  .gp-view-picker > button:focus-visible { outline: 2px solid #b2d8bb; outline-offset: 3px; }

  .gp-window {
    --gp-bg: #15181d;
    --gp-chrome: #1b1f26;
    --gp-terminal: #0d1116;
    --gp-line: #ffffff1a;
    --gp-text: #e8ebef;
    --gp-muted: #9aa3ae;
    --gp-dim: #838c99;
    --gp-add: #7ee787;
    --gp-del: #ffa198;
    --gp-mono: 'Cascadia Mono', Consolas, ui-monospace, monospace;
    overflow: hidden;
    min-width: 0;
    color: var(--gp-text);
    background: var(--gp-bg);
    border: 1px solid var(--gp-line);
    border-radius: 12px;
    box-shadow: 0 16px 36px #0006;
    font: 13px/1.5 'Segoe UI', 'Segoe UI Variable', sans-serif;
    text-align: left;
  }

  .gp-window *, .gp-window *::before, .gp-window *::after { box-sizing: border-box; }
  .gp-caption { display: flex; align-items: stretch; justify-content: space-between; min-height: 38px; background: var(--gp-chrome); border-bottom: 1px solid var(--gp-line); }
  .gp-native-tab { display: flex; align-items: center; gap: 9px; margin: 4px 0 0 7px; padding: 0 12px; min-width: 170px; border: 1px solid var(--gp-line); border-bottom: 0; border-radius: 7px 7px 0 0; background: var(--gp-terminal); font-size: 12px; }
  .gp-native-tab > img { flex: none; width: 16px; height: 16px; }
  .gp-tab-close { display: flex; margin-left: auto; color: var(--gp-muted); }
  .gp-tab-close svg { width: 10px; height: 10px; }
  .gp-window-controls { display: flex; flex: none; }
  .gp-window-control { width: 40px; display: grid; place-items: center; color: var(--gp-muted); }
  .gp-window-control svg { width: 10px; height: 10px; }

  .gp-toolbar { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; align-items: center; gap: 8px; min-height: 48px; padding: 7px 12px; background: var(--gp-chrome); border-bottom: 1px solid var(--gp-line); }
  .gp-toolbar-start, .gp-toolbar-end { display: flex; align-items: center; gap: 8px; }
  .gp-tool { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 32px; padding: 0 12px; border: 1px solid var(--gp-line); border-radius: 6px; white-space: nowrap; }
  .gp-refresh { white-space: nowrap; }
  .gp-dots { padding-inline: 8px; }
  .gp-icon { flex: none; width: 14px; height: 14px; }
  .gp-separator { height: 20px; width: 1px; background: var(--gp-line); }
  .gp-center { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 3px 10px; min-width: 0; }
  .gp-branch-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 10px; border: 1px solid var(--gp-line); border-radius: 6px; background: var(--gp-terminal); white-space: nowrap; }
  .gp-tracking { color: var(--gp-dim); font-size: 12px; }

  .gp-body { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 512px; }
  .gp-sidebar { padding: 8px; min-width: 0; background: var(--gp-chrome); border-right: 1px solid var(--gp-line); }
  .gp-modes { display: flex; flex-direction: column; gap: 2px; }
  .gp-mode { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 12px; border-radius: 6px; color: var(--gp-muted); }
  .gp-mode .gp-icon { width: 16px; height: 16px; }
  .gp-mode-selected { background: #ffffff1a; color: var(--gp-text); font-weight: 600; }
  .gp-filter { display: flex; align-items: center; gap: 8px; min-height: 30px; margin: 8px 0 6px; padding: 0 8px; color: var(--gp-dim); background: var(--gp-terminal); border: 1px solid var(--gp-line); border-radius: 6px; font-size: 12px; }
  .gp-group { margin-top: 6px; }
  .gp-group-title { display: flex; align-items: center; gap: 8px; height: 28px; padding-inline: 8px; color: var(--gp-dim); font-size: 12px; }
  .gp-group-title > svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .gp-repo-row { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 8px 0 26px; min-width: 0; }
  .gp-repo-row > .gp-icon { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .gp-current { font-weight: 600; }
  .gp-current > .gp-check { margin-left: -18px; width: 10px; height: 10px; stroke-width: 1.8; }
  .gp-repo-child { padding-left: 46px; color: var(--gp-muted); }
  .gp-row-menu { margin-left: auto; color: var(--gp-dim); font-size: 16px; line-height: 1; }
  .gp-stash-row { flex-wrap: wrap; gap: 0 7px; }
  .gp-row-sub { color: var(--gp-dim); font-size: 12px; }

  .gp-main { min-width: 0; }
  .gp-changes { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100%; min-width: 0; }
  .gp-file-lists { display: flex; flex-direction: column; border-right: 1px solid var(--gp-line); min-width: 0; }
  .gp-change-section { flex: 1 1 0; min-height: 150px; padding-bottom: 8px; }
  .gp-change-section + .gp-change-section { border-top: 1px solid var(--gp-line); }
  .gp-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 8px 12px; color: var(--gp-muted); font-size: 12px; }
  .gp-small-tool { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 2px 8px; border: 1px solid var(--gp-line); border-radius: 6px; color: var(--gp-text); font-size: 12px; white-space: nowrap; }
  .gp-file-row { display: flex; align-items: center; gap: 6px; min-height: 28px; margin: 0 6px 2px; padding: 3px 8px; border-radius: 4px; color: var(--gp-muted); }
  .gp-file-row > .gp-icon { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .gp-folder-row { color: var(--gp-dim); }
  .gp-tree-chevron { display: inline-flex; align-items: center; justify-content: center; width: 16px; }
  .gp-tree-chevron > svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .gp-tree-indent { padding-left: 24px; }
  .gp-tree-indent-deep { padding-left: 40px; }
  .gp-file-selected { background: var(--gp-terminal); color: var(--gp-text); box-shadow: inset 2px 0 0 var(--gp-text); }
  .gp-status { display: inline-flex; justify-content: center; align-items: center; flex: none; min-width: 16px; height: 16px; padding: 0; border: 1px solid var(--gp-line); border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1; }
  .gp-status-modified { color: #ff9f0a; background: #ff9f0a1a; border-color: #ff9f0a73; }
  .gp-status-word { min-width: 44px; padding: 0 5px; }
  .gp-delta { font: 12px/1.5 var(--gp-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .gp-added { color: var(--gp-add); }
  .gp-deleted { color: var(--gp-del); }

  .gp-commit-box { margin-top: auto; display: grid; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--gp-line); background: var(--gp-chrome); }
  .gp-commit-message { min-height: 70px; padding: 6px 8px; background: var(--gp-terminal); border: 1px solid var(--gp-line); border-radius: 6px; overflow-wrap: anywhere; }
  .gp-commit-footer { display: flex; align-items: center; gap: 8px; color: var(--gp-dim); font-size: 12px; }
  .gp-commit-footer > kbd { padding: 0; font: 11px/1.5 var(--gp-mono); background: transparent; border: 0; }
  .gp-primary { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; min-height: 30px; padding: 0 12px; border: 1px solid #e8ebef4d; border-radius: 6px; background: #e8ebef; color: var(--gp-terminal); font-size: 13px; font-weight: 600; }

  .gp-detail { display: flex; flex-direction: column; min-width: 0; }
  .gp-detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 46px; padding: 8px 12px; background: var(--gp-chrome); border-bottom: 1px solid var(--gp-line); }
  .gp-detail-head > strong { font-size: 15px; font-weight: 600; }
  .gp-detail-dir { color: var(--gp-dim); font-size: 12px; }
  .gp-detail-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
  .gp-diff { flex: 1 1 auto; min-height: 270px; min-width: 0; padding-bottom: 18px; background: var(--gp-terminal); font: 13px/1.8 var(--gp-mono); }
  .gp-diff-hunk { padding: 4px 12px; color: var(--gp-dim); background: #e8ebef08; font-size: 12px; }
  .gp-diff-line { display: grid; grid-template-columns: 28px 28px 12px minmax(0, 1fr); gap: 4px; padding: 1px 8px; color: var(--gp-muted); }
  .gp-diff-num { padding-right: 3px; color: var(--gp-dim); text-align: right; font-variant-numeric: tabular-nums; }
  .gp-diff-sign { text-align: center; }
  .gp-diff-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
  .gp-diff-added { color: var(--gp-add); background: #7ee7871f; }
  .gp-diff-deleted { color: var(--gp-del); background: #ffa1981f; }

  .gp-commits { display: grid; grid-template-rows: minmax(190px, 1fr) auto; height: 100%; min-width: 0; }
  .gp-history { min-width: 0; background: #181c22; }
  .gp-history-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) 120px 72px 120px; gap: 12px; align-items: center; height: 28px; padding: 0 16px; background: var(--gp-chrome); color: var(--gp-dim); font-size: 12px; border-bottom: 1px solid var(--gp-line); }
  .gp-history-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 120px 72px 120px; gap: 12px; align-items: center; height: 28px; padding: 0 16px; font-size: 13px; }
  .gp-history-selected { background: var(--gp-terminal); }
  .gp-history-selected .gp-graph-node { fill: var(--gp-terminal); }
  .gp-graph { width: 40px; height: 28px; overflow: visible; }
  .gp-graph path { fill: none; stroke-width: 1.5; }
  .gp-lane-main { stroke: #6f9dd6; }
  .gp-lane-branch { stroke: #8fbf7f; }
  .gp-graph-node { stroke-width: 1.5; fill: #181c22; }
  .gp-history-subject { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; white-space: nowrap; }
  .gp-history-subject > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .gp-ref { display: inline-flex; align-items: center; min-height: 18px; padding: 0 5px; border: 1px solid #6f9dd673; border-radius: 4px; color: #6f9dd6; font-size: 11px; white-space: nowrap; }
  .gp-ref-head { color: var(--gp-text); border-color: #e8ebef73; }
  .gp-ref-branch { color: #8fbf7f; border-color: #8fbf7f73; }
  .gp-ref-tag { color: #c9a15f; border-color: #c9a15f73; }
  .gp-author { color: var(--gp-muted); }
  .gp-sha { color: var(--gp-muted); font: 12px/1.5 var(--gp-mono); }
  .gp-date { color: var(--gp-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .gp-commit-detail { min-width: 0; }
  .gp-splitter { height: 6px; background: var(--gp-chrome); border-top: 1px solid var(--gp-line); border-bottom: 1px solid var(--gp-line); }
  .gp-detail-tabs { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; background: var(--gp-bg); border-bottom: 1px solid var(--gp-line); }
  .gp-detail-tablist { display: flex; align-items: center; gap: 2px; min-width: 0; }
  .gp-detail-tab { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; color: var(--gp-muted); white-space: nowrap; }
  .gp-detail-tab-selected { color: var(--gp-text); box-shadow: inset 0 -2px 0 var(--gp-text); }
  .gp-detail-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
  .gp-detail-tools > span { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--gp-muted); }
  .gp-commit-files { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-width: 0; }
  .gp-selected-files { border-right: 1px solid var(--gp-line); min-width: 0; }
  .gp-selected-files .gp-delta { margin-left: auto; }
  .gp-selected-files .gp-row-menu { margin-left: 6px; }
  .gp-file-totals { display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; color: var(--gp-dim); font-size: 12px; }
  .gp-commit-detail .gp-detail-head { min-height: 32px; padding-block: 3px; }
  .gp-commit-detail .gp-diff { min-height: 210px; padding-bottom: 12px; line-height: 1.55; }
  .gp-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; min-height: 30px; padding: 4px 12px; background: var(--gp-chrome); border-top: 1px solid var(--gp-line); color: var(--gp-dim); font-size: 12px; }
  .gp-status-line > span:last-child { margin-left: auto; }
  .gp-status-path { color: var(--gp-muted); }
  .git-workspace-preview > figcaption { margin-top: 15px; color: #83a78d; font-size: 11px; line-height: 1.8; }

  @container git-preview (max-width: 1120px) {
    .gp-toolbar { grid-template-columns: max-content minmax(0, 1fr); }
    .gp-toolbar-end { grid-column: 1 / -1; justify-content: flex-end; }
    .gp-center { justify-content: flex-end; }
    .gp-body { grid-template-columns: 210px minmax(0, 1fr); }
    .gp-changes { grid-template-columns: 245px minmax(0, 1fr); }
    .gp-detail-actions { flex-basis: 100%; justify-content: flex-end; }
    .gp-history-head, .gp-history-row { grid-template-columns: 40px minmax(0, 1fr) 72px 120px; }
    .gp-author { display: none; }
  }

  @container git-preview (max-width: 920px) {
    .gp-body { grid-template-columns: minmax(0, 1fr); min-height: 465px; }
    .gp-sidebar { display: none; }
    .gp-changes { grid-template-columns: 260px minmax(0, 1fr); }
    .gp-toolbar { grid-template-columns: max-content minmax(0, 1fr); }
    .gp-center { grid-column: 2; grid-row: 1; }
    .gp-toolbar-end { grid-column: 1 / -1; }
    .gp-diff { min-height: 240px; }
  }

  @container git-preview (max-width: 760px) {
    .gp-toolbar { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px; }
    .gp-toolbar-start { flex-wrap: wrap; gap: 6px; }
    .gp-refresh, .gp-separator { display: none; }
    .gp-center { grid-column: 1; grid-row: 2; justify-content: flex-start; }
    .gp-toolbar-end { grid-column: 1; grid-row: 3; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
    .gp-tool { min-height: 30px; padding-inline: 10px; font-size: 12px; }
    .gp-body { min-height: 0; }
    .gp-changes { display: flex; flex-direction: column; }
    .gp-file-lists { display: contents; }
    .gp-change-section { flex: none; min-height: 0; padding-bottom: 5px; order: 1; }
    .gp-section-head { min-height: 34px; padding-block: 5px; }
    .gp-folder-row { display: none; }
    .gp-tree-indent, .gp-tree-indent-deep { padding-left: 12px; }
    .gp-file-row { min-height: 32px; }
    .gp-detail { order: 2; border-top: 1px solid var(--gp-line); }
    .gp-detail-head { gap: 7px; padding: 10px 12px; }
    .gp-detail-head > strong { font-size: 14px; }
    .gp-detail-actions { justify-content: flex-start; }
    .gp-diff { min-height: 0; padding-bottom: 18px; font-size: 12px; }
    .gp-diff-line { grid-template-columns: 22px 22px 10px minmax(0, 1fr); gap: 3px; padding-inline: 6px; }
    .gp-history-head, .gp-history-row { grid-template-columns: minmax(0, 1fr); }
    .gp-graph, .gp-sha, .gp-date, .gp-history-head > span:first-child { display: none; }
    .gp-commits { grid-template-rows: auto auto; }
    .gp-history-row { height: auto; min-height: 40px; padding-block: 6px; }
    .gp-history-subject { flex-wrap: wrap; white-space: normal; }
    .gp-history-subject > span:last-child { flex-basis: 100%; overflow: visible; overflow-wrap: anywhere; }
    .gp-commit-files { grid-template-columns: minmax(0, 1fr); }
    .gp-selected-files { padding-bottom: 5px; border-right: 0; border-bottom: 1px solid var(--gp-line); }
    .gp-commit-files .gp-detail { border-top: 0; }
    .gp-commit-detail .gp-diff { min-height: 0; }
    .gp-commit-box { order: 3; }
    .gp-commit-message { min-height: 60px; }
    .gp-status-path { display: none; }
    .git-workspace-preview > figcaption { font-size: 11px; }
  }
}
