:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e4e8;
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --open: #2563eb;
  --resolved: #16a34a;
  --danger: #dc2626;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---- login ---- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 320px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.muted { font-size: 14px; margin: 0; }
.login-card input {
  width: 100%; padding: 10px 12px; margin: 14px 0 10px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.login-card button {
  width: 100%; padding: 10px; border: none; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500; cursor: pointer;
}
.login-card button:hover { background: var(--accent-dark); }

/* ---- app shell ---- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; margin: 0; flex-shrink: 0; }
.filters { display: flex; gap: 8px; flex: 1; }

select, input {
  font-size: 14px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}

button.secondary {
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer;
}
button.secondary:hover { background: var(--bg); }

/* ---- feedback list ---- */
.feedback-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; padding: 24px;
}
.empty-state { text-align: center; color: var(--muted); padding: 60px 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column;
}
.card .thumb {
  width: 100%; aspect-ratio: 16/10; background: var(--bg); object-fit: cover;
  cursor: pointer; display: block; border-bottom: 1px solid var(--border);
}
.card .thumb-placeholder {
  width: 100%; aspect-ratio: 16/10; background: var(--bg);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.card-comment { font-size: 14px; line-height: 1.4; }
.card-selector {
  font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted);
  background: var(--bg); padding: 4px 6px; border-radius: 6px; overflow-x: auto; white-space: nowrap;
}
.card-url {
  font-size: 12px; color: var(--accent); text-decoration: none; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 4px; }

.badge {
  font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 999px; text-transform: uppercase;
}
.badge.open { background: rgba(37,99,235,0.1); color: var(--open); }
.badge.resolved { background: rgba(22,163,74,0.1); color: var(--resolved); }

.resolve-btn {
  font-size: 12px; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer;
}
.resolve-btn:hover { background: var(--bg); }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100;
}
.modal {
  background: var(--surface); border-radius: 12px; width: 480px; max-width: 100%;
  padding: 24px; max-height: 85vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-header h2 { margin: 0; font-size: 18px; }
.icon-btn { border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }

.projects-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.project-row {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px;
}
.project-row .name { font-weight: 500; }
.project-row .token-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap;
  font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted);
}
.project-row .token-row span {
  flex: 1 1 auto; min-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-row .copy-btn { flex-shrink: 0; }
.copy-btn {
  font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); cursor: pointer; flex-shrink: 0;
}

.project-form { display: flex; flex-direction: column; gap: 8px; }
.project-form select, .project-form input { width: 100%; }
.project-form button {
  padding: 10px; border: none; border-radius: 8px; background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 500; cursor: pointer;
}
#new-project-result { margin-top: 12px; font-size: 12px; }
#new-project-result .snippet {
  background: var(--bg); padding: 8px; border-radius: 6px; font-family: ui-monospace, monospace;
  word-break: break-all; margin-top: 6px;
}

/* ---- lightbox ---- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center; z-index: 200; cursor: zoom-out;
}
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 6px; }
