:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --ink: #17212b;
  --muted: #64717f;
  --line: #d8e0e7;
  --accent: #0e7c74;
  --accent-dark: #075e58;
  --danger: #a33b31;
  --focus: #2f80ed;
  --shadow: 0 16px 40px rgba(23, 33, 43, 0.10);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(14, 124, 116, 0.12), rgba(47, 128, 237, 0.08)),
    var(--bg);
}

.auth-panel {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel h1,
.topbar h1,
.pane h2 {
  margin: 0;
  letter-spacing: 0;
}

.auth-panel h1 {
  font-size: clamp(2rem, 8vw, 3.25rem);
  line-height: 0.98;
}

.auth-copy {
  margin: 18px 0 24px;
  color: var(--muted);
  line-height: 1.55;
}

.workspace {
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto 16px;
}

.topbar h1 {
  font-size: 1.55rem;
}

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

.model-selector {
  min-height: 40px;
  display: grid;
  grid-template-columns: auto minmax(220px, 320px);
  align-items: center;
  gap: 8px;
}

.model-selector span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.model-selector select {
  width: 100%;
  min-height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.model-selector select:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--surface-2);
}

.user-label {
  max-width: 260px;
  color: var(--muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.upload-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  max-width: 1480px;
  margin: 0 auto 16px;
}

.drop-zone {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed #9ab0bf;
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #eef8f6;
  color: var(--ink);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.button,
.icon-link,
.icon-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.button {
  padding: 0 16px;
  font-weight: 700;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto;
}

.pane {
  min-height: calc(100vh - 156px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.pane-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.pane h2 {
  font-size: 1.05rem;
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--surface-2);
  color: var(--ink);
}

.icon-link {
  padding: 0 12px;
  color: var(--accent-dark);
  background: var(--surface-2);
  font-weight: 700;
  font-size: 0.9rem;
}

.pdf-preview {
  width: 100%;
  flex: 1;
  min-height: 520px;
  border: 0;
  background: #f0f2f4;
}

.empty-state {
  flex: 1;
  min-height: 520px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  background: #f0f2f4;
}

.status-line {
  min-height: 38px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

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

.summary-output {
  flex: 1;
  padding: 16px;
  overflow: auto;
  line-height: 1.55;
}

.summary-output:empty::before {
  content: "The generated summary will appear here.";
  color: var(--muted);
}

.summary-output h1,
.summary-output h2,
.summary-output h3,
.summary-output h4 {
  margin: 18px 0 8px;
  line-height: 1.25;
  letter-spacing: 0;
}

.summary-output h1:first-child,
.summary-output h2:first-child,
.summary-output h3:first-child,
.summary-output h4:first-child,
.summary-output p:first-child {
  margin-top: 0;
}

.summary-output h1 {
  font-size: 1.25rem;
}

.summary-output h2 {
  font-size: 1.12rem;
}

.summary-output h3,
.summary-output h4 {
  font-size: 1rem;
}

.summary-output p,
.summary-output ul,
.summary-output ol,
.summary-output table,
.summary-output blockquote,
.summary-output pre {
  margin: 0 0 12px;
}

.summary-output ul,
.summary-output ol {
  padding-left: 22px;
}

.summary-output li + li {
  margin-top: 4px;
}

.summary-output table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.summary-output th,
.summary-output td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.summary-output th {
  background: var(--surface-2);
  font-weight: 700;
}

.summary-output code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.summary-output pre {
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.summary-output pre code {
  padding: 0;
  background: transparent;
}

.summary-output blockquote {
  padding-left: 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.warning {
  margin: 18px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .upload-band,
  .content-grid {
    max-width: 100%;
  }

  .topbar,
  .upload-band {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .model-selector {
    grid-template-columns: auto minmax(220px, 1fr);
    flex: 1 1 100%;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .pane {
    min-height: 560px;
  }
}

@media (max-width: 560px) {
  .auth-panel {
    padding: 24px;
  }

  .topbar-actions,
  .upload-band {
    display: grid;
  }

  .model-selector {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }
}
