/* Ícones servidos localmente: o app não depende do Google Fonts para exibir ícones. */
@font-face {
  font-family: 'Material Symbols Rounded';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url(/fonts/material-symbols-rounded.woff2) format('woff2');
}

/* Nebula Drive - Material 3 look-alike. Tokens per UI_GOOGLE_DRIVE_SPEC.md section 2. */
:root {
  --md-sys-typescale-family: "Google Sans Flex", "Google Sans", "Google Sans Text", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  --md-sys-color-surface: #f8fafd;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f0f4f9;
  --md-sys-color-surface-container: #eef3fb;
  --md-sys-color-surface-container-high: #e9eef6;
  --md-sys-color-surface-container-highest: #e1e6ee;
  --md-sys-color-surface-bright: #ffffff;
  --md-sys-color-on-surface: #1f1f1f;
  --md-sys-color-on-surface-variant: #444746;
  --md-sys-color-outline: #747775;
  --md-sys-color-outline-variant: #c4c7c5;
  --md-sys-color-primary: #0b57d0;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #041e49;
  --md-sys-color-secondary-container: #d3e3fd;
  --md-sys-color-on-secondary-container: #041e49;
  --md-sys-color-error: #b3261e;
  --md-sys-color-inverse-surface: #303030;
  --md-sys-color-inverse-on-surface: #f2f2f2;
  --md-sys-color-inverse-primary: #a8c7fa;
  --md-sys-color-scrim: rgba(0, 0, 0, .32);
  --md-sys-color-state-hover-on-surface: rgba(31, 31, 31, .08);
  --md-sys-color-state-focus-on-surface: rgba(31, 31, 31, .12);
  --md-sys-color-state-hover-primary: rgba(11, 87, 208, .08);
  --app-row-selected: #e8f0fe;
  --app-drop-overlay: rgba(248, 250, 253, .85);
  --app-card-hover-border: #747775;
  --elev-1: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --elev-2: 0 1px 2px rgba(60, 64, 67, .3), 0 2px 6px 2px rgba(60, 64, 67, .15);
  --elev-3: 0 4px 8px 3px rgba(60, 64, 67, .15), 0 1px 3px rgba(60, 64, 67, .3);
  --elev-4: 0 6px 10px 4px rgba(60, 64, 67, .15), 0 2px 3px rgba(60, 64, 67, .3);
  --danger-hover: rgba(179, 38, 30, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --md-sys-color-surface: #131314;
    --md-sys-color-surface-container-lowest: #0e0e0f;
    --md-sys-color-surface-container-low: #1b1c1e;
    --md-sys-color-surface-container: #1e1f20;
    --md-sys-color-surface-container-high: #282a2c;
    --md-sys-color-surface-container-highest: #333537;
    --md-sys-color-surface-bright: #37393b;
    --md-sys-color-on-surface: #e3e3e3;
    --md-sys-color-on-surface-variant: #c7c7c7;
    --md-sys-color-outline: #8e918f;
    --md-sys-color-outline-variant: #444746;
    --md-sys-color-primary: #a8c7fa;
    --md-sys-color-on-primary: #062e6f;
    --md-sys-color-primary-container: #0842a0;
    --md-sys-color-on-primary-container: #d3e3fd;
    --md-sys-color-secondary-container: #004a77;
    --md-sys-color-on-secondary-container: #c2e7ff;
    --md-sys-color-error: #f2b8b5;
    --md-sys-color-inverse-surface: #e3e3e3;
    --md-sys-color-inverse-on-surface: #303030;
    --md-sys-color-inverse-primary: #0b57d0;
    --md-sys-color-scrim: rgba(0, 0, 0, .56);
    --md-sys-color-state-hover-on-surface: rgba(227, 227, 227, .08);
    --md-sys-color-state-focus-on-surface: rgba(227, 227, 227, .12);
    --md-sys-color-state-hover-primary: rgba(168, 199, 250, .08);
    --app-row-selected: rgba(0, 74, 119, .4);
    --app-drop-overlay: rgba(19, 19, 20, .85);
    --app-card-hover-border: #8e918f;
    --elev-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
    --elev-2: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 6px 2px rgba(0, 0, 0, .15);
    --elev-3: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);
    --elev-4: 0 6px 10px 4px rgba(0, 0, 0, .15), 0 2px 3px rgba(0, 0, 0, .3);
    --danger-hover: rgba(242, 184, 181, .1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --md-sys-color-surface: #131314;
  --md-sys-color-surface-container-lowest: #0e0e0f;
  --md-sys-color-surface-container-low: #1b1c1e;
  --md-sys-color-surface-container: #1e1f20;
  --md-sys-color-surface-container-high: #282a2c;
  --md-sys-color-surface-container-highest: #333537;
  --md-sys-color-surface-bright: #37393b;
  --md-sys-color-on-surface: #e3e3e3;
  --md-sys-color-on-surface-variant: #c7c7c7;
  --md-sys-color-outline: #8e918f;
  --md-sys-color-outline-variant: #444746;
  --md-sys-color-primary: #a8c7fa;
  --md-sys-color-on-primary: #062e6f;
  --md-sys-color-primary-container: #0842a0;
  --md-sys-color-on-primary-container: #d3e3fd;
  --md-sys-color-secondary-container: #004a77;
  --md-sys-color-on-secondary-container: #c2e7ff;
  --md-sys-color-error: #f2b8b5;
  --md-sys-color-inverse-surface: #e3e3e3;
  --md-sys-color-inverse-on-surface: #303030;
  --md-sys-color-inverse-primary: #0b57d0;
  --md-sys-color-scrim: rgba(0, 0, 0, .56);
  --md-sys-color-state-hover-on-surface: rgba(227, 227, 227, .08);
  --md-sys-color-state-focus-on-surface: rgba(227, 227, 227, .12);
  --md-sys-color-state-hover-primary: rgba(168, 199, 250, .08);
  --app-row-selected: rgba(0, 74, 119, .4);
  --app-drop-overlay: rgba(19, 19, 20, .85);
  --app-card-hover-border: #8e918f;
  --elev-1: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px 1px rgba(0, 0, 0, .15);
  --elev-2: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 6px 2px rgba(0, 0, 0, .15);
  --elev-3: 0 4px 8px 3px rgba(0, 0, 0, .15), 0 1px 3px rgba(0, 0, 0, .3);
  --elev-4: 0 6px 10px 4px rgba(0, 0, 0, .15), 0 2px 3px rgba(0, 0, 0, .3);
  --danger-hover: rgba(242, 184, 181, .1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-family);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--md-sys-color-primary); text-decoration: none; }
:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: -2px; }
[hidden] { display: none !important; }
.muted { color: var(--md-sys-color-on-surface-variant); }
.small { font-size: 12px; line-height: 16px; }
.strong { font-weight: 500; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.spacer { flex: 1 1 auto; }
.grow { flex: 1 1 auto; min-width: 0; }

/* Icons */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
  flex: 0 0 auto;
}
.big { font-size: 64px !important; }
.huge { font-size: 96px !important; }
.ok { color: var(--md-sys-color-primary); }
.muted.material-symbols-rounded, .material-symbols-rounded.muted { color: var(--md-sys-color-on-surface-variant); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: 500; letter-spacing: .1px; text-decoration: none;
  background: transparent; color: var(--md-sys-color-primary); white-space: nowrap;
}
.btn.filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.btn.filled:hover { box-shadow: var(--elev-1); }
.btn.filled.danger { background: var(--md-sys-color-error); color: #fff; }
.btn.text { padding: 0 12px; }
.btn.text:hover { background: var(--md-sys-color-state-hover-primary); }
.btn.text.danger-text { color: var(--md-sys-color-error); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  width: 40px; height: 40px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--md-sys-color-on-surface-variant); cursor: pointer;
  text-decoration: none; position: relative;
}
.icon-btn:hover { background: var(--md-sys-color-state-hover-on-surface); color: var(--md-sys-color-on-surface); }
.icon-btn:disabled { opacity: .4; }
.icon-btn.xs { width: 24px; height: 24px; }
.icon-btn.xs .material-symbols-rounded { font-size: 16px; }
.icon-btn.danger:hover { color: var(--md-sys-color-error); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.field.inline { flex-direction: row; align-items: center; gap: 12px; }
.field.inline .field-label { min-width: 120px; }
.field-label { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.field-error { color: var(--md-sys-color-error); font-size: 12px; min-height: 16px; }
.input, .select {
  height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface-container-lowest); color: var(--md-sys-color-on-surface); min-width: 0;
}
.input:focus, .select:focus { outline: 2px solid var(--md-sys-color-primary); outline-offset: -1px; }
.input:disabled { opacity: .6; }
textarea.input { height: auto; padding: 8px 12px; }
.select { cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--md-sys-color-primary); }
.form-error { color: var(--md-sys-color-error); min-height: 20px; margin-bottom: 8px; }
.card-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .input { flex: 1; }
.check-list { max-height: 260px; overflow: auto; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 8px; padding: 4px 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.user-form .field { margin-bottom: 8px; }

/* Toasts */
.toasts { position: fixed; left: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 568px; pointer-events: none; }
.snackbar {
  pointer-events: auto; display: flex; align-items: center; gap: 8px; min-width: 288px; min-height: 48px;
  padding: 6px 8px 6px 16px; border-radius: 4px; background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface); box-shadow: var(--elev-4); font-size: 14px; line-height: 20px;
}
.snack-msg { flex: 1; padding: 6px 0; }
.snack-action {
  height: 36px; padding: 0 8px; min-width: 48px; border: 0; border-radius: 999px; background: transparent;
  color: var(--md-sys-color-inverse-primary); font-weight: 500; cursor: pointer;
}
.snack-close { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* Dialogs */
dialog.dlg {
  border: 0; padding: 0; border-radius: 28px; width: calc(100vw - 32px); max-width: 560px; min-width: min(360px, 100vw - 32px);
  max-height: 80vh; background: var(--md-sys-color-surface-bright); color: var(--md-sys-color-on-surface); box-shadow: var(--elev-4);
}
dialog.dlg.wide { max-width: 600px; }
dialog.dlg.move { max-width: 480px; }
dialog.dlg::backdrop { background: var(--md-sys-color-scrim); }
.dlg-inner { padding: 24px; max-height: 80vh; display: flex; flex-direction: column; }
.dlg-title { margin: 0 0 16px; font-size: 24px; line-height: 32px; font-weight: 400; }
.dlg-body { overflow: auto; min-height: 0; flex: 1 1 auto; }
.dlg-text { margin: 0 0 8px; color: var(--md-sys-color-on-surface-variant); }
/* Diálogo de conflito de nome no envio (ui/upload.js) */
.conf-count { font-size: 12px; color: var(--md-sys-color-on-surface-variant); margin-bottom: 4px; }
.conf-help { margin: 12px 0 0; padding-left: 20px; color: var(--md-sys-color-on-surface-variant); font-size: 14px; }
.conf-help li { margin: 6px 0; }
.conf-help strong { color: var(--md-sys-color-on-surface); font-weight: 500; }
.conf-all { display: flex; align-items: center; gap: 8px; margin-top: 16px; cursor: pointer; font-size: 14px; }
.conf-all-cb { width: 18px; height: 18px; accent-color: var(--md-sys-color-primary); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.section-title { font-size: 14px; font-weight: 500; margin: 20px 0 8px; }

/* Menus */
.menu {
  position: fixed; z-index: 70; min-width: 240px; max-width: 280px; padding: 8px 0; border-radius: 4px;
  background: var(--md-sys-color-surface-bright); box-shadow: var(--elev-2); color: var(--md-sys-color-on-surface);
}
.menu-item {
  display: flex; align-items: center; gap: 16px; width: 100%; height: 40px; padding: 0 16px; border: 0; background: transparent;
  cursor: pointer; font-size: 14px; text-align: left;
}
.menu-item .material-symbols-rounded { font-size: 20px; color: var(--md-sys-color-on-surface-variant); }
.menu-item:hover, .menu-item:focus-visible { background: var(--md-sys-color-state-hover-on-surface); outline: none; }
.menu-item:disabled { opacity: .4; cursor: default; background: transparent; }
.menu-item.danger { color: var(--md-sys-color-error); }
.menu-item.danger .material-symbols-rounded { color: var(--md-sys-color-error); }
.menu-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-kbd { color: var(--md-sys-color-on-surface-variant); font-size: 12px; }
.menu-sep { height: 1px; margin: 8px 0; background: var(--md-sys-color-outline-variant); }
.account-menu .menu-item:first-child { color: var(--md-sys-color-on-surface-variant); }
.new-menu { min-width: 220px; }

/* Shell */
.fab { display: none; }
.shell {
  display: grid; height: 100vh; overflow: hidden;
  grid-template-areas: "top top" "nav main";
  grid-template-rows: 64px 1fr;
  grid-template-columns: 256px 1fr;
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px;
  background: var(--md-sys-color-surface); min-width: 0;
}
.brand { display: flex; align-items: center; gap: 8px; width: 240px; flex: 0 0 auto; }
.brand-mark { display: flex; align-items: center; gap: 8px; }
.logo { height: 40px; width: auto; display: block; flex: 0 0 auto; }
.wordmark { display: inline-flex; align-items: center; white-space: nowrap; }
.wm-img { height: 26px; width: auto; }

/* Marca: alterna claro/escuro pelo tema (data-theme ou prefers-color-scheme) */
.theme-img-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-img-light { display: none; }
  :root:not([data-theme="light"]) .theme-img-dark { display: inline-block; }
}
:root[data-theme="dark"] .theme-img-light { display: none; }
:root[data-theme="dark"] .theme-img-dark { display: inline-block; }

/* Logo completo (login, convite, compartilhamento público) */
.brand-full { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 8px 0 0; text-align: center; }
.logo-full { width: 280px; max-width: 70vw; height: auto; }
.brand-tagline { margin: 0; font-size: 14px; letter-spacing: .08em; color: var(--md-sys-color-on-surface-variant); }

/* Splash de inicialização: símbolo com pulso suave */
.boot-mark { width: 64px; height: auto; display: block; animation: nebula-pulse 1.6s ease-in-out infinite; }
@keyframes nebula-pulse {
  0%, 100% { opacity: .55; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1); }
}

