:root {
  color-scheme: light;
  --bg: #eef4fb;
  --panel: #ffffff;
  --ink: #132b43;
  --muted: #5d7084;
  --line: #d4e0ec;
  --accent: #1f6feb;
  --accent-strong: #1557ba;
  --danger: #a12626;
  --shadow: 0 18px 50px rgba(29, 55, 86, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 235, 0.18), transparent 32rem),
    linear-gradient(135deg, #f6faff 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 18px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.intro {
  max-width: 560px;
  color: var(--muted);
  font-size: 1.05rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: 24px;
}

.search-card {
  margin-bottom: 22px;
}

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

.search-row {
  display: flex;
  gap: 12px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font: inherit;
  padding: 13px 14px;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(31, 111, 235, 0.16);
}

button {
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 13px 20px;
  white-space: nowrap;
}

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

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

.secondary-button {
  border: 1px solid var(--line);
  background: #f7fbff;
  color: var(--accent);
}

.secondary-button:hover {
  background: #edf5ff;
  color: var(--accent-strong);
}

.status {
  min-height: 1.3em;
  margin: 14px 0 0;
  color: var(--muted);
}

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

.results {
  display: grid;
  gap: 12px;
}

.result-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fbfa;
  color: var(--ink);
  padding: 16px;
  text-align: left;
}

.result-button:hover,
.result-button.active {
  border-color: var(--accent);
  background: #edf5ff;
  color: var(--ink);
}

.result-title {
  display: block;
  margin-bottom: 8px;
  font-weight: 850;
}

.result-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.document-card {
  min-height: 420px;
}

.document {
  overflow: auto;
}

.document-frame {
  width: 100%;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.raw-document {
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0f1b2d;
  color: #eaf3ff;
  padding: 18px;
  white-space: pre-wrap;
}

.empty-state {
  color: var(--muted);
}

.document-page {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.document-toolbar {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  padding: 12px 18px;
}

.document-toolbar .status {
  min-height: 0;
  margin: 0;
  margin-left: auto;
  text-align: right;
}

.back-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.toolbar-title {
  color: var(--ink);
  font-weight: 850;
}

.document-full {
  min-height: 0;
  overflow: auto;
  padding: 0;
}

.document-full.empty-state {
  display: grid;
  place-items: center;
  padding: 24px;
}

.full-page-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.full-page-raw {
  min-height: 100%;
  border: 0;
  border-radius: 0;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 28px 0;
  }

  .card {
    border-radius: 18px;
    padding: 18px;
  }

  .search-row {
    display: grid;
  }

  button {
    width: 100%;
  }
}
