/* gio admin — design system minim, derivat din ADR-012 */
:root {
  --bg: #FAFAF7;
  --surface: #F2F1EB;
  --text: #1A1F26;
  --text-muted: #5A6573;
  --brand: #3A4A5C;
  --brand-hover: #2C3845;
  --accent: #C9A227;
  --accent-text: #7A6010;
  --warning-soft: #FBF3D5;
  --success: #3F7A4D;
  --danger: #A23B2D;
  --border: #D5D2C8;
  --border-strong: #9B9586;
  --radius: 6px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

code, pre { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 0.9em; }
.muted { color: var(--text-muted); font-size: 0.85em; }

.topbar {
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--sp-2); }
.brand-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--brand);
}
.brand-name { font-weight: 700; font-size: 18px; color: var(--brand); }
.brand-tag {
  background: var(--brand);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.nav { display: flex; gap: var(--sp-4); flex: 1; }
.nav a {
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
}
.nav a.active {
  background: var(--brand);
  color: #fff;
}
.nav a.active:hover { color: #fff; text-decoration: none; }

.user { display: flex; align-items: center; gap: var(--sp-2); font-size: 14px; }
.user-email { color: var(--text-muted); }
.btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--brand); padding: 4px 8px; font: inherit;
}
.btn-link:hover { color: var(--brand-hover); text-decoration: underline; }

main { padding: var(--sp-5); max-width: 1400px; margin: 0 auto; }

h1 { margin: 0 0 var(--sp-4) 0; font-size: 28px; font-weight: 700; color: var(--brand); }
h2 { margin: var(--sp-5) 0 var(--sp-3) 0; font-size: 20px; font-weight: 600; }

.subtitle { color: var(--text-muted); margin-top: -8px; margin-bottom: var(--sp-4); }
.empty-state { color: var(--text-muted); padding: var(--sp-5); text-align: center; background: var(--surface); border-radius: var(--radius); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
}
.stat-card {
  display: flex; flex-direction: column;
  background: #fff;
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--brand); margin: 4px 0; }
.stat-detail { font-size: 13px; color: var(--text-muted); }

.data-table {
  width: 100%; border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th {
  background: var(--surface);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.status-retracted { background: #f7e9e6; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge.predicate { background: #d6e3ee; border-color: #b6cce0; color: #1F6F8B; }
.badge.status-active { background: #dceadd; color: var(--success); border-color: #b3d3b6; }
.badge.status-retracted { background: #f3d4ce; color: var(--danger); border-color: #d8a59b; }
.badge.status-disputed { background: var(--warning-soft); color: var(--accent-text); border-color: #ddc78a; }
.user-role.badge { background: var(--brand); color: #fff; border-color: transparent; }

.confidence-pill {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
}

.btn, button.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn.primary, button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover, button.primary:hover { background: var(--brand-hover); }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.btn-sm.primary { background: var(--success); color: #fff; border-color: var(--success); }
.btn-sm.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.actions-cell { white-space: nowrap; display: flex; gap: 6px; }
.actions-cell form { margin: 0; display: inline; }
.inline { display: inline; }

.quote-cell { max-width: 320px; }
.quote-cell em { color: var(--text); font-style: italic; }
.yt-link {
  display: inline-block;
  margin-top: 4px;
  background: var(--accent);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
}
.yt-link:hover { background: var(--accent-text); color: #fff; text-decoration: none; }

.json-snippet {
  display: block;
  max-width: 400px;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-muted);
}

.warning-box {
  background: var(--warning-soft);
  border-left: 4px solid var(--accent);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: var(--sp-4) 0;
}
.warning-box code { background: rgba(0,0,0,0.07); padding: 1px 4px; border-radius: 2px; }

.code-block {
  background: var(--text);
  color: #FAFAF7;
  padding: var(--sp-3);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.quick-actions { list-style: none; padding: 0; }
.quick-actions li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.quick-actions li:last-child { border-bottom: none; }

.login {
  max-width: 480px;
  margin: 64px auto;
  padding: var(--sp-5);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.footer {
  text-align: center;
  padding: var(--sp-4);
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-6);
}

/* Forms */
.form-page { max-width: 760px; }
.form-stacked fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
  background: #fff;
}
.form-stacked legend {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 8px;
}
.field { margin-bottom: var(--sp-3); }
.field label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  font-size: 14px;
}
.field .req { color: var(--danger); }
.field input[type=text], .field input[type=number], .field input[type=date],
.field input[type=search], .field input[type=email], .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(58, 74, 92, 0.1);
}
.field textarea { font-family: inherit; resize: vertical; min-height: 80px; }
.field .hint, .field small { font-size: 12px; color: var(--text-muted); display: block; margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
@media (max-width: 768px) { .field-row { grid-template-columns: 1fr; } }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; }
.form-actions {
  display: flex; gap: var(--sp-3); justify-content: flex-end;
  margin-top: var(--sp-4);
}
.alias-list {
  list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 var(--sp-3) 0;
}
.alias-list li code {
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--text);
}

/* Filter bar */
.filter-bar {
  display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4);
  flex-wrap: wrap; align-items: center;
}
.input-search, .input-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
}
.input-search { flex: 1; min-width: 200px; }

/* Histogram */
.histogram { margin: var(--sp-4) 0; }
.hist-row {
  display: grid;
  grid-template-columns: 80px 1fr 130px;
  gap: var(--sp-3); align-items: center;
  margin-bottom: 6px;
}
.hist-label { font-family: "SF Mono", monospace; font-size: 13px; }
.hist-bar-track {
  background: var(--surface);
  border-radius: 4px;
  height: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.hist-bar {
  background: var(--brand);
  height: 100%;
  min-width: 1px;
  transition: width 0.3s ease;
}
.hist-count { font-size: 13px; }

@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; gap: var(--sp-3); }
  .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 6px 8px; }
  .quote-cell { max-width: 200px; }
}

/* Sortable table headers + pagination */
.data-table.sortable th.sortable-h { padding: 0; }
.data-table.sortable th.sortable-h a {
  display: block; padding: 10px 12px; color: inherit; text-decoration: none;
  font-weight: 700;
}
.data-table.sortable th.sortable-h a:hover { background: rgba(0,0,0,0.04); }
.data-table.sortable th.sortable-h .sort-arrow {
  margin-left: 6px; font-size: 11px; color: #C9A227;
}
.pagination {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px; justify-content: center;
}
.pagination .btn-sm.disabled {
  opacity: 0.4; pointer-events: none;
}
.pagination .page-info {
  font-size: 13px; color: #5A6573;
  font-variant-numeric: tabular-nums;
}
