:root {
  color-scheme: dark;
  --bg: #101218;
  --sidebar: #13161e;
  --surface: #171b24;
  --surface-raised: #1d2230;
  --surface-soft: #202636;
  --surface-hover: #262d3d;
  --border: #2b3241;
  --border-strong: #3b4558;
  --text: #f0f1f5;
  --muted: #9aa2b7;
  --muted-dim: #687188;
  --violet: #a78bfa;
  --violet-strong: #8b5cf6;
  --cyan: #67e8f9;
  --green: #59d49a;
  --amber: #f6bd64;
  --red: #f5868c;
  --grid: rgba(141, 151, 178, 0.12);
  --sidebar-width: 232px;
  --header-height: 70px;
  --drawer-width: 430px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  --node-width: 244px;
  --node-height: 104px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

body {
  min-width: 300px;
}

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

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
}

:where(button, a, input, textarea, select, [tabindex="0"]):focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--violet);
  color: #191327;
  font-weight: 700;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background: var(--bg);
}

.app-shell[data-stage="loading"] .sidebar,
.app-shell[data-stage="loading"] .workspace {
  visibility: hidden;
}

.live-region {
  position: fixed;
  z-index: 120;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.sidebar {
  z-index: 8;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  padding: 26px 16px 16px;
  border-right: 1px solid rgba(78, 87, 109, 0.28);
  background: linear-gradient(180deg, rgba(23, 27, 36, 0.72), rgba(15, 18, 25, 0.96));
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark,
.status-logo {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(183, 160, 255, 0.48);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.26), rgba(98, 88, 159, 0.12));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 5px 18px rgba(113, 87, 221, 0.15);
  color: #d8ccff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.12;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  margin-top: 3px;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-badge,
.version-badge,
.ai-lock,
.cap-label {
  border: 1px solid rgba(167, 139, 250, 0.26);
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.09);
  color: var(--violet);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.mode-badge {
  margin-left: auto;
  padding: 5px 7px;
}

.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 26px 3px 13px;
}

.eyebrow {
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.version-badge {
  padding: 4px 7px;
  border-color: rgba(109, 122, 149, 0.36);
  background: rgba(109, 122, 149, 0.09);
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: none;
}

.new-group-button,
.sync-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -0.005em;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.new-group-button {
  width: 100%;
  padding: 0 11px;
  background: var(--violet-strong);
  box-shadow: 0 8px 24px rgba(109, 68, 215, 0.18);
  color: #f8f5ff;
}

.new-group-button:hover,
.sync-button:hover,
.button.primary:hover {
  background: #9a73f7;
}

.new-group-button:active,
.sync-button:active,
.button:active {
  transform: translateY(1px);
}

.shortcut-hint {
  margin-left: auto;
  color: rgba(247, 244, 255, 0.6);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.sidebar-heading,
.mobile-list-heading,
.section-heading,
.drawer-header,
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-heading {
  margin: 27px 4px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.count-label,
.repo-count {
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
}

.group-nav {
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.group-list,
.mobile-repo-list {
  display: grid;
  gap: 3px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.group-list-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 8px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}

.group-list-item:hover,
.group-list-item:focus-visible,
.group-list-item.selected {
  background: rgba(111, 121, 149, 0.13);
  color: var(--text);
}

.group-list-item.selected {
  box-shadow: inset 2px 0 0 var(--group-color, var(--violet));
}

.group-list-item .group-color-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--group-color, var(--violet));
  box-shadow: 0 0 10px color-mix(in srgb, var(--group-color, var(--violet)) 42%, transparent);
}

.group-list-item .group-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-list-item .group-count {
  min-width: 21px;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  text-align: right;
}

.sidebar-bottom {
  display: grid;
  gap: 16px;
  margin-top: auto;
  padding-top: 16px;
}

.sync-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 9px;
  border-top: 1px solid rgba(76, 87, 111, 0.24);
  color: var(--muted);
}

.status-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(89, 212, 154, 0.1), 0 0 12px rgba(89, 212, 154, 0.42);
}

.sync-summary[data-status="running"] .status-dot,
.canvas-status[data-status="running"] .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(246, 189, 100, 0.1), 0 0 12px rgba(246, 189, 100, 0.38);
  animation: pulse 1.15s ease-in-out infinite;
}

