:root {
  --od-bg: #faf9f8;
  --od-surface: #ffffff;
  --od-sidebar: #f3f2f1;
  --od-border: #edebe9;
  --od-border-strong: #d2d0ce;
  --od-text: #242424;
  --od-muted: #605e5c;
  --od-blue: #0078d4;
  --od-blue-hover: #106ebe;
  --od-blue-soft: #deecf9;
  --od-row-hover: #f5f5f5;
  --od-row-selected: #eff6fc;
  --od-danger: #a4262c;
  --od-ok: #107c10;
  --od-folder: #ffb900;
  --sidebar-w: 260px;
  --radius: 4px;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  --shadow: 0 1.6px 3.6px rgba(0, 0, 0, 0.13), 0 0.3px 0.9px rgba(0, 0, 0, 0.11);
  --bottom-nav-h: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-only {
  display: none !important;
}

.desktop-only {
  display: revert;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--od-bg);
  color: var(--od-text);
  font-family: var(--font);
  font-size: 14px;
}

button,
input {
  font: inherit;
}

#app {
  height: 100%;
}

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 400px at 10% 0%, #deecf9 0%, transparent 55%),
    radial-gradient(700px 360px at 100% 10%, #f3f2f1 0%, transparent 50%),
    var(--od-bg);
}

.login-screen[hidden] {
  display: none !important;
}

.login-card {
  width: min(400px, 100%);
  background: var(--od-surface);
  border: 1px solid var(--od-border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 28px 24px 20px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand h1 {
  margin: 0;
  font-size: 22px;
}

.login-brand p {
  margin: 2px 0 0;
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form label,
.settings-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--od-muted);
}

.login-form input,
.settings-form input,
.users-add-form input,
.users-add-form select {
  border: 1px solid var(--od-border-strong);
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
  color: var(--od-text);
  background: #fff;
}

.login-form input:focus,
.settings-form input:focus {
  outline: none;
  border-color: var(--od-blue);
  box-shadow: 0 0 0 1px var(--od-blue);
}

.login-submit {
  width: 100%;
  margin-top: 4px;
  padding: 10px 14px;
}

.login-error {
  margin: 0;
  color: var(--od-danger);
  font-size: 13px;
  font-weight: 500;
}

.login-error[hidden] {
  display: none !important;
}

.login-hint {
  margin: 14px 0 0;
  text-align: center;
}

.login-hint code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: var(--od-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Account button (bottom-left) */
.sidebar-foot {
  margin-top: auto;
  padding: 10px 6px 0;
  border-top: 1px solid var(--od-border);
  position: relative;
}

.account-wrap {
  position: relative;
}

.account-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--od-text);
}

.account-btn:hover {
  background: #e1dfdd;
}

.account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0078d4, #5b5fc7);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: 0 0 auto;
}

.account-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

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

.account-role {
  text-transform: capitalize;
}

.account-chev {
  color: var(--od-muted);
  font-size: 11px;
}

.account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  background: var(--od-surface);
  border: 1px solid var(--od-border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px 0;
  z-index: 40;
}

.account-menu[hidden] {
  display: none !important;
}

.account-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--od-text);
  font: inherit;
}

.account-menu button:hover {
  background: var(--od-row-hover);
}

.account-menu button.danger {
  color: var(--od-danger);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.users-card {
  width: min(720px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.users-head h3 {
  margin: 0;
}

.users-add h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--od-muted);
}

.users-add-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.users-add-form button {
  grid-column: 1 / -1;
}

.users-list-wrap {
  overflow: auto;
  border: 1px solid var(--od-border);
  border-radius: 6px;
  flex: 1;
  min-height: 180px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.users-table th,
.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--od-border);
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  background: var(--od-bg);
  color: var(--od-muted);
  font-size: 12px;
}

.users-table .user-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .users-add-form {
    grid-template-columns: 1fr;
  }
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

.shell.sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.shell.sidebar-collapsed .sidebar {
  overflow: hidden;
  border: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

/* Sidebar — OneDrive style */
.sidebar {
  background: var(--od-sidebar);
  border-right: 1px solid var(--od-border);
  display: flex;
  flex-direction: column;
  padding: 12px 10px 16px;
  min-width: 0;
  transition: opacity 0.15s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 16px;
}

.sidebar-brand .brand-text {
  flex: 1;
}

.sidebar-scrim {
  display: none;
}

.account-avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.mobile-avatar-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}

.mobile-status-bar {
  display: none;
}

.floating-search {
  display: none;
}

