:root {
  /* DaisyUI Colour System */
  --p: #1d4ed8;
  --pf: #1e40af;
  --pc: #ffffff;
  --s: #64748b;
  --sf: #475569;
  --sc: #ffffff;
  --b1: #ffffff;
  --b2: #f8fafc;
  --b3: #e2e8f0;
  --bc: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --border: #cbd5e1;
  --su: #15803d;
  --su-bg: #f0fdf4;
  --su-border: #bbf7d0;
  --er: #b91c1c;
  --er-bg: #fef2f2;
  --er-border: #fecaca;
  --wa: #b45309;
  --wa-bg: #fffbeb;

  /* Typography & Sizing */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--bc);
  background: var(--b2);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  --rounded-box: 12px;
  --rounded-btn: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.07), 0 2px 4px -2px rgb(15 23 42 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(15 23 42 / 0.08), 0 4px 6px -4px rgb(15 23 42 / 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button, input {
  font: inherit;
}

button, a, input {
  touch-action: manipulation;
}

::selection {
  background: #dbeafe;
  color: #1e3a8a;
}

:focus-visible {
  outline: 2px solid var(--p);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* Skip link */
.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  padding: 10px 16px;
  background: var(--b1);
  color: var(--p);
  font-weight: 600;
  border-radius: var(--rounded-btn);
  box-shadow: var(--shadow-md);
  z-index: 50;
  transition: top 0.15s ease;
}

.skip:focus {
  top: 16px;
}

/* Header */
header {
  border-bottom: 1px solid var(--b3);
  background: var(--b1);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 16px;
}

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

.brand-icon {
  color: var(--p);
  flex-shrink: 0;
}

.brand {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.015em;
  color: var(--bc);
}

/* Buttons */
button {
  cursor: pointer;
  background: var(--p);
  border: 1px solid var(--p);
  border-radius: var(--rounded-btn);
  color: var(--pc);
  font-weight: 600;
  padding: 10px 20px;
  min-height: 44px;
  font-size: 0.9375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

button:hover {
  background: var(--pf);
  border-color: var(--pf);
}

button:active {
  transform: scale(0.99);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

button.secondary {
  color: var(--bc);
  background: var(--b1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Main container */
main {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 60px;
  flex: 1;
}

/* Cards */
.card {
  background: var(--b1);
  border: 1px solid var(--b3);
  border-radius: var(--rounded-box);
  box-shadow: var(--shadow-sm);
  padding: 32px;
}

.card-header {
  margin-bottom: 24px;
}

.badge-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: var(--p);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

h1 {
  font-size: 1.625rem;
  line-height: 1.25;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bc);
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--bc);
}

p {
  margin: 0 0 16px;
  color: var(--muted);
}

.subtitle {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0;
  max-width: 58ch;
}

.section-sub {
  font-size: 0.875rem;
  color: var(--subtle);
  margin: 0;
}

/* Login Panel */
#login-panel {
  max-width: 460px;
  margin: 32px auto 0;
}

.form-control {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0 0 6px;
  color: var(--bc);
}

input:not([type=file]) {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--rounded-btn);
  padding: 10px 14px;
  background: var(--b1);
  color: var(--bc);
  font-size: 0.9375rem;
  caret-color: var(--p);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type=file])::placeholder {
  color: #94a3b8;
}

input:not([type=file]):focus {
  outline: none;
  border-color: var(--p);
  box-shadow: 0 0 0 3px rgb(29 78 216 / 0.12);
}

#login-panel button[type=submit] {
  width: 100%;
  margin-top: 8px;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--b3);
  color: var(--subtle);
}

.card-footer svg {
  flex-shrink: 0;
  color: #94a3b8;
}

.card-footer .help {
  margin: 0;
  font-size: 0.8125rem;
}

.help {
  font-size: 0.875rem;
  color: var(--subtle);
  margin: 0;
}

/* File Picker */
.file-picker {
  margin: 24px 0 0;
}

.picker-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--rounded-btn);
  background: #fbfcfd;
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.picker-dropzone:hover {
  border-color: var(--p);
  background: #eff6ff;
}

