/* Tabbed Folders: a file manager in the spirit of the mid-90s desktop.
   Grey bevelled panels, a navy title bar, a teal desktop behind the window.
   All shapes and icons are original drawings. */
:root {
  --desk: #008080;        /* teal desktop */
  --face: #c0c0c0;        /* panel grey */
  --hi: #ffffff;          /* bevel highlight */
  --light: #dfdfdf;       /* inner highlight */
  --shadow: #808080;      /* bevel shadow */
  --dark: #000000;        /* outer shadow */
  --title: #000080;       /* navy title bar */
  --title-2: #0b3f9c;
  --sel: #000080;         /* selection */
  --sel-ink: #ffffff;
  --ink: #000000;
  --muted: #404040;
  --field: #ffffff;
  --folder: #f4c430;
  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--hi), inset -2px -2px var(--shadow), inset 2px 2px var(--light);
  --sunken: inset -1px -1px var(--hi), inset 1px 1px var(--shadow), inset -2px -2px var(--light), inset 2px 2px var(--dark);
  --font: Tahoma, Verdana, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 12px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
u { text-decoration: underline; }
[hidden] { display: none !important; }

/* Window */
.win {
  position: fixed;
  inset: 10px;
  display: flex;
  flex-direction: column;
  background: var(--face);
  box-shadow: var(--raised);
  padding: 3px;
  min-width: 0;
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 4px;
  background: linear-gradient(90deg, var(--title), var(--title-2));
  color: #fff;
  font-weight: bold;
  flex: none;
}
.titlebar img { display: block; }
.titlebar .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Menu bar */
.menubar { display: flex; gap: 0; padding: 2px 0; flex: none; }
.menubar button {
  border: 0; background: none; padding: 3px 8px; cursor: default;
}
.menubar button:hover, .menubar button.open { box-shadow: inset -1px -1px var(--hi), inset 1px 1px var(--shadow); }
.menubar button.open { background: var(--sel); color: var(--sel-ink); box-shadow: none; }

