:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --sidebar: #0d1014;
  --card: #171b22;
  --card2: #20252e;
  --main: #2e3137;
  --main-soft: #363a42;
  --text: #f7f7fb;
  --muted: rgba(247,247,251,.58);
  --muted2: rgba(247,247,251,.38);
  --line: rgba(255,255,255,.075);
  --accent: #ff8a22;
  --accent2: #58c7ff;
  --danger: #ff7676;
  --good: #65e6b1;
  --radius: 18px;
  --tap: 44px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
button, input { font: inherit; }
button {
  border: 0;
  border-radius: 13px;
  min-height: 38px;
  padding: 9px 13px;
  background: rgba(255,255,255,.07);
  color: #fff;
  cursor: pointer;
  transition: background .14s ease, transform .14s ease, opacity .14s ease;
}
button:hover { background: rgba(255,255,255,.11); }
button:active { transform: translateY(1px) scale(.99); }
button:disabled { opacity: .42; cursor: default; transform: none; }
input {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  min-height: 42px;
  padding: 11px 13px;
  background: rgba(255,255,255,.055);
  color: #fff;
  outline: none;
}
input:focus { border-color: rgba(255,138,34,.7); box-shadow: 0 0 0 3px rgba(255,138,34,.12); }
.hidden { display: none !important; }
.app { width: 100vw; height: 100vh; height: 100dvh; display: grid; place-items: center; background: radial-gradient(circle at 20% 0%, rgba(255,138,34,.09), transparent 30%), var(--bg); }

