:root {
  --panel: #fff;
  --surface: #f8f9fa;
  --surface-strong: #eaecf0;
  --border: #c8ccd1;
  --border-strong: #a2a9b1;
  --text: #202122;
  --muted: #54595d;
  --faint: #72777d;
  --link: #0645ad;
  --focus: #3366cc;
  --danger: #ba0000;
  --danger-soft: #fff5f5;
  --danger-icon-filter: invert(12%) sepia(99%) saturate(4821%) hue-rotate(356deg) brightness(83%) contrast(120%);
  --success: #00af89;
  --success-soft: #effffa;
  --topbar-h: 48px;
  --safe-top: env(safe-area-inset-top, 0px);
  --appbar-h: calc(var(--topbar-h) + var(--safe-top));
  --content-width: 1100px;
}

* { box-sizing: border-box; }
html { min-height: 100%; scrollbar-gutter: stable; background: #fff; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: #fff;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}
body.has-overlay { overflow: hidden; overscroll-behavior: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: #d8ecff; color: var(--text); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.material-icon { display: block; width: 18px; height: 18px; flex: 0 0 auto; object-fit: contain; pointer-events: none; user-select: none; }

.app-shell { min-height: 100vh; min-height: 100dvh; background: #fff; touch-action: pan-x pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.app-shell input, .app-shell textarea, .app-shell select, .app-shell [contenteditable="true"], .app-shell .allow-text-selection, .app-shell pre, .app-shell code { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: var(--appbar-h);
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
}
.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: var(--topbar-h);
  padding-right: max(16px, env(safe-area-inset-right));
  padding-left: max(16px, env(safe-area-inset-left));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 112px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.75rem;
  cursor: default;
}
.brand:hover, .brand:active { background: transparent; color: #000; opacity: 1; }
.brand-icon { width: 24px; height: 24px; }
.mode-switcher {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  width: 232px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  transform: translate(-50%, -50%);
  isolation: isolate;
}
.mode-switcher::after {
  position: absolute;
  top: 50%;
  right: 1px;
  left: 1px;
  z-index: 0;
  height: 34px;
  border-radius: 999px;
  background: rgba(0,0,0,.03);
  content: "";
  pointer-events: none;
  transform: translateY(-50%);
}
.mode-switcher::before {
  position: absolute;
  top: -.5px;
  bottom: -.5px;
  left: -.5px;
  z-index: 1;
  width: calc(50% + 9px);
  border: .5px solid rgba(0,0,0,.1);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 6px 0 rgba(0,0,0,.05);
  content: "";
  pointer-events: none;
  transition: left 150ms ease;
}
.mode-switcher.is-files::before { left: calc(50% - 8.5px); }
.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  width: 100%;
  min-width: 0;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5d5d5d;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  transition: color 150ms ease;
}
.mode-tab > span { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.mode-tab:first-child > span { transform: translateX(4px); }
.mode-tab:last-child > span { transform: translateX(-4px); }
.mode-tab:hover { color: #0d0d0d; text-decoration: none; }
.mode-tab.is-active { color: #0d0d0d; box-shadow: none; }
.mode-tab .material-icon { display: none; }
.topbar-account { display: flex; min-width: 112px; align-items: center; justify-content: flex-end; gap: 8px; }
.topbar-user { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; color: #000; }
.topbar-user:hover .google-identity { text-decoration: underline; }
.topbar-user:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 999px; }
.topbar-user.is-active .account-avatar { outline: 1px solid var(--border-strong); outline-offset: 2px; }
.account-avatar { position: relative; display: inline-grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #ebedfe; color: #3449F0; font-size: 12px; font-weight: 700; }
.account-avatar::after { position: absolute; inset: -3px; border: 2px solid transparent; border-radius: 50%; content: ""; pointer-events: none; }
.topbar-user.has-sync-pending .account-avatar::after { border-color: #e2cff5; border-top-color: #a875d3; animation: account-sync-spin .9s linear infinite; }
@keyframes account-sync-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .topbar-user.has-sync-pending .account-avatar::after { animation-duration: 2.4s; } }
.google-identity { max-width: 180px; overflow: hidden; color: #000; font-size: 14px; font-weight: 500; line-height: 1.25rem; text-overflow: ellipsis; white-space: nowrap; }
.icon-control, .icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
}
.icon-control:hover, .icon-button:hover { background: var(--surface-strong); }
.status-badge {
  display: none;
  align-items: center;
  gap: 5px;
  max-width: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-badge::before { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--border-strong); content: ""; }
.status-online { display: none; }
.status-online::before { background: #00af89; }
.status-working::before { background: #3366cc; animation: pulse-dot 1.2s ease-in-out infinite alternate; }
.status-offline::before { background: #d33; }
.status-pending { display: none; }
.status-pending::before { background: #a875d3; animation: pulse-dot 1.2s ease-in-out infinite alternate; }
@keyframes pulse-dot { from { opacity: .35; } to { opacity: 1; } }

.auth-mode .mode-switcher, .auth-mode .topbar-user { display: none !important; }
.boot-mode .mode-switcher, .boot-mode #drivePanel { pointer-events: none; }
.main-panel { min-width: 0; }
.page-wrapper { width: 100%; max-width: var(--content-width); min-height: calc(100vh - var(--appbar-h)); min-height: calc(100dvh - var(--appbar-h)); margin: 0 auto; padding: .75rem; background: #fff; }
.auth-wrapper, .welcome-wrapper { display: flex; align-items: center; justify-content: center; }
.monobook-card { border: 1px solid var(--border); border-radius: 0; background: #fff; box-shadow: none; }
.auth-card, .welcome-card { width: min(420px, 100%); padding: 24px; text-align: center; }
.auth-brand { display: flex; align-items: center; justify-content: center; padding-bottom: 9px; border-bottom: 1px solid var(--border-strong); }
.auth-brand-home { display: inline-grid; place-items: center; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; cursor: default; }
.auth-brand-home:hover, .auth-brand-home:active { background: transparent; color: inherit; opacity: 1; }
.auth-brand .material-icon { width: 30px; height: 30px; }
.auth-card > p, .welcome-card > p { color: var(--muted); }
.auth-help { margin: 14px 0 0; font-size: 12px; }
.google-button { display: inline-flex; width: 100%; min-height: 40px; align-items: center; justify-content: center; gap: 9px; }

.section-tabs { display: flex; gap: 0; margin: -1px 0 13px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.section-tabs::-webkit-scrollbar { display: none; }
.section-tab { position: relative; display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.section-tab .material-icon { display: none; width: 18px; height: 18px; }
.section-tab:hover { color: var(--text); text-decoration: none; }
.section-tab.is-active { background: transparent; color: #000; }
.section-tab.is-active::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; background: #000; content: ""; }
.photo-section-tabs { align-items: center; border-bottom: 0; }
.photo-section-tabs > .section-tab,
.photo-section-tabs > .section-tabs-spacer { align-self: stretch; border-bottom: 1px solid var(--border); }
.photo-search-toggle.is-open { color: var(--text); }
.photo-search-toggle.is-open::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; background: #000; content: ""; }
.section-tabs-spacer { min-width: 8px; flex: 1 1 auto; }
.photo-add-button, .photo-empty-trash-button { min-height: 32px; flex: 0 0 auto; margin: 0 8px 0 6px; white-space: nowrap; }
.photo-empty-trash-button .material-icon { width: 17px; height: 17px; }

.content-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 14px; }
.is-minimal-root .content-header { display: none; }
#drivePanel:not(.is-minimal-root) .content-header { margin-bottom: 8px; }
#drivePanel:not(.is-minimal-root) .content-header .page-title { display: none; }
.content-title-wrap { min-width: 0; flex: 1; }
.page-title {
  margin: 0;
  color: var(--text);
  padding: 0 0 4px;
  border-bottom: 1px solid var(--border-strong);
  font-family: "Linux Libertine", Georgia, "Times New Roman", serif;
  font-size: 1.8em;
  font-weight: 400;
  line-height: 1.2;
}
.page-subtitle { display: none; }
.file-path-row { display: flex; min-width: 0; align-items: center; gap: 7px; }
.file-navigation { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 2px; }
.file-nav-button { width: 28px; height: 28px; }
.file-nav-button .material-icon { width: 15px; height: 15px; }
.file-up-button .material-icon { transform: rotate(90deg); }
.breadcrumbs { min-height: 28px; margin-bottom: 3px; display: flex; min-width: 0; align-items: center; color: var(--muted); font-size: 12px; }
.breadcrumbs:empty { display: none; }
.breadcrumbs button { padding: 0; border: 0; background: transparent; color: var(--link); }
.breadcrumbs button:hover { text-decoration: underline; }
.breadcrumbs span { padding: 0 6px; color: var(--faint); }
.breadcrumb-path-editor { width: min(620px, 100%); min-width: 180px; height: 30px; padding: 3px 7px; border: 1px solid var(--border-strong); border-radius: 2px; background: #fff; color: var(--text); font: inherit; }
.header-actions, .settings-actions, .photo-album-toolbar, .selection-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.primary-button, .secondary-button, .danger-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: .42rem .75rem;
  border-radius: 2px;
  font-size: .85rem;
  font-weight: 600;
}
.primary-button { border: 1px solid #000; background: #000; color: #fff; }
.primary-button:hover { border-color: #333; background: #333; }
.primary-button .material-icon { filter: invert(1); }
.add-menu-button { white-space: nowrap; }
.secondary-button { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.secondary-button:hover { background: var(--surface-strong); }
.danger-button { border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger); }
.danger-button:hover { background: #ffebeb; }
.danger-button .material-icon { opacity: 1; filter: var(--danger-icon-filter); }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar.photo-search-only .header-actions,
.toolbar.photo-search-only .toolbar-actions { display: none; }
.toolbar.collection-landing .search-box,
.toolbar.collection-landing .toolbar-actions { display: none; }
.toolbar.collection-landing .header-actions { margin-left: auto; }
.search-box { display: flex; min-width: 240px; min-height: 34px; flex: 1; align-items: center; gap: 7px; padding: 4px 6px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; transition: border-color 120ms ease; }
.search-box:focus-within { border-color: var(--muted); box-shadow: none; }
.search-box .material-icon { width: 15px; height: 15px; opacity: .8; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box input::placeholder { color: var(--faint); }
.photo-search-date-button { display: none; min-height: 32px; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.toolbar.photo-search-only .photo-search-date-button { display: inline-flex; }
.photo-search-date-button:hover { background: var(--surface); color: var(--text); }
.photo-search-date-button.is-active { border-color: var(--border); background: var(--surface); color: var(--text); }
.photo-search-date-button .material-icon { width: 16px; height: 16px; }
.toolbar-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }
.toolbar-menu { position: relative; }
.file-control-button { min-width: 104px; white-space: nowrap; }
.file-control-button.is-active { border-color: #72777d; background: var(--surface-strong); }
.file-control-button .material-icon { width: 17px; height: 17px; }
.toolbar-choice-popover { top: calc(100% + 4px); min-width: 188px; }
.toolbar-choice-popover button[aria-checked="true"] { background: var(--surface); font-weight: 700; }
.toolbar-choice-popover .menu-check-placeholder { width: 17px; height: 17px; flex: 0 0 17px; }
.empty-trash-button { white-space: nowrap; }
.empty-trash-button .material-icon { width: 17px; height: 17px; }
.empty-trash-icon {
  background-color: currentColor;
  -webkit-mask: url("/icons/material/delete_forever.svg") center / contain no-repeat;
  mask: url("/icons/material/delete_forever.svg") center / contain no-repeat;
  filter: none !important;
}
.file-density-button { width: 34px; height: 34px; }
.file-density-button.is-active { background: var(--surface-strong); box-shadow: inset 0 -2px #000; }
.view-toggle { display: flex; }
.view-toggle button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--border-strong); border-radius: 0; background: var(--surface); }
.view-toggle button + button { border-left: 0; }
.view-toggle button.is-active { background: #fff; box-shadow: inset 0 -2px #000; }
.photo-album-toolbar { justify-content: flex-end; margin: 0 0 12px; }

.notice { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border-strong); border-left: 4px solid var(--focus); border-radius: 2px; background: var(--surface); color: var(--text); text-align: left; }
.notice-error { border-color: var(--danger); border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.selection-toolbar { position: sticky; top: calc(var(--appbar-h) + 7px); z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 0; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.selection-toolbar > strong { white-space: nowrap; }
.item-select { display: grid; width: 25px; height: 25px; place-items: center; padding: 0; border: 1px solid var(--border-strong); border-radius: 2px; background: #fff; color: transparent; font-size: 13px; font-weight: 800; }
.item-select.is-selected { border-color: #000; background: #000; color: #fff; }
.item-select .material-icon { width: 16px; height: 16px; opacity: 0; }
.item-select.is-selected .material-icon { opacity: 1; filter: invert(1); }

/* Seleção da lista de arquivos: caixa visual pequena, com uma área de clique maior e invisível. */
.item-select-table {
  position: relative;
  display: grid;
  width: 22px;
  height: 32px;
  flex: 0 0 22px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  opacity: 0;
  transition: opacity 120ms ease;
}
.item-select-table::before {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0,0,0,.20);
  border-radius: 4px;
  background: #fff;
  content: "";
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.item-select-table.is-selected { border: 0; background: transparent; color: #fff; opacity: 1; }
.item-select-table.is-selected::before { border-color: #000; background: #000; }
.item-select-table .material-icon { position: relative; z-index: 1; width: 10px; height: 10px; }
.item-select-table:focus-visible { outline: 0; }
.item-select-table:focus-visible::before { box-shadow: 0 0 0 1px #fff, 0 0 0 3px #000; }
.file-table tbody tr:hover .item-select-table,
.file-table tbody tr:focus-within .item-select-table,
.selection-active .item-select-table,
.item-select-table.is-selected { opacity: 1; }

.table-wrap { overflow: visible; border: 1px solid var(--border-strong); border-radius: 0; background: #fff; }
.file-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.file-table th { position: sticky; top: var(--appbar-h); z-index: 24; padding: 7px 10px; border-bottom: 1px solid var(--border-strong); background: var(--surface-strong); color: var(--text); font-size: 12px; font-weight: 700; text-align: left; }
.file-sort-header { display: inline-flex; max-width: 100%; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; white-space: nowrap; }
.file-sort-header:hover { text-decoration: underline; }
.file-sort-header:disabled { cursor: default; opacity: .7; text-decoration: none; }
.file-sort-indicator { width: 9px; padding: 0 !important; color: var(--muted) !important; font-size: 9px; line-height: 1; }
.file-sort-header[data-direction="asc"] .file-sort-indicator::before { content: "▲"; }
.file-sort-header[data-direction="desc"] .file-sort-indicator::before { content: "▼"; }
.file-table th.col-name { padding-left: 41px; }
.file-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.file-table tbody tr:last-child td { border-bottom: 0; }
.file-table tbody tr { background: #fff; transition: background-color 120ms ease; }
.file-table tbody tr:hover { background: #f7f7f8; }
.file-table tbody tr.file-move-draggable { cursor: default; }
.file-table tbody tr.is-file-move-source { opacity: .58; }
.file-table tbody tr.is-file-move-target,
.file-table tbody tr.is-file-move-target:hover { background: #eef4ff; box-shadow: inset 0 0 0 2px var(--focus); }
.file-table th:first-child { width: auto; }
.col-type { width: 120px; }
.col-size { width: 105px; }
.col-date { width: 150px; }
.col-actions { width: 48px; text-align: right; }
#app[data-file-density="compact"] .file-table th { padding-top: 5px; padding-bottom: 5px; }
#app[data-file-density="compact"] .file-table td { padding-top: 3px; padding-bottom: 3px; }
#app[data-file-density="compact"] .item-select-table { height: 28px; }
#app[data-file-density="compact"] .action-menu > button { width: 28px; height: 28px; }
.file-name-cell { display: flex; min-width: 0; align-items: center; gap: 9px; }
.file-icon { display: block; width: 22px; height: 22px; flex: 0 0 auto; }
.file-main { min-width: 0; flex: 1; }
.file-name-button { display: block; max-width: 100%; overflow: hidden; padding: 0; border: 0; background: transparent; color: var(--text); font-weight: 600; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.file-name-button:hover { color: var(--text); text-decoration: none; }
.file-inline-name-input { width: min(100%, 520px); min-width: 120px; height: 28px; padding: 2px 5px; border: 1px solid #4a76a8; border-radius: 2px; background: #fff; color: var(--text); font: inherit; font-weight: 600; outline: 1px solid rgba(74,118,168,.15); }
.file-inline-create-row td { background: #fbfcfd; }
.file-inline-create-card { border-style: dashed; }
.file-subtitle { margin-top: 1px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.action-menu { position: relative; display: inline-block; }
.action-menu > button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 0; background: transparent; }
.action-menu > button:hover { background: var(--surface-strong); }
.action-popover { position: absolute; right: 0; top: 32px; z-index: 55; min-width: 190px; padding: 4px; border: 1px solid var(--border-strong); border-radius: 0; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.action-popover button { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 9px; padding: 7px 8px; border: 0; background: transparent; color: var(--text); text-align: left; }
.action-popover button .material-icon { width: 17px; height: 17px; opacity: .82; }
.action-popover button { border-radius: 0; }
.action-popover button:hover { background: var(--surface); }
.action-popover button.is-danger { color: var(--danger); }
.action-popover button.is-danger .material-icon { opacity: 1; filter: var(--danger-icon-filter); }

/* Seleção em massa: mantém as superfícies de biblioteca previsíveis no desktop e no toque. */
#photosView, #fileGridView, #fileListView,
#photosView *, #fileGridView *, #fileListView * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#photosView img, #fileGridView img, #fileListView img {
  -webkit-user-drag: none;
  user-select: none;
}
.selection-active #photosView,
.selection-active #fileGridView,
.selection-active #fileListView { touch-action: pan-y; overscroll-behavior-y: contain; }
.selection-dragging, .selection-dragging * { cursor: cell !important; }
.photo-tile.is-selected::after {
  position: absolute;
  inset: 2px;
  z-index: 3;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,.72);
  pointer-events: none;
  content: "";
}
.file-card.is-selected { box-shadow: inset 0 0 0 2px #111; }
.file-table tbody tr.is-selected,
.file-table tbody tr.is-selected:hover { background: #f4f4f4; }
.selection-active .item-select-photo { opacity: .62; }
.selection-active .item-select-photo.is-selected { opacity: 1; }

.site-context-menu {
  position: fixed;
  z-index: 150;
  display: grid;
  width: min(236px, calc(100vw - 16px));
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.site-context-menu button {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.site-context-menu button:hover, .site-context-menu button:focus-visible { background: var(--surface); }
.site-context-menu button .material-icon { width: 17px; height: 17px; opacity: .82; }
.site-context-menu button.is-danger { color: var(--danger); }
.site-context-menu button.is-danger .material-icon { opacity: 1; filter: var(--danger-icon-filter); }
.site-context-separator { height: 1px; margin: 4px 5px; background: var(--border); }

.empty-state { display: grid; min-height: 180px; align-content: center; justify-items: center; gap: 9px; padding: 32px 16px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); text-align: center; }
.empty-state p { max-width: 320px; margin: 0; }
.empty-state .empty-state-icon { width: 32px; height: 32px; opacity: .46; }
.empty-state-actions { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 3px; flex-wrap: wrap; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.file-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 0; background: #fff; content-visibility: auto; contain-intrinsic-size: auto 190px; }
.file-card.file-move-draggable { cursor: default; }
.file-card.is-file-move-source { opacity: .58; }
.file-card.is-file-move-target { border-color: var(--focus); box-shadow: inset 0 0 0 2px var(--focus); background: #eef4ff; }
.file-move-draggable .file-name-button,
.file-move-draggable .file-card-preview,
.file-move-draggable .file-card-name { cursor: default; }
html.file-move-dragging,
html.file-move-dragging * { cursor: default !important; }
.item-select-card {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 4;
  width: 22px;
  height: 22px;
}
.item-select-card .material-icon { width: 13px; height: 13px; }
.file-card-preview { position: relative; display: grid; width: 100%; aspect-ratio: 1.42; place-items: center; overflow: hidden; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.file-card-preview > .material-icon { width: 35px; height: 35px; }
.file-card-preview > .driveb-file-type-icon { display: block; width: 54px; height: 54px; }
.file-card-preview img:not(.material-icon) { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.file-card-body { display: flex; align-items: flex-start; gap: 5px; padding: 8px; }
.file-card-main { min-width: 0; flex: 1; }
.file-card-name { display: block; width: 100%; overflow: hidden; padding: 0; border: 0; background: transparent; color: var(--text); font-weight: 600; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.file-card-name:hover { color: var(--text); text-decoration: none; }
.file-card-meta { margin-top: 2px; color: var(--muted); font-size: 11px; }

.photos-view { min-height: 240px; }
.photo-group { margin-bottom: 20px; }
.photo-group-title { position: sticky; top: var(--appbar-h); z-index: 6; margin: 0 0 4px; padding: 4px 1px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96); color: var(--text); font-size: 12px; font-weight: 700; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 2px; }
.photo-tile { position: relative; aspect-ratio: 1; overflow: hidden; border: 0; border-radius: 0; background: var(--surface-strong); color: var(--muted); }
.photo-tile-placeholder { position: absolute; inset: 0; z-index: 0; display: grid; place-items: center; background: linear-gradient(105deg, #f1f2f3 25%, #f8f9fa 40%, #f1f2f3 55%); background-size: 240% 100%; animation: thumbnail-skeleton 1.5s ease-in-out infinite; }
.photo-tile-placeholder .material-icon { width: 26px; height: 26px; opacity: .5; }
.photo-tile > img:not(.material-icon) { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; transform: rotate(var(--media-rotation, 0deg)); }
.photo-tile.is-thumbnail-ready .photo-tile-placeholder { animation: none; }
.photo-open { position: absolute; inset: 0; z-index: 2; padding: 0; border: 0; background: transparent; }
.photo-tile-video { position: absolute; right: 5px; bottom: 5px; z-index: 3; padding: 2px 5px; background: rgba(0,0,0,.72); color: #fff; font-size: 10px; }
.photo-tile-video .material-icon { width: 15px; height: 15px; filter: invert(1); }
.photo-tile-menu { position: absolute; top: 5px; right: 5px; z-index: 4; display: grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.7); border-radius: 2px; background: rgba(0,0,0,.62); opacity: 0; }
.photo-tile-menu .material-icon { filter: invert(1); }
.photo-tile:hover .photo-tile-menu, .photo-tile:focus-within .photo-tile-menu { opacity: 1; }
.item-select-photo { position: absolute; top: 6px; left: 6px; z-index: 4; border-color: rgba(255,255,255,.9); background: rgba(0,0,0,.42); opacity: 0; transition: opacity 100ms ease; }
.photo-tile:hover .item-select-photo, .photo-tile:focus-within .item-select-photo, .item-select-photo.is-selected { opacity: 1; }
.photo-loading { opacity: .35; animation: image-pulse 1.1s ease-in-out infinite alternate; }
@keyframes image-pulse { to { opacity: .75; } }
@keyframes thumbnail-skeleton { to { background-position: -140% 0; } }
.gallery-page { min-height: 1px; content-visibility: auto; contain-intrinsic-size: auto 2400px; }
.gallery-top-spacer { width: 1px; pointer-events: none; }
.gallery-previous-sentinel { width: 1px; height: 1px; pointer-events: none; }
.gallery-previous { display: flex; margin: 0 auto 14px; }
.gallery-sentinel { display: block; width: min(360px, 100%); min-height: 38px; margin: 8px auto 24px; border: 1px solid var(--border-strong); border-radius: 2px; background: var(--surface); color: var(--link); }
.gallery-sentinel:hover { background: var(--surface-strong); }

.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.album-card { min-width: 0; content-visibility: auto; contain-intrinsic-size: auto 190px; }
.album-cover { display: grid; width: 100%; aspect-ratio: 1.3; place-items: center; overflow: hidden; border: 1px solid var(--border); border-radius: 0; background: var(--surface); }
.album-cover > .material-icon { width: 34px; height: 34px; opacity: .65; }
.album-cover img:not(.material-icon) { width: 100%; height: 100%; object-fit: cover; transform: rotate(var(--media-rotation, 0deg)); }
.album-cover img.is-quarter-turn { width: 145%; height: 145%; }
.album-name-row { display: flex; align-items: center; gap: 5px; margin-top: 6px; }
.album-name { min-width: 0; flex: 1; overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.album-name-button { padding: 0; border: 0; background: transparent; color: var(--link); text-align: left; }
.album-name-button:hover { text-decoration: underline; }
.album-count { color: var(--muted); font-size: 11px; }
.album-detail-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.album-back { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--border-strong); background: var(--surface); }
.album-detail-title { min-width: 0; flex: 1; }
.album-detail-title strong, .album-detail-title span { display: block; }
.album-detail-title strong { font-size: 16px; }
.album-detail-title span { color: var(--muted); font-size: 11px; }

.index-status { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 9px 11px; border: 1px solid var(--border-strong); border-left: 4px solid var(--focus); border-radius: 0; background: var(--surface); }
.index-status strong, .index-status span { display: block; }
.index-status span { color: var(--muted); font-size: 11px; }
.index-status-icon { width: 20px; height: 20px; flex: 0 0 auto; opacity: .72; animation: spin 1.1s linear infinite; }
.index-status.is-transient { position: fixed; top: calc(var(--appbar-h) + 10px); right: max(12px, env(safe-area-inset-right)); z-index: 70; width: min(330px, calc(100vw - 24px)); margin: 0; background: rgba(255,255,255,.96); box-shadow: 0 5px 18px rgba(0,0,0,.12); pointer-events: none; backdrop-filter: blur(8px); }
@keyframes spin { to { transform: rotate(360deg); } }

.transfer-panel { position: fixed; right: 16px; bottom: 16px; z-index: 90; width: min(360px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--border-strong); border-radius: 2px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.transfer-panel-head { display: flex; width: 100%; min-height: 52px; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: #fff; color: var(--text); text-align: left; cursor: pointer; }
.transfer-panel-head:hover { background: var(--surface); }
.transfer-panel-head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.transfer-panel-icon { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--surface-strong); }
.transfer-panel-icon .material-icon { width: 17px; height: 17px; }
.transfer-panel-copy { display: block; min-width: 0; flex: 1; }
.transfer-panel-copy strong, .transfer-panel-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-panel-copy strong { font-size: 12px; font-weight: 650; }
.transfer-panel-copy span { margin-top: 1px; color: var(--muted); font-size: 10px; }
.transfer-panel-side { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; color: var(--muted); }
.transfer-percent { min-width: 30px; font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.transfer-chevron { width: 17px; height: 17px; opacity: .66; transform: rotate(90deg); transition: transform 120ms ease; }
.transfer-panel.is-expanded .transfer-chevron { transform: rotate(-90deg); }
.transfer-overall-progress { height: 2px; overflow: hidden; background: var(--surface-strong); }
.transfer-overall-progress > span { display: block; width: 0; height: 100%; background: var(--focus); transition: width .16s linear; }
.transfer-panel.has-errors .transfer-overall-progress > span { background: var(--danger); }
.transfer-panel-body { border-top: 1px solid var(--border); background: #fff; }
.transfer-list { max-height: min(44vh, 350px); overflow: auto; }
.transfer-row { padding: 9px 10px 8px; border-bottom: 1px solid var(--border); }
.transfer-row:last-child { border-bottom: 0; }
.transfer-row-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 11px; }
.transfer-row-top strong { display: flex; min-width: 0; flex: 1; align-items: center; gap: 6px; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.transfer-row-top strong .material-icon { width: 15px; height: 15px; flex: 0 0 auto; }
.transfer-row-top > span { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.transfer-row .progress { height: 3px; border: 0; border-radius: 2px; background: var(--surface-strong); }
.transfer-row .progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--focus); transition: width .12s linear; }
.transfer-row[data-status="failed"] .progress > span { background: var(--danger); }
.upload-detail { margin-top: 4px; overflow: hidden; color: var(--faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.transfer-error-text { margin-top: 4px; color: var(--danger); font-size: 10px; line-height: 1.35; }
.transfer-action { margin-top: 5px; padding: 2px 0; border: 0; background: transparent; color: var(--link); font-size: 10px; }
.transfer-queue-note { padding: 8px 10px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.transfer-panel-dismiss { width: 100%; min-height: 34px; padding: 6px 10px; border: 0; border-top: 1px solid var(--border); background: #fff; color: var(--muted); font-size: 10px; text-align: center; }
.transfer-panel-dismiss:hover { background: var(--surface); color: var(--text); }
.transfer-diagnostics { color: var(--link); font-weight: 600; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.pagination span { min-width: 110px; color: var(--muted); font-size: 12px; text-align: center; }
.drop-zone { position: fixed; inset: 60px 18px 18px; z-index: 85; display: grid; place-items: center; border: 2px dashed var(--focus); background: rgba(248,251,255,.96); color: var(--focus); font-size: 20px; font-weight: 700; }

.settings-page { display: grid; place-items: start center; padding-top: 42px; }
.settings-simple { width: min(440px, 100%); }
.settings-account { display: grid; justify-items: center; padding: 4px 4px 0; text-align: center; }
.settings-account-label, .settings-account > strong { display: block; }
.settings-account-label { margin-bottom: 1px; color: var(--muted); font-size: 11px; font-weight: 600; }
.settings-account > strong { width: 100%; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.settings-storage-feature { display: grid; justify-items: center; gap: 3px; padding: 18px 4px 20px; color: var(--text); text-align: center; }
.settings-storage-label { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 13px; font-weight: 600; }
.settings-storage-label .material-icon { width: 18px; height: 18px; opacity: 1; filter: none; }
.settings-storage-feature > strong { font-size: 22px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.settings-storage-manage { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; padding: 3px 7px; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.settings-storage-manage:hover { color: var(--text); }
.settings-storage-manage .material-icon { width: 15px; height: 15px; }
.settings-signout { width: 100%; min-height: 34px; padding: .42rem .75rem; border: 1px solid var(--border-strong); border-radius: 2px; background: var(--surface); color: var(--text); font-size: .85rem; font-weight: 600; }
.settings-signout:hover { background: var(--surface-strong); }
.settings-sync-summary { display: flex; align-items: flex-start; gap: 10px; margin: 12px 2px 0; padding: 10px 11px; border-radius: 8px; background: #faf8fc; color: var(--text); }
.settings-sync-spinner { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; border: 2px solid #e2cff5; border-top-color: #a875d3; border-radius: 50%; animation: account-sync-spin .9s linear infinite; }
.settings-sync-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.settings-sync-copy > strong { font-size: 12px; font-weight: 650; line-height: 1.35; }
.settings-sync-copy > span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.settings-sync-details-button { width: fit-content; margin: 3px 0 0; padding: 0; border: 0; background: transparent; color: #8558ad; font-size: 11px; font-weight: 650; line-height: 1.5; }
.settings-sync-details-button:hover { color: #6d438f; text-decoration: underline; text-underline-offset: 2px; }
.settings-sync-diagnostics { margin: 6px 2px 0; padding: 10px 11px; border: 1px solid #eee7f4; border-radius: 8px; background: #fff; }
.settings-sync-diagnostic-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 12px; align-items: baseline; font-size: 11px; line-height: 1.45; }
.settings-sync-diagnostic-grid > span { color: var(--muted); }
.settings-sync-diagnostic-grid > strong { min-width: 0; overflow-wrap: anywhere; font-weight: 600; text-align: right; }
.settings-sync-diagnostic-operations { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.settings-sync-diagnostic-hint { margin: 8px 0 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
.settings-sync-diagnostic-hint.is-warning { color: #8a5b13; }
.settings-sync-diagnostic-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.settings-sync-diagnostic-actions > button { padding: 0; border: 0; background: transparent; color: #8558ad; font-size: 10.5px; font-weight: 650; }
.settings-sync-diagnostic-actions > button:hover { color: #6d438f; text-decoration: underline; text-underline-offset: 2px; }
.settings-sync-diagnostic-actions > button:disabled { color: var(--faint); text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .settings-sync-spinner { animation-duration: 2.4s; } }
.advanced-settings { margin-top: 28px; padding-top: 15px; border-top: 1px solid var(--border); color: var(--muted); }
.advanced-settings summary { width: fit-content; cursor: pointer; font-size: 12px; font-weight: 600; list-style-position: outside; }
.advanced-settings[open] summary { color: var(--text); }
.advanced-settings > p { margin: 12px 0; font-size: 12px; line-height: 1.55; }
.advanced-settings-actions { display: grid; gap: 8px; }
.advanced-settings-actions > button { width: 100%; min-height: 34px; }
.version-line { margin: 28px 0 0; color: var(--faint); font-size: 11px; text-align: center; }

.modal-backdrop { position: fixed; inset: 0; z-index: 190; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(255,255,255,.85); }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--border-strong); border-radius: 2px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.modal.modal-wide { width: min(960px, 100%); }
.modal-header { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border-strong); background: var(--surface); }
.modal-header h2 { min-width: 0; flex: 1; margin: 0; font-size: 16px; }
.modal-body { padding: 14px; }
.modal.modal-details { width: min(480px, 100%); border-color: var(--border); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.12); }
.modal-details .modal-header { padding: 13px 14px; border-bottom-color: var(--border); background: #fff; }
.modal-details .modal-header h2 { font-size: 15px; font-weight: 650; }
.modal-details .modal-body { padding: 18px; }
.modal-details .modal-actions { padding: 10px 12px; border-top-color: var(--border); background: #fff; }
.item-details { display: grid; gap: 18px; }
.detail-summary { display: grid; min-width: 0; gap: 4px; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.detail-name { overflow-wrap: anywhere; color: var(--text); font-size: 16px; font-weight: 650; line-height: 1.35; }
.detail-summary-meta { color: var(--muted); font-size: 12px; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 8px 0; }
.detail-list dt, .detail-list dd { margin: 0; }
.detail-list dt { color: var(--muted); font-size: 12px; font-weight: 500; }
.detail-list dd { min-width: 0; color: var(--text); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.device-storage { display: grid; gap: 12px; }
.device-storage-meter { height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-strong); }
.device-storage-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--text); }
.device-storage-total { margin: -3px 0 2px; color: var(--muted); font-size: 12px; text-align: center; }
.version-list, .similar-report { display: grid; gap: 8px; }
.version-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.version-row:last-child { border-bottom: 0; }
.version-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.version-copy strong { font-size: 13px; }
.version-copy span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.version-actions { display: flex; align-items: center; gap: 6px; }
.similar-group { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid var(--border); background: #fff; text-align: left; }
.similar-group:hover { background: var(--surface); }
.similar-group > span { display: grid; min-width: 0; gap: 2px; }
.similar-group strong, .similar-group span span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.similar-group span span { color: var(--muted); font-size: 11px; }
.smart-file-card .file-card-preview { min-height: 105px; }
.smart-file-card .file-card-preview > .material-icon { width: 34px; height: 34px; }
.modal-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 7px; padding: 9px 12px; border-top: 1px solid var(--border-strong); background: var(--surface); }
.form-field { display: block; margin-bottom: 12px; }
.form-field > span { display: block; margin-bottom: 4px; font-weight: 650; }
.form-field input, .form-field select, .modal-search { width: 100%; min-height: 32px; padding: .35rem .55rem; border: 1px solid var(--border-strong); border-radius: 2px; background: #fff; color: var(--text); font-size: .9rem; outline: 0; }
.form-field input:focus, .form-field select:focus, .modal-search:focus { outline: 1px solid var(--focus); }
.form-help { margin: -3px 0 11px; color: var(--muted); font-size: 12px; }
.import-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 13px; }
.import-stats > div { min-width: 0; padding: 8px; border: 1px solid var(--border); background: var(--surface); }
.import-stats strong, .import-stats span { display: block; }
.import-stats strong { color: var(--muted); font-size: 11px; }
.import-stats span { overflow-wrap: anywhere; font-weight: 600; }
.import-duplicate-check { margin: 2px 0 13px; padding: 8px; border: 1px solid var(--border); }
.action-sheet-list { display: grid; }
.action-sheet-button { display: flex; width: 100%; min-height: 46px; align-items: center; gap: 11px; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text); text-align: left; }
.action-sheet-button .material-icon { width: 20px; height: 20px; opacity: .82; }
.action-sheet-button:last-child { border-bottom: 0; }
.action-sheet-button:hover { background: var(--surface); }
.action-sheet-button.is-danger { color: var(--danger); }
.action-sheet-button.is-danger .material-icon { opacity: 1; filter: var(--danger-icon-filter); }
.modal-search { margin-bottom: 8px; }
.picker-list, .multi-select-list { display: grid; max-height: 50vh; overflow: auto; }
.picker-row { min-height: 38px; padding: 6px 8px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--link); text-align: left; overflow-wrap: anywhere; }
.picker-row:hover { background: var(--surface); text-decoration: underline; }
.modal.modal-folder-picker { width: min(680px, 100%); overflow: hidden; }
.modal-folder-picker .modal-body { padding: 14px; }
.folder-picker { display: grid; gap: 9px; }
.folder-picker-search { margin: 0; }
.folder-picker-list { min-height: 280px; max-height: min(56vh, 460px); overflow: auto; border: 1px solid var(--border); background: #fff; }
.folder-picker-status, .folder-picker-empty { display: grid; min-height: 180px; place-items: center; padding: 24px; color: var(--muted); text-align: center; }
.folder-tree-entry { display: flex; min-height: 38px; align-items: center; padding: 2px 6px 2px calc(6px + var(--folder-depth, 0) * 20px); border-bottom: 1px solid #eaecf0; }
.folder-tree-entry:last-child { border-bottom: 0; }
.folder-tree-entry:hover { background: #f7f9fc; }
.folder-tree-entry.is-selected { background: #eaf2ff; }
.folder-tree-entry.is-disabled { color: var(--faint); }
.folder-tree-toggle { display: grid; width: 24px; height: 30px; flex: 0 0 24px; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.folder-tree-toggle.is-spacer, .folder-tree-toggle:disabled { opacity: 0; cursor: default; }
.folder-tree-button { display: flex; min-width: 0; min-height: 32px; flex: 1; align-items: center; gap: 8px; padding: 4px 6px; border: 0; background: transparent; color: var(--text); text-align: left; }
.folder-tree-button:hover { background: transparent; }
.folder-tree-button:disabled { color: var(--faint); opacity: .62; }
.folder-tree-button .material-icon { width: 20px; height: 20px; }
.folder-tree-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-search-row { display: flex; width: 100%; min-height: 48px; align-items: center; gap: 9px; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--border); background: #fff; color: var(--text); text-align: left; }
.folder-search-row:last-child { border-bottom: 0; }
.folder-search-row:hover { background: var(--surface); }
.folder-search-row.is-selected { background: #eaf2ff; }
.folder-search-row .material-icon { width: 20px; height: 20px; }
.folder-search-copy { display: grid; min-width: 0; gap: 1px; }
.folder-search-copy strong, .folder-search-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-search-copy strong { font-size: 13px; font-weight: 600; }
.folder-search-copy span { color: var(--muted); font-size: 11px; }
.check-row { display: flex; min-height: 40px; align-items: center; gap: 9px; padding: 6px 3px; border-bottom: 1px solid var(--border); }
.check-row input { width: 16px; height: 16px; accent-color: var(--focus); }
.check-row-main { min-width: 0; flex: 1; }
.check-row-main strong, .check-row-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-row-main span { color: var(--muted); font-size: 11px; }
.inline-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.inline-pagination span { min-width: 90px; color: var(--muted); font-size: 11px; text-align: center; }
.preview-loading { display: grid; min-height: 170px; align-content: center; justify-items: center; gap: 9px; color: var(--muted); text-align: center; }
.preview-loading::before { width: 24px; height: 24px; background: url("/icons/material/sync.svg") center / contain no-repeat; opacity: .7; animation: spin 1.1s linear infinite; content: ""; }

.media-viewer { position: fixed; inset: 0; z-index: 160; display: grid; grid-template-rows: calc(54px + var(--safe-top)) minmax(0, 1fr) calc(62px + env(safe-area-inset-bottom)); background: #0d0f12; color: #fff; }
.viewer-topbar { display: flex; min-height: calc(54px + var(--safe-top)); align-items: center; gap: 9px; padding: var(--safe-top) 9px 0; background: rgba(13,15,18,.9); }
.viewer-icon, .viewer-arrow { display: grid; place-items: center; padding: 0; border: 0; background: transparent; }
.viewer-icon { width: 40px; height: 40px; }
.viewer-icon:hover, .viewer-arrow:hover { background: rgba(255,255,255,.1); }
.viewer-icon .material-icon, .viewer-arrow .material-icon { filter: invert(1); }
.viewer-title-wrap { min-width: 0; flex: 1; text-align: center; }
.viewer-title-wrap strong, .viewer-title-wrap span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title-wrap strong { font-size: 13px; }
.viewer-title-wrap span { color: #bac2ca; font-size: 10px; }
.viewer-stage { position: relative; display: grid; min-height: 0; place-items: center; overflow: hidden; touch-action: none; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: calc(100dvh - 116px - var(--safe-top) - env(safe-area-inset-bottom)); object-fit: contain; }
.viewer-stage video { width: min(100%, 1100px); }
.viewer-media-image { transform: rotate(var(--media-rotation, 0deg)) scale(var(--viewer-scale, 1)); transform-origin: center; will-change: transform; }
.viewer-media-image.is-zoom-animated { transition: transform 180ms ease; }
.viewer-media-image.is-zoomed { cursor: zoom-out; }
.viewer-thumbnail-preview { grid-area: 1 / 1; opacity: .68; filter: blur(1px); }
.viewer-loading { z-index: 1; grid-area: 1 / 1; padding: 6px 9px; border-radius: 2px; background: rgba(0,0,0,.62); color: #c5cbd1; font-size: 13px; }
.viewer-safe-fallback { display: grid; max-width: 480px; justify-items: center; gap: 11px; padding: 18px; color: #d4dae0; text-align: center; }
.viewer-disk-badge { position: absolute; right: 10px; bottom: 10px; padding: 3px 7px; background: rgba(0,0,0,.68); color: #fff; font-size: 10px; }
.viewer-arrow { position: absolute; top: 50%; z-index: 2; width: 46px; height: 46px; transform: translateY(-50%); background: rgba(0,0,0,.36); }
.viewer-prev { left: 12px; }
.viewer-next { right: 12px; }
.viewer-arrow:disabled { opacity: .2; }
.viewer-filmstrip { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 4px; overflow-x: auto; padding: 6px 54px max(6px, env(safe-area-inset-bottom)); background: rgba(13,15,18,.94); scrollbar-width: none; }
.viewer-filmstrip::-webkit-scrollbar { display: none; }
.viewer-filmstrip-item { position: relative; width: 44px; height: 44px; flex: 0 0 44px; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 2px; background: #24272b; opacity: .62; }
.viewer-filmstrip-item.is-active { border-color: #fff; opacity: 1; }
.viewer-filmstrip-item img:not(.material-icon) { width: 100%; height: 100%; object-fit: cover; transform: rotate(var(--media-rotation, 0deg)); }
.viewer-filmstrip-item .material-icon { width: 20px; height: 20px; margin: auto; filter: invert(1); opacity: .65; }

/* Catálogo local derivado: controles discretos e coleções reconstruíveis. */
.collection-section-title { margin: 4px 0 9px; font-size: 13px; font-weight: 700; }
.collection-section-title:not(:first-child) { margin-top: 24px; }
.smart-collection-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.smart-collection-card .album-cover { aspect-ratio: 1.55; background: var(--surface); }
.smart-collection-card .album-cover > .material-icon { width: 30px; height: 30px; opacity: .58; }
.photo-experience-tools { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 38; display: flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid rgba(162,169,177,.82); border-radius: 999px; background: rgba(255,255,255,.94); box-shadow: 0 3px 14px rgba(0,0,0,.10); backdrop-filter: blur(10px); }
.photo-experience-button { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; gap: 6px; padding: 5px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: 11px; font-weight: 650; }
.photo-experience-button:hover { background: var(--surface-strong); }
.photo-experience-button .material-icon { width: 17px; height: 17px; }
.photo-density-button { width: 34px; padding: 0; }

#app[data-photo-density="compact"] .photo-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
#app[data-photo-density="dense"] .photo-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 1px; }
.photo-tile, .photo-open { -webkit-touch-callout: none; user-select: none; }

.backup-center { display: grid; gap: 12px; }
.backup-center-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.backup-center-tools button { min-height: 42px; justify-content: center; }
.backup-receipt-list { display: grid; border-top: 1px solid var(--border); }
.backup-receipt { display: flex; width: 100%; min-height: 58px; align-items: center; gap: 9px; padding: 8px 2px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; }
.backup-receipt:hover { background: var(--surface); }
.backup-receipt > .material-icon:first-child { width: 21px; height: 21px; }
.backup-receipt.is-complete > .material-icon:first-child { filter: invert(47%) sepia(90%) saturate(1152%) hue-rotate(133deg) brightness(88%); }
.backup-receipt-copy { min-width: 0; flex: 1; }
.backup-receipt-copy strong, .backup-receipt-copy span { display: block; }
.backup-receipt-copy span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.backup-center-empty { margin: 0; padding: 20px 8px; color: var(--muted); text-align: center; }
.backup-wake-check { margin-top: 8px; padding: 9px; border: 1px solid var(--border); }
.duplicate-report { display: grid; gap: 8px; }
.duplicate-group { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid var(--border); background: var(--surface); }
.duplicate-group span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.share-ready { display: grid; min-height: 140px; align-content: center; justify-items: center; gap: 9px; color: var(--muted); text-align: center; }
.share-ready .material-icon { width: 30px; height: 30px; opacity: .66; }
.toast-region { position: fixed; right: 14px; bottom: 14px; z-index: 220; display: grid; width: min(360px, calc(100vw - 28px)); gap: 7px; pointer-events: none; transition: bottom 120ms ease; }
.toast { display: flex; min-height: 42px; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-strong); border-left: 4px solid var(--focus); border-radius: 0; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.1); pointer-events: auto; }
.toast-message { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.toast-action { min-height: 34px; flex: 0 0 auto; padding: 4px 6px; border: 0; background: transparent; color: var(--link); font-weight: 700; }
.toast-action:hover { background: var(--surface); }
.toast.is-error { border-left-color: var(--danger); }
.toast.is-success { border-left-color: var(--success); }

@media (min-width: 900px) {
  .page-wrapper { padding: 1rem 1.25rem 40px; }
}

@media (max-width: 899px) {
  .page-wrapper { padding: 1rem .5rem 40px; }
  .photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #app[data-photo-density="compact"] .photo-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #app[data-photo-density="dense"] .photo-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .col-type { display: none; }
}

@media (max-width: 700px) {
  .topbar-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; padding-right: max(12px, env(safe-area-inset-right)); padding-left: max(12px, env(safe-area-inset-left)); }
  .brand { grid-column: 1; min-width: 86px; min-height: 44px; width: auto; }
  .brand-icon { width: 24px; height: 24px; }
  .topbar-account { grid-column: 3; min-width: 36px; gap: 3px; }
  .topbar-user { min-width: 44px; min-height: 44px; justify-content: center; }
  .google-identity { display: none !important; }
  .mode-switcher { position: relative; top: auto; left: auto; grid-column: 2; width: min(220px, calc(100% - 16px)); justify-self: center; transform: none; }
  .mode-tab { font-size: 14px; }
  .page-wrapper { padding: .5rem .5rem calc(36px + env(safe-area-inset-bottom)); }
  .section-tabs { position: sticky; top: var(--appbar-h); z-index: 35; margin: -.5rem -.5rem 10px; padding: 0 2px; background: rgba(255,255,255,.98); overflow: visible; }
  .section-tab { min-width: 44px; min-height: 46px; flex: 0 0 44px; gap: 0; padding: 0; font-size: 12px; }
  .section-tab .material-icon { display: block; width: 19px; height: 19px; opacity: .76; }
  .section-tab > span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .section-tab.is-active { min-width: 78px; flex: 1 1 auto; gap: 6px; padding: 0 10px; }
  .section-tab.is-active > span { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: nowrap; }
  .section-tab.is-active .material-icon { opacity: 1; }
  .section-tab.is-active::after { right: 7px; left: 7px; }
  #fileTabs { justify-content: space-between; }
  .photo-section-tabs { display: flex; align-items: stretch; overflow: visible; }
  .photo-section-tabs > .section-tab[data-photo-tab] { width: auto; }
  .photo-section-tabs .photo-search-toggle { width: 44px; padding: 0; }
  .photo-section-tabs .photo-search-toggle span,
  .photo-section-tabs .photo-add-button span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .photo-section-tabs .photo-add-button { width: 44px; min-height: 46px; flex: 0 0 44px; margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; }
  .photo-section-tabs .photo-add-button:hover { background: var(--surface); }
  .photo-section-tabs .photo-add-button .material-icon { width: 19px; height: 19px; opacity: .82; }
  .photo-section-tabs .photo-empty-trash-button { min-height: 46px; margin: 0; padding: 0 10px; border-radius: 0; border-top: 0; border-right: 0; border-bottom: 1px solid var(--border); border-left: 0; }
  .photo-section-tabs .photo-empty-trash-button .material-icon { width: 18px; height: 18px; }
  .photo-section-tabs .photo-empty-trash-button span { font-size: 12px; }
  .section-tabs-spacer { display: none; }
  .content-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .content-title-wrap { width: 100%; }
  .file-path-row { gap: 4px; }
  .file-nav-button { width: 40px; height: 40px; }
  .breadcrumbs { min-height: 40px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
  .breadcrumbs::-webkit-scrollbar { display: none; }
  .toolbar { align-items: stretch; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
  .toolbar.photo-search-only { display: flex; }
  .search-box { order: 1; min-width: 0; min-height: 44px; flex: 1 1 calc(100% - 50px); padding-right: 8px; padding-left: 8px; }
  .photo-search-date-button { order: 2; width: 44px; min-width: 44px; min-height: 44px; justify-content: center; padding: 0; border-radius: 2px; }
  .photo-search-date-button span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .header-actions { order: 2; width: auto; flex-wrap: nowrap; gap: 0; }
  .header-actions #newFolderButton { display: none !important; }
  .header-actions #uploadButton { display: none !important; }
  .header-actions #moreAddButton { position: relative; width: 44px; height: 44px; padding: 0; border-radius: 2px; }
  .header-actions #moreAddButton span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .toolbar-actions { order: 4; width: 100%; gap: 4px; margin-left: 0; flex-wrap: wrap; }
  .toolbar-menu { min-width: 44px; flex: 0 0 44px; }
  .file-control-button { width: 44px; min-width: 44px; min-height: 44px; gap: 0; padding: 0; }
  .file-control-button span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
  .file-control-button .material-icon { width: 19px; height: 19px; }
  .view-toggle { margin-left: auto; }
  .toolbar-actions .icon-control, .view-toggle button { width: 44px; height: 44px; }
  .file-density-button { display: none !important; }
  .empty-trash-button { order: 3; width: 100%; min-height: 44px; }
  .photo-album-toolbar { justify-content: flex-start; }
  .photo-album-toolbar .secondary-button { min-height: 40px; }
  .photo-group-title { top: calc(var(--appbar-h) + 46px); }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin-right: -8px; margin-left: -8px; }
  #app[data-photo-density="compact"] .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #app[data-photo-density="dense"] .photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; }
  .photo-tile { border-radius: 0; }
  .item-select-photo { width: 28px; height: 28px; }
  .photo-tile-menu { width: 30px; height: 30px; }
  .photo-tile-video { display: grid; width: 25px; height: 25px; place-items: center; padding: 0; border-radius: 50%; }
  .photo-tile-video .material-icon { width: 14px; height: 14px; filter: invert(1); }
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .table-wrap { border: 0; }
  .file-table thead { display: none; }
  .col-type, .col-size, .col-date { display: none; }
  .file-table td { padding: 7px 4px; }
  .file-table tbody tr { border-bottom: 1px solid var(--border); }
  .file-table tbody tr:last-child { border-bottom: 0; }
  .file-table tbody tr td { border-bottom: 0; }
  .action-menu > button { width: 44px; height: 44px; }
  .item-select-table { width: 24px; height: 38px; flex-basis: 24px; }
  .selection-toolbar { position: fixed; top: auto; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); left: 8px; z-index: 95; align-items: center; flex-direction: row; padding: 7px 8px; }
  .selection-toolbar > strong { font-size: 12px; }
  .selection-actions { width: auto; min-width: 0; flex: 1; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 1px; }
  .selection-actions button { min-height: 40px; flex: 0 0 auto; white-space: nowrap; }
  .selection-actions .icon-control { width: 40px; height: 40px; }
  .transfer-panel { right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); left: 8px; width: auto; }
  .selection-active .transfer-panel { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 64px); }
  .transfer-panel-head { min-height: 48px; padding: 7px 9px; }
  .transfer-panel-icon { width: 26px; height: 26px; }
  .transfer-list { max-height: min(38vh, 280px); }
  .transfer-row { padding: 8px 9px 7px; }
  .transfer-percent { min-width: 26px; }
  .settings-page { padding-top: 26px; }
  .settings-signout, .advanced-settings-actions > button { min-height: 44px; }
  .empty-state { min-height: 200px; border-right: 0; border-left: 0; }
  .modal-backdrop { align-items: center; padding: 8px; }
  .modal { width: min(520px, 100%); max-height: calc(100dvh - 16px); border: 1px solid var(--border-strong); border-radius: 2px; }
  .modal-header { min-height: 48px; padding: 8px 10px 8px 14px; }
  .modal-header .icon-button { width: 40px; height: 40px; }
  .modal-actions { gap: 6px; padding: 8px; }
  .modal-actions > button { min-height: 44px; flex: 1; }
  .modal.modal-details { width: 100%; border-radius: 10px; }
  .modal-details .modal-body { padding: 16px; }
  .detail-list > div { grid-template-columns: 82px minmax(0, 1fr); gap: 10px; }
  .modal-backdrop.is-action-sheet { align-items: flex-end; padding: 0; background: rgba(0,0,0,.28); }
  .modal.modal-action-sheet { width: 100%; max-height: 76dvh; padding-bottom: env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.12); }
  .modal-action-sheet .modal-header { padding-right: 12px; padding-left: 16px; background: #fff; }
  .modal-action-sheet .modal-body { padding: 0 10px 8px; }
  .modal-action-sheet .modal-actions { display: none; }
  .action-sheet-button { min-height: 52px; padding-right: 12px; padding-left: 12px; font-size: 14px; }
  .viewer-arrow { display: none; }
  .viewer-filmstrip { justify-content: flex-start; padding-right: 10px; padding-left: 10px; }
  .photo-experience-tools { right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
  .photo-experience-button { min-height: 38px; }
  .photo-density-button { width: 38px; }
  .smart-collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .backup-center-tools { grid-template-columns: 1fr; }
  .toast-region { right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); left: 8px; width: auto; }
  .index-status.is-transient { top: calc(var(--appbar-h) + 54px); right: 8px; width: calc(100vw - 16px); }
}

@media (hover: none) {
  .item-select-photo { opacity: .28; }
  .item-select-photo.is-selected { opacity: 1; }
  .photo-tile-menu { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .photo-tile-placeholder, .photo-loading, .index-status-icon, .preview-loading::before { animation: none; }
  .mode-switcher::before { transition: none; }
  .toast-region { transition: none; }
}

@media (max-width: 390px) {
  .brand { min-width: 28px; width: 28px; }
  .topbar-account { min-width: 34px; }
  .mode-switcher { width: min(220px, calc(100% - 12px)); }
  .import-stats { grid-template-columns: 1fr; }
}


/* Visualizador PDF: fullscreen, barra mínima e páginas virtualizadas. */
.pdf-viewer { position: fixed; inset: 0; z-index: 175; display: grid; height: 100dvh; grid-template-rows: calc(52px + env(safe-area-inset-top)) minmax(0, 1fr); background: #5f6368; color: var(--text); }
.pdf-viewer-topbar { display: flex; min-width: 0; align-items: center; gap: 8px; padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); border-bottom: 1px solid var(--border); background: #fff; }
.pdf-viewer-title { min-width: 0; flex: 1; overflow: hidden; font-size: 14px; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.pdf-viewer-controls { display: flex; min-width: 0; flex: 0 0 auto; align-items: center; gap: 3px; }
.pdf-control-button, .pdf-zoom-value { min-width: 34px; height: 34px; padding: 0 7px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 18px; line-height: 1; }
.pdf-control-button:hover, .pdf-zoom-value:hover { background: var(--surface); }
.pdf-control-button:disabled, .pdf-zoom-value:disabled { opacity: .38; cursor: default; }
.pdf-zoom-value { min-width: 48px; font-size: 12px; font-weight: 650; }
.pdf-page-position { display: flex; height: 34px; align-items: center; gap: 2px; padding: 0 5px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.pdf-page-input { width: 38px; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; text-align: right; appearance: textfield; }
.pdf-page-input::-webkit-inner-spin-button, .pdf-page-input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.pdf-page-total { min-width: 30px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.pdf-control-separator { width: 1px; height: 20px; margin: 0 2px; background: var(--border); }
.pdf-viewer-close { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; padding: 0; border: 0; background: transparent; color: var(--text); }
.pdf-viewer-close:hover { background: var(--surface); }
.pdf-viewer-close .material-icon { width: 23px; height: 23px; }
.pdf-viewer-stage { position: relative; min-height: 0; overflow: auto; overflow-anchor: none; overscroll-behavior: contain; background: #5f6368; outline: none; scrollbar-gutter: stable; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
.pdf-pages { display: grid; width: min(100%, 1120px); margin: 0 auto; gap: 12px; padding: 12px; }
.pdf-page-shell { position: relative; width: 100%; overflow: hidden; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.22); }
.pdf-page-canvas { display: block; width: 100% !important; height: auto !important; background: #fff; }
.pdf-page-preview { display: block; width: 100%; height: auto; background: #fff; object-fit: contain; }
.pdf-viewer-loading, .pdf-viewer-fallback, .pdf-password-prompt { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 24px; color: #fff; text-align: center; }
.pdf-viewer-loading { font-size: 13px; }
.pdf-viewer-loading::before { content: ""; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: pdf-viewer-spin .75s linear infinite; }
@keyframes pdf-viewer-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pdf-viewer-loading::before { animation: none; border-color: rgba(255,255,255,.65); } }
.pdf-viewer-fallback span { max-width: 420px; }
.pdf-viewer-fallback .primary-button { min-width: 132px; }
.pdf-native-fallback { display: grid; min-height: 100%; grid-template-rows: auto minmax(0, 1fr); background: #5f6368; }
.pdf-native-fallback-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: #fff; color: var(--text); font-size: 12px; }
.pdf-native-fallback-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.pdf-native-fallback-actions .secondary-button { min-height: 34px; padding: 5px 9px; font-size: 12px; text-decoration: none; }
.pdf-native-frame { display: block; width: 100%; height: 100%; min-height: 0; border: 0; background: #fff; }
.pdf-password-prompt { z-index: 3; background: rgba(95,99,104,.96); }
.pdf-password-prompt strong, .pdf-password-prompt span { display: block; }
.pdf-password-prompt input { width: min(300px, calc(100vw - 48px)); min-height: 44px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.55); background: #fff; color: #111; font: inherit; }
.pdf-password-prompt .primary-button { min-width: 120px; }

@media (max-width: 760px) {
  .pdf-viewer { grid-template-rows: calc(50px + env(safe-area-inset-top)) minmax(0, 1fr); }
  .pdf-viewer-topbar { gap: 3px; padding-left: max(6px, env(safe-area-inset-left)); }
  .pdf-viewer-title { display: none; }
  .pdf-viewer-controls { flex: 1; justify-content: center; gap: 1px; }
  .pdf-control-button { min-width: 31px; width: 31px; height: 34px; padding: 0; }
  .pdf-zoom-value { min-width: 42px; height: 34px; padding: 0 3px; font-size: 11px; }
  .pdf-page-position { height: 32px; padding: 0 3px; }
  .pdf-page-input { width: 32px; font-size: 11px; }
  .pdf-page-total { min-width: 28px; font-size: 11px; }
  .pdf-control-separator { margin: 0 1px; }
  .pdf-viewer-close { width: 40px; height: 40px; flex-basis: 40px; }
  .pdf-pages { gap: 7px; padding: 7px; }
  .pdf-page-shell { box-shadow: 0 1px 2px rgba(0,0,0,.2); }
  .pdf-native-fallback-note { align-items: stretch; flex-direction: column; }
  .pdf-native-fallback-actions { width: 100%; }
  .pdf-native-fallback-actions > * { flex: 1; justify-content: center; }
}


.lightweight-viewer { position: fixed; inset: 0; z-index: 170; display: grid; height: 100dvh; grid-template-rows: calc(52px + env(safe-area-inset-top)) minmax(0, 1fr); background: #fff; color: var(--text); }
.lightweight-viewer-topbar { display: flex; min-width: 0; align-items: center; gap: 8px; padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); border-bottom: 1px solid var(--border); background: #fff; }
.lightweight-viewer-title { min-width: 0; flex: 1; overflow: hidden; font-size: 14px; font-weight: 650; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.lightweight-viewer-close { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; padding: 0; border: 0; background: transparent; color: var(--text); }
.lightweight-viewer-close:hover { background: var(--surface); }
.lightweight-viewer-close .material-icon { width: 23px; height: 23px; }
.lightweight-viewer-stage { position: relative; min-height: 0; overflow: auto; overscroll-behavior: contain; background: #fff; outline: none; -webkit-overflow-scrolling: touch; }
.lightweight-viewer-loading, .lightweight-viewer-fallback, .lightweight-empty { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 10px; padding: 24px; color: var(--muted); text-align: center; }
.lightweight-viewer-loading::before { width: 24px; height: 24px; background: url("/icons/material/sync.svg") center / contain no-repeat; opacity: .7; animation: spin 1.1s linear infinite; content: ""; }
.lightweight-viewer-fallback span { max-width: 440px; }
.lightweight-audio-wrap { display: grid; min-height: 100%; place-items: center; padding: 24px; background: var(--surface); }
.lightweight-audio { width: min(680px, 100%); }
.lightweight-text { box-sizing: border-box; width: min(1100px, 100%); min-height: 100%; margin: 0 auto; padding: 18px clamp(14px, 3vw, 34px) max(28px, env(safe-area-inset-bottom)); background: #fff; color: var(--text); font: 13px/1.58 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; tab-size: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
.lightweight-table-wrap { box-sizing: border-box; min-width: 100%; min-height: 100%; padding-bottom: max(20px, env(safe-area-inset-bottom)); overflow: auto; background: #fff; }
.lightweight-table { border-collapse: collapse; width: max-content; min-width: 100%; font-size: 12px; line-height: 1.45; }
.lightweight-table td { max-width: 360px; padding: 7px 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.lightweight-preview-note { position: sticky; top: 0; z-index: 1; padding: 6px 10px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.96); color: var(--muted); font-size: 11px; }
@media (max-width: 760px) {
  .lightweight-viewer { grid-template-rows: calc(50px + env(safe-area-inset-top)) minmax(0, 1fr); }
  .lightweight-viewer-topbar { padding-left: max(12px, env(safe-area-inset-left)); }
  .lightweight-viewer-title { font-size: 13px; }
  .lightweight-text { font-size: 12px; line-height: 1.55; }
  .lightweight-table td { max-width: 260px; padding: 6px 8px; }
}