.picker-icon {
  color: var(--p);
  margin-bottom: 12px;
}

.picker-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bc);
  margin-bottom: 8px;
}

.picker-dropzone input[type=file] {
  margin: 6px 0 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

input::file-selector-button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--b1);
  padding: 8px 14px;
  color: var(--bc);
  margin-right: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

input::file-selector-button:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* Transfer in progress */
#transfer {
  margin-top: 24px;
}

.transfer-box {
  background: var(--b2);
  border: 1px solid var(--b3);
  border-radius: var(--rounded-btn);
  padding: 20px;
}

.transfer-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.transfer-name-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--p);
}

.transfer-name-group strong {
  overflow-wrap: anywhere;
  color: var(--bc);
  font-size: 0.9375rem;
}

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#progress-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bc);
  margin: 0;
}

progress {
  width: 100%;
  height: 10px;
  border-radius: 9999px;
  overflow: hidden;
  border: none;
  background: var(--b3);
  display: block;
}

progress::-webkit-progress-bar {
  background: var(--b3);
  border-radius: 9999px;
}

progress::-webkit-progress-value {
  background: var(--p);
  border-radius: 9999px;
}

progress::-moz-progress-bar {
  background: var(--p);
  border-radius: 9999px;
}

#progress-detail {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Uploads Section */
.uploads-section {
  margin-top: 36px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.empty-state {
  background: var(--b1);
  border: 1px dashed var(--border);
  border-radius: var(--rounded-btn);
  padding: 36px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #94a3b8;
  margin-bottom: 20px;
}

.empty-state svg {
  margin-bottom: 10px;
}

.empty-state p {
  margin: 0;
  font-size: 0.9375rem;
}

.uploads {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.upload {
  padding: 16px 20px;
  background: var(--b1);
  border: 1px solid var(--b3);
  border-radius: var(--rounded-btn);
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 20px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.upload:hover {
  border-color: #cbd5e1;
}

.upload-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--bc);
  overflow-wrap: anywhere;
  margin-bottom: 4px;
}

.upload-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0;
}

.reference {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  color: var(--subtle);
  margin: 6px 0 0;
}

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

.upload-actions button.secondary {
  padding: 6px 14px;
  min-height: 36px;
  font-size: 0.8125rem;
}

.retention-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--b1);
  border: 1px solid var(--b3);
  border-radius: var(--rounded-btn);
  color: var(--subtle);
}

.retention-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #94a3b8;
}

.retention-note p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* Alerts */
#message:not(:empty) {
  border: 1px solid var(--su-border);
  background: var(--su-bg);
  color: var(--su);
  padding: 14px 18px;
  border-radius: var(--rounded-btn);
  font-size: 0.875rem;
  font-weight: 500;
  margin: 24px 0 0;
  box-shadow: var(--shadow-sm);
}

#error:not(:empty) {
  border: 1px solid var(--er-border);
  background: var(--er-bg);
  color: var(--er);
  padding: 14px 18px;
  border-radius: var(--rounded-btn);
  font-size: 0.875rem;
  font-weight: 500;
  margin: 24px 0 0;
  box-shadow: var(--shadow-sm);
}

/* Footer */
footer {
  border-top: 1px solid var(--b3);
  background: var(--b1);
  color: var(--subtle);
  font-size: 0.8125rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.trust-badge svg {
  color: var(--p);
}

.footer-text {
  color: var(--subtle);
  font-size: 0.75rem;
}

/* Responsive */
@media (max-width: 640px) {
  .header-inner {
    padding: 14px 18px;
  }

  .brand {
    font-size: 1rem;
  }

  main {
    padding: 24px 16px 40px;
  }

  .card {
    padding: 24px 18px;
  }

  h1 {
    font-size: 1.375rem;
  }

  .upload {
    grid-template-columns: 1fr;
    padding: 14px 16px;
  }

  .upload-actions {
    margin-top: 4px;
  }

  .transfer-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .footer-inner {
    padding: 20px 18px;
  }

  .footer-badges {
    flex-direction: column;
    gap: 8px;
  }
}
