/* Panel plików NEA i strona udostępnionych plików.
   Korzysta ze zmiennych kolorów z głównego /styles.css (jasny i ciemny motyw). */

.fp-ico { display: inline-grid; place-items: center; flex: 0 0 auto; line-height: 0; }
.fp-ico svg { width: 18px; height: 18px; }
.button .fp-ico svg { width: 17px; height: 17px; }
.button { gap: 7px; }
.fp-noscroll { overflow: hidden; }
/* Atrybut hidden musi wygrywać z display:flex/grid z klas poniżej */
[hidden] { display: none !important; }
.fp-muted { color: var(--muted); font-size: 13px; margin: 0; }
.fp-danger-text { color: var(--bad) !important; }
.fp-danger-solid { color: #fff !important; background: var(--bad) !important; border-color: transparent !important; }
kbd { font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--field); color: var(--text-soft); }

/* ---------- Nagłówek strony ---------- */
.fp-main { padding-block: 34px 70px; }
.fp-titlebar { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.fp-titlebar h1 { margin: 2px 0 0; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.045em; line-height: 1.05; }
.fp-titlebar-actions { display: flex; gap: 8px; align-items: center; }
.fp-split { display: inline-flex; }
.fp-split > .button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.fp-split-more { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; padding-inline: 9px !important; border-left: 1px solid rgba(0,0,0,.18) !important; }

/* ---------- Dysk i statystyki ---------- */
.fp-stats { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 18px; }
.fp-storage, .fp-stat { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 13px 16px; min-width: 0; }
.fp-storage-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.fp-storage-line strong { color: var(--text); font-weight: 650; }
.fp-storage-track { height: 7px; border-radius: 99px; background: var(--hover); overflow: hidden; margin-top: 11px; }
.fp-storage-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.fp-storage-fill.warn { background: linear-gradient(90deg, var(--warn), var(--bad)); }
.fp-stat { display: grid; gap: 1px; }
.fp-stat span { color: var(--muted); font-size: 12px; }
.fp-stat strong { font-size: 19px; letter-spacing: -.02em; }
.fp-stat small { color: var(--muted-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Zakładki ---------- */
.fp-tabs { display: flex; gap: 4px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.fp-tab { border: 1px solid transparent; background: none; color: var(--muted); font-weight: 650; font-size: 14px; padding: 8px 14px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.fp-tab:hover { color: var(--text); background: var(--hover-soft); }
.fp-tab.active { color: var(--text); background: var(--hover); border-color: var(--line); }
.fp-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); font-size: 11px; display: inline-grid; place-items: center; }

/* ---------- Panel ---------- */
.fp-panel { border: 1px solid var(--line); background: var(--file-panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: clip; }
.fp-panel-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fp-panel-title { display: grid; gap: 1px; padding-left: 4px; }
.fp-panel-title span { color: var(--muted); font-size: 13px; }
.fp-head-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.fp-crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1 1 260px; overflow-x: auto; scrollbar-width: none; }
.fp-crumbs::-webkit-scrollbar { display: none; }
.fp-crumb { border: 1px solid transparent; background: none; color: var(--muted); padding: 5px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 14px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.fp-crumb:hover { color: var(--text); background: var(--hover); }
.fp-crumb.current { color: var(--text); }
.fp-crumb-sep { color: var(--crumb-sep); }

.fp-search { position: relative; display: block; }
.fp-search-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.fp-search-ico svg { width: 16px; height: 16px; }
.fp-search input { width: min(260px, 40vw); height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); padding: 0 12px 0 34px; outline: none; }
.fp-search input:focus, .fp-select:focus, .fp-share-input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.fp-select { height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--text); padding: 0 10px; outline: none; font: inherit; font-size: 13px; cursor: pointer; }
.fp-select option { background: var(--panel-solid); color: var(--text); }
.fp-sort-wrap { display: contents; }
.fp-sort-wrap > span { display: none; }
.fp-segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--field); }
.fp-segmented button { width: 38px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.fp-segmented button.active { background: var(--hover); color: var(--text); }

.fp-searchbar, .fp-selbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.fp-searchbar .button { margin-left: auto; }
.fp-selbar { background: var(--accent-soft); color: var(--text); position: sticky; top: 72px; z-index: 5; backdrop-filter: blur(12px); }
.fp-selbar strong { font-weight: 650; }
.fp-selbar-size { color: var(--muted); }
.fp-selbar-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.fp-selbar-actions .button { min-height: 32px; }

/* ---------- Lista ---------- */
.fp-files { min-height: 240px; outline: none; }
.fp-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 110px 150px 128px; align-items: center; gap: 0 10px; padding: 6px 12px 6px 8px; border-bottom: 1px solid var(--line-soft); position: relative; user-select: none; -webkit-user-select: none; }
.fp-row:last-child { border-bottom: 0; }
.fp-row:not(.fp-row-head):hover { background: var(--hover-soft); }
.fp-row.selected { background: var(--accent-soft) !important; box-shadow: inset 3px 0 0 var(--accent); }
.fp-row-head { padding-block: 4px; min-height: 38px; position: sticky; top: 72px; z-index: 4; background: var(--file-panel); backdrop-filter: blur(12px); }
.fp-sorthead { border: 0; background: none; padding: 4px 0; text-align: left; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.fp-sorthead.active, .fp-sorthead:hover { color: var(--text-soft); }
span.fp-sorthead { cursor: default; }
.fp-cell-check { display: grid; place-items: center; }
.fp-check { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.fp-cell-name { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 3px 0; }
.fp-name-wrap { display: grid; min-width: 0; }
.fp-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.fp-name { border: 0; background: none; padding: 0; color: var(--text); font-weight: 600; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 14px; }
.fp-name:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.fp-name-static { cursor: default; }
.fp-name-static:hover { color: var(--text); text-decoration: none; }
.fp-sub { color: var(--muted-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-mobile-meta { display: none; }
.fp-cell-meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-shared-dot { color: var(--accent-text); display: inline-grid; }
.fp-shared-dot svg { width: 14px; height: 14px; }

.fp-actions { display: flex; justify-content: flex-end; gap: 4px; opacity: 0; transition: opacity .12s ease; }
.fp-row:hover .fp-actions, .fp-row.selected .fp-actions, .fp-row:focus-within .fp-actions, .fp-actions-visible { opacity: 1; }
.fp-iconbtn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid transparent; background: none; border-radius: 9px; cursor: pointer; color: var(--muted); text-decoration: none; flex: 0 0 auto; }
.fp-iconbtn:hover { color: var(--text); background: var(--hover); border-color: var(--line); }
.fp-iconbtn.danger:hover { color: var(--bad); background: rgba(255,111,125,.08); border-color: rgba(255,111,125,.25); }

/* ---------- Miniatury i ikony typów ---------- */
.fp-thumb { position: relative; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; overflow: hidden; background: rgba(103,168,255,.08); border: 1px solid rgba(103,168,255,.12); color: var(--accent-2); }
.fp-thumb > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s ease; }
.fp-thumb.has-img > img { opacity: 1; }
.fp-thumb.has-img > .fp-ico { opacity: 0; }
.fp-thumb-play { position: absolute; right: 4px; bottom: 4px; width: 0; height: 0; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); opacity: 0; }
.fp-thumb.has-img .fp-thumb-play { opacity: 1; }
.fp-kind-folder { background: rgba(255,199,104,.10); border-color: rgba(255,199,104,.18); color: var(--warn); }
.fp-kind-image { background: rgba(102,224,194,.08); border-color: rgba(102,224,194,.16); color: var(--accent-text); }
.fp-kind-video { background: rgba(167,139,250,.10); border-color: rgba(167,139,250,.2); color: #a78bfa; }
.fp-kind-audio { background: rgba(244,114,182,.10); border-color: rgba(244,114,182,.2); color: #f472b6; }
.fp-kind-pdf { background: rgba(255,111,125,.09); border-color: rgba(255,111,125,.18); color: var(--bad); }
.fp-kind-archive { background: rgba(255,199,104,.07); border-color: rgba(255,199,104,.14); color: #e9a23b; }
.fp-thumb-icon { width: 72px; height: 72px; border-radius: 18px; display: grid; place-items: center; border: 1px solid var(--line); }
.fp-thumb-icon svg { width: 34px; height: 34px; }

/* ---------- Kafelki ---------- */
.fp-view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 14px; align-content: start; }
.fp-tile { position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--hover-soft); overflow: hidden; user-select: none; -webkit-user-select: none; transition: border-color .12s ease, transform .12s ease; }
.fp-tile:hover { border-color: var(--line-strong); }
.fp-tile.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-line); background: var(--accent-soft); }
.fp-tile-open { display: block; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.fp-thumb-big { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 0; border: 0; border-bottom: 1px solid var(--line-soft); }
.fp-thumb-big .fp-ico svg { width: 40px; height: 40px; }
.fp-thumb-big .fp-thumb-play { right: 50%; bottom: 50%; transform: translate(50%, 50%); border-left-width: 22px; border-top-width: 13px; border-bottom-width: 13px; }
.fp-tile-info { padding: 9px 38px 10px 11px; min-width: 0; }
.fp-tile-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 5px; align-items: center; }
.fp-tile-meta { color: var(--muted-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-tile-check { position: absolute; top: 8px; left: 8px; z-index: 2; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .12s ease; }
.fp-tile:hover .fp-tile-check, .fp-tile.selected .fp-tile-check, .fp-tile:focus-within .fp-tile-check { opacity: 1; }
.fp-tile-more { position: absolute; right: 4px; bottom: 6px; width: 30px; height: 30px; }

/* ---------- Stany ---------- */
.fp-empty { display: grid; justify-items: center; gap: 6px; padding: 64px 20px; text-align: center; color: var(--muted); }
.fp-empty .fp-ico svg { width: 36px; height: 36px; color: var(--muted-2); margin-bottom: 6px; }
.fp-empty strong { color: var(--text); font-size: 16px; }
.fp-empty-drop { margin: 16px; border: 1.5px dashed var(--accent-line); border-radius: 14px; background: var(--accent-soft); }
.fp-empty-actions { display: flex; gap: 8px; margin-top: 10px; }
.fp-view-grid > .fp-empty, .fp-view-grid > .fp-skeleton { grid-column: 1 / -1; }
.fp-skeleton { height: 52px; margin: 6px 14px; border-radius: 10px; background: linear-gradient(90deg, var(--skeleton-a), var(--skeleton-b), var(--skeleton-a)); background-size: 200% 100%; animation: fpShimmer 1.2s linear infinite; }
@keyframes fpShimmer { to { background-position: -200% 0; } }
.fp-hint { color: var(--muted-2); font-size: 12px; margin: 14px 4px 0; line-height: 2; }

/* ---------- Przeciąganie ---------- */
.fp-drop-hover { outline: 2px dashed var(--accent) !important; outline-offset: -3px; background: var(--accent-soft) !important; }
.fp-drag-ghost { position: fixed; top: -100px; left: -100px; padding: 8px 12px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.fp-dropzone { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(4, 12, 20, .55); backdrop-filter: blur(3px); pointer-events: none; }
.fp-dropzone[hidden] { display: none; }
.fp-dropzone > div { display: grid; gap: 4px; text-align: center; padding: 34px 48px; border: 2px dashed var(--accent); border-radius: 20px; background: var(--modal-bg); box-shadow: var(--shadow); }
.fp-dropzone strong { font-size: 20px; }
.fp-dropzone span { color: var(--muted); }

/* ---------- Menu ---------- */
.fp-menu { position: fixed; z-index: 90; min-width: 210px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--modal-bg); box-shadow: var(--shadow); animation: fpPop .12s ease; }
@keyframes fpPop { from { opacity: 0; transform: scale(.97); } }
.fp-menu-item { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14px; }
.fp-menu-item:hover, .fp-menu-item:focus-visible { background: var(--hover); outline: none; }
.fp-menu-item .fp-ico { color: var(--muted); }
.fp-menu-item.danger { color: var(--bad); }
.fp-menu-item.danger .fp-ico { color: var(--bad); }
.fp-menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.fp-menu-label { padding: 6px 10px 4px; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }

/* ---------- Okna dialogowe ---------- */
.fp-dialog { z-index: 120; }
.fp-modal { animation: fpPop .14s ease; }
.fp-modal-wide { width: min(560px, 100%); }
.fp-modal select { width: auto; }

.fp-picker { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.fp-picker-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--hover-soft); }
.fp-picker-list { max-height: min(46vh, 340px); overflow-y: auto; padding: 4px; }
.fp-picker-item { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; color: var(--text); padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.fp-picker-item:hover { background: var(--hover); }
.fp-picker-item > .fp-ico:first-child { color: var(--warn); }
.fp-picker-item > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-picker-item > .fp-ico:last-child { color: var(--muted-2); }
.fp-picker-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.fp-picker-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 12px; border-top: 1px solid var(--line); }
.fp-picker-info { margin: 0 !important; font-size: 12px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fp-share { display: grid; gap: 14px; }
.fp-share-item { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fp-share-item > div { display: grid; min-width: 0; }
.fp-share-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-share-new { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--hover-soft); }
.fp-share-new label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.fp-share-list { display: grid; gap: 10px; }
.fp-share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 4px; align-items: center; }
.fp-share-input { height: 36px; min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--field); color: var(--text); padding: 0 10px; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; outline: none; }
.fp-share-meta { grid-column: 1 / -1; color: var(--muted-2); font-size: 12px; padding-left: 2px; }

