*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: #ffffff;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 48px;
  border-bottom: 1px solid #e6e3df;
}

.logo { display: inline-block; line-height: 0; }

.header-right { display: flex; align-items: center; gap: 12px; }

/* ── Main ── */
main {
  flex: 1;
  padding: 64px 48px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ── Typography ── */
h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 2.3rem;
  font-weight: 400;
  color: #14110f;
  margin: 0 0 10px;
  line-height: 1.2;
}

h2 {
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: #14110f;
  margin: 0 0 20px;
}

.subtitle {
  color: #5a5a5a;
  margin: 0 0 52px;
  font-size: 1rem;
}

/* ── Form ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group { margin-bottom: 24px; }

label {
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4a4a4a;
  margin-bottom: 8px;
  font-weight: 600;
}

.optional { color: #8a8a8a; font-weight: 400; }

.field-hint {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #6a6a6a;
  text-transform: none;
  letter-spacing: 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid #c9c4bd;
  color: #1a1a1a;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder, textarea::placeholder { color: #9a958e; }

input:focus, textarea:focus {
  border-color: #cc3322;
  box-shadow: 0 0 0 3px rgba(204, 51, 34, 0.12);
}
textarea { resize: none; min-height: 72px; overflow: hidden; }

/* ── Drop zone ── */
.drop-zone {
  border: 2px dashed #c9c4bd;
  border-radius: 6px;
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 24px;
  user-select: none;
  background: #fbfaf9;
}