.bottom-nav {
  display: none;
}

.bottom-sheet {
  display: none;
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12px;
}

.cloud-logo {
  display: grid;
  place-items: center;
}

.brand-text {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.add-wrap {
  position: relative;
  padding: 0 8px 14px;
}

.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 10px;
  background: var(--od-blue);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  white-space: nowrap;
  vertical-align: middle;
}

.btn-add:hover {
  background: var(--od-blue-hover);
}

.btn-add .plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  flex: 0 0 auto;
}

.btn-add-label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.btn-add .chev {
  display: inline-flex;
  align-items: center;
  opacity: 0.9;
  font-size: 10px;
  line-height: 1;
  margin-left: 2px;
  flex: 0 0 auto;
}

.add-menu {
  position: absolute;
  top: calc(100% - 6px);
  left: 6px;
  min-width: 220px;
  background: var(--od-surface);
  border: 1px solid var(--od-border-strong);
  border-radius: 4px;
  box-shadow: var(--shadow);
  z-index: 50;
  padding: 4px 0;
}

.add-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--od-text);
}

.add-menu button:hover {
  background: var(--od-row-hover);
}

.menu-sep {
  height: 1px;
  background: var(--od-border);
  margin: 4px 0;
}

.menu-hint {
  margin: 0;
  padding: 6px 14px 8px;
  color: var(--od-muted);
  font-size: 12px;
}

.mi.folder {
  filter: none;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--od-text);
  text-align: left;
}

.nav-item:hover {
  background: #e1dfdd;
}

.nav-item.active {
  background: var(--od-blue-soft);
  color: var(--od-blue);
  font-weight: 600;
}

.side-section-label {
  margin: 16px 14px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--od-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.folder-tree {
  flex: 1;
  overflow: auto;
  padding: 0 4px 8px;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--od-text);
  text-align: left;
  font-size: 13px;
}

.tree-item:hover {
  background: #e1dfdd;
}

.tree-item.active {
  background: var(--od-blue-soft);
  color: var(--od-blue);
  font-weight: 600;
}

.tree-item .indent {
  flex: 0 0 auto;
}

.tree-ico {
  color: var(--od-folder);
}

/* sidebar-foot styled with account button */

.muted {
  color: var(--od-muted);
}

.small {
  font-size: 12px;
  line-height: 1.4;
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--od-surface);
  position: relative;
}

.command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--od-border);
  background: var(--od-surface);
}

.cmd-left,
.cmd-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cmd-titles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.page-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--od-blue);
  line-height: 1.2;
}

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--od-row-hover);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 18px;
  font-weight: 600;
}

.breadcrumb button {
  border: 0;
  background: transparent;
  color: var(--od-blue);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 18px;
}

.breadcrumb button:hover {
  background: var(--od-blue-soft);
}

.breadcrumb button.current {
  color: var(--od-text);
  cursor: default;
}

.breadcrumb button.current:hover {
  background: transparent;
}

.crumb-sep {
  color: var(--od-muted);
  font-weight: 400;
  font-size: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--od-bg);
  border: 1px solid var(--od-border-strong);
  border-radius: 4px;
  padding: 0 10px;
  min-width: 180px;
}

.search-box:focus-within {
  border-color: var(--od-blue);
  box-shadow: 0 0 0 1px var(--od-blue);
}

.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  padding: 7px 0;
  width: 160px;
  color: var(--od-text);
}

.search-ico {
  color: var(--od-muted);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--od-border);
  background: var(--od-surface);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  appearance: none;
  border: 1px solid var(--od-border-strong);
  background: var(--od-surface);
  color: var(--od-text);
  border-radius: 4px;
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 500;
}

.btn:hover:not(:disabled) {
  background: var(--od-row-hover);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--od-blue);
  border-color: var(--od-blue);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--od-blue-hover);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover:not(:disabled) {
  background: var(--od-row-hover);
}

.btn.ghost.danger {
  color: var(--od-danger);
}

.status-toast {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--od-blue-soft);
  color: var(--od-blue);
}

.status-toast.error {
  background: #fde7e9;
  color: var(--od-danger);
}

.status-toast.ok {
  background: #dff6dd;
  color: var(--od-ok);
}

.file-area {
  flex: 1;
  overflow: auto;
  position: relative;
}

.list-head,
.file-row {
  display: grid;
  grid-template-columns: 40px minmax(160px, 1.5fr) 120px 150px 90px 90px 110px;
  gap: 8px;
  align-items: center;
  padding: 0 20px;
  min-height: 42px;
}

