:root {
  --bg: #f2ede2;
  --bg-accent: #d8c5a7;
  --panel: rgba(255, 252, 247, 0.88);
  --line: rgba(62, 43, 24, 0.16);
  --ink: #26170f;
  --muted: #715743;
  --brand: #8d3b1f;
  --brand-dark: #6a2a14;
  --ok: #355d3b;
  --error: #8a2d2d;
  --shadow: 0 20px 60px rgba(70, 46, 25, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(216, 197, 167, 0.9), transparent 32%),
    radial-gradient(circle at bottom right, rgba(145, 59, 31, 0.12), transparent 28%),
    linear-gradient(135deg, #f8f4ec 0%, var(--bg) 48%, #ece2cf 100%);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(38, 23, 15, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 23, 15, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 92%);
}

.auth-shell,
.app-shell {
  position: relative;
  padding: 32px;
}

.auth-card,
.dashboard {
  width: min(1080px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.auth-card {
  min-height: calc(100vh - 64px);
  align-items: center;
  grid-template-columns: 1.2fr 0.9fr;
}

.hero-copy h1,
.topbar h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.hero-copy h1 {
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  max-width: 10ch;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand);
}

.lead {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 28px;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 22px;
  border: 1px solid rgba(141, 59, 31, 0.08);
  pointer-events: none;
}

.panel-large {
  min-height: 320px;
}

.panel h2 {
  margin: 0 0 18px;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-size: 1.8rem;
}

.stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid rgba(113, 87, 67, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: rgba(141, 59, 31, 0.44);
  box-shadow: 0 0 0 4px rgba(141, 59, 31, 0.12);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  padding: 0 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

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

.button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.button-primary {
  color: #fff7f3;
  background: linear-gradient(135deg, var(--brand) 0%, #b44a24 100%);
}

.button-primary:hover {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
}

.button-muted {
  color: var(--ink);
  background: rgba(113, 87, 67, 0.11);
}

.topbar {
  width: min(1080px, 100%);
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.dashboard {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: start;
}

#result-panel {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.upload-drop {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 28px;
  border-radius: 24px;
  border: 1px dashed rgba(113, 87, 67, 0.4);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(248, 240, 225, 0.78)),
    linear-gradient(135deg, rgba(141, 59, 31, 0.08), transparent);
  overflow: hidden;
}

.upload-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-title {
  font-size: 1.32rem;
  font-weight: 700;
}

.upload-subtitle {
  color: var(--muted);
  line-height: 1.5;
}

.notice {
  border-radius: 18px;
  background: rgba(113, 87, 67, 0.1);
  color: var(--ink);
  padding: 16px 18px;
  line-height: 1.5;
}

.notice-error {
  background: rgba(138, 45, 45, 0.12);
  color: var(--error);
}

.notice-success {
  background: rgba(53, 93, 59, 0.12);
  color: var(--ok);
}

.notice-loading {
  background: rgba(141, 59, 31, 0.1);
  color: var(--brand-dark);
}

@media (max-width: 900px) {
  .auth-card,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-shell,
  .app-shell {
    padding: 18px;
  }
}
