:root {
  --bg: #1b1d23;
  --pane-bg: #22252c;
  --pane-border: #33363f;
  --text: #e6e8ee;
  --text-dim: #9aa0ac;
  --accent: #6ea8fe;
  --danger: #e5677e;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ---- login ---- */
.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--pane-bg);
  border: 1px solid var(--pane-border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.login-card h1 { margin: 0 0 0.5rem 0; font-size: 1.4rem; }
.login-card label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: var(--text-dim); }
.login-card input {
  background: var(--bg); border: 1px solid var(--pane-border); border-radius: 6px;
  color: var(--text); padding: 0.5rem; font-size: 0.95rem;
}
.login-card button, .quick-add button, .new-board-form button {
  background: var(--accent); color: #10131a; border: none; border-radius: 6px;
  padding: 0.55rem; font-weight: 600; cursor: pointer;
}
.error { color: var(--danger); font-size: 0.85rem; margin: 0; }

/* ---- three-pane layout ---- */
.app {
  display: grid;
  grid-template-columns: 220px 1fr 380px;
  height: 100vh;
}

.pane { border-right: 1px solid var(--pane-border); overflow-y: auto; }
.pane-detail { border-right: none; }

.pane-boards {
  background: var(--pane-bg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.board-list li a {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.6rem; border-radius: 6px; color: var(--text-dim); text-decoration: none;
}
.board-list .board-icon { font-size: 0.9rem; line-height: 1; }
.board-list .board-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .board-count { font-size: 0.72rem; color: var(--text-dim); }
.board-list li.active a { background: var(--bg); color: var(--text); font-weight: 600; }
.board-list li a:hover { color: var(--text); }

.new-board-form { display: flex; flex-direction: column; gap: 0.4rem; margin-top: auto; }
.new-board-form input, .new-board-form select {
  background: var(--bg); border: 1px solid var(--pane-border); color: var(--text);
  border-radius: 6px; padding: 0.4rem; font-size: 0.85rem;
}
.logout-link { color: var(--text-dim); font-size: 0.8rem; text-decoration: none; }
.logout-link:hover { color: var(--text); }

.pane-list { padding: 1rem 1.2rem; display: flex; flex-direction: column; }
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8rem; }
.list-header h1 { font-size: 1.2rem; margin: 0; }
.board-actions { display: flex; gap: 0.5rem; }
.inline-form { display: flex; gap: 0.3rem; }
.inline-form input {
  background: var(--pane-bg); border: 1px solid var(--pane-border); color: var(--text);
  border-radius: 6px; padding: 0.3rem 0.5rem; font-size: 0.8rem; width: 110px;
}
.inline-form button {
  background: transparent; border: 1px solid var(--pane-border); color: var(--text-dim);
  border-radius: 6px; padding: 0.3rem 0.6rem; font-size: 0.8rem; cursor: pointer;
}
.inline-form button.danger { color: var(--danger); border-color: var(--danger); }

.quick-add { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.quick-add input[type=url] {
  flex: 2; background: var(--pane-bg); border: 1px solid var(--pane-border); color: var(--text);
  border-radius: 6px; padding: 0.5rem;
}
.quick-add input[type=text] {
  flex: 1; background: var(--pane-bg); border: 1px solid var(--pane-border); color: var(--text);
  border-radius: 6px; padding: 0.5rem;
}

.card-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.status-heading {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim);
  margin: 1rem 0 0.3rem 0;
}
.status-heading:first-child { margin-top: 0; }
.card-row {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.6rem;
  border-radius: 6px; cursor: pointer;
}
.card-row:hover { background: var(--pane-bg); }
.card-row.selected { background: var(--pane-bg); outline: 1px solid var(--accent); }
.card-row .card-icon {
  width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--icon-bg, #3a3d46); color: #fff; font-size: 0.65rem; font-weight: 700;
}
.card-row .card-icon img { width: 100%; height: 100%; object-fit: cover; }
.card-row .card-icon .icon-letter { display: none; }
.card-row .card-icon.icon-fallback .icon-letter { display: inline; }
.card-row .card-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.price-badge { font-size: 0.78rem; color: var(--accent); font-weight: 600; }

.pane-detail { padding: 1.2rem; }
.empty-state { color: var(--text-dim); font-size: 0.9rem; }

.detail-image { width: 100%; border-radius: var(--radius); margin-bottom: 0.8rem; max-height: 180px; object-fit: cover; }
.detail-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.3rem 0; }
.detail-url { font-size: 0.78rem; color: var(--text-dim); word-break: break-all; display: block; margin-bottom: 0.8rem; }
.detail-field { margin-bottom: 0.9rem; }
.detail-field label { display: block; font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.03em; }
.detail-field textarea, .detail-field input, .detail-field select {
  width: 100%; background: var(--pane-bg); border: 1px solid var(--pane-border); color: var(--text);
  border-radius: 6px; padding: 0.5rem; font-size: 0.9rem; font-family: inherit;
}
.detail-field textarea { min-height: 100px; resize: vertical; }
.price-row { display: flex; gap: 0.5rem; }
.detail-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.detail-actions button {
  flex: 1; border-radius: 6px; padding: 0.5rem; cursor: pointer; font-size: 0.85rem;
  border: 1px solid var(--pane-border); background: transparent; color: var(--text-dim);
}
.detail-actions button.danger { color: var(--danger); border-color: var(--danger); }
.save-indicator { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.3rem; height: 1em; }
