:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --chip-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input { font: inherit; }
body { min-height: 100vh; }

.app-shell {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
}

.sidebar {
  order: 2;
  flex: 0 0 320px;
  min-width: 280px;
  max-width: 380px;
  min-height: 0;
  background: #f8fafc;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
  overflow: hidden;
}

.main-panel {
  order: 1;
  flex: 1 1 520px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
  overflow: hidden;
}

.title-block h1 {
  margin: 0;
  font-size: 1.35rem;
}

.title-block p,
.sidebar-footer p,
.muted {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 14px;
  background: white;
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.counter { white-space: nowrap; font-weight: 700; }

.elements-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  overflow: auto;
  padding-top: 4px;
  padding-right: 4px;
}

.sidebar-chip,
.board-item,
.text-btn,
.drag-ghost {
  border: 1px solid var(--border);
  background: white;
  min-height: 44px;
  font-size: 15px;
}

.sidebar-chip,
.board-item,
.drag-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: min(100%, 320px);
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: grab;
  user-select: none;
  box-shadow: var(--chip-shadow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-chip:hover,
.sidebar-chip:focus-visible,
.text-btn:hover,
.text-btn:focus-visible { transform: translateY(-1px); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-version-row {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.sidebar-version {
  color: var(--muted);
  font-size: 0.92rem;
}


.text-btn {
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.workspace-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.workspace {
  position: relative;
  flex: 1;
  min-height: 65vh;
  background: radial-gradient(circle at top, rgba(255,255,255,0.9), rgba(255,255,255,0.75)), linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
}

.empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--muted);
  pointer-events: none;
  text-align: center;
}

.board-item {
  position: absolute;
  left: 0;
  top: 0;
  touch-action: none;
}
.board-item.dragging { cursor: grabbing; z-index: 1000; }
.board-item.targeted { outline: 2px dashed #94a3b8; outline-offset: 3px; }
.board-item.tested-success {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18), var(--chip-shadow);
}
.board-item.tested-fail {
  border-color: #b91c1c;
  background: #fee2e2;
  color: #7f1d1d;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.28), 0 0 18px rgba(220, 38, 38, 0.16), var(--chip-shadow);
}
.board-item.targeted.tested-success,
.board-item.targeted.tested-fail { outline-width: 3px; }

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 100000;
}

.workspace-tools {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  z-index: 20;
}

.tool-zone {
  border: 1px solid var(--border);
  background: white;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--chip-shadow);
  cursor: pointer;
}

.tool-zone:hover,
.tool-zone:focus-visible {
  transform: translateY(-1px);
}

.trash-zone.active {
  border-color: #dc2626;
  background: #fee2e2;
  color: #7f1d1d;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18), var(--chip-shadow);
}


.status-bar {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
}
.status-inner { width: 100%; padding: 14px 16px; }
.status-inner strong { display: inline-block; margin-right: 8px; }
.status-inner.success { color: #14532d; }
.status-inner.fail { color: #92400e; }

.discovery-modal[hidden] { display: none; }
.discovery-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
}
.discovery-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.42);
}
.discovery-card {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 460px);
  background: white;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.22);
  padding: 22px;
}
.discovery-eyebrow {
  font-size: 0.85rem;
  font-weight: 700;
  color: #7c3aed;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.discovery-type {
  color: var(--muted);
  margin-bottom: 12px;
}
.discovery-description { margin: 0; line-height: 1.5; }
.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: 1px solid var(--border);
  background: white;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    flex-wrap: wrap;
    overflow: visible;
  }
  .main-panel { order: 1; width: 100%; min-height: 70vh; }
  .sidebar {
    order: 2;
    width: 100%;
    max-width: none;
    border-left: 0;
    border-top: 1px solid var(--border);
    min-height: 280px;
  }
  .workspace { min-height: 58vh; }
}

.board-item-label { display: inline-block; }


.sidebar-chip--complete,
.board-item--complete {
  background: linear-gradient(180deg, #fffdf2 0%, #f6e8ab 100%);
  border-color: #d9bf6a;
  color: #6f5200;
  box-shadow: 0 0 0 1px rgba(217, 191, 106, 0.14), var(--chip-shadow);
}
