@import "tailwindcss";

@theme {
  --color-ink: #f0f1f2;
  --color-ink-muted: #c1c3c6;
  --color-ink-faint: #7f8389;
  --color-ink-dim: #9da1a6;
  --color-ink-quiet: #aeb1b5;

  --color-surface: #2b2e34;
  --color-surface-alt: #1b1c1e;
  --color-surface-dim: #2e3137;
  --color-surface-hover: #363a41;
  --color-surface-raised: #32363d;
  --color-surface-solid: #222328;

  --color-border: #3a3e45;
  --color-border-subtle: #34383e;
  --color-border-input: #465159;

  --color-primary: #25a7c7;
  --color-primary-dark: #188ca9;
  --color-accent: #2eb5d1;

  --color-bar: #292c30;
  --color-bar-text: #f0f1f2;
  --color-bar-muted: #8b8f94;

  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

:root {
  --app-color-scheme: dark;
  --app-bg: #222328;
  --app-button-bg: #32363d;
  --app-input-bg: #22252a;
  --app-select-option-bg: #32363d;
  --app-panel-highlight: linear-gradient(180deg, rgba(255,255,255,0.038), transparent 70%);
  --app-panel-shadow: 0 18px 48px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.045);
  --app-dialog-backdrop: rgba(12, 13, 15, 0.7);
  --app-dialog-bg: #22252a;
  --app-dialog-chrome: #2b2e34;
  --app-dialog-shadow: 0 24px 68px rgba(0, 0, 0, 0.54), 0 2px 12px rgba(0,0,0,0.32);
  --app-settings-row-bg: #2b2e34;
  --app-scrollbar-thumb: #4a4e55;
  --app-scrollbar-thumb-hover: #60656d;

  --code-surface: #222328;
  --code-surface-raised: #2b2e34;
  --code-surface-subtle: #1f2024;
  --code-surface-muted: #26282d;
  --code-surface-meta: #1d1e22;
  --code-input-bg: #22252a;
  --code-hover-bg: #30343a;
  --code-add-text: #5dd88a;
  --code-add-strong: #4eca76;
  --code-add-bg: rgba(78, 202, 118, 0.09);
  --code-add-gutter-bg: rgba(78, 202, 118, 0.1);
  --code-delete-text: #ef8080;
  --code-delete-strong: #e86060;
  --code-delete-bg: rgba(232, 96, 96, 0.1);
  --code-delete-gutter-bg: rgba(232, 96, 96, 0.12);
  --code-hunk-text: #7aacff;
  --code-hunk-bg: rgba(122, 172, 255, 0.08);
  --code-match-text: #f3c969;
  --code-match-bg: rgba(240, 182, 72, 0.22);
  --code-match-gutter-bg: rgba(240, 182, 72, 0.2);
}

:root[data-theme="light"] {
  --color-ink: #172033;
  --color-ink-muted: #475569;
  --color-ink-faint: #728098;
  --color-ink-dim: #5f6f89;
  --color-ink-quiet: #66758d;

  --color-surface: rgba(255, 255, 255, 0.86);
  --color-surface-alt: #f3f6fb;
  --color-surface-dim: rgba(244, 247, 252, 0.92);
  --color-surface-hover: rgba(226, 233, 245, 0.82);
  --color-surface-raised: rgba(255, 255, 255, 0.94);
  --color-surface-solid: #ffffff;

  --color-border: rgba(61, 89, 142, 0.24);
  --color-border-subtle: rgba(34, 49, 78, 0.11);
  --color-border-input: rgba(46, 117, 182, 0.28);

  --color-primary: #315fd6;
  --color-primary-dark: #284cb4;
  --color-accent: #0f8fb5;

  --color-bar: rgba(248, 251, 255, 0.94);
  --color-bar-text: #172033;
  --color-bar-muted: #64728a;

  --app-color-scheme: light;
  --app-bg:
    radial-gradient(circle at 12% 0%, rgba(49, 95, 214, 0.12), transparent 30%),
    radial-gradient(circle at 82% 4%, rgba(15, 143, 181, 0.12), transparent 28%),
    linear-gradient(135deg, #f7f9fd 0%, #eef3f9 48%, #f8fafc 100%);
  --app-button-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(235, 240, 249, 0.95));
  --app-input-bg: rgba(255, 255, 255, 0.9);
  --app-select-option-bg: #ffffff;
  --app-panel-highlight: linear-gradient(180deg, rgba(255,255,255,0.72), transparent 70%);
  --app-panel-shadow: 0 18px 48px rgba(28, 44, 74, 0.12), inset 0 1px 0 rgba(255,255,255,0.86);
  --app-dialog-backdrop: rgba(222, 229, 241, 0.56);
  --app-dialog-bg: #ffffff;
  --app-dialog-chrome: #f4f7fc;
  --app-dialog-shadow: 0 24px 72px rgba(28, 44, 74, 0.2), 0 2px 12px rgba(28,44,74,0.1);
  --app-settings-row-bg: #f8fafd;
  --app-scrollbar-thumb: #c2cada;
  --app-scrollbar-thumb-hover: #aeb8cb;

  --code-surface: #fbfcfe;
  --code-surface-raised: #f1f5fa;
  --code-surface-subtle: #f3f6fb;
  --code-surface-muted: #edf1f7;
  --code-surface-meta: #e9eef7;
  --code-input-bg: #ffffff;
  --code-hover-bg: #e8eef7;
  --code-add-text: #146c37;
  --code-add-strong: #19723d;
  --code-add-bg: rgba(25, 114, 61, 0.1);
  --code-add-gutter-bg: rgba(25, 114, 61, 0.14);
  --code-delete-text: #a91f36;
  --code-delete-strong: #b4233b;
  --code-delete-bg: rgba(180, 35, 59, 0.09);
  --code-delete-gutter-bg: rgba(180, 35, 59, 0.13);
  --code-hunk-text: #245cc7;
  --code-hunk-bg: rgba(36, 92, 199, 0.09);
  --code-match-text: #744500;
  --code-match-bg: rgba(230, 158, 31, 0.2);
  --code-match-gutter-bg: rgba(230, 158, 31, 0.24);
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html, body, #app { width: 100%; height: 100%; margin: 0; }

  * { scrollbar-width: thin; scrollbar-color: var(--app-scrollbar-thumb) transparent; }
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--app-scrollbar-thumb); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--app-scrollbar-thumb-hover); }

  html { color-scheme: var(--app-color-scheme); }
  body {
    overflow: hidden;
    color: var(--color-ink);
    background: var(--app-bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  button, input, textarea, select { font: inherit; }

  button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-ink-muted);
    background: var(--app-button-bg);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    font-size: 13px;
  }
  button:hover:not(:disabled) {
    border-color: var(--color-border-input);
    background: var(--color-surface-hover);
    color: var(--color-ink);
  }
  button:disabled { cursor: not-allowed; opacity: 0.4; }

  input, textarea, select {
    width: 100%;
    border: 1px solid var(--color-border-input);
    border-radius: 8px;
    color: var(--color-ink);
    background: var(--app-input-bg);
    outline: none;
  }
  input:focus, textarea:focus, select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 20%, transparent), 0 0 30px color-mix(in srgb, var(--color-accent) 7%, transparent);
  }
  input { height: 34px; padding: 0 11px; }
  textarea { resize: vertical; min-height: 132px; padding: 10px 11px; line-height: 1.45; }
  select { height: 34px; padding: 0 9px; }

  select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 34px;
    padding: 0 32px 0 11px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    color: var(--color-ink);
    background-color: var(--color-surface-raised);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235e6e9c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    outline: none;
    cursor: pointer;
    font-size: 13px;
  }
  select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(90, 140, 248, 0.18);
  }
  select option { background: var(--app-select-option-bg); color: var(--color-ink); }
}

