/* Base */
:root {
  --mono: "Courier New", monospace;
  --sans: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

/* Login */
.login-page {
  display: grid;
  place-items: center;
  font-family: var(--sans);
  color: #d9e5ec;
  background: #0f1722;
}

.login-page form {
  width: min(430px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid #c7d8dd;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 12px 24px rgba(22, 32, 36, 0.08);
}

.login-page h1 {
  margin: 0 0 0.5rem;
}

.login-page label {
  display: block;
  margin-top: 0.8rem;
  font-weight: 700;
  color: #162024;
}

.login-page input {
  width: 100%;
  margin-top: 0.2rem;
  padding: 0.55rem;
  border: 1px solid #c7d8dd;
  border-radius: 9px;
}

.login-page button {
  margin-top: 1rem;
  width: 100%;
  border: 0;
  border-radius: 9px;
  padding: 0.58rem;
  color: #fff;
  font-weight: 700;
  background: #0c6c88;
  cursor: pointer;
}

.login-page .error {
  margin-top: 0.8rem;
  color: #a20f0f;
}

.login-page .muted {
  color: #56666d;
  font-size: 0.92rem;
}

/* Index */
.index-page {
  font-family: var(--sans);
  color: #e3edf4;
  background: #101b28;
}

.index-page main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.index-page .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.index-page h1,
.index-page h2,
.index-page h3 {
  margin: 0 0 0.6rem;
}

.index-page .muted {
  color: #547067;
}

.index-page .top .muted {
  color: #afc2cf;
}

.index-page .pill {
  font-size: 0.8rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid #d5e3dc;
  background: #f3f8f6;
}

.index-page .logout {
  color: #9dd8ff;
  font-weight: 700;
  text-decoration: none;
}

.index-page .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.index-page .card {
  background: #fff;
  border: 1px solid #d5e3dc;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(20, 33, 27, 0.08);
  padding: 1rem;
  color: #14211b;
}

.index-page label {
  display: block;
  margin: 0.35rem 0 0.2rem;
  font-weight: 700;
}

.index-page input,
.index-page select,
.index-page textarea {
  width: 100%;
  border: 1px solid #d5e3dc;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  background: #fbfefd;
}

.index-page textarea {
  min-height: 92px;
  resize: vertical;
}

.index-page button {
  margin-top: 0.6rem;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  color: #fff;
  background: #0d6a50;
  font-weight: 700;
  cursor: pointer;
}

.index-page button.secondary {
  background: #0f5f8a;
}

.index-page button.warn {
  background: #8b1e1e;
}

.index-page .table-wrap {
  overflow: auto;
}

.index-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.index-page th,
.index-page td {
  text-align: left;
  padding: 0.42rem;
  border-bottom: 1px solid #e5efea;
  white-space: nowrap;
}

.index-page pre {
  margin: 0.5rem 0 0;
  background: #f6fbf8;
  border: 1px solid #d5e3dc;
  border-radius: 10px;
  padding: 0.65rem;
  max-height: 280px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.86rem;
  white-space: pre-wrap;
}

.index-page code {
  font-family: var(--mono);
}

.index-page .docs code {
  color: #003f63;
}

.index-page .new-key {
  background: #fff3d2;
  border: 1px solid #edd388;
  border-radius: 10px;
  padding: 0.7rem;
  margin-bottom: 0.6rem;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.index-page .inline-form {
  display: inline;
}

.index-page .checkbox-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.index-page .checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.index-page .checkbox-item input {
  width: auto;
  margin: 0;
}

.index-page .error-banner {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #d08a8a;
  border-radius: 8px;
  background: #feecec;
  color: #8b1e1e;
}

.index-page .preview-toolbar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.8rem;
  align-items: end;
}

.index-page .preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.index-page .preview-actions {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 0.45rem;
}

.index-page .preview-card {
  margin: 0;
  border: 1px solid #d5e3dc;
  border-radius: 12px;
  background: #f7fbf8;
  overflow: hidden;
}

.index-page .preview-card figcaption {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #d5e3dc;
  font-weight: 700;
  background: #eef7f2;
}

.index-page .preview-card img {
  display: block;
  width: 100%;
  min-height: 240px;
  max-height: 70vh;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 900px) {
  .index-page .preview-toolbar {
    grid-template-columns: 1fr;
  }

  .index-page .preview-grid {
    grid-template-columns: 1fr;
  }
}

/* Detail */
.detail-page {
  font-family: var(--sans);
  color: #d8e4ec;
  background: #121f2d;
}

.detail-page main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem;
}

.detail-page .card {
  background: #fff;
  border: 1px solid #d2e0e4;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(23, 34, 39, 0.08);
  padding: 1rem;
  margin-bottom: 1rem;
  color: #172227;
}

.detail-page table {
  width: 100%;
  border-collapse: collapse;
}

.detail-page td {
  border-bottom: 1px solid #e6eff2;
  padding: 0.46rem;
}

.detail-page td:first-child {
  width: 260px;
  color: #52686e;
  font-weight: 700;
}

.detail-page a {
  color: #0d6794;
  font-weight: 700;
}

.detail-page pre {
  background: #f7fbfd;
  border: 1px solid #d2e0e4;
  border-radius: 8px;
  padding: 0.65rem;
  overflow: auto;
  white-space: pre-wrap;
}

.benchmark-texts-page {
  max-width: 1600px;
}

.benchmark-text-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.benchmark-text-card {
  min-width: 0;
}

.benchmark-text-card h2 {
  margin-top: 0;
}

.benchmark-text-raw {
  min-height: 420px;
  max-height: 75vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
