:root {
  color-scheme: dark;

  /* Brand blue scale */
  --brand-0: #eff6ff;
  --brand-1: #dbeafe;
  --brand-2: #bfdbfe;
  --brand-3: #93c5fd;
  --brand-4: #60a5fa;
  --brand-5: #3b82f6;
  --brand-6: #2563eb;
  --brand-7: #1d4ed8;
  --brand-8: #1e40af;
  --brand-9: #1e3a8a;

  /* Accent green scale */
  --accent-0: #e7f9ed;
  --accent-1: #d2f2de;
  --accent-2: #a7e6bf;
  --accent-3: #79d99f;
  --accent-4: #51cd85;
  --accent-5: #22B34A;
  --accent-6: #1ea342;
  --accent-7: #198b37;
  --accent-8: #15752e;
  --accent-9: #0c4f1e;

  /* Surfaces */
  --bg: #2C292A;
  --bg-secondary: #353233;
  --panel: rgba(53, 50, 51, 0.9);
  --panel-solid: #353233;

  /* Text */
  --ink: #F5F5F5;
  --ink-secondary: rgba(255, 255, 255, 0.72);
  --muted: rgba(255, 255, 255, 0.50);

  /* Accent shortcuts */
  --accent: #22B34A;
  --accent-glow: rgba(34, 179, 74, 0.4);
  --accent-hover: #1ea342;

  /* Status */
  --success: #22B34A;
  --warning: #F97316;
  --error: #dc2626;

  /* Borders */
  --border: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(34, 179, 74, 0.5);

  /* Shadows */
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(34, 179, 74, 0.15);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #22B34A 0%, #51cd85 100%);
  --gradient-dark: linear-gradient(180deg, #1F1D1E 0%, #2C292A 100%);

  /* Header geometry */
  --header-h: 52px;
  --header-btn-w: 180px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Splash Screen
   ============================================================ */
.splash {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.splash.hidden {
  display: none;
}

.splash-card {
  text-align: center;
  padding: 48px;
  background: var(--panel-solid);
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  max-width: 560px;
  width: 90%;
}

.splash-logos {
  margin-bottom: 20px;
}

.splash-logo {
  height: 48px;
}

.splash-card h1 {
  margin: 0 0 12px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.splash-card p {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 15px;
}

.splash-input {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.splash-input input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  transition: all 0.2s ease;
}

.splash-input input::placeholder {
  color: var(--muted);
}

.splash-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.splash-input button {
  padding: 14px 24px;
  font-size: 15px;
}

.splash-footer {
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* ============================================================
   Main App Container
   ============================================================ */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ============================================================
   Floating Header Bars  (matches INSTANT_MAPPER Header.css)
   ============================================================ */
.overlayRow {
  position: fixed;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
  background: var(--bg);
  color: #ffffff;
  border-radius: 12px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.overlayRow--right {
  left: auto;
  right: 8px;
}

/* Logo tile */
.tile {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--header-h);
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
}

.tile img {
  display: block;
  height: calc(var(--header-h) - 8px);
  width: auto;
  margin: 2px 0;
}

.tile-label {
  font-weight: 700;
  font-size: 17px;
  color: #ffffff;
  white-space: nowrap;
  padding: 0 8px;
}

/* Nav button group */
.navGroup {
  display: inline-flex;
  gap: 4px;
}

/* Two-line header nav button */
.headerNavBtn {
  pointer-events: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  height: var(--header-h);
  padding: 0 10px;
  gap: 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  line-height: 1.15;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
  width: var(--header-btn-w);
  font-family: inherit;
  color: #ffffff;
}

.headerNavBtn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.headerNavBtn[data-active="true"] {
  background: #E5E7E1;
  border-color: #E5E7E1;
  box-shadow: none;
  color: var(--bg);
}

.headerNavBtn[data-active="true"]:hover {
  background: #edeee9;
}

.headerNavBtn[data-outline="accent"] {
  border-color: var(--accent);
}

.headerNavBtn[data-outline="warning"] {
  border-color: var(--warning);
}

.headerNavBtn:disabled,
.headerNavBtn[disabled] {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

.headerNavBtn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.headerNavBtn .title {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.headerNavBtn .subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.headerNavBtn[data-active="true"] .title { color: var(--bg); }
.headerNavBtn[data-active="true"] .subtitle { color: rgba(44, 41, 42, 0.75); }

/* Small-variant header button (? / Copy) */
.headerNavBtn--small {
  width: auto;
  min-width: var(--header-h);
  align-items: center;
  justify-content: center;
  text-align: center;
}


/* ============================================================
   Path bar (below floating header)
   ============================================================ */
.path-bar {
  position: fixed;
  top: calc(8px + var(--header-h) + 8px + 12px);
  left: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 299;
  pointer-events: none;
  background: var(--bg);
  color: #ffffff;
  border-radius: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.path-bar > * {
  pointer-events: auto;
}

.path-label {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

.path-bar code {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

.path-bar .headerNavBtn {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  width: auto;
  min-width: unset;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.path-bar .headerNavBtn .title {
  font-size: 11px;
  line-height: 1;
}

/* ============================================================
   Status bar
   ============================================================ */
.status {
  margin-top: calc(8px + var(--header-h) + 8px + 12px + 28px + 24px);
  padding: 10px 32px;
  color: var(--ink-secondary);
  font-size: 13px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  background: var(--panel-solid);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink);
}

.status .warning {
  color: var(--warning);
  font-weight: 500;
}

.status strong {
  color: var(--ink);
}

.status::before {
  content: none;
}

.status:empty::before {
  display: none;
}

/* ============================================================
   Generic button styles
   ============================================================ */
.secondary-btn {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  cursor: pointer;
  color: var(--ink);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

.secondary-btn:hover:not(:disabled) {
  background: var(--panel-solid) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  transform: none !important;
}

.secondary-btn.active {
  border-color: var(--accent) !important;
  color: var(--ink) !important;
  box-shadow: 0 0 0 1px var(--accent-glow) !important;
}

button:not(.headerNavBtn):not(.destroy-btn):not(.warning-btn):not(.secondary-btn):not(.danger-btn) {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: var(--gradient-primary);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(34, 179, 74, 0.3);
}

button:not(.headerNavBtn):not(.destroy-btn):not(.warning-btn):not(.secondary-btn):not(.danger-btn):disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

button:not(.headerNavBtn):not(.destroy-btn):not(.warning-btn):not(.secondary-btn):not(.danger-btn):hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34, 179, 74, 0.4);
}

button:not(.headerNavBtn):not(.destroy-btn):not(.warning-btn):not(.secondary-btn):not(.danger-btn):active:not(:disabled) {
  transform: translateY(0);
}

/* ============================================================
   Workspace (main content area)
   ============================================================ */
.workspace {
  display: grid;
  grid-template-columns: 240px 240px 1fr;
  gap: 16px;
  padding: 16px 32px 32px;
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 160px);
}

/* ============================================================
   Panels
   ============================================================ */
.panel {
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 160px);
}

.panel::-webkit-scrollbar {
  width: 6px;
}

.panel::-webkit-scrollbar-track {
  background: transparent;
}

.panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.panel::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.panel-header-right {
  font-weight: 500;
}

.panel ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
}

.panel li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  color: var(--ink-secondary);
}

.panel li:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

.panel li.active {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.panel li.missing {
  color: var(--muted);
  font-style: italic;
}

.panel li.missing::after {
  content: " (missing)";
  font-size: 11px;
  opacity: 0.6;
}

.panel li.load-more {
  color: var(--accent);
  font-style: italic;
  text-align: center;
  background: rgba(34, 179, 74, 0.08);
  border: 1px dashed var(--accent);
}

.panel li.load-more:hover {
  background: rgba(34, 179, 74, 0.15);
}

.panel li .projected {
  color: var(--success);
}

.panel li .marker-name {
  flex: 1;
}

.panel li .projection-count {
  float: right;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.panel li.insufficient .projection-count {
  color: var(--error);
  font-weight: 500;
}

.panel li .projection-count.sufficient {
  color: var(--success);
  font-weight: 500;
}

.panel li .pixel-error {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.destroy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  border-radius: 8px;
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.12);
  color: var(--error);
  cursor: pointer;
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease;
  margin-top: 8px;
}

.destroy-btn:hover {
  background: rgba(220, 38, 38, 0.20);
  border-color: rgba(220, 38, 38, 0.5);
  transform: none;
  box-shadow: none;
}

.panel-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.panel-divider {
  height: 1px;
  background: var(--border);
  margin-top: 10px;
  margin-bottom: 10px;
  width: 100%;
}

.marker-rmse-summary {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  text-align: center;
}

.overall-rmse {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.warning-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  border-radius: 8px;
  border: 1px solid rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.12);
  color: var(--warning);
  cursor: pointer;
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease;
  margin-top: 10px;
  margin-bottom: 8px;
}

.warning-btn:hover {
  background: rgba(249, 115, 22, 0.20);
  border-color: rgba(249, 115, 22, 0.5);
  transform: none;
  box-shadow: none;
}

.panel .destroy-btn {
  margin-top: 8px;
}

/* ============================================================
   Modals
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
}

.modal-content.danger {
  border-color: var(--error);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.import-modal-content {
  width: min(560px, 92vw);
}

.import-modal-content p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.import-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.import-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-secondary);
  min-width: 0;
}

.import-field--full {
  grid-column: 1 / -1;
}

.import-field input,
.import-field select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
}

.import-field input[type="file"] {
  height: auto;
  padding: 6px 10px;
}

.import-field input:focus,
.import-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.import-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.import-preview-label {
  font-size: 12px;
  color: var(--ink-secondary);
}

.import-preview-table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  max-width: 100%;
  max-height: 170px;
  background: rgba(0, 0, 0, 0.12);
}

.import-preview-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}

.import-preview-table th,
.import-preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.import-preview-table th {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  color: var(--ink);
  z-index: 1;
}

.tutorial-modal-content {
  width: min(520px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tutorial-header h2 {
  margin: 0;
  font-size: 18px;
}

.tutorial-lead {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tutorial-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-secondary);
}

.tutorial-steps strong {
  color: var(--ink);
  font-weight: 600;
}

.tutorial-tip {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(34, 179, 74, 0.12);
  border: 1px solid rgba(34, 179, 74, 0.3);
  font-size: 12px;
  color: var(--ink);
}

.danger-btn {
  background: var(--error);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.danger-btn:hover {
  filter: brightness(0.95);
}

/* ============================================================
   Map modal
   ============================================================ */
.map-modal-content {
  width: min(920px, 92vw);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.map-modal-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.map-modal-header p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.map-modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.map-crs-hint {
  font-size: 12px;
  color: var(--warning);
}

.marker-map {
  height: min(70vh, 520px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.legend-item.projected::before {
  background: #22B34A;
}

.legend-item.unprojected::before {
  background: #f97316;
}

.legend-item.cameras::before {
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Viewer
   ============================================================ */
.viewer {
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: calc(100vh - 160px);
  overflow: hidden;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.viewer-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.viewer-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  font-family: "JetBrains Mono", "Fira Code", monospace;
}

.viewer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pixel-error-display {
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}

.viewer-actions button {
  padding: 8px 14px;
  font-size: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  box-shadow: none;
}

.viewer-actions button:hover:not(:disabled) {
  background: var(--panel-solid);
  border-color: var(--border-focus);
  box-shadow: none;
  transform: none;
}

.canvas-wrap {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  position: relative;
}

.canvas-wrap::before {
  content: "Select a marker and image to begin";
  position: absolute;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
  opacity: 0.5;
}

.canvas-wrap:has(canvas.loaded)::before {
  display: none;
}

#image-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  transition: filter 0.1s ease;
}

#image-canvas.dragging {
  cursor: grabbing;
  filter: brightness(1.05);
}

#image-canvas.panning {
  cursor: grabbing;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.loading .status::before {
  animation: pulse 1.5s ease-in-out infinite;
  background: var(--accent);
}

.status.error {
  color: var(--error);
}

.status.error::before {
  background: var(--error);
}

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

.panel li {
  animation: fadeIn 0.2s ease-out backwards;
}

.panel li:nth-child(1) { animation-delay: 0.02s; }
.panel li:nth-child(2) { animation-delay: 0.04s; }
.panel li:nth-child(3) { animation-delay: 0.06s; }
.panel li:nth-child(4) { animation-delay: 0.08s; }
.panel li:nth-child(5) { animation-delay: 0.10s; }
.panel li:nth-child(6) { animation-delay: 0.12s; }
.panel li:nth-child(7) { animation-delay: 0.14s; }
.panel li:nth-child(8) { animation-delay: 0.16s; }
.panel li:nth-child(9) { animation-delay: 0.18s; }
.panel li:nth-child(10) { animation-delay: 0.20s; }

/* ============================================================
   Toast notifications (bottom-right)
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--success);
  background: rgba(34, 179, 74, 0.12);
  border: 1px solid rgba(34, 179, 74, 0.25);
  animation: toastIn 200ms ease-out, toastOut 400ms ease-in 1.8s forwards;
  pointer-events: auto;
}

.toast.error {
  color: var(--error);
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

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

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 200px 200px 1fr;
  }
}

@media (max-width: 980px) {
  .overlayRow {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    flex-wrap: wrap;
    pointer-events: auto;
    margin: 8px;
  }

  .overlayRow--right {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    margin: 0 8px 8px;
  }

  .path-bar {
    position: relative;
    top: auto;
    left: auto;
    pointer-events: auto;
    margin: 0 8px 8px;
  }

  .status {
    margin-top: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 16px 20px;
  }

  .panel {
    max-height: 200px;
  }

  .import-form {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Login (optional auth, see src/auth.py)
   ============================================================ */
.login-card {
  max-width: 420px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field span {
  font-size: 12px;
  color: var(--ink-secondary);
}

.login-field input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  transition: all 0.2s ease;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-form button {
  margin-top: 8px;
  padding: 14px 24px;
  font-size: 15px;
}

.logout-form {
  display: contents;
}

.login-error {
  margin: 0 0 20px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #f87171;
}
