@import url("https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --bg: #f2f4f9;
  --surface: #fbfcff;
  --surface-2: #f5f8ff;
  --line: #d9e0ef;
  --text: #1a2437;
  --muted: #63708b;
  --primary: #1e63c9;
  --primary-strong: #174ea0;
  --danger: #c93e4a;
  --danger-strong: #8d1e30;
  --ok: #1f8a4d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sarabun", "Noto Sans Thai", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1300px 550px at 84% -12%, #d7e8ff 0%, rgba(215, 232, 255, 0) 68%),
    radial-gradient(900px 420px at -12% 25%, #dfe9ff 0%, rgba(223, 233, 255, 0) 70%),
    var(--bg);
}

.app-shell {
  width: min(1080px, calc(100% - 28px));
  margin: 24px auto 36px;
  display: grid;
  gap: 14px;
}

.masthead,
.auth-gate,
.workspace-panel,
.status-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(248, 251, 255, 0.92));
  border-radius: 18px;
  box-shadow: 0 16px 30px rgba(27, 46, 87, 0.07);
}

.masthead {
  padding: 20px 22px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.brand-block h1 {
  margin: 2px 0 6px;
  font-family: "Space Grotesk", "Sarabun", sans-serif;
  font-size: clamp(1.48rem, 2.7vw, 2rem);
  letter-spacing: 0.01em;
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-strong);
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  border: 1px solid #b8cff7;
  background: #e7f0ff;
  color: var(--primary-strong);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 700;
}

.ghost-btn,
.secondary-btn,
button[type="submit"],
.delete-btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.ghost-btn {
  background: #eef4ff;
  border-color: #c6d8fa;
  color: var(--primary-strong);
}

.secondary-btn {
  background: #e8f0ff;
  border-color: #bfd4ff;
  color: var(--primary-strong);
}

button[type="submit"] {
  background: var(--primary);
  border-color: var(--primary-strong);
  color: #fff;
}

.ghost-btn:hover,
.secondary-btn:hover,
button[type="submit"]:hover,
.delete-btn:hover {
  transform: translateY(-1px);
}

.auth-gate,
.workspace-panel,
.status-panel {
  padding: 18px 20px;
}

.auth-gate {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.auth-copy h2,
.section-head h2,
.status-panel h2 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", "Sarabun", sans-serif;
  font-size: 1.26rem;
}

.auth-copy p,
.section-head p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-form label {
  font-size: 0.92rem;
  font-weight: 600;
}

.login-form input {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.workspace-panel {
  display: grid;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.section-head p {
  flex: 1;
  min-width: 220px;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.file-input-wrap {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  background: var(--surface-2);
  border: 1px dashed #b7c8e7;
  border-radius: 11px;
  padding: 8px 10px;
  min-height: 48px;
}

.file-input-wrap > span {
  font-weight: 600;
  color: #294270;
}

.file-input-wrap input[type="file"] {
  max-width: 300px;
}

.files-container {
  display: grid;
  gap: 10px;
}

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

.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 11px 12px;
  animation: liftIn 280ms ease both;
}

.file-meta {
  display: grid;
  gap: 4px;
}

.file-name {
  font-weight: 700;
}

.file-sub {
  color: var(--muted);
  font-size: 0.92rem;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-actions a {
  text-decoration: none;
  font-weight: 700;
  color: var(--primary-strong);
}

.delete-btn {
  background: var(--danger);
  border-color: var(--danger-strong);
  color: #fff;
}

.status-panel pre {
  margin: 0;
  border: 1px solid #b7c8e7;
  background: #eaf2ff;
  border-radius: 12px;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.status-panel pre.error {
  background: #ffedf0;
  border-color: #efb6c0;
  color: #9f1e30;
}

button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.reveal {
  animation: revealIn 380ms ease both;
}

@keyframes revealIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

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

  .section-head {
    align-items: flex-start;
  }

  .file-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: calc(100% - 18px);
    margin: 16px auto 24px;
  }

  .masthead {
    padding: 16px;
    flex-direction: column;
  }

  .auth-gate,
  .workspace-panel,
  .status-panel {
    padding: 14px;
  }
}

