:root {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body {
  margin: 0;
  background: #f6f7fb;
  color: #111;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* =====================
   Top Navigation
   ===================== */
.topbar {
  background: #111827;
  color: #fff;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand .title {
  font-weight: 700;
}

.brand .sub {
  font-size: 12px;
  opacity: .8;
}

.nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 12px;
  opacity: .9;
}

.nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* =====================
   Cards & Typography
   ===================== */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 10px rgba(0,0,0,.06);
  margin: 16px 0;
}

h1, h2 {
  margin: 0 0 12px 0;
}

label {
  display: block;
  font-size: 12px;
  color: #374151;
  margin-bottom: 6px;
}

/* =====================
   Inputs
   ===================== */
input,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  box-sizing: border-box;
  background: #fff;
}

/* =====================
   Existing Grid (keep)
   ===================== */
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  align-items: end;
}

.grid > div {
  grid-column: span 2;
  min-width: 0;
}

/* =====================
   Search Grid (NEW)
   Fixes input border bleed
   ===================== */
.search-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.search-grid input,
.search-grid select {
  width: 100%;
  box-sizing: border-box;
}

/* =====================
   Actions / Buttons
   ===================== */
.actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

button,
.btn-secondary {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #111827;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

button {
  background: #111827;
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: #111827;
}

/* =====================
   Tables
   ===================== */
.table-wrap {
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

th {
  background: #f9fafb;
  font-size: 12px;
  color: #374151;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* =====================
   Key/Value & Messages
   ===================== */
.kv {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.kv div span {
  display: block;
  font-size: 12px;
  color: #6b7280;
}

.warn {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 10px;
  border-radius: 10px;
}

.muted {
  color: #6b7280;
}

/* =====================
   Responsive
   ===================== */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid > div {
    grid-column: span 2;
  }

  .search-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .kv {
    grid-template-columns: 1fr;
  }
}
