:root {
  --ink: #1b1712;
  --muted: #6d6458;
  --paper: #f3eadb;
  --card: #fffaf1;
  --line: #d7cbb8;
  --navy: #1f2a44;
  --navy-2: #2c3b5e;
  --clay: #c45c26;
  --clay-dark: #9b3f14;
  --good: #2f6f4e;
  --bad: #9b2c2c;
  --shadow: 0 24px 60px rgba(31, 42, 68, 0.16);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #ffe7c2 0%, transparent 55%),
    linear-gradient(180deg, #efe4d2 0%, var(--paper) 40%);
}

h1, h2, h3 {
  font-family: "Fraunces", serif;
  margin: 0;
  letter-spacing: -0.03em;
}

p { margin: 0; }

code {
  font-size: 0.85em;
  background: rgba(255,255,255,0.08);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.rail {
  background: linear-gradient(180deg, var(--navy) 0%, #162033 100%);
  color: #f6efe4;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, #e7b07a, var(--clay));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25);
  position: relative;
}

.mark::after {
  content: "";
  position: absolute;
  inset: 11px 9px 11px 14px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  color: #cbbca6;
  margin-bottom: 4px;
}

.brand h1 {
  font-size: 2rem;
  line-height: 1;
}

.lede {
  color: #d9cebf;
  line-height: 1.55;
  font-size: 0.98rem;
}

.stats {
  display: grid;
  gap: 12px;
  margin: 0;
}

.stats > div {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.stats dt {
  color: #b7ad9e;
  font-size: 0.82rem;
}

.stats dd {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
}

.rail-note {
  margin-top: auto;
  color: #b7ad9e;
  font-size: 0.85rem;
  line-height: 1.5;
}

.stage {
  padding: 36px 42px 56px;
}

.stage-head {
  margin-bottom: 22px;
}

.stage-head h2 {
  font-size: 2.1rem;
}

.stage-head p {
  color: var(--muted);
  margin-top: 6px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 150px;
  border: 1.5px dashed #c9b89a;
  border-radius: 22px;
  background: rgba(255,250,241,0.7);
  cursor: pointer;
  text-align: center;
  padding: 24px;
  transition: 0.15s ease;
}

.dropzone strong { font-size: 1.15rem; }
.dropzone span { color: var(--muted); }
.dropzone em {
  font-style: normal;
  color: var(--good);
  min-height: 1.2em;
}

.dropzone.drag {
  border-color: var(--clay);
  background: #fff4e6;
}

progress {
  width: min(320px, 80%);
  height: 8px;
  appearance: none;
}

progress::-webkit-progress-bar { background: #eadfce; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--clay); border-radius: 99px; }

.panel {
  margin-top: 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.file-list { min-height: 120px; }

.file-row, .empty {
  padding: 16px 22px;
}

.empty {
  color: var(--muted);
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid #efe6d8;
}

.file-row:last-child { border-bottom: 0; }

.file-name {
  font-weight: 650;
  word-break: break-word;
}

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

.chip {
  display: inline-block;
  background: #efe4d2;
  color: var(--navy);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button, .ghost, .primary {
  font: inherit;
  cursor: pointer;
}

.primary, .ghost, .danger {
  border-radius: 999px;
  padding: 9px 14px;
  border: 1px solid transparent;
}

.primary {
  background: var(--clay);
  color: white;
  border-color: var(--clay-dark);
}

.primary:hover { background: var(--clay-dark); }

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}

.ghost:hover { background: #f3eadb; }

.danger {
  background: transparent;
  border-color: #efc4c4;
  color: var(--bad);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(27, 23, 18, 0.42);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.modal {
  width: min(520px, 100%);
  background: var(--card);
  border-radius: 24px;
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow: auto;
}

.icon-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  color: var(--muted);
}

.modal h3 { font-size: 1.7rem; margin-bottom: 6px; }

.modal-file {
  color: var(--muted);
  margin-bottom: 18px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

input, select {
  font: inherit;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
}

.share-result, .existing-shares {
  margin-top: 22px;
  display: grid;
  gap: 12px;
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--navy);
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 30;
}

.share-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.share-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.share-card h1 {
  font-size: 2rem;
  margin: 8px 0 12px;
}

.share-card > p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

.logout {
  display: block;
  margin-top: 14px;
  color: #e7b07a;
}

.share-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  margin-bottom: 20px;
}

.form-error {
  color: var(--bad);
  font-size: 0.9rem;
}

.back-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--navy-2);
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { min-height: auto; }
  .stage { padding: 24px 18px 40px; }
  .file-row {
    grid-template-columns: 1fr;
  }
  .actions { justify-content: flex-start; }
}
