:root {
  color-scheme: light;
  --background: #f4f6f8;
  --surface: #ffffff;
  --border: #dfe3e8;
  --border-strong: #cbd1d8;
  --text: #17212b;
  --muted: #66717e;
  --primary: #195b9b;
  --primary-hover: #124878;
  --success: #247a4d;
  --shadow: 0 8px 24px rgba(23, 33, 43, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

.page-container {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 72px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.subtitle {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.record-count {
  min-width: 116px;
  padding: 13px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.record-count span {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.record-count small {
  color: var(--muted);
  font-size: 12px;
}

.table-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}

.table-heading h2 {
  margin-bottom: 5px;
  font-size: 17px;
}

.table-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: 280px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input,
select {
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input {
  padding: 0 12px;
}

select {
  width: 100%;
  min-width: 150px;
  padding: 0 32px 0 10px;
  cursor: pointer;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25, 91, 155, 0.12);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fafbfc;
  color: #4c5966;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfcfd;
}

.identifier {
  font-weight: 650;
}

.description {
  color: var(--muted);
}

.action-heading,
.action-cell {
  text-align: right;
}

.update-button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 650;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
}

.secondary-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.update-button:hover {
  background: var(--primary-hover);
}

.update-button:active {
  transform: translateY(1px);
}

.update-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.empty-state {
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.state-message {
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

.error-state p {
  margin-bottom: 16px;
  color: #9f2d2d;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(380px, calc(100% - 48px));
  padding: 13px 16px;
  border-radius: 7px;
  background: #163524;
  color: #ffffff;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.error {
  background: #742b2b;
}

.token-dialog {
  width: min(560px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(10, 22, 34, 0.22);
}

.token-dialog::backdrop {
  background: rgba(17, 28, 39, 0.58);
  backdrop-filter: blur(2px);
}

.token-form {
  display: grid;
  gap: 22px;
  padding: 28px;
}

.token-form h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

.dialog-description {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.token-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field-error {
  margin: -8px 0 0;
  color: #9f2d2d;
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .page-container {
    width: min(100% - 28px, 1240px);
    padding: 28px 0 48px;
  }

  .page-header {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .header-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .record-count {
    min-width: 0;
  }

  .table-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 0;
  }

  th,
  td {
    padding: 12px;
  }

  .pagination {
    justify-content: space-between;
    gap: 8px;
    padding: 14px;
  }

  .token-form {
    padding: 22px;
  }
}
