:root {
  --red: #c9182b;
  --red-dark: #9f1020;
  --ink: #181715;
  --charcoal: #24211f;
  --stone: #6f6962;
  --cream: #f5f1eb;
  --warm-white: #fdfbf8;
  --line: #e5ddd3;
  --green: #217a57;
  --amber: #9b6300;
  --shadow: 0 22px 65px rgba(44, 34, 26, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { letter-spacing: -0.035em; }
h2 { letter-spacing: -0.025em; }

.hidden { display: none !important; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.eyebrow, .step-kicker {
  margin-bottom: 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.step-kicker { color: var(--stone); font-size: 11px; }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 19px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, .icon-button:focus-visible, .drop-zone:focus-visible, .text-link:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(201, 24, 43, 0.24);
  outline-offset: 2px;
}

.button.primary { background: var(--red); color: #fff; box-shadow: 0 8px 24px rgba(201, 24, 43, 0.22); }
.button.primary:hover { background: var(--red-dark); }
.button.secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button.secondary:hover { border-color: #c9bdb1; background: var(--warm-white); }
.button.ghost-on-dark { border-color: rgba(255, 255, 255, 0.25); background: transparent; color: #fff; }
.button.ghost-on-dark:hover { border-color: rgba(255, 255, 255, 0.55); }
.button.text-button { min-height: auto; padding: 3px 0; border: 0; border-radius: 0; color: var(--red); background: transparent; }
.button.large { min-height: 52px; padding: 14px 24px; font-size: 15px; }
.button.small { min-height: 38px; padding: 8px 15px; font-size: 13px; }
.button.wide { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: 0.52; transform: none; }

.text-link { color: var(--red); font-weight: 700; text-underline-offset: 4px; }
.text-link-button { border: 0; padding: 3px; color: var(--red); background: transparent; font-size: 13px; font-weight: 700; }

input, textarea, select {
  width: 100%;
  border: 1px solid #d8cec3;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  line-height: 1.4;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input, select { min-height: 47px; }
textarea { resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #bcaea0; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(201, 24, 43, 0.08); outline: none; }
.field-label { display: block; margin: 21px 0 8px; color: #332f2b; font-size: 13px; font-weight: 750; }
.field-label:first-child { margin-top: 0; }
.field-label span { color: var(--stone); font-weight: 400; }

.form-error { min-height: 19px; margin: 12px 0 0; color: var(--red-dark); font-size: 13px; line-height: 1.45; }
.notice { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 13px; padding: 13px 16px; background: #fff; font-size: 14px; line-height: 1.5; }
.notice.warning { border-color: #efd79f; background: #fff8e7; color: #704700; }
.notice.success { border-color: #bcdcca; background: #f0faf4; color: #185d41; }
.notice.error { border-color: #efbdc3; background: #fff1f3; color: #8a1120; }

/* Landing */
.landing-page {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  background:
    radial-gradient(circle at 88% 14%, rgba(201, 24, 43, 0.10), transparent 30%),
    linear-gradient(145deg, #fbf8f3, #eee7de);
}

.landing-shell {
  width: min(720px, calc(100% - 40px));
  margin: auto;
  padding: 70px 0 45px;
  text-align: center;
}

.landing-logo { width: min(360px, 78vw); margin: 0 auto 54px; }
.landing-shell h1 { max-width: 680px; margin: 0 auto 22px; font-size: clamp(42px, 7vw, 72px); line-height: 1.02; }
.landing-copy { max-width: 590px; margin: 0 auto 28px; color: var(--stone); font-size: 17px; line-height: 1.7; }
.simple-footer { padding: 24px; color: var(--stone); font-size: 12px; text-align: center; }

/* Authentication */
.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(22, 19, 17, 0.58), rgba(22, 19, 17, 0.72)),
    radial-gradient(circle at 15% 20%, #9d7a69, #25201e 62%);
}

.auth-card {
  width: min(430px, 100%);
  border-radius: 22px;
  padding: 38px;
  background: rgba(255, 253, 250, 0.98);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

.auth-logo { width: 250px; margin: 0 auto 36px; }
.auth-card h1 { margin-bottom: 26px; font-size: 39px; line-height: 1.06; }
.auth-card .button { margin-top: 18px; }

/* Admin */
.admin-page { background: #f3efe9; }
.admin-header {
  display: flex;
  min-height: 124px;
  align-items: center;
  justify-content: space-between;
  padding: 14px max(24px, calc((100vw - 1220px) / 2));
  background: var(--charcoal);
  color: #fff;
}

.admin-logo { width: 190px; max-height: 112px; object-fit: contain; object-position: left center; }
.admin-header-actions { display: flex; align-items: center; gap: 20px; }
.service-label { color: rgba(255, 255, 255, 0.62); font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.dashboard-shell { width: min(1220px, calc(100% - 42px)); margin: 0 auto; padding: 48px 0 80px; }
.dashboard-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.dashboard-intro h1 { margin-bottom: 12px; font-size: clamp(40px, 5vw, 61px); line-height: 1.02; }
.dashboard-intro p:last-child { max-width: 690px; margin-bottom: 0; color: var(--stone); line-height: 1.65; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--warm-white); box-shadow: var(--shadow); }
.create-panel { margin: 28px 0 50px; padding: 32px; }
.panel-heading, .section-heading, .contents-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-heading { margin-bottom: 28px; }
.panel-heading h2, .section-heading h2, .contents-heading h2 { margin: 0; font-size: 34px; }
.icon-button { display: inline-grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--stone); font-size: 24px; line-height: 1; }
.icon-button:hover { border-color: #c8bbae; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(330px, 0.82fr); gap: 44px; }
.recipient-fieldset { margin: 27px 0 0; padding: 0; border: 0; }
.recipient-fieldset legend { margin-bottom: 10px; color: #332f2b; font-size: 13px; font-weight: 750; }
.recipient-row { display: grid; grid-template-columns: minmax(120px, 0.75fr) minmax(200px, 1.25fr) 38px; gap: 9px; margin-bottom: 9px; }
.recipient-row .icon-button { margin-top: 4px; }
.recipient-row:only-child .remove-recipient { visibility: hidden; }
.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.drop-zone {
  display: flex;
  min-height: 286px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1.5px dashed #c9bcb0;
  border-radius: 18px;
  padding: 30px 24px;
  background: #f8f4ee;
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.drop-zone.dragging { border-color: var(--red); background: #fff1f3; transform: scale(1.008); }
.drop-icon { display: grid; width: 52px; height: 52px; place-items: center; margin-bottom: 16px; border-radius: 50%; background: var(--red); color: #fff; font-size: 27px; }
.drop-zone strong { margin-bottom: 7px; font-family: Georgia, serif; font-size: 23px; font-weight: 400; }
.drop-zone > span { color: var(--stone); font-size: 13px; line-height: 1.5; }
.picker-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.file-summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 15px; border-bottom: 1px solid var(--line); padding: 0 2px 13px; }
.file-summary strong, .file-summary span { display: block; }
.file-summary strong { font-size: 14px; }
.file-summary span { margin-top: 3px; color: var(--stone); font-size: 12px; }
.file-summary.empty strong { color: var(--stone); }
.file-preview-list, .public-file-list { margin: 0; padding: 0; list-style: none; }
.file-preview-list { max-height: 160px; overflow: auto; }
.file-preview-list li, .public-file-list li { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid #ece5dd; padding: 10px 2px; font-size: 13px; }
.file-preview-list li span:first-child, .public-file-list li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview-list li span:last-child, .public-file-list li span:last-child { flex: 0 0 auto; color: var(--stone); }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 15px; color: var(--stone); font-size: 12px; line-height: 1.45; }
.check-row input { width: 17px; min-height: 17px; margin: 0; accent-color: var(--red); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-top: 30px; border-top: 1px solid var(--line); padding-top: 25px; }
.form-actions p { max-width: 610px; margin: 0; color: var(--stone); font-size: 12px; line-height: 1.55; }
.deliveries-section { margin-top: 38px; }
.section-heading { margin-bottom: 18px; }
.delivery-list { display: grid; gap: 13px; }
.empty-deliveries { border: 1px dashed #cdbfb2; border-radius: 18px; padding: 45px 24px; color: var(--stone); text-align: center; }
.delivery-card { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(170px, 0.55fr) minmax(165px, 0.5fr) auto; align-items: center; gap: 24px; border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; background: #fff; box-shadow: 0 6px 20px rgba(54, 43, 34, 0.04); }
.delivery-title { min-width: 0; }
.delivery-title h3 { margin: 0 0 6px; overflow: hidden; font-family: Georgia, serif; font-size: 20px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.delivery-title p, .delivery-stat span, .delivery-expiry span { margin: 0; color: var(--stone); font-size: 12px; line-height: 1.45; }
.delivery-recipients { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 7px; border-radius: 999px; padding: 5px 9px; background: #f0eee9; color: #5d5751; font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.status-pill.ready { background: #eaf6ef; color: var(--green); }
.status-pill.uploading, .status-pill.draft { background: #fff4d8; color: var(--amber); }
.status-pill.revoked, .status-pill.expired, .status-pill.deleted { background: #f3e9ea; color: #8b3c47; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.delivery-stat { display: flex; gap: 18px; }
.delivery-stat strong, .delivery-expiry strong { display: block; margin-bottom: 3px; font-size: 15px; }
.delivery-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.delivery-actions .button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.delivery-actions .danger { border-color: #efd0d4; color: #9b1828; }
.delivery-actions .danger:hover { background: #fff3f4; }
.email-note { display: inline-block; margin-top: 7px; color: var(--stone); font-size: 11px; }
.email-note.failed { color: var(--red-dark); }

/* Additional recipient dialog */
.recipient-dialog { width: min(520px, calc(100% - 32px)); max-width: none; border: 0; border-radius: 22px; padding: 0; background: transparent; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34); }
.recipient-dialog::backdrop { background: rgba(25, 22, 20, 0.76); backdrop-filter: blur(7px); }
.recipient-dialog-card { border: 1px solid var(--line); border-radius: 22px; padding: 32px; background: var(--warm-white); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-heading h2 { margin: 0; font-size: 34px; line-height: 1.08; }
.dialog-copy { margin: 20px 0 0; color: var(--stone); font-size: 14px; line-height: 1.6; }
.dialog-delivery { margin: 15px 0 23px; border-left: 3px solid var(--red); padding: 4px 0 4px 12px; color: var(--stone); font-size: 13px; line-height: 1.5; }
.dialog-delivery strong { color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 21px; }

/* Progress */
.progress-overlay { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(25, 22, 20, 0.78); backdrop-filter: blur(7px); }
.progress-card { width: min(530px, 100%); border-radius: 23px; padding: 39px; background: #fff; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34); text-align: center; }
.progress-monogram, .state-monogram { width: 72px; height: 72px; margin: 0 auto 20px; object-fit: contain; }
.progress-card h2 { margin-bottom: 10px; font-size: 32px; }
.progress-card > p:not(.eyebrow):not(.progress-note) { color: var(--stone); }
.progress-track { height: 11px; margin-top: 28px; overflow: hidden; border-radius: 999px; background: #ece5dd; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red), #e35061); transition: width 180ms ease; }
.progress-numbers { display: flex; justify-content: space-between; margin-top: 9px; color: var(--stone); font-size: 12px; font-variant-numeric: tabular-nums; }
.progress-note { margin: 26px 0 0; color: #8b837b; font-size: 12px; }

/* Public transfer */
.transfer-page { background: var(--warm-white); }
.transfer-header { position: relative; z-index: 5; display: flex; min-height: 124px; align-items: center; justify-content: space-between; padding: 8px max(24px, calc((100vw - 1180px) / 2)); background: var(--charcoal); color: #fff; }
.transfer-logo { width: 190px; max-height: 112px; object-fit: contain; object-position: left center; }
.transfer-header > span { color: rgba(255, 255, 255, 0.62); font-size: 11px; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
.transfer-state { min-height: calc(100vh - 184px); }
.centered-state { display: grid; place-items: center; padding: 45px 22px; text-align: center; }
.centered-state > p { color: var(--stone); }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; transform: scale(0.96); } }
.lock-card, .error-card { width: min(500px, 100%); border: 1px solid var(--line); border-radius: 22px; padding: 40px; background: #fff; box-shadow: var(--shadow); }
.lock-card h1, .error-card h1 { margin-bottom: 14px; font-size: 42px; line-height: 1.08; }
.lock-card > p:not(.eyebrow):not(.form-error), .error-card > p:not(.eyebrow) { color: var(--stone); line-height: 1.6; }
.lock-card form { display: grid; gap: 10px; margin-top: 24px; }
.muted { filter: grayscale(1); opacity: 0.55; }
.transfer-content { width: min(1180px, calc(100% - 42px)); margin: 0 auto; padding: 48px 0 80px; }
.transfer-hero { display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(360px, 0.95fr); min-height: 570px; overflow: hidden; border-radius: 24px; background: #f0eae2; box-shadow: var(--shadow); }
.transfer-hero:not(:has(.cover-wrap:not(.hidden))) { grid-template-columns: 1fr; min-height: 510px; }
.transfer-hero:not(:has(.cover-wrap:not(.hidden))) .transfer-hero-copy { max-width: 760px; margin: auto; text-align: center; }
.cover-wrap { min-height: 570px; overflow: hidden; background: #d6cec6; }
.cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.transfer-hero-copy { display: flex; align-items: flex-start; justify-content: center; flex-direction: column; padding: clamp(35px, 5.5vw, 72px); }
.transfer-hero-copy h1 { max-width: 570px; margin-bottom: 7px; font-size: clamp(49px, 6vw, 77px); line-height: 0.98; }
.maltese-line { margin-bottom: 28px; color: var(--red); font-family: Georgia, serif; font-size: 16px; font-style: italic; }
.transfer-hero-copy h2 { margin: 0 0 13px; font-family: Arial, sans-serif; font-size: 17px; font-weight: 750; letter-spacing: 0; }
.client-message { max-width: 570px; margin: 0 0 25px; color: #514b45; font-size: 15px; line-height: 1.7; white-space: pre-line; }
.download-button { margin-top: 8px; }
.package-detail { margin: 16px 0 4px; color: #4e4842; font-size: 13px; font-weight: 700; }
.expiry-detail { margin: 0; color: var(--stone); font-size: 12px; }
.contents-panel { margin-top: 30px; border: 1px solid var(--line); border-radius: 20px; padding: 28px 32px; background: #fff; }
.contents-heading { margin-bottom: 14px; }
.contents-heading > span { color: var(--stone); font-size: 12px; }
.public-file-list li { padding: 13px 3px; font-size: 14px; }
.contents-panel > .button { margin-top: 18px; }
.transfer-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding: 22px max(24px, calc((100vw - 1180px) / 2)); color: var(--stone); font-size: 12px; }
.transfer-footer a { color: var(--red); font-weight: 700; }

@media (max-width: 1000px) {
  .form-grid { grid-template-columns: 1fr; }
  .file-picker-column { max-width: none; }
  .delivery-card { grid-template-columns: 1fr 0.55fr 0.55fr; }
  .delivery-actions { grid-column: 1 / -1; justify-content: flex-start; border-top: 1px solid var(--line); padding-top: 13px; }
  .transfer-hero { grid-template-columns: 1fr; }
  .cover-wrap { min-height: min(62vw, 560px); max-height: 620px; }
}

@media (max-width: 700px) {
  .admin-header, .transfer-header { min-height: 100px; padding: 7px 18px; }
  .admin-logo, .transfer-logo { width: 145px; max-height: 86px; }
  .service-label, .transfer-header > span { display: none; }
  .admin-header-actions { gap: 8px; }
  .dashboard-shell, .transfer-content { width: min(100% - 28px, 1180px); padding-top: 31px; }
  .dashboard-intro { align-items: flex-start; flex-direction: column; }
  .dashboard-intro h1 { font-size: 43px; }
  .create-panel { padding: 22px 17px; }
  .panel-heading h2, .section-heading h2 { font-size: 29px; }
  .recipient-row { grid-template-columns: 1fr 38px; }
  .recipient-email { grid-column: 1 / 2; }
  .remove-recipient { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .two-column-fields { grid-template-columns: 1fr; gap: 0; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button { width: 100%; }
  .delivery-card { grid-template-columns: 1fr 1fr; gap: 17px; padding: 18px; }
  .delivery-title { grid-column: 1 / -1; }
  .delivery-actions { grid-column: 1 / -1; }
  .recipient-dialog-card { padding: 27px 20px 22px; }
  .dialog-heading h2 { font-size: 30px; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
  .progress-card, .lock-card, .error-card { padding: 30px 22px; }
  .transfer-hero { min-height: 0; }
  .transfer-hero-copy { padding: 40px 24px 45px; }
  .transfer-hero-copy h1 { font-size: 49px; }
  .contents-panel { padding: 24px 19px; }
  .contents-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .transfer-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