.fp-shares { display: grid; gap: 10px; padding: 14px; }
.fp-share-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 10px; background: var(--hover-soft); }
.fp-share-card.missing { opacity: .65; }
.fp-share-card-head { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* ---------- Kolejka wgrywania ---------- */
.fp-uploads { position: fixed; right: 18px; bottom: 18px; z-index: 60; width: min(400px, calc(100vw - 24px)); border: 1px solid var(--line-strong); border-radius: 16px; background: var(--modal-bg); box-shadow: var(--shadow); overflow: hidden; }
.fp-up-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; }
.fp-up-toggle { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; display: grid; color: var(--text); }
.fp-up-toggle strong { font-size: 14px; }
.fp-up-toggle span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-up-bar { height: 3px; background: var(--hover); }
.fp-up-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s linear; }
.fp-up-list { max-height: 260px; overflow-y: auto; padding: 6px; display: grid; gap: 2px; }
.fp-uploads.collapsed .fp-up-list { display: none; }
.fp-up-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 6px; align-items: center; padding: 6px 4px 6px 8px; border-radius: 8px; font-size: 13px; }
.fp-up-item .fp-iconbtn { grid-row: 1 / 3; grid-column: 2; width: 30px; height: 30px; }
.fp-up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-up-state { color: var(--muted-2); font-size: 11px; }
.fp-up-item.is-done .fp-up-state { color: var(--good); }
.fp-up-item.is-error .fp-up-state { color: var(--bad); }
.fp-up-progress { grid-column: 1 / -1; height: 3px; border-radius: 99px; background: var(--hover); overflow: hidden; margin-top: 4px; }
.fp-up-progress > div { height: 100%; background: var(--accent); transition: width .25s linear; }
body:has(.fp-uploads:not([hidden])) .toast-stack { bottom: 90px; }

