:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --primary: #0f172a;
  --primary-foreground: #f8fafc;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --ring: rgba(15, 23, 42, 0.3);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--foreground);
  background: var(--background);
  min-height: 100vh;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  display: grid;
  gap: 32px;
}

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

h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.2rem, 3vw, 3.4rem);
  letter-spacing: -0.02em;
}

.lede {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 52ch;
}

.share-status {
  font-size: 0.92rem;
  color: #0b6bcb;
  font-weight: 600;
}

.share-status.is-error {
  color: #b42318;
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border-radius: 16px;
  padding: 28px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: grid;
  gap: 20px;
}

.dropzone {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 24px;
  background: var(--accent);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dropzone:focus,
.dropzone.is-dragging {
  outline: none;
  border-color: var(--foreground);
  box-shadow: 0 0 0 3px var(--ring);
}

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

.dropzone-content {
  display: flex;
  gap: 16px;
  align-items: center;
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dropzone-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.dropzone-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.footnote {
  font-size: 0.9rem;
  color: var(--muted);
}

.file-tile {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 16px;
}

.file-list {
  display: grid;
  gap: 16px;
}

.file-list:empty {
  display: none;
}

.file-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.file-status {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="password"] {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="password"]:focus {
  outline: none;
  border-color: var(--foreground);
  box-shadow: 0 0 0 3px var(--ring);
}

.file-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 44px;
}

.preview-panel {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: grid;
  gap: 12px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.preview-title {
  font-weight: 600;
}

.preview-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.preview-body iframe,
.preview-body object {
  width: 100%;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.csv-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.preview-csv-view {
  min-width: 0;
}

.csv-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

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

.csv-table th {
  background: var(--accent);
  font-weight: 600;
}

.csv-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.csv-pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 8px;
}

.csv-pagination .page-info {
  color: var(--muted);
  font-size: 0.85rem;
}

.csv-pagination .page-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.password-inline {
  display: flex;
  gap: 10px;
  align-items: center;
}

.password-inline label {
  font-size: 0.85rem;
  white-space: nowrap;
}

.password-inline input[type="password"] {
  width: 180px;
  padding: 10px 12px;
}

.cta {
  background: var(--primary);
  border: none;
  color: var(--primary-foreground);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.2);
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.notes h2 {
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.notes p {
  color: var(--muted);
}

@media (max-width: 720px) {
  .page {
    padding: 48px 18px 64px;
  }

  .card {
    padding: 22px;
  }

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

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

  .file-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .file-actions .cta,
  .file-actions .ghost,
  .password-inline {
    width: 100%;
    justify-content: center;
  }

  .password-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .password-inline input[type="password"] {
    width: 100%;
  }
}
