:root {
  font-family: "Segoe UI", "Yu Gothic UI", sans-serif;
  color: #202124;
  background: #f7f8fa;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; overflow: hidden; }

button, select { font: inherit; }

.toolbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(100deg, #185abd, #1675d1);
  box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
}

.brand { display: flex; gap: 10px; align-items: center; font-size: 18px; font-weight: 600; }
.brand-icon { font-size: 24px; color: #ffd45c; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.toolbar-button {
  height: 34px;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 4px;
  color: #fff;
  background: rgb(255 255 255 / 12%);
}
.toolbar-button { width: 36px; display: inline-grid; place-items: center; padding: 0; font-size: 17px; cursor: pointer; }
.toolbar-button:hover:not(:disabled) { background: rgb(255 255 255 / 24%); }
.toolbar-button:disabled { opacity: .45; cursor: default; }
.toolbar-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.view-picker { position: relative; }
.view-mode-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; padding: 5px; border: 1px solid #cdd2d9; border-radius: 5px; background: #fff; box-shadow: 0 4px 15px rgb(0 0 0 / 20%); }
.view-select { display: block; width: 155px; border: 0; color: #202124; background: #fff; font: inherit; cursor: pointer; }
.view-select option { padding: 7px 10px; }
.divider { width: 1px; height: 26px; margin: 0 6px; background: rgb(255 255 255 / 35%); }

.breadcrumb {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid #d8dce3;
  background: #fff;
}
.crumb { min-width: 0; max-width: 100%; overflow-wrap: anywhere; border: 0; padding: 4px 6px; color: #2a5b93; background: transparent; cursor: pointer; }
.crumb:hover { text-decoration: underline; }
.crumb-separator { color: #8a9099; }

.explorer { height: calc(100% - 58px); display: grid; grid-template-columns: 30% 70%; }
.tree-pane, .content-pane { min-width: 0; overflow: auto; background: #fff; }
.tree-pane { border-right: 1px solid #d8dce3; }
.folder-tree { padding: 8px 4px 18px; user-select: none; }
.tree-node { margin: 0; }
.tree-row { display: flex; align-items: center; height: 30px; padding-right: 7px; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.tree-row:hover { background: #edf4fc; }
.tree-row.selected { color: #0d57a1; background: #dcecff; }
.tree-row.drop-target { outline: 2px solid #2878c7; outline-offset: -2px; background: #dcecff; }
.tree-toggle { width: 24px; border: 0; padding: 0; color: #59616b; background: transparent; cursor: pointer; }
.tree-toggle.empty { visibility: hidden; }
.tree-folder { margin-right: 7px; color: #e3a400; }
.tree-children { margin-left: 17px; border-left: 1px solid #dce1e8; }
.tree-children.collapsed { display: none; }

.content-pane { position: relative; }
.status { min-height: 26px; padding: 7px 14px 0; color: #68717c; font-size: 12px; }
.status.error { color: #b42318; }
.items { min-height: calc(100% - 26px); padding: 8px 14px 24px; user-select: none; }
.drop-overlay {
  position: absolute;
  inset: 10px;
  z-index: 20;
  display: none;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 3px dashed #2878c7;
  border-radius: 10px;
  color: #15599c;
  background: rgb(225 240 255 / 94%);
  pointer-events: none;
}
.content-pane.drag-over .drop-overlay { display: grid; }
.drop-overlay-icon { font-size: 52px; line-height: 1; }
.empty { display: grid; place-items: center; min-height: 260px; color: #7a828c; }

.items:not(.details) { display: grid; align-content: start; gap: 8px; }
.items.extra-large { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.items.large { grid-template-columns: repeat(auto-fill, minmax(115px, 1fr)); }
.items.icons { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tile { min-width: 0; border: 1px solid transparent; border-radius: 5px; cursor: default; }
.tile, .details-row { user-select: none; }
.tile:hover { background: #f0f6fd; border-color: #c7def8; }
.tile.selected { background: #dcecff; border-color: #74abe3; }
.extra-large .tile, .large .tile { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; text-align: center; }
.extra-large .item-icon { font-size: 70px; }
.large .item-icon { font-size: 48px; }
.icons .tile { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 5px 8px; }
.icons .item-icon { font-size: 28px; }
.item-name { overflow: hidden; text-overflow: ellipsis; }
.rename-input {
  min-width: 70px;
  max-width: 100%;
  border: 1px solid #1873c9;
  border-radius: 2px;
  padding: 2px 4px;
  color: #202124;
  background: #fff;
  font: inherit;
  outline: 1px solid rgb(24 115 201 / 20%);
  user-select: text;
}
.extra-large .item-name, .large .item-name { width: 100%; margin-top: 5px; }

.details { display: block; padding-top: 3px; }
.details-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.details-table th { position: sticky; top: 0; z-index: 1; height: 32px; border-bottom: 1px solid #cdd2d9; padding: 0 8px; color: #535b66; background: #fff; text-align: left; font-weight: 500; cursor: pointer; }
.details-table th:hover { background: #f2f5f8; }
.details-table th[data-sort="kind"] { width: 54px; text-align: center; }
.details-table th[data-sort="name"] { width: 35%; }
.details-table th[data-sort="modifiedAt"], .details-table th[data-sort="createdAt"] { width: 20%; }
.details-table td { height: 34px; border-bottom: 1px solid #eff1f4; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details-row:hover { background: #f0f6fd; }
.details-row.selected { background: #dcecff; outline: 1px solid #8ab9e8; outline-offset: -1px; }
.details-row .item-icon { font-size: 19px; text-align: center; }
.sort-mark { margin-left: 5px; color: #145fa8; }

.drawio-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(14 25 39 / 62%);
}
.drawio-modal.hidden { display: none; }
.drawio-window {
  width: min(1500px, 96vw);
  height: min(920px, 94vh);
  display: grid;
  grid-template-rows: 42px 1fr;
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 55px rgb(0 0 0 / 35%);
}
.drawio-header { display: flex; align-items: center; gap: 12px; padding-left: 14px; color: #fff; background: #185abd; font-weight: 600; }
.drawio-status { flex: 1; overflow: hidden; color: #dcecff; font-size: 12px; font-weight: 400; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.drawio-close { width: 44px; height: 42px; border: 0; color: #fff; background: transparent; font-size: 25px; cursor: pointer; }
.drawio-close:hover { background: #c42b1c; }
.drawio-frame { width: 100%; height: 100%; border: 0; background: #fff; }

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: rgb(14 25 39 / 72%);
}
.image-preview-modal.hidden { display: none; }
.image-preview-window {
  width: 90vw;
  height: 90vh;
  display: grid;
  grid-template-rows: 42px 1fr;
  overflow: hidden;
  border-radius: 7px;
  background: #20252b;
  box-shadow: 0 18px 55px rgb(0 0 0 / 42%);
}
.image-preview-header { display: flex; align-items: center; gap: 12px; padding-left: 14px; color: #fff; background: #185abd; font-weight: 600; }
.image-preview-header > span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-zoom { color: #dcecff; font-size: 12px; font-weight: 400; }
.image-preview-close { width: 44px; height: 42px; border: 0; color: #fff; background: transparent; font-size: 25px; cursor: pointer; }
.image-preview-close:hover { background: #c42b1c; }
.image-preview-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #fff;
  background-image: conic-gradient(#c0c0c0 25%, #fff 0 50%, #c0c0c0 0 75%, #fff 0);
  background-size: 24px 24px;
  touch-action: none;
  user-select: none;
}
.image-preview { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; -webkit-user-drag: none; }
.image-preview.pannable { cursor: grab; }
.image-preview.dragging { cursor: grabbing; }
.image-preview-controls { position: absolute; right: 18px; bottom: 18px; display: flex; gap: 7px; }
.image-preview-controls button {
  min-width: 54px;
  height: 40px;
  border: 1px solid #8d959e;
  border-radius: 5px;
  color: #fff;
  background: rgb(30 36 43 / 88%);
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 2px 7px rgb(0 0 0 / 30%);
}
.image-preview-controls button:hover { background: #185abd; border-color: #78afe8; }

@media (max-width: 760px) {
  .brand span:last-child { display: none; }
  .brand { flex: 0 0 auto; }
  .toolbar { padding: 0 8px; }
  .toolbar-actions { gap: 3px; }
  .explorer { grid-template-columns: 38% 62%; }
  .details-table th[data-sort="createdAt"], .details-table td:nth-child(4),
  .details-table th[data-sort="type"], .details-table td:nth-child(5) { display: none; }
  .drawio-modal { padding: 0; }
  .drawio-window { width: 100vw; height: 100vh; border-radius: 0; }
}