.col.author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--od-surface);
  border-bottom: 1px solid var(--od-border);
  color: var(--od-muted);
  font-size: 12px;
  font-weight: 600;
}

.file-row {
  border-bottom: 1px solid var(--od-border);
  cursor: default;
}

.file-row:hover {
  background: var(--od-row-hover);
}

.file-row.selected {
  background: var(--od-row-selected);
}

.file-row.dragging {
  opacity: 0.5;
}

.file-row.drop-target {
  outline: 2px dashed var(--od-blue);
  outline-offset: -2px;
  background: var(--od-blue-soft);
}

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

.name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.name-text.folder-link {
  color: var(--od-text);
  cursor: pointer;
}

.name-text.folder-link:hover {
  color: var(--od-blue);
  text-decoration: underline;
}

.file-ico {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 16px;
}

.file-ico.folder {
  color: var(--od-folder);
  font-size: 18px;
}

.badge-status {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 10px;
  vertical-align: middle;
}

.badge-status.processing {
  background: #fff4ce;
  color: #835c00;
}

.badge-status.error {
  background: #fde7e9;
  color: var(--od-danger);
}

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
}

.file-row:hover .row-actions,
.file-row.selected .row-actions {
  opacity: 1;
}

.row-actions button {
  border: 0;
  background: transparent;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--od-muted);
}

.row-actions button:hover {
  background: #e1dfdd;
  color: var(--od-text);
}

.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--od-muted);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--od-text);
  font-weight: 600;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 120, 212, 0.08);
  border: 2px dashed var(--od-blue);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.drop-overlay[hidden] {
  display: none !important;
}

.drop-overlay-card {
  background: var(--od-surface);
  border: 1px solid var(--od-blue);
  color: var(--od-blue);
  padding: 16px 24px;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* Context menu */
.ctx-menu {
  position: fixed;
  z-index: 100;
  min-width: 200px;
  background: var(--od-surface);
  border: 1px solid var(--od-border-strong);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 4px 0;
}

.ctx-menu button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 14px;
  cursor: pointer;
}

.ctx-menu button:hover {
  background: var(--od-row-hover);
}

.ctx-menu button.danger {
  color: var(--od-danger);
}

/* Modal base */
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: auto;
}

.modal[hidden] {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.modal-card {
  width: min(420px, 100%);
  background: var(--od-surface);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  padding: 18px 18px 14px;
}

.modal-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.move-list {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--od-border);
  border-radius: 4px;
}

.move-list button {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--od-border);
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.move-list button:last-child {
  border-bottom: 0;
}

.move-list button:hover,
.move-list button.selected {
  background: var(--od-blue-soft);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* Generic UI dialog */
.ui-dialog {
  z-index: 140;
}

.ui-dialog-card {
  width: min(440px, 100%);
}

.ui-dialog-message {
  margin: 0 0 12px;
  color: var(--od-text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.ui-dialog-input {
  width: 100%;
  border: 1px solid var(--od-border-strong);
  border-radius: 4px;
  padding: 9px 11px;
  margin-bottom: 4px;
  outline: none;
}

.ui-dialog-input:focus {
  border-color: var(--od-blue);
  box-shadow: 0 0 0 1px var(--od-blue);
}

.ui-dialog-input[hidden] {
  display: none !important;
}

.btn.danger-solid {
  background: var(--od-danger);
  border-color: var(--od-danger);
  color: #fff;
}

.share-card {
  width: min(520px, 100%);
}

.share-desc {
  margin: 0 0 14px;
  line-height: 1.45;
  font-size: 13px;
}

.share-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--od-muted);
  margin-bottom: 6px;
}

.share-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.share-row.secondary {
  margin-bottom: 4px;
}

.share-link-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--od-border-strong);
  border-radius: 4px;
  padding: 9px 11px;
  background: var(--od-bg);
  color: var(--od-text);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 12px;
}

.share-link-input:focus {
  outline: none;
  border-color: var(--od-blue);
  box-shadow: 0 0 0 1px var(--od-blue);
}

.btn.danger-solid:hover:not(:disabled) {
  filter: brightness(1.05);
  background: #8b1e24;
}

/* File viewer popup */
.viewer-modal {
  z-index: 130;
  padding: 24px;
  align-items: center;
}

.viewer-card {
  width: min(1100px, calc(100vw - 48px));
  height: min(860px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  background: var(--od-surface);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--od-border-strong);
}

.editor-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--od-border);
  background: var(--od-surface);
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.editor-left,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.editor-left .icon-close {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
}

