/* CloudDrop — dark, professional, mobile-first.
   No framework, no build step. CSS custom properties for theming. */

:root {
  color-scheme: dark;

  /* Surface palette (deep slate) */
  --bg:           #0b1120;
  --bg-2:         #0f172a;
  --surface:      #131c2e;
  --surface-2:    #1c2740;
  --border:       #283656;
  --border-2:     #364663;

  /* Text */
  --text:         #e2e8f0;
  --text-strong:  #f8fafc;
  --text-muted:   #94a3b8;
  --text-faint:   #64748b;

  /* Accent (sky/blue) */
  --accent:       #38bdf8;
  --accent-hi:    #7dd3fc;
  --accent-lo:    #0284c7;
  --accent-on:    #001a2e;

  /* Semantic */
  --error:        #f87171;
  --error-bg:     #3a0d0d;
  --error-border: #5e1a1a;
  --success:      #4ade80;

  /* Geometry */
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;

  --shadow-sm:    0 1px 2px rgba(0,0,0,0.35);
  --shadow:       0 4px 14px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.25);
  --shadow-lg:    0 12px 36px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3);

  /* Spacing rhythm (4px base, doubled for major) */
  --gap-1: 0.25rem;
  --gap-2: 0.5rem;
  --gap-3: 0.75rem;
  --gap-4: 1rem;
  --gap-5: 1.25rem;
  --gap-6: 1.5rem;
  --gap-8: 2rem;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  font-feature-settings: "ss01", "cv02";
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(56, 189, 248, 0.07), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(99, 102, 241, 0.08), transparent 60%);
  background-attachment: fixed;
}

::selection { background: rgba(56, 189, 248, 0.35); color: var(--text-strong); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }

h1, h2, h3 {
  margin: 0;
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 { font-size: 1.5rem; line-height: 1.2; }
h2 { font-size: 1rem;   line-height: 1.3; }

.muted        { color: var(--text-muted); }
.text-faint   { color: var(--text-faint); }
.inline       { display: inline; }
.count        { color: var(--text-muted); font-weight: 500; font-size: 0.875rem; }

/* === Top bar === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(11, 17, 32, 0.78);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--gap-3) var(--gap-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-4);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-2);
  color: var(--text-strong);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--text-strong); }
.brand-name  { font-size: 1.05rem; }

/* === Brand mark (logo) === */
.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: var(--accent-on);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--gap-5);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.brand-mark-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  margin: 0;
}

/* === Container === */
.container {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--gap-5) var(--gap-4) calc(var(--gap-8) + env(safe-area-inset-bottom)) var(--gap-4);
}

/* === Panels (cards) === */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gap-5);
  margin-bottom: var(--gap-4);
  box-shadow: var(--shadow-sm);
}
.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-3);
  margin-bottom: var(--gap-4);
}

.storage-usage {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: baseline;
  gap: var(--gap-2);
  white-space: nowrap;
}
.storage-sep { opacity: 0.5; }

/* === Forms === */
.field { margin-bottom: var(--gap-4); }

label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--gap-2);
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  display: block;
  width: 100%;
  padding: 0.75rem 0.875rem;
  background: var(--bg-2);
  color: var(--text-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;          /* keep at 16px on iOS to suppress auto-zoom */
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover {
  border-color: var(--border-2);
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
  background: var(--bg);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-2);
  min-height: 44px;
  padding: 0.625rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-strong);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover    { background: var(--border); }
.btn:active   { transform: translateY(1px); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-on);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 1px 2px rgba(0,0,0,0.4);
}
.btn-primary:hover  { background: var(--accent-hi); }
.btn-primary:active { background: var(--accent-lo); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  min-height: 36px;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-strong); }

.btn-block { width: 100%; }

/* === Login === */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gap-6) var(--gap-4);
  padding-top: max(var(--gap-6), env(safe-area-inset-top));
  padding-bottom: max(var(--gap-6), env(safe-area-inset-bottom));
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-8);
  text-align: left;
  box-shadow: var(--shadow-lg);
}
.login-card .brand-mark { display: flex; }
.login-card h1 {
  font-size: 1.75rem;
  margin-bottom: var(--gap-1);
}
.login-card .muted {
  margin: 0 0 var(--gap-6) 0;
}

