/* Shared admin theme — dark, aligned with the dashboard tokens (see docs/dashboard/DESIGN.md).
   Drives list / detail / edit / scrape / runs / partners / prompt / login. The dashboard's
   own `.dash` block scopes its own vars on top of this. */
:root {
  --bg: #09090B; --surface: #18181B; --surface-2: #202024;
  --text: #FAFAFA; --text-muted: #A1A1AA;
  --accent: #10B981; --accent-hover: #059669;
  --ok: #10B981; --fail: #EF4444; --warn: #F59E0B;
  --border: rgba(250, 250, 250, 0.08);
  --zebra: rgba(250, 250, 250, 0.03);
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  font-family: Inter, system-ui, sans-serif; margin: 0; line-height: 1.5;
  background: var(--bg); color: var(--text);
}

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: .55rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
header nav a { color: var(--text-muted); margin-right: 1.1rem; text-decoration: none; font-weight: 500; }
header nav a:hover { color: var(--text); }
header .logout button {
  background: transparent; color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
header .logout button:hover { color: var(--text); border-color: var(--text-muted); }

main { padding: 1.5rem; max-width: 1140px; margin: 0 auto; }

h1, h2, h3 { color: var(--text); font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; margin-top: 1.8rem; }
h3 { font-size: 1rem; }

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

/* Tables */
table {
  border-collapse: collapse; width: 100%; margin: .5rem 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
th, td { border-bottom: 1px solid var(--border); padding: .45rem .7rem; text-align: left; }
th { color: var(--text-muted); font-weight: 600; font-size: .82rem; text-transform: none; }
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:last-child td { border-bottom: none; }

/* Form controls */
input, select, textarea {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: .35rem .5rem; font: inherit;
}
input::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
select option { background: var(--surface); color: var(--text); }

button, input[type="submit"] {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: .4rem .8rem; font: inherit; cursor: pointer;
}
button:hover, input[type="submit"]:hover { border-color: var(--accent); color: var(--accent); }

/* Layout helpers used by list/detail */
.list-head { display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; }
.btn-export { display: inline-block; background: var(--accent); color: #09090B;
  font-weight: 600; padding: .45rem .9rem; border-radius: 6px; }
.btn-export:hover { background: var(--accent-hover); text-decoration: none; }
.filters { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.filter-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.search-row input[type="search"] { flex: 1; min-width: 260px; }
.add-filter-select { background: transparent; border: 1px dashed var(--border); border-radius: 6px; padding: .35rem .5rem; color: var(--text-muted); cursor: pointer; }
.add-filter-select:hover { border-color: var(--accent); color: var(--accent); }
.active-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter-chip { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 0; overflow: hidden; }
.filter-chip select, .filter-chip input { border: none; background: transparent; border-radius: 0; margin: 0; box-shadow: none; padding-right: 0; }
.filter-chip select:focus, .filter-chip input:focus { border: none; box-shadow: none; outline: none; }
.filter-chip .remove-filter { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: .35rem .5rem; line-height: 1; border-radius: 0; }
.filter-chip .remove-filter:hover { color: var(--fail); background: rgba(239, 68, 68, 0.1); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .6rem 0 1rem; }
form.inline { display: inline; }
.pager { color: var(--text-muted); }
.pager a { margin: 0 .45rem; }
.ind { text-align: center; }
.ind a { text-decoration: none; }
.muted { color: var(--text-muted); }
.status-active { color: #2f855a; }                      /* seen in latest scrape */
.status-missing { color: #c05621; font-weight: 600; }   /* not in its city's last run */
.status-closed { color: #c53030; }                      /* inactive */

/* Messages + status */
.flash {
  background: rgba(16, 185, 129, .12); border: 1px solid rgba(16, 185, 129, .3);
  color: var(--text); padding: .55rem .8rem; border-radius: var(--radius);
  list-style: none; margin: 0 0 1rem;
}
.error { color: var(--fail); }
.locked { color: var(--warn); font-weight: bold; }

/* Code / raw blocks (detail page) */
pre {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .8rem; overflow: auto; color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .85rem;
}
code { font-family: "JetBrains Mono", ui-monospace, monospace; }
details { margin: .3rem 0; }
summary { cursor: pointer; color: var(--text); }

.btn-kvk {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  padding: .25rem .6rem;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}
.btn-kvk:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* Creditsafe Widget styles */
.creditsafe-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
}

.creditsafe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.8rem;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.creditsafe-logo {
  font-weight: 800;
  font-size: 1.4rem;
  color: #ef4444; /* Red color matching creditsafe */
  letter-spacing: -0.5px;
}

.creditsafe-logo span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

.creditsafe-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.creditsafe-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-block;
}

.creditsafe-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.creditsafe-btn.primary {
  background: var(--accent);
  color: #09090B;
  border-color: var(--accent);
}

.creditsafe-btn.primary:hover {
  background: var(--accent-hover);
  color: #09090B;
}

.creditsafe-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.creditsafe-kpi-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.creditsafe-kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  font-weight: 500;
}

.creditsafe-kpi-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.creditsafe-kpi-card.status-active-card {
  border-left: 4px solid var(--ok);
}

.creditsafe-kpi-card.status-inactive-card {
  border-left: 4px solid var(--fail);
}

.creditsafe-status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.creditsafe-status-badge.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--ok);
}

.creditsafe-status-badge.inactive {
  background: rgba(239, 68, 68, 0.2);
  color: var(--fail);
}

.creditsafe-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  overflow-x: auto;
}

.creditsafe-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.creditsafe-tab-btn:hover {
  color: var(--text);
}

.creditsafe-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.creditsafe-tab-content {
  display: none;
}

.creditsafe-tab-content.active {
  display: block;
}

.creditsafe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .creditsafe-grid {
    grid-template-columns: 1fr;
  }
}

.creditsafe-section {
  background: rgba(250, 250, 250, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.creditsafe-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.creditsafe-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background: transparent;
  border: none;
}

.creditsafe-table th, .creditsafe-table td {
  padding: 0.45rem 0.5rem;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(250, 250, 250, 0.04);
  text-align: left;
}

.creditsafe-table th {
  font-weight: 500;
  color: var(--text-muted);
  width: 40%;
}

.creditsafe-table td {
  color: var(--text);
}

.creditsafe-table tr:last-child th, .creditsafe-table tr:last-child td {
  border-bottom: none;
}

/* Restaurant list single-line truncation */
table.restaurant-list th, table.restaurant-list td {
  white-space: nowrap;
}
table.restaurant-list td:first-child, table.restaurant-list th:first-child {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
}