.login-card {
  width: min(430px, calc(100vw - 28px));
  display: grid;
  gap: 13px;
  padding: 28px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.035)), var(--card);
  border: 1px solid var(--line);
}
.login-logo { width: 82px; height: 82px; object-fit: contain; border-radius: 22px; }
.login-card h1 { margin: 0; font-size: 28px; line-height: 1.05; }
.login-card p { margin: -4px 0 7px; color: var(--muted); }
.login-card button { min-height: 46px; background: linear-gradient(135deg, #ff7a1a, #ffb35d); color: #141414; font-weight: 800; }
.remember-row { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status { font-size: 12px; color: var(--muted); line-height: 1.35; min-height: 16px; }

.notes-app {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 330px 1fr;
  background: var(--main);
  overflow: hidden;
}
.mobile-appbar { display: none; }
.sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--sidebar);
  border-right: 1px solid rgba(255,255,255,.06);
  overflow: auto;
}
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 3px; }
.side-brand { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.side-brand img { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; flex: 0 0 auto; }
.side-brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.small-button { min-height: 34px; padding: 7px 10px; font-size: 13px; }
#syncStatus {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.58);
}
.sidebar > button { width: 100%; justify-content: center; }
#newPageButton, #mobileNewPageButton { background: linear-gradient(135deg, #ff7a1a, #ffb35d); color: #141414; font-weight: 900; }
.danger-button { background: rgba(255, 92, 92, .14); color: #ffc7c7; }
.danger-button:hover:not(:disabled) { background: rgba(255, 92, 92, .23); }
.admin-only { background: rgba(88,199,255,.13); color: #c7efff; }

.tree { display: grid; gap: 7px; margin-top: 4px; padding-bottom: 20px; }
.item {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 14px;
  color: rgba(255,255,255,.76);
  cursor: pointer;
}
.item:hover { background: rgba(255,255,255,.065); color: #fff; }
.item.active { background: rgba(255,255,255,.105); color: #fff; }
.item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 13px; height: 13px; border-radius: 5px; background: #8b9bff; flex: 0 0 auto; }

.editor {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 8px;
  padding: 32px;
  overflow: hidden;
  background: var(--main);
}
.editor-head { display: none; align-items: center; justify-content: space-between; gap: 10px; }
.back-button { background: rgba(255,255,255,.07); }
.title {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 800;
  padding: 0;
  min-height: auto;
  box-shadow: none !important;
}
.title:disabled { opacity: .6; }
.toolbar { display: flex; gap: 7px; flex-wrap: wrap; padding: 8px 0 11px; }
.toolbar button { min-height: 32px; padding: 6px 10px; background: rgba(255,255,255,.06); font-size: 13px; }
.color-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.06); color: #fff; font-size: 13px; }
.color-tool input { width: 20px; height: 20px; min-height: 20px; border: 0; padding: 0; background: transparent; box-shadow: none; }
.content {
  min-width: 0;
  overflow: auto;
  outline: none;
  line-height: 1.58;
  font-size: 16px;
  padding: 8px 12px 80px 0;
}
.content:empty::before { content: attr(data-placeholder); color: rgba(255,255,255,.35); }
.content h2 { font-size: 1.45em; line-height: 1.18; margin: .45em 0 .35em; }
.content blockquote { margin: .7em 0; padding: .55em .8em; border-left: 3px solid var(--accent); background: rgba(255,255,255,.04); border-radius: 0 10px 10px 0; }
.muted { color: var(--muted); }

.icon-button { width: var(--tap); min-width: var(--tap); height: var(--tap); min-height: var(--tap); padding: 0; display: inline-grid; place-items: center; border-radius: 15px; font-weight: 900; }
.icon-button.primary { background: linear-gradient(135deg, #ff7a1a, #ffb35d); color: #161616; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.62); padding: 18px; z-index: 20; }
.modal-card { width: min(720px, calc(100vw - 36px)); max-height: min(720px, calc(100vh - 36px)); overflow: auto; background: #181b24; border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: grid; gap: 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: center; }
.users-list { display: grid; gap: 6px; }
.user-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.045); font-size: 13px; }
.user-row em { color: rgba(255,255,255,.48); font-style: normal; }
.badge { padding: 3px 7px; border-radius: 999px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); font-size: 11px; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 760px) {
  body { overflow: hidden; overscroll-behavior: none; }
  .app { display: block; background: var(--bg); }
  .login-card {
    min-height: 100dvh;
    width: 100vw;
    border-radius: 0;
    border: 0;
    padding: max(34px, env(safe-area-inset-top) + 20px) 22px 22px;
    align-content: center;
    background: radial-gradient(circle at 15% 5%, rgba(255,138,34,.16), transparent 34%), #101318;
  }
  .login-logo { width: 92px; height: 92px; margin-bottom: 2px; }
  .login-card h1 { font-size: 31px; }
  .login-card p { font-size: 15px; margin-bottom: 12px; }
  .login-card input, .login-card button { min-height: 52px; border-radius: 16px; font-size: 16px; }

  .notes-app {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: calc(58px + env(safe-area-inset-top)) 1fr;
    background: var(--bg);
  }
  .mobile-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
    background: rgba(13,16,20,.98);
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .mobile-brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 900; letter-spacing: .4px; }
  .mobile-brand img { width: 34px; height: 34px; border-radius: 10px; }
  .mobile-actions { display: inline-flex; align-items: center; gap: 7px; position: relative; }
  .topline { display: none; }
  .sidebar {
    grid-row: 2;
    border-right: 0;
    padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
    gap: 10px;
    background: #0d1014;
  }
  .sidebar > button { display: none; }
  #syncStatus { display: none; }
  .search-input { display: block; min-height: 50px; border-radius: 16px; font-size: 16px; margin-bottom: 2px; }
  .tree { gap: 8px; padding-bottom: 32px; }
  .item { min-height: 50px; border-radius: 16px; padding: 10px 12px !important; font-size: 15px; background: rgba(255,255,255,.035); }
  .item.active { background: rgba(255,138,34,.16); }
  .dot { width: 16px; height: 16px; border-radius: 6px; }

  .editor {
    grid-row: 2;
    display: none;
    grid-template-rows: auto auto auto 1fr;
    gap: 8px;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    background: var(--main);
  }
  .notes-app.editor-open .sidebar { display: none; }
  .notes-app.editor-open .editor { display: grid; }
  .editor-head { display: flex; justify-content: space-between; gap: 10px; }
  .back-button, #editorSaveButton { min-height: 44px; border-radius: 14px; }
  .title { font-size: 28px; padding: 8px 0 4px; }
  .toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 0 8px;
    margin: 0 -14px;
    padding-left: 14px;
    padding-right: 14px;
    scroll-snap-type: x proximity;
  }
  .toolbar button, .color-tool { flex: 0 0 auto; min-height: 38px; border-radius: 13px; font-size: 13px; }
  .content {
    font-size: 17px;
    line-height: 1.62;
    padding: 10px 2px 120px 0;
    -webkit-user-select: text;
    user-select: text;
  }
  .modal { padding: 10px; align-items: end; }
  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 28px);
    border-radius: 24px 24px 14px 14px;
    padding: 16px;
  }
  .admin-form { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr auto; }
  .user-row em { grid-column: 1 / -1; }
}

