/* ═════════════ Motyw ═════════════ */
:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --border: #e3e5ee;
  --text: #12141c;
  --muted: #646a7d;
  --accent: #5b5bf0;
  --accent-2: #9b5cf6;
  --accent-soft: #ecebff;
  --danger: #dc3a40;
  --danger-soft: #fdecec;
  --success: #12a150;
  --success-soft: #e4f6eb;
  --shadow: 0 1px 2px rgb(16 18 35 / .05), 0 8px 24px rgb(16 18 35 / .06);
  --shadow-lg: 0 24px 64px rgb(16 18 35 / .22);
  --radius: 16px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c11; --surface: #14161e; --surface-2: #1b1e29; --border: #262a37;
    --text: #ececf3; --muted: #959bae; --accent: #7d7dff; --accent-2: #b085ff; --accent-soft: #23234a;
    --danger: #ff6369; --danger-soft: #3a1719; --success: #3dd68c; --success-soft: #0f2e20;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0c11; --surface: #14161e; --surface-2: #1b1e29; --border: #262a37;
  --text: #ececf3; --muted: #959bae; --accent: #7d7dff; --accent-2: #b085ff; --accent-soft: #23234a;
  --danger: #ff6369; --danger-soft: #3a1719; --success: #3dd68c; --success-soft: #0f2e20;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
  --shadow-lg: 0 24px 64px rgb(0 0 0 / .6);
  color-scheme: dark;
}

/* ═════════════ Podstawy ═════════════ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 5% -15%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 60%),
    radial-gradient(50rem 32rem at 105% 0%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 60%);
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.i, .logo { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i { width: 20px; height: 20px; }

/* ═════════════ Przyciski i pola ═════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s, filter .15s, transform .06s;
}
.btn .i { width: 18px; height: 18px; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); filter: brightness(1.08); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-ghost-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-ghost-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; height: 46px; }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn.loading::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; flex: none;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color .15s, color .15s; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

:where(.btn, .icon-btn, .user-btn, .tabs button, .dropzone, a):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, .field input, .field select {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field select:focus, .search input:focus, .pill-select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.pw { position: relative; }
.pw input { padding-right: 48px; }
.pw .icon-btn { position: absolute; right: 4px; top: 4px; }

.form-error {
  display: flex; gap: 8px; padding: 10px 12px; margin-bottom: 16px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 500;
}

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 4px; }
.strength i { height: 4px; border-radius: 2px; background: var(--border); transition: background-color .2s; }
.strength[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] i:nth-child(-n+2) { background: #f59e0b; }
.strength[data-score="3"] i:nth-child(-n+3) { background: #22c55e; }
.strength[data-score="4"] i { background: var(--success); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ═════════════ Logowanie ═════════════ */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 40px 56px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background: linear-gradient(150deg, #3730a3 0%, #5b21b6 50%, #9d174d 100%);
}
.auth-hero::before, .auth-hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgb(255 255 255 / .18), transparent 70%);
}
.auth-hero::before { width: 520px; height: 520px; right: -180px; top: -160px; }
.auth-hero::after { width: 420px; height: 420px; left: -160px; bottom: -180px; }
.auth-hero-body { position: relative; display: grid; gap: 20px; max-width: 520px; }
.auth-hero h1 { font-size: clamp(30px, 3.4vw, 46px); letter-spacing: -.03em; }
.lead { font-size: 17px; opacity: .88; }
.features { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 12px; }
.features li {
  display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-radius: 14px;
  background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .16); backdrop-filter: blur(8px);
}
.hero-foot { position: relative; font-size: 13px; opacity: .7; }
.auth-panel { position: relative; display: grid; place-items: center; padding: 40px 20px; }
.floating-theme { position: absolute; top: 16px; right: 16px; display: flex; gap: 6px; align-items: center; }
.lang-btn { min-width: 44px; letter-spacing: .04em; background: transparent; }
.auth-card { width: 100%; max-width: 430px; padding: 28px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 26px; border-radius: 12px; background: var(--surface-2); }
.tabs button {
  height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer; transition: background-color .15s, color .15s;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.form h2 { font-size: 24px; }
.form .sub { margin: 6px 0 22px; }
.switch { text-align: center; margin-top: 18px; font-size: 14px; }
.forgot-link { margin: -6px 0 16px; text-align: right; font-size: 13.5px; }
.forgot-link a { font-weight: 600; text-decoration: none; }
.form-ok { padding: 12px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--success-soft); color: var(--success); font-size: 14px; font-weight: 500; }
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch-row > span { display: grid; gap: 4px; }
.switch-row input {
  appearance: none; flex: none; width: 44px; height: 26px; margin: 2px 0 0; border-radius: 99px; cursor: pointer;
  background: var(--border); position: relative; transition: background-color .2s;
}
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(18px); }
.switch-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch a { font-weight: 600; text-decoration: none; }

