@import url("../source-panel.css");

:root {
  --page: #f2f5f3;
  --surface: #ffffff;
  --ink: #17251d;
  --muted: #495b50;
  --line: #c5d2c8;
  --brand: #174f2d;
  --brand-dark: #0e351d;
  --accent: #d97706;
  --success: #15803d;
  --danger: #b91c1c;
  --soft: #e5ede7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.page { width: min(56rem, 100%); margin: 0 auto; }

.page-header {
  margin: 0 0 20px;
  padding: 22px;
  background: var(--brand);
  color: #fff;
  border-radius: 14px;
  text-align: center;
}

.page-header h1,
.page-header p { margin: 0 0 8px; }

.page-header p { color: #dceade; }

.card {
  margin: 0 0 18px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.card h2 { margin: 0 0 10px; color: var(--brand); }

.help {
  margin: 0 0 12px;
  color: var(--muted);
}

.field { margin: 14px 0; }

.field label {
  display: block;
  margin: 0 0 6px;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

.field input,
.toolbar input {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #789383;
  border-radius: 0.5rem;
  background: #fff;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button.secondary,
.btn.secondary {
  background: #fff;
  border-color: #789383;
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 12px;
}

.message {
  margin: 12px 0 0;
  padding: 0.65rem 0.8rem;
  background: var(--soft);
  border-radius: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

thead th {
  background: var(--soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

th.sort {
  cursor: pointer;
  user-select: none;
}

th.sort:hover,
th.sort.asc,
th.sort.desc {
  color: var(--brand-dark);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  justify-content: space-between;
  margin: 0 0 12px;
}

.toolbar .field {
  margin: 0;
  min-width: 14rem;
  flex: 1 1 14rem;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.pagination li {
  display: inline-flex;
}

.pagination .page {
  display: inline-flex;
  min-width: 2rem;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.pagination .active .page {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 12px;
}

.bulk-actions {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.bulk-actions.is-visible {
  display: flex;
}

.bulk-replace.is-hidden {
  display: none;
}

pre#selected-rows {
  margin: 12px 0 0;
  padding: 0.75rem;
  background: #0f1f16;
  color: #dceade;
  border-radius: 0.5rem;
  overflow-x: auto;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  body {
    padding: 16px 12px;
  }

  .page-header {
    padding: 18px 16px;
  }

  .page-header h1 {
    font-size: 1.65rem;
    line-height: 1.2;
  }

  .card {
    padding: 16px;
  }

  .toolbar {
    align-items: stretch;
  }

  .bulk-replace,
  .bulk-actions {
    width: 100%;
  }

  .bulk-replace button,
  .bulk-actions button,
  .bulk-actions select {
    width: 100%;
  }

  .footer-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination {
    width: 100%;
    justify-content: center;
  }
}