.search-input { width: 100%; min-height: 42px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.035); color: var(--text); padding: 0 13px; outline: none; font: inherit; }
.search-input:focus { border-color: rgba(255,138,34,.55); box-shadow: 0 0 0 3px rgba(255,138,34,.10); }
.primary-save { background: linear-gradient(135deg, #ff7a1a, #ffb35d); color: #151515; font-weight: 900; }
.mobile-menu { position: fixed; right: 10px; top: calc(env(safe-area-inset-top) + 54px); z-index: 30; width: min(280px, calc(100vw - 20px)); padding: 10px; border-radius: 18px; background: rgba(18,21,27,.98); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 16px 40px rgba(0,0,0,.35); display: grid; gap: 8px; }
.mobile-menu.hidden { display: none !important; }
.mobile-menu button { min-height: 46px; border-radius: 14px; justify-content: flex-start; padding: 0 14px; text-align: left; }

.chevron { width: 16px; flex: 0 0 16px; color: rgba(255,255,255,.44); text-align: center; font-size: 13px; }
.folder-item .label { font-weight: 650; }
.mobile-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(360px, calc(100vw - 28px));
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(16,18,24,.94);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 12px 28px rgba(0,0,0,.32);
  font-size: 13px;
}
.narrow-modal { width: min(460px, calc(100vw - 36px)); }
.password-form { grid-template-columns: 1fr; }

@media (max-width: 760px) {
  .chevron { width: 18px; flex-basis: 18px; font-size: 15px; }
  .item { gap: 9px; }
  .folder-item { background: rgba(255,255,255,.052); }
  .mobile-toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
}


.attachments-panel {
  display: grid;
  gap: 9px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.06);
}
.attachments-panel.hidden { display: none !important; }
.attachments-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.attachments-head strong { font-size: 13px; color: rgba(255,255,255,.82); }
.attachments-list { display: grid; gap: 7px; }
.attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(255,255,255,.045);
}
.attachment-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.attachment-meta { color: rgba(255,255,255,.48); font-size: 12px; }
.attachment-row button { min-height: 34px; border-radius: 10px; padding: 0 10px; font-size: 12px; }

@media (max-width: 760px) {
  .editor { grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
  .attachments-panel { margin-top: 4px; padding: 10px; border-radius: 15px; }
  .attachment-row { grid-template-columns: minmax(0, 1fr) auto; }
  .attachment-meta { grid-column: 1 / -1; }
  .attachment-row button { min-height: 40px; }
}

/* FILES-01 UI FIX */
.attachments-panel {
  margin-top: 28px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.06);
}

.attachments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.attachments-head strong {
  font-size: 14px;
}

.attachments-head #attachFileButton {
  width: auto !important;
  min-width: auto !important;
  padding: 8px 12px !important;
  flex: 0 0 auto;
}

