:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #edf1fa;
  background: #0c1017;
  --panel: #141b26;
  --panel-hover: #192230;
  --line: #293344;
  --muted: #8996aa;
  --accent: #9aabff;
  --purple: #747ff2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 8% -15%, #313a70 0, transparent 35%),
    radial-gradient(ellipse at 100% 5%, #20284a 0, transparent 27%),
    #0c1017;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #e8edfa;
  background: #18212e;
  font: inherit;
  cursor: pointer;
  transition: .16s ease;
}

button:hover, .button:hover {
  border-color: #6876c9;
  background: #222d41;
  transform: translateY(-1px);
}

button:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 15px clamp(18px, 5vw, 68px);
  border-bottom: 1px solid #ffffff12;
  background: #101620eF;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f2f4ff;
  text-decoration: none;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.4px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: white;
  background: linear-gradient(135deg, #7788ff, #9c71ef);
}
.brand-dot { color: #a0aaff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-button { user-select: none; }

main { width: min(1100px, 92vw); margin: 44px auto; }

.welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 29px;
}
.eyebrow, .modal-kicker {
  margin: 0 0 9px;
  color: #a1aaff;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.5px;
}
h1 { margin: 0; font-size: clamp(30px, 5vw, 43px); letter-spacing: -1.5px; }
.subheading { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.storage-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 30px;
  color: #adb8ca;
  font-size: 12px;
  white-space: nowrap;
}
.storage-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5dd6a1;
  box-shadow: 0 0 12px #5dd6a177;
}

.pathbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111821;
  overflow-x: auto;
}
.home-button { padding: 7px 10px; }
#breadcrumbs { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.crumb { border: 0; background: transparent; padding: 6px 7px; color: #c7d0e0; }
.crumb:hover { background: #ffffff0b; transform: none; }
.slash { color: #5d6879; }

.list-head {
  display: flex;
  justify-content: space-between;
  padding: 20px 16px 10px;
  color: #758198;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
}
.file-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #111721c9;
}
.file-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, auto);
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 11px 15px;
  border-bottom: 1px solid #ffffff0a;
  transition: background .15s;
}
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: #ffffff06; }
.file-main { display: flex; align-items: center; gap: 13px; min-width: 0; }
.file-icon {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid #ffffff0c;
  border-radius: 12px;
  background: #20293a;
  font-size: 20px;
}
.filename {
  overflow: hidden;
  color: #e7ebf5;
  font-size: 14px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.filename:hover { color: #b9c3ff; }
.file-sub { margin-top: 5px; color: #738096; font-size: 11px; }
.row-right { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.file-meta { color: #8995a8; font-size: 12px; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.actions button { padding: 6px 8px; border-radius: 8px; font-size: 11px; }
.notice { min-height: 25px; padding: 8px 2px 0; color: #aab5ff; font-size: 13px; }
.empty { padding: 44px 20px; color: #8995a8; text-align: center; }

.modal {
  width: min(900px, calc(100% - 24px));
  padding: 20px;
  border: 1px solid #37435a;
  border-radius: 17px;
  color: #e8edfa;
  background: #141b26;
  box-shadow: 0 25px 90px #0009;
}
.modal::backdrop { background: #05070bd1; backdrop-filter: blur(5px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.modal-head h2 { margin: 0; overflow-wrap: anywhere; font-size: 18px; }
.modal-kicker { display: block; margin-bottom: 5px; font-size: 9px; }
.icon-button { width: 36px; height: 36px; padding: 0; }
textarea {
  display: block;
  width: 100%;
  min-height: 55vh;
  padding: 15px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: #e6ebf6;
  background: #0b1017;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
}
textarea:focus { border-color: #7684e5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.primary { border-color: #7582ed; background: #5968db; }
.preview-body { display: grid; place-items: center; min-height: 120px; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 70vh; border-radius: 9px; }

/* Предпросмотр текстовых документов и скриптов */
[hidden] { display: none !important; }
.preview-actions { display: flex; align-items: center; gap: 8px; }
.preview-actions button { padding: 7px 11px; font-size: 13px; }
.text-preview {
  justify-self: stretch;
  width: 100%;
  max-height: 68vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0b1017;
}
.text-preview pre {
  margin: 0;
  padding: 16px 18px;
  color: #dfe6f5;
  font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 4;
}
.markdown { padding: 20px 24px; font-size: 14.5px; line-height: 1.75; color: #e3e9f7; }
.markdown > :first-child { margin-top: 0; }
.markdown h1, .markdown h2, .markdown h3,
.markdown h4, .markdown h5, .markdown h6 { margin: 22px 0 10px; letter-spacing: -.3px; line-height: 1.3; }
.markdown h1 { font-size: 25px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.markdown h2 { font-size: 20px; }
.markdown h3 { font-size: 17px; }
.markdown p { margin: 10px 0; }
.markdown a { color: var(--accent); }
.markdown code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101724;
  font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #ffd9a8;
}
.markdown pre {
  margin: 14px 0;
  padding: 14px 16px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0b1017;
}
.markdown pre code { padding: 0; border: none; background: none; color: #dfe6f5; font-size: 13px; }
.markdown ul, .markdown ol { margin: 10px 0; padding-left: 24px; }
.markdown li { margin: 4px 0; }
.markdown blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 3px solid #5968db;
  border-radius: 0 10px 10px 0;
  background: #121a27;
  color: #b9c4d8;
}
.markdown hr { margin: 20px 0; border: none; border-top: 1px solid var(--line); }
.markdown img { max-width: 100%; border-radius: 9px; }

.editor-meta { margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.editor-hint { margin-right: auto; color: #6f7d93; font-size: 12px; }

/* Переключатель рабочей директории и блок пользователя */
.root-select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 230px;
  padding: 9px 34px 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: #18212e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238996aa' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  color: #e8edfa;
  font: inherit;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: .16s ease;
}
.root-select:hover { border-color: #6876c9; background-color: #222d41; }
.root-select:focus { outline: none; border-color: #6876c9; box-shadow: 0 0 0 3px #6876c933; }
.root-select option { background: #141b26; color: #e8edfa; }
.userbox { display: flex; align-items: center; gap: 9px; }
.userbox .button { text-decoration: none; }
.userbox .username {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 780px) {
  .file-row { grid-template-columns: 1fr; gap: 9px; }
  .row-right { justify-content: space-between; padding-left: 55px; }
}
@media (max-width: 560px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .toolbar { width: 100%; }
  .toolbar button, .toolbar label, .toolbar select { flex: 1; min-width: 0; max-width: none; }
  .toolbar span { display: none; }
  main { margin-top: 28px; }
  .welcome { align-items: flex-start; flex-direction: column; }
  .storage-badge { display: none; }
  .list-head { display: none; }
  .row-right { align-items: flex-start; flex-direction: column; padding-left: 55px; }
  .actions { justify-content: flex-start; }
}
