:root {
  --ink: #17141e;
  --ink-soft: #2a2434;
  --muted: #6a7282;
  --paper: #fbfaf7;
  --paper-deep: #f4f1ea;
  --card: #ffffff;
  --line: #e6e1da;
  --line-strong: #d8d1c7;
  --brand: #6a50e3;
  --brand-dark: #4a3aad;
  --brand-soft: rgba(106, 80, 227, 0.12);
  --success: #147a3d;
  --error: #dc3545;
  --warning: #9a6b00;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(106, 80, 227, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgba(23, 20, 30, 0.08), transparent 26rem),
    linear-gradient(135deg, #ffffff 0%, var(--paper) 52%, var(--paper-deep) 100%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

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

button,
input {
  font: inherit;
}

button {
  appearance: none;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 14px 0 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 0 10px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  width: min(220px, 52vw);
  max-height: 46px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

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

.tool-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid rgba(106, 80, 227, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(23, 20, 30, 0.06);
  white-space: nowrap;
}

.content {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(390px, 1fr);
  gap: 20px;
  align-items: stretch;
  padding: 12px 0 8px;
}

.hero,
.panel {
  min-height: auto;
  max-height: calc(100vh - 118px);
  border: 1px solid rgba(23, 20, 30, 0.1);
  border-radius: 26px;
  box-shadow: 0 28px 80px rgba(23, 20, 30, 0.1);
}

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  padding: 28px;
  background:
    linear-gradient(145deg, rgba(23, 20, 30, 0.96), rgba(23, 20, 30, 0.88)),
    radial-gradient(circle at 80% 15%, rgba(106, 80, 227, 0.64), transparent 24rem);
  color: var(--paper);
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto -90px -90px auto;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(251, 250, 247, 0.18);
  border-radius: 999px;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 28px 28px auto auto;
  width: 82px;
  height: 82px;
  border-radius: 22px;
  background: rgba(251, 250, 247, 0.06);
  transform: rotate(8deg);
}

.hero-copy,
.status-strip {
  position: relative;
  z-index: 1;
}

.hero-eyebrow,
.section-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 900;
}

.hero-eyebrow {
  color: rgba(251, 250, 247, 0.72);
}

.section-kicker {
  color: var(--brand-dark);
}

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

h1,
h2 {
  letter-spacing: -0.055em;
  line-height: 0.98;
}

h1 {
  max-width: 660px;
  margin-bottom: 14px;
  font-size: clamp(38px, 4.8vw, 64px);
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(26px, 2.2vw, 32px);
}

h3 {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.hero-sub {
  max-width: 560px;
  margin-bottom: 0;
  color: rgba(251, 250, 247, 0.76);
  font-size: 16px;
  line-height: 1.5;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-strip div {
  min-height: 88px;
  padding: 13px;
  border: 1px solid rgba(251, 250, 247, 0.14);
  border-radius: 18px;
  background: rgba(251, 250, 247, 0.07);
  backdrop-filter: blur(12px);
}

.status-strip span {
  display: inline-flex;
  margin-bottom: 10px;
  color: #b9abff;
  font-size: 12px;
  font-weight: 900;
}

.status-strip p {
  margin-bottom: 0;
  color: rgba(251, 250, 247, 0.82);
  font-size: 14px;
  line-height: 1.35;
}

.panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(18px);
}

.login-card {
  padding: 22px;
  border: 1px solid rgba(23, 20, 30, 0.08);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 250, 247, 0.94));
  box-shadow: 0 22px 54px rgba(23, 20, 30, 0.08);
}