/* === Upload === */
.upload {
  display: flex;
  flex-direction: column;
  gap: var(--gap-3);
}
.file-picker {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  padding: var(--gap-3) var(--gap-4);
  background: var(--bg-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
  position: relative;
  min-height: 64px;
}
.file-picker:hover { border-color: var(--accent); background: rgba(56, 189, 248, 0.05); }

.upload-modal-content { min-width: min(420px, 92vw); }
.upload-modal .modal-body { gap: var(--gap-3); }
.upload-status {
  margin: 0;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.upload-progress-row {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  width: 100%;
}
.upload-progress {
  flex: 1;
  height: 10px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  -webkit-appearance: none;
  appearance: none;
}
.upload-progress::-webkit-progress-bar {
  background: var(--surface-2);
  border-radius: 999px;
}
.upload-progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  border-radius: 999px;
  transition: width 0.15s ease;
}
.upload-progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}
.upload-progress:not([value]) {
  /* indeterminate state — gentle animated stripe so the user knows the
     request is in flight even before the first progress event. */
  background:
    linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.4), transparent),
    var(--surface-2);
  background-size: 30% 100%, 100% 100%;
  background-repeat: no-repeat, no-repeat;
  background-position: -30% 0, 0 0;
  animation: upload-indeterminate 1.2s linear infinite;
}
@keyframes upload-indeterminate {
  from { background-position: -30% 0, 0 0; }
  to   { background-position: 130% 0, 0 0; }
}
.upload-progress-pct {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 4em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.file-picker.drag-over {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(56, 189, 248, 0.12);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}
.file-picker:focus-within {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
.file-picker input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-picker-icon {
  flex: 0 0 36px;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.file-picker-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

/* === File list === */
.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-2);
}

/* file-row is now a flex container with a clickable download link AND a
   sibling delete form. The download link styling lives on .file-row-link. */
.file-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  transition: border-color 120ms ease, background 120ms ease;
  overflow: hidden;
}
.file-row:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
}
.file-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.file-row-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  padding: var(--gap-3);
  color: var(--text);
  text-decoration: none;
  transition: color 120ms ease, transform 80ms ease;
  -webkit-tap-highlight-color: transparent;
}
.file-row-link:hover { color: var(--text-strong); }
.file-row-link:active { transform: translateY(1px); }

.file-row-share,
.file-row-delete {
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--border);
}
.file-row-share { padding: 0; background: transparent; border-top: 0; border-bottom: 0; border-right: 0; }

.file-row .btn-icon,
.file-row-delete .btn-icon-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.file-row .btn-icon:hover {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}
.file-row .btn-icon:focus-visible {
  outline: none;
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent);
}
.file-row-delete .btn-icon-danger:hover {
  background: rgba(248, 113, 113, 0.12);
  color: var(--error);
}
.file-row-delete .btn-icon-danger:focus-visible {
  outline: none;
  background: rgba(248, 113, 113, 0.16);
  color: var(--error);
}

.file-icon {
  flex: 0 0 44px;
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--surface-2), var(--border));
  color: var(--accent-hi);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid var(--border);
}

.file-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.file-name {
  font-weight: 500;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}
.file-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.file-action {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color 120ms;
}
.file-row:hover .file-action { color: var(--accent); }

/* === Empty === */
.empty {
  text-align: center;
  padding: var(--gap-6) var(--gap-4);
}
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  margin-bottom: var(--gap-3);
}
.empty p { margin: 0.25rem 0; }

/* === Alerts === */
.alert {
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.875rem;
  font-size: 0.9rem;
  margin-bottom: var(--gap-4);
  border: 1px solid transparent;
}
.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}

/* === Share links (owner UI) === */
.share-blurb { margin-top: 0; margin-bottom: var(--gap-4); }

.share-create {
  display: flex;
  flex-direction: column;
  gap: var(--gap-3);
  margin-bottom: var(--gap-4);
}

.share-form {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--gap-3);
}

.share-form-row {
  display: flex;
  flex-direction: column;
  gap: var(--gap-3);
  align-items: stretch;
}

