:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef2f5;
  --text: #15202b;
  --muted: #637083;
  --line: #d8dee6;
  --accent: #0d6b57;
  --accent-dark: #095343;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button,
a {
  border-radius: 6px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 5vw, 56px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.search-form {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.search-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 12px;
}

.search-controls {
  display: flex;
  justify-content: flex-end;
}

.search-form input,
.search-form select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: white;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.muted {
  color: var(--muted);
  font-size: 14px;
}

button {
  border: 0;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 11px 16px;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.ghost-button {
  background: var(--surface-soft);
  color: var(--text);
}

.ghost-button:hover {
  background: var(--line);
}

.status {
  min-height: 24px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  margin: 24px 0 10px;
  font-size: 18px;
}

.status-error,
.form-error {
  color: var(--danger);
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding: 18px 0 4px;
}

.listing-table {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.datatable-wrap {
  padding: 14px;
}

.listing-data-table {
  width: 100%;
}

.listing-data-table h2 {
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.35;
}

.listing-data-table p,
.listing-data-table td {
  color: var(--muted);
}

.listing-data-table strong {
  color: var(--text);
}

.listing-data-table a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.listing-data-table a:hover {
  text-decoration: underline;
}

div.dt-container .dt-search input,
div.dt-container .dt-length select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
}

div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: white !important;
}

.table-head,
.listing-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 150px 80px 92px;
  gap: 18px;
  align-items: center;
  padding: 15px 18px;
}

.table-head {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.listing-row {
  border-top: 1px solid var(--line);
}

.listing-row h2 {
  margin-bottom: 5px;
  font-size: 16px;
  line-height: 1.35;
}

.listing-row p,
.listing-row span {
  color: var(--muted);
}

.listing-row a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.listing-row a:hover {
  text-decoration: underline;
}

.favorite-marker {
  color: #b7791f;
  margin-right: 4px;
}

.favorite-button {
  min-width: 84px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 9px 12px;
}

.favorite-button:hover {
  background: var(--line);
}

.favorite-button.is-favorite {
  background: #fff1c7;
  color: #6b4a00;
}

.alert-line {
  margin-top: 6px;
  color: var(--danger);
  font-weight: 700;
}

.history-line {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-panel h1 {
  margin-bottom: 22px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  font-weight: 700;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 16px, 100%);
    margin: 16px auto 32px;
  }

  .topbar,
  .toolbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 18px 16px;
    gap: 12px;
  }

  .eyebrow {
    text-align: center;
  }

  .section-title {
    text-align: center;
  }

  .search-form {
    gap: 12px;
    margin-bottom: 14px;
  }

  .datatable-wrap {
    padding: 8px;
  }

  .search-fields {
    grid-template-columns: 1fr;
  }

  .search-form label,
  .search-form input,
  .search-form select,
  .search-controls {
    text-align: center;
  }

  .search-controls {
    justify-content: center;
  }

  .table-head {
    display: none;
  }

  .listing-data-table,
  .listing-data-table thead,
  .listing-data-table tbody,
  .listing-data-table tr,
  .listing-data-table td {
    display: block;
    width: 100%;
  }

  .listing-data-table thead {
    position: absolute;
    left: -9999px;
    top: -9999px;
  }

  .listing-data-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    background: var(--surface);
  }

  .listing-data-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    align-items: center;
    text-align: left;
  }

  .listing-data-table td:first-child {
    display: block;
    border-top: 0;
  }

  .listing-data-table td:not(:first-child)::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    flex: 0 0 110px;
  }

  .listing-data-table td:not(:first-child) {
    text-align: right;
  }

  .listing-data-table td:first-child h2 {
    margin-bottom: 4px;
  }

  .listing-data-table td:first-child p {
    font-size: 13px;
  }

  .listing-data-table strong,
  .listing-data-table td:not(:first-child) {
    color: var(--text);
  }

  .favorite-button {
    width: 100%;
  }

  .load-more-row {
    padding-top: 12px;
  }

  .search-controls button {
    width: 100%;
    max-width: 260px;
  }

  .status {
    text-align: center;
  }
}