.card-heading {
  margin-bottom: 18px;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

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

.form-intro {
  margin-bottom: 4px;
  padding: 12px;
  border: 1px solid rgba(106, 80, 227, 0.12);
  border-radius: 16px;
  background: var(--brand-soft);
}

.form-intro h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.form-intro p,
.helper {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

label {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #ffffff;
  color: var(--ink);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

input::placeholder {
  color: #9aa1ad;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(106, 80, 227, 0.16);
}

input[type="file"] {
  padding: 9px 12px;
  cursor: pointer;
}

button {
  min-height: 44px;
  margin-top: 5px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(23, 20, 30, 0.18);
  background: #0f0d14;
}

button:active {
  transform: translateY(0);
}

button.secondary {
  margin-top: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(23, 20, 30, 0.04);
  box-shadow: none;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(106, 80, 227, 0.12);
  border-radius: 13px;
  background: rgba(106, 80, 227, 0.06);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.checkbox-row input {
  width: auto;
  min-height: 0;
  margin: 3px 0 0;
  accent-color: var(--brand);
  flex: 0 0 auto;
}

.message {
  min-height: 18px;
  margin-top: 10px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.message div + div {
  margin-top: 6px;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--error);
}

.message.warning {
  color: var(--warning);
}

.hidden {
  display: none;
}

.workflow {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(23, 20, 30, 0.08);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.7);
}

.step-no {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
}

.workflow p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* Laptop height optimization */
@media (max-height: 760px) and (min-width: 1041px) {
  .brand-logo {
    width: min(200px, 48vw);
    max-height: 40px;
  }

  .tool-badge {
    min-height: 28px;
    padding: 5px 11px;
  }

  .content {
    gap: 16px;
    padding-top: 8px;
  }

  .hero,
  .panel {
    max-height: calc(100vh - 102px);
  }

  .hero {
    padding: 24px;
  }

  h1 {
    font-size: clamp(36px, 4.2vw, 58px);
  }

  .hero-sub {
    font-size: 15px;
  }

  .status-strip div {
    min-height: 78px;
    padding: 11px;
  }

  .login-card {
    padding: 18px;
  }

  .card-heading {
    margin-bottom: 14px;
  }

  .workflow li {
    padding: 10px;
  }

  input {
    min-height: 40px;
  }

  button {
    min-height: 42px;
  }
}

@media (max-width: 1040px) {
  .content {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel {
    max-height: none;
    min-height: auto;
  }

  .hero {
    gap: 42px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding-top: 20px;
  }

  .hero,
  .panel {
    border-radius: 26px;
  }

  .hero {
    padding: 26px;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 22px;
    border-radius: 24px;
  }

  .panel {
    padding: 14px;
  }

  .footer {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .brand-logo {
    width: min(230px, 80vw);
  }

  h1 {
    font-size: 42px;
  }

  h2 {
    font-size: 30px;
  }

  .hero-sub {
    font-size: 16px;
  }

  .workflow li {
    grid-template-columns: 1fr;
  }
}

/* Logged-in state: show only one upload section */
body.is-logged-in .content {
  grid-template-columns: minmax(0, 560px);
  justify-content: center;
  align-items: center;
  padding: 18px 0 8px;
}

body.is-logged-in .hero,
body.is-logged-in .workflow {
  display: none;
}

body.is-logged-in .panel {
  width: 100%;
  min-height: auto;
  max-height: none;
  display: block;
  padding: 16px;
}

body.is-logged-in .login-card {
  padding: 24px;
}

body.is-logged-in .card-heading {
  display: none;
}

body.is-logged-in .form-intro {
  margin-bottom: 8px;
}

body.is-logged-in .message {
  margin-top: 12px;
}

@media (max-width: 760px) {
  body.is-logged-in .content {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

.upload-success {
  padding: 12px 14px;
  border: 1px solid rgba(20, 122, 61, 0.18);
  border-radius: 14px;
  background: rgba(20, 122, 61, 0.08);
  color: var(--success);
}

.message-title {
  font-weight: 900;
  margin-bottom: 6px;
}

.message-detail {
  color: #245b39;
  font-size: 13px;
  line-height: 1.4;
}

.message-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  width: min(390px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px 14px 14px 16px;
  border: 1px solid rgba(23, 20, 30, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 46px rgba(23, 20, 30, 0.16);
  animation: toastIn 0.25s ease both;
  backdrop-filter: blur(16px);
}

.toast.success {
  border-color: rgba(20, 122, 61, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 253, 244, 0.98));
}

.toast.error {
  border-color: rgba(220, 53, 69, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 241, 242, 0.98));
}

.toast.warning {
  border-color: rgba(154, 107, 0, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 225, 0.98));
}

.toast.info {
  border-color: rgba(106, 80, 227, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 243, 255, 0.98));
}

.toast-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

.toast-description {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.toast-close {
  width: 28px;
  height: 28px;
  min-height: 0;
  margin: -4px -4px 0 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.toast-close:hover {
  transform: none;
  box-shadow: none;
  background: rgba(23, 20, 30, 0.06);
}

.toast.is-hiding {
  animation: toastOut 0.25s ease both;
}

.upload-success,
.upload-result {
  padding: 12px 14px;
  border-radius: 14px;
}

.upload-success {
  border: 1px solid rgba(20, 122, 61, 0.18);
  background: rgba(20, 122, 61, 0.08);
  color: var(--success);
}

.upload-result {
  border: 1px solid rgba(154, 107, 0, 0.2);
  background: rgba(154, 107, 0, 0.08);
  color: var(--warning);
}

.message-title {
  font-weight: 900;
  margin-bottom: 6px;
}

.message-detail {
  color: #245b39;
  font-size: 13px;
  line-height: 1.4;
}

.upload-result .message-detail {
  color: #6f4f00;
}

.message-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@media (max-width: 520px) {
  .toast-container {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
}