/* Toolbar */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 3px 2px; border-top: 1px solid var(--shadow); box-shadow: inset 0 1px var(--hi);
  flex: none;
}
.tb {
  width: 30px; height: 28px; border: 0; background: var(--face); box-shadow: var(--raised);
  display: inline-grid; place-items: center; padding: 0; cursor: default;
}
.tb svg { width: 18px; height: 18px; display: block; shape-rendering: crispEdges; }
.tb:active:not(:disabled), .tb.on { box-shadow: var(--sunken); }
.tb.on { background: repeating-conic-gradient(var(--face) 0 25%, #fff 0 50%) 0 0 / 2px 2px; }
.tb:disabled svg { opacity: .35; filter: grayscale(1); }
.tb:focus-visible { outline: 1px dotted var(--dark); outline-offset: -5px; }
.sep { width: 2px; height: 24px; margin: 0 4px; box-shadow: inset 1px 0 var(--shadow), inset -1px 0 var(--hi); }

/* Address bar */
.addressbar {
  display: flex; align-items: center; gap: 6px; padding: 3px 2px 4px;
  border-top: 1px solid var(--shadow); box-shadow: inset 0 1px var(--hi); flex: none;
}
.addressbar label { padding-left: 2px; }
.sunken { box-shadow: var(--sunken); background: var(--field); }
.address {
  flex: 1; min-width: 0; height: 24px; padding: 3px 6px; display: flex; align-items: center; gap: 2px;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.address::-webkit-scrollbar { display: none; }
.address button { border: 0; background: none; padding: 1px 3px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.address button:hover { text-decoration: underline; }
.address .crumb-sep { color: var(--shadow); }
.address svg { width: 16px; height: 16px; }
#filter { width: 190px; height: 24px; border: 0; padding: 3px 6px; outline: none; }

/* Folder tabs */
.tabstrip {
  display: flex; align-items: flex-end; gap: 0; padding: 4px 4px 0; flex: none;
  overflow-x: auto; scrollbar-width: none; position: relative; z-index: 1;
}
.tabstrip::-webkit-scrollbar { display: none; }
.ftab {
  position: relative; display: flex; align-items: center; gap: 5px; max-width: 220px; height: 24px;
  padding: 2px 6px 2px 8px; margin-right: -1px; border: 0; background: var(--face);
  box-shadow: inset 1px 1px var(--hi), inset 2px 2px var(--light), inset -1px 0 var(--dark), inset -2px 0 var(--shadow);
  border-radius: 3px 3px 0 0; cursor: default; flex-shrink: 0; top: 2px;
}
.ftab.active { height: 27px; top: 1px; z-index: 2; font-weight: bold; padding-bottom: 4px; }
.ftab .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftab svg { width: 16px; height: 16px; flex: none; }
.ftab .x { border: 0; background: none; width: 16px; height: 16px; padding: 0; line-height: 14px; font-size: 13px; font-weight: normal; cursor: default; }
.ftab .x:hover { box-shadow: var(--raised); }
.ftab.drop { outline: 1px dotted var(--dark); outline-offset: -4px; }
.ftab:focus-visible { outline: 1px dotted var(--dark); outline-offset: -5px; }
.tabadd { width: 26px; height: 22px; margin-left: 4px; border: 0; background: var(--face); box-shadow: var(--raised); top: 0; font-weight: bold; cursor: default; flex-shrink: 0; }
.tabadd:active { box-shadow: var(--sunken); }

/* Body: tree + pane */
.body {
  flex: 1; min-height: 0; display: flex; padding: 4px;
  box-shadow: inset 1px 1px var(--hi), inset -1px -1px var(--dark), inset 2px 2px var(--light), inset -2px -2px var(--shadow);
}
.tree { width: var(--tree-w, 240px); min-width: 140px; max-width: 60%; overflow: auto; padding: 4px 2px; }
.splitter { width: 6px; cursor: col-resize; flex: none; }
.pane { flex: 1; min-width: 0; overflow: auto; outline: none; position: relative; }
body.notree .tree, body.notree .splitter { display: none; }

/* Tree */
.tnode { display: flex; align-items: center; gap: 3px; height: 20px; padding-right: 6px; white-space: nowrap; cursor: default; }
.tnode .tw { width: 11px; height: 11px; flex: none; display: grid; place-items: center; font-size: 9px; line-height: 1; border: 1px solid var(--shadow); background: #fff; }
.tnode .tw.empty { border-color: transparent; background: none; }
.tnode svg { width: 16px; height: 16px; flex: none; }
.tnode .tl { padding: 0 2px; }
.tnode.cur .tl { background: var(--sel); color: var(--sel-ink); }
.tnode.drop .tl { outline: 1px dotted var(--dark); }
.tnode.place { font-weight: bold; }
.tnode .warn { color: #a00000; font-weight: normal; }
.tree .tsection { margin: 8px 4px 2px; color: var(--muted); font-size: 11px; }

/* Details view */
table.details { border-collapse: collapse; width: 100%; table-layout: fixed; }
table.details th {
  position: sticky; top: 0; z-index: 1; background: var(--face); font-weight: normal; text-align: left;
  padding: 2px 6px; height: 20px; box-shadow: var(--raised); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default;
}
table.details th:active { box-shadow: var(--sunken); }
table.details th .arrow { font-size: 9px; margin-left: 4px; }
table.details th.c-size, table.details td.c-size { text-align: right; }
table.details col.c-name { width: auto; }
table.details col.c-size { width: 90px; }
table.details col.c-type { width: 150px; }
table.details col.c-date { width: 150px; }
table.details td { padding: 1px 6px; height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
table.details td.c-name { display: flex; align-items: center; gap: 5px; }
table.details td.c-name svg { width: 16px; height: 16px; flex: none; }
table.details td.c-name .nm { overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
tr.item.sel td.c-name .nm { background: var(--sel); color: var(--sel-ink); }
tr.item.sel td:not(.c-name) { background: #e6e6f2; }
tr.item.cut td.c-name svg { opacity: .45; }
tr.item.drop td.c-name .nm { outline: 1px dotted var(--dark); }
tr.item.focus td.c-name .nm { outline: 1px dotted var(--dark); outline-offset: 0; }

/* Icons view */
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px 4px; padding: 8px; align-content: start; }
.icon { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; cursor: default; min-width: 0; }
.icon svg { width: 36px; height: 36px; }
.icon .nm { max-width: 100%; text-align: center; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 0 2px; }
.icon.sel .nm { background: var(--sel); color: var(--sel-ink); }
.icon.sel svg { filter: brightness(.75) sepia(1) hue-rotate(190deg) saturate(3); }
.icon.cut svg { opacity: .45; }
.icon.drop .nm, .icon.focus .nm { outline: 1px dotted var(--dark); }

.rename-input { width: 100%; min-width: 80px; border: 1px solid var(--dark); padding: 0 2px; height: 18px; outline: none; background: #fff; color: #000; font: inherit; }
.icon .rename-input { text-align: center; }

/* Empty and welcome screens */
.note { padding: 18px; color: var(--muted); }
.welcome { max-width: 560px; margin: 28px auto; padding: 18px 22px; background: var(--face); box-shadow: var(--raised); color: var(--ink); }
.welcome h2 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.welcome h2 img { width: 32px; height: 32px; }
.welcome p { margin: 0 0 10px; }
.welcome .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.btn {
  min-width: 88px; height: 26px; padding: 0 12px; border: 0; background: var(--face); box-shadow: var(--raised); cursor: default;
}
.btn:active:not(:disabled) { box-shadow: var(--sunken); padding-top: 1px; }
.btn.default { box-shadow: inset 0 0 0 1px var(--dark), inset -2px -2px var(--dark), inset 2px 2px var(--hi), inset -3px -3px var(--shadow), inset 3px 3px var(--light); }
.btn:focus-visible { outline: 1px dotted var(--dark); outline-offset: -5px; }
.btn:disabled { color: var(--shadow); text-shadow: 1px 1px var(--hi); }
.dropzone.drop { outline: 2px dashed var(--title); outline-offset: -6px; }

/* Status bar */
.statusbar { display: flex; gap: 2px; padding-top: 3px; flex: none; }
.statusbar .cell { box-shadow: inset 1px 1px var(--shadow), inset -1px -1px var(--hi); padding: 2px 6px; min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; height: 20px; }
.statusbar .grow { flex: 1; min-width: 0; }

/* Menus (dropdown and right-click) */
.menu {
  position: fixed; z-index: 50; min-width: 190px; padding: 3px; background: var(--face); box-shadow: var(--raised);
}
.menu button {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; width: 100%;
  border: 0; background: none; padding: 4px 18px 4px 22px; text-align: left; cursor: default; white-space: nowrap; position: relative;
}
.menu button .k { color: var(--muted); }
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--sel); color: var(--sel-ink); outline: none; }
.menu button:hover:not(:disabled) .k, .menu button:focus-visible .k { color: var(--sel-ink); }
.menu button:disabled { color: var(--shadow); text-shadow: 1px 1px var(--hi); }
.menu button.checked::before { content: "•"; position: absolute; left: 9px; font-weight: bold; }
.menu hr { border: 0; height: 2px; margin: 3px 2px; box-shadow: inset 0 1px var(--shadow), inset 0 -1px var(--hi); }

/* Dialogs */
.modal-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 0, 0, .08); padding: 12px; }
.dlg { width: min(420px, 100%); background: var(--face); box-shadow: var(--raised); padding: 3px; }
.dlg .titlebar { justify-content: space-between; }
.dlg .titlebar .x { width: 16px; height: 14px; border: 0; background: var(--face); box-shadow: var(--raised); color: #000; font: bold 10px/1 var(--font); padding: 0; cursor: default; }
.dlg .content { padding: 14px 12px 10px; display: flex; gap: 12px; align-items: flex-start; }
.dlg .content svg { width: 32px; height: 32px; flex: none; }
.dlg .content p { margin: 0 0 8px; overflow-wrap: anywhere; }
.dlg .content .txt { flex: 1; min-width: 0; }
.dlg .buttons { display: flex; justify-content: center; gap: 8px; padding: 4px 8px 10px; flex-wrap: wrap; }
.dlg input[type=text] { width: 100%; height: 24px; border: 0; padding: 3px 6px; box-shadow: var(--sunken); background: #fff; outline: none; }
.dlg table.props { border-collapse: collapse; width: 100%; }
.dlg table.props td { padding: 3px 4px; vertical-align: top; overflow-wrap: anywhere; }
.dlg table.props td:first-child { width: 110px; color: var(--muted); }
.dlg .about a { color: #0000c0; }
.dlg .about h3 { margin: 12px 0 4px; font-size: 12px; }
.dlg .scroll { max-height: min(60vh, 460px); overflow: auto; padding-right: 4px; }

/* Small screens */
@media (max-width: 760px) {
  .win { inset: 0; padding: 2px; }
  #filter { width: 110px; }
  .tree { position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; width: min(78vw, 300px); max-width: none; box-shadow: var(--sunken), 4px 0 10px rgba(0,0,0,.3); }
  .body { position: relative; }
  .splitter { display: none; }
  body:not(.treeopen) .tree { display: none; }
  table.details col.c-type, table.details col.c-date { width: 0; }
  table.details th.c-type, table.details td.c-type, table.details th.c-date, table.details td.c-date { display: none; }
  .statusbar .cell { min-width: 0; }
  .tb { width: 34px; height: 32px; }
  .narrow-hide { display: none; }
}
@media (pointer: coarse) {
  table.details td { height: 30px; }
  .tnode { height: 28px; }
  .menu button { padding-top: 8px; padding-bottom: 8px; }
}