.editor-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#editor-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(42vw, 480px);
}

.editor-hint {
  padding: 6px 16px;
  font-size: 12px;
  color: var(--od-muted);
  background: #f3f9fd;
  border-bottom: 1px solid var(--od-border);
  flex: 0 0 auto;
}

.editor-hint[hidden] {
  display: none !important;
}

.editor-frame {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: #fff;
  min-height: 0;
}

.viewer-card.editing .editor-frame {
  box-shadow: inset 0 0 0 2px var(--od-blue);
}

.viewer-card.dirty #btn-editor-save {
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.25);
}

@media (max-width: 700px) {
  .viewer-card {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 8px;
  }

  .viewer-modal {
    padding: 8px;
  }

  #editor-title {
    max-width: 40vw;
  }
}

/* Slideshow (dark) */
.slideshow {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #fff;
}

.slideshow[hidden] {
  display: none !important;
}

.slide-chrome {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.9rem;
  background: rgba(12, 14, 18, 0.92);
  border-bottom: 1px solid #222;
  z-index: 5;
}

.slide-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

#slide-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#slide-counter {
  font-size: 0.8rem;
  opacity: 0.7;
}

.slide-controls {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.slide-controls .btn {
  min-width: 2.4rem;
  padding: 0.45rem 0.7rem;
  background: #1b1f24;
  border-color: #333;
  color: #fff;
}

.slide-stage {
  flex: 1;
  position: relative;
  background: #111;
  overflow: hidden;
}

#slide-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.slide-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #aaa;
}

