:root {
  --blue: #208aef;
  --blue-dark: #0a6fd1;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1a1d24;
  --text-secondary: #60646c;
  --border: #e2e5eb;
  --danger: #e24c4c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --surface: #1a1c20;
    --text: #f2f3f5;
    --text-secondary: #9aa0aa;
    --border: #2c2f36;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.tag {
  display: inline-block;
  background: var(--blue);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  max-width: 360px;
  margin: 64px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.panel h2 { margin-top: 0; }

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

input {
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.btn {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--blue);
  color: white;
}

.btn-primary:hover { background: var(--blue-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-small {
  font-size: 12px;
  padding: 6px 10px;
}

.muted { color: var(--text-secondary); font-size: 13px; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar input[type="search"] {
  flex: 1;
  max-width: 320px;
}

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 1200px;
  table-layout: fixed;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td input, td textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

td textarea { min-height: 60px; resize: vertical; }

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 180px;
}

.photo-thumb-wrap {
  position: relative;
  width: 40px;
  height: 40px;
}

.photo-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border);
}

.photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  font-size: 10px;
  line-height: 16px;
  cursor: pointer;
  padding: 0;
}

.dirty-badge {
  font-size: 11px;
  color: var(--blue);
  font-weight: 600;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  z-index: 1000;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}