@layer components {
  /* --- Shared utilities --- */

  .btn-sm { min-height: 26px; padding: 0 8px; font-size: 12px; }

  .select-menu { position: relative; width: 100%; min-width: 0; }
  .select-menu-trigger {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    height: 34px;
    min-height: 34px;
    padding: 0 9px 0 11px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    color: var(--color-ink);
    background: var(--color-surface-raised);
    font-size: 13px;
    text-align: left;
  }
  .select-menu-value { display: flex; align-items: center; min-width: 0; gap: 7px; overflow: hidden; }
  .select-menu-value > span { overflow: hidden; color: var(--color-ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .select-menu-value > small {
    flex: 0 0 auto;
    padding: 2px 5px;
    border: 1px solid color-mix(in srgb, var(--color-accent) 28%, transparent);
    border-radius: 4px;
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 9%, transparent);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.025em;
  }
  .select-menu-value.placeholder > span { color: var(--color-ink-muted); font-weight: 600; }
  .select-menu-trigger svg { color: var(--color-ink-faint); transition: transform 120ms ease; }
  .select-menu.open .select-menu-trigger {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(90, 140, 248, 0.18);
  }
  .select-menu.open .select-menu-trigger svg { transform: rotate(180deg); }
  .select-menu-popup {
    position: fixed;
    z-index: 1000;
    display: grid;
    gap: 2px;
    padding: 5px;
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-solid);
    box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  }
  .select-menu-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 5px 3px 2px;
    padding: 7px 5px 5px;
    border-top: 1px solid var(--color-border-subtle);
    color: var(--color-accent);
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: 0.065em;
    text-transform: uppercase;
  }
  .select-menu-group:first-child { margin-top: 0; border-top: 0; }
  .select-menu-group small {
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    color: var(--color-ink);
    background: var(--color-surface-hover);
    font-size: 9px;
    letter-spacing: 0;
    text-align: center;
  }
  .select-menu-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14px;
    align-items: center;
    justify-content: initial;
    width: 100%;
    min-height: 30px;
    padding: 6px 8px;
    border-color: transparent;
    border-radius: 6px;
    color: var(--color-ink);
    background: transparent;
    font-size: 12px;
    font-weight: 750;
    text-align: left;
  }
  .select-menu-option > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .select-menu-option svg { color: var(--color-primary); }
  .select-menu-option:hover:not(:disabled), .select-menu-option.active:not(:disabled) {
    border-color: var(--color-border-subtle);
    color: var(--color-ink);
    background: rgba(255,255,255,0.06);
  }
  .select-menu-option.selected { color: var(--color-ink); }
  .select-menu-option:disabled { cursor: not-allowed; opacity: 0.42; }

  .compare-target-select .select-menu-trigger {
    height: 38px;
    min-height: 38px;
    padding: 0 11px;
    border-color: var(--color-border);
    font-size: 12px;
    font-weight: 700;
  }

  .btn-primary {
    border-color: color-mix(in srgb, var(--color-primary) 82%, white);
    color: #ffffff;
    background: var(--color-primary);
    box-shadow: none;
    font-weight: 600;
  }
  .btn-primary:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--color-accent) 78%, white);
    background: var(--color-accent);
    color: #ffffff;
  }

  .btn-secondary {
    border-color: rgba(77, 182, 214, 0.3);
    color: #b8e7f6;
    background: linear-gradient(180deg, rgba(77, 182, 214, 0.1), rgba(111, 140, 255, 0.07));
    font-weight: 700;
  }
  .btn-secondary:hover:not(:disabled) {
    border-color: rgba(77, 182, 214, 0.58);
    color: #ffffff;
    background: linear-gradient(180deg, rgba(77, 182, 214, 0.16), rgba(111, 140, 255, 0.12));
  }

  .btn-danger {
    border-color: rgba(255, 90, 103, 0.72);
    color: #ffffff;
    background: linear-gradient(135deg, rgba(255, 90, 103, 0.92), rgba(195, 44, 64, 0.9));
    box-shadow: 0 0 22px rgba(255, 90, 103, 0.16);
    font-weight: 700;
  }
  .btn-danger:hover:not(:disabled) {
    border-color: rgba(255, 161, 169, 0.86);
    color: #ffffff;
    background: linear-gradient(135deg, rgba(255, 111, 124, 0.96), rgba(214, 55, 77, 0.95));
  }

  .panel {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background:
      var(--app-panel-highlight),
      var(--color-surface);
    box-shadow: var(--app-panel-shadow);
    backdrop-filter: blur(16px);
  }

  .section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: linear-gradient(90deg, rgba(111,140,255,0.07), rgba(77,182,214,0.025));
  }
  .section-head h2 { margin: 1px 0 0; color: var(--color-ink); font-size: 14px; line-height: 1.2; font-weight: 600; }

  .section-head-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
  }

  .graph-branch-dialog-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 0 9px;
    overflow: hidden;
    border: 1px solid rgba(91,209,138,0.24);
    border-radius: 999px;
    color: #b6f1c4;
    background: rgba(34,68,48,0.28);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
  }

  .graph-branch-dialog-button:hover {
    border-color: rgba(91,209,138,0.42);
    background: rgba(34,68,48,0.42);
  }

  .graph-branch-dialog-button span {
    padding: 1px 5px;
    border-radius: 999px;
    color: #061021;
    background: #6ce18f;
    font-size: 10px;
    line-height: 1.2;
  }

  .branch-filter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #050712;
  }

  .branch-filter-dialog {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    width: min(520px, 100%);
    max-height: min(680px, calc(100vh - 48px));
    overflow: hidden;
    border: 1px solid rgba(94,110,156,0.24);
    border-radius: 10px;
    background:
      linear-gradient(180deg, #20253f 0%, #151827 72%),
      #151827;
    box-shadow: 0 24px 80px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.05);
  }

  .branch-filter-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: linear-gradient(90deg, rgba(100,108,255,0.12), rgba(65,209,255,0.04));
  }

  .branch-filter-dialog-head h3 {
    margin: 1px 0 0;
    color: var(--color-ink);
    font-size: 16px;
    font-weight: 750;
  }

  .dialog-icon-button {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(94,110,156,0.18);
    border-radius: 7px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.035);
  }

  .dialog-icon-button:hover {
    color: var(--color-ink);
    border-color: rgba(65,209,255,0.28);
    background: rgba(65,209,255,0.08);
  }

  .branch-filter-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-ink-dim);
    font-size: 12px;
    font-weight: 700;
  }

  .branch-filter-actions {
    display: inline-flex;
    gap: 6px;
  }

  .branch-filter-actions button {
    min-height: 24px;
    padding: 0 8px;
    border-color: rgba(94,110,156,0.16);
    border-radius: 999px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.035);
    font-size: 10.5px;
    font-weight: 800;
  }

  .branch-filter-actions button:hover:not(:disabled) {
    border-color: rgba(65,209,255,0.28);
    color: var(--color-ink);
    background: rgba(65,209,255,0.08);
  }

  .branch-filter-actions button:disabled {
    cursor: default;
    opacity: 0.45;
  }

  .branch-filter-dialog-list {
    display: grid;
    align-content: start;
    gap: 4px;
    min-height: 0;
    padding: 8px;
    overflow: auto;
    scrollbar-width: thin;
  }

  .branch-filter-option {
    display: grid;
    grid-template-columns: 16px 16px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #a8eeba;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
  }

  .branch-filter-option:hover {
    border-color: rgba(91,209,138,0.18);
    background: rgba(34,68,48,0.22);
  }

  .branch-filter-option.muted {
    color: var(--color-ink-faint);
    opacity: 0.72;
  }

  .branch-filter-option input {
    width: 14px;
    height: 14px;
    accent-color: #6ce18f;
  }

  .branch-filter-option svg {
    color: currentColor;
  }

  .branch-filter-option span {
    min-width: 0;
    overflow: hidden;
    font-family: var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .eyebrow {
    display: block;
    color: var(--color-ink-faint);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }

  .pill {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }
  .pill-count  { color: var(--color-ink-dim); background: rgba(94, 110, 156, 0.15); }
  .pill-active { color: #4eca76; background: rgba(78, 202, 118, 0.13); }

  .blank-state {
    display: grid;
    place-items: center;
    min-height: 72px;
    padding: 14px;
    color: var(--color-ink-faint);
    font-size: 13px;
    text-align: center;
  }

  .status-badge {
    display: inline-block;
    min-width: 72px;
    padding: 2px 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.02em;
  }
  .status-badge.modified   { color: #e0a040; background: rgba(224,160,64,0.13); border-color: rgba(224,160,64,0.22); }
  .status-badge.added,
  .status-badge.untracked  { color: #4eca76; background: rgba(78,202,118,0.11); border-color: rgba(78,202,118,0.22); }
  .status-badge.deleted    { color: #e86060; background: rgba(232,96,96,0.11); border-color: rgba(232,96,96,0.22); }
  .status-badge.renamed    { color: #7aacff; background: rgba(122,172,255,0.11); border-color: rgba(122,172,255,0.22); }
  .status-badge.conflicted { color: #d060c0; background: rgba(208,96,192,0.11); border-color: rgba(208,96,192,0.22); }
  .status-badge.unknown,
  .status-badge.none       { color: var(--color-ink-dim); background: rgba(94,110,156,0.12); border-color: rgba(94,110,156,0.2); }

  .quiet { overflow: hidden; color: var(--color-ink-faint); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

  .spin { animation: spin 900ms linear infinite; }

  /* --- App shell --- */

  .shell {
    --app-titlebar-height: 42px;
    --app-toolbar-height: 58px;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
  }

  .shell-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    padding: 8px 12px 12px;
    gap: 8px;
  }

  /* --- Titlebar --- */

  .titlebar {
    position: relative;
    z-index: 500;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    height: var(--app-titlebar-height);
    background:
      linear-gradient(90deg, rgba(111,140,255,0.08), rgba(77,182,214,0.045), rgba(255,255,255,0.012)),
      var(--color-bar);
    color: var(--color-bar-text);
    user-select: none;
    flex-shrink: 0;
    -webkit-app-region: drag;
  }

  .titlebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 13px 0 11px;
    height: 100%;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--color-bar-text);
    border-right: 1px solid rgba(255,255,255,0.06);
  }
  .titlebar-brand-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
  }
  .titlebar-brand-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
  }

  .tb-version {
    margin-left: 1px;
    color: rgba(255,255,255,0.32);
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.01em;
  }

  .titlebar-info {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    min-width: 0;
    height: 100%;
    overflow: hidden;
  }
  .titlebar-context {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 6px;
    overflow: hidden;
  }
  .titlebar-context svg { color: var(--color-accent); flex: 0 0 auto; }

  .tb-repo   { flex: 0 1 160px; min-width: 0; color: var(--color-bar-muted); font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tb-sep    { flex: 0 0 auto; color: rgba(255,255,255,0.22); font-size: 13px; }
  .tb-branch { flex: 1 1 auto; min-width: 0; max-width: 220px; color: #f5f7ff; font-size: 12px; font-weight: 700; font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .tb-sync-group { display: inline-flex; align-items: center; gap: 4px; min-width: max-content; }
  .tb-sync { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; flex-shrink: 0; }
  .tb-sync.ahead  { color: #e0a040; background: rgba(224,160,64,0.13); }
  .tb-sync.behind { color: #7aacff; background: rgba(122,172,255,0.13); }

  .tb-no-repo { color: var(--color-bar-muted); font-size: 12px; font-style: italic; }

  /* App-global actions (help, settings) that must stay reachable in every view,
     including Repository Management where the repo toolbar is hidden. */
  .titlebar-globals {
    display: flex;
    align-items: stretch;
    height: 100%;
  }

  /* Repository actions are ordered by workflow: sync, inspect/history, utilities. */
  .repo-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: var(--app-toolbar-height);
    padding: 5px 8px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    background: rgba(16, 17, 29, 0.9);
    flex-shrink: 0;
    overflow: visible;
    user-select: none;
  }

  .repo-toolbar-sync {
    display: grid;
    grid-template-rows: 11px 34px;
    gap: 2px;
    align-self: stretch;
    min-width: 0;
  }
  .repo-toolbar-group-label {
    padding-left: 6px;
    color: var(--color-ink-faint);
    font-size: 8px;
    font-weight: 850;
    line-height: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .repo-action-group {
    display: flex;
    align-items: stretch;
    height: 34px;
    min-width: 0;
    border: 1px solid var(--color-border-subtle);
    border-radius: 7px;
    background: rgba(255,255,255,0.018);
  }
  .repo-action-group > .repo-action,
  .repo-action-group > .repo-history-wrap > .repo-action {
    border-right: 1px solid var(--color-border-subtle);
  }
  .repo-action-group > .repo-action:last-child,
  .repo-action-group > .repo-history-wrap:last-child > .repo-action {
    border-right: 0;
  }
  .repo-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 38px;
    height: 32px;
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    color: var(--color-ink-muted);
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: color 120ms ease, background 120ms ease;
    -webkit-app-region: no-drag;
  }
  .repo-action:first-child { border-radius: 6px 0 0 6px; }
  .repo-action:last-child { border-radius: 0 6px 6px 0; }
  .repo-action:only-child { border-radius: 6px; }
  .repo-action:hover:not(:disabled),
  .repo-action.active {
    color: var(--color-ink);
    background: var(--color-surface-hover);
  }
  .repo-action:disabled { opacity: 0.34; cursor: not-allowed; }
  .repo-action.sync-primary { color: var(--color-accent); }
  .repo-action.sync-primary:hover:not(:disabled) { background: rgba(90,140,248,0.1); }
  .repo-action-label { font-size: 12px; font-weight: 750; }
  .repo-action-count {
    color: currentColor;
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 850;
  }
  .repo-action-count.behind { color: #7aacff; }
  .repo-action-count.ahead { color: #e0a040; }
  .repo-action.sync-primary.publish-local {
    color: #f0bd6b;
    background: linear-gradient(180deg, rgba(224,160,64,.1), rgba(224,160,64,.045));
  }
  .repo-action.sync-primary.publish-local:hover:not(:disabled) {
    color: #ffd48c;
    background: rgba(224,160,64,.14);
  }
  .repo-action-local-marker {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 16px;
    padding: 0 4px;
    border: 1px dashed rgba(240,189,107,.5);
    border-radius: 4px;
    color: #f0bd6b;
    background: rgba(224,160,64,.08);
    font-family: var(--font-mono);
    font-size: 7.5px;
    font-weight: 900;
    letter-spacing: .04em;
  }
  .repo-toolbar-divider {
    width: 1px;
    height: 30px;
    margin: 0 1px 2px;
    background: var(--color-border-subtle);
    flex: 0 0 auto;
  }
  .repo-toolbar-spacer { flex: 1 1 auto; min-width: 6px; }
  .repo-inspect-actions,
  .repo-utility-actions { margin-bottom: 1px; }
  .repo-history-wrap { position: relative; height: 32px; }
  .history-trigger { border-radius: 0 6px 6px 0; }
  .history-trigger .history-chevron { transition: transform 120ms ease; }
  .history-trigger.active .history-chevron { transform: rotate(180deg); }
  .repo-history-menu {
    position: absolute;
    z-index: 90;
    top: calc(100% + 7px);
    right: -1px;
    display: grid;
    width: 240px;
    padding: 5px;
    border: 1px solid var(--color-border);
    border-radius: 9px;
    background: var(--color-surface-raised);
    box-shadow: 0 16px 42px rgba(0,0,0,0.36);
  }
  .repo-history-menu > button {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 7px 8px;
    border: 0;
    border-radius: 6px;
    color: var(--color-ink-muted);
    background: transparent;
    text-align: left;
  }
  .repo-history-menu > button:hover { color: var(--color-ink); background: var(--color-surface-hover); }
  .repo-history-menu > button > svg { color: var(--color-accent); }
  .repo-history-menu > button > span { display: grid; gap: 2px; min-width: 0; }
  .repo-history-menu strong { color: inherit; font-size: 11px; }
  .repo-history-menu small { overflow: hidden; color: var(--color-ink-faint); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
  .repo-utility-actions { flex: 0 0 auto; }
  .repo-action.icon-action { width: 36px; padding: 0; }
  .repo-auto-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    min-height: 32px;
    padding: 0 8px 0 10px;
    border: 0;
    border-radius: 0 6px 6px 0;
    color: var(--color-ink-muted);
    background: transparent;
    font-size: 11.5px;
    font-weight: 750;
  }
  .repo-auto-toggle:hover { color: var(--color-ink); background: var(--color-surface-hover); }
  .repo-switch {
    position: relative;
    width: 27px;
    height: 15px;
    border-radius: 999px;
    background: var(--color-border-input);
    transition: background 140ms ease;
  }
  .repo-switch > span {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.28);
    transition: transform 140ms ease;
  }
  .repo-auto-toggle.active { color: #4eca76; }
  .repo-auto-toggle.active .repo-switch { background: #26924f; }
  .repo-auto-toggle.active .repo-switch > span { transform: translateX(12px); }
  .repo-switch.busy { box-shadow: 0 0 0 3px rgba(78,202,118,0.12); }

  .tb-action {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 100%;
    min-height: unset;
    padding: 0 10px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--color-bar-muted);
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 120ms ease, color 120ms ease;
    -webkit-app-region: no-drag;
  }
  .tb-action:hover:not(:disabled) { background: rgba(255,255,255,0.06); border-color: transparent; color: #d6def0; }
  .tb-action:disabled { opacity: 0.3; cursor: not-allowed; }
  .tb-action.auto-toggle.active { color: #4eca76; }
  .tb-action.auto-toggle.active:hover:not(:disabled) { color: #6ee090; background: rgba(78,202,118,0.1); }
  .tb-action-label { font-size: 12px; font-weight: 600; }

  .titlebar-divider { width: 1px; margin: 8px 6px; background: rgba(255,255,255,0.08); flex-shrink: 0; }

  .titlebar-controls { display: flex; align-items: stretch; height: 100%; border-left: 1px solid rgba(255,255,255,0.06); }

  .tb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 100%;
    min-height: unset;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #536078;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    -webkit-app-region: no-drag;
  }
  .tb-btn:hover:not(:disabled) { background: rgba(255,255,255,0.08); border-color: transparent; color: #d6def0; }
  .tb-btn.close:hover:not(:disabled) { background: #c0392b; color: #ffffff; }

  /* --- Top bar (repo form) --- */

  .topbar {
    padding: 9px 10px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background:
      linear-gradient(90deg, rgba(111,140,255,0.055), rgba(77,182,214,0.045), rgba(255,255,255,0.012)),
      var(--color-surface);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(16px);
  }

  .repo-form {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 9px;
  }
  .repo-form label { color: var(--color-ink-faint); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
  .repo-browse { min-width: 104px; }

  /* --- Repository tabs + management --- */

  .repo-tabbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
    min-height: 44px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    background: rgba(13, 15, 25, 0.92);
    overflow: hidden;
  }

  .repo-tabs-scroll {
    display: flex;
    align-items: stretch;
    min-width: 0;
    border-left: 1px solid var(--color-border-subtle);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  .repo-tab-wrap {
    display: flex;
    align-items: stretch;
    flex: 0 1 230px;
    min-width: 150px;
    max-width: 260px;
    position: relative;
    border-right: 1px solid var(--color-border-subtle);
    background: rgba(255,255,255,0.012);
    transition: background 120ms ease;
  }
  .repo-tab-wrap:hover { background: rgba(255,255,255,0.035); }
  .repo-tab-wrap.active {
    background: linear-gradient(180deg, rgba(90,140,248,0.14), rgba(23,29,43,0.96));
    box-shadow: inset 0 -3px 0 var(--color-primary);
  }

  .repo-tab {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 42px;
    min-width: 0;
    max-width: none;
    padding: 0 8px 0 13px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--color-ink-muted);
    font-size: 12px;
    font-weight: 720;
    text-align: left;
  }
  .repo-tab > svg { flex: 0 0 auto; color: var(--color-ink-faint); }
  .repo-tab.management {
    min-width: 184px;
    border: 0;
    box-shadow: inset 0 -3px 0 transparent;
  }
  .repo-tab.management.active {
    color: var(--color-ink);
    background: linear-gradient(180deg, rgba(90,140,248,0.14), rgba(23,29,43,0.96));
    box-shadow: inset 0 -3px 0 var(--color-primary);
  }
  .repo-tab.management:hover:not(:disabled) { background: var(--color-surface-hover); }
  .repo-tab-wrap.active .repo-tab {
    color: var(--color-ink);
  }
  .repo-tab-wrap.active .repo-tab > svg,
  .repo-tab.management.active > svg { color: var(--color-accent); }
  .repo-tab span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .repo-tab-close,
  .repo-tab-add {
    min-height: 42px;
    min-width: 36px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--color-ink-faint);
  }
  .repo-tab-close {
    display: grid;
    place-items: center;
    align-self: center;
    min-width: 26px;
    width: 26px;
    max-width: 26px;
    min-height: 26px;
    height: 26px;
    max-height: 26px;
    flex: 0 0 26px;
    margin-right: 6px;
    border-radius: 5px;
    opacity: 0.58;
    transition: opacity 120ms ease, color 120ms ease, background 120ms ease;
  }
  .repo-tab-wrap:hover .repo-tab-close,
  .repo-tab-wrap.active .repo-tab-close { opacity: 1; }
  .repo-tab-close:hover:not(:disabled),
  .repo-tab-close:focus-visible:not(:disabled) {
    color: #ff6673;
    background: rgba(255, 90, 103, 0.13);
  }
  .repo-tab-add {
    min-width: 44px;
    border-left: 1px solid var(--color-border-subtle);
  }
  .repo-tab-add:hover:not(:disabled) { color: var(--color-accent); background: var(--color-surface-hover); }

  .repo-management {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    flex: 1 1 0;
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: rgba(20, 21, 34, 0.82);
    overflow: hidden;
  }

  .repo-management-head,
  .repo-management-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--color-surface-dim);
  }
  .repo-management-head h1 {
    margin: 2px 0 0;
    color: var(--color-ink);
    font-size: 18px;
    line-height: 1.2;
  }
  .repo-management-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .repo-management-tools {
    padding: 9px 16px;
    background: rgba(12, 13, 24, 0.72);
  }
  .repo-search {
    position: relative;
    width: min(620px, 100%);
  }
  .repo-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    color: var(--color-ink-faint);
    transform: translateY(-50%);
    pointer-events: none;
  }
  .repo-search input {
    padding-left: 34px;
  }

  .repo-sections {
    min-height: 0;
    overflow: auto;
    padding: 14px 16px 18px;
  }

  .repo-section {
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: rgba(255,255,255,0.018);
    overflow: hidden;
  }
  .repo-section + .repo-section { margin-top: 12px; }
  .repo-section > header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: rgba(255,255,255,0.045);
  }
  .repo-section h2 {
    margin: 0;
    color: var(--color-ink);
    font-size: 13px;
    font-weight: 800;
  }
  .repo-section > header span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 20px;
    border-radius: 999px;
    background: rgba(94, 110, 156, 0.18);
    color: var(--color-ink-dim);
    font-size: 11px;
    font-weight: 800;
  }

  .repo-empty {
    padding: 20px 24px;
    color: var(--color-ink-faint);
    font-size: 13px;
    font-style: italic;
  }

  .repo-table {
    display: grid;
  }
  .repo-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: stretch;
    min-height: 36px;
    border-bottom: 1px solid rgba(255,255,255,0.035);
  }
  .repo-row:last-child { border-bottom: 0; }
  .repo-row-main {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) minmax(160px, 360px);
    justify-content: stretch;
    min-height: 36px;
    padding: 0 10px 0 28px;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: left;
  }
  .repo-row-main:hover:not(:disabled) {
    background: rgba(90, 140, 248, 0.08);
  }
  .repo-row-name,
  .repo-row-path,
  .repo-row-meta {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    color: var(--color-ink-muted);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .repo-row-path {
    color: var(--color-ink-faint);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
  }
  .repo-row-meta {
    gap: 5px;
    justify-content: flex-start;
    color: var(--color-ink-dim);
  }
  .repo-row-meta strong,
  .repo-row-meta em {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 20px;
    padding: 0 6px;
    border-radius: 4px;
    background: rgba(94, 110, 156, 0.18);
    color: var(--color-ink-dim);
    font-size: 10.5px;
    font-style: normal;
    font-weight: 800;
  }
  .repo-row-meta .ahead { color: #e0a040; background: rgba(224,160,64,0.13); }
  .repo-row-meta .behind { color: #7aacff; background: rgba(122,172,255,0.13); }
  .repo-row-icon {
    min-height: 36px;
    min-width: 36px;
    padding: 0;
    border: 0;
    border-left: 1px solid rgba(255,255,255,0.035);
    border-radius: 0;
    background: transparent;
    color: var(--color-ink-faint);
  }
  .repo-row-favorite.active {
    color: #e0c15f;
  }
  .repo-row-favorite.active svg {
    fill: currentColor;
  }

  /* --- Notices --- */

  .notice {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 5px 11px;
    border: 1px solid;
    border-radius: 8px;
    font-size: 13px;
    flex-shrink: 0;
  }
  .notice.error    { border-color: rgba(232,96,90,0.3); color: #f09090; background: rgba(232,96,90,0.08); }
  .notice.busy     { border-color: rgba(90,140,248,0.28); color: #8ab0f8; background: rgba(90,140,248,0.07); }
  .notice.conflict { border-color: rgba(224,160,64,0.3); color: #e8b060; background: rgba(224,160,64,0.07); }
  .notice.rebase   { flex-wrap: wrap; border-color: rgba(186,130,255,0.3); color: #c9a8ff; background: rgba(186,130,255,0.075); }
  .notice.rebase span { min-width: 0; flex: 1 1 auto; }
  .notice.conflict button {
    margin-left: auto;
    min-height: 26px;
    padding: 0 10px;
    border-color: rgba(224,160,64,0.3);
    color: #e8b060;
    background: rgba(224,160,64,0.1);
    font-size: 12px;
    font-weight: 700;
  }
  .notice.conflict button:hover:not(:disabled) {
    background: rgba(224,160,64,0.18);
    border-color: rgba(224,160,64,0.45);
    color: #f0c070;
  }
  .notice.rebase button {
    min-height: 26px;
    padding: 0 10px;
    border-color: rgba(186,130,255,0.28);
    color: #d5bdff;
    background: rgba(186,130,255,0.1);
    font-size: 12px;
    font-weight: 700;
  }
  .notice.rebase button:hover:not(:disabled) {
    background: rgba(186,130,255,0.18);
    border-color: rgba(186,130,255,0.45);
    color: #eadfff;
  }

  /* --- Global error toast --- */

  .error-toast-region {
    position: fixed;
    top: calc(var(--app-titlebar-height, 40px) + 14px);
    left: 50%;
    z-index: 90;
    width: min(560px, calc(100vw - 32px));
    pointer-events: none;
    transform: translateX(-50%);
  }

  .error-toast {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 11px;
    width: 100%;
    padding: 13px 13px 14px;
    overflow: hidden;
    border: 1px solid rgba(232,96,96,0.46);
    border-radius: 13px;
    color: var(--color-ink);
    background:
      linear-gradient(135deg, rgba(232,96,96,0.18), rgba(100,108,255,0.08)),
      rgba(12,13,24,0.96);
    box-shadow: 0 18px 54px rgba(0,0,0,0.46), 0 0 0 1px rgba(255,255,255,0.035) inset;
    backdrop-filter: blur(18px);
    pointer-events: auto;
    animation: error-toast-in 180ms cubic-bezier(.2,.8,.2,1) both;
  }

  .error-toast-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(232,96,96,0.28);
    border-radius: 10px;
    color: #ff9b9b;
    background: rgba(232,96,96,0.12);
  }

  .error-toast-content {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding-top: 1px;
  }

  .error-toast-content strong {
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
  }

  .error-toast-content span {
    color: var(--color-ink-muted);
    font-size: 12.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .error-toast-close {
    width: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border-color: rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.04);
  }

  .error-toast-close:hover:not(:disabled) {
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    background: rgba(255,255,255,0.1);
  }

  .error-toast-timeout {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #ff7878, #ef9a9a);
    transform-origin: left;
    animation: error-toast-timeout 6s linear both;
  }

  .error-toast:hover .error-toast-timeout {
    animation-play-state: paused;
  }

  @keyframes error-toast-in {
    from { opacity: 0; transform: translateY(-10px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes error-toast-timeout {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
  }

  /* --- Update toast --- */

  .update-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 70;
    width: min(410px, calc(100vw - 28px));
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-top: 2px solid var(--color-accent);
    color: var(--color-ink);
    background: var(--app-dialog-bg);
    box-shadow: 0 18px 48px rgba(0,0,0,0.42);
    animation: update-toast-in 180ms cubic-bezier(.2,.8,.2,1) both;
  }
  .update-toast.error {
    border-top-color: var(--code-delete-strong);
  }
  .update-toast.installed {
    border-top-color: var(--code-add-strong);
  }

  .update-toast-header {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px 11px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--app-dialog-chrome);
  }

  .update-toast-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--color-accent) 32%, var(--color-border));
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 9%, var(--color-surface-raised));
  }
  .update-toast.error .update-toast-icon {
    border-color: color-mix(in srgb, var(--code-delete-strong) 34%, var(--color-border));
    color: var(--code-delete-strong);
    background: var(--code-delete-bg);
  }
  .update-toast.installed .update-toast-icon {
    border-color: color-mix(in srgb, var(--code-add-strong) 34%, var(--color-border));
    color: var(--code-add-strong);
    background: var(--code-add-bg);
  }
  .update-toast-icon.busy { color: var(--color-accent); }

  .update-toast-body {
    display: grid;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    background: var(--app-dialog-bg);
  }

  .update-toast-copy { min-width: 0; }
  .update-toast-kicker {
    display: block;
    overflow: hidden;
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .update-toast h2 {
    margin: 3px 0 0;
    color: var(--color-ink);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
  }
  .update-toast p {
    margin: 0;
    color: var(--color-ink-muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .update-toast-close {
    width: 26px;
    min-width: 26px;
    min-height: 26px;
    padding: 0;
    border-color: var(--color-border-subtle);
    color: var(--color-ink-dim);
    background: transparent;
  }
  .update-toast-close:hover:not(:disabled) {
    border-color: var(--color-border);
    color: var(--color-ink);
    background: var(--color-surface-hover);
  }

  .update-progress {
    position: relative;
    height: 4px;
    overflow: hidden;
    background: var(--color-surface-hover);
  }
  .update-progress span {
    position: absolute;
    inset: 0 auto 0 0;
    min-width: 0;
    background: var(--color-accent);
    transition: width 160ms ease;
  }
  .update-progress.indeterminate span {
    width: 42% !important;
    animation: update-progress-slide 1.1s ease-in-out infinite;
  }
  .update-progress-label {
    margin-top: -3px;
    color: var(--color-ink-faint);
    font-size: 11px;
    font-weight: 700;
  }

  .update-toast-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 49px;
    padding: 8px 11px;
    border-top: 1px solid var(--color-border-subtle);
    background: var(--app-dialog-chrome);
  }
  .update-toast-primary,
  .update-toast-secondary {
    min-height: 31px;
    font-size: 11.5px;
    font-weight: 800;
  }
  .update-toast-primary {
    border-color: var(--color-primary);
    color: #ffffff;
    background: var(--color-primary);
  }
  .update-toast-primary:hover:not(:disabled) {
    border-color: var(--color-primary-dark);
    color: #ffffff;
    background: var(--color-primary-dark);
  }
  .update-toast-secondary {
    border-color: var(--color-border);
    color: var(--color-ink-muted);
    background: var(--app-button-bg);
  }

  @keyframes update-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @media (max-width: 480px) {
    .update-toast {
      right: 8px;
      bottom: 8px;
      width: calc(100vw - 16px);
    }
    .update-toast-actions > button {
      flex: 1 1 0;
    }
  }

  /* --- Workspace layout --- */

  .workspace {
    display: grid;
    grid-template-columns: minmax(220px, var(--left-sidebar-width, 280px)) 8px minmax(0, 1fr) 8px minmax(var(--history-aside-min-width, 420px), var(--history-aside-width, 620px));
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    column-gap: 0;
    row-gap: 8px;
  }

  .history-aside {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    column-gap: 0;
    row-gap: 8px;
  }

  .left-sidebar-resize-handle,
  .history-resize-handle {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 8px;
    cursor: col-resize;
    touch-action: none;
  }
  .left-sidebar-resize-handle::before,
  .history-resize-handle::before {
    content: "";
    width: 3px;
    height: 40px;
    border-radius: 999px;
    background: var(--color-border);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
  }
  .left-sidebar-resize-handle:hover::before,
  .left-sidebar-resize-handle.resizing::before,
  .history-resize-handle:hover::before,
  .history-resize-handle.resizing::before {
    background: var(--color-accent);
    box-shadow: 0 0 14px rgba(65,209,255,0.3);
  }
  .left-sidebar-resize-handle:focus-visible,
  .history-resize-handle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }

  .left-sidebar {
    display: grid;
    grid-template-rows: minmax(180px, var(--branch-panel-height, 260px)) 14px minmax(150px, var(--stash-panel-height, 190px)) 14px minmax(220px, 1fr);
    align-content: start;
    min-width: 0;
    min-height: 0;
    gap: 0;
  }

  .left-panel-resize-handle {
    min-height: 14px;
    margin: 0;
  }

  .left-panel-resize-placeholder {
    display: block;
    min-height: 0;
    min-width: 0;
  }

  .left-sidebar.branch-collapsed {
    grid-template-rows: auto 0 minmax(150px, var(--stash-panel-height, 190px)) 14px minmax(220px, 1fr);
  }

  .left-sidebar.explorer-collapsed {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 260px)) 14px minmax(150px, var(--stash-panel-height, 190px)) 0 auto;
  }

  .left-sidebar.branch-collapsed.explorer-collapsed {
    grid-template-rows: auto 0 minmax(150px, var(--stash-panel-height, 190px)) 0 auto;
  }

  .left-sidebar:has(.stash-panel.collapsed) {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 260px)) 14px auto 0 minmax(220px, 1fr);
  }

  .left-sidebar.branch-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: auto 0 auto 0 minmax(220px, 1fr);
  }

  .left-sidebar.explorer-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 260px)) 14px auto 0 auto;
  }

  .left-sidebar.branch-collapsed.explorer-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: auto 0 auto 0 auto;
    align-content: start;
  }

  /* --- Main panel --- */

  .main-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    overflow: hidden;
  }

  .repo-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 46px;
    padding: 0 14px;
    border-bottom: 1px solid var(--color-border-subtle);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-surface-dim);
  }

  .repo-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    overflow: hidden;
  }
  .repo-meta svg { color: var(--color-primary); flex-shrink: 0; }
  .repo-branch {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    max-width: 220px;
    color: var(--color-ink);
  }
  .repo-path {
    color: var(--color-ink-faint);
    font-size: 11.5px;
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sync-stats, .status-counts { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; flex-shrink: 0; }
  .sync-stats strong, .sync-stats span {
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }
  .sync-stats strong:first-of-type { color: #e0a040; background: rgba(224,160,64,0.13); }
  .sync-stats strong:last-of-type  { color: #7aacff; background: rgba(122,172,255,0.13); }
  .sync-stats span { color: var(--color-ink-dim); background: rgba(94,110,156,0.13); }
  .sync-stats .sync-local-only {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border: 1px dashed rgba(224,160,64,.38);
    color: #f0bd6b;
    background: rgba(224,160,64,.09);
  }
  .sync-stats .sync-local-only strong {
    padding: 0;
    color: #f0bd6b;
    background: transparent;
    font-size: 10.5px;
    font-weight: 850;
  }
  .sync-stats .sync-local-only small {
    color: var(--color-ink-faint);
    font-size: 9px;
    font-weight: 650;
  }

  .top-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(120px, 1fr) 14px var(--commit-panel-height, 220px);
    min-height: 0;
    gap: 0;
    padding: 8px;
    overflow: hidden;
  }

  .panel-resize-handle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: row-resize;
    touch-action: none;
  }
  .panel-resize-handle::before {
    content: "";
    width: 40px;
    height: 3px;
    border-radius: 999px;
    background: var(--color-border);
    transition: background-color 0.15s ease;
  }
  .panel-resize-handle:hover::before,
  .panel-resize-handle.resizing::before {
    background: var(--color-accent);
  }
  .panel-resize-handle:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
    border-radius: 4px;
  }

  /* --- File list / change lanes --- */

  .file-list { padding: 6px; overflow: auto; }

  .file-row { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-surface-raised); }
  .file-row + .file-row { margin-top: 6px; }
  .file-row.selected { border-color: rgba(90,140,248,0.36); background: rgba(90,140,248,0.1); }
  .file-row.active { box-shadow: inset 3px 0 0 rgba(65,209,255,0.7); }

  .file-title-button {
    justify-content: flex-start;
    width: 100%;
    min-height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
  }
  .file-title-button:hover:not(:disabled) {
    background: transparent;
    color: var(--color-accent);
  }

  .file-title strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--color-ink);
  }

  .change-lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

  .change-lane {
    display: grid;
    grid-template-rows: auto auto;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
  }
  .change-lane.inactive { opacity: 0.5; }
  .lane-header { display: flex; align-items: center; gap: 8px; }
  .lane-name { color: var(--color-ink-faint); font-size: 11px; font-weight: 800; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.05em; }
  .lane-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

  .status-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--color-surface-dim);
  }
  .status-selection-count {
    padding: 0 7px;
    color: var(--color-ink-dim);
    font-size: 11.5px;
    font-weight: 800;
    white-space: nowrap;
  }

  /* --- Stash panel --- */

  .stash-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .stash-panel.collapsed {
    grid-template-rows: auto;
    min-height: 0;
  }

  .stash-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .stash-toggle {
    display: inline-grid;
    place-items: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    aspect-ratio: 1;
    flex: 0 0 28px;
    padding: 0;
    border-color: rgba(94,110,156,0.18);
    border-radius: 6px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.018);
  }

  .stash-toggle:hover:not(:disabled) {
    border-color: rgba(65,209,255,0.28);
    color: var(--color-ink);
    background: rgba(65,209,255,0.055);
  }

  .stash-create {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
    padding: 7px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--color-surface-dim);
  }

  .stash-input {
    min-width: 0;
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 7px;
    color: var(--color-ink);
    background: rgba(255,255,255,0.035);
    font-size: 12px;
  }

  .stash-input:focus {
    border-color: rgba(65,209,255,0.42);
    outline: none;
    box-shadow: 0 0 0 2px rgba(65,209,255,0.1);
  }

  .stash-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-ink-dim);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }

  .stash-check input {
    width: 13px;
    height: 13px;
    accent-color: var(--color-accent);
  }

  .stash-save-button {
    border-color: rgba(65,209,255,0.18);
    color: var(--color-ink);
    background: rgba(65,209,255,0.075);
  }

  .stash-list {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 0;
    padding: 7px;
    overflow: auto;
  }

  .stash-empty {
    min-height: 48px;
  }

  .stash-row {
    display: grid;
    gap: 7px;
    padding: 8px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-surface-raised);
  }

  .stash-row-main {
    display: grid;
    gap: 2px;
    min-width: 0;
  }

  .stash-row-main strong,
  .stash-row-main span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stash-row-main strong {
    color: var(--color-ink);
    font-size: 12px;
    font-weight: 750;
  }

  .stash-row-main span {
    color: var(--color-ink-faint);
    font-family: var(--font-mono);
    font-size: 10.5px;
  }

  .stash-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .btn-sm.danger {
    border-color: rgba(232,96,96,0.2);
    color: #ef9b9b;
    background: rgba(232,96,96,0.08);
  }

  .btn-sm.danger:hover:not(:disabled) {
    border-color: rgba(232,96,96,0.38);
    color: #ffd2d2;
    background: rgba(232,96,96,0.14);
  }

  /* --- Branch list --- */

  .branch-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .branch-panel { position: relative; }
  .branch-panel.collapsed {
    grid-template-rows: auto;
  }

  .branch-create-toggle {
    display: inline-grid;
    place-items: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    aspect-ratio: 1;
    flex: 0 0 28px;
    padding: 0;
    border-color: rgba(94,110,156,0.18);
    border-radius: 6px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.018);
  }
  .branch-create-toggle:hover:not(:disabled) {
    border-color: rgba(65,209,255,0.3);
    color: var(--color-ink);
    background: rgba(65,209,255,0.06);
  }

  .branch-list { gap: 8px; }

  .branch-create-form {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    padding: 7px 8px;
    border: 1px solid rgba(65,209,255,0.22);
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(65,209,255,0.08), rgba(100,108,255,0.07));
  }
  .branch-create-form svg { color: var(--color-accent); }
  .branch-create-form input {
    height: 30px;
    min-width: 0;
    border-radius: 7px;
    font-family: var(--font-mono);
    font-size: 12px;
  }
  .branch-create-action {
    width: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border-radius: 7px;
  }
  .branch-create-action.confirm {
    border-color: rgba(78,202,118,0.34);
    color: #6ee090;
    background: rgba(78,202,118,0.11);
  }

  .branch-group { display: grid; gap: 4px; min-width: 0; }
  .branch-group + .branch-group { margin-top: 8px; }

  .branch-group-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    justify-content: stretch;
    width: 100%;
    min-height: 28px;
    padding: 4px 6px;
    border-color: transparent;
    border-radius: 7px;
    background: rgba(255,255,255,0.02);
    color: var(--color-ink-faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-align: left;
    text-transform: uppercase;
  }
  .branch-group-toggle:hover:not(:disabled) {
    border-color: var(--color-border-subtle);
    background: rgba(255,255,255,0.05);
    color: var(--color-ink-muted);
  }
  .branch-group-toggle svg { color: var(--color-ink-faint); }

  .branch-group-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 2px 2px 5px;
    color: var(--color-ink-faint);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }
  .branch-group-count {
    display: inline-flex;
    align-items: center;
    min-height: 16px;
    padding: 0 6px;
    border-radius: 999px;
    color: var(--color-ink-dim);
    background: rgba(94,110,156,0.14);
    font-size: 10px;
  }

  .tag-group-head { display: flex; align-items: center; gap: 6px; }
  .tag-group-head .branch-group-toggle { flex: 1; min-width: 0; }
  .tag-group-head .branch-create-toggle { flex-shrink: 0; }
  .worktree-group-toggle {
    border-color: rgba(77, 182, 214, 0.12);
    background: linear-gradient(90deg, rgba(77, 182, 214, 0.055), transparent 72%);
  }
  .worktree-group-toggle:hover:not(:disabled) {
    border-color: rgba(77, 182, 214, 0.25);
    background: linear-gradient(90deg, rgba(77, 182, 214, 0.1), rgba(77, 182, 214, 0.025));
    color: var(--color-ink);
  }
  .worktree-group-toggle svg { color: #76cde7; }
  .worktree-group-toggle .branch-group-count {
    color: #9edced;
    background: rgba(77, 182, 214, 0.11);
  }

  .tag-create-form { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto auto; }

  .branch-empty {
    padding: 8px 10px;
    color: var(--color-ink-faint);
    font-size: 12px;
  }

  .branch-folder-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    justify-content: stretch;
    gap: 7px;
    width: 100%;
    min-height: 34px;
    padding: 5px 8px;
    padding-left: calc(8px + var(--branch-indent, 0px));
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--color-ink-dim);
    text-align: left;
  }
  .branch-folder-row + .branch-folder-row,
  .branch-folder-row + .branch-row,
  .branch-row + .branch-folder-row {
    margin-top: 3px;
  }
  .branch-folder-row:hover:not(:disabled) {
    border-color: var(--color-border-subtle);
    background: var(--color-surface-hover);
    color: var(--color-ink);
  }
  .branch-folder-row.current {
    border-color: rgba(78,202,118,0.2);
    background: rgba(78,202,118,0.08);
  }
  .branch-folder-row svg { color: var(--color-ink-faint); }
  .branch-folder-row.current svg { color: #4eca76; }
  .branch-folder-name {
    overflow: hidden;
    color: var(--color-ink-muted);
    font-size: 12.5px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .branch-folder-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    color: var(--color-ink-dim);
    background: rgba(94,110,156,0.14);
    font-size: 10px;
    font-weight: 800;
  }

  .branch-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 7px 8px;
    padding-left: calc(8px + var(--branch-indent, 0px));
    border: 1px solid transparent;
    border-radius: 8px;
    transition: background 120ms, border-color 120ms;
  }
  .branch-row + .branch-row { margin-top: 3px; }
  .branch-row:hover { background: var(--color-surface-hover); border-color: var(--color-border-subtle); }
  .branch-row.current {
    border-color: var(--color-border);
    border-left: 2px solid var(--color-primary);
    background: rgba(90,140,248,0.07);
  }

  .branch-info { display: flex; align-items: center; min-width: 0; gap: 8px; }
  .branch-info div { min-width: 0; }
  .branch-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--color-ink); }
  .branch-info span { display: block; margin-top: 2px; color: var(--color-ink-dim); font-size: 11px; }

  .branch-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
  .branch-actions .btn-sm { min-height: 24px; padding: 0 6px; font-size: 11px; }

  .branch-context-menu,
  .history-context-menu,
  .explorer-context-menu,
  .status-context-menu,
  .repo-tab-context-menu {
    z-index: 120;
    display: grid;
    gap: 2px;
    min-width: 184px;
    padding: 5px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface-solid);
    box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  }

  .branch-context-menu {
    position: fixed;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }
  .history-context-menu { position: absolute; }
  .explorer-context-menu,
  .status-context-menu,
  .repo-tab-context-menu { position: fixed; }

  .explorer-context-menu {
    box-sizing: border-box;
    width: min(240px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .status-context-menu {
    box-sizing: border-box;
    width: min(280px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
    border-color: color-mix(in srgb, var(--color-border) 78%, #5a8cf8);
    background:
      linear-gradient(180deg, rgba(90,140,248,0.045), transparent 70px),
      var(--color-surface-solid);
  }

  .status-context-label {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-width: 0;
    margin: -1px -1px 5px;
    padding: 8px 8px 10px;
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .status-context-object-icon,
  .status-context-action-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    color: #83adff;
    background: rgba(90,140,248,0.12);
    border: 1px solid rgba(90,140,248,0.2);
  }

  .status-context-object-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
  }

  .status-context-object-copy,
  .status-context-action-copy {
    display: grid;
    min-width: 0;
  }

  .status-context-kind {
    margin-bottom: 2px;
    color: var(--color-ink-faint);
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: .1em;
    line-height: 1;
    text-transform: uppercase;
  }

  .status-context-object-copy > strong {
    overflow: hidden;
    color: var(--color-ink);
    font-size: 12.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-context-path {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    margin-top: 2px;
    overflow: hidden;
    color: var(--color-ink-faint);
    font: 9.5px/1.2 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-context-path svg { flex: 0 0 auto; }

  .status-context-count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid rgba(90,140,248,0.18);
    border-radius: 5px;
    color: #83adff;
    background: rgba(90,140,248,0.1);
    font: 700 9.5px/1 var(--font-mono);
  }

  .branch-context-menu button,
  .history-context-menu button,
  .explorer-context-menu button,
  .status-context-menu button,
  .repo-tab-context-menu button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 30px;
    padding: 6px 8px;
    border-color: transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-ink-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
  }

  .status-context-menu button {
    box-sizing: border-box;
    max-width: 100%;
    min-height: 42px;
    gap: 9px;
    padding: 6px 7px;
    overflow: hidden;
  }

  .explorer-context-menu button {
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .explorer-context-menu button svg { flex: 0 0 auto; }
  .explorer-context-menu button.ignore { color: #91b59a; }
  .explorer-context-menu button.untrack { color: #d7ad6d; }

  .status-context-action-icon {
    width: 26px;
    height: 26px;
    border-color: transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-ink-dim);
  }

  .status-context-action-copy {
    gap: 1px;
    overflow: hidden;
  }
  .status-context-action-copy strong {
    overflow: hidden;
    color: var(--color-ink-muted);
    font-size: 11.5px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .status-context-action-copy span {
    overflow: hidden;
    color: var(--color-ink-faint);
    font-size: 9.5px;
    font-weight: 500;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .branch-context-menu button:hover:not(:disabled),
  .history-context-menu button:hover:not(:disabled),
  .explorer-context-menu button:hover:not(:disabled),
  .status-context-menu button:hover:not(:disabled),
  .repo-tab-context-menu button:hover:not(:disabled) {
    border-color: var(--color-border-subtle);
    background: rgba(255,255,255,0.06);
    color: var(--color-ink);
  }

  .status-context-menu button:hover:not(:disabled) .status-context-action-icon {
    color: #9bbcff;
    background: rgba(90,140,248,0.1);
  }
  .status-context-menu button:hover:not(:disabled) .status-context-action-copy strong {
    color: var(--color-ink);
  }

  .status-context-action-icon.ignore {
    color: #91b59a;
  }

  .status-context-action-icon.untrack {
    color: #d7ad6d;
  }

  .branch-context-menu .menu-separator,
  .history-context-menu .menu-separator,
  .explorer-context-menu .menu-separator,
  .status-context-menu .menu-separator,
  .repo-tab-context-menu .menu-separator {
    height: 1px;
    margin: 4px 3px;
    background: var(--color-border-subtle);
  }

  .branch-context-menu button.danger {
    color: #ff9aa8;
  }

  .branch-context-menu button.danger:hover:not(:disabled) {
    border-color: rgba(255,92,117,0.34);
    background: rgba(255,92,117,0.12);
    color: #ffd0d6;
  }

  .branch-context-menu button:disabled,
  .history-context-menu button:disabled,
  .explorer-context-menu button:disabled,
  .status-context-menu button:disabled,
  .repo-tab-context-menu button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
  }

  /* --- Explorer --- */

  .explorer-panel { position: relative; }
  .explorer-panel.collapsed {
    grid-template-rows: auto;
  }

  .explorer-head-actions { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
  .explorer-bulk-button {
    display: inline-grid;
    place-items: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    aspect-ratio: 1;
    flex: 0 0 28px;
    padding: 0;
    border-color: rgba(94,110,156,0.18);
    border-radius: 6px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.018);
  }
  .explorer-bulk-button:hover:not(:disabled) {
    border-color: rgba(65,209,255,0.3);
    color: var(--color-ink);
    background: rgba(65,209,255,0.06);
  }

  .explorer-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 28px;
    padding: 2px 7px 2px calc(7px + var(--depth, 0) * 14px);
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    text-align: left;
    transition: background 120ms ease, border-color 120ms ease;
  }
  .explorer-row + .explorer-row { margin-top: 0; }
  .explorer-row:hover { background: var(--color-surface-hover); border-color: var(--color-border-subtle); }
  .explorer-row.active { background: rgba(90,140,248,0.1); border-color: rgba(90,140,248,0.28); }
  .explorer-row.folder { font-weight: 700; }
  .explorer-row svg { color: var(--color-accent); }
  .explorer-row svg.file-icon.code     { color: #7aacff; }
  .explorer-row svg.file-icon.markup   { color: #f08a5d; }
  .explorer-row svg.file-icon.style    { color: #c678dd; }
  .explorer-row svg.file-icon.json     { color: #e0c15c; }
  .explorer-row svg.file-icon.config   { color: #9aa6d6; }
  .explorer-row svg.file-icon.script   { color: #4eca76; }
  .explorer-row svg.file-icon.text     { color: #b8c2e0; }
  .explorer-row svg.file-icon.image    { color: #54c7ec; }
  .explorer-row svg.file-icon.audio    { color: #d98cf0; }
  .explorer-row svg.file-icon.video    { color: #ff8ba7; }
  .explorer-row svg.file-icon.archive  { color: #d8a657; }
  .explorer-row svg.file-icon.sheet    { color: #4eca76; }
  .explorer-row svg.file-icon.database { color: #5fc5d9; }
  .explorer-row svg.file-icon.font     { color: #f0d080; }
  .explorer-row .language-icon {
    display: block;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    fill: currentColor;
  }
  .explorer-row .language-icon path { fill: currentColor; }

  .tree-toggle, .explorer-select { min-height: 20px; padding: 0; border: 0; background: transparent; color: var(--color-ink-muted); }
  .tree-toggle { width: 14px; }
  .tree-toggle:hover:not(:disabled), .explorer-select:hover:not(:disabled) { background: transparent; border-color: transparent; color: var(--color-ink); }
  .tree-spacer { width: 14px; }
  .explorer-select { justify-content: flex-start; min-width: 0; }
  .explorer-select span { overflow: hidden; font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

  /* --- Commit form --- */

  .commit-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .commit-panel .section-head { flex: 0 0 auto; }
  .commit-form {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    flex: 1 1 0;
    min-height: 0;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
  }
  .commit-form textarea {
    min-height: 0;
    height: 100%;
    resize: none;
    overflow: auto;
  }
  .commit-amend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
  }
  .commit-amend-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-ink-dim);
    font-size: 12px;
    white-space: nowrap;
  }
  .commit-amend-toggle input {
    appearance: none;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    min-width: 14px;
    min-height: 14px;
    padding: 0;
    border: 1px solid rgba(94,110,156,0.42);
    border-radius: 4px;
    background: rgba(13,14,26,0.78);
    box-shadow: none;
    cursor: pointer;
  }
  .commit-amend-toggle input:checked {
    border-color: rgba(65,209,255,0.62);
    background:
      linear-gradient(135deg, rgba(65,209,255,0.92), rgba(100,108,255,0.92));
    box-shadow: inset 0 0 0 2px rgba(13,14,26,0.82);
  }
  .commit-amend-toggle input:focus {
    box-shadow: 0 0 0 2px rgba(65,209,255,0.2);
  }
  .commit-amend-toggle input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
  }
  .commit-undo-button {
    flex: 0 0 auto;
    min-height: 26px;
    padding: 0 8px;
    font-size: 11px;
  }

  .commit-actions-row {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    min-width: 0;
  }
  .commit-actions-row .btn-primary { min-width: 0; }
  .commit-ai-button { flex: 0 0 auto; min-width: 64px; justify-content: center; }
  .commit-ai-settings-button { flex: 0 0 auto; width: 38px; min-width: 38px; padding: 0; justify-content: center; }
  .commit-block-reason {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid rgba(232,96,96,0.28);
    border-radius: 6px;
    color: #ef8080;
    background: rgba(232,96,96,0.08);
    font-size: 12px;
    line-height: 1.35;
  }

  /* --- Commit history --- */

  .history-panel { position: relative; }
  .history-list { min-width: 0; padding: 6px; overflow: auto; }

  .commit-row { display: grid; min-width: 0; gap: 8px; padding: 10px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-surface-raised); transition: border-color 120ms; }
  .commit-row + .commit-row { margin-top: 5px; }
  .commit-row:hover { border-color: var(--color-border); }
  .commit-row.selected { border-color: color-mix(in srgb, var(--color-primary) 58%, var(--color-border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-primary) 18%, transparent) inset; }
  .commit-row.compact { padding: 8px; }

  .commit-line { display: flex; align-items: flex-start; min-width: 0; gap: 8px; }
  .commit-line svg { flex: 0 0 auto; margin-top: 2px; color: var(--color-accent); }
  .commit-line div { min-width: 0; }
  .commit-line-text { max-width: 100%; overflow: hidden; }
  .commit-line strong { display: block; overflow: hidden; color: var(--color-ink); font-size: 13px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
  .commit-line span { display: block; overflow: hidden; margin-top: 3px; color: var(--color-ink-dim); font-family: var(--font-mono); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

  .commit-card-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    min-width: 0;
  }
  .commit-avatar {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(122,172,255,0.18);
    border-radius: 999px;
    color: #b8c5df;
    background: rgba(18, 22, 38, 0.72);
    font-size: 9px;
    font-weight: 800;
  }
  .commit-card-main { display: grid; gap: 2px; min-width: 0; }
  .commit-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .commit-summary {
    display: block;
    overflow: hidden;
    color: #edf2ff;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .commit-kind {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    padding: 1px 5px;
    border: 1px solid rgba(94,110,156,0.18);
    border-radius: 999px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.025);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
  }
  .commit-kind.merge { color: #dca6da; border-color: rgba(208,96,192,0.24); background: rgba(208,96,192,0.07); }
  .commit-kind.root { color: #d7b66b; border-color: rgba(224,180,92,0.22); background: rgba(224,180,92,0.07); }
  .commit-meta-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    color: var(--color-ink-faint);
    font-size: 10.5px;
  }
  .commit-meta-line > * { min-width: 0; }
  .commit-hash {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    color: #8db8ff;
    background: transparent;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
  }
  .commit-author {
    flex: 1 1 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .commit-note-indicator {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
  }
  .commit-note-presence {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 18px;
    padding: 1px 5px 1px 4px;
    border: 1px solid transparent;
    border-radius: 5px;
    color: #dcb96c;
    background: linear-gradient(90deg, rgba(216, 167, 74, 0.11), rgba(216, 167, 74, 0.045));
    box-shadow: inset 0 -1px 0 rgba(216, 167, 74, 0.22);
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.015em;
  }
  .commit-note-presence:hover:not(:disabled) {
    border-color: rgba(216, 167, 74, 0.24);
    color: #efd08a;
    background: linear-gradient(90deg, rgba(216, 167, 74, 0.17), rgba(216, 167, 74, 0.075));
  }
  .commit-note-presence:focus-visible {
    outline: 2px solid rgba(216, 167, 74, 0.32);
    outline-offset: 2px;
  }
  .commit-note-tooltip {
    position: absolute;
    z-index: 40;
    top: calc(100% + 7px);
    right: 0;
    display: grid;
    width: min(270px, calc(100vw - 36px));
    padding: 9px 10px 10px;
    border: 1px solid color-mix(in srgb, #d8a74a 24%, var(--color-border));
    border-radius: 7px;
    color: var(--color-ink-muted);
    background: color-mix(in srgb, #d8a74a 4%, var(--color-surface-solid));
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34), inset 2px 0 0 rgba(216, 167, 74, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-3px);
    visibility: hidden;
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
  }
  .commit-note-tooltip::before {
    content: "";
    position: absolute;
    top: -4px;
    right: 12px;
    width: 7px;
    height: 7px;
    border-top: 1px solid color-mix(in srgb, #d8a74a 24%, var(--color-border));
    border-left: 1px solid color-mix(in srgb, #d8a74a 24%, var(--color-border));
    background: color-mix(in srgb, #d8a74a 4%, var(--color-surface-solid));
    transform: rotate(45deg);
  }
  .commit-note-indicator:hover,
  .commit-note-indicator:focus-within { z-index: 40; }
  .commit-note-indicator:hover .commit-note-tooltip,
  .commit-note-indicator:focus-within .commit-note-tooltip {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }
  .commit-note-tooltip-head {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border-subtle);
    color: #dcb96c;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .commit-note-tooltip-head small {
    margin-left: auto;
    color: var(--color-ink-faint);
    font-size: 8px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: none;
  }
  .commit-note-tooltip-body {
    display: -webkit-box;
    overflow: hidden;
    padding-top: 7px;
    color: var(--color-ink-muted);
    font-size: 10.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 7;
  }

  .commit-ref-area {
    position: relative;
    z-index: 3;
    display: grid;
    gap: 5px;
    min-width: 0;
  }
  .commit-ref-strip {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    min-height: 20px;
  }
  .branch-ref-cluster {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    margin-left: -10px;
  }
  .compact-ref-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: min(58%, 230px);
    height: 19px;
    padding: 0 6px 0 5px;
    overflow: hidden;
    border: 1px solid rgba(91,209,138,0.2);
    border-radius: 5px;
    color: #a8eeba;
    background: rgba(34,68,48,0.3);
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
  }
  .compact-ref-chip.branch {
    flex: 0 1 auto;
    max-width: 22px;
    height: 20px;
    margin-left: 0;
    padding: 0 5px;
    border-color: color-mix(in srgb, var(--ref-lane-color, #69a7ff) 34%, transparent);
    border-left-width: 2px;
    border-radius: 0 5px 5px 0;
    color: #dce9ff;
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #69a7ff) 14%, rgba(18,24,36,.96)), rgba(18,24,36,.82));
    box-shadow: inset 2px 0 0 color-mix(in srgb, var(--ref-lane-color, #69a7ff) 72%, transparent);
    transition:
      max-width 190ms cubic-bezier(.2,.75,.25,1),
      padding-right 190ms cubic-bezier(.2,.75,.25,1),
      border-color 140ms ease,
      background 140ms ease,
      box-shadow 140ms ease;
  }
  .branch-ref-cluster.local-only .compact-ref-chip.branch {
    border-radius: 0 !important;
  }
  .compact-ref-local-marker {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 3px;
    height: 20px;
    margin-left: -1px;
    padding: 0 5px 0 4px;
    border: 1px dashed rgba(240,189,107,.58);
    border-left-style: solid;
    border-radius: 0 5px 5px 0;
    color: #f0bd6b;
    background: linear-gradient(90deg, rgba(224,160,64,.13), rgba(224,160,64,.06));
    font-family: var(--font-mono);
    font-size: 7.5px;
    font-weight: 900;
    letter-spacing: .05em;
    line-height: 1;
    box-shadow: inset 1px 0 0 rgba(240,189,107,.2);
  }
  .compact-ref-branch-icon {
    flex: 0 0 auto;
    color: var(--ref-lane-color, #69a7ff);
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ref-lane-color, #69a7ff) 28%, transparent));
    transition: transform 190ms cubic-bezier(.2,.75,.25,1);
  }
  .compact-ref-chip > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .commit-ref-detail-item > i {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--ref-lane-color, #69a7ff);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ref-lane-color, #69a7ff) 18%, transparent);
  }
  .compact-ref-chip.current {
    border-color: color-mix(in srgb, var(--ref-lane-color, #69a7ff) 62%, transparent);
    color: #eaf2ff;
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #69a7ff) 25%, rgba(18,24,36,.96)), rgba(18,24,36,.9));
  }
  .compact-ref-chip.remote {
    border-color: color-mix(in srgb, var(--ref-lane-color, #69a7ff) 38%, transparent);
    color: #bcd2ff;
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #69a7ff) 14%, rgba(20,27,42,.94)), rgba(20,27,42,.84));
  }
  .compact-ref-chip.branch > span,
  .compact-ref-chip.branch > small {
    opacity: 0;
    transition: opacity 80ms ease;
  }
  .graph-row:hover .compact-ref-chip.branch,
  .graph-row.selected .compact-ref-chip.branch,
  .graph-row:focus-within .compact-ref-chip.branch {
    flex: 1 1 auto;
    max-width: 100%;
    padding-right: 8px;
    border-color: color-mix(in srgb, var(--ref-lane-color, #69a7ff) 64%, transparent);
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #69a7ff) 24%, rgba(18,24,36,.98)), rgba(18,24,36,.9));
    box-shadow:
      inset 2px 0 0 var(--ref-lane-color, #69a7ff),
      0 3px 12px color-mix(in srgb, var(--ref-lane-color, #69a7ff) 12%, rgba(0,0,0,.24));
  }
  .graph-row:hover .commit-ref-strip,
  .graph-row.selected .commit-ref-strip,
  .graph-row:focus-within .commit-ref-strip {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .graph-row:hover .branch-ref-cluster,
  .graph-row.selected .branch-ref-cluster,
  .graph-row:focus-within .branch-ref-cluster {
    flex: 0 0 auto;
    max-width: min(100%, 320px);
  }
  .graph-row:hover .compact-ref-branch-icon,
  .graph-row.selected .compact-ref-branch-icon,
  .graph-row:focus-within .compact-ref-branch-icon {
    transform: translateX(1px);
  }
  .graph-row:hover .compact-ref-chip.branch > span,
  .graph-row:hover .compact-ref-chip.branch > small,
  .graph-row.selected .compact-ref-chip.branch > span,
  .graph-row.selected .compact-ref-chip.branch > small,
  .graph-row:focus-within .compact-ref-chip.branch > span,
  .graph-row:focus-within .compact-ref-chip.branch > small {
    opacity: 1;
    transition-delay: 55ms;
    transition-duration: 120ms;
  }
  .compact-ref-chip.tag {
    flex: 0 1 auto;
    max-width: min(32%, 150px);
    padding-inline: 4px;
    border-color: transparent;
    color: #dbc078;
    background: transparent;
  }
  .compact-ref-chip.tag svg { flex: 0 0 auto; }
  .compact-ref-chip small {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 2px;
    padding-left: 4px;
    border-left: 1px solid rgba(255,255,255,.12);
    color: #f0bd6b;
    font-family: var(--font-sans);
    font-size: 8.5px;
    font-weight: 850;
  }
  .compact-ref-chip small.up-to-date { color: #7de39b; }
  .compact-ref-overflow {
    flex: 0 0 auto;
    min-width: 29px;
    min-height: 20px !important;
    height: 20px !important;
    padding: 0 5px;
    border-color: transparent;
    border-radius: 4px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,0.025);
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 800;
  }
  .compact-ref-overflow:hover:not(:disabled),
  .compact-ref-overflow[aria-expanded="true"] {
    border-color: rgba(101,162,255,.34);
    color: var(--color-ink);
    background: rgba(101,162,255,.1);
  }
  .commit-ref-details {
    display: grid;
    gap: 7px;
    padding: 8px;
    border: 1px solid rgba(94,110,156,.2);
    border-radius: 7px;
    background: rgba(10,14,21,.68);
    box-shadow: inset 2px 0 0 color-mix(in srgb, var(--ref-lane-color, #69a7ff) 65%, transparent);
  }
  .commit-ref-details > strong {
    color: var(--color-ink-muted);
    font-size: 10px;
    font-weight: 800;
  }
  .commit-ref-details section {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: start;
    gap: 7px;
  }
  .commit-ref-details section > span {
    padding-top: 3px;
    color: var(--color-ink-faint);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .commit-ref-details section > div { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
  .commit-ref-detail-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    min-height: 20px;
    padding: 2px 6px;
    overflow: hidden;
    border: 1px solid rgba(94,110,156,.18);
    border-radius: 5px;
    color: var(--color-ink-dim);
    background: rgba(255,255,255,.025);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .commit-ref-detail-item.local { color: #a8eeba; border-color: rgba(91,209,138,.18); }
  .commit-ref-detail-item.remote { color: #bcd2ff; border-color: rgba(122,172,255,.2); }
  .commit-ref-detail-item.tag { color: #dbc078; border-color: rgba(224,180,92,.2); }
  .commit-ref-detail-item small {
    color: var(--color-ink-faint);
    font-family: var(--font-sans);
    font-size: 8px;
    font-weight: 800;
  }
  .commit-ref-detail-item small.local-only {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #d99532;
  }

  .commit-files {
    display: grid;
    gap: 5px;
    padding: 6px;
    border: 1px solid rgba(94,110,156,0.14);
    border-radius: 8px;
    background: rgba(7,8,16,0.16);
  }
  .commit-files-toggle {
    justify-content: flex-start;
    gap: 6px;
    min-height: 26px;
    padding: 0 8px;
    border-color: transparent;
    background: transparent;
    color: var(--color-ink-dim);
    font-size: 11.5px;
    font-weight: 800;
  }
  .commit-files-toggle:hover:not(:disabled) { border-color: var(--color-border-subtle); background: var(--color-surface-hover); color: var(--color-ink); }

  .commit-file-list { display: grid; gap: 4px; }
  .commit-file-button {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    justify-content: stretch;
    width: 100%;
    min-height: 30px;
    padding: 4px 7px;
    text-align: left;
    border-color: rgba(94,110,156,0.16);
    background: rgba(255,255,255,0.03);
  }
  .commit-file-button:hover:not(:disabled) { border-color: rgba(65,209,255,0.22); background: rgba(65,209,255,0.055); }
  .commit-file-button strong { overflow: hidden; color: var(--color-ink-muted); font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }

  .commit-actions { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
  .commit-actions time,
  .commit-time {
    min-width: 0;
    overflow: hidden;
    color: var(--color-ink-faint);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .commit-action-buttons { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
  .commit-action-buttons button { flex: 0 0 auto; white-space: nowrap; }
  .commit-menu-button {
    width: 28px;
    min-width: 28px;
    min-height: 26px;
    padding: 0;
    border-color: rgba(94,110,156,0.16);
    border-radius: 7px;
    background: rgba(255,255,255,0.035);
    color: var(--color-ink-dim);
  }
  .commit-menu-button:hover:not(:disabled),
  .commit-menu-button[aria-expanded="true"] {
    border-color: rgba(65,209,255,0.28);
    background: rgba(65,209,255,0.08);
    color: var(--color-ink);
  }

  .branch-filter-group-label {
    padding: 9px 9px 3px;
    color: var(--color-ink-faint);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  .commit-note-button:not(:disabled) { color: color-mix(in srgb, var(--color-accent) 72%, var(--color-ink-dim)); }
  /* --- Git graph --- */

  .graph-list {
    padding: 0;
    background: var(--color-surface-dim);
  }

  .history-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 54px;
    padding: 9px 12px;
    border-top: 1px solid var(--color-border-subtle);
    color: var(--color-ink-faint);
    background: var(--color-surface-dim);
    font-size: 11.5px;
  }

  .history-load-more-button {
    min-height: 30px;
    border-color: transparent;
    color: var(--color-primary);
    background: transparent;
  }

  .history-load-more-button:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--color-primary) 22%, transparent);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  }

  .graph-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0;
    min-height: 58px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
  }
  .graph-row + .graph-row { margin-top: 0; }

  .graph-gutter {
    position: relative;
    align-self: stretch;
    min-width: 42px;
    border-right: 1px solid rgba(226,232,240,0.08);
    background:
      linear-gradient(90deg, rgba(111,140,255,0.025), transparent),
      rgba(7,10,16,0.24);
  }
  .graph-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .graph-svg path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.76;
    transition: opacity 120ms ease, stroke-width 120ms ease;
  }
  .graph-svg path.hidden-branch {
    opacity: 0.08;
  }
  .graph-svg path.graph-segment-ahead {
    stroke: #e0a040;
    filter: drop-shadow(0 0 3px rgba(224,160,64,0.24));
  }
  .graph-svg path.graph-segment-behind {
    stroke-dasharray: 4 4;
    filter: drop-shadow(0 0 3px rgba(122,172,255,0.2));
  }
  .graph-svg path.graph-ref-connector {
    opacity: 0.35;
    stroke-linecap: round;
  }
  .graph-dot {
    position: absolute;
    z-index: 2;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--dot-color, #5a8cf8);
    border: 2px solid var(--app-dialog-bg);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 2px 8px rgba(0,0,0,0.22);
    transform: translate(-50%, -50%);
    transition: transform 120ms ease, box-shadow 120ms ease;
  }
  .graph-dot.hidden-branch {
    opacity: 0.16;
    box-shadow: none;
  }
  .graph-dot.ahead {
    background: #e0a040;
    box-shadow: 0 0 0 1px rgba(224,160,64,0.42), 0 0 10px rgba(224,160,64,0.16);
  }
  .graph-dot.behind {
    background: var(--dot-color, #5a8cf8);
    box-shadow: 0 0 0 1px var(--dot-color, #5a8cf8), 0 0 10px rgba(122,172,255,0.18);
  }
  .graph-dot.tip { width: 14px; height: 14px; box-shadow: 0 0 0 1px var(--dot-color, #5a8cf8); }
  .graph-dot.merge {
    width: 15px;
    height: 15px;
    background: var(--color-surface-alt);
    border-color: var(--dot-color, #5a8cf8);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.1);
  }
  .branch-filter-option.remote {
    border-color: rgba(122,172,255,0.32);
    color: #bcd2ff;
    background: rgba(31,43,72,0.88);
  }
  .commit-body {
    position: relative;
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 8px 10px;
    background: rgba(18,24,36,0.5);
    transition: background 120ms ease;
  }
  .commit-body.has-branch-ref::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 24px;
    bottom: calc(50% + 16px);
    left: -16px;
    width: 16px;
    min-height: 14px;
    border-top: 1.5px solid var(--ref-lane-color, #69a7ff);
    border-left: 1.5px solid var(--ref-lane-color, #69a7ff);
    border-top-left-radius: 14px;
    opacity: .35;
    pointer-events: none;
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ref-lane-color, #69a7ff) 12%, transparent));
    transition: opacity 140ms ease, filter 140ms ease;
  }
  .commit-body.has-branch-ref::after {
    content: "";
    position: absolute;
    z-index: 2;
    top: calc(50% - 16px);
    left: -32px;
    width: 16px;
    height: 16px;
    border-right: 1.5px solid var(--ref-lane-color, #69a7ff);
    border-bottom: 1.5px solid var(--ref-lane-color, #69a7ff);
    border-bottom-right-radius: 14px;
    opacity: .35;
    pointer-events: none;
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ref-lane-color, #69a7ff) 12%, transparent));
    transition: opacity 140ms ease, filter 140ms ease;
  }
  .graph-row + .graph-row .commit-body { border-top: 1px solid rgba(226,232,240,0.075); }
  .graph-row.graph-ahead-row .commit-body {
    box-shadow: inset 3px 0 0 rgba(224,160,64,0.72);
  }
  .graph-row.graph-behind-row .commit-body {
    box-shadow: inset 3px 0 0 rgba(122,172,255,0.72);
  }
  .graph-row:hover .commit-body { background: rgba(30,39,57,0.72); }
  .graph-row:hover .graph-svg path { opacity: 1; stroke-width: 2.65; }
  .graph-row:hover .graph-svg path.graph-ref-connector,
  .graph-row.selected .graph-svg path.graph-ref-connector,
  .graph-row:focus-within .graph-svg path.graph-ref-connector { opacity: .95; stroke-width: 1.8; }
  .graph-row:hover .commit-body.has-branch-ref::before,
  .graph-row:hover .commit-body.has-branch-ref::after,
  .graph-row.selected .commit-body.has-branch-ref::before,
  .graph-row.selected .commit-body.has-branch-ref::after,
  .graph-row:focus-within .commit-body.has-branch-ref::before,
  .graph-row:focus-within .commit-body.has-branch-ref::after {
    opacity: .95;
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--ref-lane-color, #69a7ff) 24%, transparent));
  }
  .graph-row:hover .graph-svg path.hidden-branch { opacity: 0.12; stroke-width: 2.2; }
  .graph-row:hover .graph-dot { transform: translate(-50%, -50%) scale(1.12); }
  .graph-row:hover .graph-dot.hidden-branch { transform: translate(-50%, -50%) scale(1); }
  .graph-row.merge-row .commit-body {
    background: rgba(26,27,43,0.56);
  }
  .graph-row.tip-row .commit-body {
    background:
      linear-gradient(90deg, rgba(111,140,255,0.065), transparent 34%),
      rgba(20,27,40,0.62);
  }

  @media (prefers-reduced-motion: reduce) {
    .compact-ref-chip.branch,
    .compact-ref-chip.branch > span,
    .compact-ref-chip.branch > small,
    .compact-ref-branch-icon,
    .commit-body.has-branch-ref::before,
    .commit-body.has-branch-ref::after {
      transition: none;
    }
  }

  @media (hover: none) {
    .commit-ref-strip {
      flex-wrap: wrap;
      row-gap: 4px;
    }
    .branch-ref-cluster {
      flex: 0 0 auto;
      max-width: min(100%, 320px);
    }
    .compact-ref-chip.branch {
      flex: 1 1 auto;
      max-width: 100%;
      padding-right: 8px;
    }
    .compact-ref-chip.branch > span,
    .compact-ref-chip.branch > small {
      opacity: 1;
    }
  }

  /* --- Compare panel --- */

  .compare-panel {
    display: grid;
    grid-template-rows: auto auto;
    margin: 0 8px 8px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-surface-dim);
    overflow: hidden;
  }

  .compare-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
    align-items: end;
    gap: 10px;
  }
  .compare-field { display: grid; gap: 6px; min-width: 0; }
  .compare-field > span { color: var(--color-ink-muted); font-size: 10.5px; font-weight: 750; }
  .compare-target-help {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--color-accent) 20%, var(--color-border-subtle));
    border-radius: 8px;
    color: var(--color-ink-dim);
    background: color-mix(in srgb, var(--color-accent) 5%, var(--color-surface-raised));
    font-size: 11.5px;
    line-height: 1.5;
  }
  .compare-target-help svg { flex: 0 0 auto; margin-top: 1px; color: var(--color-accent); }
  .compare-target-warning { border-color: color-mix(in srgb, #e0a040 30%, var(--color-border-subtle)); background: color-mix(in srgb, #e0a040 7%, var(--color-surface-raised)); }
  .compare-target-warning svg { color: #e0a040; }

  .compare-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .compare-range { display: flex; align-items: center; gap: 7px; color: var(--color-ink-muted); }
  .compare-range .hash, .dialog-range .hash {
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(90,140,248,0.13);
    color: var(--color-accent);
    border: 1px solid rgba(90,140,248,0.22);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
  }
  .compare-count { color: var(--color-ink-dim); font-size: 12px; font-weight: 700; }

  /* --- Dialogs --- */

  .dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background-color: var(--app-dialog-backdrop);
    background-image: none;
    -webkit-backdrop-filter: blur(10px) saturate(0.78);
    backdrop-filter: blur(10px) saturate(0.78);
  }

  .app-chrome-backdrop {
    top: var(--app-titlebar-height, 42px);
  }

  .dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1100px, 100%);
    height: min(760px, 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background-color: var(--app-dialog-bg);
    background-image: none;
    box-shadow: var(--app-dialog-shadow);
    overflow: hidden;
  }
  .file-history-dialog-backdrop { z-index: 70; }
  .compare-dialog-backdrop { z-index: 80; }
  .file-history-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(780px, calc(100vw - 32px));
    height: min(720px, calc(100vh - 32px));
    border: 1px solid var(--color-border);
    border-radius: 12px;
    outline: 0;
    background: var(--app-dialog-bg);
    box-shadow: var(--app-dialog-shadow);
    overflow: hidden;
  }
  .file-history-dialog-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 72px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-dim);
  }
  .file-history-dialog-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid color-mix(in srgb, var(--color-primary) 24%, var(--color-border));
    border-radius: 9px;
    color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 9%, var(--color-surface-solid));
  }
  .file-history-dialog-heading { display: grid; min-width: 0; gap: 2px; }
  .file-history-dialog-heading h2 {
    margin: 0;
    overflow: hidden;
    color: var(--color-ink);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-history-dialog-path {
    overflow: hidden;
    color: var(--color-ink-faint);
    font: 10.5px/1.35 var(--font-mono);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-history-dialog-body { min-height: 0; overflow: hidden; background: var(--color-surface-solid); }
  .file-history-dialog-list { height: 100%; padding: 6px; overflow: auto; }
  .file-history-dialog-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    min-height: 66px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--color-border-subtle);
  }
  .file-history-dialog-row:last-child { border-bottom: 0; }
  .file-history-dialog-row:hover { background: var(--color-surface-hover); }
  .file-history-dialog-commit { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 9px; min-width: 0; }
  .file-history-dialog-commit > div { display: grid; min-width: 0; gap: 4px; }
  .file-history-dialog-commit strong {
    overflow: hidden;
    color: var(--color-ink);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-history-dialog-commit span { overflow: hidden; color: var(--color-ink-faint); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
  .file-history-dialog-commit code { color: var(--color-primary); font-family: var(--font-mono); }
  .file-history-dialog-row time { color: var(--color-ink-faint); font-size: 10.5px; white-space: nowrap; }
  .file-history-dialog-actions { display: flex; align-items: center; gap: 5px; }
  .file-history-dialog-actions button { min-height: 28px; white-space: nowrap; }
  .file-history-dialog-state {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    height: 100%;
    min-height: 220px;
    padding: 28px;
    color: var(--color-ink-faint);
    text-align: center;
  }
  .file-history-dialog-state svg { color: var(--color-primary); }
  .file-history-dialog-state strong { color: var(--color-ink); font-size: 13px; }
  .file-history-dialog-state span { max-width: 520px; font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
  .file-history-dialog-state.error svg,
  .file-history-dialog-state.error strong { color: var(--color-danger); }
  .compare-dialog {
    width: min(1560px, calc(100vw - 32px));
    height: min(940px, calc(100vh - 32px));
  }
  .compare-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 70px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--app-dialog-chrome);
  }
  .compare-dialog-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .compare-dialog-title > div { min-width: 0; }
  .compare-dialog-mark { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border: 1px solid color-mix(in srgb, var(--color-accent) 28%, var(--color-border)); border-radius: 10px; color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 9%, transparent); }
  .compare-dialog-title h2 { margin: 0; color: var(--color-ink); font-size: 18px; font-weight: 700; line-height: 1.2; }
  .compare-dialog-title p { margin: 3px 0 0; color: var(--color-ink-dim); font-size: 11px; font-weight: 400; line-height: 1.35; }
  .global-search-dialog {
    width: min(1180px, calc(100vw - 32px));
    height: min(840px, calc(100vh - 32px));
  }
  .line-patch-dialog {
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1320px, calc(100vw - 32px));
    height: min(860px, calc(100vh - 32px));
  }
  .blame-dialog {
    grid-template-rows: auto minmax(0, 1fr);
    width: min(1320px, calc(100vw - 32px));
    height: min(860px, calc(100vh - 32px));
  }
  .compare-select-dialog {
    grid-template-rows: auto minmax(0, 1fr);
    width: min(720px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: hidden;
  }
  .compare-select-shell { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; }
  .compare-select-body { display: grid; align-content: start; gap: 12px; min-height: 0; padding: 18px 20px 20px; overflow: auto; }
  .compare-target-panel { display: grid; gap: 16px; padding: 16px; border: 1px solid var(--color-border-subtle); border-radius: 12px; background: color-mix(in srgb, var(--app-settings-row-bg) 72%, transparent); }
  .compare-target-heading h3 { margin: 0; color: var(--color-ink); font-size: 14px; font-weight: 700; line-height: 1.2; }
  .compare-target-heading p { margin: 3px 0 0; color: var(--color-ink-dim); font-size: 10.5px; font-weight: 400; line-height: 1.4; }
  .compare-arrow-shell { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--color-border-subtle); border-radius: 9px; color: var(--color-accent); background: var(--color-surface-raised); }
  .compare-select-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; padding: 11px 16px; border-top: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
  .compare-select-footer > span { color: var(--color-ink-faint); font-size: 9.5px; }
  .compare-select-footer > div { display: flex; gap: 8px; }
  .compare-select-footer button { min-height: 32px; }
  .interactive-rebase-dialog,
  .reflog-dialog {
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1120px, calc(100vw - 32px));
    height: min(820px, 100%);
  }

  .interactive-rebase-body {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    align-content: start;
    min-height: 0;
    overflow: hidden;
  }
  .rebase-base-bar {
    display: grid;
    grid-template-columns: minmax(280px, 0.7fr) minmax(260px, 1fr);
    align-items: end;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--color-surface-dim);
  }
  .rebase-base-bar label { display: grid; gap: 5px; color: var(--color-ink-muted); font-size: 12px; }
  .rebase-base-bar label > span { font-weight: 700; }
  .rebase-base-bar label strong { color: var(--color-ink); font-family: var(--font-mono); }
  .rebase-base-bar p { margin: 0 0 4px; color: var(--color-ink-faint); font-size: 12px; line-height: 1.45; }
  .rebase-plan {
    display: grid;
    align-content: start;
    min-height: 0;
    padding: 8px;
    overflow: auto;
    background: var(--code-surface);
  }
  .rebase-plan-row {
    display: grid;
    grid-template-columns: auto 112px 64px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-bottom-color: var(--color-border-subtle);
    background: var(--code-surface);
  }
  .rebase-plan-row:hover { border-color: var(--color-border-subtle); background: var(--code-hover-bg); }
  .rebase-plan-row.drop { opacity: 0.58; background: var(--code-delete-bg); }
  .rebase-order-actions { display: inline-flex; gap: 3px; }
  .rebase-order-actions button {
    width: 25px;
    min-height: 25px;
    padding: 0;
    border-radius: 5px;
    background: var(--code-surface-subtle);
  }
  .rebase-action { font-family: var(--font-mono); font-weight: 800; }
  .rebase-action .select-menu-trigger { height: 30px; min-height: 30px; font-family: inherit; font-weight: inherit; }
  .rebase-action.pick .select-menu-trigger { color: var(--code-add-strong); }
  .rebase-action.reword .select-menu-trigger { color: var(--code-hunk-text); }
  .rebase-action.squash .select-menu-trigger, .rebase-action.fixup .select-menu-trigger { color: #96620f; }
  .rebase-action.drop .select-menu-trigger { color: var(--code-delete-strong); }
  .rebase-plan-row > code { color: var(--color-accent); font-family: var(--font-mono); font-size: 11px; font-weight: 800; }
  .rebase-commit-copy { display: grid; gap: 3px; min-width: 0; }
  .rebase-commit-copy strong { overflow: hidden; color: var(--color-ink); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
  .rebase-commit-copy span { color: var(--color-ink-faint); font-size: 10.5px; }
  .rebase-commit-copy input { height: 30px; font-family: var(--font-mono); font-size: 12px; }
  .rebase-warning {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 12px 0;
    padding: 8px 10px;
    border: 1px solid rgba(224,160,64,0.25);
    border-radius: 7px;
    color: #b87914;
    background: rgba(224,160,64,0.08);
    font-size: 12px;
  }
  .rebase-warning.error { border-color: rgba(232,96,96,0.28); color: var(--code-delete-text); background: var(--code-delete-bg); }
  .rebase-footer-actions { display: flex; gap: 8px; }

  .reflog-body { display: grid; grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr); min-height: 0; overflow: hidden; }
  .reflog-list-pane { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; border-right: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
  .reflog-search { position: relative; display: flex; align-items: center; padding: 10px; border-bottom: 1px solid var(--color-border-subtle); }
  .reflog-search svg { position: absolute; left: 21px; color: var(--color-ink-faint); }
  .reflog-search input { padding-left: 34px; }
  .reflog-list { display: grid; align-content: start; min-height: 0; padding: 7px; overflow: auto; }
  .reflog-list > button {
    display: grid;
    justify-content: stretch;
    gap: 4px;
    width: 100%;
    min-height: 70px;
    padding: 8px 10px;
    border-color: transparent;
    border-bottom-color: var(--color-border-subtle);
    border-radius: 6px;
    background: transparent;
    text-align: left;
  }
  .reflog-list > button:hover:not(:disabled) { background: var(--color-surface-hover); }
  .reflog-list > button.active { border-color: rgba(49,95,214,0.3); background: rgba(49,95,214,0.09); }
  .reflog-list > button strong { overflow: hidden; color: var(--color-ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .reflog-row-top, .reflog-row-bottom { display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 8px; color: var(--color-ink-faint); font-size: 10.5px; }
  .reflog-row-top code { color: var(--color-accent); font-weight: 800; }
  .reflog-row-bottom code { color: var(--color-ink-dim); }
  .reflog-detail { display: grid; align-content: start; gap: 14px; min-width: 0; padding: 18px; overflow: auto; }
  .reflog-detail-head { display: flex; align-items: center; gap: 10px; }
  .reflog-detail-head > svg { color: var(--color-accent); }
  .reflog-detail-head h3 { margin: 2px 0 0; color: var(--color-ink); font-size: 17px; }
  .reflog-detail dl { display: grid; gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-border-subtle); }
  .reflog-detail dl > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; padding: 9px 11px; background: var(--color-surface-raised); }
  .reflog-detail dt { color: var(--color-ink-faint); font-size: 11px; font-weight: 800; text-transform: uppercase; }
  .reflog-detail dd { min-width: 0; margin: 0; overflow: hidden; color: var(--color-ink-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .reflog-detail dd code { font-family: var(--font-mono); }
  .reflog-preview { justify-self: start; }
  .reflog-recovery-card { display: grid; gap: 12px; padding: 14px; border: 1px solid rgba(78,202,118,0.24); border-radius: 10px; background: rgba(78,202,118,0.07); }
  .reflog-recovery-title { display: flex; align-items: flex-start; gap: 9px; }
  .reflog-recovery-title > svg { flex: 0 0 auto; color: var(--code-add-strong); }
  .reflog-recovery-title div { display: grid; gap: 3px; }
  .reflog-recovery-title strong { color: var(--color-ink); font-size: 13px; }
  .reflog-recovery-title span { color: var(--color-ink-faint); font-size: 11px; line-height: 1.4; }
  .reflog-recovery-card label { display: grid; gap: 5px; color: var(--color-ink-faint); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
  .reflog-recovery-card label > div { position: relative; display: flex; align-items: center; }
  .reflog-recovery-card label svg { position: absolute; left: 10px; color: var(--color-accent); }
  .reflog-recovery-card label input { padding-left: 33px; font-family: var(--font-mono); text-transform: none; letter-spacing: 0; }
  .reflog-recovery-card .btn-primary { justify-self: start; }
  .new-branch-dialog {
    display: block;
    width: min(520px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .init-repository-dialog {
    display: block;
    width: min(540px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .merge-branch-dialog {
    display: block;
    width: min(590px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .rename-branch-dialog {
    display: block;
    width: min(520px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .discard-confirm-dialog {
    display: grid;
    grid-template-rows: auto auto auto;
    width: min(560px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .branch-delete-dialog {
    display: grid;
    grid-template-rows: auto auto auto;
    width: min(500px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    border-color: rgba(255, 90, 103, 0.22);
    box-shadow: var(--app-dialog-shadow), 0 0 0 1px rgba(255, 90, 103, 0.04);
    overflow: auto;
  }
  .worktree-dialog {
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    width: min(920px, calc(100vw - 32px));
    height: min(820px, calc(100vh - 32px));
    border-color: rgba(77, 182, 214, 0.24);
  }
  .worktree-confirm-dialog {
    grid-template-rows: auto auto auto;
    width: min(520px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
  }
  .worktree-nested-backdrop { z-index: 70; }
  .ai-settings-dialog {
    display: block;
    width: min(560px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .app-settings-dialog,
  .analytics-notice-dialog {
    display: block;
    width: min(620px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .app-settings-dialog {
    width: min(880px, calc(100vw - 32px));
  }
  .clone-repository-dialog {
    display: block;
    width: min(620px, calc(100vw - 32px));
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  .clone-dialog-form {
    display: grid;
    gap: 14px;
    padding: 16px;
  }
  .clone-dialog-field {
    display: grid;
    gap: 5px;
    min-width: 0;
  }
  .clone-dialog-field > span {
    overflow: hidden;
    color: var(--color-ink-faint);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.04em;
  }
  .clone-dialog-path-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-width: 0;
  }
  .clone-dialog-error {
    padding: 9px 10px;
    border: 1px solid rgba(232,96,90,0.3);
    border-radius: 7px;
    color: #f09090;
    background: rgba(232,96,90,0.08);
    font-size: 12.5px;
    line-height: 1.45;
  }
  .clone-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 2px;
  }
  .ai-settings-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }
  .app-settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  .settings-section {
    display: grid;
    gap: 12px;
    min-width: 0;
  }
  .settings-section > header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border-subtle);
  }
  .settings-section > header svg {
    color: var(--color-accent);
    flex: 0 0 auto;
  }
  .settings-section h3 {
    margin: 1px 0 0;
    color: var(--color-ink);
    font-size: 15px;
    font-weight: 750;
  }
  .settings-segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
    padding: 4px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--app-settings-row-bg);
  }
  .settings-segmented label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--color-ink-dim);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  }
  .settings-segmented label:hover {
    border-color: var(--color-border-subtle);
    color: var(--color-ink);
    background: var(--color-surface-hover);
  }
  .settings-segmented label.active {
    border-color: var(--color-border-input);
    color: var(--color-ink);
    background: var(--color-surface-raised);
    box-shadow: 0 1px 4px rgba(28,44,74,0.08);
  }
  .settings-segmented input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
  .settings-segmented span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .settings-segmented.settings-language {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-toggle-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--app-settings-row-bg);
    color: var(--color-ink-muted);
    cursor: pointer;
  }
  .settings-toggle-row input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--color-accent);
  }
  .settings-toggle-row span {
    display: grid;
    gap: 4px;
    min-width: 0;
  }
  .settings-toggle-row strong {
    color: var(--color-ink);
    font-size: 13px;
  }
  .settings-toggle-row small {
    color: var(--color-ink-dim);
    font-size: 12px;
    line-height: 1.45;
  }
  .analytics-notice-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 18px 16px 16px;
  }
  .analytics-notice-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(65,209,255,0.28);
    border-radius: 10px;
    color: var(--color-accent);
    background: rgba(65,209,255,0.08);
  }
  .analytics-notice-copy {
    display: grid;
    gap: 9px;
    min-width: 0;
    color: var(--color-ink-muted);
    font-size: 13px;
    line-height: 1.5;
  }
  .analytics-notice-copy p {
    margin: 0;
  }
  .analytics-notice-toggle {
    grid-column: 1 / -1;
  }
  .analytics-notice-footer {
    align-items: center;
  }
  .ai-provider-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .ai-provider-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: var(--color-ink-dim);
    font-size: 12.5px;
    font-weight: 700;
  }
  .ai-provider-option:hover {
    border-color: var(--color-border);
    color: var(--color-ink);
    background: var(--color-surface-hover);
  }
  .ai-provider-option.active {
    border-color: rgba(100,108,255,0.5);
    color: #f5f7ff;
    background: linear-gradient(180deg, rgba(100,108,255,0.22), rgba(65,209,255,0.1));
  }
  .new-branch-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }
  .init-repository-header { padding: 16px 18px; }
  .init-repository-heading { display: flex; align-items: center; gap: 12px; }
  .init-repository-heading h2 { margin: 2px 0 0; color: var(--color-ink); font-size: 15px; line-height: 1.25; }
  .init-repository-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--color-accent) 34%, var(--color-border));
    border-radius: 9px;
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-raised));
  }
  .init-repository-form { display: flex; flex-direction: column; gap: 16px; padding: 18px; }
  .init-repository-description { margin: 0; color: var(--color-ink-dim); font-size: 11.5px; line-height: 1.5; }
  .init-repository-field > span { font-size: 9.5px; }
  .init-repository-field > div { position: relative; align-items: center; }
  .init-repository-field > div > svg { position: absolute; left: 11px; z-index: 1; color: var(--color-ink-faint); pointer-events: none; }
  .init-repository-field > div > input { height: 36px; padding-left: 36px; font-family: var(--font-mono); font-size: 12px; }
  .init-repository-field small { color: var(--color-ink-faint); font-size: 9.5px; line-height: 1.4; }
  .init-repository-path-field { padding: 12px; border: 1px solid var(--color-border-subtle); border-radius: 9px; background: var(--color-surface-raised); }
  .init-repository-path-control { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .init-repository-path-control > input { grid-column: 1; }
  .init-repository-browse { grid-column: 2; display: inline-flex; align-items: center; gap: 6px; height: 36px; font-size: 11.5px; white-space: nowrap; }
  .init-repository-error { color: var(--color-danger, #ff6b78) !important; }
  .init-repository-actions { padding-top: 2px; }
  .init-repository-actions > button { font-size: 11.5px; }
  .merge-branch-header { padding: 15px 17px; }
  .merge-branch-heading { display: flex; align-items: center; gap: 11px; }
  .merge-branch-heading h2 { margin: 2px 0 0; color: var(--color-ink); font-size: 15px; line-height: 1.25; }
  .merge-branch-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--color-accent) 34%, var(--color-border));
    border-radius: 9px;
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface-raised));
  }
  .merge-branch-form { display: flex; flex-direction: column; gap: 15px; padding: 17px; }
  .merge-branch-route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--color-border-subtle); border-radius: 9px; background: var(--color-surface-raised); }
  .merge-branch-route > div { display: grid; gap: 3px; min-width: 0; }
  .merge-branch-route > div:last-child { text-align: right; }
  .merge-branch-route span { color: var(--color-ink-faint); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  .merge-branch-route strong { overflow: hidden; color: var(--color-ink); font-family: var(--font-mono); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
  .merge-branch-route > svg { color: var(--color-accent); }
  .merge-strategy-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
  .merge-strategy-fieldset legend { margin-bottom: 7px; color: var(--color-ink-faint); font-size: 9.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  .merge-strategy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .merge-strategy-option { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 9px; min-width: 0; padding: 11px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--color-surface-dim); cursor: pointer; }
  .merge-strategy-option:hover { border-color: var(--color-border); background: var(--color-surface-hover); }
  .merge-strategy-option.active { border-color: color-mix(in srgb, var(--color-accent) 52%, var(--color-border)); background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-raised)); box-shadow: inset 2px 0 0 var(--color-accent); }
  .merge-strategy-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
  .merge-strategy-check { display: grid; place-items: center; width: 17px; height: 17px; margin-top: 1px; border: 1px solid var(--color-border-input); border-radius: 50%; color: #fff; background: var(--color-surface-raised); }
  .merge-strategy-option.active .merge-strategy-check { border-color: var(--color-accent); background: var(--color-accent); }
  .merge-strategy-copy { display: grid; gap: 3px; min-width: 0; }
  .merge-strategy-copy strong { color: var(--color-ink); font-size: 11.5px; }
  .merge-strategy-copy small { color: var(--color-ink-faint); font-size: 9.5px; line-height: 1.4; }
  .merge-branch-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 1px; }
  .merge-branch-actions > button { font-size: 11.5px; }
  .rename-branch-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }
  .new-branch-target {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-surface-raised);
  }
  .new-branch-summary {
    overflow: hidden;
    color: var(--color-ink-dim);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .new-branch-field { display: grid; gap: 6px; }
  .new-branch-field span {
    color: var(--color-ink-faint);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .new-branch-field > div { display: flex; min-width: 0; }
  .new-branch-field > div > input { width: 100%; min-width: 0; }
  .remote-branch-name-field > strong {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    height: 34px;
    padding: 0 0 0 11px;
    border: 1px solid var(--color-border-input);
    border-right: 0;
    border-radius: var(--ui-radius-sm) 0 0 var(--ui-radius-sm);
    color: var(--color-ink-faint);
    background: var(--color-surface-dim);
    font-family: var(--font-mono);
    font-size: 12px;
  }
  .remote-branch-name-field > input { border-radius: 0 var(--ui-radius-sm) var(--ui-radius-sm) 0; }
  .rename-remote-note {
    margin: -2px 0 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    color: var(--color-ink-dim);
    background: var(--color-surface-dim);
    font-size: 11.5px;
    line-height: 1.5;
  }
  .rename-remote-note strong { color: var(--color-ink); font-family: var(--font-mono); font-weight: 700; }
  .new-branch-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }

  .dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
  .dialog-header > div:first-child { min-width: 0; }
  .dialog-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; min-width: 0; }
  .tool-surface-choice { display: inline-flex; align-items: center; gap: 3px; min-width: 0; padding: 3px; border: 1px solid var(--color-border-subtle); border-radius: 7px; background: var(--color-surface-dim); }
  .tool-surface-choice > span { padding: 0 6px 0 4px; color: var(--color-ink-faint); font-size: 9px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
  .tool-surface-choice > button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 26px; max-width: 190px; padding: 0 8px; border: 1px solid transparent; border-radius: 5px; color: var(--color-ink-dim); background: transparent; font-size: 10px; font-weight: 750; }
  .tool-surface-choice > button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tool-surface-choice > button:hover:not(:disabled) { color: var(--color-ink); background: var(--color-surface-hover); }
  .tool-surface-choice > button.active { border-color: color-mix(in srgb, var(--color-accent) 32%, var(--color-border)); color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 9%, var(--color-surface-raised)); box-shadow: inset 2px 0 0 var(--color-accent); }
  .line-patch-header-actions { --line-patch-header-control-size: var(--ui-control-height); }
  .line-patch-header-actions .tool-surface-choice {
    height: var(--line-patch-header-control-size);
    padding: 0;
    overflow: hidden;
    border-radius: var(--ui-radius-sm);
  }
  .line-patch-header-actions .tool-surface-choice > span {
    display: inline-flex;
    align-items: center;
    align-self: stretch;
  }
  .line-patch-header-actions .tool-surface-choice > button {
    height: var(--line-patch-header-control-size);
    min-height: var(--line-patch-header-control-size);
    border-radius: calc(var(--ui-radius-sm) - 1px);
  }
  .line-patch-header-actions > .btn-sm {
    height: var(--line-patch-header-control-size);
    min-height: var(--line-patch-header-control-size);
  }
  .line-patch-header-actions > .dialog-close {
    width: var(--line-patch-header-control-size);
    min-width: var(--line-patch-header-control-size);
  }
  .compare-restore { max-width: 170px; min-width: 0; }
  .compare-restore span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .dialog-range { display: flex; align-items: center; gap: 8px; max-width: min(68vw, 780px); margin: 2px 0 0; color: var(--color-accent); font-size: 15px; }
  .dialog-range .hash { min-width: 0; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dialog-title { margin: 2px 0 0; color: var(--color-ink); font-size: 15px; font-weight: 600; }

  .dialog-close { min-height: 32px; min-width: 32px; padding: 0; justify-content: center; }

  @media (max-width: 760px) {
    .tool-surface-choice > span { display: none; }
    .tool-surface-choice > button { max-width: 120px; padding-inline: 7px; }
  }

  .dialog-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 0; }
  .compare-dialog .dialog-body { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }

  .dialog-files { display: grid; align-content: start; gap: 4px; padding: 8px; overflow: auto; border-right: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
  .compare-files-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; margin: -8px -8px 4px; padding: 8px 12px; border-bottom: 1px solid var(--color-border-subtle); color: var(--color-ink-dim); font-size: 10px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
  .compare-files-head strong { display: grid; place-items: center; min-width: 22px; height: 20px; padding-inline: 5px; border-radius: 10px; color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 12%, transparent); font-size: 9px; }

  .dialog-file-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    text-align: left;
    transition: background 120ms, border-color 120ms;
  }
  .dialog-file-row:hover { background: var(--color-surface-hover); border-color: var(--color-border-subtle); }
  .dialog-file-row.active   { background: rgba(90,140,248,0.1); border-color: rgba(90,140,248,0.28); }
  .dialog-file-row.prepared { background: rgba(78,202,118,0.08); border-color: rgba(78,202,118,0.22); }
  .dialog-file-row.prepared.active { background: rgba(78,202,118,0.13); border-color: rgba(78,202,118,0.32); }
  .dialog-file-row strong { overflow: hidden; color: var(--color-ink); font-family: var(--font-mono); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  .dialog-file-row svg { color: #4eca76; }

  .dialog-diff { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

  .diff-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--code-surface-raised);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-ink-muted);
    flex-shrink: 0;
    overflow: hidden;
  }
  .diff-header svg { flex-shrink: 0; color: var(--color-ink-faint); }
  .diff-header span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .split-diff {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: start;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    tab-size: 2;
    background: var(--code-surface);
  }

  .split-pane {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    scrollbar-gutter: stable;
  }
  .split-pane + .split-pane { border-left: 1px solid var(--color-border-subtle); }

  .split-pane-grid {
    display: grid;
    grid-template-columns: 3.2rem minmax(max-content, 1fr);
    align-content: start;
    min-width: 100%;
  }

  .split-span {
    grid-column: 1 / -1;
    padding: 2px 10px;
    white-space: pre-wrap;
    word-break: break-all;
  }
  .split-span.split-meta { color: var(--color-ink-faint); background: var(--code-surface-meta); font-size: 11px; }
  .split-span.split-hunk { color: var(--code-hunk-text); background: var(--code-hunk-bg); padding: 3px 10px; }

  .split-num {
    padding: 0 6px 0 4px;
    text-align: right;
    color: var(--color-ink-faint);
    font-size: 11px;
    user-select: none;
    border-right: 1px solid var(--color-border-subtle);
    background: var(--code-surface-subtle);
  }
  .split-num.del   { background: var(--code-delete-gutter-bg); color: var(--code-delete-strong); border-right-color: rgba(232,96,96,0.2); }
  .split-num.add   { background: var(--code-add-gutter-bg); color: var(--code-add-strong); border-right-color: rgba(78,202,118,0.2); }
  .split-num.empty { background: var(--code-surface-muted); }

  .split-cell {
    padding: 0 8px;
    white-space: pre;
    color: var(--color-ink-muted);
    min-width: 0;
    overflow: visible;
  }
  .split-cell.del   { background: var(--code-delete-bg); color: var(--code-delete-text); }
  .split-cell.add   { background: var(--code-add-bg); color: var(--code-add-text); }
  .split-cell.empty { background: var(--code-surface-muted); }

  /* Search-hit highlight: amber, distinct from add (green) / del (red).
     Higher specificity so it overrides the add/del backgrounds on a matched line. */
  .split-diff .split-cell.match {
    background: var(--code-match-bg);
    color: var(--code-match-text);
    box-shadow: inset 2px 0 0 rgba(240,182,72,0.9);
  }
  .split-diff .split-num.match {
    background: var(--code-match-gutter-bg);
    color: var(--code-match-text);
    border-right-color: rgba(240,182,72,0.35);
  }

  .split-col-headers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex-shrink: 0;
    border-bottom: 1px solid var(--color-border-subtle);
  }
  .split-col-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px calc(3.2rem + 10px);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-ink-faint);
    background: var(--code-surface-subtle);
  }
  .split-col-label + .split-col-label { border-left: 1px solid var(--color-border-subtle); }
  .split-col-hash {
    min-width: 0;
    max-width: min(42%, 260px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(90,140,248,0.12);
    color: var(--color-accent);
    border: 1px solid rgba(90,140,248,0.2);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
  }

  .dialog-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
  .dialog-footer-info { color: var(--color-ink-dim); font-size: 13px; font-weight: 700; }

  .prepared-tag { display: inline-flex; align-items: center; gap: 4px; margin-right: auto; color: #4eca76; font-size: 12px; font-weight: 700; }

  .discard-confirm-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 18px 16px 16px;
  }
  .branch-delete-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    padding: 20px 18px 18px;
  }
  .branch-delete-header {
    padding: 15px 16px;
    background:
      linear-gradient(90deg, rgba(255, 90, 103, 0.08), transparent 42%),
      var(--app-dialog-chrome);
  }
  .branch-delete-heading { display: flex; align-items: center; gap: 11px; }
  .branch-delete-heading-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 90, 103, 0.28);
    border-radius: 8px;
    color: #ff9aa4;
    background: rgba(255, 90, 103, 0.09);
  }
  .branch-delete-heading-icon.force {
    border-color: rgba(255, 174, 92, 0.34);
    color: #ffc07a;
    background: rgba(255, 151, 61, 0.1);
  }
  .discard-warning-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 90, 103, 0.32);
    border-radius: 10px;
    color: #ff9aa4;
    background: rgba(255, 90, 103, 0.1);
  }
  .discard-confirm-copy {
    display: grid;
    gap: 10px;
    min-width: 0;
    color: var(--color-ink-muted);
    font-size: 13px;
    line-height: 1.45;
  }
  .discard-confirm-copy p { margin: 0; }
  .discard-target {
    display: block;
    min-width: 0;
    max-height: 84px;
    overflow: auto;
    padding: 8px 9px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    color: var(--color-ink);
    background: rgba(0, 0, 0, 0.18);
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .branch-delete-body .discard-target {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .branch-delete-lead { color: var(--color-ink); font-weight: 600; }
  .branch-delete-target {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.16);
    box-shadow: inset 3px 0 0 rgba(255, 90, 103, 0.48);
  }
  .branch-delete-target-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 7px;
    color: var(--color-accent);
    background: rgba(77, 182, 214, 0.1);
  }
  .branch-delete-target-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
  .branch-delete-target-copy code {
    overflow: hidden;
    color: var(--color-ink);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .branch-delete-target-copy > span { color: var(--color-ink-faint); font-size: 10.5px; }
  .branch-delete-scope {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 1px solid rgba(77, 182, 214, 0.22);
    border-radius: 999px;
    color: #8ed8ee;
    background: rgba(77, 182, 214, 0.08);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .branch-delete-scope.remote { border-color: rgba(167, 126, 255, 0.25); color: #c2a9ff; background: rgba(132, 88, 232, 0.1); }
  .branch-delete-body .discard-warning-text {
    padding: 9px 10px;
    border-left: 2px solid rgba(255, 90, 103, 0.55);
    color: #f2aeb5;
    background: rgba(255, 90, 103, 0.055);
    font-size: 11.5px;
    font-weight: 600;
  }
  .branch-delete-confirm { min-width: 116px; }
  .worktree-dialog-header {
    background:
      linear-gradient(90deg, rgba(77, 182, 214, 0.09), transparent 40%),
      var(--app-dialog-chrome);
  }
  .worktree-dialog-heading { display: flex; align-items: center; gap: 11px; }
  .worktree-dialog-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(77, 182, 214, 0.3);
    border-radius: 9px;
    color: #8ed8ee;
    background: rgba(77, 182, 214, 0.1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  }
  .worktree-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    align-items: stretch;
    gap: 1px;
    padding: 1px 0;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--color-border-subtle);
  }
  .worktree-summary > div {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
    padding: 11px 14px;
    background: var(--app-dialog-bg);
  }
  .worktree-summary > div strong { color: var(--color-ink); font-family: var(--font-mono); font-size: 14px; }
  .worktree-summary > div span { overflow: hidden; color: var(--color-ink-faint); font-size: 10.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .worktree-summary > div.attention strong { color: #ffc07a; }
  .worktree-summary > .btn-primary { align-self: center; margin: 0 14px; white-space: nowrap; }
  .worktree-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-bottom: 1px solid rgba(255, 90, 103, 0.2);
    color: #ffb8bf;
    background: rgba(255, 90, 103, 0.08);
    font-size: 11.5px;
    font-weight: 650;
  }
  .worktree-content {
    min-height: 0;
    overflow: auto;
    padding: 14px;
    background:
      radial-gradient(circle at 92% 0%, rgba(77, 182, 214, 0.055), transparent 28%),
      var(--app-dialog-bg);
  }
  .worktree-create-card {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid rgba(77, 182, 214, 0.26);
    border-radius: 10px;
    background: var(--color-surface-raised);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
  }
  .worktree-create-card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .worktree-create-card h3 { margin: 3px 0 0; color: var(--color-ink); font-size: 13px; font-weight: 700; }
  .worktree-mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.14);
  }
  .worktree-mode-tabs button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    border-color: transparent;
    color: var(--color-ink-faint);
    background: transparent;
    font-size: 10.5px;
    font-weight: 750;
  }
  .worktree-mode-tabs button.active {
    border-color: rgba(77, 182, 214, 0.27);
    color: #b8e7f6;
    background: rgba(77, 182, 214, 0.11);
    box-shadow: 0 3px 12px rgba(0,0,0,0.14);
  }
  .worktree-create-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .worktree-create-fields label,
  .worktree-lock-body label { display: grid; gap: 5px; color: var(--color-ink-dim); font-size: 10.5px; font-weight: 750; }
  .worktree-create-fields input,
  .worktree-create-fields select,
  .worktree-lock-body input { width: 100%; min-width: 0; }
  .worktree-create-fields .worktree-path-field { grid-column: 1 / -1; }
  .worktree-path-field > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  .worktree-create-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
  .worktree-check { display: flex; align-items: flex-start; gap: 8px; color: var(--color-ink-muted); font-size: 11px; cursor: pointer; }
  .worktree-check input { width: auto; margin-top: 2px; }
  .worktree-check span { display: grid; gap: 1px; }
  .worktree-check strong { color: var(--color-ink); font-size: 11px; }
  .worktree-check small { color: var(--color-ink-faint); font-size: 10px; font-weight: 500; }
  .worktree-check.danger strong,
  .worktree-check.danger small { color: #ffb8bf; }
  .worktree-list { display: grid; gap: 8px; }
  .worktree-card {
    position: relative;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    min-width: 0;
    border: 1px solid var(--color-border-subtle);
    border-radius: 9px;
    background: var(--color-surface-raised);
    overflow: hidden;
  }
  .worktree-card.current { border-color: rgba(77, 182, 214, 0.34); box-shadow: inset 0 0 0 1px rgba(77, 182, 214, 0.06); }
  .worktree-card.stale { border-color: rgba(255, 151, 61, 0.28); }
  .worktree-rail {
    position: relative;
    display: grid;
    place-items: start center;
    padding-top: 18px;
    background: rgba(0,0,0,0.1);
  }
  .worktree-rail::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(77, 182, 214, 0.22);
  }
  .worktree-rail span {
    position: relative;
    z-index: 1;
    width: 9px;
    height: 9px;
    border: 2px solid #76cde7;
    border-radius: 50%;
    background: var(--color-surface-solid);
    box-shadow: 0 0 0 3px rgba(77, 182, 214, 0.08);
  }
  .worktree-rail i {
    position: absolute;
    top: 31px;
    left: 50%;
    width: 7px;
    height: 14px;
    border-bottom: 1px solid rgba(77, 182, 214, 0.26);
    border-left: 1px solid rgba(77, 182, 214, 0.26);
  }
  .worktree-card-main { display: grid; gap: 9px; min-width: 0; padding: 12px; }
  .worktree-card-main > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .worktree-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--color-accent); }
  .worktree-name > div { display: grid; gap: 1px; min-width: 0; }
  .worktree-name strong { overflow: hidden; color: var(--color-ink); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
  .worktree-name span { color: var(--color-ink-faint); font-size: 10px; }
  .worktree-badges { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
  .worktree-badges span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 999px;
    color: var(--color-ink-faint);
    background: rgba(255,255,255,0.025);
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .worktree-badges span.active { border-color: rgba(78, 202, 118, 0.25); color: #77d99a; background: rgba(78, 202, 118, 0.08); }
  .worktree-badges span.locked { border-color: rgba(111, 140, 255, 0.26); color: #aebcff; background: rgba(111, 140, 255, 0.08); }
  .worktree-badges span.danger { border-color: rgba(255, 151, 61, 0.3); color: #ffc07a; background: rgba(255, 151, 61, 0.08); }
  .worktree-path { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--color-ink-faint); }
  .worktree-path code { overflow: hidden; font-family: var(--font-mono); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
  .worktree-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; color: var(--color-ink-faint); font-size: 9.5px; }
  .worktree-meta span { display: inline-flex; align-items: center; gap: 4px; }
  .worktree-meta span.dirty,
  .worktree-meta span.danger { color: #ffc07a; }
  .worktree-card-main > footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; }
  .worktree-card-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
  .worktree-card-actions .danger { border-color: rgba(255, 90, 103, 0.2); color: #ff9aa4; background: rgba(255, 90, 103, 0.06); }
  .worktree-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--color-border-subtle);
    background: var(--app-dialog-chrome);
  }
  .worktree-dialog-footer > div { display: flex; align-items: center; gap: 6px; color: var(--color-ink-faint); font-size: 10px; }
  .worktree-loading,
  .worktree-empty {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    min-height: 240px;
    color: var(--color-ink-faint);
    text-align: center;
    font-size: 11px;
  }
  .worktree-empty strong { color: var(--color-ink); font-size: 13px; }
  .worktree-confirm-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 13px;
    padding: 17px 16px;
  }
  .worktree-confirm-body > div { display: grid; gap: 10px; min-width: 0; }
  .worktree-confirm-body p { margin: 0; color: var(--color-ink-muted); font-size: 12px; line-height: 1.45; }
  .worktree-confirm-body code { overflow: auto; padding: 8px; border: 1px solid var(--color-border-subtle); border-radius: 6px; color: var(--color-ink); background: rgba(0,0,0,0.16); font-size: 10.5px; }
  .worktree-lock-body { padding: 18px 16px; }
  .worktree-lock-body label > span { display: flex; align-items: baseline; justify-content: space-between; }
  .worktree-lock-body small { color: var(--color-ink-faint); font-size: 9.5px; font-weight: 500; }
  @media (max-width: 700px) {
    .worktree-summary { grid-template-columns: repeat(3, 1fr); }
    .worktree-summary > div { display: grid; gap: 2px; }
    .worktree-summary > .btn-primary { grid-column: 1 / -1; margin: 9px 14px; }
    .worktree-create-fields { grid-template-columns: 1fr; }
    .worktree-create-fields .worktree-path-field { grid-column: auto; }
    .worktree-create-card > footer,
    .worktree-card-main > footer { align-items: stretch; flex-direction: column; }
    .worktree-card-actions { justify-content: flex-start; }
    .worktree-dialog-footer > div { display: none; }
  }
  .discard-target-list {
    display: grid;
    gap: 4px;
    max-height: 168px;
    overflow: auto;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .discard-target-list .discard-target {
    max-height: none;
  }
  .discard-target-more {
    padding: 2px 2px 0;
    color: var(--color-ink-muted);
    font-size: 12px;
  }
  .discard-warning-text {
    color: #ffb8bf;
    font-weight: 650;
  }
  .discard-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--color-border-subtle);
    background: var(--color-surface-dim);
  }

  .line-patch-body {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  .line-patch-selection-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 46px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--app-dialog-chrome);
  }
  .line-patch-selection-bar.active {
    background:
      linear-gradient(90deg, rgba(77, 182, 214, 0.1), transparent 44%),
      var(--app-dialog-chrome);
  }
  .line-patch-selection-bar > div:first-child {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--color-accent);
  }
  .line-patch-selection-bar strong { color: var(--color-ink); font-size: 11.5px; }
  .line-patch-selection-bar span { color: var(--color-ink-faint); font-size: 10px; }
  .line-patch-selected-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

  .line-patch-scroll {
    min-height: 0;
    overflow: auto;
    background: var(--code-surface);
  }

  .line-patch-hunk {
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .line-patch-hunk-head {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: max-content;
    min-width: 100%;
    padding: 7px 10px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: color-mix(in srgb, var(--code-surface-raised) 96%, transparent);
  }
  .line-patch-select-hunk,
  .line-patch-line-select {
    display: grid;
    place-items: center;
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    color: #ffffff;
    background: var(--code-surface);
    box-shadow: none;
  }
  .line-patch-select-hunk:hover:not(:disabled),
  .line-patch-line-select:hover:not(:disabled) {
    border-color: rgba(77, 182, 214, 0.65);
    background: rgba(77, 182, 214, 0.1);
  }
  .line-patch-select-hunk.all,
  .line-patch-select-hunk.some,
  .line-patch-line-select[aria-pressed="true"] {
    border-color: rgba(77, 182, 214, 0.78);
    background: #238eb4;
  }
  .line-patch-select-hunk.some { background: rgba(35, 142, 180, 0.55); }
  .line-patch-hunk-head code {
    color: var(--color-accent);
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre;
  }
  .line-patch-hunk-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding-left: 16px;
  }
  .line-patch-hunk-button {
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 3px;
    background: var(--code-surface-subtle);
    color: var(--color-ink);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
  }
  .line-patch-hunk-button:hover:not(:disabled) {
    background: var(--code-hover-bg);
  }
  .line-patch-hunk-button.discard {
    border-color: rgba(255, 90, 103, 0.7);
    color: var(--code-delete-text);
  }
  .line-patch-hunk-button.stage,
  .line-patch-hunk-button.unstage {
    border-color: rgba(78, 202, 118, 0.72);
    color: var(--code-add-text);
  }

  .line-patch-lines {
    min-width: max-content;
    font-family: var(--font-mono);
    font-size: 12px;
  }

  .line-patch-row {
    display: grid;
    grid-template-columns: 18px 38px 38px 22px minmax(max-content, 1fr);
    align-items: start;
    min-height: 22px;
    padding: 1px 10px 1px 8px;
    color: var(--color-ink-muted);
  }
  .line-patch-row.selectable { cursor: default; }
  .line-patch-row.selected {
    box-shadow: inset 3px 0 0 rgba(77, 182, 214, 0.86);
    filter: saturate(1.12) brightness(1.06);
  }
  .line-patch-row.add {
    background: var(--code-add-bg);
    color: var(--code-add-text);
  }
  .line-patch-row.delete {
    background: var(--code-delete-bg);
    color: var(--code-delete-text);
  }
  .line-patch-row.meta {
    color: var(--color-ink-faint);
  }
  .line-patch-prefix {
    color: var(--color-ink-faint);
    text-align: center;
    user-select: none;
  }
  .line-patch-line-select { align-self: center; }
  .line-patch-line-select-placeholder { width: 16px; }
  .line-patch-line-number {
    padding-right: 7px;
    color: var(--color-ink-faint);
    font-size: 10px;
    line-height: 20px;
    text-align: right;
    user-select: none;
  }
  .line-patch-row.add .line-patch-prefix { color: var(--code-add-strong); }
  .line-patch-row.delete .line-patch-prefix { color: var(--code-delete-strong); }
  .line-patch-row code {
    white-space: pre;
    font-family: var(--font-mono);
  }
  @media (max-width: 760px) {
    .line-patch-selection-bar { align-items: stretch; flex-direction: column; }
    .line-patch-selected-actions { justify-content: flex-start; flex-wrap: wrap; }
  }

  .blame-body {
    min-height: 0;
    overflow: hidden;
    background: var(--code-surface);
  }

  .blame-code-header strong {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--color-ink-faint);
    font-size: 11px;
    font-weight: 800;
  }

  .blame-search-bar {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: var(--code-surface);
  }
  .blame-search-bar svg {
    position: absolute;
    left: 20px;
    color: var(--color-ink-faint);
    pointer-events: none;
  }
  .blame-search-bar input {
    width: 100%;
    height: 26px;
    padding: 0 34px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: var(--code-input-bg);
    color: var(--color-ink);
    font-size: 12px;
  }
  .blame-search-clear {
    position: absolute;
    right: 14px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-ink-faint);
  }
  .blame-search-clear svg {
    position: static;
  }

  .blame-column-headers {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  }
  .blame-commit-col-label {
    padding-left: 12px;
  }
  .blame-code-col-label {
    padding-left: calc(3.2rem + 10px);
  }
  .blame-commit-col-label + .blame-code-col-label {
    border-left: 1px solid var(--color-border-subtle);
  }

  .blame-diff {
    grid-template-columns: minmax(0, 1fr);
  }

  .blame-scroll {
    min-height: 0;
    overflow: auto;
  }

  .blame-code-table {
    width: max-content;
    min-width: 100%;
  }

  .blame-group {
    display: grid;
    grid-template-columns: minmax(300px, 340px) minmax(max-content, 1fr);
    align-items: stretch;
    min-width: max-content;
    border-bottom: 1px solid var(--color-border-subtle);
  }
  .blame-group.uncommitted {
    background: var(--code-surface-raised);
  }

  .blame-meta {
    position: sticky;
    left: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 8px 12px;
    border-right: 1px solid var(--color-border-subtle);
    background: var(--code-surface-subtle);
    box-shadow: 8px 0 18px color-mix(in srgb, var(--color-ink) 8%, transparent);
  }
  .blame-hash {
    align-self: flex-start;
    overflow: hidden;
    max-width: 100%;
    padding: 2px 7px;
    border: 1px solid rgba(90,140,248,0.2);
    border-radius: 5px;
    background: var(--code-surface-raised);
    color: var(--color-accent);
    font-size: 10.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .blame-author {
    overflow: hidden;
    color: var(--color-ink);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .blame-summary {
    overflow: hidden;
    color: var(--color-ink-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .blame-date {
    color: var(--color-ink-faint);
    font-size: 10.5px;
  }
  .blame-group:hover .blame-meta {
    background: var(--code-hover-bg);
  }
  .blame-group.uncommitted .blame-hash,
  .blame-group.uncommitted .blame-author {
    color: #e8b45a;
  }
  .blame-group.uncommitted .blame-hash {
    border-color: rgba(232, 180, 90, 0.26);
    background: color-mix(in srgb, #e8b45a 13%, var(--code-surface));
  }

  .blame-lines {
    min-width: max-content;
    grid-template-columns: 4rem minmax(max-content, 1fr);
  }
  .blame-line-number {
    min-height: 20px;
    padding-right: 8px;
  }
  .blame-line-code {
    min-height: 20px;
  }
  .blame-group:hover .blame-line-number {
    background: var(--code-hover-bg);
  }
  .blame-group:hover .blame-line-code {
    background: var(--code-hover-bg);
  }
  .blame-search-hit {
    padding: 0 1px;
    border-radius: 3px;
    background: var(--code-match-bg);
    color: var(--code-match-text);
  }

  .global-search-body {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
  }

  .global-search-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: rgba(7, 8, 16, 0.34);
  }
  .global-search-tab {
    min-height: 30px;
    padding: 0 12px;
    border-color: transparent;
    color: var(--color-ink-dim);
    background: transparent;
    font-size: 12px;
    font-weight: 800;
  }
  .global-search-tab:hover:not(:disabled) {
    border-color: rgba(65,209,255,0.22);
    background: rgba(65,209,255,0.07);
  }
  .global-search-tab.active {
    border-color: rgba(65,209,255,0.36);
    color: #ffffff;
    background: linear-gradient(135deg, rgba(100,108,255,0.26), rgba(65,209,255,0.1));
  }

  .global-search-form {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: linear-gradient(90deg, rgba(100,108,255,0.08), rgba(65,209,255,0.035));
  }

  .global-search-query { display: grid; gap: 6px; min-width: 0; }
  .global-search-query span,
  .search-limit span {
    color: var(--color-ink-faint);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .global-search-query textarea {
    min-height: 112px;
    max-height: 240px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 12px;
    white-space: pre;
    overflow: auto;
  }
  .global-search-query input {
    height: 40px;
    font-family: var(--font-mono);
    font-size: 13px;
  }

  .global-search-options {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px auto auto;
    align-items: end;
    gap: 10px;
  }
  .check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--color-ink-muted);
    font-size: 12px;
    font-weight: 700;
  }
  .check-row input { width: 15px; height: 15px; flex: 0 0 auto; }
  .search-limit { display: grid; gap: 5px; }
  .search-cancel {
    border-color: rgba(232,96,96,0.35);
    color: #ef9090;
    background: rgba(232,96,96,0.1);
  }
  .search-cancel:hover:not(:disabled) {
    border-color: rgba(232,96,96,0.55);
    color: #ffb0b0;
    background: rgba(232,96,96,0.16);
  }

  .global-search-results {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 10px;
  }
  .search-result-head {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    margin-bottom: 8px;
    color: var(--color-ink-dim);
    font-size: 12px;
    font-weight: 700;
  }
  .search-result-head strong { color: var(--color-accent); font-family: var(--font-mono); }
  .search-result-head span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .search-error { color: #ef9090; }

  .search-hit-list { display: grid; gap: 8px; }
  .search-hit {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-surface-raised);
  }
  .search-hit-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .search-hit-diff {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }
  .search-hit-top .hash {
    padding: 2px 7px;
    border: 1px solid rgba(90,140,248,0.22);
    border-radius: 6px;
    color: var(--color-accent);
    background: rgba(90,140,248,0.13);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 800;
  }
  .search-hit-top strong {
    min-width: 0;
    overflow: hidden;
    color: var(--color-ink);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .search-hit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    color: var(--color-ink-faint);
    font-size: 11.5px;
  }
  .search-hit-meta span,
  .search-hit-file {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 5px;
  }
  .search-hit-meta svg,
  .search-hit-file svg { flex: 0 0 auto; color: var(--color-ink-faint); }
  .search-hit-file {
    overflow: hidden;
    color: var(--color-ink-muted);
    font-family: var(--font-mono);
    font-size: 12px;
  }
  .search-hit-file span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .search-hit-file strong { flex: 0 0 auto; color: var(--color-accent); }
  .search-hit-line {
    overflow: auto;
    margin: 0;
    padding: 8px 10px;
    border-radius: 7px;
    border: 1px solid color-mix(in srgb, var(--code-add-strong) 18%, transparent);
    color: var(--code-add-text);
    background: var(--code-add-bg);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.45;
    white-space: pre;
  }

  .file-search-form { grid-template-columns: minmax(0, 1fr); }
  .file-search-results {
    padding: 0;
    overflow: hidden;
  }
  .file-search-split {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.75fr);
    height: 100%;
    min-width: 0;
    min-height: 0;
  }
  .file-search-column {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 10px;
    border-right: 1px solid var(--color-border-subtle);
  }
  .file-search-list { display: grid; gap: 7px; }
  .file-search-hit {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-surface-raised);
    text-align: left;
  }
  .file-search-hit:hover:not(:disabled) {
    border-color: rgba(65,209,255,0.3);
    background: var(--color-surface-hover);
  }
  .file-search-hit.active {
    border-color: rgba(90,140,248,0.42);
    background: rgba(90,140,248,0.11);
  }
  .file-search-icon {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    color: var(--color-accent);
  }
  .file-search-icon .language-icon {
    display: block;
    width: 17px;
    height: 17px;
    fill: currentColor;
  }
  .file-search-icon .language-icon path { fill: currentColor; }
  .file-search-main {
    display: grid;
    gap: 2px;
    min-width: 0;
  }
  .file-search-main strong {
    min-width: 0;
    overflow: hidden;
    color: var(--color-ink);
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-search-main span {
    min-width: 0;
    overflow: hidden;
    color: var(--color-ink-faint);
    font-family: var(--font-mono);
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-search-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .file-search-history {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: rgba(7, 8, 16, 0.18);
  }
  .file-search-history-head {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-subtle);
    background: rgba(0,0,0,0.12);
  }
  .file-search-history-head span {
    color: var(--color-ink-faint);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .file-search-history-head strong {
    min-width: 0;
    overflow: hidden;
    color: var(--color-ink);
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-search-history-list {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 10px;
  }
  .file-search-history-row {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 9px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: var(--color-surface-raised);
  }
  .file-search-history-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 5px 8px;
    min-width: 0;
  }
  .file-search-history-main .hash {
    padding: 2px 7px;
    border: 1px solid rgba(90,140,248,0.22);
    border-radius: 6px;
    color: var(--color-accent);
    background: rgba(90,140,248,0.13);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
  }
  .file-search-history-main strong {
    min-width: 0;
    overflow: hidden;
    color: var(--color-ink);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-search-history-main > span:last-child {
    grid-column: 1 / -1;
    overflow: hidden;
    color: var(--color-ink-faint);
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-search-history-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* --- Credential dialog --- */

  .cred-card {
    display: flex;
    flex-direction: column;
    width: min(500px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    border: 1px solid rgba(100, 108, 255, 0.36);
    border-radius: 14px;
    background:
      linear-gradient(180deg, #222743 0%, #111321 42%),
      #111321;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(255,255,255,0.04) inset;
    overflow: hidden;
  }

  .cred-hero {
    display: grid;
    gap: 12px;
    padding: 20px 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    background:
      linear-gradient(135deg, rgba(100,108,255,0.24), rgba(189,52,254,0.18) 46%, rgba(65,209,255,0.09)),
      var(--color-bar);
  }

  .cred-hero-top {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  .cred-hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.16);
    color: #ffffff;
    background:
      linear-gradient(135deg, rgba(65,209,255,0.32), rgba(100,108,255,0.5) 46%, rgba(189,52,254,0.48));
    box-shadow: 0 14px 36px rgba(100,108,255,0.22), inset 0 1px 0 rgba(255,255,255,0.18);
  }

  .cred-hero-text { flex: 1; min-width: 0; }
  .cred-hero-label {
    margin: 0 0 2px;
    color: #aeb8ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .cred-hero-title {
    margin: 0;
    color: #ffffff;
    font-size: 19px;
    font-weight: 800;
    line-height: 1.15;
  }

  .cred-hero-copy {
    max-width: 420px;
    margin: 0;
    color: #c4caea;
    font-size: 13px;
    line-height: 1.45;
  }

  .cred-security-note {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 7px;
    min-height: 26px;
    padding: 0 9px;
    border: 1px solid rgba(65,209,255,0.18);
    border-radius: 999px;
    color: #bfefff;
    background: rgba(65,209,255,0.08);
    font-size: 11.5px;
    font-weight: 700;
  }
  .cred-security-note svg { flex: 0 0 auto; color: #41d1ff; }
  .cred-security-note span { min-width: 0; }

  .cred-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: #aeb8ff;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
  }
  .cred-close:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #ffffff;
  }

  .cred-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 22px 20px;
    overflow: auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent);
  }

  .cred-segment {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr);
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(100,108,255,0.28);
    border-radius: 10px;
    background: rgba(8, 9, 18, 0.58);
  }

  .cred-seg-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--color-ink-dim);
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.14s, color 0.14s, border-color 0.14s;
  }
  .cred-seg-btn:hover:not(.active) { color: var(--color-ink-muted); }
  .cred-seg-btn.active {
    background: linear-gradient(135deg, rgba(100,108,255,0.28), rgba(65,209,255,0.12));
    border-color: rgba(65,209,255,0.36);
    color: var(--color-ink);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
  }

  .cred-fields { display: flex; flex-direction: column; gap: 12px; }

  .cred-field { display: flex; flex-direction: column; gap: 5px; }

  .cred-field-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--color-ink-muted);
    letter-spacing: 0.03em;
  }

  .cred-input {
    position: relative;
    display: flex;
    align-items: center;
  }
  .cred-input .cred-field-icon {
    position: absolute;
    left: 11px;
    color: var(--color-ink-faint);
    pointer-events: none;
  }
  .cred-input input {
    height: 42px;
    padding-left: 34px;
    padding-right: 40px;
    border-radius: 9px;
    border-color: rgba(65,209,255,0.22);
    background: rgba(7, 8, 16, 0.7);
    font-size: 14px;
  }
  .cred-input input::placeholder { color: rgba(168,177,216,0.48); }

  .cred-reveal {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--color-ink-faint);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
  }
  .cred-reveal:hover { background: var(--color-surface-hover); color: var(--color-ink); }

  .cred-token-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 11px;
    border-radius: 8px;
    border: 1px solid rgba(65,209,255,0.22);
    background: linear-gradient(135deg, rgba(65,209,255,0.08), rgba(100,108,255,0.07));
    color: var(--color-ink-muted);
    font-size: 12px;
    line-height: 1.55;
  }
  .cred-token-hint svg { flex-shrink: 0; margin-top: 1px; color: var(--color-primary); }
  .cred-token-hint code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(90,140,248,0.15);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--color-accent);
  }

  .cred-expiry { display: flex; flex-direction: column; gap: 5px; }
  .cred-expiry input[type="date"] {
    height: 40px;
    padding: 0 11px;
    border-radius: 9px;
    border: 1px solid rgba(65,209,255,0.22);
    background: rgba(7, 8, 16, 0.7);
    color: var(--color-ink);
    font-size: 13.5px;
    color-scheme: dark;
  }
  .cred-expiry-hint { font-size: 11.5px; color: var(--color-ink-faint); line-height: 1.5; }

  .cred-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(232,96,90,0.3);
    border-radius: 8px;
    background: rgba(232,96,90,0.08);
    color: #f09090;
    font-size: 13px;
    line-height: 1.5;
  }
  .cred-error svg { flex-shrink: 0; margin-top: 1px; }

  .cred-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border-subtle);
  }

  .cred-save {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
  }
  .cred-save input[type="checkbox"] { width: auto; height: auto; cursor: pointer; }
  .cred-save span { font-size: 12.5px; color: var(--color-ink-dim); }

  .cred-btns { display: flex; gap: 8px; flex-shrink: 0; }

  .cred-cancel {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: var(--color-surface-raised);
    color: var(--color-ink-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
  }
  .cred-cancel:hover:not(:disabled) {
    border-color: var(--color-border-input);
    background: var(--color-surface-hover);
    color: var(--color-ink);
  }

  .cred-submit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 16px;
    border: 1px solid rgba(111,140,255,0.72);
    border-radius: 7px;
    background: linear-gradient(135deg, #5f7df2, #238eb4);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
  }
  .cred-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, #6f8cff, #2da0c7);
    border-color: rgba(77,182,214,0.7);
  }
  .cred-submit:disabled { opacity: 0.45; cursor: not-allowed; }

  /* --- Diff viewer --- */

  .diff-view {
    min-height: 0;
    max-height: 420px;
    margin: 0;
    padding: 10px;
    overflow: auto;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: var(--color-surface-raised);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    tab-size: 2;
  }
  .diff-line { display: block; white-space: pre-wrap; word-break: break-word; }
  .diff-line.meta    { color: var(--color-ink-faint); }
  .diff-line.hunk    { color: var(--code-hunk-text); background: var(--code-hunk-bg); }
  .diff-line.add     { color: var(--code-add-text); background: var(--code-add-bg); }
  .diff-line.del     { color: var(--code-delete-text); background: var(--code-delete-bg); }
  .diff-line.context { color: var(--color-ink-muted); }

  .diff-counts { display: flex; gap: 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
  .diff-counts .adds { color: var(--code-add-strong); }
  .diff-counts .dels { color: var(--code-delete-strong); }

  /* --- Conflict resolver --- */

  .resolve-editor { display: flex; flex-direction: column; min-height: 0; padding: 10px; gap: 8px; }

  .resolve-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
  .resolve-toolbar button { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
  .resolve-toolbar-label { color: var(--color-ink-dim); font-size: 12px; font-weight: 800; }

  .resolve-status { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-size: 12px; font-weight: 700; color: #e0a040; }

  .resolve-textarea {
    width: 100%;
    flex: 1 1 auto;
    min-height: 120px;
    padding: 10px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    background: var(--color-surface-raised);
    color: var(--color-ink);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    tab-size: 2;
    resize: none;
    white-space: pre;
  }

  .resolve-structured {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 4px;
    overflow: hidden;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: var(--color-surface-raised);
  }

  .resolve-conflict-controls {
    display: grid;
    align-content: start;
    gap: 6px;
    flex: 0 0 auto;
    max-height: 126px;
    overflow: auto;
  }

  .resolve-conflict-controls .resolve-conflict-bar {
    padding: 7px 8px;
    border: 1px solid rgba(224,160,64,0.25);
    border-radius: 6px;
    background: rgba(224,160,64,0.06);
  }
  .resolve-conflict-controls .resolve-conflict-bar.unresolved {
    border-color: rgba(232,96,96,0.3);
    background: rgba(232,96,96,0.06);
  }

  .resolve-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: var(--code-surface);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    tab-size: 2;
  }

  .resolve-pane {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    scrollbar-gutter: stable;
  }
  .resolve-pane + .resolve-pane { border-left: 1px solid var(--color-border-subtle); }

  .resolve-pane-grid {
    display: grid;
    grid-template-columns: 3.2rem minmax(max-content, 1fr);
    align-content: start;
    min-width: 100%;
  }

  .resolve-split-marker {
    grid-column: 1 / -1;
    padding: 3px 8px;
    color: #e0a040;
    background: rgba(224,160,64,0.12);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }
  .resolve-split-marker.unresolved { color: var(--code-delete-text); background: var(--code-delete-gutter-bg); }

  .resolve-num {
    padding: 0 6px 0 4px;
    border-right: 1px solid var(--color-border-subtle);
    color: var(--color-ink-faint);
    background: var(--code-surface-subtle);
    text-align: right;
    user-select: none;
  }
  .resolve-num.ours   { color: var(--code-add-strong); background: var(--code-add-gutter-bg); border-right-color: rgba(78,202,118,0.2); }
  .resolve-num.theirs { color: var(--code-hunk-text); background: var(--code-hunk-bg); border-right-color: rgba(122,172,255,0.2); }
  .resolve-num.empty  { background: var(--code-surface-muted); }

  .resolve-cell {
    min-width: 0;
    padding: 0 8px;
    overflow: visible;
    color: var(--color-ink-muted);
    white-space: pre;
  }
  .resolve-cell.ours   { color: var(--code-add-text); background: var(--code-add-bg); }
  .resolve-cell.theirs { color: var(--code-hunk-text); background: var(--code-hunk-bg); }
  .resolve-cell.empty  { background: var(--code-surface-muted); }
  .resolve-cell.dimmed { opacity: 0.42; filter: grayscale(0.5); }

  .resolve-context { margin: 0; padding: 2px 8px; overflow-x: auto; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; tab-size: 2; color: var(--color-ink-muted); }

  .resolve-conflict { display: grid; gap: 6px; padding: 8px; border: 1px solid rgba(224,160,64,0.25); border-radius: 6px; background: rgba(224,160,64,0.06); }
  .resolve-conflict.unresolved { border-color: rgba(232,96,96,0.3); background: rgba(232,96,96,0.06); }
  .resolve-conflict-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .resolve-conflict-label { color: #e0a040; font-size: 12px; font-weight: 800; }

  .resolve-choice-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
  .resolve-choice-buttons button { min-height: 24px; padding: 0 8px; font-size: 11.5px; }
  .resolve-choice-buttons button.active { border-color: var(--color-primary); color: #ffffff; background: var(--color-primary); }

  .resolve-side { display: grid; gap: 3px; padding: 6px; border: 1px solid var(--color-border-subtle); border-radius: 6px; border-left-width: 3px; }
  .resolve-side.ours   { border-left-color: #4eca76; background: rgba(78,202,118,0.06); }
  .resolve-side.theirs { border-left-color: #5a8cf8; background: rgba(90,140,248,0.06); }
  .resolve-side.dimmed { opacity: 0.4; filter: grayscale(0.5); }

  .resolve-side-label { font-size: 11px; font-weight: 800; text-transform: uppercase; }
  .resolve-side.ours .resolve-side-label   { color: var(--code-add-strong); }
  .resolve-side.theirs .resolve-side-label { color: var(--code-hunk-text); }

  .resolve-lines { margin: 0; overflow-x: auto; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; tab-size: 2; }
  .resolve-line { display: block; white-space: pre-wrap; word-break: break-word; }
  .resolve-line.ours    { color: var(--code-add-text); }
  .resolve-line.theirs  { color: var(--code-hunk-text); }
  .resolve-line.context { color: var(--color-ink-muted); }

  .resolve-binary { display: grid; align-content: start; gap: 12px; padding: 4px; }
  .resolve-binary-note { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid rgba(224,160,64,0.28); border-radius: 6px; color: #e0a040; background: rgba(224,160,64,0.07); font-size: 13px; }
  .resolve-binary-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

  .resolve-binary-card { display: grid; gap: 6px; justify-items: start; padding: 14px; border: 1px solid var(--color-border-subtle); border-left-width: 3px; border-radius: 8px; text-align: left; background: var(--color-surface-raised); }
  .resolve-binary-card.ours   { border-left-color: #4eca76; }
  .resolve-binary-card.theirs { border-left-color: #5a8cf8; }
  .resolve-binary-card.active { box-shadow: 0 0 0 2px var(--color-primary) inset; border-color: var(--color-primary); }
  .resolve-binary-card strong { color: var(--color-ink); font-size: 18px; }
  .resolve-binary-hint { color: var(--color-ink-faint); font-size: 12px; }

  .resolve-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .resolve-path { overflow: hidden; color: var(--color-ink-faint); font-family: var(--font-mono); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
}

:root[data-theme="light"] button:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

:root[data-theme="light"] input:focus,
:root[data-theme="light"] textarea:focus,
:root[data-theme="light"] select:focus {
  box-shadow: 0 0 0 3px rgba(49, 95, 214, 0.14), 0 10px 24px rgba(28, 44, 74, 0.06);
}

:root[data-theme="light"] .btn-primary {
  border-color: rgba(49, 95, 214, 0.72);
  background: linear-gradient(135deg, #315fd6 0%, #0f8fb5 100%);
  box-shadow: 0 10px 24px rgba(49, 95, 214, 0.18);
}

:root[data-theme="light"] .btn-primary:hover:not(:disabled) {
  border-color: rgba(15, 143, 181, 0.72);
  background: linear-gradient(135deg, #3d6ee4 0%, #139dc7 100%);
}

:root[data-theme="light"] .btn-secondary {
  border-color: rgba(15, 143, 181, 0.28);
  color: #0c6683;
  background: linear-gradient(180deg, rgba(15, 143, 181, 0.08), rgba(49, 95, 214, 0.06));
}

:root[data-theme="light"] .btn-secondary:hover:not(:disabled) {
  color: #0d4f9e;
  background: linear-gradient(180deg, rgba(15, 143, 181, 0.13), rgba(49, 95, 214, 0.1));
}

:root[data-theme="light"] .titlebar {
  background:
    linear-gradient(90deg, rgba(49, 95, 214, 0.08), rgba(15, 143, 181, 0.05), rgba(214, 156, 49, 0.04)),
    var(--color-bar);
}

:root[data-theme="light"] .titlebar-brand,
:root[data-theme="light"] .titlebar-controls {
  border-color: rgba(34,49,78,0.1);
}

:root[data-theme="light"] .repo-toolbar {
  border-color: var(--color-border);
  background: rgba(255,255,255,0.78);
}

:root[data-theme="light"] .titlebar-brand-icon img {
  filter: drop-shadow(0 1px 2px rgba(28,44,74,0.18));
}

:root[data-theme="light"] .tb-version {
  color: rgba(23,32,51,0.36);
}

:root[data-theme="light"] .titlebar-info svg {
  color: var(--color-accent);
}

:root[data-theme="light"] .tb-repo,
:root[data-theme="light"] .tb-no-repo {
  color: var(--color-bar-muted);
}

:root[data-theme="light"] .tb-sep {
  color: rgba(23,32,51,0.28);
}

:root[data-theme="light"] .tb-branch {
  color: var(--color-bar-text);
}

:root[data-theme="light"] .tb-action:hover:not(:disabled),
:root[data-theme="light"] .tb-btn:hover:not(:disabled) {
  background: rgba(49,95,214,0.08);
  color: var(--color-ink);
}

:root[data-theme="light"] .titlebar-divider {
  background: rgba(34,49,78,0.1);
}

:root[data-theme="light"] .tb-btn {
  color: var(--color-bar-muted);
}

:root[data-theme="light"] .topbar {
  border-color: var(--color-border);
  background:
    linear-gradient(90deg, rgba(49,95,214,0.06), rgba(15,143,181,0.045), rgba(214,156,49,0.035)),
    var(--color-surface);
}

:root[data-theme="light"] .repo-tabbar,
:root[data-theme="light"] .repo-management-tools {
  background: rgba(247,249,252,0.96);
}

/* 2026 workspace refresh --------------------------------------------------
   A single, quiet product system shared by management, repository workspace,
   dialogs and both color themes. Kept as an override layer so existing Git
   behavior and component ownership stay unchanged. */
:root {
  --ui-radius: 7px;
  --ui-radius-sm: 5px;
  --ui-control-height: 32px;
  --ui-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  --app-bg: #222328;
  --app-button-bg: #32363d;
  --app-input-bg: #22252a;
  --app-panel-highlight: none;
  --app-panel-shadow: none;
  --color-surface: #2b2e34;
  --color-surface-alt: #1b1c1e;
  --color-surface-dim: #2e3137;
  --color-surface-hover: #363a41;
  --color-surface-raised: #32363d;
  --color-surface-solid: #222328;
  --color-border: #3a3e45;
  --color-border-subtle: #34383e;
  --color-border-input: #465159;
  --color-primary: #25a7c7;
  --color-primary-dark: #188ca9;
  --color-accent: #2eb5d1;
}

:root[data-theme="light"] {
  --ui-shadow: 0 10px 28px rgba(23, 40, 72, 0.09);
  --app-bg: #f4f6f9;
  --app-button-bg: #ffffff;
  --app-input-bg: #ffffff;
  --app-panel-highlight: none;
  --app-panel-shadow: none;
  --color-surface: #ffffff;
  --color-surface-alt: #f7f8fa;
  --color-surface-dim: #f8f9fb;
  --color-surface-hover: #f0f4fa;
  --color-surface-raised: #ffffff;
  --color-surface-solid: #ffffff;
  --color-border: #cfd6e1;
  --color-border-subtle: #e3e7ed;
  --color-border-input: #c9d1dd;
  --color-primary: #0b63e6;
  --color-primary-dark: #0755c8;
  --color-accent: #0b63e6;
}

body { background: var(--app-bg); }

button {
  min-height: var(--ui-control-height);
  border-radius: var(--ui-radius-sm);
  box-shadow: none;
  font-size: 12px;
  font-weight: 650;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-accent) 88%, transparent);
  outline-offset: 2px;
}
input, textarea, select { border-radius: var(--ui-radius-sm); }
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 16%, transparent); }

.shell { --app-titlebar-height: 40px; --app-toolbar-height: 64px; background: var(--app-bg); }
.shell-body { gap: 0; padding: 0; }
.titlebar {
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-bar);
}
.titlebar-brand { min-width: 140px; padding-left: 14px; border-right: 0; font-size: 14px; }
.titlebar-brand-icon,
.titlebar-brand-icon img { width: 22px; height: 22px; }
.titlebar-brand-icon { flex-basis: 22px; }
.titlebar-drag { align-self: stretch; min-width: 0; }
.titlebar-info { justify-self: center; width: min(480px, 100%); }
.titlebar-context { justify-content: center; }
.tb-repo, .tb-branch { color: var(--color-ink); font-size: 13px; }
.tb-version { color: var(--color-ink-faint); }
.titlebar-globals { margin-left: auto; }
.titlebar-divider { background: var(--color-border-subtle); }

.repo-tabbar {
  min-height: 46px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface-dim);
}
.repo-tab-wrap { min-height: 45px; border-right: 1px solid var(--color-border-subtle); border-radius: 0; }
.repo-tab-wrap:first-child { border-left: 1px solid var(--color-border-subtle); }
.repo-tab-wrap.active { background: var(--color-surface-solid); box-shadow: inset 0 -3px 0 var(--color-primary); }
.repo-tab { min-height: 45px; padding-left: 14px; font-size: 12.5px; }
.repo-tab-close {
  width: 26px;
  min-width: 26px;
  max-width: 26px;
  height: 26px;
  min-height: 26px;
  max-height: 26px;
  flex-basis: 26px;
  aspect-ratio: 1;
}
.repo-tab-add { min-height: 45px; }

.repo-toolbar {
  height: var(--app-toolbar-height);
  padding: 7px 18px 8px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-surface-raised);
}
.repo-toolbar-sync { grid-template-rows: 10px 36px; }
.repo-toolbar-group-label { padding-left: 1px; font-size: 8.5px; letter-spacing: .13em; }
.repo-action-group { height: 36px; border-color: var(--color-border); background: transparent; }
.repo-action { height: 34px; min-height: 34px; padding-inline: 15px; font-weight: 650; }
.repo-action.sync-primary { color: var(--color-primary); }
.repo-toolbar-divider { height: 34px; margin-inline: 6px; }

.workspace {
  grid-template-columns: minmax(220px, var(--left-sidebar-width, 280px)) 7px minmax(360px, 1fr) 7px minmax(var(--history-aside-min-width, 420px), var(--history-aside-width, 620px));
  flex: 1 1 0;
  padding: 0;
  background: var(--color-border-subtle);
  row-gap: 0;
}
.left-sidebar { background: var(--color-surface); }
.main-panel { border: 0; border-radius: 0; background: var(--color-surface-solid); }
.history-aside { background: var(--color-border-subtle); row-gap: 0; }

.panel {
  border: 0;
  border-radius: 0;
  background: var(--color-surface-solid);
  box-shadow: none;
  backdrop-filter: none;
}
.left-sidebar .panel + .panel { border-top: 1px solid var(--color-border); }
.left-sidebar .panel { background: var(--color-surface); }
.section-head {
  min-height: 50px;
  padding: 8px 12px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-solid);
}
.section-head h2 { font-size: 14px; font-weight: 750; }
.eyebrow { font-size: 9px; font-weight: 750; letter-spacing: .11em; }
.pill { min-height: 19px; padding-inline: 6px; border-radius: 5px; }
.pill-count { color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 10%, transparent); }

.repo-summary { height: 48px; padding-inline: 16px; background: var(--color-surface-dim); }
.repo-branch { font-size: 14px; }
.repo-path { opacity: .82; }
.sync-stats strong, .sync-stats span { border-radius: 5px; background: transparent !important; }
.top-section { grid-template-rows: minmax(160px, 1fr) 7px var(--commit-panel-height, 220px); padding: 0; }

.left-sidebar-resize-handle,
.history-resize-handle,
.panel-resize-handle,
.left-panel-resize-handle { background: var(--color-border-subtle); }
.left-sidebar-resize-handle::before,
.history-resize-handle::before { width: 1px; height: 48px; background: var(--color-border); }
.panel-resize-handle::before { width: 44px; height: 2px; }

.status-toolbar {
  min-height: 40px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-dim);
}
.status-toolbar .danger { margin-left: auto; }
.status-panel > .section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}
.status-panel > .section-head > :first-child { justify-self: start; }
.status-panel > .section-head > .status-head-actions {
  justify-self: end;
  max-width: 100%;
}
.status-view-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  align-items: center;
  min-height: 26px;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-surface-dim);
}
.status-view-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 20px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  color: var(--color-ink-faint);
  background: transparent;
  font-size: 9.5px;
  font-weight: 700;
}
.status-view-switch button:hover:not(:disabled) {
  color: var(--color-ink);
  background: var(--color-surface-hover);
}
.status-view-switch button.active {
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 13%, var(--color-surface-solid));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.status-view-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 12px;
  height: 10px;
}
.status-view-icon.list-icon {
  background: repeating-linear-gradient(to bottom, currentColor 0 1px, transparent 1px 4px);
}
.status-panel { container-type: inline-size; }
.status-lanes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 25px minmax(280px, 1fr);
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
  background: var(--color-border-subtle);
}
.status-lane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--color-surface-solid);
}
.status-lane.staged-lane {
  background:
    linear-gradient(180deg, color-mix(in srgb, #2da44e 2.5%, transparent), transparent 120px),
    var(--color-surface-solid);
}
.status-flow-divider {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  color: var(--color-primary);
  background: var(--color-surface-dim);
}
.status-flow-divider::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 50%;
  width: 1px;
  background: var(--color-border);
}
.status-flow-divider span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
  border-radius: 50%;
  background: var(--color-surface-solid);
  box-shadow: 0 0 0 2px var(--color-surface-dim);
}
.status-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-dim);
}
.status-lane-head > div { display: flex; align-items: center; gap: 7px; }
.status-lane-head strong { color: var(--color-ink); font-size: 12px; }
.status-lane-copy { display: grid; gap: 1px; }
.status-lane-copy small {
  color: var(--color-ink-faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}
.status-lane-count {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 5px;
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  font-size: 10.5px;
  font-weight: 750;
}
.staged-lane .status-lane-count {
  color: #55bd72;
  background: color-mix(in srgb, #2da44e 12%, transparent);
}
.status-file-list {
  min-height: 0;
  padding: 5px 0;
  overflow: auto;
  scrollbar-gutter: stable;
}
.status-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  min-height: 42px;
  padding: 3px 8px 3px 12px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--color-border-subtle);
}
.status-file-row:last-child { border-bottom: 0; }
.status-file-row:hover { background: var(--color-surface-hover); }
.status-file-row.selected { background: color-mix(in srgb, var(--color-primary) 9%, var(--color-surface-solid)); }
.status-file-row.active { border-left-color: var(--color-primary); }
.status-file-row.status-tree-file { padding-left: calc(12px + var(--tree-indent, 0px)); }
.status-file-main { display: grid; justify-content: start; gap: 1px; min-width: 0; padding: 3px 8px; border: 0; background: transparent; text-align: left; }
.status-file-main:hover:not(:disabled) { background: transparent; }
.status-file-main strong, .status-file-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-file-main strong { color: var(--color-ink); font: 650 12px/1.3 var(--font-mono); }
.status-file-main span { color: var(--color-ink-faint); font: 10px/1.2 var(--font-mono); }
.status-file-actions { display: flex; margin-left: 5px; opacity: 0; transition: opacity 120ms ease; }
.status-file-row:hover .status-file-actions, .status-file-row:focus-within .status-file-actions { opacity: 1; }
.status-file-actions button { width: 28px; min-width: 28px; min-height: 28px; padding: 0; border-color: transparent; background: transparent; }
.status-file-actions .danger:hover:not(:disabled) { color: #e86060; background: rgba(232,96,96,.1); }
.status-folder-row {
  display: grid;
  grid-template-columns: 14px 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 32px;
  padding: 2px 12px 2px calc(12px + var(--tree-indent, 0px));
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  color: var(--color-ink-muted);
  background: color-mix(in srgb, var(--color-surface-dim) 64%, transparent);
  text-align: left;
}
.status-folder-row:hover:not(:disabled) {
  color: var(--color-ink);
  background: var(--color-surface-hover);
}
.status-tree-chevron {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 120ms ease;
}
.status-tree-chevron.expanded { transform: rotate(45deg) translate(-1px, -1px); }
.status-folder-row .status-folder-lucide { color: var(--color-accent); }
.status-folder-row strong {
  overflow: hidden;
  color: inherit;
  font: 650 11px/1.2 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-folder-count {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  border-radius: 4px;
  color: var(--color-ink-faint);
  background: color-mix(in srgb, var(--color-ink-faint) 9%, transparent);
  font-size: 9px;
  font-weight: 750;
}
.status-lane-empty {
  display: grid;
  place-items: center;
  min-height: 86px;
  margin: 0;
  padding: 14px 16px;
  color: var(--color-ink-faint);
  font-size: 11.5px;
  text-align: center;
}
.status-badge { min-width: 58px; padding-inline: 5px; border: 0; border-radius: 4px; font-size: 9px; letter-spacing: .04em; }

.commit-panel { border-top: 1px solid var(--color-border); }
.commit-head-actions { display: flex; align-items: center; gap: 5px; }
.commit-generate-button { color: var(--color-primary); background: transparent; }
.commit-settings-button { width: 30px; min-width: 30px; padding: 0; background: transparent; }
.commit-form { padding: 10px 12px 12px; }
.commit-form textarea { min-height: 72px; resize: none; }
.commit-amend-row { min-height: 34px; }
.commit-actions-row .btn-primary { min-height: 38px; border-radius: var(--ui-radius-sm); background: var(--color-primary); box-shadow: none; }
.commit-actions-row .btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }

.branch-list, .explorer-list, .stash-list { padding: 5px !important; }
.branch-row, .explorer-row, .stash-row { border-radius: var(--ui-radius-sm); }
.branch-row.current, .explorer-row.active { background: color-mix(in srgb, var(--color-primary) 11%, var(--color-surface-solid)); box-shadow: inset 3px 0 0 var(--color-primary); }
.branch-group-toggle { background: transparent; }
.explorer-row .status-badge { min-width: 18px; overflow: hidden; color: #d9891b; background: transparent; text-indent: -999px; }
.explorer-row .status-badge::after { content: "M"; float: right; text-indent: 0; }

.history-panel { min-height: 0; }
.graph-list { background: var(--color-surface-solid); }
.graph-gutter { background: var(--color-surface-dim); }
.commit-body {
  border-radius: 0;
  background: color-mix(in srgb, var(--color-primary) 7%, var(--color-surface-solid));
  box-shadow: none;
}
.graph-row + .graph-row .commit-body { border-top: 1px solid var(--color-border-subtle); }
.graph-row:hover .commit-body { background: var(--color-surface-hover); }
.commit-note-rail {
  position: absolute;
  z-index: 2;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: #d8a74a;
  box-shadow: 0 0 8px rgba(216, 167, 74, 0.16);
  opacity: 0.68;
  pointer-events: none;
}
.graph-row.has-note .commit-body {
  background:
    linear-gradient(90deg, rgba(216, 167, 74, 0.075), rgba(216, 167, 74, 0.025) 36%, transparent 68%),
    color-mix(in srgb, var(--color-primary) 7%, var(--color-surface-solid));
}
.graph-row.has-note:hover .commit-body {
  background:
    linear-gradient(90deg, rgba(216, 167, 74, 0.105), rgba(216, 167, 74, 0.035) 36%, transparent 68%),
    var(--color-surface-hover);
}
.graph-row {
  content-visibility: auto;
  contain-intrinsic-block-size: 108px;
}
.commit-avatar { border-radius: 50%; }
.commit-kind, .compact-ref-chip { border-radius: 4px; }
.workspace-statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 30px;
  padding: 0 14px;
  border-top: 1px solid var(--color-border);
  color: var(--color-ink-faint);
  background: var(--color-surface-solid);
  font-size: 10.5px;
}
.workspace-statusbar > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.workspace-status-spacer { flex: 1 1 auto; }
.workspace-health > span { width: 8px; height: 8px; border-radius: 50%; background: #d9891b; }
.workspace-health.clean > span { background: #2da44e; }
.workspace-statusbar .ahead { color: #d9891b; }
.workspace-statusbar .behind { color: var(--color-primary); }
.workspace-statusbar .workspace-local-only {
  padding: 2px 6px;
  border: 1px dashed rgba(224,160,64,.42);
  border-radius: 4px;
  color: #f0bd6b;
  background: rgba(224,160,64,.08);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .02em;
}
.workspace-auto i { width: 7px; height: 7px; border-radius: 50%; background: var(--color-ink-faint); }
.workspace-auto.active i { background: #2da44e; }
.app-version {
  padding-left: 12px;
  border-left: 1px solid var(--color-border-subtle);
  color: var(--color-ink-faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.repo-management { margin: 14px; border-radius: var(--ui-radius); background: var(--color-surface-solid); box-shadow: var(--ui-shadow); }
.repo-management-head, .repo-management-tools { background: var(--color-surface-solid); }
.repo-section { border-radius: var(--ui-radius-sm); background: var(--color-surface-solid); }
.repo-section > header { background: var(--color-surface-dim); }
.repo-row-main:hover:not(:disabled) { background: var(--color-surface-hover); }

/* Dark control contrast --------------------------------------------------
   Keep GitKraken's restrained graphite palette while making interactive
   boundaries and text states unambiguous on every dark surface. */
:root:not([data-theme="light"]) .btn-primary {
  border-color: #2eb5d1;
  color: #ffffff;
  background: #126f84;
}
:root:not([data-theme="light"]) .btn-primary:hover:not(:disabled) {
  border-color: #55c5dc;
  color: #ffffff;
  background: #147c94;
}
:root:not([data-theme="light"]) .btn-secondary {
  border-color: #596169;
  color: #d7dadc;
  background: #32363d;
}
:root:not([data-theme="light"]) .btn-secondary:hover:not(:disabled) {
  border-color: #707982;
  color: #ffffff;
  background: #41464d;
}
:root:not([data-theme="light"]) input,
:root:not([data-theme="light"]) textarea,
:root:not([data-theme="light"]) select,
:root:not([data-theme="light"]) .select-menu-trigger {
  border-color: #596169;
}
:root:not([data-theme="light"]) input:hover:not(:disabled),
:root:not([data-theme="light"]) textarea:hover:not(:disabled),
:root:not([data-theme="light"]) select:hover:not(:disabled),
:root:not([data-theme="light"]) .select-menu-trigger:hover:not(:disabled) {
  border-color: #707982;
}
:root:not([data-theme="light"]) input:focus,
:root:not([data-theme="light"]) textarea:focus,
:root:not([data-theme="light"]) select:focus,
:root:not([data-theme="light"]) .select-menu.open .select-menu-trigger {
  border-color: var(--color-accent);
}
:root:not([data-theme="light"]) .repo-action-group,
:root:not([data-theme="light"]) .dialog-icon-button {
  border-color: #535a62;
}
:root:not([data-theme="light"]) .repo-action:hover:not(:disabled),
:root:not([data-theme="light"]) .repo-action.active,
:root:not([data-theme="light"]) .dialog-icon-button:hover:not(:disabled) {
  border-color: #707982;
  background: #3b4047;
}

/* Dark app chrome separation -------------------------------------------
   Tabs, command toolbar and workspace should read as three adjacent
   layers instead of one uninterrupted gray strip. */
:root:not([data-theme="light"]) .repo-tabbar {
  border-bottom-color: #505760;
  background: #26292f;
  box-shadow:
    inset 0 -1px 0 #191b1f,
    0 1px 0 rgba(255, 255, 255, 0.035);
}
:root:not([data-theme="light"]) .repo-tabs-scroll {
  border-left-color: #454b53;
}
:root:not([data-theme="light"]) .repo-tab-wrap {
  border-right-color: #454b53;
  background: #292c32;
}
:root:not([data-theme="light"]) .repo-tab-wrap:hover {
  background: #30343a;
}
:root:not([data-theme="light"]) .repo-tab-wrap.active,
:root:not([data-theme="light"]) .repo-tab.management.active {
  background: #343941;
  box-shadow:
    inset 0 -3px 0 var(--color-accent),
    inset 1px 0 0 #4c535b,
    inset -1px 0 0 #4c535b,
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}
:root:not([data-theme="light"]) .repo-tab-add {
  border-left-color: #454b53;
  background: #292c32;
}
:root:not([data-theme="light"]) .repo-toolbar {
  border-top: 1px solid #424850;
  border-bottom-color: #505760;
  background: #30343a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 2px 0 #191b1f;
}
:root:not([data-theme="light"]) .repo-action-group {
  border-color: #596169;
  background: #292d32;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}
:root:not([data-theme="light"]) .repo-action-group > .repo-action,
:root:not([data-theme="light"]) .repo-action-group > .repo-history-wrap > .repo-action {
  border-right-color: #484e55;
}
:root:not([data-theme="light"]) .repo-toolbar-divider {
  background: #555c64;
}
:root:not([data-theme="light"]) .workspace {
  box-shadow: inset 0 1px 0 #17191c;
}

/* Light app chrome separation ------------------------------------------
   Keep the same layered hierarchy as the dark theme with restrained,
   cool-gray borders and a clean white active surface. */
:root[data-theme="light"] .repo-tabbar {
  border-bottom-color: #aeb8c5;
  background: #e9edf2;
  box-shadow:
    inset 0 -1px 0 #d2d9e2,
    0 1px 0 rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .repo-tabs-scroll {
  border-left-color: #c3cbd5;
}

:root[data-theme="light"] .repo-tab-wrap {
  border-right-color: #c3cbd5;
  background: #eef1f5;
}

:root[data-theme="light"] .repo-tab-wrap:hover {
  background: #e3e8ee;
}

:root[data-theme="light"] .repo-tab-wrap.active,
:root[data-theme="light"] .repo-tab.management.active {
  background: #ffffff;
  box-shadow:
    inset 0 -3px 0 var(--color-primary),
    inset 1px 0 0 #b7c1cd,
    inset -1px 0 0 #b7c1cd,
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

:root[data-theme="light"] .repo-tab-add {
  border-left-color: #c3cbd5;
  background: #eef1f5;
}

:root[data-theme="light"] .repo-toolbar {
  border-top: 1px solid #c4ccd6;
  border-bottom-color: #aeb8c5;
  background: #f4f6f8;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 2px 0 #d6dce4;
}

:root[data-theme="light"] .repo-action-group {
  border-color: #aeb8c5;
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 1px 2px rgba(34, 49, 78, 0.06);
}

:root[data-theme="light"] .repo-action-group > .repo-action,
:root[data-theme="light"] .repo-action-group > .repo-history-wrap > .repo-action {
  border-right-color: #c8d0da;
}

:root[data-theme="light"] .repo-toolbar-divider {
  background: #b5bec9;
}

:root[data-theme="light"] .workspace {
  box-shadow: inset 0 1px 0 #c9d1db;
}

@media (max-width: 1180px) {
  .repo-action { padding-inline: 10px; }
  .repo-toolbar-divider { margin-inline: 2px; }
  .repo-action-label { display: none; }
  .repo-action.sync-primary .repo-action-label { display: inline; }
}

@media (max-width: 900px) {
  .shell-body { overflow: auto; }
  .workspace { grid-template-columns: minmax(190px, 230px) 7px minmax(420px, 1fr); min-height: 760px; }
  .history-resize-handle, .history-aside { display: none; }
  .workspace-statusbar { position: sticky; bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (hover: none), (pointer: coarse) {
  .status-file-actions { opacity: 1; }
}

:root[data-theme="light"] .repo-tab-wrap {
  background: rgba(255,255,255,0.5);
}

:root[data-theme="light"] .repo-tab-wrap.active {
  background: #ffffff;
}

:root[data-theme="light"] .repo-tab-wrap:hover,
:root[data-theme="light"] .repo-tab.management:hover:not(:disabled) {
  background: rgba(255,255,255,0.9);
}

:root[data-theme="light"] .repo-tab.management.active {
  background: #ffffff;
}

:root[data-theme="light"] .repo-row {
  border-bottom-color: rgba(34,49,78,0.08);
}

:root[data-theme="light"] .repo-row-main:hover:not(:disabled) {
  background: rgba(49,95,214,0.07);
}

:root[data-theme="light"] .repo-row-icon {
  border-left-color: rgba(34,49,78,0.08);
}

:root[data-theme="light"] .notice.error,
:root[data-theme="light"] .cred-error {
  color: #b33445;
  background: rgba(210, 55, 75, 0.08);
}

:root[data-theme="light"] .error-toast {
  border-color: rgba(190,48,66,0.28);
  background:
    linear-gradient(135deg, rgba(210,55,75,0.11), rgba(49,95,214,0.05)),
    rgba(255,255,255,0.96);
  box-shadow: 0 18px 48px rgba(28,44,74,0.18), 0 0 0 1px rgba(255,255,255,0.8) inset;
}

:root[data-theme="light"] .error-toast-icon {
  color: #b33445;
  background: rgba(210,55,75,0.09);
}

:root[data-theme="light"] .error-toast-content strong {
  color: #24314a;
}

:root[data-theme="light"] .notice.busy {
  color: #315fd6;
}

:root[data-theme="light"] .notice.conflict,
:root[data-theme="light"] .notice-action.conflict,
:root[data-theme="light"] .resolve-status,
:root[data-theme="light"] .resolve-conflict-label {
  color: #96620f;
}

:root[data-theme="light"] .notice.rebase,
:root[data-theme="light"] .notice-action.rebase {
  color: #6f3ca8;
}

:root[data-theme="light"] .update-toast {
  box-shadow: 0 22px 56px rgba(28,44,74,0.18), 0 0 0 1px rgba(255,255,255,0.75) inset;
}

:root[data-theme="light"] .branch-filter-backdrop {
  background: rgba(232,238,248,0.96);
}

:root[data-theme="light"] .branch-filter-dialog {
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f7fc 72%),
    #f4f7fc;
  box-shadow: var(--app-dialog-shadow);
}

:root[data-theme="light"] .graph-branch-dialog-button,
:root[data-theme="light"] .branch-filter-option {
  color: #16723b;
}

:root[data-theme="light"] .graph-branch-dialog-button span {
  color: #ffffff;
  background: #22834a;
}

:root[data-theme="light"] .main-panel {
  background: var(--color-surface);
  box-shadow: var(--app-panel-shadow);
}

:root[data-theme="light"] .repo-management {
  background: var(--color-surface);
  box-shadow: var(--app-panel-shadow);
}

:root[data-theme="light"] .repo-section {
  background: rgba(255,255,255,0.62);
}

:root[data-theme="light"] .repo-section > header {
  background: rgba(244,247,252,0.88);
}

:root[data-theme="light"] .repo-empty {
  background: rgba(255,255,255,0.48);
}

:root[data-theme="light"] .repo-summary,
:root[data-theme="light"] .lane-header,
:root[data-theme="light"] .stash-toolbar,
:root[data-theme="light"] .dialog-footer,
:root[data-theme="light"] .cred-header {
  background: var(--color-surface-dim);
}

:root[data-theme="light"] .file-row.selected,
:root[data-theme="light"] .branch-row.current,
:root[data-theme="light"] .file-history-row.active {
  background: rgba(49,95,214,0.08);
}

:root[data-theme="light"] .graph-list {
  background: rgba(248,250,253,0.9);
}

:root[data-theme="light"] .graph-gutter {
  border-right-color: rgba(34,49,78,0.1);
  background:
    linear-gradient(90deg, rgba(49,95,214,0.035), rgba(255,255,255,0.18)),
    rgba(238,243,249,0.78);
}

:root[data-theme="light"] .graph-dot {
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(34,49,78,0.16), 0 2px 6px rgba(28,44,74,0.12);
}

:root[data-theme="light"] .graph-dot.merge {
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(34,49,78,0.14);
}

:root[data-theme="light"] .commit-body {
  background: rgba(255,255,255,0.72);
}

:root[data-theme="light"] .graph-row + .graph-row .commit-body {
  border-top-color: rgba(34,49,78,0.08);
}

:root[data-theme="light"] .graph-row:hover .commit-body {
  background: rgba(235,241,250,0.9);
}

:root[data-theme="light"] .graph-row.has-note .commit-body {
  background:
    linear-gradient(90deg, rgba(194, 132, 35, 0.09), rgba(194, 132, 35, 0.025) 38%, transparent 68%),
    rgba(255,255,255,0.76);
}

:root[data-theme="light"] .graph-row.has-note:hover .commit-body {
  background:
    linear-gradient(90deg, rgba(194, 132, 35, 0.12), rgba(194, 132, 35, 0.035) 38%, transparent 68%),
    rgba(235,241,250,0.92);
}

:root[data-theme="light"] .commit-note-presence {
  border-color: transparent;
  color: #986313;
  background: linear-gradient(90deg, rgba(194, 132, 35, 0.12), rgba(194, 132, 35, 0.05));
  box-shadow: inset 0 -1px 0 rgba(168, 105, 16, 0.2);
}

:root[data-theme="light"] .commit-note-tooltip,
:root[data-theme="light"] .commit-note-tooltip::before {
  background: color-mix(in srgb, #c28423 4%, #ffffff);
}

:root[data-theme="light"] .commit-note-tooltip {
  box-shadow: 0 12px 30px rgba(35, 45, 68, 0.16), inset 2px 0 0 rgba(194, 132, 35, 0.48);
}

:root[data-theme="light"] .commit-note-tooltip-head {
  color: #986313;
}

:root[data-theme="light"] .graph-row.merge-row .commit-body {
  background: rgba(248,244,252,0.82);
}

:root[data-theme="light"] .graph-row.tip-row .commit-body {
  background:
    linear-gradient(90deg, rgba(49,95,214,0.075), transparent 34%),
    rgba(255,255,255,0.82);
}

:root[data-theme="light"] .commit-summary {
  color: var(--color-ink);
}

:root[data-theme="light"] .commit-avatar {
  border-color: rgba(49,95,214,0.18);
  color: #315fd6;
  background: rgba(232,238,248,0.92);
}

:root[data-theme="light"] .commit-kind {
  background: rgba(244,247,252,0.82);
}

:root[data-theme="light"] .commit-hash {
  color: #315fd6;
}

:root[data-theme="light"] .compact-ref-chip.branch {
  border-color: color-mix(in srgb, var(--ref-lane-color, #315fd6) 48%, rgba(49,95,214,.16));
  color: #18345f;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #315fd6) 14%, #f7faff), #f7faff);
}

:root[data-theme="light"] .compact-ref-local-marker {
  border-color: rgba(154,82,0,.46);
  color: #8b5207;
  background: linear-gradient(90deg, rgba(217,137,27,.14), rgba(217,137,27,.06));
  box-shadow: inset 1px 0 0 rgba(154,82,0,.14);
}

:root[data-theme="light"] .compact-ref-chip.current {
  border-color: color-mix(in srgb, var(--ref-lane-color, #315fd6) 58%, rgba(49,95,214,.2));
  color: #18345f;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #315fd6) 20%, #f7faff), #f7faff);
}

:root[data-theme="light"] .branch-filter-option.remote {
  border-color: rgba(49,95,214,0.22);
  color: #315fd6;
  background: rgba(231,237,255,0.92);
}

:root[data-theme="light"] .compact-ref-chip.remote {
  border-color: color-mix(in srgb, var(--ref-lane-color, #315fd6) 42%, rgba(49,95,214,.16));
  color: #315fd6;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #315fd6) 12%, #f7faff), #f7faff);
}

:root[data-theme="light"] .graph-row:hover .compact-ref-chip.branch,
:root[data-theme="light"] .graph-row.selected .compact-ref-chip.branch,
:root[data-theme="light"] .graph-row:focus-within .compact-ref-chip.branch {
  border-color: color-mix(in srgb, var(--ref-lane-color, #315fd6) 62%, rgba(49,95,214,.2));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ref-lane-color, #315fd6) 22%, #f7faff), #ffffff);
  box-shadow:
    inset 2px 0 0 var(--ref-lane-color, #315fd6),
    0 3px 12px color-mix(in srgb, var(--ref-lane-color, #315fd6) 10%, rgba(34,49,78,.16));
}

:root[data-theme="light"] .compact-ref-chip.tag,
:root[data-theme="light"] .commit-ref-detail-item.tag {
  color: #8b5d0e;
}

:root[data-theme="light"] .compact-ref-chip.tag {
  background: transparent;
}

:root[data-theme="light"] .compact-ref-overflow {
  color: #60708a;
  border-color: transparent;
  background: rgba(49,95,214,.035);
}

:root[data-theme="light"] .graph-branch-dialog-button {
  color: #475873;
  border-color: rgba(49,95,214,.16);
  background: rgba(244,247,252,.9);
}

:root[data-theme="light"] .commit-ref-details {
  border-color: rgba(49,95,214,.16);
  background: rgba(247,249,253,.94);
}

:root[data-theme="light"] .commit-ref-detail-item {
  color: #475873;
  background: #ffffff;
}

:root[data-theme="light"] .commit-files,
:root[data-theme="light"] .commit-file-button {
  background: rgba(248,250,253,0.78);
}

:root[data-theme="light"] .file-history-rail-toggle {
  background: linear-gradient(180deg, rgba(49,95,214,0.08), rgba(15,143,181,0.04));
}

:root[data-theme="light"] .file-history-rail-toggle:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(49,95,214,0.12), rgba(15,143,181,0.08));
}

:root[data-theme="light"] .file-history-loading {
  background:
    radial-gradient(circle at center 42%, rgba(49,95,214,0.1), transparent 52%),
    linear-gradient(180deg, rgba(244,247,252,0.88), transparent);
}

:root[data-theme="light"] .file-history-loading-icon {
  filter:
    drop-shadow(0 10px 14px rgba(28,44,74,0.18))
    drop-shadow(0 0 12px rgba(49,95,214,0.18));
}

:root[data-theme="light"] .branch-context-menu {
  box-shadow: 0 18px 50px rgba(28,44,74,0.18);
}

:root[data-theme="light"] .select-menu-popup {
  box-shadow: 0 18px 50px rgba(28,44,74,0.18);
}

:root[data-theme="light"] .select-menu-value > span,
:root[data-theme="light"] .select-menu-option,
:root[data-theme="light"] .select-menu-option.selected {
  color: var(--color-ink);
}

:root[data-theme="light"] .select-menu-value.placeholder > span {
  color: var(--color-ink-muted);
}

:root[data-theme="light"] .select-menu-option:hover:not(:disabled),
:root[data-theme="light"] .select-menu-option.active:not(:disabled) {
  background: var(--color-surface-hover);
}

:root[data-theme="light"] .dialog-file-row:hover,
:root[data-theme="light"] .branch-row:hover,
:root[data-theme="light"] .explorer-row:hover,
:root[data-theme="light"] .commit-files-toggle:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

:root[data-theme="light"] .diff-line.meta,
:root[data-theme="light"] .resolve-split-marker {
  color: #64728a;
}

:root[data-theme="light"] .global-search-tabs,
:root[data-theme="light"] .file-search-history,
:root[data-theme="light"] .file-search-history-head {
  background: var(--color-surface-dim);
}

:root[data-theme="light"] .discard-target {
  background: var(--code-surface-subtle);
}

:root[data-theme="light"] .commit-amend-toggle input {
  border-color: var(--color-border-input);
  background: var(--app-input-bg);
}

:root[data-theme="light"] .commit-amend-toggle input:checked {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 2px #ffffff;
}

:root[data-theme="light"] .cred-segment {
  border-color: rgba(49,95,214,0.2);
  background: #eef3f9;
}

:root[data-theme="light"] .cred-card {
  border-color: rgba(49, 95, 214, 0.22);
  background: #ffffff;
  box-shadow: 0 28px 72px rgba(28, 44, 74, 0.2), 0 0 0 1px rgba(255,255,255,0.82) inset;
}

:root[data-theme="light"] .cred-hero {
  border-bottom-color: rgba(34, 49, 78, 0.1);
  background:
    radial-gradient(circle at 8% 0%, rgba(49,95,214,0.13), transparent 42%),
    linear-gradient(135deg, #f8faff, #eef4fc);
}

:root[data-theme="light"] .cred-hero-icon {
  border-color: rgba(49,95,214,0.2);
  color: #ffffff;
  background: linear-gradient(135deg, #4d8dff, #0f8fb5);
  box-shadow: 0 12px 26px rgba(49,95,214,0.2), inset 0 1px 0 rgba(255,255,255,0.24);
}

:root[data-theme="light"] .cred-hero-label { color: #315fd6; }
:root[data-theme="light"] .cred-hero-title { color: #172033; }
:root[data-theme="light"] .cred-hero-copy { color: #526078; }

:root[data-theme="light"] .cred-security-note {
  border-color: rgba(15,143,181,0.2);
  color: #21647a;
  background: rgba(15,143,181,0.07);
}

:root[data-theme="light"] .cred-security-note svg { color: #0f8fb5; }

:root[data-theme="light"] .cred-body {
  background: #ffffff;
}

:root[data-theme="light"] .cred-seg-btn.active {
  border-color: rgba(49,95,214,0.26);
  background: linear-gradient(135deg, rgba(49,95,214,0.12), rgba(15,143,181,0.08));
  box-shadow: 0 8px 18px rgba(28,44,74,0.1), inset 0 1px 0 rgba(255,255,255,0.9);
}

:root[data-theme="light"] .cred-seg-btn:hover:not(.active) {
  color: var(--color-ink);
  background: rgba(255,255,255,0.68);
}

:root[data-theme="light"] .cred-close {
  border-color: var(--color-border-subtle);
  color: var(--color-ink-dim);
  background: rgba(255,255,255,0.76);
}

:root[data-theme="light"] .cred-close:hover:not(:disabled) {
  border-color: var(--color-border-input);
  color: var(--color-ink);
  background: var(--color-surface-hover);
}

:root[data-theme="light"] .status-badge.modified,
:root[data-theme="light"] .resolve-status,
:root[data-theme="light"] .resolve-conflict-label {
  color: #8a580a;
}

:root[data-theme="light"] .status-badge.added,
:root[data-theme="light"] .status-badge.untracked,
:root[data-theme="light"] .pill-active,
:root[data-theme="light"] .prepared-tag {
  color: #19723d;
}

:root[data-theme="light"] .status-badge.deleted {
  color: #b4233b;
}

:root[data-theme="light"] .status-badge.renamed {
  color: #245cc7;
}

:root[data-theme="light"] .cred-input input,
:root[data-theme="light"] .cred-expiry input[type="date"] {
  border-color: var(--color-border-input);
  background: rgba(255,255,255,0.92);
  color-scheme: light;
}

:root[data-theme="light"] .cred-input input::placeholder { color: #8995a8; }

:root[data-theme="light"] .cred-reveal:hover {
  color: var(--color-ink);
  background: var(--color-surface-hover);
}

:root[data-theme="light"] .cred-token-hint code {
  color: #0d78a0;
}

:root[data-theme="light"] .status-panel-overlay {
  background:
    radial-gradient(circle at 50% 38%, rgba(49, 95, 214, 0.12), transparent 55%),
    rgba(244, 247, 252, 0.68);
}

:root[data-theme="light"] .status-panel-overlay-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(244,247,252,0.94)),
    var(--color-surface-raised);
  box-shadow: 0 18px 44px rgba(28,44,74,0.16), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* Custom tooltip — appended to body, not clipped by overflow:hidden parents */
.path-tooltip {
  position: fixed;
  z-index: 300;
  max-width: 480px;
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface-raised);
  color: var(--color-ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes update-progress-slide {
  0% { transform: translateX(-120%); }
  50% { transform: translateX(120%); }
  100% { transform: translateX(320%); }
}

/* --- Responsive breakpoints --- */

@media (min-width: 1800px) {
  .workspace    { grid-template-columns: minmax(220px, var(--left-sidebar-width, 320px)) 8px minmax(0, 1fr) 8px minmax(var(--history-aside-min-width, 420px), var(--history-aside-width, 680px)); }
}

@media (max-width: 1400px) {
  .workspace { grid-template-columns: minmax(200px, var(--left-sidebar-width, 265px)) 8px minmax(0, 1fr) 8px minmax(var(--history-aside-min-width, 420px), var(--history-aside-width, 580px)); }
}

/* Stack CommitPanel below StatusPanel; history panels stay side by side */
@media (max-width: 1100px) {
  .workspace    { grid-template-columns: minmax(185px, var(--left-sidebar-width, 220px)) 8px minmax(0, 1fr) 8px minmax(var(--history-aside-min-width, 420px), var(--history-aside-width, 560px)); }
  .top-section  { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 14px var(--commit-panel-height, 190px); }
}

/* Compact workspace with narrow sidebars */
@media (max-width: 960px) {
  .workspace      { grid-template-columns: 180px 8px minmax(0, 1fr) 0 300px; row-gap: 6px; }
  .history-aside  { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); row-gap: 0; }
  .history-resize-handle { display: none; }
  .shell-body     { gap: 6px; }
  .left-sidebar {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 230px)) 14px minmax(150px, var(--stash-panel-height, 170px)) 14px minmax(220px, 1fr);
  }
  .left-sidebar:has(.stash-panel.collapsed) {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 230px)) 14px auto 0 minmax(220px, 1fr);
  }
  .left-sidebar.branch-collapsed {
    grid-template-rows: auto 0 minmax(150px, var(--stash-panel-height, 170px)) 14px minmax(220px, 1fr);
  }
  .left-sidebar.explorer-collapsed {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 230px)) 14px minmax(150px, var(--stash-panel-height, 170px)) 0 auto;
  }
  .left-sidebar.branch-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: auto 0 auto 0 minmax(220px, 1fr);
  }
  .left-sidebar.explorer-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 230px)) 14px auto 0 auto;
  }
  .left-sidebar.branch-collapsed.explorer-collapsed {
    grid-template-rows: auto 0 minmax(150px, var(--stash-panel-height, 170px)) 0 auto;
  }
  .left-sidebar.branch-collapsed.explorer-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: auto 0 auto 0 auto;
    align-content: start;
  }
  .section-head   { min-height: 40px; padding: 6px 10px; }
  .repo-summary   { height: 40px; padding: 0 10px; }
  .repo-branch    { max-width: 160px; }
  .repo-path      { display: none; }
  .sync-stats span { display: none; }
  .branch-actions { flex-direction: column; align-items: flex-end; gap: 4px; }
  .branch-actions button { width: 100%; }
  .tb-action-label { display: none; }
  .repo-action-label.utility-label { display: none; }
}

/* Narrow: single column */
@media (max-width: 740px) {
  body            { overflow: auto; }
  .shell-body     { min-height: 100%; gap: 6px; }
  .titlebar-info  { padding: 0 8px; }
  .tb-action      { padding: 0 9px; }
  .tb-btn         { width: 34px; }
  .workspace      { grid-template-columns: 1fr; gap: 6px; }
  .left-sidebar-resize-handle { display: none; }
  .history-aside  { grid-template-columns: 1fr; grid-template-rows: minmax(200px, 1fr); min-height: 240px; }
  .file-history-dialog-backdrop { padding: 8px; }
  .file-history-dialog { width: 100%; height: 100%; }
  .file-history-dialog-header { min-height: 64px; padding: 9px 10px; }
  .file-history-dialog-icon { width: 34px; height: 34px; }
  .file-history-dialog-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
  .file-history-dialog-row time { display: none; }
  .file-history-dialog-actions { display: grid; }
  .file-history-dialog-actions button { width: 32px; min-width: 32px; padding: 0; overflow: hidden; color: var(--color-ink-muted); font-size: 0; gap: 0; }
  .left-sidebar {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 240px)) 14px minmax(150px, var(--stash-panel-height, 180px)) 14px minmax(220px, 1fr);
    min-height: 560px;
  }
  .left-sidebar:has(.stash-panel.collapsed) {
    grid-template-rows: minmax(180px, var(--branch-panel-height, 240px)) 14px auto 0 minmax(220px, 1fr);
  }
  .left-sidebar.branch-collapsed {
    grid-template-rows: auto 0 minmax(150px, var(--stash-panel-height, 180px)) 14px minmax(220px, 1fr);
  }
  .left-sidebar.explorer-collapsed {
    grid-template-rows: minmax(120px, var(--branch-panel-height, 240px)) 14px minmax(150px, var(--stash-panel-height, 180px)) 0 auto;
  }
  .left-sidebar.branch-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: auto 0 auto 0 minmax(0, 1fr);
  }
  .left-sidebar.explorer-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: minmax(120px, var(--branch-panel-height, 240px)) 14px auto 0 auto;
  }
  .left-sidebar.branch-collapsed.explorer-collapsed {
    grid-template-rows: auto 0 minmax(150px, var(--stash-panel-height, 180px)) 0 auto;
  }
  .left-sidebar.branch-collapsed.explorer-collapsed:has(.stash-panel.collapsed) {
    grid-template-rows: auto 0 auto 0 auto;
    align-content: start;
  }
  .top-section    { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 14px var(--commit-panel-height, 190px); }
  .repo-form      { grid-template-columns: 1fr; }
  .repo-tabbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .repo-tab.management { min-width: 44px; width: 44px; padding: 0; justify-content: center; }
  .repo-tab.management span { display: none; }
  .repo-tabs-scroll { grid-column: auto; order: initial; border-top: 0; }
  .repo-management-head,
  .repo-management-tools { align-items: stretch; flex-direction: column; }
  .repo-management-actions { justify-content: flex-start; }
  .clone-dialog-path-field { grid-template-columns: minmax(0, 1fr); }
  .clone-dialog-actions { flex-direction: column-reverse; }
  .clone-dialog-actions button { width: 100%; }
  .repo-row-main  { grid-template-columns: minmax(0, 1fr); gap: 2px; align-content: center; padding-left: 12px; }
  .repo-row       { min-height: 58px; }
  .repo-row-icon  { min-height: 58px; }
  .repo-path      { display: none; }
  .repo-summary   { height: 40px; }
  .change-lanes   { grid-template-columns: 1fr; }
  .compare-form   { grid-template-columns: 1fr; }
  .compare-arrow-shell { width: 100%; height: 30px; }
  .compare-arrow-shell svg { transform: rotate(90deg); }
  .compare-dialog-head { min-height: 60px; padding: 10px 12px; }
  .compare-dialog-mark { width: 34px; height: 34px; }
  .compare-dialog-title h2 { font-size: 15px; }
  .compare-select-body { padding: 14px; }
  .compare-target-panel { padding: 13px; }
  .compare-select-footer > span { display: none; }
  .compare-select-footer { justify-content: flex-end; }
  .dialog-body    { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 0.4fr) minmax(0, 1fr); }
  .compare-dialog .dialog-body { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 0.4fr) minmax(0, 1fr); }
  .global-search-options { grid-template-columns: 1fr; }
  .file-search-split { grid-template-columns: 1fr; grid-template-rows: minmax(150px, 0.9fr) minmax(0, 1fr); }
  .file-search-column { border-right: none; border-bottom: 1px solid var(--color-border-subtle); }
  .file-search-hit { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .file-search-hit .status-badge,
  .file-search-action { grid-column: 2; justify-self: start; }
  .rebase-base-bar { grid-template-columns: 1fr; }
  .rebase-plan-row { grid-template-columns: auto 96px 54px minmax(180px, 1fr); }
  .reflog-body { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 0.8fr) minmax(0, 1.2fr); }
  .reflog-list-pane { border-right: none; border-bottom: 1px solid var(--color-border-subtle); }
  .dialog-files   { border-right: none; border-bottom: 1px solid var(--color-border-subtle); }
  .branch-actions { flex-direction: row; justify-content: flex-start; }
  .tb-action-label { display: none; }
  .repo-action-label { display: none; }
  .repo-action { padding-inline: 8px; }
  .repo-toolbar { gap: 5px; padding-inline: 6px; }
  .repo-toolbar-divider { margin-inline: 0; }
  .repo-auto-toggle { padding-left: 7px; gap: 6px; }
}

/* Keep the refreshed workspace rules authoritative after legacy theme/media
   compatibility declarations above. */
.commit-actions-row .btn-primary,
:root[data-theme="light"] .commit-actions-row .btn-primary {
  border-color: var(--color-primary);
  color: #fff;
  background: var(--color-primary);
  box-shadow: none;
}
.commit-actions-row .btn-primary:hover:not(:disabled),
:root[data-theme="light"] .commit-actions-row .btn-primary:hover:not(:disabled) {
  border-color: var(--color-primary-dark);
  color: #fff;
  background: var(--color-primary-dark);
}
:root[data-theme="light"] .panel,
:root[data-theme="light"] .main-panel,
:root[data-theme="light"] .graph-list,
:root[data-theme="light"] .commit-body { box-shadow: none; }

@media (max-width: 1100px) {
  .shell-body { overflow: auto; }
  .workspace {
    grid-template-columns: minmax(200px, 250px) 7px minmax(480px, 1fr);
    min-width: 760px;
    min-height: 680px;
  }
  .history-resize-handle,
  .history-aside { display: none; }
  .workspace-statusbar { position: sticky; bottom: 0; z-index: 20; }
}

/* Repository workflow order: inspect first, then remote synchronization. */
.repo-toolbar > .repo-inspect-actions { order: 1; }
.repo-toolbar > .repo-toolbar-divider:not(.utility) { order: 2; }
.repo-toolbar > .repo-toolbar-sync {
  order: 3;
  display: block;
  align-self: auto;
  margin-bottom: 1px;
}
.repo-toolbar > .repo-toolbar-spacer { order: 4; }
.repo-toolbar > .repo-toolbar-divider.utility { order: 5; }
.repo-toolbar > .repo-utility-actions { order: 6; }

/* Center every toolbar group with the same breathing room above and below. */
.repo-toolbar {
  align-items: center;
  padding-top: 8px;
  padding-bottom: 8px;
}
.repo-toolbar > .repo-toolbar-sync,
.repo-toolbar > .repo-inspect-actions,
.repo-toolbar > .repo-utility-actions { margin-bottom: 0; }
.repo-toolbar > .repo-toolbar-divider { margin-top: 0; margin-bottom: 0; }

/* Compact change map for long compare and line-patch views. */
.split-diff-shell,
.line-patch-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.split-diff-shell .split-diff { min-height: 0; }
.line-patch-workspace .line-patch-scroll { min-height: 0; }
.diff-overview {
  position: relative;
  min-width: 16px;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--color-border-subtle);
  background: var(--code-surface-subtle);
}
.diff-overview::before {
  content: "";
  position: absolute;
  inset: 5px 6px;
  border-radius: 999px;
  background: var(--color-border-subtle);
}
.diff-overview-marker {
  position: absolute;
  z-index: 1;
  top: var(--marker-position);
  left: 2px;
  width: 11px;
  min-width: 11px;
  height: 5px;
  min-height: 5px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  transform: translateY(-50%);
  box-shadow: 0 0 0 1px color-mix(in srgb, currentColor 28%, transparent);
  appearance: none;
}
.diff-overview-marker.add { color: var(--code-add-strong); background: var(--code-add-strong); }
.diff-overview-marker.delete { color: var(--code-delete-strong); background: var(--code-delete-strong); }
.diff-overview-marker.mixed {
  color: var(--color-accent);
  background: linear-gradient(90deg, var(--code-delete-strong) 0 48%, var(--code-add-strong) 52% 100%);
}
.diff-overview-marker:hover:not(:disabled),
.diff-overview-marker:focus-visible {
  filter: brightness(1.18);
  outline: 0;
  box-shadow: 0 0 0 1px currentColor, 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

/* Preserve semantic diff colors against global button hover rules. */
.diff-overview .diff-overview-marker.add:hover:not(:disabled),
.diff-overview .diff-overview-marker.add:focus-visible {
  border: 0 !important;
  color: var(--code-add-strong) !important;
  background-color: var(--code-add-strong) !important;
  background-image: none !important;
}
.diff-overview .diff-overview-marker.delete:hover:not(:disabled),
.diff-overview .diff-overview-marker.delete:focus-visible {
  border: 0 !important;
  color: var(--code-delete-strong) !important;
  background-color: var(--code-delete-strong) !important;
  background-image: none !important;
}
.diff-overview .diff-overview-marker.mixed:hover:not(:disabled),
.diff-overview .diff-overview-marker.mixed:focus-visible {
  border: 0 !important;
  color: var(--color-accent) !important;
  background-color: transparent !important;
  background-image: linear-gradient(90deg, var(--code-delete-strong) 0 48%, var(--code-add-strong) 52% 100%) !important;
}
.line-patch-hunk-button.stage:hover:not(:disabled),
.line-patch-hunk-button.unstage:hover:not(:disabled) {
  border-color: var(--code-add-strong);
  color: var(--code-add-strong);
  background: var(--code-add-bg);
}
.line-patch-hunk-button.discard:hover:not(:disabled) {
  border-color: var(--code-delete-strong);
  color: var(--code-delete-strong);
  background: var(--code-delete-bg);
}

/* Footer status must stay readable on the bright theme. */
:root[data-theme="light"] .workspace-statusbar { color: #526078; }
:root[data-theme="light"] .workspace-branch {
  color: #172033;
  font-weight: 750;
}
:root[data-theme="light"] .workspace-branch svg { color: #0b63e6; }
:root[data-theme="light"] .workspace-statusbar .ahead {
  color: #9a5200;
  font-weight: 800;
}
:root[data-theme="light"] .workspace-statusbar .behind {
  color: #0755c8;
  font-weight: 800;
}
:root[data-theme="light"] .repo-action.sync-primary.publish-local,
:root[data-theme="light"] .repo-action-local-marker,
:root[data-theme="light"] .workspace-statusbar .workspace-local-only {
  color: #8b5207;
  border-color: rgba(154,82,0,.4);
  background: rgba(217,137,27,.09);
}
:root[data-theme="light"] .sync-stats .sync-local-only {
  border-color: rgba(154,82,0,.36);
  color: #8b5207;
  background: rgba(217,137,27,.09);
}
:root[data-theme="light"] .sync-stats .sync-local-only strong { color: #8b5207; }

/* AI pre-commit review --------------------------------------------------- */
.commit-review-button {
  border-color: color-mix(in srgb, var(--color-primary) 26%, var(--color-border));
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}
.commit-review-button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-primary) 50%, var(--color-border));
  color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
}
.ai-review-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(920px, calc(100vw - 40px));
  height: min(780px, calc(100vh - 40px));
  overflow: hidden;
}
.ai-review-header h2 { margin: 2px 0 0; color: var(--color-ink); font-size: 16px; }
.ai-review-provider {
  padding: 3px 7px;
  border-radius: 5px;
  color: var(--color-ink-dim);
  background: var(--color-surface-hover);
  font-size: 10.5px;
  font-weight: 750;
}
.ai-review-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-dim);
}
.ai-review-summary-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: #d9891b;
  background: color-mix(in srgb, #d9891b 12%, transparent);
}
.ai-review-summary-icon.clean { color: #2da44e; background: color-mix(in srgb, #2da44e 12%, transparent); }
.ai-review-summary-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-review-summary-line > strong { color: var(--color-ink); font-size: 14px; }
.ai-review-summary p { margin: 5px 0 0; color: var(--color-ink-muted); font-size: 12.5px; line-height: 1.45; }
.ai-review-risk {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ai-review-risk.low { color: #2da44e; background: color-mix(in srgb, #2da44e 12%, transparent); }
.ai-review-risk.medium { color: #b96500; background: color-mix(in srgb, #d9891b 13%, transparent); }
.ai-review-risk.high { color: #d1242f; background: color-mix(in srgb, #d1242f 12%, transparent); }
.ai-review-findings { min-height: 0; padding: 10px; overflow: auto; background: var(--app-dialog-bg); }
.ai-review-finding {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--color-border-subtle);
  border-left: 3px solid var(--color-border);
  border-radius: 7px;
  background: var(--color-surface-solid);
}
.ai-review-finding + .ai-review-finding { margin-top: 8px; }
.ai-review-finding.critical { border-left-color: #d1242f; }
.ai-review-finding.warning { border-left-color: #d9891b; }
.ai-review-finding.info { border-left-color: var(--color-primary); }
.ai-review-finding-icon { display: grid; place-items: start center; padding-top: 1px; color: var(--color-primary); }
.ai-review-finding.critical .ai-review-finding-icon { color: #d1242f; }
.ai-review-finding.warning .ai-review-finding-icon { color: #d9891b; }
.ai-review-finding-title { display: flex; align-items: center; gap: 7px; }
.ai-review-finding-title span { color: var(--color-ink-faint); font-size: 9px; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.ai-review-finding-title strong { color: var(--color-ink); font-size: 12.5px; }
.ai-review-finding-body > p { margin: 6px 0 8px; color: var(--color-ink-muted); font-size: 12px; line-height: 1.5; }
.ai-review-location { display: flex; align-items: center; gap: 5px; color: var(--color-primary); }
.ai-review-location code { overflow-wrap: anywhere; font: 10.5px/1.4 var(--font-mono); }

/* Sync settings: one place for pull behavior, upstream and remote connections. */
.sync-settings-dialog { width: min(820px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--color-border); border-radius: 14px; background: var(--app-dialog-bg); box-shadow: 0 28px 80px rgba(0,0,0,.48); }
.sync-settings-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
.sync-settings-title { display: flex; align-items: center; gap: 12px; }
.sync-settings-title h2 { margin: 2px 0 0; color: var(--color-ink); font-size: 19px; }
.sync-settings-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(90,140,248,.28); border-radius: 10px; color: var(--color-accent); background: rgba(90,140,248,.1); }
.sync-settings-body { display: grid; gap: 12px; min-height: 0; padding: 14px; overflow: auto; }
.sync-settings-card { padding: 16px; border: 1px solid var(--color-border-subtle); border-radius: 11px; background: var(--color-surface-raised); }
.sync-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.sync-card-heading h3 { margin: 0; color: var(--color-ink); font-size: 13px; }
.sync-card-heading p { margin: 4px 0 0; color: var(--color-ink-faint); font-size: 11px; }
.count-pill { min-width: 24px; padding: 3px 7px; border-radius: 999px; color: var(--color-ink-muted); background: var(--color-surface-hover); font: 700 10px var(--font-mono); text-align: center; }
.strategy-options { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.strategy-options label { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 8px; min-height: 94px; padding: 12px; border: 1px solid var(--color-border-subtle); border-radius: 9px; color: var(--color-ink-muted); background: var(--app-input-bg); cursor: pointer; }
.strategy-options label.active { border-color: rgba(90,140,248,.65); box-shadow: inset 0 0 0 1px rgba(90,140,248,.18); background: rgba(90,140,248,.08); }
.strategy-options input { margin-top: 2px; accent-color: var(--color-accent); }
.strategy-options span { display: grid; align-content: start; gap: 5px; }
.strategy-options strong { color: var(--color-ink); font-size: 12px; }
.strategy-options small, .sync-fields small { color: var(--color-ink-faint); font-size: 10px; line-height: 1.45; }
.sync-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-subtle); }
.sync-fields label { display: grid; gap: 6px; color: var(--color-ink-muted); font-size: 11px; font-weight: 700; }
.sync-fields select, .remote-add input, .remote-edit input { width: 100%; height: 35px; border: 1px solid var(--color-border-input); border-radius: 7px; color: var(--color-ink); background: var(--app-input-bg); font-size: 11px; }
.sync-fields select { padding: 0 9px; }
.remote-list { display: grid; gap: 5px; }
.sync-action-error { display: grid; gap: 4px; margin-bottom: 5px; padding: 10px 11px; border: 1px solid rgba(232,96,96,.28); border-radius: 8px; color: #ef8888; background: rgba(232,96,96,.08); }
.sync-action-error strong { font-size: 11px; }
.sync-action-error span { font: 9.5px/1.45 var(--font-mono); overflow-wrap: anywhere; }
.sync-action-status { margin-bottom: 5px; padding: 9px 11px; border: 1px solid rgba(90,140,248,.28); border-radius: 8px; color: var(--color-accent); background: rgba(90,140,248,.08); font-size: 10.5px; font-weight: 700; }
.remote-row { display: grid; grid-template-columns: 28px minmax(0,1fr) auto auto; align-items: center; gap: 7px; min-height: 48px; padding: 6px 7px; border: 1px solid var(--color-border-subtle); border-radius: 8px; background: var(--app-input-bg); }
.remote-mark { display: grid; place-items: center; color: var(--color-accent); }
.remote-main { display: grid; gap: 3px; min-width: 0; padding: 0; border: 0; color: var(--color-ink); background: transparent; text-align: left; }
.remote-main strong, .remote-edit strong { font-size: 11.5px; }
.remote-main span { overflow: hidden; color: var(--color-ink-faint); font: 10px var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.remote-edit { display: grid; grid-template-columns: 80px minmax(0,1fr); align-items: center; gap: 8px; }
.remote-confirm { display: grid; gap: 3px; min-width: 0; }
.remote-confirm strong { color: var(--color-ink); font-size: 11px; }
.remote-confirm span { color: var(--color-ink-faint); font-size: 9.5px; }
.remote-edit input, .remote-add input { padding: 0 9px; }
.remote-delete { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 8px; border: 0; border-radius: 6px; color: #e86060; background: transparent; font-size: 10px; font-weight: 750; }
.remote-delete:hover { background: rgba(235,87,87,.1); }
.btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; padding: 0 11px; border: 1px solid rgba(232,96,96,.38); border-radius: 7px; color: #fff; background: #c84f4f; font-size: 10.5px; font-weight: 750; }
.btn-danger:hover:not(:disabled) { background: #dd5b5b; }
.remote-empty { margin: 4px 0 10px; color: var(--color-ink-faint); font-size: 11px; }
.remote-add { display: grid; grid-template-columns: 120px minmax(180px,1fr) auto; gap: 7px; margin-top: 9px; padding-top: 10px; border-top: 1px solid var(--color-border-subtle); }
.sync-settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 20px; border-top: 1px solid var(--color-border-subtle); background: var(--app-dialog-chrome); }
.sync-settings-footer p { max-width: 440px; margin: 0; color: var(--color-ink-faint); font-size: 9.5px; line-height: 1.4; }
.sync-settings-footer > div { display: flex; gap: 8px; }
@media (max-width: 720px) { .strategy-options, .sync-fields { grid-template-columns: 1fr; } .remote-add { grid-template-columns: 1fr; } .sync-settings-footer { align-items: stretch; flex-direction: column; } .sync-settings-footer > div { justify-content: flex-end; } }

/* Compact square controls shared by the Branches, Stash and Explorer headers. */
.branch-head-actions .branch-create-toggle,
.stash-head-actions .stash-toggle,
.explorer-head-actions .explorer-bulk-button {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  inline-size: 24px;
  min-inline-size: 24px;
  max-inline-size: 24px;
  block-size: 24px;
  min-block-size: 24px;
  max-block-size: 24px;
  flex: 0 0 24px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 5px;
}
.explorer-head-actions .explorer-tool-action:not(:disabled) {
  color: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 24%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface-raised));
}
.explorer-head-actions .explorer-tool-action:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--color-accent) 42%, var(--color-border));
  background: color-mix(in srgb, var(--color-accent) 13%, var(--color-surface-raised));
}
.explorer-action-divider {
  inline-size: 1px;
  block-size: 14px;
  margin-inline: 1px;
  background: var(--color-border);
}
.ai-review-suggestion { display: grid; gap: 3px; margin-top: 9px; padding: 8px 9px; border-radius: 5px; background: var(--color-surface-dim); }

/* Square UI language: controls and surfaces have no rounded corners. */
*,
*::before,
*::after {
  border-radius: 0 !important;
}

/* Preserve shapes that communicate a circular marker rather than a rounded surface. */
.commit-avatar,
.repo-switch > span,
.commit-ref-detail-item > i,
.graph-dot,
.worktree-rail span,
.workspace-health > span,
.workspace-auto i {
  border-radius: 50% !important;
}

/* Branch flags keep their flag shape and curved graph connection. */
.compact-ref-chip,
.compact-ref-overflow {
  border-radius: 5px !important;
}
.compact-ref-chip.branch {
  border-radius: 0 5px 5px 0 !important;
}
.branch-ref-cluster.local-only .compact-ref-chip.branch {
  border-radius: 0 !important;
}
.compact-ref-local-marker {
  border-radius: 0 5px 5px 0 !important;
}
.commit-body.has-branch-ref::before {
  border-top-left-radius: 14px !important;
}
.commit-body.has-branch-ref::after {
  border-bottom-right-radius: 14px !important;
}
.ai-review-suggestion strong { color: var(--color-ink-dim); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; }
.ai-review-suggestion span { color: var(--color-ink-muted); font-size: 11.5px; line-height: 1.45; }
.ai-review-clean-state { display: grid; place-items: center; align-content: center; min-height: 280px; gap: 8px; color: #2da44e; text-align: center; }
.ai-review-clean-state strong { color: var(--color-ink); font-size: 14px; }
.ai-review-clean-state span { color: var(--color-ink-faint); font-size: 12px; }
.ai-review-footer p { margin: 0; color: var(--color-ink-faint); font-size: 10.5px; }
.ai-review-footer > div { display: flex; gap: 7px; }

@media (max-width: 720px) {
  .commit-head-actions .pill-count { display: none; }
  .commit-review-button,
  .commit-generate-button { padding-inline: 8px; }
  .ai-review-dialog { width: calc(100vw - 16px); height: calc(100vh - 16px); }
  .ai-review-footer { align-items: stretch; flex-direction: column; }
  .ai-review-footer > div { justify-content: flex-end; }
}

/* Contextual status actions: global discard in the panel header, selection
   actions beside their matching Stage/Unstage command. */
.status-head-actions,
.status-lane-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
}
.status-head-actions { flex-wrap: wrap; }
.status-discard-all {
  margin-left: 3px;
  border-color: color-mix(in srgb, var(--code-delete-strong) 30%, var(--color-border));
  color: var(--code-delete-strong);
  background: color-mix(in srgb, var(--code-delete-strong) 8%, transparent);
}
.status-discard-all:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--code-delete-strong) 52%, var(--color-border));
  color: var(--code-delete-strong);
  background: color-mix(in srgb, var(--code-delete-strong) 14%, transparent);
}
.status-lane-title { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.status-lane-actions { flex-wrap: wrap; }
.status-lane-actions .status-selection-count {
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: 22px;
  padding: 0 5px;
  color: var(--color-ink-dim);
  background: transparent;
  font-size: 9.5px;
}

@container (max-width: 680px) {
  .status-lanes {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 25px minmax(0, 1fr);
  }

  .status-flow-divider::before {
    inset-block: auto;
    inset-inline: 0;
    top: 50%;
    width: auto;
    height: 1px;
  }
  .status-flow-divider span { transform: rotate(90deg); }
}

@container (max-width: 520px) {
  .status-view-switch button > span { display: none; }
  .status-view-switch button { width: 24px; padding-inline: 0; }
}

@media (max-width: 760px) {
  .status-lane-head { align-items: flex-start; flex-direction: column; }
  .status-lane-actions { width: 100%; justify-content: flex-start; }
}

/* Muted light theme -----------------------------------------------------
   A lower-luminance light palette for long sessions. The hierarchy stays
   light and readable without using pure white for every working surface. */
:root[data-theme="light"] {
  --ui-shadow: 0 10px 26px rgba(29, 39, 52, 0.12);
  --app-bg: #cfd5dc;
  --app-button-bg: #e2e7eb;
  --app-input-bg: #e9edf0;
  --app-select-option-bg: #e7ebef;
  --app-dialog-backdrop: rgba(91, 103, 117, 0.38);
  --app-dialog-bg: #e2e6ea;
  --app-dialog-chrome: #d7dde3;
  --app-settings-row-bg: #dce2e7;
  --app-scrollbar-thumb: #aab4be;
  --app-scrollbar-thumb-hover: #929eaa;

  --color-ink: #202832;
  --color-ink-muted: #4d5a68;
  --color-ink-faint: #687583;
  --color-ink-dim: #596674;
  --color-ink-quiet: #62707e;
  --color-surface: #e2e6ea;
  --color-surface-alt: #d8dde3;
  --color-surface-dim: #dce1e6;
  --color-surface-hover: #cfd6de;
  --color-surface-raised: #e7ebee;
  --color-surface-solid: #e1e5e9;
  --color-border: #9faab5;
  --color-border-subtle: #bbc3cc;
  --color-border-input: #98a5b2;
  --color-bar: #d6dce2;
  --color-bar-text: #202832;
  --color-bar-muted: #596674;

  --code-surface: #e1e5e9;
  --code-surface-raised: #d9dfe5;
  --code-surface-subtle: #dce2e7;
  --code-surface-muted: #d4dae0;
  --code-surface-meta: #ced5dc;
  --code-input-bg: #e8ecef;
  --code-hover-bg: #cfd7df;
}

:root[data-theme="light"] .titlebar {
  background:
    linear-gradient(90deg, rgba(49, 95, 214, 0.035), rgba(15, 143, 181, 0.025)),
    var(--color-bar);
}

:root[data-theme="light"] .repo-tabbar {
  border-bottom-color: #929da8;
  background: #cbd2d9;
  box-shadow: inset 0 -1px 0 #aeb7c0;
}

:root[data-theme="light"] .repo-tab-wrap,
:root[data-theme="light"] .repo-tab-add {
  border-color: #aeb8c2;
  background: #d3d9df;
}

:root[data-theme="light"] .repo-tab-wrap:hover,
:root[data-theme="light"] .repo-tab.management:hover:not(:disabled) {
  background: #c8d0d8;
}

:root[data-theme="light"] .repo-tab-wrap.active,
:root[data-theme="light"] .repo-tab.management.active {
  background: #e3e7eb;
  box-shadow:
    inset 0 -3px 0 var(--color-primary),
    inset 1px 0 0 #9faab5,
    inset -1px 0 0 #9faab5;
}

:root[data-theme="light"] .repo-toolbar {
  border-top-color: #aeb7c0;
  border-bottom-color: #929da8;
  background: #d5dbe1;
  box-shadow: 0 2px 0 #b9c1c9;
}

:root[data-theme="light"] .repo-action-group {
  border-color: #98a4af;
  background: #e0e5e9;
  box-shadow: 0 1px 2px rgba(29, 39, 52, 0.1);
}

:root[data-theme="light"] .repo-action-group > .repo-action,
:root[data-theme="light"] .repo-action-group > .repo-history-wrap > .repo-action {
  border-right-color: #aeb8c2;
}

:root[data-theme="light"] .workspace {
  box-shadow: inset 0 1px 0 #aab4be;
}

:root[data-theme="light"] .repo-management,
:root[data-theme="light"] .main-panel {
  background: var(--color-surface);
}

:root[data-theme="light"] .repo-section {
  background: #dbe0e5;
}

:root[data-theme="light"] .repo-section > header,
:root[data-theme="light"] .repo-summary,
:root[data-theme="light"] .lane-header,
:root[data-theme="light"] .stash-toolbar,
:root[data-theme="light"] .dialog-footer,
:root[data-theme="light"] .cred-header {
  background: #d2d8de;
}

:root[data-theme="light"] .repo-empty,
:root[data-theme="light"] .graph-list,
:root[data-theme="light"] .commit-body,
:root[data-theme="light"] .commit-files,
:root[data-theme="light"] .commit-file-button,
:root[data-theme="light"] .commit-ref-detail-item,
:root[data-theme="light"] .cred-card,
:root[data-theme="light"] .cred-body {
  background: #e0e4e8;
}

:root[data-theme="light"] .graph-gutter {
  background: #d2d8de;
}

:root[data-theme="light"] .graph-row:hover .commit-body {
  background: #d3dae1;
}

:root[data-theme="light"] .branch-filter-dialog,
:root[data-theme="light"] .status-panel-overlay-card {
  background: #e2e6ea;
}

:root[data-theme="light"] .cred-input input,
:root[data-theme="light"] .cred-expiry input[type="date"] {
  background: var(--app-input-bg);
}

/* Shared dark-mode accent language in the muted light theme. */
:root[data-theme="light"] {
  --color-primary: #25a7c7;
  --color-primary-dark: #188ca9;
  --color-accent: #2eb5d1;
  --color-ink: #222328;
  --color-ink-muted: #3f4852;
  --color-ink-faint: #66707a;
  --color-ink-dim: #515b65;
  --color-ink-quiet: #5c6670;
  --color-bar-text: #222328;
  --color-bar-muted: #59636d;
}

:root[data-theme="light"] .btn-primary {
  border-color: #2eb5d1;
  color: #f0f1f2;
  background: #126f84;
  box-shadow: none;
}

:root[data-theme="light"] .btn-primary:hover:not(:disabled) {
  border-color: #55c5dc;
  color: #ffffff;
  background: #147c94;
}

:root[data-theme="light"] .btn-secondary,
:root[data-theme="light"] .dialog-icon-button {
  border-color: #909ca8;
  color: #2f3943;
  background: #d2d8de;
}

:root[data-theme="light"] .btn-secondary:hover:not(:disabled),
:root[data-theme="light"] .dialog-icon-button:hover:not(:disabled) {
  border-color: #778591;
  color: #222328;
  background: #c3cbd3;
}

:root[data-theme="light"] .repo-action-group {
  border-color: #909ca8;
  background: #d2d8de;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

:root[data-theme="light"] .repo-action {
  color: #35404a;
}

:root[data-theme="light"] .repo-action-group > .repo-action,
:root[data-theme="light"] .repo-action-group > .repo-history-wrap > .repo-action {
  border-right-color: #aab4be;
}

:root[data-theme="light"] .repo-action:hover:not(:disabled),
:root[data-theme="light"] .repo-action.active {
  color: #222328;
  background: #c3cbd3;
}

:root[data-theme="light"] .repo-action.sync-primary,
:root[data-theme="light"] .repo-action.sync-primary svg {
  color: #2eb5d1;
}

/* Repository tabs stay light while sharing the cyan dark-theme accent. */
:root[data-theme="light"] .repo-tabbar {
  border-bottom-color: #929da8;
  background: #cbd2d9;
  box-shadow: inset 0 -1px 0 #aeb7c0;
}

:root[data-theme="light"] .repo-tabs-scroll {
  border-left-color: #aeb8c2;
}

:root[data-theme="light"] .repo-tab-wrap,
:root[data-theme="light"] .repo-tab.management,
:root[data-theme="light"] .repo-tab-add {
  border-color: #aeb8c2;
  color: #3f4852;
  background: #d3d9df;
}

:root[data-theme="light"] .repo-tab-wrap:hover,
:root[data-theme="light"] .repo-tab.management:hover:not(:disabled),
:root[data-theme="light"] .repo-tab-add:hover:not(:disabled) {
  color: #222328;
  background: #c5ced6;
}

:root[data-theme="light"] .repo-tab-wrap.active,
:root[data-theme="light"] .repo-tab.management.active {
  color: #222328;
  background: #e3e7eb;
  box-shadow:
    inset 0 -3px 0 var(--color-accent),
    inset 1px 0 0 #9faab5,
    inset -1px 0 0 #9faab5;
}

:root[data-theme="light"] .repo-tab > svg,
:root[data-theme="light"] .repo-tab-close,
:root[data-theme="light"] .repo-tab-add {
  color: #66707a;
}

:root[data-theme="light"] .repo-tab-wrap.active .repo-tab,
:root[data-theme="light"] .repo-tab-wrap.active .repo-tab > svg,
:root[data-theme="light"] .repo-tab.management.active > svg,
:root[data-theme="light"] .repo-tab-add:hover:not(:disabled) {
  color: #2eb5d1;
}

:root[data-theme="light"] .repo-tab-wrap.active .repo-tab span,
:root[data-theme="light"] .repo-tab.management.active span {
  color: #222328;
}

:root[data-theme="light"] .repo-tab-close:hover:not(:disabled),
:root[data-theme="light"] .repo-tab-close:focus-visible:not(:disabled) {
  color: #222328;
  background: #c3cbd3;
}

/* Appearance presets --------------------------------------------------- */
:root[data-theme="light"][data-appearance="classic"] {
  --ui-shadow: 0 10px 28px rgba(23, 40, 72, 0.09);
  --app-bg: #f4f6f9;
  --app-button-bg: #ffffff;
  --app-input-bg: #ffffff;
  --app-dialog-bg: #ffffff;
  --app-dialog-chrome: #f4f7fc;
  --app-settings-row-bg: #f8fafd;
  --color-ink: #172033;
  --color-ink-muted: #475569;
  --color-ink-faint: #728098;
  --color-ink-dim: #5f6f89;
  --color-surface: #ffffff;
  --color-surface-alt: #f7f8fa;
  --color-surface-dim: #f8f9fb;
  --color-surface-hover: #f0f4fa;
  --color-surface-raised: #ffffff;
  --color-surface-solid: #ffffff;
  --color-border: #cfd6e1;
  --color-border-subtle: #e3e7ed;
  --color-border-input: #c9d1dd;
  --color-primary: #0b63e6;
  --color-primary-dark: #0755c8;
  --color-accent: #0b63e6;
}

:root[data-theme="light"][data-appearance="classic"] .titlebar {
  background:
    linear-gradient(90deg, rgba(49, 95, 214, 0.08), rgba(15, 143, 181, 0.05), rgba(214, 156, 49, 0.04)),
    var(--color-bar);
}

:root[data-theme="light"][data-appearance="classic"] .repo-tabbar,
:root[data-theme="light"][data-appearance="classic"] .repo-management-tools {
  border-color: var(--color-border);
  background: rgba(247, 249, 252, 0.96);
  box-shadow: none;
}

:root[data-theme="light"][data-appearance="classic"] .repo-tab-wrap,
:root[data-theme="light"][data-appearance="classic"] .repo-tab.management,
:root[data-theme="light"][data-appearance="classic"] .repo-tab-add {
  border-color: var(--color-border-subtle);
  color: var(--color-ink-muted);
  background: rgba(255, 255, 255, 0.5);
}

:root[data-theme="light"][data-appearance="classic"] .repo-tab-wrap:hover,
:root[data-theme="light"][data-appearance="classic"] .repo-tab.management:hover:not(:disabled),
:root[data-theme="light"][data-appearance="classic"] .repo-tab-add:hover:not(:disabled) {
  color: var(--color-ink);
  background: rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"][data-appearance="classic"] .repo-tab-wrap.active,
:root[data-theme="light"][data-appearance="classic"] .repo-tab.management.active {
  color: var(--color-ink);
  background: #ffffff;
  box-shadow: inset 0 -3px 0 var(--color-primary);
}

:root[data-theme="light"][data-appearance="classic"] .repo-tab-wrap.active .repo-tab span,
:root[data-theme="light"][data-appearance="classic"] .repo-tab.management.active span {
  color: var(--color-ink);
}

:root[data-theme="light"][data-appearance="classic"] .repo-toolbar {
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: none;
}

:root[data-theme="light"][data-appearance="classic"] .repo-action-group {
  border-color: var(--color-border);
  background: var(--color-surface-raised);
  box-shadow: none;
}

:root[data-theme="light"][data-appearance="classic"] .repo-action {
  color: var(--color-ink-muted);
}

:root[data-theme="light"][data-appearance="classic"] .repo-action:hover:not(:disabled),
:root[data-theme="light"][data-appearance="classic"] .repo-action.active {
  color: var(--color-ink);
  background: var(--color-surface-hover);
}

:root[data-theme="light"][data-appearance="classic"] .btn-primary {
  border-color: rgba(49, 95, 214, 0.72);
  color: #ffffff;
  background: linear-gradient(135deg, #315fd6 0%, #0f8fb5 100%);
  box-shadow: 0 10px 24px rgba(49, 95, 214, 0.18);
}

:root[data-theme="light"][data-appearance="classic"] .btn-secondary,
:root[data-theme="light"][data-appearance="classic"] .dialog-icon-button {
  border-color: rgba(15, 143, 181, 0.28);
  color: #0c6683;
  background: linear-gradient(180deg, rgba(15, 143, 181, 0.08), rgba(49, 95, 214, 0.06));
}

:root[data-theme="light"][data-appearance="classic"] .repo-management,
:root[data-theme="light"][data-appearance="classic"] .main-panel,
:root[data-theme="light"][data-appearance="classic"] .cred-card,
:root[data-theme="light"][data-appearance="classic"] .cred-body {
  background: var(--color-surface);
}

:root[data-theme="light"][data-appearance="classic"] .repo-section {
  background: rgba(255, 255, 255, 0.62);
}

:root[data-theme="light"][data-appearance="classic"] .repo-section > header,
:root[data-theme="light"][data-appearance="classic"] .repo-summary,
:root[data-theme="light"][data-appearance="classic"] .lane-header,
:root[data-theme="light"][data-appearance="classic"] .stash-toolbar,
:root[data-theme="light"][data-appearance="classic"] .dialog-footer,
:root[data-theme="light"][data-appearance="classic"] .cred-header {
  background: var(--color-surface-dim);
}

:root[data-theme="light"][data-appearance="classic"] .repo-empty {
  background: rgba(255, 255, 255, 0.48);
}

:root[data-theme="light"][data-appearance="classic"] .graph-list {
  background: rgba(248, 250, 253, 0.9);
}

:root[data-theme="light"][data-appearance="classic"] .commit-body,
:root[data-theme="light"][data-appearance="classic"] .commit-files,
:root[data-theme="light"][data-appearance="classic"] .commit-file-button {
  background: rgba(255, 255, 255, 0.72);
}

:root[data-appearance="custom"] .titlebar,
:root[data-appearance="custom"] .repo-tabbar,
:root[data-appearance="custom"] .repo-toolbar {
  border-color: var(--color-border);
  background: var(--color-surface-alt);
  box-shadow: none;
}

:root[data-appearance="custom"] .repo-tab-wrap,
:root[data-appearance="custom"] .repo-tab.management,
:root[data-appearance="custom"] .repo-tab-add,
:root[data-appearance="custom"] .repo-action-group,
:root[data-appearance="custom"] .btn-secondary,
:root[data-appearance="custom"] .dialog-icon-button {
  border-color: var(--color-border);
  color: var(--color-ink-muted);
  background: var(--color-surface-raised);
}

:root[data-appearance="custom"] .repo-tab-wrap.active,
:root[data-appearance="custom"] .repo-tab.management.active {
  color: var(--color-ink);
  background: var(--color-surface-raised);
  box-shadow: inset 0 -3px 0 var(--color-accent);
}

:root[data-appearance="custom"] .repo-tab-wrap.active .repo-tab span,
:root[data-appearance="custom"] .repo-tab.management.active span {
  color: var(--color-ink);
}

:root[data-appearance="custom"] .btn-primary {
  border-color: var(--color-accent);
  color: var(--color-surface-raised);
  background: var(--color-primary-dark);
  box-shadow: none;
}

:root[data-appearance="custom"] .repo-management,
:root[data-appearance="custom"] .main-panel,
:root[data-appearance="custom"] .repo-section,
:root[data-appearance="custom"] .repo-empty,
:root[data-appearance="custom"] .graph-list,
:root[data-appearance="custom"] .commit-body,
:root[data-appearance="custom"] .commit-files,
:root[data-appearance="custom"] .commit-file-button,
:root[data-appearance="custom"] .cred-card,
:root[data-appearance="custom"] .cred-body,
:root[data-appearance="custom"] .branch-filter-dialog,
:root[data-appearance="custom"] .status-panel-overlay-card {
  background: var(--color-surface);
}

:root[data-appearance="custom"] .repo-section > header,
:root[data-appearance="custom"] .repo-summary,
:root[data-appearance="custom"] .lane-header,
:root[data-appearance="custom"] .stash-toolbar,
:root[data-appearance="custom"] .dialog-footer,
:root[data-appearance="custom"] .cred-header,
:root[data-appearance="custom"] .graph-gutter {
  background: var(--color-surface-dim);
}

/* Branch visibility dialog ---------------------------------------------
   Local and remote branches share one visual and interaction language. */
.branch-filter-backdrop,
:root[data-theme="light"] .branch-filter-backdrop {
  padding: 24px;
  background: var(--app-dialog-backdrop);
  backdrop-filter: blur(5px);
}

.branch-filter-dialog,
:root[data-theme="light"] .branch-filter-dialog {
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 48px));
  border-color: var(--color-border);
  background: var(--app-dialog-bg);
  box-shadow: var(--app-dialog-shadow);
}

.branch-filter-dialog-head {
  min-height: 64px;
  padding: 12px 14px;
  border-bottom-color: var(--color-border);
  background: var(--app-dialog-chrome);
}

.branch-filter-dialog-head h3 {
  color: var(--color-ink);
  font-size: 15px;
}

.branch-filter-summary {
  min-height: 48px;
  padding: 8px 14px;
  border-bottom-color: var(--color-border);
  color: var(--color-ink-muted);
  background: var(--color-surface-dim);
}

.branch-filter-actions button {
  min-height: 28px;
  border-color: var(--color-border);
  color: var(--color-ink-muted);
  background: var(--color-surface-raised);
}

.branch-filter-actions button:hover:not(:disabled) {
  border-color: var(--color-border-input);
  color: var(--color-ink);
  background: var(--color-surface-hover);
}

.branch-filter-dialog-list {
  gap: 8px;
  padding: 10px;
  background: var(--color-surface-alt);
}

.branch-filter-group {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.branch-filter-group-toggle {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  color: var(--color-ink-muted);
  background: var(--color-surface-dim);
  text-align: left;
}

.branch-filter-group-toggle:hover:not(:disabled) {
  color: var(--color-ink);
  background: var(--color-surface-hover);
}

.branch-filter-group-toggle > svg {
  color: var(--color-accent);
}

.branch-filter-group-toggle > span {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.branch-filter-group-toggle > em {
  min-width: 34px;
  padding: 2px 5px;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-ink-faint);
  background: var(--color-surface-raised);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-align: center;
}

.branch-filter-group-list {
  display: grid;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid var(--color-border-subtle);
}

.branch-filter-option,
:root[data-theme="light"] .branch-filter-option,
:root[data-theme="light"] .branch-filter-option.remote {
  min-height: 34px;
  border-color: color-mix(in srgb, var(--color-accent) 32%, var(--color-border));
  color: var(--color-ink);
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-raised));
  opacity: 1;
}

.branch-filter-option:hover,
:root[data-theme="light"] .branch-filter-option:hover {
  border-color: color-mix(in srgb, var(--color-accent) 52%, var(--color-border));
  color: var(--color-ink);
  background: color-mix(in srgb, var(--color-accent) 13%, var(--color-surface-hover));
}

.branch-filter-option.muted,
:root[data-theme="light"] .branch-filter-option.muted {
  border-color: var(--color-border-subtle);
  color: var(--color-ink-faint);
  background: var(--color-surface-raised);
  opacity: 0.72;
}

.branch-filter-option input {
  accent-color: var(--color-accent);
}

@media (max-width: 560px) {
  .branch-filter-backdrop { padding: 8px; }
  .branch-filter-summary { align-items: stretch; flex-direction: column; }
  .branch-filter-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Authentication and token dialogs ------------------------------------
   Keep credentials, access tokens and API-key forms on the active theme
   instead of the legacy violet/black palette. */
.cred-card,
:root[data-theme="light"] .cred-card {
  border-color: var(--color-border-input);
  background: var(--app-dialog-bg);
  box-shadow: var(--app-dialog-shadow);
}

.cred-hero,
:root[data-theme="light"] .cred-hero {
  border-bottom-color: var(--color-border);
  background:
    radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--color-accent) 14%, transparent), transparent 44%),
    var(--app-dialog-chrome);
}

.cred-hero-icon,
:root[data-theme="light"] .cred-hero-icon {
  border-color: color-mix(in srgb, var(--color-accent) 42%, var(--color-border));
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface-raised));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

.cred-hero-label,
:root[data-theme="light"] .cred-hero-label {
  color: var(--color-accent);
}

.cred-hero-title,
:root[data-theme="light"] .cred-hero-title {
  color: var(--color-ink);
}

.cred-hero-copy,
:root[data-theme="light"] .cred-hero-copy {
  color: var(--color-ink-muted);
}

.cred-security-note,
:root[data-theme="light"] .cred-security-note {
  border-color: color-mix(in srgb, var(--color-accent) 32%, var(--color-border));
  color: var(--color-ink-muted);
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-raised));
}

.cred-security-note svg,
:root[data-theme="light"] .cred-security-note svg {
  color: var(--color-accent);
}

.cred-close,
:root[data-theme="light"] .cred-close {
  border-color: var(--color-border);
  color: var(--color-ink-faint);
  background: var(--color-surface-raised);
}

.cred-close:hover:not(:disabled),
:root[data-theme="light"] .cred-close:hover:not(:disabled) {
  border-color: var(--color-border-input);
  color: var(--color-ink);
  background: var(--color-surface-hover);
}

.cred-body,
:root[data-theme="light"] .cred-body {
  background: var(--app-dialog-bg);
}

.cred-segment,
:root[data-theme="light"] .cred-segment {
  border-color: var(--color-border);
  background: var(--color-surface-alt);
}

.cred-seg-btn,
:root[data-theme="light"] .cred-seg-btn {
  color: var(--color-ink-faint);
}

.cred-seg-btn:hover:not(.active),
:root[data-theme="light"] .cred-seg-btn:hover:not(.active) {
  color: var(--color-ink);
  background: var(--color-surface-hover);
}

.cred-seg-btn.active,
:root[data-theme="light"] .cred-seg-btn.active {
  border-color: color-mix(in srgb, var(--color-accent) 46%, var(--color-border));
  color: var(--color-ink);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface-raised));
  box-shadow: inset 0 -2px 0 var(--color-accent);
}

.cred-input input,
.cred-expiry input[type="date"],
:root[data-theme="light"] .cred-input input,
:root[data-theme="light"] .cred-expiry input[type="date"] {
  border-color: var(--color-border-input);
  color: var(--color-ink);
  background: var(--app-input-bg);
  color-scheme: var(--app-color-scheme);
}

.cred-input input::placeholder,
:root[data-theme="light"] .cred-input input::placeholder {
  color: var(--color-ink-faint);
  opacity: 0.72;
}

.cred-token-hint,
:root[data-theme="light"] .cred-token-hint {
  border-color: color-mix(in srgb, var(--color-accent) 34%, var(--color-border));
  color: var(--color-ink-muted);
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface-dim));
}

.cred-token-hint code,
:root[data-theme="light"] .cred-token-hint code {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-surface-raised));
}

