.file-app {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.file-main {
  width: min(1180px, 94vw);
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 auto;
  padding: 22px 0 20px;
}

.topbar-actions a { text-decoration: none; }

.file-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.breadcrumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
}

.crumb {
  flex: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: var(--text);
  cursor: pointer;
  font: 800 12.5px var(--sans);
  padding: 8px 12px;
}

.crumb:hover {
  border-color: var(--border-strong);
  background: var(--panel-soft);
}

.crumb-sep { color: var(--text-faint); font-size: 12px; }


.file-panel {
  min-height: 0;
  flex: 1;
  overflow: hidden;
  border: 1px solid rgba(216, 227, 239, .95);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow-sm);
}

.file-table-head,
.file-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px 170px 46px;
  align-items: center;
  gap: 12px;
}

.file-table-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.file-list {
  max-height: calc(100dvh - 188px);
  overflow: auto;
}

.file-row {
  position: relative;
  min-height: 58px;
  padding: 10px 62px 10px 16px;
  border-bottom: 1px solid rgba(216, 227, 239, .72);
}

.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--panel-soft); }

.file-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.file-icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.file-icon.dir {
  background: #ecfdf5;
  color: var(--accent-2);
}

.file-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.file-title small {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size,
.file-date {
  color: var(--text-dim);
  font-size: 13px;
}

.file-actions {
  position: absolute;
  top: 10px;
  right: 16px;
  display: flex;
  justify-content: flex-end;
}

.file-menu-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.file-menu-btn:hover {
  border-color: var(--border-strong);
  background: #f8fbfe;
}

.file-menu {
  position: fixed;
  z-index: 80;
  min-width: 168px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.file-menu-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: 800 13px var(--sans);
  padding: 11px 12px;
  text-align: left;
}

.file-menu-action:hover {
  background: var(--panel-soft);
}

.file-menu-action.danger {
  color: var(--danger);
}

.file-menu-action[disabled] {
  cursor: not-allowed;
  opacity: .38;
}

.file-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--text-dim);
  font-size: 14px;
}

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .34);
  backdrop-filter: blur(7px);
}

.editor-panel {
  position: relative;
  width: min(980px, 100%);
  height: min(760px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(216, 227, 239, .92);
  border-radius: 24px;
  background: rgba(255,255,255,.97);
  box-shadow: var(--shadow);
  animation: sheetIn .2s ease;
}

.editor-head,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.editor-head h2 {
  max-width: min(760px, 72vw);
  margin: 0;
  overflow: hidden;
  font-size: 19px;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editor-text {
  min-height: 0;
  flex: 1;
  resize: none;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  outline: 0;
  background: #101827;
  color: #dbeafe;
  font: 13px/1.55 var(--mono);
  tab-size: 2;
}

#editor-text:focus {
  border-color: rgba(37, 99, 235, .55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .11);
}

#editor-status {
  color: var(--text-dim);
  font-size: 13px;
}

@media (max-width: 820px) {
  .file-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .file-table-head {
    display: none;
  }
  .file-list {
    max-height: calc(100dvh - 220px);
  }
  .file-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 58px 12px 14px;
  }
  .file-actions {
    top: 12px;
    right: 14px;
    justify-content: flex-end;
  }
  .file-size,
  .file-date {
    padding-left: 45px;
  }
}