.share-field { display: flex; flex-direction: column; gap: var(--gap-1); }
.share-field-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.share-field-readout {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 0.75rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.share-field-grow   { flex: 1; min-width: 0; }
.share-field-narrow { flex: 0 0 120px; }
.share-field-pair   { flex: 0 0 200px; }
.share-field-button { flex: 0 0 auto; }

/* Phantom label above the submit button. Hidden on mobile (button is full-width
   below the inputs anyway). On desktop it takes up the same vertical space as
   a real label so all three columns have identical top/bottom edges. */
.share-field-label-spacer { display: none; }

.share-form select,
.share-form input[type="number"] {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 0.75rem;
  background: var(--surface);
  color: var(--text-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95rem;
  -webkit-appearance: none;
  appearance: none;
}
.share-form select:focus,
.share-form input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.share-form-submit { align-self: stretch; }

.share-list-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.share-list {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 640px;
}
.share-list thead th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.share-list tbody td {
  padding: 0.625rem 0.75rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  background: var(--bg-2);
}
.share-list tbody tr:first-child td { border-top: 0; }
.share-row-dead td { opacity: 0.55; }

.share-kind {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-2);
  white-space: nowrap;
  line-height: 1.4;
}
.share-kind-download { color: var(--accent-hi); border-color: rgba(56, 189, 248, 0.3); }
.share-kind-upload   { color: #a5b4fc;          border-color: rgba(99, 102, 241, 0.35); }

.share-target { color: var(--text-strong); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-expiry {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.muted-hint {
  display: block;
  font-weight: 400;
  text-transform: none;
  color: var(--text-faint);
  font-size: 0.7rem;
  letter-spacing: 0;
  margin-top: 1px;
}

.field-pair {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.field-pair-num { flex: 1 1 4.5rem; min-width: 4.5rem; }
.field-pair-unit { flex: 1 1 6rem; }

.share-target-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fcd34d;
  border: 1px solid rgba(252, 211, 77, 0.35);
  vertical-align: 1px;
}
.share-uses { white-space: nowrap; color: var(--text); }

.share-url-cell {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
  min-width: 240px;
}
.share-url {
  flex: 1;
  min-width: 160px;
  padding: 0.4rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  -webkit-appearance: none;
  appearance: none;
}
.share-url:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
.share-copy {
  flex: 0 0 auto;
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  min-height: 32px;
}
.share-actions { white-space: nowrap; }

/* === Share modal (native <dialog>) === */
dialog.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: calc(100vw - 2rem);
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop {
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.modal-form { display: flex; flex-direction: column; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-3);
  padding: var(--gap-4) var(--gap-5);
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.modal-target {
  color: var(--accent);
  font-weight: 500;
}

.btn-icon-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  flex: 0 0 auto;
}
.btn-icon-close:hover { background: var(--surface-2); color: var(--text-strong); }

.modal-body  { padding: var(--gap-5); display: flex; flex-direction: column; gap: var(--gap-3); }
.modal-meta  { margin: 0; font-size: 0.85rem; }
.modal-hint  { margin: 0; font-size: 0.85rem; }

.modal-body .field { margin: 0; }
.modal-body .field-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--gap-2);
}
.modal-body input[type="number"],
.modal-body select.field-select,
.field-select {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 0.75rem;
  background: var(--bg-2);
  color: var(--text-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}
.modal-body input[type="number"]:focus,
.modal-body select.field-select:focus,
.field-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

.qr-body { align-items: center; }
.qr-image {
  width: 280px;
  height: 280px;
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.qr-url-text {
  margin: 0;
  font-size: 0.78rem;
  word-break: break-all;
  text-align: center;
}
.share-qr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.share-qr-btn svg { display: block; }
.share-qr-btn:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent);
  color: var(--accent-hi);
}
.share-qr-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--gap-2);
  padding: var(--gap-4) var(--gap-5);
  border-top: 1px solid var(--border);
}

/* === Anonymous share pages === */
.anon-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gap-6) var(--gap-4);
  padding-top: max(var(--gap-6), env(safe-area-inset-top));
  padding-bottom: max(var(--gap-6), env(safe-area-inset-bottom));
}
.anon-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--gap-8);
  box-shadow: var(--shadow-lg);
  text-align: left;
}
.anon-card h1 {
  font-size: 1.5rem;
  margin-bottom: var(--gap-1);
}
.anon-card .muted {
  margin: 0 0 var(--gap-5) 0;
}
.anon-card .upload {
  margin-top: var(--gap-2);
}

.anon-target {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  padding: var(--gap-3);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  margin-bottom: var(--gap-4);
}
.anon-target-info { flex: 1; min-width: 0; }
.anon-target-name {
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.anon-target-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 2px;
}
.anon-uses {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: var(--gap-4) 0 0 0;
}

/* === Wider screens === */
@media (min-width: 720px) {
  .container { padding: var(--gap-8) var(--gap-5) var(--gap-8) var(--gap-5); }
  .panel    { padding: var(--gap-6); }
  .upload   { flex-direction: row; align-items: stretch; }
  .upload .file-picker {
    flex: 1;
    min-height: 52px;
    height: 52px;
    padding: 0 var(--gap-3);    /* center via flex; height pins both visually */
  }
  .upload .file-picker-icon { width: 28px; height: 28px; flex-basis: 28px; }
  .upload .btn-primary {
    min-height: 52px;
    height: 52px;
    min-width: 130px;
  }
  h1        { font-size: 1.625rem; }

  .share-form-row {
    flex-direction: row;
    align-items: stretch;   /* every column has the same label+control structure */
    gap: var(--gap-3);
  }
  .share-field-label-spacer {
    display: block;
    visibility: hidden;     /* takes the line's vertical space without showing */
  }
  .share-form-submit {
    width: 100%;
    height: 44px;
    min-height: 44px;
    min-width: 170px;
  }
}

@media (min-width: 1024px) {
  .login-card { padding: 2.5rem; }
}

/* === Reduced motion respect === */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