.fp-toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fp-toast-action { border: 0; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; padding: 5px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; }

/* ---------- Podgląd plików ---------- */
.fp-viewer { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: rgba(3, 7, 13, .975); color: #f4f8ff; backdrop-filter: blur(6px); animation: fpFade .15s ease; }
@keyframes fpFade { from { opacity: 0; } }
.fp-viewer-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; }
.fp-viewer-heading { flex: 1; min-width: 0; display: grid; }
.fp-viewer-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-viewer-meta { color: #93a4ba; font-size: 12px; }
.fp-viewer-actions { display: flex; gap: 4px; }
.fp-viewer-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: rgba(255,255,255,.06); color: #f4f8ff; cursor: pointer; text-decoration: none; }
.fp-viewer-btn:hover { background: rgba(255,255,255,.14); }
.fp-viewer-body { position: relative; min-height: 0; display: grid; }
.fp-viewer-stage { min-height: 0; display: grid; place-items: center; padding: 6px 64px 10px; overflow: hidden; }
.fp-viewer-media { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #000; }
img.fp-viewer-media { background: transparent; }
.fp-viewer-doc { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 8px; background: #fff; }
.fp-viewer-text { width: min(1100px, 100%); height: 100%; margin: 0; overflow: auto; padding: 18px 20px; border-radius: 10px; background: #0b1424; border: 1px solid rgba(255,255,255,.1); color: #dfe9f7; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; tab-size: 4; }
.fp-viewer-audio { display: grid; justify-items: center; gap: 16px; padding: 40px; border-radius: 20px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.fp-viewer-audio .fp-ico svg { width: 56px; height: 56px; color: #f472b6; }
.fp-viewer-audio audio { width: min(420px, 80vw); }
.fp-viewer-fallback { display: grid; justify-items: center; gap: 10px; text-align: center; color: #93a4ba; }
.fp-viewer-fallback strong { color: #f4f8ff; }
.fp-viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 64px; border: 0; border-radius: 12px; background: rgba(255,255,255,.06); color: #fff; cursor: pointer; display: grid; place-items: center; }
.fp-viewer-nav:hover { background: rgba(255,255,255,.15); }
.fp-viewer-nav svg { width: 26px; height: 26px; }
.fp-viewer-prev { left: 8px; }
.fp-viewer-next { right: 8px; }
.fp-viewer-counter { text-align: center; color: #93a4ba; font-size: 12px; padding: 0 0 12px; min-height: 12px; }
.fp-viewer-loading { position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: fpSpin .8s linear infinite; }
@keyframes fpSpin { to { transform: rotate(360deg); } }

/* ---------- Strona udostępnionego pliku ---------- */
.sh-main { padding-block: 40px 70px; display: grid; gap: 18px; }
.sh-card { border: 1px solid var(--line); background: var(--file-panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.sh-head { display: flex; align-items: center; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sh-head .fp-thumb { width: 52px; height: 52px; border-radius: 14px; }
.sh-head h1 { margin: 0; font-size: clamp(20px, 3vw, 26px); letter-spacing: -.02em; overflow-wrap: anywhere; }
.sh-head-text { flex: 1; min-width: 220px; display: grid; gap: 2px; }
.sh-head-text span { color: var(--muted); font-size: 13px; }
.sh-preview { display: grid; place-items: center; background: rgba(0,0,0,.25); min-height: 200px; max-height: 72vh; }
.sh-preview img { max-width: 100%; max-height: 72vh; display: block; }
.sh-preview video { width: 100%; max-height: 72vh; display: block; background: #000; }
.sh-preview audio { width: min(520px, 90%); margin: 40px 0; }
.sh-preview iframe { width: 100%; height: 72vh; border: 0; background: #fff; }
.sh-preview pre { width: 100%; max-height: 72vh; overflow: auto; margin: 0; padding: 18px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; color: var(--text-soft); background: var(--panel-solid); }
.sh-error { padding: 70px 24px; text-align: center; display: grid; justify-items: center; gap: 8px; color: var(--muted); }
.sh-error .fp-ico svg { width: 40px; height: 40px; color: var(--muted-2); }
.sh-error strong { color: var(--text); font-size: 20px; }
.sh-note { color: var(--muted-2); font-size: 12px; text-align: center; }

/* ---------- Telefon i tablet ---------- */
@media (max-width: 900px) {
  .fp-stats { grid-template-columns: 1fr 1fr; }
  .fp-storage { grid-column: 1 / -1; }
  .fp-row { grid-template-columns: 40px minmax(0, 1fr) 96px 120px; }
  .fp-row .fp-col-modified { display: none; }
  .fp-row-head > :nth-child(4) { display: none; }
}
@media (max-width: 640px) {
  /* Zwarty nagłówek: tytuł + konto, wgrywanie pod przyciskiem „+” */
  .fp-page .topbar { background: color-mix(in srgb, var(--bg) 96%, transparent); }
  .fp-main { padding-block: 14px 110px; width: min(calc(100% - 24px), var(--shell)); }
  .fp-titlebar { align-items: center; flex-wrap: nowrap; margin-bottom: 12px; }
  .fp-titlebar h1 { font-size: 30px; }
  .fp-titlebar .section-kicker { font-size: 11px; }
  #newFolderBtn, .fp-split { display: none; }
  .fp-account-label { display: none; }
  .fp-stats { margin-bottom: 10px; }
  .fp-stat { display: none; }
  .fp-storage { padding: 9px 12px; border-radius: 12px; }
  .fp-storage-line { font-size: 12px; }
  .fp-storage-line > span { display: none; }
  .fp-storage-track { margin-top: 7px; height: 5px; }
  .fp-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
  .fp-tab { justify-content: center; padding: 8px 4px; font-size: 13px; gap: 5px; }
  .fp-tab-long { display: none; }
  .fp-tab .fp-tab-short { display: inline; }
  .fp-accounts .fp-acc-row { padding: 10px 6px 10px 12px; gap: 12px; }

  /* Lista od krawędzi do krawędzi */
  .fp-panel { margin-inline: -12px; border-radius: 0; border-inline: 0; box-shadow: none; }
  .fp-panel-head { padding: 8px 10px; gap: 8px; }
  .fp-crumbs { flex-basis: 100%; }
  .fp-crumb { font-size: 15px; padding: 6px 6px; max-width: 46vw; }
  .fp-head-tools { width: 100%; margin: 0; gap: 6px; }
  .fp-search { flex: 1; }
  .fp-search input { width: 100%; height: 42px; font-size: 16px; }
  .fp-sort-wrap > span { display: grid; }
  .fp-sort-wrap { position: relative; width: 42px; height: 42px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; background: var(--field); display: grid; place-items: center; color: var(--muted); }
  .fp-sort-wrap .fp-select { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
  .fp-segmented button { width: 42px; height: 40px; }

  .fp-row-head { display: none; }
  .fp-row { grid-template-columns: minmax(0, 1fr) auto; padding: 2px 4px 2px 10px; min-height: 64px; }
  .fp-row .fp-cell-check { display: none; }
  .fp-row .fp-cell-meta { display: none; }
  .fp-cell-name { gap: 12px; }
  .fp-thumb { width: 46px; height: 46px; border-radius: 12px; }
  .fp-name { font-size: 15px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
  .fp-name:hover { text-decoration: none; }
  .fp-mobile-meta { display: block; }
  .fp-actions { opacity: 1; }
  .fp-actions > :not(:last-child) { display: none; }
  .fp-actions-visible > * { display: inline-grid !important; }
  .fp-actions .fp-iconbtn { width: 44px; height: 44px; }
  .fp-row:not(.fp-row-head):hover { background: none; }
  .fp-row:active { background: var(--hover-soft) !important; }

  .fp-view-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px; }
  .fp-tile-check { opacity: 1; }
  .fp-tile-info { padding-right: 40px; }
  .fp-tile-more { width: 40px; height: 40px; bottom: 2px; right: 0; }

  /* Zaznaczanie: pasek akcji przy dolnej krawędzi, pod kciukiem */
  .fp-selbar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 66; display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--modal-bg); border-top: 1px solid var(--line-strong); box-shadow: 0 -10px 30px rgba(0,0,0,.25); backdrop-filter: none; animation: fpUp .16s ease; }
  .fp-selbar[hidden] { display: none !important; }
  .fp-selbar strong { font-size: 15px; justify-self: start; }
  .fp-selbar-size { display: none; }
  .fp-sel-all { justify-self: end; }
  body.fp-selecting .toast-stack { bottom: calc(150px + env(safe-area-inset-bottom)); }
  .fp-selbar-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px; width: 100%; margin: 0; }
  .fp-selbar-actions .button { min-height: 54px; flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 11px; border-radius: 10px; background: none; border-color: transparent; }
  .fp-selbar-actions .button .fp-ico svg { width: 21px; height: 21px; }
  .fp-selbar-actions .fp-sel-rename { display: none; }
  body.fp-selecting .fp-fab, body.fp-selecting .fp-uploads { display: none; }
  body.fp-selecting .fp-main { padding-bottom: 170px; }

  .fp-hint { display: none; }
  .fp-uploads { left: 10px; right: 10px; width: auto; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .fp-up-list { max-height: 40vh; }
  body:has(.fp-uploads:not([hidden])) .fp-fab { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .toast-stack { left: 10px; right: 10px; width: auto; bottom: calc(86px + env(safe-area-inset-bottom)); }

  .fp-viewer-top { padding: 8px 6px 8px 12px; gap: 4px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .fp-viewer-btn { width: 44px; height: 44px; }
  .fp-viewer-stage { padding: 0 0 6px; }
  .fp-viewer-media { border-radius: 0; box-shadow: none; }
  .fp-viewer-nav { display: none; }
  .fp-viewer-counter { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .fp-share-row { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .fp-share-new { flex-direction: column; align-items: stretch; }
  .fp-share-new .button { width: 100%; }
  .fp-shares { padding: 10px; }
}
@media (hover: none) {
  .fp-actions, .fp-tile-check { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .fp-menu, .fp-modal, .fp-viewer { animation: none; }
}

/* ---------- Telefon: przycisk „+” i menu wysuwane od dołu ---------- */
.fp-fab { display: none; }
@media (max-width: 640px) {
  .fp-fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 64; width: 60px; height: 60px; border: 0; border-radius: 20px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 12px 30px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.08) inset; cursor: pointer; transition: transform .15s ease; }
  .fp-fab:active { transform: scale(.94); }
  .fp-fab svg { width: 28px; height: 28px; stroke-width: 2.2; }
}
.fp-sheet-backdrop { position: fixed; inset: 0; z-index: 95; background: rgba(2,6,12,.55); animation: fpFade .15s ease; }
.fp-menu.fp-sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-height: 82vh; overflow-y: auto; min-width: 0; padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; border-width: 1px 0 0; z-index: 96; animation: fpUp .2s cubic-bezier(.2,.9,.3,1); }
.fp-sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 4px auto 8px; }
.fp-sheet .fp-menu-item { padding: 14px 12px; font-size: 16px; border-radius: 12px; gap: 14px; }
.fp-sheet .fp-menu-item .fp-ico svg { width: 22px; height: 22px; }
.fp-sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.fp-sheet-head > div { display: grid; min-width: 0; }
.fp-sheet-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-sheet-head span { color: var(--muted); font-size: 12px; }
@keyframes fpUp { from { transform: translateY(30%); opacity: 0; } }

/* Miniatura jako przycisk zaznaczania (jak w Gmailu) */
.fp-thumb-btn { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 12px; flex: 0 0 auto; display: block; }
.fp-thumb-mark { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: var(--accent); color: var(--accent-ink); transform: scale(.6); opacity: 0; transition: transform .15s ease, opacity .15s ease; pointer-events: none; }
.fp-thumb-mark svg { width: 24px; height: 24px; stroke-width: 2.6; }
.selected .fp-thumb-mark { transform: none; opacity: 1; }

/* Konto w nagłówku panelu */
.fp-tab-short { display: none; }
.fp-account-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 10px 0 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--hover-soft); color: var(--text); cursor: pointer; font: inherit; }
.fp-account-btn:hover { border-color: var(--line-strong); background: var(--hover); }
.fp-account-label { font-size: 14px; font-weight: 650; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.fp-account-caret { color: var(--muted); display: inline-grid; }
.fp-account-caret svg { width: 16px; height: 16px; }
.fp-avatar { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.fp-avatar-lg { width: 42px; height: 42px; font-size: 17px; }
.fp-avatar.is-admin { box-shadow: 0 0 0 2px var(--modal-bg), 0 0 0 4px var(--warn); }
.fp-sheet-head .fp-avatar { color: var(--accent-ink); font-size: 17px; }
.fp-account-head { border-bottom: 1px solid var(--line); margin: -5px -5px 5px; padding: 12px 12px 12px; }
.fp-menu-account { min-width: 240px; }

/* Lista kont */
.fp-accounts { display: grid; align-content: start; }
.fp-acc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line-soft); }
.fp-acc-row:last-child { border-bottom: 0; }
.fp-acc-login { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-role { font-size: 11px; font-weight: 750; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.fp-role-admin { color: var(--warn); border-color: rgba(255,199,104,.35); background: rgba(255,199,104,.08); }
.fp-role-self { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }

/* Formularze w oknach */
.fp-form { display: grid; gap: 12px; }
.fp-form-error { padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255,111,125,.35); background: rgba(255,111,125,.09); color: var(--bad); font-size: 13px; font-weight: 600; }
.fp-field { display: grid; gap: 5px; }
.fp-field > span:first-child { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.fp-field-row { display: flex; align-items: center; gap: 6px; }
.fp-field-row input { flex: 1; min-width: 0; }
.fp-field .fp-select { width: 100%; height: 42px; }
.fp-iconbtn.on { color: var(--accent-text); }
.fp-credentials { margin: 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; color: var(--text); }
.fp-form > .button { justify-self: start; }

/* ---------- Strona logowania ---------- */
.lg-main { min-height: calc(100vh - 72px); min-height: calc(100dvh - 72px); display: grid; place-items: center; padding: 28px 16px calc(28px + env(safe-area-inset-bottom)); }
.lg-card { width: min(400px, 100%); display: grid; gap: 14px; padding: 30px 26px 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--file-panel); box-shadow: var(--shadow); }
.lg-card h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; text-align: center; }
.lg-badge { justify-self: center; width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); margin-bottom: 2px; }
.lg-sub { margin: -8px 0 4px; color: var(--muted); font-size: 14px; text-align: center; }
.lg-error { padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255,111,125,.35); background: rgba(255,111,125,.09); color: var(--bad); font-size: 13px; font-weight: 600; }
.lg-field { display: grid; gap: 6px; }
.lg-field > span:first-child { font-size: 13px; font-weight: 650; color: var(--text-soft); }
.lg-field input { width: 100%; height: 50px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--field); color: var(--text); padding: 0 14px; font-size: 16px; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
.lg-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.lg-password { position: relative; display: block; }
.lg-password input { padding-right: 52px; }
.lg-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 42px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.lg-eye:hover, .lg-eye.on { color: var(--accent-text); }
.lg-caps { color: var(--warn); font-size: 12px; font-weight: 600; }
.lg-remember { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-soft); cursor: pointer; line-height: 1.4; }
.lg-remember input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.lg-submit { height: 52px; font-size: 16px; justify-content: center; margin-top: 4px; }
.lg-spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(0,0,0,.2); border-top-color: var(--accent-ink); animation: fpSpin .7s linear infinite; }
.lg-submit.busy .lg-spinner { display: inline-block; }
.lg-back { justify-self: center; color: var(--muted); font-size: 13px; text-decoration: none; padding: 6px; }
.lg-back:hover { color: var(--text); }
.lg-shake { animation: lgShake .35s ease; }
@keyframes lgShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (max-width: 640px) {
  .lg-main { place-items: start center; padding-top: 6vh; }
  .lg-card { padding: 26px 18px 20px; }
}
