:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --ok: #16a34a;
  --danger: #dc2626;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); }
main { flex: 1; padding: 24px 16px 48px; }
.top { padding: 18px 24px; }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 16px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 30px rgba(0,0,0,.05);
  max-width: 620px; margin: 0 auto; padding: 32px;
}
.card.narrow { max-width: 400px; }
.card.wide-card { max-width: 1100px; }
h1 { font-size: 24px; margin: 0 0 6px; line-height: 1.25; }
h2 { font-size: 20px; margin: 8px 0; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 32px 0; }
.nowrap { white-space: nowrap; }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 0; }
label .muted { font-weight: 400; }
input:not([type=file]):not([type=hidden]):not([type=checkbox]), textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.stack > * + * { margin-top: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #f9fafb; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; margin-top: 18px; padding: 13px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* strefa upuszczania */
.drop {
  margin-top: 20px; border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 28px 18px;
  text-align: center; cursor: pointer; transition: .15s; background: #fafbfc;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #eff6ff; }
.drop:focus-visible { outline: 2px solid var(--accent); }
.drop-icon {
  width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.drop-title { font-weight: 700; font-size: 17px; }
.drop.has-files .drop-icon { width: 36px; height: 36px; font-size: 20px; }
.filelist { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; max-height: 280px; overflow: auto; }
.filelist li, .dl-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #fff;
  border: 1px solid var(--line); margin-top: 6px;
}
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { color: var(--muted); font-size: 13px; white-space: nowrap; }
.filelist .rm { border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.filelist .rm:hover { color: var(--danger); }
.filelist li.active { border-color: var(--accent); }
.filelist li.ok .fsize::after { content: " ✓"; color: var(--ok); }
.summary { margin-top: 8px; font-size: 13px; }
.uploader.busy .drop { cursor: default; }

.progress { margin-top: 18px; }
.bar { height: 10px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.ptext { margin-top: 6px; font-size: 13px; }

.error { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 10px; margin: 14px 0 0; }
.flash { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; padding: 10px 12px; border-radius: 10px; }

.done { text-align: center; padding: 16px 0 0; }
.check {
  width: 64px; height: 64px; margin: 8px auto; border-radius: 50%; background: var(--ok); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.linkbox { display: flex; gap: 8px; margin: 16px 0; }
.linkbox input { margin: 0; }

.dl-list { list-style: none; padding: 0; margin: 20px 0 0; }
.msg { margin: 18px 0 0; padding: 12px 16px; background: #f8fafc; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; }

/* panel */
.admin-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 8px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.badge { background: #eef2ff; color: var(--accent); border-radius: 99px; padding: 1px 8px; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); }
.list td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list .actions { white-space: nowrap; text-align: right; }
.list .actions > * { margin: 2px 0 2px 4px; }
form.inline { display: inline; }
.clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; background: #fef3c7; color: #92400e; padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.admin .card .uploader { max-width: 640px; }
.admin #done { max-width: 640px; }

@media (max-width: 600px) {
  .card { padding: 22px 18px; }
  .grid2 { grid-template-columns: 1fr; }
  .list .actions { white-space: normal; }
}

/* ---------- telefon / aplikacja ---------- */
.on-touch { display: none; }
@media (pointer: coarse) {
  .on-desktop { display: none; }
  .on-touch { display: inline; }
}
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.wa:hover { background: #1ebe5a; }
.share-row { display: flex; gap: 6px; flex-wrap: wrap; }
.share-big { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0 0 12px; }
.share-big .btn { padding: 13px; font-size: 16px; }
.request-box {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 14px;
}
details.more { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
details.more summary { cursor: pointer; font-weight: 600; }
details.more[open] { padding-bottom: 14px; }
label.check-row { display: flex; align-items: center; gap: 8px; font-weight: 400; text-align: left; }
label.check-row input { width: 18px; height: 18px; margin: 0; }

/* tryb aplikacji (ikona na ekranie głównym) */
@media (display-mode: standalone) {
  .top { padding-top: max(18px, env(safe-area-inset-top)); }
  .foot { display: none; }
}

@media (max-width: 700px) {
  main { padding: 8px 10px 32px; }
  .top { padding: 12px 14px; }
  .card { padding: 20px 16px; border-radius: 12px; }
  h1 { font-size: 21px; }
  input:not([type=file]):not([type=hidden]):not([type=checkbox]), textarea, select { font-size: 16px; } /* iOS nie powiększa */
  .drop { padding: 22px 14px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs a { white-space: nowrap; padding: 10px 12px; }
  .request-box .share-row { width: 100%; }
  .request-box .share-row .btn { flex: 1; }

  /* tabela jako karty */
  table.list thead { display: none; }
  table.list, .list tbody, .list tr, .list td { display: block; width: 100%; }
  .list tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  .list td { border: 0; padding: 3px 0; }
  .list td[data-label] { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
  .list td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .list td[data-label] .clip { display: none; }
  .list td.who { font-size: 15px; padding-bottom: 6px; }
  .list .clip { max-width: 100%; }
  .clip-names { display: block; overflow-wrap: anywhere; }
  .list .actions { text-align: left; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
  .list .actions > * { margin: 0; }
  .list .actions .btn { flex: 1 1 auto; padding: 9px 10px; }
  .list .actions form.inline { display: flex; gap: 6px; flex: 1 1 100%; }
  .list .actions form.inline .btn { flex: 1; }
}
