/* Ubuntu / GNOME Files (Nautilus) look, Yaru colours. Light by default, dark via prefers-color-scheme. */
:root {
  --bg: #ebebeb;            /* header bar */
  --side: #f6f5f4;          /* sidebar */
  --pane: #ffffff;          /* content */
  --line: #dad6d2; --line2: #c9c5c0;
  --text: #2e3436; --muted: #77767b; --muted2: #5e5c64;
  --hover: #f0eeec; --hover2: #e6e3e0;
  --accent: #e95420; --accent-d: #c7461a; --accent-soft: rgba(233, 84, 32, .14);
  --aub: #77216f; --aub-d: #2c001e;
  --danger: #c01c28; --ok: #26a269;
  --card: #ffffff; --head: #f6f5f4; --field: #ffffff; --btn: #f6f5f4; --btn-h: #ebe9e7;
  --shadow: 0 6px 24px rgba(0, 0, 0, .22); --scrim: rgba(0, 0, 0, .4);
  --viewer-bg: #deddda; --stripe1: #efefef; --stripe2: #fafafa;
  --font: "Ubuntu", "Cantarell", "Noto Sans", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2a2630; --side: #2b2733; --pane: #241f31;
    --line: #3d3846; --line2: #4d4758;
    --text: #f6f5f4; --muted: #9a9996; --muted2: #c0bfbc;
    --hover: #2f2a3a; --hover2: #3d3846;
    --accent-soft: rgba(233, 84, 32, .28);
    --aub: #c061cb; --aub-d: #f6f5f4;
    --card: #2e2a3a; --head: #2a2630; --field: #1e1a28; --btn: #3d3846; --btn-h: #4a4456;
    --shadow: 0 6px 24px rgba(0, 0, 0, .6); --scrim: rgba(0, 0, 0, .6);
    --viewer-bg: #1a1623; --stripe1: #2c2736; --stripe2: #332e3f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.4 var(--font); color: var(--text); background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
.ic { width: 18px; height: 18px; flex: none; }
.fi { width: 20px; height: 20px; flex: none; display: block; }
.fi.big { width: 72px; height: 72px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.win { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ---- header bar ---- */
.hb { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg); border-bottom: 1px solid var(--line); min-height: 50px; }
.tb { background: none; border: 0; border-radius: 8px; min-width: 34px; height: 34px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); text-decoration: none; flex: none; }
.tb:hover:not(:disabled) { background: var(--hover2); }
.tb:active:not(:disabled) { background: var(--line); }
.tb.on { background: var(--hover2); }
.seg { display: flex; background: var(--btn); border-radius: 9px; padding: 2px; gap: 2px; flex: none; }
.seg .tb { height: 30px; min-width: 32px; border-radius: 7px; }
.seg .tb.on { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.tree-toggle { display: none; }
.pathbar { flex: 1; min-width: 0; height: 34px; background: var(--btn); border-radius: 9px; display: flex; align-items: center; padding: 2px; overflow: hidden; }
.crumbs { display: flex; align-items: center; white-space: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; gap: 2px; }
.crumbs::-webkit-scrollbar { display: none; }
.crumb { background: none; border: 0; border-radius: 7px; height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.crumb:hover { background: var(--hover2); }
.crumb.last, .crumb.static { background: var(--card); font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.crumb.static { color: var(--muted2); }
.crumb .fi { width: 16px; height: 16px; }
.sep { display: none; }
.search { display: flex; align-items: center; background: transparent; border-radius: 9px; flex: none; transition: background .12s; }
.search input { border: 0; outline: 0; background: none; width: 0; padding: 0; min-width: 0; transition: width .18s; }
.search.open { background: var(--field); box-shadow: inset 0 0 0 1px var(--line2); }
.search.open input { width: 230px; padding-right: 10px; }
.search.open:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.user .lbl { font-size: 13px; }

/* ---- action bar (administrators only) ---- */
.cmd { display: flex; align-items: center; gap: 4px; padding: 4px 10px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; background: var(--head); border-bottom: 1px solid var(--line); }
.cmd[hidden] { display: none; }
.cmd::-webkit-scrollbar { display: none; }
.cb { background: none; border: 0; border-radius: 8px; height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; flex: none; }
.cb:hover:not(:disabled) { background: var(--hover2); }
.vsep { width: 1px; height: 20px; background: var(--line2); margin: 0 6px; flex: none; }

/* ---- body ---- */
.body { flex: 1; min-height: 0; display: flex; position: relative; }
.nav { width: 250px; flex: none; overflow: auto; padding: 8px 6px 12px; background: var(--side); border-right: 1px solid var(--line); }
.tree { min-width: max-content; }
.tn { display: flex; align-items: center; gap: 6px; height: 34px; padding-left: calc(var(--l) * 14px + 4px); padding-right: 10px; border-radius: 8px; cursor: default; white-space: nowrap; user-select: none; }
.tn:hover { background: var(--hover2); }
.tn.cur { background: var(--accent); color: #fff; }
.tn.cur .chev { color: #fff; }
.tn.off { opacity: .45; }
.tn .fi { width: 20px; height: 20px; }
.chev { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--muted2); transition: transform .12s; }
.chev .ic { width: 12px; height: 12px; stroke-width: 2.2; }
.chev.open { transform: rotate(90deg); }
.chev.none { visibility: hidden; }
.drop-hover { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }

.pane { flex: 1; min-width: 0; background: var(--pane); position: relative; display: flex; flex-direction: column; }
.list { flex: 1; overflow: auto; position: relative; outline: none; padding-bottom: 54px; }

/* list view: Name, Size, Type, Modified */
.lrow { display: grid; grid-template-columns: minmax(0, 1fr) 100px 210px 160px; align-items: center; min-width: 560px; }
.pane.admin .lrow { grid-template-columns: 30px minmax(0, 1fr) 100px 210px 160px; }
.pane.loc .lrow { grid-template-columns: minmax(0, 1fr) 220px 100px 210px 160px; min-width: 760px; }
.pane.admin.loc .lrow { grid-template-columns: 30px minmax(0, 1fr) 220px 100px 210px 160px; }
.lhead { position: sticky; top: 0; z-index: 2; background: var(--pane); border-bottom: 1px solid var(--line); height: 36px; font-size: 13px; font-weight: 700; }
.th { background: none; border: 0; text-align: left; height: 36px; padding: 0 10px; color: var(--muted2); font-weight: 700; display: flex; align-items: center; gap: 6px; border-left: 1px solid transparent; }
.th:hover { background: var(--hover); }
.th .arr { font-size: 8px; }
.row { height: 38px; margin: 0 6px; border-radius: 8px; cursor: default; user-select: none; }
.lrow.row { min-width: 548px; }
.row:hover { background: var(--hover); }
.row.sel { background: var(--accent); color: #fff; }
.row.sel:hover { background: var(--accent-d); }
.row.sel .c-size, .row.sel .c-type, .row.sel .c-date, .row.sel .c-loc, .row.sel .meta { color: rgba(255, 255, 255, .88); }
.row.sel .c-loc a:hover { color: #fff; }
.row.foc { outline: 2px solid var(--accent); outline-offset: -2px; }
.row.sel.foc { outline-color: #fff; outline-offset: -3px; }
.c-name { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 10px; }
.c-name .ico { display: inline-flex; }
.nm { min-width: 0; display: flex; flex-direction: column; }
.nmt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { display: none; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-date, .c-type, .c-size, .c-loc { padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted2); font-size: 13px; }
.c-loc a { color: inherit; text-decoration: none; } .c-loc a:hover { text-decoration: underline; color: var(--accent); }
.c-chk { display: none; width: 20px; height: 20px; margin: 0 5px; border: 2px solid var(--line2); border-radius: 50%; background: var(--pane); align-items: center; justify-content: center; opacity: 0; color: #fff; }
.pane.admin .c-chk { display: flex; }
.pane.admin .lhead .c-chk { opacity: 0; border: 0; }
.row:hover .c-chk, .row.sel .c-chk { opacity: 1; }
.row.sel .c-chk { background: #fff; border-color: #fff; color: var(--accent); }
.c-chk .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.empty { padding: 64px 16px; text-align: center; color: var(--muted); font-size: 16px; }
.empty .hint { margin-top: 8px; font-size: 13px; }

/* icon grid */
.tilebox { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; padding: 14px; }
.tile { height: auto; margin: 0; padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; text-align: center; border-radius: 12px; }
.tile .c-chk { position: absolute; left: 6px; top: 6px; margin: 0; }
.tico { width: 88px; height: 88px; display: flex; align-items: center; justify-content: center; }
.tico .fi { width: 76px; height: 76px; }
.tico img { max-width: 88px; max-height: 88px; border-radius: 6px; box-shadow: 0 0 0 1px var(--line2); object-fit: contain; background: #fff; }
.tname { font-size: 13px; line-height: 1.25; max-height: 3.75em; overflow: hidden; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* floating status (Nautilus) */
.floatstat { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; background: var(--card); color: var(--text); border-radius: 999px; padding: 6px 16px; font-size: 12.5px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); pointer-events: none; z-index: 5; }
.floatstat span:empty { display: none; }
.floatstat #stSel { color: var(--accent); font-weight: 700; }

/* drop overlay */
.dropov { position: absolute; inset: 8px; background: var(--accent-soft); border: 3px dashed var(--accent); border-radius: 14px; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 20; }
.dropov[hidden] { display: none; }
.dropmsg { background: var(--card); border-radius: 14px; padding: 24px 36px; box-shadow: var(--shadow); text-align: center; font-size: 17px; color: var(--accent); display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 80%; overflow-wrap: anywhere; font-weight: 700; }
.dropmsg .ic { width: 38px; height: 38px; }

/* ---- popover menu / toast ---- */
.ctx { position: fixed; z-index: 100; min-width: 210px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 7px; }
.mi:hover:not(:disabled) { background: var(--hover2); }
.mi .mk { margin-left: auto; color: var(--accent); }
.mhead { padding: 6px 10px 2px; font-size: 12px; font-weight: 700; color: var(--muted); }
.msep { height: 1px; background: var(--line); margin: 5px 4px; }
#toast { position: fixed; left: 50%; bottom: 64px; transform: translate(-50%, 20px); background: #3d3846; color: #fff; padding: 10px 20px; border-radius: 999px; z-index: 300; opacity: 0; pointer-events: none; transition: all .2s; max-width: 90vw; font-size: 13px; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); }

/* ---- uploads panel ---- */
.uploads { position: fixed; right: 16px; bottom: 16px; width: 340px; max-width: calc(100vw - 32px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 90; overflow: hidden; }
.uploads[hidden] { display: none; }
.uh { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; font-weight: 700; border-bottom: 1px solid var(--line); background: var(--head); }
.ul { max-height: 260px; overflow: auto; padding: 6px 14px 10px; }
.ui { padding: 5px 0; font-size: 13px; }
.un { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 5px; background: var(--line); border-radius: 3px; margin: 4px 0 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .15s; border-radius: 3px; }
.ui.done .bar i { background: var(--ok); }
.ui.error .bar i { background: var(--danger); width: 100% !important; }
.us { font-size: 12px; color: var(--muted); }
.ui.error .us { color: var(--danger); }

/* ---- dialogs (GNOME style) ---- */
.dlg-back { position: fixed; inset: 0; background: var(--scrim); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); width: 420px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.dlg.wide { width: 520px; }
.dlg-head { padding: 18px 22px 4px; font-size: 18px; font-weight: 700; color: var(--aub); text-align: center; }
.dlg-body { padding: 8px 22px 14px; overflow: auto; }
.dlg-foot { display: flex; gap: 10px; justify-content: stretch; padding: 4px 22px 20px; }
.dlg-foot .btn { flex: 1; }
.dlg-foot .btn.primary { order: 2; }
.dlg-msg { margin: 6px 0; overflow-wrap: anywhere; text-align: center; } .dlg-detail { color: var(--muted); font-size: 13px; margin: 4px 0 0; text-align: center; }
.dlg-error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.dlg-error[hidden] { display: none; }
.field { display: block; margin: 10px 0; } .field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--field); }
.field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.btn { min-width: 90px; height: 36px; padding: 0 18px; border: 0; background: var(--btn); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 500; }
.btn:hover { background: var(--btn-h); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.picker { border: 1px solid var(--line); border-radius: 10px; height: 280px; overflow: auto; margin-top: 8px; padding: 4px; background: var(--side); }
.picker .tn { height: 32px; }

/* ---- viewer ---- */
.vw-back { position: fixed; inset: 0; z-index: 150; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 3vh 3vw; }
.vw { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); width: min(1200px, 100%); height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.vw-head { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border-bottom: 1px solid var(--line); background: var(--bg); flex: none; }
.vw-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.vw-title #vw-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-ico { display: inline-flex; }
.vw-tools { display: flex; align-items: center; gap: 10px; }
.vw-group { display: flex; align-items: center; gap: 2px; background: var(--btn); border-radius: 9px; padding: 2px; }
.vw-group[hidden] { display: none; }
.vw-tools .tb { width: 34px; height: 32px; }
.vw-dl { width: auto !important; padding: 0 14px; gap: 6px; background: var(--btn); }
.vw-dl:hover { background: var(--btn-h) !important; }
.vw-pct { width: 54px !important; font-size: 12px; }
.vw-pageno { width: 42px; height: 28px; text-align: center; border: 1px solid var(--line2); border-radius: 6px; margin: 0 4px; background: var(--field); }
.vw-pagecount { font-size: 12px; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.vw-close { width: 38px; height: 38px; border: 0; background: var(--btn); border-radius: 50%; color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.vw-close .ic { width: 20px; height: 20px; stroke-width: 2.2; }
.vw-close:hover { background: var(--accent); color: #fff; }
.vw-body { flex: 1; min-height: 0; position: relative; background: var(--viewer-bg); }
.vw-body.scroll { overflow: auto; }
.vw-body.center { display: flex; align-items: center; justify-content: center; background: var(--pane); }
.vw-body.textbox { background: var(--pane); }
.vw-text { margin: 0; padding: 16px 22px; font: 13px/1.55 "Ubuntu Mono", "DejaVu Sans Mono", Consolas, "Courier New", monospace; white-space: pre-wrap; word-break: break-word; tab-size: 4; }
.vw-note { padding: 10px 20px; background: #fff3cd; color: #664d03; font-size: 13px; border-top: 1px solid #f0e2a8; position: sticky; bottom: 0; }
.imgbox { display: flex; padding: 16px; background: repeating-conic-gradient(var(--stripe1) 0 25%, var(--stripe2) 0 50%) 0 0 / 20px 20px; }
.vw-img { margin: auto; max-width: none; display: block; box-shadow: 0 2px 12px rgba(0, 0, 0, .3); background: #fff; border-radius: 4px; }
.htmlbox { background: #fff; overflow: auto; }
.htmlwrap { width: 100%; height: 100%; overflow: auto; }
.htmlwrap iframe { border: 0; background: #fff; transform-origin: 0 0; width: 100%; height: 100%; display: block; }
.vw-video { max-width: 100%; max-height: 100%; background: #000; }
audio { width: min(520px, 90%); }
.pdfbox { padding: 14px 0; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: min-content; }
.pg { background: #fff; box-shadow: 0 1px 8px rgba(0, 0, 0, .35); position: relative; flex: none; }
.pg canvas { display: block; }
.textLayer { position: absolute; inset: 0; overflow: clip; line-height: 1; text-align: initial; transform-origin: 0 0; forced-color-adjust: none; z-index: 0;
  --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0 0; user-select: text; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height)); --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.textLayer .markedContent { display: contents; }
.textLayer ::selection { background: rgba(233, 84, 32, .35); color: transparent; }
.spin-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.vw-card { background: var(--card); border-radius: 14px; padding: 30px 38px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 90%; box-shadow: 0 2px 14px rgba(0, 0, 0, .15); }
.vw-card-name { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.vw-card-meta { color: var(--muted); }
.vw-card-msg { color: var(--danger); max-width: 420px; margin: 6px 0 4px; }

/* ---- phones and narrow windows ---- */
@media (max-width: 820px) {
  .tree-toggle { display: inline-flex; }
  .nav { position: fixed; z-index: 80; left: 0; top: 0; bottom: 0; width: 290px; max-width: 86vw; padding-top: 14px; transform: translateX(-102%); transition: transform .18s; box-shadow: 0 0 30px rgba(0, 0, 0, .4); }
  .nav-back { display: none; position: fixed; inset: 0; background: var(--scrim); z-index: 70; }
  body.tree-open .nav { transform: none; }
  body.tree-open .nav-back { display: block; }
  .search.open input { width: 150px; }
}
@media (max-width: 680px) {
  .hb { flex-wrap: wrap; padding: 6px 8px; gap: 6px; }
  .pathbar { order: 9; flex-basis: 100%; }
  .user .lbl { display: none; }
  .search.open { flex: 1; } .search.open input { width: 100%; }
  .cb .lbl { display: none; }
  .lrow, .pane.admin .lrow, .pane.loc .lrow, .pane.admin.loc .lrow { min-width: 0; grid-template-columns: minmax(0, 1fr); }
  .pane.admin .lrow, .pane.admin.loc .lrow { grid-template-columns: 34px minmax(0, 1fr); }
  .c-date, .c-type, .c-size, .c-loc, .lhead .th:not(.c-name) { display: none; }
  .meta { display: block; }
  .row { height: 54px; }
  .lrow.row { min-width: 0; }
  .c-chk { opacity: 1; }
  .vw-back { padding: 0; }
  .vw { border-radius: 0; }
  .vw-head { flex-wrap: wrap; }
  .vw-title { flex: 1 1 60%; order: 1; }
  .vw-close { order: 2; }
  .vw-tools { order: 3; flex-basis: 100%; justify-content: space-between; overflow-x: auto; }
  .vw-dl .lbl { display: none; }
  .tilebox { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .dlg-foot { flex-direction: column-reverse; }
}