/* Aviso de nova versão do service worker */
.pwa-toast {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 6px 6px 6px 16px;
  max-width: calc(100vw - 32px); border-radius: 4px; box-shadow: var(--elev-3, 0 4px 8px rgba(0,0,0,.3));
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface); font-size: 14px;
}
.pwa-toast-action {
  border: 0; background: transparent; cursor: pointer; padding: 8px 12px; border-radius: 4px;
  color: var(--md-sys-color-inverse-primary); font-weight: 500; font-size: 14px;
}
.pwa-toast-action:hover, .pwa-toast-action:focus-visible { background: var(--md-sys-color-state-hover-on-surface); }
.pwa-toast-action:disabled { opacity: .6; cursor: default; }
.nav-toggle { display: none; }
.search {
  flex: 1 1 720px; max-width: 720px; min-width: 200px; margin: 0 auto; height: 48px; display: flex; align-items: center; gap: 12px;
  padding: 0 8px 0 16px; border-radius: 24px; background: var(--md-sys-color-surface-container-high);
}
.search:focus-within { background: var(--md-sys-color-surface-container-highest); box-shadow: var(--elev-1); }
.search-ico { color: var(--md-sys-color-on-surface-variant); }
.search-input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 16px; color: var(--md-sys-color-on-surface); outline: none;
}
.search-input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.avatar {
  width: 32px; height: 32px; margin: 4px; border-radius: 50%; border: 0; cursor: pointer; flex: 0 0 auto;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container);
  font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; justify-content: center;
}
.avatar:hover { box-shadow: 0 0 0 4px var(--md-sys-color-state-hover-primary); }
.nav {
  grid-area: nav; padding: 8px 0 0 0; overflow-y: auto; min-height: 0; display: flex; flex-direction: column;
  background: var(--md-sys-color-surface);
}
.new-btn {
  display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; margin: 4px 0 12px 16px; height: 52px; min-width: 120px; flex-shrink: 0;
  padding: 0 24px 0 16px; border: 0; border-radius: 16px; cursor: pointer; background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface); font-size: 14px; font-weight: 500; box-shadow: var(--elev-1);
}
.new-btn:hover { box-shadow: var(--elev-2); }
.new-btn .plus { font-size: 36px; color: var(--md-sys-color-primary); }
.nav-item {
  display: flex; align-items: center; gap: 16px; height: 36px; flex-shrink: 0; padding: 0 16px 0 24px; margin-right: 16px;
  border-radius: 0 20px 20px 0; color: var(--md-sys-color-on-surface-variant); font-size: 14px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.nav-item:hover { background: var(--md-sys-color-state-hover-on-surface); }
.nav-item.active { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); font-weight: 700; }
.nav-item.active .material-symbols-rounded { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.nav-divider { border: 0; height: 1px; flex-shrink: 0; background: var(--md-sys-color-outline-variant); margin: 6px 24px; }
.nav-spacer { flex: 0 1 auto; }
.storage { padding: 8px 24px 16px; flex-shrink: 0; color: var(--md-sys-color-on-surface-variant); }
.storage-head { display: flex; align-items: center; gap: 12px; color: var(--md-sys-color-on-surface); font-weight: 500; margin-bottom: 6px; }
.bar { height: 4px; border-radius: 2px; background: var(--md-sys-color-surface-container-highest); overflow: hidden; width: 100%; }
.bar > span { display: block; height: 100%; background: var(--md-sys-color-primary); }
.bar.danger > span { background: var(--md-sys-color-error); }
.license-box { margin: 0 16px 4px; padding: 8px 12px; border-radius: 12px; font-size: 12px; line-height: 16px; color: var(--md-sys-color-on-surface-variant); flex-shrink: 0; }
.license-box .license-head { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; }
.license-box .license-head .material-symbols-rounded, .license-box .license-head svg { font-size: 18px; }
.license-box .license-text { margin-top: 2px; }
.license-box.lvl-warn { background: #fef3e2; color: #8a4b00; }
.license-box.lvl-danger { background: var(--danger-hover); color: var(--md-sys-color-error); }
.storage-text { margin-top: 6px; font-size: 13px; line-height: 18px; }
a.storage { display: block; text-decoration: none; border-radius: 0 16px 16px 0; }
a.storage:hover { background: var(--md-sys-color-state-hover-on-surface); }
.bar.lvl-ok > span { background: var(--md-sys-color-primary); }
.bar.lvl-warn > span { background: #e37400; }
.bar.lvl-danger > span { background: var(--md-sys-color-error); }
.storage-page .bar { height: 8px; border-radius: 4px; margin: 12px 0; }
.storage-line { margin: 8px 0 4px; font-size: 16px; }
.storage-banner { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: var(--danger-hover); color: var(--md-sys-color-error); }
.storage-banner .grow { flex: 1; }
.usage-cell { min-width: 180px; }
.usage-cell .bar { margin-bottom: 4px; }
.usage-line { margin: 0 0 12px; }
.cell-ellipsis { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; }
.main { grid-area: main; overflow: auto; min-width: 0; min-height: 0; position: relative; padding: 0; }
.page { padding: 16px 24px 24px; max-width: 1040px; }
.page-title { margin: 12px 0 16px; font-size: 22px; line-height: 28px; font-weight: 400; }
.page-loading, .boot { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 200px; }
.spinner {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--md-sys-color-outline-variant);
  border-top-color: var(--md-sys-color-primary); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { margin: 24px; padding: 16px; border-radius: 12px; background: var(--danger-hover); color: var(--md-sys-color-error); }

/* Browser header */
.browser-row { display: flex; height: 100%; min-height: 0; }
.browser-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.main-header {
  position: sticky; top: 0; z-index: 2; background: var(--md-sys-color-surface); padding: 8px 24px 0 24px;
}
.row-a { display: flex; align-items: center; gap: 4px; min-height: 40px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 0; font-size: 22px; line-height: 28px; min-width: 0; padding: 4px 0; }
.breadcrumbs .crumb { color: var(--md-sys-color-on-surface-variant); padding: 4px 6px; border-radius: 8px; white-space: nowrap; }
.breadcrumbs a.crumb:hover { background: var(--md-sys-color-state-hover-on-surface); text-decoration: none; }
.breadcrumbs .crumb.current { color: var(--md-sys-color-on-surface); }
.breadcrumbs .sep { color: var(--md-sys-color-on-surface-variant); font-size: 20px; }
.row-b { display: flex; align-items: center; gap: 8px; min-height: 40px; margin: 4px 0 4px; }
.sel-slot { min-height: 56px; display: flex; flex-direction: column; justify-content: center; }
.sel-slot > .sel-bar { flex: 0 0 auto; }
.sel-bar { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border-radius: 8px; padding: 4px 8px; min-height: 48px; }
.sel-bar .icon-btn { color: inherit; }
.sel-count { font-size: 14px; font-weight: 500; margin-left: 4px; }
.seg-toggle { display: inline-flex; border: 1px solid var(--md-sys-color-outline); border-radius: 18px; overflow: hidden; height: 36px; margin-left: 4px; }
.seg { width: 40px; height: 34px; border: 0; background: transparent; cursor: pointer; color: var(--md-sys-color-on-surface-variant); display: inline-flex; align-items: center; justify-content: center; }
.seg.on { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.seg + .seg { border-left: 1px solid var(--md-sys-color-outline); }
.seg .material-symbols-rounded { font-size: 20px; }
.browser-body { flex: 1 1 auto; padding: 0 24px 24px; }

/* Details panel */
.details-host { flex: 0 0 auto; }
.details-host:empty { display: none; }
.details {
  width: 360px; height: 100%; overflow: auto; background: var(--md-sys-color-surface); border-left: 1px solid var(--md-sys-color-outline-variant);
  display: flex; flex-direction: column; animation: slidein 200ms cubic-bezier(.2, 0, 0, 1);
}
@keyframes slidein { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.det-head { display: flex; align-items: center; gap: 4px; height: 64px; padding: 0 16px 0 8px; flex: 0 0 auto; }
.det-title { font-size: 16px; line-height: 24px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.det-preview { margin: 8px 24px 16px; height: 160px; border-radius: 12px; background: var(--md-sys-color-surface-container-high); display: flex; align-items: center; justify-content: center; }
.det-preview .material-symbols-rounded { color: var(--md-sys-color-on-surface-variant); }
.det-list { display: grid; grid-template-columns: 120px 1fr; gap: 12px 8px; margin: 0 24px; font-size: 14px; }
.det-list dt { color: var(--md-sys-color-on-surface-variant); }
.det-list dd { margin: 0; word-break: break-word; }
.det-share { margin: 16px 16px; align-self: flex-start; }

/* List view */
.list { display: flex; flex-direction: column; }
.list-head, .list .row {
  display: grid; grid-template-columns: 40px minmax(240px, 1fr) 200px 160px 110px 48px; align-items: center; column-gap: 8px;
}
.list-head {
  position: sticky; top: 0; z-index: 1; height: 40px; background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant);
  font-size: 12px; line-height: 16px; font-weight: 500;
}
.list-head .cell { height: 40px; display: flex; align-items: center; gap: 4px; }
.list-head .sortable { cursor: pointer; user-select: none; }
.list-head .sortable:hover { color: var(--md-sys-color-on-surface); }
.list-head .sortable.active { color: var(--md-sys-color-on-surface); }
.sort-ico { font-size: 16px !important; }
.list .row { height: 48px; padding: 0 8px 0 0; border-radius: 0; cursor: default; user-select: none; }
.list .row:hover { background: var(--md-sys-color-state-hover-on-surface); }
.list .row.selected { background: var(--app-row-selected); }
.list .row.trashed { opacity: .8; }
.list .row .cell { min-width: 0; display: flex; align-items: center; gap: 8px; }
.list .row .cell.name { font-size: 16px; line-height: 24px; }
.list .cell.date, .list .cell.size, .list .cell.owner { color: var(--md-sys-color-on-surface-variant); }
.list .cell.size { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.list .cell.owner, .list .cell.date { overflow: hidden; }
.list .cell.owner { text-overflow: ellipsis; white-space: nowrap; }
.list .cell.sel { justify-content: center; }
.list-head .cell.size { justify-content: flex-end; }
.cell.kebab { justify-content: flex-end; }
.check-cell { display: inline-flex; color: var(--md-sys-color-on-surface-variant); opacity: 0; transition: opacity 100ms; }
.check-cell .on { color: var(--md-sys-color-primary); }
.list .row:hover .check-cell, .list .row.selected .check-cell, .file-card:hover .check-cell { opacity: 1; }
.kind-icon { font-size: 20px !important; }
.name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.star-ico { color: #f9ab00; font-size: 18px !important; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20; flex: 0 0 auto; }
.kebab-btn { opacity: 0; width: 32px; height: 32px; }
.list .row:hover .kebab-btn, .file-card:hover .kebab-btn, .folder-chip:hover .kebab-btn, .kebab-btn:focus { opacity: 1; }
.kebab-btn:focus { outline: none; }
.list .row.drop-target, .folder-chip.drop-target, .file-card.drop-target { background: var(--md-sys-color-primary-container) !important; outline: 2px dashed var(--md-sys-color-primary); }
.list.trash .row .cell.date { font-variant-numeric: tabular-nums; }

/* Grid view */
.grid-wrap { padding-top: 8px; }
.grid-label { font-size: 12px; line-height: 16px; color: var(--md-sys-color-on-surface-variant); margin: 8px 0 12px; font-weight: 500; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-bottom: 16px; }
.folder-chip {
  display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 4px 0 12px; border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline-variant); cursor: default; user-select: none; min-width: 0;
}
.folder-chip:hover { background: var(--md-sys-color-state-hover-on-surface); }
.folder-chip.selected { outline: 2px solid var(--md-sys-color-primary); outline-offset: -2px; background: color-mix(in srgb, var(--md-sys-color-primary-container) 30%, transparent); }
.fc-ico { color: var(--md-sys-color-on-surface-variant); font-size: 20px !important; }
.folder-chip .name-text { flex: 1; font-size: 14px; font-weight: 500; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.file-card {
  position: relative; max-width: 240px; border-radius: 12px; background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant); overflow: hidden; cursor: default; user-select: none;
}
.file-card:hover { box-shadow: var(--elev-1); border-color: var(--app-card-hover-border); }
.file-card.selected { outline: 2px solid var(--md-sys-color-primary); outline-offset: -2px; }
.file-card .thumb { position: relative; height: 140px; background: var(--md-sys-color-surface-container-high); display: flex; align-items: center; justify-content: center; }
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .thumb .check-cell { position: absolute; top: 8px; left: 8px; opacity: 1; background: var(--md-sys-color-surface-bright); border-radius: 50%; }
.file-card .thumb-ico .material-symbols-rounded { font-size: 48px !important; }
.play-badge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; display: flex; align-items: center; justify-content: center; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .35); }
.progress span { display: block; height: 100%; background: var(--md-sys-color-primary); }
.card-foot { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 4px 0 16px; }
.card-foot .name-text { flex: 1; font-size: 14px; font-weight: 500; }
.card-foot .kebab-btn { width: 32px; height: 32px; }
.file-card .thumb-ico { width: 100%; height: 100%; }
.file-card .thumb-ico .kind-icon { color: inherit; }

/* Empty state */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 64px 16px; color: var(--md-sys-color-on-surface-variant); min-height: 300px; }
.empty-ico { font-size: 96px !important; margin-bottom: 16px; color: var(--md-sys-color-outline); }
.empty-mark { width: 120px; height: auto; opacity: .35; margin-bottom: 16px; display: block; }
.empty h2 { font-size: 22px; line-height: 28px; font-weight: 400; color: var(--md-sys-color-on-surface); margin: 0 0 8px; }
.empty p { margin: 0; }

/* Upload panel */
.upload-panel {
  position: fixed; right: 16px; bottom: 16px; width: 360px; max-height: 420px; z-index: 40; display: flex; flex-direction: column;
  border-radius: 16px 16px 12px 12px; background: var(--md-sys-color-surface-bright); box-shadow: var(--elev-3); overflow: hidden;
}
.up-head { display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 8px 0 16px; background: var(--md-sys-color-surface-container-high); flex: 0 0 auto; }
.up-titles { flex: 1; min-width: 0; }
.up-title { font-size: 14px; font-weight: 500; }
.up-sub { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.up-body { overflow: auto; max-height: 360px; }
.up-row { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 16px; }
.up-icon { color: var(--md-sys-color-on-surface-variant); }
.up-mid { flex: 1; min-width: 0; }
.up-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-bar { height: 4px; margin: 4px 0; border-radius: 2px; background: var(--md-sys-color-surface-container-highest); overflow: hidden; }
.up-bar span { display: block; height: 100%; background: var(--md-sys-color-primary); transition: width 150ms; }
.up-meta { font-size: 11px; line-height: 16px; color: var(--md-sys-color-on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-row.error .up-meta { color: var(--md-sys-color-error); }
.up-row.done .up-bar span { background: var(--md-sys-color-primary); }
.drop-overlay {
  position: fixed; inset: 16px; z-index: 50; border: 2px dashed var(--md-sys-color-primary); border-radius: 16px;
  background: var(--app-drop-overlay); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  pointer-events: none; text-align: center;
}
.drop-overlay .material-symbols-rounded { color: var(--md-sys-color-primary); font-size: 64px !important; }
.drop-title { font-size: 22px; line-height: 28px; }
.drop-sub { color: var(--md-sys-color-on-surface-variant); }

/* Viewer */
.viewer {
  position: fixed; inset: 0; z-index: 60; background: #000; color: #e3e3e3; display: flex; flex-direction: column;
  animation: fadein 200ms ease-out;
}
@keyframes fadein { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
.viewer-top {
  display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 8px 0 8px; flex: 0 0 auto;
  background: linear-gradient(rgba(0, 0, 0, .6), transparent);
}
.viewer-top .icon-btn { color: #e3e3e3; }
.viewer-top .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.v-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.v-name { font-size: 16px; line-height: 24px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-count { font-size: 12px; color: #bdbdbd; }
.v-actions { display: flex; gap: 4px; }
.viewer-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; overflow: auto; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .4); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2;
}
.viewer-nav:hover { background: rgba(0, 0, 0, .6); }
.viewer-nav:disabled { opacity: .3; cursor: default; }
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }
.v-media { max-width: 100%; max-height: 100%; width: 100%; height: 100%; background: #000; outline: none; }
.v-img { max-width: 100%; max-height: calc(100vh - 64px); object-fit: contain; transition: transform 150ms; cursor: zoom-in; user-select: none; }
.v-zoom { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; }
.v-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.v-text-wrap { width: 100%; height: 100%; overflow: auto; padding: 16px; box-sizing: border-box; }
.v-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 20px; color: #e3e3e3; }
.audio-card { width: 360px; max-width: calc(100vw - 32px); padding: 24px; border-radius: 28px; background: #282a2c; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.audio-card .art { width: 160px; height: 160px; border-radius: 12px; background: #3c4043; display: flex; align-items: center; justify-content: center; }
.audio-card .art .material-symbols-rounded { font-size: 96px; color: #c7c7c7; }
.audio-name { font-size: 16px; font-weight: 500; text-align: center; word-break: break-word; }
.audio-card audio { width: 100%; }
.nopreview { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: #c7c7c7; padding: 24px; }
.nopreview h3 { font-weight: 400; font-size: 18px; margin: 0; color: #e3e3e3; }
.nopreview p { margin: 0; }

/* Share dialog */
.share { display: flex; flex-direction: column; gap: 4px; }
.share-sec { display: flex; flex-direction: column; gap: 8px; }
.people-input { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 56px; border-bottom: 1px solid var(--md-sys-color-outline); padding: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-input { flex: 1; min-width: 160px; height: 36px; border: 0; background: transparent; outline: none; color: var(--md-sys-color-on-surface); }
.chip-input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.person-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 4px 4px 4px 4px; border-radius: 16px;
  border: 1px solid var(--md-sys-color-outline); max-width: 260px;
}
.person-chip.invalid { border-color: var(--md-sys-color-error); color: var(--md-sys-color-error); }
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; font-size: 14px; }
.avatar-mini {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); font-size: 12px; font-weight: 500;
}
.share-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; }
.share-row .material-symbols-rounded { color: var(--md-sys-color-on-surface-variant); }
.share-row.error { color: var(--md-sys-color-error); }
.share-row.error .material-symbols-rounded { color: var(--md-sys-color-error); }
.share-row.owner { border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.share-results { display: flex; flex-direction: column; }
.link-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.link-form { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.link-form .field.inline .input, .link-form .field.inline .select { flex: 1; }
.link-form .btn { align-self: flex-end; margin-top: 4px; }
.grants, .links { display: flex; flex-direction: column; }

/* Move tree */
.move-body { display: flex; flex-direction: column; gap: 8px; }
.tree { border: 1px solid var(--md-sys-color-outline-variant); border-radius: 8px; padding: 8px 0; height: 320px; overflow: auto; }
.tree-row { display: flex; align-items: center; gap: 8px; height: 40px; padding-right: 12px; cursor: pointer; border-radius: 0; }
.tree-row:hover { background: var(--md-sys-color-state-hover-on-surface); }
.tree-row.sel { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.tree-row.disabled { opacity: .45; cursor: default; }
.tree-row .chev { transition: transform 150ms; }
.tree-row .chev.open { transform: rotate(90deg); }
.tree-row .chev .material-symbols-rounded { font-size: 20px; }
.tree-ico { color: var(--md-sys-color-on-surface-variant); font-size: 20px !important; }
.tree-name { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row.sel .tree-ico { color: inherit; }
.tree-row .muted { font-size: 12px; }
.tree-kids { display: block; }
.dlg-actions .btn.text { margin-right: auto; }

/* Settings & shared rows */
.card { background: var(--md-sys-color-surface-container-low); border-radius: 16px; padding: 16px 24px; margin-bottom: 16px; max-width: 720px; }
.card-title { font-size: 16px; line-height: 24px; font-weight: 500; margin: 0 0 12px; }
.ap-created .field { margin-bottom: 12px; }
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--md-sys-color-outline-variant); background: var(--md-sys-color-surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--md-sys-color-outline-variant); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 500; color: var(--md-sys-color-on-surface-variant); background: var(--md-sys-color-surface-container-low); }
.table tr.muted td { color: var(--md-sys-color-on-surface-variant); }
.table.audit td { font-size: 13px; }
.row-actions { display: inline-flex; gap: 4px; }
.toolbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

/* Tabs and stats (admin) */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--md-sys-color-outline-variant); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 12px 16px; color: var(--md-sys-color-on-surface-variant); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.on { color: var(--md-sys-color-primary); border-bottom-color: var(--md-sys-color-primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--md-sys-color-surface-container-low); border-radius: 16px; padding: 16px; }
.stat-label { font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.stat-value { font-size: 24px; line-height: 32px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--md-sys-color-on-surface-variant); }
.kv dd { margin: 0; }
.check-list .check-row { margin: 4px 0; }
.admin-content .card { max-width: none; }

/* Public page */
.public-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar.public { position: static; }
.public-head { padding: 8px 24px 0; }
.public-main { flex: 1; overflow: auto; padding: 0 24px 24px; }
.public-title { margin: 8px 0 16px; }
.public-list .row { cursor: pointer; }
.pw-card { max-width: 420px; margin: 40px auto; padding: 32px; text-align: center; background: var(--md-sys-color-surface-container-low); border-radius: 28px; }
.pw-card .big { color: var(--md-sys-color-primary); margin-bottom: 8px; }
.public-file { display: flex; flex-direction: column; gap: 12px; }
.public-file-head { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 500; }
.public-media { display: flex; justify-content: center; min-height: 60vh; background: #000; border-radius: 12px; overflow: hidden; }
.public-media .v-media, .public-media .v-img { max-height: 70vh; }
.public-media .v-frame { height: 75vh; }
.public-media .nopreview { color: #c7c7c7; }

/* Auth pages - Google style */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; background: var(--md-sys-color-surface); }
.auth-card { width: 100%; max-width: 448px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 28px; padding: 40px 40px 32px; background: var(--md-sys-color-surface-bright); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.auth-title { font-size: 24px; line-height: 32px; font-weight: 400; margin: 0 0 8px; text-align: center; }
.auth-card-body { display: flex; flex-direction: column; }
.auth-card-body > .muted { margin: 0 0 24px; text-align: center; }
.auth-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.auth-foot { text-align: center; padding: 24px 0 8px; display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; max-width: 448px; }
.lang-select { height: 36px; width: auto; }
.lang-select.compact { height: 32px; }
.auth-page .select { background: var(--md-sys-color-surface); }
.auth-card .field { margin-bottom: 16px; }

/* Floating label field for auth */
.auth-field { position: relative; margin-bottom: 24px; display: block; }
.auth-field-label { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--md-sys-color-on-surface-variant); pointer-events: none; transition: all 0.15s ease; background: transparent; padding: 0 4px; }
.auth-field .input { width: 100%; padding: 16px 16px 8px; font-size: 16px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 4px; background: transparent; box-sizing: border-box; transition: border-color 0.15s; }
.auth-field .input:focus { border-color: var(--md-sys-color-primary); outline: none; border-width: 2px; padding: 15px 15px 7px; }
.auth-field .input:focus + .auth-field-label,
.auth-field .input:not(:placeholder-shown) + .auth-field-label,
.auth-field:focus-within .auth-field-label { top: 0; transform: translateY(-50%) scale(0.75); transform-origin: left; color: var(--md-sys-color-primary); font-size: 12px; background: var(--md-sys-color-surface-bright); }

/* Responsive */
@media (max-width: 1279px) {
  .shell { grid-template-columns: 72px 1fr; }
  .nav { padding-top: 8px; align-items: center; }
  .nav-item { flex-direction: column; justify-content: center; height: 56px; gap: 4px; padding: 0; margin: 0 4px; width: 64px; border-radius: 16px; font-size: 12px; font-weight: 500; }
  .nav-item span:last-child { font-size: 12px; line-height: 16px; }
  .nav-item.active { font-weight: 500; }
  .nav-item.active .material-symbols-rounded { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
  .new-btn { width: 56px; min-width: 56px; height: 56px; padding: 0; justify-content: center; margin-left: 8px; }
  .new-btn span:not(.plus) { display: none; }
  .new-btn .plus { font-size: 24px; }
  .new-btn .material-symbols-rounded { font-size: 24px; }
  .nav-divider { margin: 8px 12px; }
  .storage { display: none; }
  .brand { width: auto; }
  .wordmark { display: none; }
  .details { position: fixed; right: 0; top: 64px; bottom: 0; z-index: 30; box-shadow: var(--elev-3); }
  .details-host:empty { display: none; }
  .nav .nav-item span:last-child { display: block; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .nav { overflow-x: hidden; }
  .nav-section-title { font-size: 10px; text-align: center; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 72px; }
  .nav-item { min-width: 0; }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 45; transform: translateX(-100%);
    transition: transform 300ms cubic-bezier(.2, 0, 0, 1); align-items: stretch; padding-top: 8px; border-radius: 0 28px 28px 0;
    background: var(--md-sys-color-surface-container-low); box-shadow: var(--elev-3);
  }
  .nav-item { flex-direction: row; justify-content: flex-start; width: auto; height: 40px; padding: 0 16px 0 24px; margin: 0 16px 0 0; gap: 16px; font-size: 14px; border-radius: 0 20px 20px 0; }
  .nav-item span:last-child { font-size: 14px; line-height: 20px; }
  .new-btn { width: auto; min-width: 120px; height: 56px; padding: 0 24px 0 16px; margin: 8px 16px 16px 16px; justify-content: flex-start; }
  .new-btn span:not(.plus) { display: inline; }
  .new-btn .plus { font-size: 36px; }
  .storage { display: block; }
  .shell.drawer-open .nav { transform: none; }
  .shell.drawer-open .scrim { display: block; position: fixed; inset: 0; background: var(--md-sys-color-scrim); z-index: 44; }
  .nav-toggle { display: inline-flex; }
  .brand { width: auto; }
  .wordmark { display: inline; }
  .details { position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 100vw); z-index: 30; padding-top: 0; }
  .topbar { padding: 0 8px; }
  .search { min-width: 0; }
  .topbar-actions a.icon-btn[href="#/settings"] { display: none; }
  .browser-body { padding: 0 16px 24px; }
  .main-header { padding: 8px 16px 0; }
  .list-head, .list .row { grid-template-columns: 40px minmax(180px, 1fr) 120px 48px; }
  .list-head .owner, .list .row .owner, .list-head .size, .list .row .size { display: none; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .breadcrumbs { font-size: 18px; line-height: 24px; }
  .page { padding: 16px; }
  .auth-card { padding: 28px 20px; }
}
@media (max-width: 599px) {
  .shell { grid-template-rows: 56px 1fr; }
  .topbar { height: 56px; }
  .search { position: static; flex: 1; max-width: none; height: 40px; padding: 0 12px; border-radius: 20px; }
  .search .icon-btn { display: none; }
  .search-input { font-size: 14px; }
  .topbar-actions { gap: 0; }
  .topbar-actions .icon-btn { display: none; }
  .wordmark { display: none; }
  .brand { width: auto; gap: 0; }
  .brand-mark .logo { height: 32px; }
  .empty-mark { width: 96px; }
  .pwa-toast { bottom: 88px; }
  .main-header { padding: 4px 8px 0; }
  .browser-body { padding: 0 8px 96px; }
  .row-a { flex-wrap: wrap; }
  .breadcrumbs { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; width: 100%; font-size: 16px; }
  .list-head, .list .row { grid-template-columns: 40px minmax(0, 1fr) 90px; }
  .list-head .sel, .list .row .sel { display: none; }
  .list .row { height: 56px; }
  .list-head .date, .list .row .date { font-size: 12px; }
  .list-head .kebab, .list .row .kebab { display: none; }
  .kebab-btn { opacity: 1; }
  .file-grid, .folder-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .folder-grid { grid-template-columns: 1fr; }
  .file-card { max-width: none; }
  .file-card .thumb { height: 110px; }
  .details { width: 100vw; }
  .upload-panel { left: 0; right: 0; bottom: 0; width: auto; border-radius: 16px 16px 0 0; }
  .toasts { left: 8px; right: 8px; bottom: 88px; max-width: none; }
  .snackbar { min-width: 0; }
  dialog.dlg { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; margin: 0; }
  dialog.dlg .dlg-inner { max-height: 100vh; height: 100%; }
  .page { padding: 12px; }
  .card { padding: 16px; }
  .field.inline { flex-direction: column; align-items: stretch; }
  .grid2 { grid-template-columns: 1fr; }
  .viewer-top { padding: 0 4px; height: 56px; }
  .v-name { font-size: 14px; }
  .viewer-nav { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .tabs { margin-bottom: 8px; }
  .auth-card { margin: 16px auto; padding: 24px 20px; border-radius: 20px; }
  .new-btn { display: none; }
  .fab {
    display: flex; position: fixed; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 16px; border: 0; cursor: pointer;
    background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); align-items: center; justify-content: center;
    z-index: 35; box-shadow: var(--elev-3);
  }
  .empty { min-height: 240px; padding: 32px 16px; }
  .empty-ico { font-size: 72px !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Editor de documentos (Office / Collabora), rota #/office/{id} ---------- */
.office-page {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  background: var(--md-sys-color-surface);
}
.office-page.office-error { align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.office-top {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 12px;
  background: var(--md-sys-color-surface-container-lowest);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.office-top .icon-btn { flex: 0 0 auto; color: var(--md-sys-color-on-surface-variant); text-decoration: none; }
.office-name {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 16px; color: var(--md-sys-color-on-surface);
}
.office-mode { flex: 0 0 auto; white-space: nowrap; }
.office-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: 0; background: var(--md-sys-color-surface-container-low); }
.office-form { display: none; }
@media (max-width: 600px) {
  .office-mode { display: none; }
  .office-top { padding: 0 8px; gap: 4px; }
}

/* Visualizador de Office (js/ui/officeview.js): DOCX, planilhas, slides em texto. */
.of-root { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }
.of-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; width: 100%; }
.of-loading { margin: auto; color: #bdbdbd; padding: 24px; }
.of-docx-styles { display: none; }
.of-docx { flex: 0 0 auto; width: 100%; box-sizing: border-box; padding: 16px 0; background: #525659; }
.of-slides-wrap { width: 100%; max-width: 900px; margin: 0 auto; box-sizing: border-box; padding: 16px; color: #e3e3e3; }
.of-note { color: #bdbdbd; font-size: 14px; margin: 0 0 8px; }
.of-slides { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.of-slides li { background: #1f1f1f; border: 1px solid #3c3c3c; border-radius: 8px; padding: 12px 16px; }
.of-slides strong { font-weight: 500; }
.of-slides p { margin: 4px 0 0; white-space: pre-wrap; word-break: break-word; }
.of-sheets { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; }
.of-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: #1f1f1f; border-bottom: 1px solid #3c3c3c; flex: 0 0 auto; }
.of-tabs { display: flex; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.of-tab { border: 0; background: transparent; color: #c7c7c7; font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 16px; cursor: pointer; white-space: nowrap; }
.of-tab:hover:not(.on) { background: rgba(255, 255, 255, .08); }
.of-tab.on { background: #0b57d0; color: #fff; }
.of-controls { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #c7c7c7; flex-wrap: wrap; }
.of-controls .icon-btn { color: #e3e3e3; }
.of-info { white-space: nowrap; }
.of-sep { width: 1px; height: 20px; background: #3c3c3c; margin: 0 6px; }
.of-zoom-label { min-width: 44px; text-align: center; }
.of-grid { flex: 1; min-height: 0; overflow: auto; background: #fff; }
.of-table { border-collapse: separate; border-spacing: 0; font-family: Arial, system-ui, sans-serif; color: #1f1f1f; }
.of-table td, .of-table th { border-right: 1px solid #e0e0e0; border-bottom: 1px solid #e0e0e0; padding: 2px 6px; min-width: 64px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: 400; }
.of-table thead th { position: sticky; top: 0; z-index: 2; background: #f3f3f3; color: #444; font-weight: 500; text-align: center; }
.of-table .of-corner, .of-table .of-rown { position: sticky; left: 0; z-index: 1; background: #f3f3f3; color: #444; text-align: center; min-width: 44px; }
.of-table thead .of-corner { z-index: 3; }
.viewer-top .office-open { color: #e3e3e3; }
.viewer-top .office-open:hover { background: rgba(255, 255, 255, .1); }

/* Histórico de versões (ui/versions.js) */
.ver-list { display: flex; flex-direction: column; gap: 4px; }
.ver-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px; border-bottom: 1px solid rgba(127, 127, 127, .2); }
.ver-main { min-width: 0; }
.ver-date { font-weight: 500; }
.ver-meta { font-size: .85em; opacity: .75; overflow-wrap: anywhere; }
.ver-actions { display: flex; gap: 2px; flex-shrink: 0; }
.ver-empty, .ver-note { margin: 8px 0; opacity: .8; }

/* Assistente de IA: botão na barra superior e painel lateral (ui/assistant.js) */
.ai-btn[hidden] { display: none !important; }
.topbar-actions .ai-btn:not([hidden]) { display: inline-flex; }
.ai-btn.on { color: var(--md-sys-color-primary); background: var(--md-sys-color-primary-container); }
.ai-panel {
  position: fixed; top: 64px; right: 0; bottom: 0; width: min(400px, 100vw); z-index: 46;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-on-surface);
  border-left: 1px solid var(--md-sys-color-outline-variant); box-shadow: var(--elev-3);
}
.ai-panel[hidden] { display: none; }
@media (max-width: 739px) { .ai-panel { top: 56px; } }
.ai-head { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.ai-spark { color: var(--md-sys-color-primary); }
.ai-title { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 500; }
.ai-count { font-size: 12px; color: var(--md-sys-color-on-surface-variant); white-space: nowrap; }
.ai-list { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-empty { margin: auto 0; font-size: 14px; line-height: 1.5; color: var(--md-sys-color-on-surface-variant); }
.ai-msg { display: flex; flex-direction: column; gap: 8px; max-width: 92%; }
.ai-msg.user { align-self: flex-end; align-items: flex-end; }
.ai-msg.bot { align-self: flex-start; }
.ai-msg.err { align-self: stretch; max-width: 100%; }
.ai-bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg.user .ai-bubble { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); white-space: pre-wrap; border-bottom-right-radius: 4px; }
.ai-msg.bot .ai-bubble { background: var(--md-sys-color-surface-container-lowest); border-bottom-left-radius: 4px; }
.ai-msg.err .ai-bubble { color: var(--md-sys-color-error); border: 1px solid var(--md-sys-color-error); }
.ai-md p { margin: 0 0 8px; white-space: pre-line; }
.ai-md p:last-child, .ai-md ul:last-child, .ai-md ol:last-child { margin-bottom: 0; }
.ai-md ul, .ai-md ol { margin: 0 0 8px; padding-left: 20px; }
.ai-md code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--md-sys-color-surface-container-high); padding: 1px 4px; border-radius: 4px; }
.ai-code { margin: 0 0 8px; padding: 10px; overflow-x: auto; background: var(--md-sys-color-surface-container-high); border-radius: 8px; }
.ai-code code { background: none; padding: 0; white-space: pre; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 12px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 16px; background: var(--md-sys-color-surface-container-lowest); color: var(--md-sys-color-on-surface); text-decoration: none; font-size: 13px; }
.ai-chip:hover { box-shadow: var(--elev-1); }
.ai-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 12px; background: var(--md-sys-color-surface-container-lowest); font-size: 14px; }
.ai-card.done { flex-direction: row; align-items: center; gap: 8px; color: var(--md-sys-color-on-surface-variant); }
.ai-card-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ai-typing { align-self: flex-start; }
.ai-dots { display: inline-flex; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--md-sys-color-surface-container-lowest); }
.ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--md-sys-color-on-surface-variant); animation: ai-bounce 1.2s infinite ease-in-out; }
.ai-dots i:nth-child(2) { animation-delay: .15s; }
.ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-bounce { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-foot { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.ai-consent { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 12px; border: 1px dashed var(--md-sys-color-outline); border-radius: 8px; background: none; color: var(--md-sys-color-on-surface-variant); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.ai-consent.on { border-style: solid; border-color: var(--md-sys-color-primary); background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.ai-consent[hidden] { display: none; }
.ai-compose { display: flex; align-items: flex-end; gap: 8px; }
.ai-input { flex: 1; min-height: 40px; max-height: 140px; resize: none; padding: 10px 14px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: 20px; background: var(--md-sys-color-surface-container-lowest); color: var(--md-sys-color-on-surface); font: inherit; font-size: 14px; }
.ai-input:focus { outline: 2px solid var(--md-sys-color-primary); outline-offset: -1px; }
.ai-send { flex: 0 0 auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ai-send:disabled { opacity: .4; cursor: default; }
.ai-key-badge { margin-left: 6px; padding: 1px 8px; border-radius: 8px; font-size: 12px; background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); }
.ai-key-badge.ok { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.ai-privacy { margin: 12px 0; }
@media (prefers-reduced-motion: reduce) { .ai-dots i { animation: none; } }

.pwa-install { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px); padding: 10px 12px; border-radius: 14px; background: var(--surface, #fff); color: inherit;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); font-size: 14px; }
.pwa-install img { border-radius: 8px; flex: none; }
.pwa-install-go { border: 0; border-radius: 999px; padding: 8px 14px; background: #7b3fe4; color: #fff; font: inherit; cursor: pointer; white-space: nowrap; }
.pwa-install-x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ---------------------------------------------------------------- Visual de Pastas Semânticas & Categorias de Bibliotecas */
.folder-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.folder-badge-ico {
  font-size: 20px !important;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}
.folder-badge.fc-badge { width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px; }

/* Tons semânticos (Claro) */
.folder-badge.tone-movies  { background: rgba(26, 115, 232, 0.12); color: #1967d2; }
.folder-badge.tone-series  { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.folder-badge.tone-books   { background: rgba(227, 116, 0, 0.13);  color: #c25e00; }
.folder-badge.tone-music   { background: rgba(0, 137, 123, 0.12);  color: #00796b; }
.folder-badge.tone-courses { background: rgba(2, 132, 199, 0.12);  color: #0369a1; }
.folder-badge.tone-videos  { background: rgba(220, 38, 38, 0.11);  color: #b91c1c; }
.folder-badge.tone-photos  { background: rgba(219, 39, 119, 0.12); color: #be185d; }
.folder-badge.tone-system  { background: rgba(79, 70, 229, 0.12);  color: #4338ca; }
.folder-badge.tone-backup  { background: rgba(71, 85, 105, 0.12);  color: #334155; }
.folder-badge.tone-project { background: rgba(13, 148, 136, 0.12); color: #0f766e; }
.folder-badge.tone-default { background: rgba(95, 99, 104, 0.11);  color: #475569; }

/* Tons semânticos (Escuro) */
:root[data-theme="dark"] .folder-badge.tone-movies  { background: rgba(138, 180, 248, 0.16); color: #8ab4f8; }
:root[data-theme="dark"] .folder-badge.tone-series  { background: rgba(196, 181, 253, 0.16); color: #c4b5fd; }
:root[data-theme="dark"] .folder-badge.tone-books   { background: rgba(253, 186, 116, 0.16); color: #fdba74; }
:root[data-theme="dark"] .folder-badge.tone-music   { background: rgba(94, 234, 212, 0.16);  color: #5eead4; }
:root[data-theme="dark"] .folder-badge.tone-courses { background: rgba(125, 211, 252, 0.16); color: #7dd3fc; }
:root[data-theme="dark"] .folder-badge.tone-videos  { background: rgba(248, 113, 113, 0.16); color: #f87171; }
:root[data-theme="dark"] .folder-badge.tone-photos  { background: rgba(244, 114, 182, 0.16); color: #f472b6; }
:root[data-theme="dark"] .folder-badge.tone-system  { background: rgba(165, 180, 252, 0.16); color: #a5b4fc; }
:root[data-theme="dark"] .folder-badge.tone-backup  { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
:root[data-theme="dark"] .folder-badge.tone-project { background: rgba(94, 234, 212, 0.16);  color: #5eead4; }
:root[data-theme="dark"] .folder-badge.tone-default { background: rgba(148, 163, 184, 0.14); color: #94a3b8; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .folder-badge.tone-movies  { background: rgba(138, 180, 248, 0.16); color: #8ab4f8; }
  :root:not([data-theme="light"]) .folder-badge.tone-series  { background: rgba(196, 181, 253, 0.16); color: #c4b5fd; }
  :root:not([data-theme="light"]) .folder-badge.tone-books   { background: rgba(253, 186, 116, 0.16); color: #fdba74; }
  :root:not([data-theme="light"]) .folder-badge.tone-music   { background: rgba(94, 234, 212, 0.16);  color: #5eead4; }
  :root:not([data-theme="light"]) .folder-badge.tone-courses { background: rgba(125, 211, 252, 0.16); color: #7dd3fc; }
  :root:not([data-theme="light"]) .folder-badge.tone-videos  { background: rgba(248, 113, 113, 0.16); color: #f87171; }
  :root:not([data-theme="light"]) .folder-badge.tone-photos  { background: rgba(244, 114, 182, 0.16); color: #f472b6; }
  :root:not([data-theme="light"]) .folder-badge.tone-system  { background: rgba(165, 180, 252, 0.16); color: #a5b4fc; }
  :root:not([data-theme="light"]) .folder-badge.tone-backup  { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
  :root:not([data-theme="light"]) .folder-badge.tone-project { background: rgba(94, 234, 212, 0.16);  color: #5eead4; }
  :root:not([data-theme="light"]) .folder-badge.tone-default { background: rgba(148, 163, 184, 0.14); color: #94a3b8; }
}

/* Refinamento das linhas de pasta e chips no Meu Drive */
.list .row[data-folder="1"] { height: 52px; border-radius: 10px; transition: background 120ms ease; }
.list .row[data-folder="1"] .cell.name .name-text { font-weight: 500; }
.list .row[data-folder="1"]:hover .folder-badge,
.folder-chip:hover .folder-badge { transform: scale(1.05); }
.folder-chip {
  height: 54px; padding: 0 6px 0 10px; border-radius: 12px;
  background: var(--md-sys-color-surface-container-low);
  transition: box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}
.folder-chip:hover { box-shadow: var(--elev-1); border-color: var(--app-card-hover-border); }

/* Ícones de categorias na sidebar */
.nav-item.active .nav-lib-ico { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

/* Cabeçalho agrupado das Bibliotecas + Pílulas de Sub-bibliotecas */
.lib-header-wrap { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.lib-title-row { display: flex; align-items: center; gap: 12px; }
.lib-title-row .lib-title { margin: 0; }
.lib-title-badge { width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px; }
.lib-subpills {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 4px 0 2px;
}
.lib-subpill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}
.lib-subpill:hover {
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--elev-1);
}
.lib-subpill.is-active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
  font-weight: 600;
}
.lib-subpill-ico { font-size: 18px !important; }
.lib-subpill.is-active .lib-subpill-ico {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}
.lib-subpill-count {
  font-size: 12px; font-weight: 500; opacity: 0.78;
  padding: 1px 8px; border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}