@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 22px 30px; gap: 18px; }
  .auth-hero .features, .hero-foot { display: none; }
  .auth-hero h1 { font-size: 26px; }
  .lead { font-size: 15px; }
  .auth-panel { place-items: start center; padding: 24px 16px 40px; }
  .floating-theme { position: fixed; top: 14px; right: 14px; color: #fff; z-index: 5; }
}

/* ═════════════ Pasek górny ═════════════ */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.topbar {
  position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: saturate(1.6) blur(14px);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; letter-spacing: -.03em; color: var(--text); text-decoration: none; }
.brand--light { color: #fff; position: relative; }
.logo {
  width: 36px; height: 36px; padding: 7px; border-radius: 11px; color: #fff; stroke-width: 2;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand--light .logo { background: rgb(255 255 255 / .18); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.user-btn {
  display: flex; align-items: center; gap: 9px; padding: 4px 12px 4px 4px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.user-btn:hover { background: var(--surface-2); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  font-size: 13px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .user-name { display: none; } .user-btn { padding: 4px; } }

/* ═════════════ Panel ═════════════ */
.main { display: grid; gap: 20px; padding-top: 32px; padding-bottom: 72px; }
.greeting h1 { font-size: 30px; letter-spacing: -.03em; }
.greeting p { margin-top: 4px; }

.stats { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 16px; }
.stat { display: grid; align-content: start; gap: 4px; padding: 18px 20px; }
.stat strong { font-size: 26px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.meter { height: 8px; margin-top: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > div { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.meter.warn > div { background: linear-gradient(90deg, #f59e0b, #ef4444); }
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-wide { grid-column: 1 / -1; order: -1; }
}

.dropzone {
  padding: 38px 20px; text-align: center; cursor: pointer; border-radius: var(--radius);
  border: 2px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  transition: border-color .2s, background-color .2s, transform .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.dz-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.dz-icon .i { width: 28px; height: 28px; }
.dz-title { font-size: 16px; margin-bottom: 4px; }
.link { color: var(--accent); font-weight: 600; }

.queue { display: grid; gap: 8px; }
.queue:empty { display: none; }
.q-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; padding: 12px 10px 12px 16px; animation: fadein .2s ease; }
.q-info { min-width: 0; }
.q-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-item .meter { grid-column: 1 / -1; height: 6px; margin: 0 6px 0 0; }
.q-item.done .meter > div { background: var(--success); }
.q-item.error .meter > div { background: var(--danger); }
.q-item.error .q-status { color: var(--danger); }

.files-card { padding: 8px; }
.files-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 12px 10px; }
.files-head h2 { font-size: 19px; margin-right: auto; }
.files-tools { display: flex; gap: 8px; flex: 1 1 320px; justify-content: flex-end; }
.search { position: relative; flex: 1; max-width: 340px; }
.search .i { position: absolute; left: 13px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input, .pill-select {
  height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px;
}
.search input { width: 100%; padding: 0 14px 0 38px; }
.pill-select { padding: 0 14px; cursor: pointer; }

.file-list { display: grid; }
.file-row {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 12px; transition: background-color .12s; animation: fadein .25s ease;
}
.file-row:hover { background: var(--surface-2); }
.file-icon { --c: var(--accent); display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.k-image { --c: #0ea5e9; } .k-video { --c: #ef4444; } .k-audio { --c: #f59e0b; } .k-archive { --c: #b45309; }
.k-pdf { --c: #e11d48; } .k-doc { --c: #2563eb; } .k-sheet { --c: #16a34a; } .k-code { --c: #0d9488; } .k-file { --c: #8b5cf6; }
.file-main { min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--success-soft); color: var(--success); }
.badge .i { width: 13px; height: 13px; stroke-width: 2.2; }
.file-actions { display: flex; gap: 2px; }
@media (hover: hover) { .file-actions { opacity: .55; transition: opacity .15s; } .file-row:hover .file-actions, .file-row:focus-within .file-actions { opacity: 1; } }
@media (max-width: 560px) {
  .file-row { grid-template-columns: 42px minmax(0, 1fr); gap: 4px 12px; }
  .file-icon { width: 42px; height: 42px; }
  .file-actions { grid-column: 2; margin-left: -10px; }
  .files-tools { flex-basis: 100%; }
  .search { max-width: none; }
}
.empty { padding: 48px 20px 56px; text-align: center; }
.empty h3 { font-size: 18px; margin-bottom: 6px; }

.drop-overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 22%, rgb(8 10 20 / .55)); backdrop-filter: blur(3px);
}
.drop-overlay div { display: flex; align-items: center; gap: 12px; padding: 28px 40px; border: 2px dashed #fff; border-radius: 22px; color: #fff; font-size: 20px; font-weight: 700; }
.drop-overlay .i { width: 28px; height: 28px; }

/* ═════════════ Nawigacja i foldery ═════════════ */
.greeting { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.nav-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.nav-tabs a {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; transition: background-color .15s, color .15s;
}
.nav-tabs a .i { width: 18px; height: 18px; }
.nav-tabs a:hover { color: var(--text); }
.nav-tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (max-width: 600px) {
  .nav-tabs { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .nav-tabs a { flex-direction: column; justify-content: center; gap: 2px; height: 50px; padding: 0 4px; font-size: 11.5px; }
  .wide-only { display: none; }
  .folder-head-main { align-items: flex-start; }
  .folder-head-icon { width: 46px; height: 46px; border-radius: 14px; }
  .folder-head-icon .i { width: 24px; height: 24px; }
  .folder-head-text h2 { font-size: 20px; }
}

.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; margin-bottom: 2px; }
#folders-view { display: grid; }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.folder-card {
  display: grid; gap: 14px; padding: 18px; color: var(--text); text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s; animation: fadein .25s ease;
}
.folder-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--accent) 35%, transparent); }
.folder-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.folder-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: var(--accent); background: var(--accent-soft); }
.folder-icon .i { width: 26px; height: 26px; }
.folder-card h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card .owner { font-size: 13px; color: var(--muted); margin-top: 2px; }
.folder-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--border); }
.folder-stats span { display: inline-flex; align-items: center; gap: 5px; }
.folder-stats .i { width: 15px; height: 15px; }

.role-badge { --c: var(--muted); display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--c); background: color-mix(in srgb, var(--c) 13%, var(--surface)); }
.role-owner { --c: var(--accent); }
.role-manager { --c: #a855f7; }
.role-editor { --c: #2563eb; }
.role-contributor { --c: var(--success); }
.role-viewer { --c: #64748b; }

.folder-head { display: grid; gap: 14px; padding: 18px 20px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; width: max-content; font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted); }
.back-link:hover { color: var(--accent); }
.back-link .i { width: 16px; height: 16px; }
.folder-head-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.folder-head-icon { display: grid; place-items: center; width: 56px; height: 56px; flex: none; border-radius: 16px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.folder-head-icon .i { width: 28px; height: 28px; }
.folder-head-text { min-width: 0; display: grid; gap: 4px; }
.folder-head-text h2 { font-size: 22px; overflow-wrap: anywhere; }
.folder-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.folder-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.folder-head-actions #fh-members { margin-right: auto; }
@media (min-width: 760px) {
  .folder-head { grid-template-columns: 1fr auto; }
  .back-link { grid-column: 1 / -1; }
  .folder-head-actions #fh-members { margin-right: 0; }
}
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { width: 28px; height: 28px; font-size: 10px; letter-spacing: -.02em; border: 2px solid var(--surface); margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: -4px; }
.avatar.more { background: var(--surface-2); color: var(--muted); }

.note-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-size: 14px; }
.note-card .i { color: var(--muted); }
.uploader { display: inline-flex; align-items: center; gap: 4px; }
.uploader .i { width: 13px; height: 13px; }

/* Wybór poziomu dostępu */
.invite { padding-bottom: 6px; }
.invite h4, .section h4 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 14px; }
.invite h4 .i { width: 18px; height: 18px; color: var(--muted); }
.role-picker { border: 0; padding: 0; margin: 0 0 14px; }
.role-picker legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.role-picker .req { font-weight: 500; }
#role-options { display: grid; gap: 8px; }
.role-option {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: start;
  padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.role-option:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.role-option input { grid-row: span 2; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.role-option strong { font-size: 14px; }
.role-option span { font-size: 13px; color: var(--muted); }
.role-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.role-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.role-option.disabled { opacity: .5; cursor: not-allowed; }
@media (min-width: 560px) { #role-options { grid-template-columns: 1fr 1fr; } }

.member-list { display: grid; gap: 2px; margin: 0 -8px; }
.member { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.member:hover { background: var(--surface-2); }
.member .avatar { width: 36px; height: 36px; }
.member-info { min-width: 0; }
.member-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-name em { font-style: normal; font-weight: 500; color: var(--muted); }
.member-email { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member select { height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
@media (max-width: 480px) {
  .member { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .member > :nth-child(3) { grid-column: 2; justify-self: start; }
  .member > :nth-child(4) { grid-row: 1; grid-column: 3; }
}

/* ═════════════ Okna dialogowe ═════════════ */
.modal { width: 100%; max-width: min(500px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; background: transparent; color: var(--text); }
.modal-wide { max-width: min(620px, calc(100vw - 24px)); }
.modal::backdrop { background: rgb(8 10 20 / .5); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .18s ease; }
.modal-card { padding: 22px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-head h3 { font-size: 19px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions.reverse { flex-direction: row-reverse; justify-content: flex-start; }
#ask-input { margin-top: 12px; }
.file-title { margin-bottom: 16px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; overflow-wrap: anywhere; }
.note { display: flex; gap: 10px; padding: 12px; border-radius: 12px; background: var(--accent-soft); font-size: 13.5px; }
.note .i { color: var(--accent); width: 18px; height: 18px; margin-top: 1px; }
.copy-row { display: flex; gap: 8px; margin-bottom: 10px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 14px; }
.account-info { display: flex; align-items: center; gap: 14px; padding: 6px 0 18px; }
.account-info strong { font-size: 16px; }
.section { padding: 18px 0 4px; border-top: 1px solid var(--border); }
.section h4 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 14px; }
.section h4 .i { width: 18px; height: 18px; color: var(--muted); }
.danger-zone h4, .danger-zone h4 .i { color: var(--danger); }
.danger-zone > p { margin: -6px 0 14px; }

/* ═════════════ Powiadomienia ═════════════ */
.toasts { position: fixed; left: 50%; bottom: 20px; z-index: 100; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); translate: -50% 0; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; pointer-events: auto;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 500; animation: toastin .25s ease;
}
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.toast.success .i { color: var(--success); }
.toast.error .i { color: var(--danger); }

/* ═════════════ Strona udostępnienia ═════════════ */
.share-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.share-card { width: 100%; max-width: 440px; padding: 34px 28px; text-align: center; }
.share-card .file-icon { width: 72px; height: 72px; margin: 6px auto 18px; border-radius: 20px; }
.share-card .file-icon .i { width: 34px; height: 34px; }
.share-card h1 { font-size: 21px; overflow-wrap: anywhere; }
.share-meta { margin: 8px 0 24px; }
.share-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.share-foot { margin-top: 18px; font-size: 13px; }
.share-foot .i { width: 15px; height: 15px; vertical-align: -3px; }
#share-loading { margin: 24px auto; }

/* ═════════════ Ładowanie i animacje ═════════════ */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═════════════ Wersja 2: nawigacja w drzewie, zaznaczanie, kosz, podgląd, administracja ═════════════ */
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; gap: 6px; }
.btn-sm .i { width: 16px; height: 16px; }
.faint { opacity: .75; }
.auth-note { padding: 12px 14px; margin-bottom: 18px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }

/* Baner i panel wznawiania */
.banner, .resume-head { display: flex; align-items: center; gap: 14px; }
.banner { padding: 14px 16px; border-color: color-mix(in srgb, #f59e0b 45%, var(--border)); background: color-mix(in srgb, #f59e0b 7%, var(--surface)); }
.banner > .i { color: #d97706; }
.banner > div, .resume-head > div { display: grid; gap: 2px; flex: 1; min-width: 0; }
.resume { display: grid; gap: 12px; padding: 16px; }
.resume-head > .i { color: var(--accent); }
.resume-list { display: grid; gap: 6px; }
.resume-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.resume-row .q-info { flex: 1; }
.resume-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 560px) {
  .banner { flex-wrap: wrap; }
  .resume-row { flex-wrap: wrap; }
}

/* Okruszki */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; margin-right: auto; font-size: 19px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; letter-spacing: -.02em; }
a.crumb { color: var(--muted); text-decoration: none; font-size: 15px; padding: 2px 6px; margin: 0 -6px; border-radius: 8px; }
a.crumb:hover { color: var(--accent); background: var(--accent-soft); }
a.crumb .i { width: 17px; height: 17px; }
h2.crumb { font-size: 19px; }
.crumb-sep { color: var(--border); font-weight: 600; }

/* Narzędzia listy i pasek zaznaczenia */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 8px; }
.check-all { display: inline-flex; align-items: center; gap: 10px; padding-left: 2px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.list-actions, .bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bulk-bar {
  position: sticky; top: 72px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 4px 6px; padding: 8px 8px 8px 16px; border-radius: 12px; background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); animation: fadein .15s ease;
}
.bulk-bar strong { font-size: 14px; }
input.sel, .check-all input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; flex: none; }

/* Wiersze z polem zaznaczenia i podfoldery */
.file-row { grid-template-columns: 22px 46px minmax(0, 1fr) auto; }
.file-row.selected { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.file-row.is-dir .file-name { color: var(--text); text-decoration: none; display: block; }
.file-row.is-dir .file-name:hover { color: var(--accent); }
.file-icon { text-decoration: none; }
.k-dir { --c: #eab308; }
.file-icon.sm { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.file-icon.sm .i { width: 18px; height: 18px; }
.link-like { display: block; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.link-like:hover { color: var(--accent); }
.loc { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc:hover { color: var(--accent); }
.loc .i { width: 13px; height: 13px; flex: none; }
@media (max-width: 560px) {
  .file-row { grid-template-columns: 20px 42px minmax(0, 1fr); }
  .file-actions { grid-column: 3; }
  .crumbs { flex-basis: 100%; }
  .list-tools .wide-only { display: none; }
  .bulk-bar { top: 66px; }
}

/* Menu kontekstowe */
.menu {
  position: fixed; z-index: 90; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .12s ease;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
}
.menu button .i { width: 18px; height: 18px; color: var(--muted); }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button.danger, .menu button.danger .i { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }
.menu button[disabled] { opacity: .45; cursor: not-allowed; }
.menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--border); }

/* Listy w oknach dialogowych (kosz, wersje, wybór miejsca) */
.dialog-lead { margin: -4px 0 12px; overflow-wrap: anywhere; }
.dialog-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.dialog-bar.center { justify-content: center; margin: 12px 0 0; }
.dialog-bar.end { justify-content: flex-end; margin: 14px 0 0; }
.item-list { display: grid; gap: 2px; max-height: min(56vh, 520px); overflow: auto; margin: 0 -8px; padding: 0 2px; }
.item-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; cursor: default; }
label.item-row { cursor: pointer; }
.item-row:hover { background: var(--surface-2); }
.item-row.current { background: var(--accent-soft); }
.item-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
.item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 2px; flex: none; }
.target-list { display: grid; gap: 6px; max-height: 56vh; overflow: auto; }
.target-option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, background-color .15s;
}
.target-option:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.target-option .file-icon { width: 40px; height: 40px; border-radius: 11px; }

/* Drzewo wyboru miejsca (przenoszenie) */
.tree { display: grid; gap: 1px; max-height: min(52vh, 460px); overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 12px; }
.tree-row {
  display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 10px 0 calc(10px + var(--depth, 0) * 20px);
  border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 500;
}
.tree-row:hover { background: var(--surface-2); }
.tree-row .i { width: 18px; height: 18px; color: #eab308; }
.tree-row input { accent-color: var(--accent); margin: 0; }
.tree-row:has(input:checked) { background: var(--accent-soft); font-weight: 700; }
.tree-row.disabled { opacity: .45; cursor: not-allowed; }
.tree-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dziennik aktywności */
.activity-list { display: grid; gap: 2px; max-height: min(60vh, 560px); overflow: auto; margin: 0 -8px; }
.activity-row { display: flex; align-items: flex-start; gap: 12px; padding: 8px; border-radius: 12px; }
.activity-row:hover { background: var(--surface-2); }
.activity-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.activity-icon .i { width: 16px; height: 16px; }
.activity-text { display: grid; gap: 1px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.avatar.sm { width: 32px; height: 32px; font-size: 11px; }

/* Powiadomienie z działaniem („Cofnij”) */
.toast span { flex: 1; }
.toast-action {
  flex: none; margin: -4px -6px -4px 4px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--accent-2); font: inherit; font-weight: 700; cursor: pointer;
}
.toast-action:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }

/* Podgląd plików */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(6 7 12 / .94); color: #fff; overflow: hidden;
}
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); inset: 0; animation: none; }
.lightbox::backdrop { background: rgb(0 0 0 / .6); }
.lightbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 20px; background: rgb(0 0 0 / .35); }
.lightbox-title { display: grid; min-width: 0; }
.lightbox-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-title .muted { color: rgb(255 255 255 / .6); }
.lightbox-actions { display: flex; gap: 4px; flex: none; }
.lightbox .icon-btn { color: rgb(255 255 255 / .8); }
.lightbox .icon-btn:hover { background: rgb(255 255 255 / .12); color: #fff; }
.lightbox-body { display: grid; place-items: center; min-height: 0; padding: 16px 64px; overflow: auto; }
.pv-media { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
video.pv-media { width: auto; background: #000; }
.pv-frame { width: min(1000px, 100%); height: 100%; border: 0; border-radius: 6px; background: #fff; }
.pv-text {
  align-self: stretch; width: min(1000px, 100%); margin: 0; padding: 20px; overflow: auto; border-radius: 10px;
  background: #11131b; color: #e4e6ef; font: 13px/1.55 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere;
}
.pv-audio, .pv-fallback { display: grid; justify-items: center; gap: 18px; text-align: center; }
.pv-audio > .i, .pv-fallback > .i { width: 72px; height: 72px; opacity: .6; }
.pv-audio audio { width: min(420px, 80vw); }
.lightbox-nav {
  position: absolute; top: 50%; translate: 0 -50%; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / .12); color: #fff; cursor: pointer; transition: background-color .15s;
}
.lightbox-nav:hover { background: rgb(255 255 255 / .24); }
.lightbox-nav.prev { left: 10px; }
.lightbox-nav.next { right: 10px; }
.lightbox-nav[disabled] { opacity: 0; pointer-events: none; }
@media (max-width: 600px) {
  .lightbox-body { padding: 8px; }
  .lightbox-nav { top: auto; bottom: 14px; translate: none; }
}

/* Panel administratora */
#admin-view { display: grid; gap: 16px; }
.admin-stats { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .admin-stats { grid-template-columns: 1fr 1fr; } }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-card { padding: 18px 20px; display: grid; gap: 14px; align-content: start; }
.admin-card h3, .card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.admin-card h3 .i { width: 18px; height: 18px; color: var(--muted); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.card-head .input { height: 38px; max-width: 260px; }
.checks { display: grid; gap: 6px; }
.check { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.check-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; }
.check-icon .i { width: 16px; height: 16px; }
.check.ok .check-icon { color: var(--success); background: var(--success-soft); }
.check.warn .check-icon { color: #d97706; background: color-mix(in srgb, #f59e0b 16%, var(--surface)); }
.check.fail .check-icon { color: var(--danger); background: var(--danger-soft); }
.check > div { display: grid; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.check-word { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.check.fail .check-word { color: var(--danger); }
.check.warn .check-word { color: #d97706; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; min-width: 0; height: 40px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.user-table { display: grid; gap: 2px; margin: 0 -8px; }
.user-row {
  display: grid; grid-template-columns: 36px minmax(0, 1.4fr) minmax(140px, 1fr) minmax(0, .9fr) auto; align-items: center; gap: 14px;
  padding: 10px 8px; border-radius: 12px;
}
.user-row:hover { background: var(--surface-2); }
.user-row.is-disabled { opacity: .6; }
.user-row .avatar { width: 36px; height: 36px; }
.user-main { display: grid; min-width: 0; }
.user-main > .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.user-usage { display: grid; gap: 4px; }
.user-usage .meter { margin: 0; height: 6px; }
.user-facts { display: grid; }
.role-danger { --c: var(--danger); }
.role-warn { --c: #d97706; }
@media (max-width: 760px) {
  .user-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .user-usage, .user-facts { grid-column: 2; }
  .user-row > .icon-btn { grid-row: 1; grid-column: 3; }
}

/* Strona linku z hasłem */
.share-card form { display: grid; gap: 12px; text-align: left; }
.share-card .pv-inline { display: block; max-width: 100%; max-height: 50vh; margin: 0 auto 18px; border-radius: 12px; }
.share-card audio.pv-inline { width: 100%; }

/* ═════════════ Wersja 3: galeria, ulubione, notatki, komentarze, linki, strony publiczne ═════════════ */
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .02em; }
.file-name .i, .tile-star .i { width: 15px; height: 15px; color: #f5b301; margin-right: 4px; vertical-align: -2px; }
.badge.warn { background: color-mix(in srgb, #f59e0b 16%, var(--surface)); color: #b45309; }
.file-icon.has-thumb { padding: 0; overflow: hidden; background: var(--surface-2); }
.file-icon.has-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-more { padding: 14px; text-align: center; font-size: 13px; color: var(--muted); }
.view-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.pill-select.sm { height: 32px; padding: 0 10px; font-size: 13px; }

/* Opcje wysyłania (pod strefą upuszczania) */
.upload-opts { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: -10px; font-size: 13px; color: var(--muted); }
.upload-opts label { display: inline-flex; align-items: center; gap: 6px; }
.upload-opts .i { width: 15px; height: 15px; }

/* Galeria */
.file-list.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 6px 8px 10px; }
.tile { position: relative; display: grid; grid-template-rows: auto auto; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); overflow: hidden; animation: fadein .2s ease; transition: border-color .15s, box-shadow .15s; content-visibility: auto; contain-intrinsic-size: 180px; }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent) 45%, transparent); }
.tile.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.tile-thumb {
  --c: var(--accent); position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; width: 100%; padding: 0; border: 0; cursor: pointer;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface-2)); overflow: hidden; text-decoration: none;
}
.tile-thumb > .i { width: 38px; height: 38px; }
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-play { position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgb(0 0 0 / .55); color: #fff; }
.tile-play .i { width: 15px; height: 15px; }
.tile-star { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgb(255 255 255 / .85); }
.tile-star .i { margin: 0; }
.tile-foot { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 4px 6px 10px; }
.tile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; color: var(--text); text-decoration: none; }
.tile-more { width: 32px; height: 32px; }
.tile .sel { width: 16px; height: 16px; }
@media (max-width: 560px) { .file-list.grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } }

/* Edytor notatek */
.modal.editor { max-width: min(980px, calc(100vw - 24px)); width: 100%; }
.editor-card { display: flex; flex-direction: column; gap: 10px; height: min(86dvh, 900px); }
.editor-card > .editor-area, .editor-card > .md-view { flex: 1; min-height: 0; }
.editor-card > .note { margin: 0; }
.editor-card .modal-head { margin: 0; }
.editor-title { display: grid; min-width: 0; }
.editor-title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.editor-area, .md-view { width: 100%; height: 100%; min-height: 240px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.editor-area { resize: none; padding: 16px; font: 14px/1.6 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; tab-size: 2; }
.editor-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.md-view { overflow: auto; padding: 18px 22px; background: var(--surface); line-height: 1.65; }
.md-view h1, .md-view h2, .md-view h3 { margin: 18px 0 8px; } .md-view h1:first-child, .md-view h2:first-child { margin-top: 0; }
.md-view p, .md-view ul, .md-view ol, .md-view pre, .md-view blockquote { margin: 0 0 12px; }
.md-view pre { padding: 12px; border-radius: 10px; background: var(--surface-2); overflow: auto; }
.md-view code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.md-view pre code { padding: 0; background: none; }
.md-view blockquote { padding-left: 14px; border-left: 3px solid var(--border); color: var(--muted); }
.md-view li.task { list-style: none; margin-left: -20px; }
.md-view hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* Komentarze */
.comment-list { display: grid; gap: 10px; max-height: min(50vh, 460px); overflow: auto; margin: 0 -4px 12px; padding: 0 4px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.comment.mine .comment-body { background: var(--accent-soft); }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.comment-head .icon-btn { width: 28px; height: 28px; margin-left: auto; }
.comment-body p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.comment-form textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.comment-form .dialog-bar { margin: 8px 0 0; }

/* Okno linków */
.small-tabs { margin-bottom: 14px; }
.check-row { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.list-sub { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }
.note { margin-bottom: 14px; }

/* Ustawienia konta */
#acc-extra .section:first-child { border-top: 1px solid var(--border); }
.item-list.compact { max-height: 260px; }
.secret { display: grid; gap: 6px; margin: 6px 0 12px; padding: 12px; border-radius: 12px; background: var(--success-soft); }
.secret .copy-row { margin: 4px 0 0; }

/* Strony publiczne: folder i prośba o pliki */
.pub-page { display: grid; gap: 16px; width: 100%; max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; align-content: start; min-height: 100vh; }
.pub-head { display: flex; justify-content: center; padding: 6px 0 4px; }
.pub-page > .share-card { justify-self: center; }
#pub-loading { margin: 60px auto; }
.pub-title { display: flex; align-items: center; gap: 14px; padding: 18px 20px; flex-wrap: wrap; }
.pub-title .folder-head-text { flex: 1; }
.pub-title h1 { font-size: 22px; overflow-wrap: anywhere; }
.pub-form { display: grid; gap: 6px; padding: 18px 20px; }
.pub-form .field { margin-bottom: 8px; }
.pub-note { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.pub-note .i { width: 16px; height: 16px; }
.pub-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
#pub-upload, #pub-view { display: grid; gap: 16px; }
#pub-upload[hidden], #pub-view[hidden] { display: none; }
@media (max-width: 560px) { .pub-row { grid-template-columns: 42px minmax(0, 1fr) auto; } .pub-row .file-actions { grid-column: auto; margin: 0; } }

.narrow-only { display: none; }
@media (max-width: 600px) { .narrow-only { display: inline; } }
@media (max-width: 880px) { .floating-theme .lang-btn { color: inherit; border-color: color-mix(in srgb, currentColor 40%, transparent); } }

/* ═════════════ Animacje (wersja 3.1) ═════════════
   Zasada: jedna sekwencja wejścia po zalogowaniu, reszta to krótkie odpowiedzi na działania użytkownika.
   Wszystko ≤ 0,4 s (poza wejściem), łagodna krzywa, bez zapętlonych efektów poza paskiem wysyłania. */
:root { --ease-out: cubic-bezier(.22, 1, .36, 1); }

/* strona logowania: karta i opis pojawiają się raz, delikatnie */
.auth-card { animation: rise .55s var(--ease-out) both .05s; }
.auth-hero-body { animation: rise .6s var(--ease-out) both; }
.form { animation: fade-swap .28s var(--ease-out); }
.form-error { animation: shake .4s var(--ease-out); }

/* wejście po zalogowaniu: sekcje po kolei, potem pierwsze wiersze plików */
.intro .greeting, .intro .stats, .intro .dropzone, .intro .files-card, .intro .banner { animation: rise .55s var(--ease-out) both; }
.intro .stats { animation-delay: .06s; }
.intro .dropzone { animation-delay: .12s; }
.intro .files-card { animation-delay: .18s; }
.intro .stat strong { animation: count-in .7s var(--ease-out) both .25s; }
.intro .file-row, .intro .tile { animation: rise .45s var(--ease-out) both; }
.intro .file-row:nth-child(1), .intro .tile:nth-child(1) { animation-delay: .28s; }
.intro .file-row:nth-child(2), .intro .tile:nth-child(2) { animation-delay: .32s; }
.intro .file-row:nth-child(3), .intro .tile:nth-child(3) { animation-delay: .36s; }
.intro .file-row:nth-child(4), .intro .tile:nth-child(4) { animation-delay: .40s; }
.intro .file-row:nth-child(5), .intro .tile:nth-child(5) { animation-delay: .44s; }
.intro .file-row:nth-child(n+6), .intro .tile:nth-child(n+6) { animation-delay: .48s; }

/* przełączanie widoków */
#folders-view:not([hidden]), #admin-view:not([hidden]) { animation: fade-swap .3s var(--ease-out); }
.meter > div { transition: width .7s var(--ease-out); }

/* przyciski: lekkie wciśnięcie */
.btn { transition: background-color .15s, border-color .15s, color .15s, box-shadow .2s, transform .12s var(--ease-out); }
.btn:active, .icon-btn:active { transform: scale(.96); }
.btn-primary:hover { box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }

/* strefa wysyłania */
.dz-icon { transition: transform .3s var(--ease-out), background-color .2s; }
.dropzone:hover .dz-icon, .dropzone.over .dz-icon { transform: translateY(-4px); }
.dropzone.over .dz-icon .i { animation: nudge 1s var(--ease-out) infinite; }
.drop-overlay { animation: fade .15s ease; }
.drop-overlay div { animation: pop .3s var(--ease-out); }

/* kolejka wysyłania: ruchome prążki w trakcie, „zielony błysk” po zakończeniu */
.q-item { animation: slide-down .3s var(--ease-out); }
.q-item:not(.done):not(.error) .meter > div {
  background-image: linear-gradient(90deg, var(--accent), var(--accent-2)), repeating-linear-gradient(-45deg, rgb(255 255 255 / .28) 0 8px, transparent 8px 16px);
  background-blend-mode: overlay; background-size: 100% 100%, 22px 22px; animation: stripes .8s linear infinite;
}
.q-item.done { animation: done-flash .9s var(--ease-out); }
.q-item.error { animation: shake .4s var(--ease-out); }

/* miniatury: płynne pojawienie się po wczytaniu */
.file-icon.has-thumb img, .tile-thumb img { animation: fade .4s ease; }
.tile-thumb img { transition: transform .4s var(--ease-out); }
.tile:hover .tile-thumb img { transform: scale(1.03); }

/* okna, menu, powiadomienia */
.modal[open] { animation: modal-in .26s var(--ease-out); }
.modal::backdrop { animation: fade .2s ease; }
.menu { transform-origin: top right; animation: menu-in .16s var(--ease-out); }
.toast { animation: toast-in .35s var(--ease-out); }
.lightbox[open] { animation: fade .2s ease; }
.pv-media { animation: zoom-in .3s var(--ease-out); }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-swap { from { opacity: 0; transform: translateY(6px); } }
@keyframes count-in { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes menu-in { from { opacity: 0; transform: scale(.95); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes zoom-in { from { opacity: 0; transform: scale(.97); } }
@keyframes stripes { to { background-position: 0 0, 22px 0; } }
@keyframes done-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 45%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes nudge { 50% { transform: translateY(-3px); } }