.attachments-list {
  display: grid;
  gap: 8px;
}

.attachment-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.045);
}

.attachment-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
}

.attachment-meta {
  white-space: nowrap;
  color: rgba(255,255,255,.55);
  font-size: 12px;
}

.attachment-row button,
.attachment-row .small-button {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 30px;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  flex: 0 0 auto;
}

.attachment-row button:last-child {
  width: 30px !important;
  padding: 0 !important;
  color: #ffd0d0;
  background: rgba(255, 80, 80, .16);
}

.attachment-row button:last-child:hover {
  background: rgba(255, 80, 80, .28);
}

.attachments-status,
#attachmentsStatus {
  margin-top: 8px;
  min-height: 18px;
  font-size: 12px;
}

@media (max-width: 760px) {
  .attachments-panel {
    margin: 18px 12px 0;
    padding: 14px;
  }

  .attachment-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .attachment-meta {
    display: none;
  }
}

/* FILES-01 COMPACT ATTACHMENTS FINAL FIX */
.attachments-panel {
  margin-top: 18px !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  min-height: 0 !important;
}

.attachments-head {
  margin-bottom: 8px !important;
  min-height: 30px !important;
}

.attachments-list {
  gap: 6px !important;
}

.attachment-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto auto !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 36px !important;
  padding: 8px 10px !important;
  border-radius: 10px !important;
}

.attachment-name {
  font-size: 13px !important;
  line-height: 1.2 !important;
}

.attachment-meta {
  font-size: 12px !important;
  line-height: 1.2 !important;
}

.attachment-row button,
.attachment-row .small-button {
  height: 28px !important;
  width: auto !important;
  min-width: 28px !important;
  padding: 0 9px !important;
  margin: 0 !important;
  line-height: 1 !important;
}

.attachment-row button:last-child {
  width: 28px !important;
  min-width: 28px !important;
  max-width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  grid-column: auto !important;
  grid-row: auto !important;
}

#attachmentsStatus {
  margin-top: 4px !important;
  min-height: 0 !important;
}

@media (max-width: 760px) {
  .attachment-row {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
  }

  .attachment-meta {
    display: none !important;
  }
}

/* FILES-01 HARD COMPACT OVERRIDE */
body .attachments-panel,
body section#attachmentsPanel.attachments-panel {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 18px 0 0 0 !important;
  padding: 10px 12px !important;
  box-sizing: border-box !important;
  border-radius: 12px !important;
  overflow: visible !important;
}

body .attachments-head,
body #attachmentsPanel .attachments-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  margin: 0 0 8px 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

body .attachments-head strong {
  display: inline-flex !important;
  align-items: center !important;
  height: 30px !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  line-height: 1 !important;
}

body #attachFileButton {
  width: auto !important;
  height: 30px !important;
  min-height: 30px !important;
  max-height: 30px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 10px !important;
  flex: 0 0 auto !important;
  line-height: 1 !important;
}

body .attachments-list,
body #attachmentsList {
  display: grid !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
}

body .attachment-row,
body #attachmentsList .attachment-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto auto !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  margin: 0 !important;
  padding: 6px 8px !important;
  box-sizing: border-box !important;
  border-radius: 9px !important;
}

body .attachment-name {
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  line-height: 1.1 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

body .attachment-meta {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body .attachment-row button {
  width: auto !important;
  height: 26px !important;
  min-width: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  flex: 0 0 auto !important;
}

body .attachment-row button:last-child {
  width: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  padding: 0 !important;
}

body #attachmentsStatus {
  display: block !important;
  margin: 4px 0 0 0 !important;
  padding: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  line-height: 1.2 !important;
}

@media (max-width: 760px) {
  body .attachment-row,
  body #attachmentsList .attachment-row {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
  }

  body .attachment-meta {
    display: none !important;
  }
}