.slide-hint {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
  z-index: 4;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.rename-input {
  width: 100%;
  border: 1px solid var(--od-blue);
  border-radius: 3px;
  padding: 4px 8px;
  outline: none;
}

/* =========================
   Mobile — OneDrive style
   ========================= */
@media (max-width: 900px) {
  .mobile-only {
    display: inline-flex !important;
  }

  .desktop-only {
    display: none !important;
  }

  /* CRITICAL: do NOT use desktop sidebar-collapsed grid (0 1fr) —
     it zero-widths .main and hides the file list. */
  .shell,
  .shell.sidebar-collapsed {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
  }

  .main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 20px);
  }

  .item-list {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 55;
  }

  .sidebar-scrim[hidden] {
    display: none !important;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    z-index: 60;
    transform: translateX(0);
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .shell.sidebar-collapsed .sidebar {
    transform: translateX(-105%);
    opacity: 1;
    pointer-events: none;
  }

  .command-bar {
    padding: 10px 14px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 8;
  }

  .cmd-left {
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .cmd-titles {
    gap: 1px;
  }

  .page-title {
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .breadcrumb {
    font-size: 16px;
    line-height: 1.25;
  }

  .breadcrumb button {
    font-size: 16px;
    padding: 1px 2px;
  }

  .crumb-sep {
    font-size: 14px;
  }

  .mobile-status-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 14px 8px;
    border-bottom: 1px solid var(--od-border);
    background: var(--od-surface);
  }

  .file-area {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    width: 100%;
  }

  .list-head {
    display: none !important;
  }

  /* Mobile card rows — dedicated class, no desktop grid */
  .file-row,
  .file-row.m-card {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 14px !important;
    min-height: 64px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-bottom: 1px solid var(--od-border) !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
  }

  .file-row > * {
    min-width: 0;
  }

  .file-row .col.check,
  .file-row .col.author,
  .file-row .col.modified,
  .file-row .col.type,
  .file-row .col.size {
    display: none !important;
  }

  .file-row .col.name,
  .file-row .m-name {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    align-items: center !important;
    gap: 12px !important;
    overflow: hidden !important;
  }

  .file-row .col.actions,
  .file-row .m-actions {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    gap: 2px;
  }

  .m-ico,
  .file-row .file-ico {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 10px;
    background: #f3f2f1;
    font-size: 18px !important;
    flex: 0 0 40px !important;
    display: grid !important;
    place-items: center;
  }

  .file-row .file-ico.folder,
  .m-ico.folder {
    background: #fff4ce;
    font-size: 20px !important;
  }

  .m-meta,
  .file-meta-block {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px;
    overflow: hidden !important;
  }

  .m-title,
  .file-row .name-text {
    display: block !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  .m-sub,
  .file-sub {
    display: block !important;
    font-size: 12px !important;
    color: var(--od-muted) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .file-row .row-actions {
    opacity: 1 !important;
    display: flex !important;
    flex: 0 0 auto !important;
  }

  .file-row .row-actions button,
  .m-actions button {
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 40px !important;
    font-size: 16px;
  }

  .empty-state {
    padding: 48px 20px 120px;
  }

  /* Floating search */
  .floating-search {
    position: fixed;
    left: 12px;
    right: 12px;
    top: calc(10px + env(safe-area-inset-top, 0px));
    z-index: 65;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100dvh - 100px);
  }

  .floating-search[hidden] {
    display: none !important;
  }

  .floating-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--od-border-strong);
    border-radius: 14px;
    padding: 8px 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  }

  .floating-search-bar input {
    flex: 1;
    border: 0;
    outline: none;
    font: inherit;
    font-size: 15px;
    background: transparent;
    min-width: 0;
  }

  .floating-search-results {
    background: #fff;
    border: 1px solid var(--od-border);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
    overflow: auto;
    max-height: min(58dvh, 420px);
  }

  .search-hit {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--od-border);
    background: transparent;
    text-align: left;
    padding: 12px 14px;
    cursor: pointer;
    font: inherit;
    color: var(--od-text);
  }

  .search-hit:last-child {
    border-bottom: 0;
  }

  .search-hit:active {
    background: var(--od-row-hover);
  }

  .search-hit-empty {
    padding: 20px 14px;
    text-align: center;
    color: var(--od-muted);
    font-size: 13px;
  }

  /* Floating bottom navbar — equal sides + larger centered FAB */
  .bottom-nav {
    display: grid !important;
    grid-template-columns: 1fr 72px 1fr;
    align-items: center;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + var(--safe-bottom));
    height: var(--bottom-nav-h);
    z-index: 50;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--od-border);
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .bnav-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    height: 100%;
    min-width: 0;
  }

  .bnav-item {
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--od-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    padding: 0 2px;
    cursor: pointer;
    border-radius: 14px;
  }

  .bnav-item.active {
    color: var(--od-blue);
  }

  .bnav-label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
  }

  .bnav-ico {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
  }

  .bnav-fab {
    width: 72px;
    height: 72px;
    border: 0;
    background: transparent;
    margin: 0;
    transform: translateY(-14px);
    cursor: pointer;
    padding: 0;
    display: grid;
    place-items: center;
    align-self: center;
    justify-self: center;
    position: relative;
    z-index: 2;
  }

  .bnav-fab-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #0078d4, #106ebe);
    color: #fff;
    font-size: 38px;
    font-weight: 400;
    line-height: 1;
    box-shadow: 0 10px 22px rgba(0, 120, 212, 0.45);
    border: 4px solid #fff;
  }

  .bnav-fab:active .bnav-fab-circle {
    transform: scale(0.96);
  }

  /* Bottom sheets */
  .bottom-sheet {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(0, 0, 0, 0.4);
    display: flex !important;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .bottom-sheet[hidden] {
    display: none !important;
  }

  .bottom-sheet-card {
    width: min(480px, 100%);
    background: var(--od-surface);
    border-radius: 16px 16px 14px 14px;
    padding: 8px 12px 12px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
    animation: sheet-up 0.18s ease-out;
  }

  @keyframes sheet-up {
    from { transform: translateY(16px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
  }

  .bottom-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: #d2d0ce;
    margin: 4px auto 12px;
  }

  .bottom-sheet-card h3 {
    margin: 0 8px 10px;
    font-size: 16px;
  }

  .sheet-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 14px;
  }

  .sheet-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 14px 12px;
    border-radius: 10px;
    font: inherit;
    color: var(--od-text);
    cursor: pointer;
  }

  .sheet-action:hover,
  .sheet-action:active {
    background: var(--od-row-hover);
  }

  .sheet-action.danger {
    color: var(--od-danger);
  }

  .sheet-ico {
    width: 28px;
    text-align: center;
  }

  .sheet-cancel {
    width: 100%;
    margin-top: 6px;
    border: 0;
    background: var(--od-bg);
    border-radius: 10px;
    padding: 13px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }

  .viewer-modal {
    padding: 0;
  }

  .viewer-card {
    width: 100vw;
    height: 100dvh;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border: 0;
  }

  .modal {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-card,
  .share-card,
  .users-card,
  .ui-dialog-card {
    width: 100%;
    max-height: min(90dvh, 90vh);
    overflow: auto;
    border-radius: 14px;
  }

  .login-screen {
    padding: 16px;
    align-items: flex-end;
  }

  .login-card {
    width: 100%;
    border-radius: 16px;
    margin-bottom: max(8px, var(--safe-bottom));
  }
}