.sync-summary[data-status="failed"] .status-dot,
.canvas-status[data-status="error"] .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(245, 134, 140, 0.1), 0 0 12px rgba(245, 134, 140, 0.34);
}

.sync-label,
.sync-time {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-label {
  max-width: 166px;
  font-size: 11px;
  font-weight: 600;
}

.sync-time {
  margin-top: 2px;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(77, 88, 111, 0.24);
  border-radius: 10px;
  background: rgba(26, 31, 43, 0.56);
}

.avatar,
.repo-symbol {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(103, 232, 249, 0.36);
  border-radius: 7px;
  background: rgba(103, 232, 249, 0.08);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
}

.user-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.user-copy strong,
.user-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  color: var(--text);
  font-size: 11px;
}

.user-copy span {
  margin-top: 2px;
  color: var(--muted-dim);
  font-size: 9px;
}

.workspace {
  position: relative;
  display: grid;
  min-width: 0;
  height: 100%;
  grid-template-rows: var(--header-height) minmax(0, 1fr);
  background: var(--bg);
}

.topbar {
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 0 26px;
  border-bottom: 1px solid rgba(76, 87, 111, 0.25);
  background: rgba(16, 18, 24, 0.89);
  backdrop-filter: blur(18px);
}

.topbar-title {
  min-width: 0;
}

.breadcrumb-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.title-line h1 {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-width: 0;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(350px, 35vw);
  min-width: 190px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(26, 30, 41, 0.72);
  color: var(--muted-dim);
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.search-form:focus-within {
  border-color: rgba(167, 139, 250, 0.72);
  background: rgba(30, 34, 47, 0.9);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.11);
}

.search-form input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.search-form input::placeholder {
  color: var(--muted-dim);
  opacity: 1;
}

.search-key {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.search-clear {
  width: 22px !important;
  height: 22px !important;
}

.sync-button {
  flex: 0 0 auto;
  padding: 0 12px;
  border-color: var(--border);
  background: rgba(32, 38, 54, 0.68);
  color: var(--text);
}

.sync-button[data-running="true"] .icon-slot {
  animation: spin 900ms linear infinite;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.icon-button.subtle {
  color: var(--muted-dim);
}

.menu-button {
  display: none;
}

.icon-slot {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 16px;
  height: 16px;
}

.icon-slot svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.canvas-region {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.canvas-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: #101218;
  background-image: radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 1.5px);
  background-size: 32px 32px;
  cursor: grab;
  touch-action: none;
}

.canvas-viewport:active {
  cursor: grabbing;
}

.canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 4800px;
  height: 3600px;
  transform-origin: 0 0;
  will-change: transform;
}

.groups-layer,
.repos-layer {
  position: absolute;
  inset: 0;
}

.groups-layer {
  z-index: 1;
}

.repos-layer {
  z-index: 2;
  pointer-events: none;
}

.group-bubble {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 260px;
  min-height: 200px;
  border: 1px solid color-mix(in srgb, var(--group-color, var(--violet)) 65%, #4d5569);
  border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--group-color, var(--violet)) 7%, transparent), rgba(22, 26, 36, 0.35));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02), 0 14px 40px rgba(0, 0, 0, 0.09);
  pointer-events: auto;
  user-select: none;
}

.group-bubble[data-system="true"] {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--group-color, #64748b) 52%, #454e63);
  background: rgba(26, 30, 39, 0.22);
}

.group-bubble.is-drop-target {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(103, 232, 249, 0.18), inset 0 0 36px rgba(103, 232, 249, 0.06);
}

.group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 13px 0 15px;
  border-bottom: 1px solid color-mix(in srgb, var(--group-color, var(--violet)) 18%, var(--border));
  border-radius: 20px 20px 0 0;
  color: var(--muted);
  cursor: grab;
}

.group-head:active {
  cursor: grabbing;
}

.group-head .group-color-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--group-color, var(--violet));
  box-shadow: 0 0 13px color-mix(in srgb, var(--group-color, var(--violet)) 58%, transparent);
}