.drop-zone:hover,
.drop-zone:focus { border-color: #cc3322; background: rgba(204, 51, 34, 0.05); outline: none; }
.drop-zone.dragover { border-color: #cc3322; border-style: solid; background: rgba(204, 51, 34, 0.09); }

.drop-zone-icon { font-size: 2.2rem; color: #b5aea4; margin-bottom: 14px; line-height: 1; }
.drop-zone p { color: #555; margin: 0; font-size: 1rem; }
.drop-zone span { color: #cc3322; font-weight: 600; }

/* ── File list ── */
.file-list { margin-bottom: 32px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #eceae7;
}

.file-name { flex: 1; color: #1a1a1a; font-size: 0.95rem; word-break: break-all; }
.file-size { color: #777; font-size: 0.82rem; white-space: nowrap; flex-shrink: 0; }

.remove-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 2px;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}
.remove-btn:hover { color: #cc3322; background: rgba(204, 51, 34, 0.08); }

/* ── Buttons ── */
.btn {
  display: inline-block;
  background: #cc3322;
  color: #fff;
  border: none;
  padding: 13px 28px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn:hover { background: #aa2a1a; }
.btn:disabled { background: #e6ddd9; color: #a89e96; cursor: not-allowed; }

.btn-secondary {
  background: #ffffff;
  border: 1px solid #c9c4bd;
  color: #444;
}
.btn-secondary:hover { background: #f6f4f2; border-color: #a39d95; color: #1a1a1a; }

.btn-ghost {
  background: transparent;
  border: none;
  color: #666;
  padding: 8px 0;
}
.btn-ghost:hover { background: transparent; color: #1a1a1a; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn-trash {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  transition: color 0.1s, background 0.1s;
}
.btn-trash:hover { color: #cc3322; background: rgba(204, 51, 34, 0.08); }

/* ── Progress ── */
.progress-section { padding-top: 32px; }
.progress-label { color: #555; font-size: 0.9rem; margin: 0 0 14px; }
.progress-track { background: #ececea; border-radius: 2px; height: 4px; overflow: hidden; }
.progress-bar { background: #cc3322; height: 100%; width: 0; transition: width 0.3s ease; }
.progress-pct { color: #cc3322; font-size: 2.2rem; font-family: Georgia, serif; margin-top: 20px; }

/* ── Admin table ── */
.admin-nav { margin-bottom: 40px; display: flex; align-items: center; justify-content: space-between; }
.admin-nav h1 { margin: 0; }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; border: 1px solid #e2e0dd; }

th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555;
  padding: 10px 14px;
  background: #f6f5f3;
  border: 1px solid #e2e0dd;
  font-weight: 600;
}

td {
  padding: 12px 14px;
  border: 1px solid #ececea;
  color: #333;
  vertical-align: top;
}

.col-client .client-name { display: block; color: #1a1a1a; }
.col-client .client-email { display: block; color: #666; font-size: 0.84rem; }
.col-files .file-total { display: block; color: #777; font-size: 0.8rem; }
.col-date { white-space: nowrap; }
.col-opens { color: #666; font-size: 0.88rem; white-space: nowrap; vertical-align: middle; text-align: right; }
.col-actions { vertical-align: middle; }

.notes-row td { padding-top: 4px; padding-bottom: 12px; }
.notes-cell { color: #666; font-size: 0.84rem; font-style: italic; white-space: pre-wrap; }

.sent-history-row td { padding-top: 0; }
.sent-history-cell { padding-bottom: 12px !important; }
.sent-history { display: flex; flex-direction: column; gap: 2px; }

.sent-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 10px;
  font-size: 0.82rem;
  border-left: 2px solid #d8d3cc;
}

.sent-date { color: #666; white-space: nowrap; }
.sent-files { color: #888; white-space: nowrap; }
.sent-opens { color: #777; white-space: nowrap; }
.sent-notes { color: #777; font-style: italic; flex: 1; min-width: 0; overflow: hidden; overflow-wrap: break-word; }

.sent-link {
  color: #777;
  font-size: 0.74rem;
  text-decoration: none;
  white-space: nowrap;
}
.sent-link:hover { color: #cc3322; }

.btn-copy {
  background: #fff;
  border: 1px solid #cfcac4;
  color: #666;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 3px;
  font-family: inherit;
  transition: color 0.1s, border-color 0.1s;
  white-space: nowrap;
  margin-left: auto;
}
.btn-copy:hover { color: #cc3322; border-color: #cc3322; }

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2e7d32;
  background: #eaf5ea;
  border: 1px solid #b8ddb8;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  font-weight: 600;
}


/* ── Flash messages ── */
.flash {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 28px;
  font-size: 0.92rem;
}
.flash-success { background: #eaf5ea; border: 1px solid #b8ddb8; color: #256d29; }
.flash-error   { background: #fdecea; border: 1px solid #f3c4bd; color: #b3271a; }

/* ── Download page ── */
.notes-block {
  background: #faf9f7;
  border: 1px solid #e4dfd9;
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 32px;
}
.notes-label { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: #666; margin: 0 0 6px; font-weight: 600; }
.notes-text { color: #2a2a2a; font-size: 0.95rem; margin: 0; white-space: pre-wrap; }

.download-list { margin: 32px 0; }

.download-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eceae7;
}
.download-item:last-child { border-bottom: none; }
.download-name { flex: 1; color: #1a1a1a; font-size: 0.95rem; word-break: break-all; }
.download-size { color: #777; font-size: 0.82rem; white-space: nowrap; flex-shrink: 0; }
.download-link { color: #cc3322; font-size: 0.88rem; text-decoration: none; white-space: nowrap; flex-shrink: 0; font-weight: 600; }
.download-link:hover { color: #aa2a1a; text-decoration: underline; }

.expiry-notice { color: #6a6a6a; font-size: 0.82rem; margin-top: 32px; }

/* ── Success / error states ── */
.success-state { text-align: center; padding: 40px 0; }
.success-mark { font-family: Georgia, serif; font-size: 3rem; color: #cc3322; margin: 0 0 16px; line-height: 1; }
.success-state h1 { margin-bottom: 10px; }

.error-state { padding: 40px 0; }
.error-state h1 { margin-bottom: 12px; }

/* ── Admin login ── */
.login-wrap { max-width: 360px; }
.login-wrap h1 { margin-bottom: 36px; }

/* ── Admin send ── */
.back-link { color: #666; font-size: 0.88rem; text-decoration: none; display: inline-block; margin-bottom: 32px; }
.back-link:hover { color: #1a1a1a; }

/* ── Empty state ── */
.empty-state { color: #6a6a6a; padding: 40px 0; }

/* ── Footer ── */
footer {
  padding: 24px 48px;
  border-top: 1px solid #e6e3df;
  text-align: center;
  color: #888;
  font-size: 0.82rem;
}

footer a { color: #777; text-decoration: none; }
footer a:hover { color: #1a1a1a; }

/* ── Responsive ── */
@media (max-width: 640px) {
  header { padding: 22px 24px; }
  main { padding: 40px 24px; }
  footer { padding: 20px 24px; }
  h1 { font-size: 1.9rem; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .drop-zone { padding: 40px 20px; }
}