/* FILES-01 STICKY ATTACHMENTS FIX */
body section#attachmentsPanel.attachments-panel {
  position: sticky !important;
  bottom: 14px !important;
  z-index: 20 !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: 132px !important;
  margin: 18px 0 0 0 !important;
  padding: 8px 10px !important;
  box-sizing: border-box !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background: rgba(46,49,55,.96) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  backdrop-filter: blur(8px);
}

body section#attachmentsPanel.attachments-panel.hidden {
  display: none !important;
}

body #attachmentsPanel .attachments-head {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  margin: 0 0 6px 0 !important;
  padding: 0 !important;
}

body #attachmentsPanel .attachments-list {
  max-height: 82px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 5px !important;
}

body #attachmentsPanel .attachment-row {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 5px 8px !important;
  grid-template-columns: minmax(0, 1fr) auto auto auto !important;
}

body #attachmentsPanel .attachment-row button {
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
}

body #attachmentsPanel .attachment-row button:last-child {
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
}

body #attachmentsPanel #attachmentsStatus {
  display: none !important;
}

/* чтобы последний текст не прятался под sticky-вложениями */
body .editor,
body .content,
body #content {
  scroll-padding-bottom: 160px !important;
}

@media (max-width: 760px) {
  body section#attachmentsPanel.attachments-panel {
    bottom: 10px !important;
    margin: 12px 0 0 0 !important;
    max-height: 124px !important;
  }

  body #attachmentsPanel .attachments-list {
    max-height: 76px !important;
  }
}

/* FILES-01 FLOATING ATTACHMENTS FINAL FIX */
body section#attachmentsPanel.attachments-panel {
  position: fixed !important;
  left: 330px !important;
  right: 28px !important;
  bottom: 28px !important;
  z-index: 9999 !important;

  display: block !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: 118px !important;

  margin: 0 !important;
  padding: 8px 10px !important;
  box-sizing: border-box !important;

  border-radius: 12px !important;
  background: rgba(46,49,55,.98) !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

body section#attachmentsPanel.attachments-panel.hidden {
  display: none !important;
}

body #attachmentsPanel .attachments-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;

  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;

  margin: 0 0 6px 0 !important;
  padding: 0 !important;
}

body #attachmentsPanel .attachments-head strong {
  height: 26px !important;
  display: inline-flex !important;
  align-items: center !important;

  margin: 0 !important;
  padding: 0 !important;

  font-size: 13px !important;
  line-height: 1 !important;
}

body #attachmentsPanel #attachFileButton {
  width: auto !important;
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;

  margin: 0 !important;
  padding: 0 10px !important;

  font-size: 12px !important;
  line-height: 1 !important;
  flex: 0 0 auto !important;
}

body #attachmentsPanel #attachmentsList,
body #attachmentsPanel .attachments-list {
  display: grid !important;
  gap: 5px !important;

  margin: 0 !important;
  padding: 0 !important;

  max-height: 74px !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

body #attachmentsPanel .attachment-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto auto !important;
  align-items: center !important;
  gap: 8px !important;

  width: 100% !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;

  margin: 0 !important;
  padding: 4px 8px !important;
  box-sizing: border-box !important;

  border-radius: 8px !important;
  background: rgba(255,255,255,.045) !important;
}

body #attachmentsPanel .attachment-name {
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;

  font-size: 13px !important;
  line-height: 1 !important;

  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

body #attachmentsPanel .attachment-meta {
  margin: 0 !important;
  padding: 0 !important;

  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  color: rgba(255,255,255,.55) !important;
}

body #attachmentsPanel .attachment-row button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: auto !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;

  margin: 0 !important;
  padding: 0 8px !important;

  font-size: 12px !important;
  line-height: 1 !important;
  flex: 0 0 auto !important;
}

body #attachmentsPanel .attachment-row button:last-child {
  width: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  padding: 0 !important;
}

body #attachmentsPanel #attachmentsStatus {
  display: none !important;
}