.group-head h2 {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count {
  flex: 0 0 auto;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.group-edit {
  width: 25px;
  height: 25px;
}

.group-edit .icon-slot {
  width: 13px;
  height: 13px;
}

.group-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.group-note {
  position: absolute;
  bottom: 12px;
  left: 15px;
  color: var(--muted-dim);
  font-size: 10px;
  opacity: 0.9;
}

.resize-handle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-dim);
  cursor: nwse-resize;
  opacity: 0.75;
}

.resize-handle:hover,
.resize-handle:focus-visible {
  background: rgba(154, 164, 188, 0.12);
  color: var(--text);
}

.resize-handle::before,
.resize-handle::after {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 1px;
  background: currentColor;
  content: "";
  transform: rotate(-45deg);
  transform-origin: right center;
}

.resize-handle::after {
  right: 3px;
  bottom: 8px;
  width: 5px;
}

.repo-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  width: var(--node-width);
  height: var(--node-height);
  padding: 12px 12px 10px;
  overflow: hidden;
  border: 1px solid rgba(71, 82, 105, 0.84);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(29, 34, 47, 0.96), rgba(22, 26, 36, 0.96));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  color: var(--text);
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.repo-node:hover,
.repo-node:focus-visible,
.repo-node.selected {
  border-color: rgba(167, 139, 250, 0.82);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22), 0 0 0 2px rgba(139, 92, 246, 0.12);
}

.repo-node:active {
  cursor: grabbing;
}

.repo-node.is-search-match {
  border-color: rgba(103, 232, 249, 0.84);
  box-shadow: 0 0 0 2px rgba(103, 232, 249, 0.16), 0 16px 32px rgba(0, 0, 0, 0.24);
}

.repo-topline,
.repo-footer {
  display: flex;
  align-items: center;
  min-width: 0;
}

.repo-topline {
  gap: 9px;
}

.repo-symbol {
  width: 26px;
  height: 26px;
  border-color: rgba(167, 139, 250, 0.34);
  border-radius: 7px;
  background: rgba(167, 139, 250, 0.09);
  color: var(--violet);
}

.repo-symbol.large {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 15px;
}

.repo-name-block {
  min-width: 0;
  flex: 1 1 auto;
}