.cred-footer {
  border-top-color: var(--color-border-subtle);
}

.cred-save input[type="checkbox"] {
  accent-color: var(--color-accent);
}

.cred-save span {
  color: var(--color-ink-muted);
}

.cred-cancel {
  border-color: var(--color-border);
  color: var(--color-ink-muted);
  background: var(--color-surface-raised);
}

.cred-submit {
  border-color: color-mix(in srgb, var(--color-accent) 62%, var(--color-border));
  color: var(--color-surface-solid);
  background: var(--color-primary-dark);
  box-shadow: none;
}

.cred-submit:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-surface-solid);
  background: var(--color-primary);
}

@media (max-width: 560px) {
  .cred-card { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .cred-hero { padding: 16px; }
  .cred-body { padding: 16px; }
  .cred-security-note { align-items: flex-start; border-radius: 8px; padding-block: 7px; }
  .cred-footer { align-items: stretch; flex-direction: column; }
  .cred-btns { display: grid; grid-template-columns: 1fr 1fr; }
}

/* Compact repository strip, matching the reference's IDE-style tab chrome. */
.repo-tabbar {
  display: flex;
  align-items: stretch;
  min-height: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  overflow: hidden;
}

.repo-tabs-scroll {
  flex: 0 1 auto;
  min-height: 35px;
  min-width: 0;
  border-left: 1px solid var(--color-border-subtle);
  scrollbar-width: none;
}

.repo-tabs-scroll::-webkit-scrollbar { display: none; }

.repo-tab-wrap {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 260px;
  min-height: 35px;
  border-right: 1px solid var(--color-border-subtle);
  border-radius: 0;
}

.repo-tab {
  min-height: 35px;
  height: 35px;
  padding: 0 34px 0 15px;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
}

.repo-tab.management {
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  height: 35px;
  min-height: 35px;
  padding: 0;
  justify-content: center;
  border: 0;
  box-shadow: none;
}

.repo-tab-wrap.active,
.repo-tab.management.active {
  box-shadow: none;
}

.repo-tab-close {
  position: absolute;
  top: 6px;
  right: 5px;
  width: 23px;
  min-width: 23px;
  max-width: 23px;
  height: 23px;
  min-height: 23px;
  max-height: 23px;
  margin: 0;
  border-radius: 3px;
  color: var(--color-ink-faint);
  background: transparent;
  box-shadow: none;
  opacity: 0.62;
  transition: opacity 120ms ease, color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.repo-tab-wrap.active .repo-tab-close { opacity: 0.72; }
.repo-tab-wrap:hover .repo-tab-close,
.repo-tab-wrap:focus-within .repo-tab-close { opacity: 1; }
.repo-tab-close:hover:not(:disabled),
.repo-tab-close:focus-visible:not(:disabled) {
  color: #ffffff;
  background: #d93641;
  box-shadow: inset 0 0 0 1px #f0646d;
}

:root[data-theme="light"] .repo-tab-close:hover:not(:disabled),
:root[data-theme="light"] .repo-tab-close:focus-visible:not(:disabled) {
  color: #ffffff;
  background: #c92f3a;
  box-shadow: inset 0 0 0 1px #a9212b;
}

.repo-tab-add {
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  height: 35px;
  min-height: 35px;
  border-left: 1px solid var(--color-border-subtle);
}

:root:not([data-theme="light"]) .repo-tabbar {
  border-bottom-color: #41454c;
  background: #2b2e34;
  box-shadow: inset 0 -1px 0 #23262b;
}

:root:not([data-theme="light"]) .repo-tabs-scroll {
  border-left-color: #454950;
}

:root:not([data-theme="light"]) .repo-tab-wrap,
:root:not([data-theme="light"]) .repo-tab.management,
:root:not([data-theme="light"]) .repo-tab-add {
  border-color: #454950;
  color: #9ca1a9;
  background: #2b2e34;
}

:root:not([data-theme="light"]) .repo-tab-wrap:hover,
:root:not([data-theme="light"]) .repo-tab.management:hover:not(:disabled),
:root:not([data-theme="light"]) .repo-tab-add:hover:not(:disabled) {
  color: #d7dae0;
  background: #32363d;
}

:root:not([data-theme="light"]) .repo-tab-wrap.active,
:root:not([data-theme="light"]) .repo-tab.management.active {
  color: #d7dae0;
  background: #30343a;
  box-shadow: inset 0 -1px 0 #30343a;
}

:root:not([data-theme="light"]) .repo-tab-wrap.active .repo-tab,
:root:not([data-theme="light"]) .repo-tab-wrap.active .repo-tab > svg,
:root:not([data-theme="light"]) .repo-tab.management.active > svg {
  color: #d7dae0;
}

/* Keep every dialog close action neutral until it is intentionally targeted. */
:root .dialog-close:hover:not(:disabled),
:root .dialog-close:focus-visible:not(:disabled),
:root .dialog-icon-button:hover:not(:disabled),
:root .dialog-icon-button:focus-visible:not(:disabled),
:root .cred-close:hover:not(:disabled),
:root .cred-close:focus-visible:not(:disabled) {
  color: #ffffff;
  border-color: #f0646d;
  background: #d93641;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .dialog-close:hover:not(:disabled),
:root[data-theme="light"] .dialog-close:focus-visible:not(:disabled),
:root[data-theme="light"] .dialog-icon-button:hover:not(:disabled),
:root[data-theme="light"] .dialog-icon-button:focus-visible:not(:disabled),
:root[data-theme="light"] .cred-close:hover:not(:disabled),
:root[data-theme="light"] .cred-close:focus-visible:not(:disabled) {
  color: #ffffff;
  border-color: #a9212b;
  background: #c92f3a;
}