body .editor,
body .content,
body #content {
  padding-bottom: 150px !important;
  scroll-padding-bottom: 150px !important;
}

@media (max-width: 760px) {
  body section#attachmentsPanel.attachments-panel {
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    max-height: 116px !important;
  }

  body #attachmentsPanel .attachment-row {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
  }

  body #attachmentsPanel .attachment-meta {
    display: none !important;
  }
}

/* FILES-01 DRAG + RESIZE ATTACHMENTS PANEL */
body section#attachmentsPanel.attachments-panel.attachments-floating {
  position: fixed !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 9999 !important;
  resize: none !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

body #attachmentsPanel.attachments-floating .attachments-head {
  cursor: move !important;
  user-select: none !important;
}

body #attachmentsPanel .attachments-panel-tools {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-left: auto !important;
}

body #attachmentsPanel .attachments-panel-tools button {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  max-width: 26px !important;
  padding: 0 !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

body #attachmentsPanel .attachments-resize-handle {
  position: absolute !important;
  right: 3px !important;
  bottom: 3px !important;
  width: 14px !important;
  height: 14px !important;
  cursor: nwse-resize !important;
  opacity: .45 !important;
  border-right: 2px solid rgba(255,255,255,.35) !important;
  border-bottom: 2px solid rgba(255,255,255,.35) !important;
  border-radius: 0 0 8px 0 !important;
}

body #attachmentsPanel.attachments-vertical .attachments-list,
body #attachmentsPanel.attachments-vertical #attachmentsList {
  max-height: calc(100% - 36px) !important;
}

body #attachmentsPanel.attachments-vertical .attachment-row {
  height: auto !important;
  min-height: 58px !important;
  max-height: none !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: auto auto !important;
}

body #attachmentsPanel.attachments-vertical .attachment-name {
  grid-column: 1 / 3 !important;
}

body #attachmentsPanel.attachments-vertical .attachment-meta {
  grid-column: 1 / 2 !important;
}

body #attachmentsPanel.attachments-vertical .attachment-row button {
  grid-row: 2 !important;
}

body #attachmentsPanel.attachments-horizontal .attachments-list,
body #attachmentsPanel.attachments-horizontal #attachmentsList {
  max-height: calc(100% - 36px) !important;
}

@media (max-width: 760px) {
  body section#attachmentsPanel.attachments-panel.attachments-floating {
    left: 10px !important;
    right: auto !important;
  }
}

/* FILES-01 FREE DRAG / NO MODE BUTTON FIX */
body #attachmentsLayoutModeButton {
  display: none !important;
}

body #attachmentsPanel .attachments-panel-tools {
  margin-left: auto !important;
}

body #attachmentsPanel.attachments-floating {
  max-width: calc(100vw - 24px) !important;
  max-height: calc(100vh - 24px) !important;
}

/* FILES-01 TRUE FREE DRAG FIX */
body section#attachmentsPanel.attachments-panel.attachments-floating {
  right: auto !important;
  bottom: auto !important;
  max-width: calc(100vw - 20px) !important;
  max-height: calc(100vh - 20px) !important;
}

body #attachmentsLayoutModeButton {
  display: none !important;
}

/* FILES-01 +FILE BUTTON FIX */
body #attachmentsPanel #attachFileButton {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: auto !important;
  min-width: 64px !important;
  max-width: none !important;

  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;

  padding: 0 10px !important;
  margin: 0 !important;

  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow: visible !important;

  font-size: 12px !important;
  line-height: 1 !important;
  flex: 0 0 auto !important;
}

body #attachmentsPanel .attachments-panel-tools {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  min-width: 72px !important;
  flex: 0 0 auto !important;
}

body #attachmentsPanel .attachments-head {
  grid-template-columns: minmax(0, 1fr) auto !important;
  overflow: visible !important;
}

body #attachmentsPanel .attachments-head strong {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