.repo-name,
.repo-full-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repo-name {
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.repo-full-name {
  margin-top: 2px;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
}

.repo-description {
  display: -webkit-box;
  min-height: 30px;
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.repo-footer {
  gap: 6px;
  margin-top: auto;
  color: var(--muted-dim);
  font-size: 9px;
}

.repo-footer .status-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.repo-footer .status-dot.unavailable {
  background: var(--amber);
}

.repo-footer .status-dot.stale {
  background: var(--violet);
}

.repo-footer span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-toolbar {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 19px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(73, 84, 108, 0.44);
  border-radius: 10px;
  background: rgba(23, 27, 36, 0.86);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
}

.canvas-toolbar .icon-button {
  width: 27px;
  height: 27px;
}

.canvas-toolbar .icon-button .icon-slot {
  width: 14px;
  height: 14px;
}

.zoom-readout {
  min-width: 45px;
  height: 27px;
  padding: 0 4px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.zoom-readout:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.toolbar-divider {
  width: 1px;
  height: 16px;
  margin: 0 3px;
  background: var(--border);
}

.canvas-status {
  position: absolute;
  z-index: 4;
  right: 20px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(77, 88, 111, 0.34);
  border-radius: 999px;
  background: rgba(23, 27, 36, 0.82);
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.canvas-status .status-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.canvas-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  width: min(340px, calc(100% - 32px));
  padding: 32px 24px;
  border: 1px dashed rgba(83, 95, 121, 0.56);
  border-radius: 18px;
  background: rgba(22, 26, 36, 0.62);
  text-align: center;
  transform: translate(-50%, -50%);
}

.empty-glyph {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  border: 1px solid rgba(167, 139, 250, 0.34);
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--violet);
}

.canvas-empty h2,
.status-panel h2,
.mobile-list-heading h2,
.drawer-header h2,
.dialog-header h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.canvas-empty p,
.status-panel p,
.section-copy {
  max-width: 290px;
  margin: 8px 0 19px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.button {
  min-height: 34px;
  padding: 0 12px;
}

.button.primary {
  background: var(--violet-strong);
  color: #f8f5ff;
}

.button.quiet {
  border-color: var(--border);
  background: rgba(32, 38, 54, 0.64);
  color: var(--muted);
}

.button.quiet:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.button.danger {
  color: var(--red);
}

.button.danger:hover {
  border-color: rgba(245, 134, 140, 0.4);
  background: rgba(245, 134, 140, 0.08);
}

.mobile-list {
  display: none;
}

.detail-drawer {
  position: absolute;
  z-index: 15;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(var(--drawer-width), 100%);
  height: 100%;
  border-left: 1px solid var(--border-strong);
  background: rgba(20, 24, 33, 0.98);
  box-shadow: var(--shadow);
  transform: translateX(105%);
  transition: transform 220ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  flex: 0 0 auto;
  min-height: 77px;
  padding: 0 21px;
  border-bottom: 1px solid rgba(76, 87, 111, 0.28);
}

.drawer-header h2 {
  margin-top: 4px;
}

.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 21px 32px;
  overflow: auto;
  scrollbar-color: var(--border) transparent;
  scrollbar-width: thin;
}

.drawer-repo-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.drawer-repo-heading h3 {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-full-name {
  display: block;
  max-width: 270px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-dim);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 12px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(78, 90, 113, 0.47);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.meta-chip[data-tone="accent"] {
  border-color: rgba(167, 139, 250, 0.35);
  color: var(--violet);
}

.meta-chip[data-tone="warning"] {
  border-color: rgba(246, 189, 100, 0.33);
  color: var(--amber);
}

.github-link {
  display: flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 22px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.github-link:hover {
  color: #b4f3ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.github-link .icon-slot {
  width: 14px;
  height: 14px;
}

.github-link .arrow-icon {
  width: 12px;
  height: 12px;
  margin-left: 2px;
}

.repo-form,
.ai-section {
  padding-top: 20px;
  border-top: 1px solid rgba(76, 87, 111, 0.28);
}

.field-group {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field-group label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: rgba(14, 17, 24, 0.68);
  color: var(--text);
  font-size: 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field-group textarea {
  min-height: 108px;
  resize: vertical;
}

.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus {
  border-color: rgba(167, 139, 250, 0.72);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.11);
}

.field-group input::placeholder,
.field-group textarea::placeholder {
  color: var(--muted-dim);
}

.field-hint {
  color: var(--muted-dim);
  font-size: 10px;
  line-height: 1.35;
}

.repo-ai-state {
    margin: 4px 0 12px;
    padding: 9px 10px;
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 8px;
    background: rgba(139, 92, 246, 0.07);
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.drawer-actions,
.ai-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-actions {
  margin: 18px 0 23px;
}

.drawer-actions .primary {
  flex: 1 1 auto;
}

.ai-section {
  margin-top: 5px;
}

.section-heading {
  gap: 14px;
}

.section-heading h3 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.ai-lock,
.cap-label {
  flex: 0 0 auto;
  padding: 5px 7px;
  border-color: rgba(88, 99, 123, 0.38);
  background: rgba(85, 97, 123, 0.08);
  color: var(--muted-dim);
  font-size: 8px;
}

.section-copy {
  margin: 8px 0 13px;
  font-size: 11px;
}

.ai-actions .button {
  flex: 1 1 auto;
}

.full-width {
  width: 100%;
}

.code-result {
  margin-top: 11px;
  padding: 11px;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 8px;
  background: rgba(103, 232, 249, 0.05);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.status-screen {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 18, 24, 0.97);
}

.status-panel {
  display: grid;
  justify-items: center;
  width: min(420px, 100%);
  padding: 34px 28px;
  border: 1px solid rgba(76, 88, 113, 0.42);
  border-radius: 18px;
  background: rgba(23, 27, 36, 0.86);
  box-shadow: var(--shadow);
  text-align: center;
}

.status-logo {
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border-radius: 13px;
  font-size: 21px;
}

.status-panel h2 {
  margin-top: 11px;
  font-size: 21px;
}

.status-panel p {
  max-width: 310px;
  margin-bottom: 20px;
}

.status-progress {
  width: min(220px, 100%);
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--border);
}

.status-progress span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: var(--violet);
  animation: loading-bar 1.2s ease-in-out infinite;
}

.status-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.toast-stack {
  position: fixed;
  z-index: 110;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid rgba(82, 94, 119, 0.55);
  border-radius: 10px;
  background: rgba(27, 32, 44, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.42;
  pointer-events: auto;
  animation: toast-in 180ms ease both;
}

.toast[data-tone="error"] {
  border-color: rgba(245, 134, 140, 0.38);
}

.toast[data-tone="success"] {
  border-color: rgba(89, 212, 154, 0.34);
}

.toast-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(167, 139, 250, 0.13);
  color: var(--violet);
  font-size: 11px;
  font-weight: 800;
}

.tooltip {
  position: fixed;
  z-index: 200;
  max-width: 230px;
  padding: 6px 8px;
  border: 1px solid rgba(93, 105, 131, 0.6);
  border-radius: 6px;
  background: #222838;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.26);
  color: var(--text);
  font-size: 10px;
  line-height: 1.35;
  pointer-events: auto;
}

.group-dialog {
  width: min(390px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
}

.group-dialog::backdrop {
  background: rgba(7, 9, 13, 0.72);
  backdrop-filter: blur(5px);
}

.group-dialog form {
  padding: 21px;
}

.dialog-header {
  margin-bottom: 23px;
}

.dialog-header h2 {
  margin-top: 4px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  margin-top: 26px;
}

.dialog-actions .danger {
  justify-self: start;
}

.color-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-control input[type="color"] {
  width: 38px;
  height: 32px;
  padding: 2px;
  cursor: pointer;
}

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

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

@keyframes loading-bar {
  0% { transform: translateX(-120%); }
  50% { transform: translateX(150%); }
  100% { transform: translateX(350%); }
}

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

@media (max-width: 900px) {
  :root {
    --sidebar-width: 204px;
  }

  .topbar {
    padding: 0 18px;
  }

  .search-form {
    width: min(300px, 31vw);
  }

  .sync-button span:not(.icon-slot) {
    display: none;
  }

  .sync-button {
    width: 36px;
    padding: 0;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 62px;
  }

  html,
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(286px, calc(100vw - 48px));
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.sidebar-open::after {
    position: fixed;
    z-index: 20;
    inset: 0;
    background: rgba(7, 9, 13, 0.68);
    content: "";
  }

  .workspace {
    display: block;
    height: auto;
    min-height: 100svh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    min-height: var(--header-height);
    padding: 0 13px;
  }

  .topbar-title {
    flex: 1 1 auto;
  }

  .topbar-actions {
    gap: 5px;
  }

  .search-form {
    width: min(45vw, 230px);
    min-width: 0;
  }

  .search-key {
    display: none;
  }

  .menu-button {
    display: inline-grid;
  }

  .canvas-region {
    min-height: calc(100svh - var(--header-height));
  }

  .canvas-viewport,
  .canvas-toolbar,
  .canvas-status {
    display: none;
  }

  .mobile-list {
    display: block;
    padding: 20px 14px 36px;
  }

  .mobile-list-heading {
    align-items: flex-end;
    margin-bottom: 15px;
  }

  .mobile-list-heading h2 {
    margin-top: 4px;
    font-size: 19px;
  }

  .mobile-repo-list {
    gap: 8px;
  }

  .mobile-repo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 68px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(26, 31, 43, 0.76);
    text-align: left;
  }

  .mobile-repo-item:hover,
  .mobile-repo-item:focus-visible {
    border-color: var(--border-strong);
    background: var(--surface-hover);
  }

  .mobile-repo-copy {
    min-width: 0;
    flex: 1 1 auto;
  }

  .mobile-repo-copy strong,
  .mobile-repo-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-repo-copy strong {
    font-size: 12px;
  }

  .mobile-repo-copy span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
  }

  .mobile-repo-group {
    flex: 0 0 auto;
    color: var(--muted-dim);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 9px;
  }

  .detail-drawer {
    position: fixed;
    width: 100%;
    border-left: 0;
  }

  .drawer-body {
    padding-right: 18px;
    padding-left: 18px;
  }
}

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

@media (prefers-contrast: more) {
  :root {
    --muted: #bdc4d4;
    --muted-dim: #929bb0;
    --border: #4a566e;
  }
}
