@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-muted: #f3f4f6;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --text: #111827;
  --text-secondary: #334155;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-fg: #ffffff;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --radius: 6px;
  --radius-lg: 10px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --topbar-h: 57px;
}

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

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

/* ---- Hidden utility ---- */
.hidden { display: none !important; }

/* ========== TOPBAR ========== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.topbar-page-title {
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* ========== SEARCH ========== */

.topbar-search {
  height: 34px;
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0.75rem;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-subtle);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.topbar-search::placeholder {
  color: var(--text-subtle);
}

.topbar-search:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ========== BUTTONS ========== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 34px;
  padding: 0 0.875rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, box-shadow 120ms;
  white-space: nowrap;
  text-decoration: none;
  background: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

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

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-dark);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

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

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-dark);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.btn-logout {
  color: var(--danger);
  background: transparent;
  border-color: #fca5a5;
}

.btn-logout:hover:not(:disabled) {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fca5a5;
}

button:disabled,
input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== LOGIN VIEW ========== */

#login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.05);
}

.login-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.login-card h2 {
  margin: 0 0 0.5rem;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.login-card p {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 14px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-family: 'Google Sans', 'Roboto', var(--font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.25px;
  cursor: pointer;
  transition: background 120ms, box-shadow 120ms;
}

.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.15);
}

.btn-google:active {
  background: #f1f3f4;
}

/* ========== APP VIEW ========== */

#app-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.page-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ========== USER CHIP ========== */

.user-chip {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== FEEDBACK BANNER ========== */

.feedback-banner {
  margin: 0.75rem 1.5rem;
  padding: 0.6rem 0.875rem;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
}

.feedback-banner.success {
  background: var(--success-bg);
  color: #14532d;
  border-color: var(--success-border);
}

.feedback-banner.error {
  background: var(--danger-bg);
  color: #7f1d1d;
  border-color: #fecaca;
}

.feedback-banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

/* ========== TAB ROW ========== */

.tab-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  background: #fff;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 0.25rem;
  margin-right: 1.25rem;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 120ms, border-color 120ms;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text);
}

.tab-active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* ========== FILTER TOOLBAR ========== */

.filter-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-field span,
.selection-summary-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-field select {
  height: 34px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 0 0.75rem;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  outline: none;
  min-width: 200px;
  transition: border-color 120ms;
}

.filter-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.toggle-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  height: 34px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.toggle-field input {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
  margin: 0;
}

/* ========== SELECTION SUMMARY ========== */

.selection-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.625rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(37, 99, 235, 0.03);
  font-size: 13px;
}

.selection-summary strong {
  display: block;
  margin-top: 0.1rem;
  font-size: 13px;
  color: var(--text);
}

.selection-summary p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ========== TABLE TOOLBAR ========== */

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
}

.select-all input {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--primary);
  margin: 0;
}

.table-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== ITEM CARDS ========== */

.table-wrapper {
  display: flex;
  flex-direction: column;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.item-card {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.95rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  transition: background 120ms, border-color 120ms, box-shadow 120ms;
}

.item-card.workflow {
  border-left-color: var(--info);
}

.item-card.secret {
  border-left-color: #7c3aed;
}

.item-card:hover {
  background: #fbfdff;
  border-color: var(--border-dark);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.item-card.selected {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.item-card.blocked {
  background: rgba(253, 186, 116, 0.08);
}

.item-card.blocked:hover {
  background: rgba(253, 186, 116, 0.14);
}

.item-card-loading {
  display: block;
}

.item-card-check {
  display: flex;
  justify-content: center;
  align-items: center;
}

.item-card-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.item-card-main {
  min-width: 0;
  display: grid;
  gap: 0.75rem;
}

.item-card-summary {
  display: grid;
  gap: 0.75rem;
  cursor: pointer;
  border-radius: 10px;
  outline: none;
}

.item-card-summary:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.item-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.item-card-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.item-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.item-card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.item-card-actions .status-cell {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.item-card-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.item-card-footer {
  display: flex;
  gap: 1rem;
  align-items: start;
}

.item-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.btn-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-link:hover:not(:disabled) {
  text-decoration: underline;
}

.commit-cell {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.commit-author {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.commit-date {
  font-size: 12px;
  color: var(--text-muted);
}

.commit-date::before {
  content: "·";
  margin-right: 0.5rem;
  color: var(--text-muted);
}

/* ========== BADGES ========== */

.type-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.type-badge.workflow {
  background: var(--info-bg);
  color: var(--info);
}

.type-badge.secret {
  background: #f5f3ff;
  color: #7c3aed;
}

.status-badge.modified {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-badge.new {
  background: var(--info-bg);
  color: var(--info);
}

.status-badge.synced {
  background: var(--success-bg);
  color: var(--success);
}

.status-badge.promote_pending {
  background: #fff7ed;
  color: #c2410c;
}

.status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.status-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.status-link {
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.status-link:hover {
  text-decoration: underline;
}

.status-help {
  font-size: 12px;
  color: var(--danger);
  line-height: 1.45;
}

.muted-text {
  color: var(--text-muted);
  font-size: 13px;
  padding: 1rem;
}

/* ========== EMPTY STATE ========== */

.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state strong {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}

/* ========== ACTION BAR (fixed bottom) ========== */

.action-bar {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 3rem));
  display: grid;
  grid-template-columns: 1fr minmax(200px, 0.7fr) auto;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
}

.action-summary span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.action-summary p {
  margin: 0.15rem 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.release-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.release-field span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.release-field input {
  height: 34px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 0 0.75rem;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-subtle);
  outline: none;
  transition: border-color 120ms;
}

.release-field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.action-bar .btn-primary {
  height: 40px;
  padding: 0 1.25rem;
  font-size: 14px;
  font-weight: 600;
}

/* ========== MODAL ========== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-card {
  position: relative;
  width: min(520px, calc(100% - 2rem));
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.modal-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.modal-card h3 {
  margin: 0 0 1rem;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.processing-modal {
  width: min(440px, calc(100% - 2rem));
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.35rem;
}

.processing-spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  margin-bottom: 0.25rem;
}

.processing-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.confirm-items {
  padding-left: 1.25rem;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.35rem;
}

.confirm-items li {
  font-size: 13px;
  color: var(--text-muted);
}

.confirm-release {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.15);
  margin-bottom: 0.875rem;
}

.confirm-release span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.confirm-release strong {
  font-size: 14px;
  color: var(--text);
}

.confirm-description-field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.875rem;
}

.confirm-description-field span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.confirm-description-field textarea {
  width: 100%;
  resize: vertical;
  min-height: 10rem;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 0.75rem;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  outline: none;
  transition: border-color 120ms;
}

.confirm-description-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.confirm-error {
  font-size: 13px;
  color: #7f1d1d;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
  margin-bottom: 0.875rem;
}

.confirm-success {
  display: grid;
  gap: 0.5rem;
  padding: 0.875rem;
  border-radius: var(--radius);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  margin-bottom: 0.875rem;
}

.confirm-success strong {
  font-size: 14px;
  font-weight: 600;
  color: #14532d;
}

.confirm-success p {
  margin: 0;
  font-size: 13px;
  color: #166534;
  line-height: 1.55;
}

.success-link {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.success-link:hover {
  text-decoration: underline;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

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

.diff-inline-row {
  margin-top: 0.1rem;
}

.diff-inline-panel {
  border: 1px solid #d6deea;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 14px 34px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.diff-inline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.875rem;
  border-bottom: 1px solid rgba(214, 222, 234, 0.9);
  background: linear-gradient(180deg, rgba(75, 121, 183, 0.96) 0%, rgba(247, 250, 255, 0.92) 100%);
}

.diff-inline-heading {
  min-width: 0;
  display: grid;
  gap: 0.45rem;
}

.diff-inline-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.diff-inline-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  word-break: break-all;
}

.diff-inline-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.diff-inline-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

.diff-view-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem;
  border: 1px solid rgba(214, 222, 234, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.diff-view-button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.diff-view-button:hover:not(:disabled) {
  color: var(--text);
}

.diff-view-button.is-active {
  background: #ffffff;
  color: #1e3a5f;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.diff-inline-close {
  flex-shrink: 0;
}

.diff-inline-blocking {
  margin: 1rem 1rem 0;
  font-size: 13px;
  color: #7f1d1d;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 0.75rem 0.875rem;
}

.diff-inline-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 13px;
}

.diff-inline-empty strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.diff-split-wrapper {
  overflow: auto;
  padding: 0.9rem;
  background: linear-gradient(180deg, rgba(236, 242, 249, 0.9) 0%, rgba(75, 121, 183, 0.96) 100%);
}

.diff-split-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12px;
  border: 1px solid #d6deea;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.diff-split-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.75rem;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: #edf3fb;
  border-bottom: 1px solid #d6deea;
}

.diff-column-title {
  display: inline-block;
  color: #334155;
}

.diff-line-number-col {
  width: 60px;
  text-align: right !important;
}

.diff-branch-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.5rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.diff-branch-pill-main {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.diff-branch-pill-dev {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.diff-split-row td {
  padding: 0;
  border-bottom: 1px solid rgba(214, 222, 234, 0.85);
  vertical-align: top;
}

.diff-split-row.hunk td {
  padding: 0.55rem 0.75rem;
  background: #dbeafe;
  color: #1d4ed8;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
}

.diff-line-number {
  width: 60px;
  padding: 0.45rem 0.5rem;
  text-align: right;
  color: var(--text-subtle);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  user-select: none;
}

.diff-side {
  padding: 0.45rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  line-height: 1.5;
}

.diff-split-row.context .diff-line-number,
.diff-split-row.context .diff-side {
  background: #f8fafc;
}

.diff-split-row.remove td {
  background: #ffe4e6;
}

.diff-split-row.add td {
  background: #dcfce7;
}

.diff-split-row.changed td:nth-child(-n + 2) {
  background: #ffe4e6;
}

.diff-split-row.changed td:nth-child(n + 3) {
  background: #dcfce7;
}

.diff-split-row.remove .diff-line-number,
.diff-split-row.remove .diff-side {
  background: #ffe4e6;
}

.diff-split-row.add .diff-line-number,
.diff-split-row.add .diff-side {
  background: #dcfce7;
}

.diff-split-row.changed .diff-side.left {
  background: #ffe4e6;
}

.diff-split-row.changed .diff-side.right {
  background: #dcfce7;
}

.diff-split-row.remove .diff-side.left,
.diff-split-row.changed .diff-side.left {
  color: #9f1239;
}

.diff-split-row.add .diff-side.right,
.diff-split-row.changed .diff-side.right {
  color: #166534;
}

.diff-split-row.remove td:first-child,
.diff-split-row.remove td:nth-child(2) {
  box-shadow: inset 3px 0 0 #e11d48;
}

.diff-split-row.add td:nth-child(3),
.diff-split-row.add td:nth-child(4) {
  box-shadow: inset 3px 0 0 #16a34a;
}

.diff-split-row.changed td:first-child,
.diff-split-row.changed td:nth-child(2) {
  box-shadow: inset 3px 0 0 #e11d48;
}

.diff-split-row.changed td:nth-child(3),
.diff-split-row.changed td:nth-child(4) {
  box-shadow: inset 3px 0 0 #16a34a;
}

.diff-split-row.remove .diff-line-number,
.diff-split-row.changed td:nth-child(1),
.diff-split-row.changed td:nth-child(3),
.diff-split-row.add .diff-line-number {
  font-weight: 600;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
  .topbar {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  .topbar-page-title {
    display: none;
  }

  .topbar-search {
    min-width: 140px;
  }

  .user-chip {
    display: none;
  }

  .filter-toolbar {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
  }

  .filter-field select {
    min-width: 160px;
  }

  .selection-summary {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.625rem 1rem;
  }

  .tab-row {
    padding: 0 1rem;
  }

  .table-toolbar,
  .filter-toolbar {
    padding: 0.625rem 1rem;
  }

  .feedback-banner {
    margin: 0.5rem 1rem;
  }

  .action-bar {
    grid-template-columns: 1fr;
    bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    left: 0;
    transform: none;
  }

  .diff-inline-header {
    flex-direction: column;
  }

  .diff-inline-actions {
    width: 100%;
    justify-content: space-between;
  }

  .item-card {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .item-card-check {
    justify-content: flex-start;
    padding-top: 0;
  }

  .item-card-footer {
    flex-direction: column;
  }

  .diff-split-table {
    min-width: 720px;
  }
}

@media (max-width: 560px) {
  .item-card {
    padding: 0.9rem;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}
