/* Workspace — styles */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8ebf0;
  --border: #e1e4ea;
  --border-strong: #c9ced8;
  --text: #1d2129;
  --text-2: #545d6b;
  --text-3: #868e9b;
  --accent: #2f6fed;
  --accent-hover: #2560d6;
  --accent-weak: #e7efff;
  --accent-text: #ffffff;
  --danger: #d0362a;
  --danger-weak: #fdecea;
  --ok: #1f8f4e;
  --warn-weak: #fff6dc;
  --warn-text: #7a5a00;
  --doc: #3b7ded;
  --sheet: #1f9d55;
  --folder: #f2b134;
  --pdf: #e5483f;
  --image: #9b5de5;
  --video: #d6336c;
  --audio: #f08c00;
  --code: #495466;
  --sel: rgba(47, 111, 237, 0.11);
  --sel-strong: rgba(47, 111, 237, 0.2);
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-2: 0 4px 10px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .06);
  --shadow-3: 0 16px 40px rgba(16, 24, 40, .18), 0 4px 10px rgba(16, 24, 40, .08);
  --radius: 10px;
  --radius-sm: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --page-bg: #eef0f3;
  --page: #ffffff;
  --page-text: #1d2129;
  --grid-line: #e3e6eb;
  --grid-head: #f5f6f8;
  --grid-head-sel: #dfe8fb;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171b; --surface: #1d2025; --surface-2: #252930; --surface-3: #2e333b; --border: #30353e;
    --border-strong: #444b56; --text: #e7e9ee; --text-2: #aab1bd; --text-3: #7b8391; --accent: #6b9bff;
    --accent-hover: #86adff; --accent-weak: #22304d; --accent-text: #0d1424; --danger: #ff7b6e; --danger-weak: #3a1f1d;
    --ok: #5fd08f; --warn-weak: #3a3117; --warn-text: #f3d27a; --sel: rgba(107, 155, 255, .16);
    --sel-strong: rgba(107, 155, 255, .28); --page-bg: #111317; --page: #1d2025; --page-text: #e7e9ee;
    --grid-line: #2f343c; --grid-head: #22262c; --grid-head-sel: #2a3a5c; --folder: #e7ab3a;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 4px 12px rgba(0, 0, 0, .45);
    --shadow-3: 0 18px 44px rgba(0, 0, 0, .6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171b; --surface: #1d2025; --surface-2: #252930; --surface-3: #2e333b; --border: #30353e;
  --border-strong: #444b56; --text: #e7e9ee; --text-2: #aab1bd; --text-3: #7b8391; --accent: #6b9bff;
  --accent-hover: #86adff; --accent-weak: #22304d; --accent-text: #0d1424; --danger: #ff7b6e; --danger-weak: #3a1f1d;
  --ok: #5fd08f; --warn-weak: #3a3117; --warn-text: #f3d27a; --sel: rgba(107, 155, 255, .16);
  --sel-strong: rgba(107, 155, 255, .28); --page-bg: #111317; --page: #1d2025; --page-text: #e7e9ee;
  --grid-line: #2f343c; --grid-head: #22262c; --grid-head-sel: #2a3a5c; --folder: #e7ab3a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 4px 12px rgba(0, 0, 0, .45);
  --shadow-3: 0 18px 44px rgba(0, 0, 0, .6); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
#app { height: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--sel-strong); }
svg.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 16px; height: 16px; }
svg.icon.lg { width: 24px; height: 24px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.hidden { display: none !important; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }

.boot-loading { height: 100%; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3);
  border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-weak); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.active, .icon-btn[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent); }
.icon-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.input, .select, textarea.input {
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); width: 100%; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--sel); }
.select { padding-right: 28px; cursor: pointer; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
label.field .hint { font-weight: 400; color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.blue { background: var(--accent-weak); color: var(--accent); }
.badge.green { background: color-mix(in srgb, var(--sheet) 14%, transparent); color: var(--ok); }
.badge.red { background: var(--danger-weak); color: var(--danger); }
.badge.amber { background: var(--warn-weak); color: var(--warn-text); }
kbd { font: 11.5px var(--mono); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text-2); }

/* ---------------------------------------------------------------- app shell (drive / settings) */
.shell { display: grid; grid-template-columns: 256px 1fr; grid-template-rows: 64px 1fr; height: 100%; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; width: 232px; flex: none; padding-left: 6px; color: var(--text);
  font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; flex: none; }
.brand-mark i { border-radius: 3.5px; }
.brand-mark i:nth-child(1) { background: var(--doc); }
.brand-mark i:nth-child(2) { background: var(--sheet); }
.brand-mark i:nth-child(3) { background: var(--folder); }
.brand-mark i:nth-child(4) { background: var(--pdf); }
.search { flex: 1; min-width: 0; max-width: 720px; overflow: hidden; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 8px 0 14px;
  background: var(--surface-2); border-radius: 999px; border: 1px solid transparent; transition: background .12s, box-shadow .12s; }
.search:focus-within { background: var(--surface); box-shadow: var(--shadow-2); border-color: var(--border); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 15px; min-width: 0; }
.search .icon { color: var(--text-2); }
.search:has(input:placeholder-shown) .icon-btn { display: none; }   /* (nothing to clear yet: room for the text on phones) */
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: 13px; user-select: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-btn { border: 0; background: transparent; padding: 4px; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover { background: var(--surface-2); }
.menu-toggle { display: none; }

.sidebar { display: flex; flex-direction: column; padding: 4px 12px 16px 8px; overflow-y: auto; min-height: 0; }
.new-btn { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 22px 0 16px; margin: 4px 0 16px;
  border-radius: 16px; border: 0; background: var(--surface); box-shadow: var(--shadow-2); font-weight: 600;
  font-size: 14.5px; cursor: pointer; align-self: flex-start; transition: box-shadow .15s, background .15s; }
.new-btn:hover { box-shadow: var(--shadow-3); background: var(--surface-2); }
.new-btn .icon { width: 24px; height: 24px; stroke-width: 2.2; }
.nav-item { display: flex; align-items: center; gap: 14px; height: 36px; padding: 0 14px; border-radius: 999px;
  color: var(--text); font-weight: 500; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-3); text-decoration: none; }
.nav-item.active { background: var(--accent-weak); color: var(--accent); font-weight: 650; }
.nav-item .icon { color: var(--text-2); }
.nav-item.active .icon { color: var(--accent); }
.nav-item.drop-target { outline: 2px solid var(--accent); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 8px; }
.storage { margin-top: auto; padding: 14px 14px 0; font-size: 12.5px; color: var(--text-2); }
/* the storage meter (drive.js storageMeter): a "Storage" row like the nav, an always-visible bar, "X of Y used" */
.storage-meter { margin: 0 -14px; }
.storage-meter .storage-link { font-size: 14px; }
.storage-icon { display: inline-flex; color: var(--text-2); }
.storage-body { padding: 2px 14px 0; }
.storage-meter .usage { height: 6px; margin: 2px 0 6px; }
.storage-text { color: var(--text); font-size: 12.5px; }
.storage-meter.warn .storage-text { color: var(--folder); font-weight: 600; }
.storage-meter.danger .storage-text { color: var(--danger); font-weight: 600; }
.storage-mine { margin-top: 2px; font-size: 12px; }
.fab { display: none; }
.main { background: var(--surface); border-radius: 16px 0 0 0; min-width: 0; min-height: 0; display: flex;
  flex-direction: column; overflow: hidden; margin-right: 0; }
.scrim { display: none; }

/* ---------------------------------------------------------------- drive */
.drive-view { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.drive-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px 10px 24px; min-height: 64px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; font-size: 22px; }
.crumb { padding: 4px 10px; border-radius: 999px; color: var(--text); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 260px; cursor: pointer; border: 0; background: transparent; font-size: inherit;
  flex: 0 1 auto; min-width: 0; }
.crumb:hover { background: var(--surface-2); text-decoration: none; }
.crumb-text { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb.current { font-weight: 500; cursor: default; display: inline-flex; align-items: center; gap: 4px; max-width: 420px; }
.crumb.current .icon { flex: none; }
.crumb.current.has-menu { cursor: pointer; }
.crumb.more-crumb { flex: none; color: var(--text-2); }
.crumb.drop-target { outline: 2px solid var(--accent); background: var(--accent-weak); }
.crumbs .sep { color: var(--text-3); flex: none; display: inline-flex; }
.drive-tools { flex: none; }
.sort-btn { color: var(--text-2); }
.sort-btn:hover { color: var(--text); background: var(--surface-2); }
.selection-bar { display: flex; align-items: center; gap: 4px; height: 44px; margin: 0 20px 8px 20px; padding: 0 8px 0 4px;
  background: var(--surface-2); border-radius: 999px; overflow-x: auto; overflow-y: hidden; flex: none; }
.selection-bar .icon-btn { flex: none; }
/* while files are ticked the selection bar covers the filter chips (same place, so the list doesn't move) */
.list-bar { position: relative; flex: none; }
.list-bar.over .filter-chips { visibility: hidden; }
.list-bar.over .selection-bar { position: absolute; top: 0; left: 20px; right: 20px; height: 36px; margin: 0; z-index: 2; }
/* filter chips (Type, People, Modified) */
.filter-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 20px 10px 24px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; max-width: 260px; padding: 0 10px 0 12px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13.5px;
  font-weight: 500; cursor: pointer; }
.chip:hover { background: var(--surface-2); }
.chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-group { display: inline-flex; align-items: center; border-radius: 8px; background: var(--accent-weak); max-width: 300px; }
.chip-group .chip { border-color: transparent; background: transparent; color: var(--accent); font-weight: 600; padding-right: 2px; min-width: 0; }
.chip-group .chip-x { color: var(--accent); width: 28px; height: 28px; margin-right: 2px; }
.chip-clear { height: 32px; }
.chip-pop { min-width: 260px; max-width: 320px; }
.chip-pop .input { margin: 4px 10px 6px; width: calc(100% - 20px); }
.chip-people { max-height: 320px; overflow-y: auto; }
.chip-people .menu-item .avatar { flex: none; }
.chip-people .menu-item .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.date-range { display: flex; gap: 12px; flex-wrap: wrap; }
.date-range .field { flex: 1; min-width: 160px; }
.skipped-list { margin: 0; padding-left: 20px; }
.skipped-list li { margin: 4px 0; overflow-wrap: anywhere; }
/* the Storage page */
.storage-summary { padding: 0 24px 4px; max-width: 620px; flex: none; }
.storage-summary .storage-meter { margin: 0; }
.storage-summary .storage-link { display: none; }
.storage-summary .storage-body { padding: 0; }
.storage-summary .storage-text { font-size: 15px; font-weight: 600; }
.storage-more { margin: 12px 8px 0; font-size: 12.5px; }
.storage-summary p { margin: 6px 0; font-size: 13px; }
.selection-bar .count { font-weight: 600; margin: 0 10px 0 4px; }
.files-wrap { flex: 1; overflow: auto; padding: 0 20px 80px 20px; position: relative; min-height: 0; }
.file-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.file-table th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 600;
  color: var(--text-2); font-size: 13px; height: 44px; padding: 0 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none; }
.file-table th.sortable { cursor: pointer; }
.file-table th.sortable:hover { color: var(--text); }
.file-table th .icon { width: 15px; height: 15px; vertical-align: -3px; margin-left: 4px; }
.file-table th .sort-hint { opacity: 0; transition: opacity .12s; }
.file-table th.sortable:hover .sort-hint { opacity: .45; }
.file-table th.sorted { color: var(--text); }
.col-check { width: 44px; padding: 0 !important; text-align: center !important; }
.file-table td.check-cell { padding: 0; text-align: center; cursor: pointer; }
.row-check { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--accent); vertical-align: middle; }
.file-table td.check-cell .row-check { opacity: 0; }
.file-table tr.file-row:hover .row-check, .file-table tr.file-row.selected .row-check, .has-selection .file-table .row-check,
.file-table .row-check:focus-visible { opacity: 1; }
.file-table tr.group-row td { height: 38px; padding-top: 12px; font-weight: 600; color: var(--text-2); font-size: 13px;
  border-bottom: 0; }
.file-table td { height: 48px; padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--text-2); font-size: 13.5px; }
.file-table tr.file-row { cursor: default; user-select: none; }
.file-table tr.file-row:hover td { background: var(--surface-2); }
.file-table tr.file-row.selected td { background: var(--accent-weak); }
.file-table tr.file-row.drop-target td { background: var(--sel-strong); }
.file-table tr.file-row.drop-refused td { background: var(--danger-weak); cursor: no-drop; }
.file-table td.name-cell { color: var(--text); font-weight: 500; }
.name-inner { display: flex; align-items: center; gap: 14px; min-width: 0; }
.name-inner .name { overflow: hidden; text-overflow: ellipsis; }
.name-inner .star { color: var(--folder); }
.col-name { width: auto; }
.col-owner { width: 170px; }
.col-modified { width: 190px; }
.col-size { width: 110px; }
.col-more { width: 56px; }
.owner-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.owner-cell .avatar { flex: none; }
.owner-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftype { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 6px; color: #fff; }
.ftype .icon { width: 16px; height: 16px; stroke-width: 2.1; }
.ftype.lg { width: 56px; height: 56px; border-radius: 14px; }
.ftype.lg .icon { width: 30px; height: 30px; stroke-width: 1.9; }
.ftype.folder { background: transparent; color: var(--folder); }
.ftype.folder .icon { width: 24px; height: 24px; fill: var(--folder); stroke: var(--folder); stroke-width: 1.5; }
.ftype.lg.folder .icon { width: 48px; height: 48px; }
.ftype.doc { background: var(--doc); }
.ftype.sheet { background: var(--sheet); }
.ftype.pdf { background: var(--pdf); }
.ftype.image { background: var(--image); }
.ftype.video { background: var(--video); }
.ftype.audio { background: var(--audio); }
.ftype.code { background: var(--code); }
.ftype.other { background: #7d8695; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; padding-top: 8px; }
.grid-section { font-weight: 600; color: var(--text-2); margin: 14px 2px 4px; grid-column: 1 / -1; font-size: 13.5px; }
.card { border-radius: 12px; background: var(--surface-2); padding: 0; cursor: default; user-select: none; overflow: hidden;
  border: 1px solid transparent; display: flex; flex-direction: column; }
.card:hover { background: var(--surface-3); }
.card.selected { background: var(--accent-weak); border-color: var(--accent); }
.card.drop-target { border-color: var(--accent); background: var(--sel-strong); }
.card.drop-refused { border-color: var(--danger); background: var(--danger-weak); cursor: no-drop; }
.card .card-title { display: flex; align-items: center; gap: 10px; padding: 12px 6px 12px 14px; font-weight: 500;
  min-width: 0; }
.card .card-title .name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card .thumb { margin: 0 8px 8px; border-radius: 8px; background: var(--surface); height: 140px; display: grid;
  place-items: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card.folder-card { flex-direction: row; align-items: center; }
.card.folder-card .card-title { flex: 1; min-width: 0; }
/* a card's checkbox: on hover, once anything is selected, and always on touch screens */
.card-check { display: none; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; margin: -4px 0; }
.card:hover .card-check, .card.selected .card-check, .has-selection .card-check { display: inline-flex; }
.card:hover .card-check + .ftype, .card.selected .card-check + .ftype, .has-selection .card-check + .ftype { display: none; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 70px 20px;
  color: var(--text-2); }
.empty .art { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-3); margin-bottom: 8px; }
.empty .art .icon { width: 52px; height: 52px; stroke-width: 1.4; }
.empty h3 { margin: 0; font-size: 18px; color: var(--text); font-weight: 600; }
.drop-overlay { position: absolute; inset: 6px; border: 2px dashed var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 7%, transparent); display: none; place-items: center; z-index: 5;
  pointer-events: none; }
.drop-overlay.show { display: grid; }
.drop-overlay.refused { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, transparent); }
.drop-overlay.refused .pill { background: var(--danger); color: #fff; }
.drop-overlay .pill { background: var(--accent); color: var(--accent-text); padding: 10px 20px; border-radius: 999px;
  font-weight: 600; box-shadow: var(--shadow-2); }

/* ---------------------------------------------------------------- menus, dialogs, toasts */
.menu { position: fixed; z-index: 1000; min-width: 220px; max-width: 320px; padding: 6px 0; background: var(--surface);
  border-radius: 10px; box-shadow: var(--shadow-3); border: 1px solid var(--border); max-height: 80vh; overflow-y: auto; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 16px; border: 0;
  background: transparent; text-align: left; cursor: pointer; color: var(--text); font-size: 13.5px; white-space: nowrap; }
.menu-item:hover, .menu-item:focus { background: var(--surface-2); outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-item:disabled { opacity: .45; cursor: default; background: transparent; }
.menu-item .icon { color: var(--text-2); width: 18px; height: 18px; }
.menu-item.danger .icon { color: var(--danger); }
.menu-item .shortcut { margin-left: auto; color: var(--text-3); font-size: 12px; padding-left: 16px; }
.menu-item .check-mark { width: 18px; display: inline-flex; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-label { padding: 6px 16px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); z-index: 900; display: grid;
  place-items: center; padding: 16px; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-3); display: flex; flex-direction: column; animation: pop .14s ease-out; }
.modal.wide { max-width: 640px; }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 20px 24px 8px; }
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 8px 24px 8px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; }
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 14px; min-width: 280px; max-width: 520px; padding: 12px 12px 12px 18px;
  border-radius: 8px; background: #2b2f36; color: #f1f3f6; box-shadow: var(--shadow-3); font-size: 13.5px;
  animation: pop .15s ease-out; }
.toast.error { background: #6e1b14; }
.toast .btn.ghost { color: #9dbcff; height: 30px; }
.toast .btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.toast .icon-btn { color: #c9ced8; width: 28px; height: 28px; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.uploads { position: fixed; right: 24px; bottom: 0; width: 360px; z-index: 950; background: var(--surface);
  border-radius: 12px 12px 0 0; box-shadow: var(--shadow-3); border: 1px solid var(--border); overflow: hidden; }
.uploads-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 18px; background: var(--surface-2);
  font-weight: 600; }
.uploads-list { max-height: 260px; overflow-y: auto; }
.upload-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--border); }
.upload-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s; }
.ok-text { color: var(--ok); }
.err-text { color: var(--danger); }

/* share dialog */
.share-add { display: flex; gap: 8px; }
.share-list { margin-top: 18px; display: flex; flex-direction: column; gap: 4px; }
.share-person { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.share-person .who { flex: 1; min-width: 0; }
.share-person .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-person .who span { font-size: 12.5px; color: var(--text-2); }
.share-person .select { width: auto; height: 34px; }
.section-title { font-weight: 600; font-size: 14px; margin: 18px 0 6px; }

/* folder picker */
.picker { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.picker-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--surface-2); min-height: 44px;
  flex-wrap: wrap; }
.picker-list { height: 280px; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px; cursor: pointer; }
.picker-item .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-head .crumb { max-width: 200px; font-size: 13.5px; }
.picker-item:hover { background: var(--surface-2); }
.picker-item.disabled { opacity: .45; cursor: default; }

/* preview */
.preview { position: fixed; inset: 0; z-index: 800; background: rgba(8, 10, 14, .9); display: flex; flex-direction: column;
  color: #eef0f3; }
.preview-head { display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 16px; flex: none; }
.preview-head .title { font-size: 16px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.preview-head .icon-btn { color: #dfe3ea; }
.preview-head .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.preview-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 24px 24px; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 100%; border-radius: 4px; }
.preview-body iframe { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.preview-body pre { width: min(1000px, 100%); height: 100%; margin: 0; overflow: auto; background: var(--surface);
  color: var(--text); padding: 20px; border-radius: 8px; font: 13px/1.5 var(--mono); white-space: pre-wrap; }
.preview-none { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* ---------------------------------------------------------------- editors (shared header) */
.editor { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.editor-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px 4px 12px; background: var(--bg); flex: none; }
.editor-logo { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; flex: none; }
.editor-logo:hover { background: var(--surface-3); text-decoration: none; }
.editor-title-wrap { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.editor-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.title-input { font-size: 18px; font-weight: 500; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px;
  background: transparent; outline: none; min-width: 60px; max-width: 100%; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; }
.title-input:focus { text-overflow: clip; }
.title-input:hover { border-color: var(--border-strong); }
.title-input:focus { border-color: var(--accent); background: var(--surface); }
.title-input[readonly] { border-color: transparent; }
.menubar { display: flex; gap: 0; margin-left: 2px; flex-wrap: wrap; }
.menubar button { border: 0; background: transparent; padding: 2px 8px; border-radius: 4px; font-size: 13.5px; cursor: pointer;
  color: var(--text); }
.menubar button:hover, .menubar button.open { background: var(--surface-3); }
.save-state { font-size: 12.5px; color: var(--text-2); margin-left: 4px; white-space: nowrap; display: inline-flex;
  align-items: center; gap: 4px; }
.save-state.error { color: var(--danger); }
.editor-head .actions { display: flex; align-items: center; gap: 8px; }
.toolbar { display: flex; align-items: center; gap: 2px; margin: 4px 12px 8px; padding: 4px 8px; background: var(--surface-2);
  border-radius: 999px; flex: none; overflow-x: auto; scrollbar-width: none; min-height: 40px; }
.toolbar::-webkit-scrollbar { display: none; }
.toolbar .icon-btn { width: 32px; height: 32px; border-radius: 6px; color: var(--text); }
.toolbar .icon-btn svg.icon { width: 18px; height: 18px; }
.toolbar .icon-btn:hover { background: var(--surface-3); }
.toolbar .icon-btn.active, .toolbar .icon-btn[aria-pressed="true"] { background: var(--accent-weak); color: var(--accent); }
.toolbar .sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 6px; flex: none; }
.toolbar .select { height: 30px; width: auto; border-radius: 6px; padding: 0 26px 0 8px; border-color: transparent;
  background-color: transparent; font-size: 13.5px; }
.toolbar .select:hover { background-color: var(--surface-3); }
.color-btn { position: relative; }
.color-btn .swatch { position: absolute; left: 7px; right: 7px; bottom: 5px; height: 3px; border-radius: 2px; }
.color-pop { display: grid; grid-template-columns: repeat(8, 22px); gap: 6px; padding: 12px; }
.color-pop button { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); cursor: pointer; padding: 0; }
.color-pop button:hover { transform: scale(1.15); }
.color-pop .reset { grid-column: 1 / -1; width: auto; height: 30px; border-radius: 6px; background: transparent;
  border: 1px solid var(--border-strong); color: var(--text); font-size: 13px; }
.banner { display: flex; align-items: center; gap: 12px; margin: 0 12px 8px; padding: 10px 14px; border-radius: 10px;
  background: var(--warn-weak); color: var(--warn-text); font-size: 13.5px; flex: none; }
.banner.info { background: var(--accent-weak); color: var(--accent); }
.banner .grow { min-width: 0; }

/* ---------------------------------------------------------------- docs */
.doc-scroll { flex: 1; overflow: auto; background: var(--page-bg); padding: 24px 16px 120px; min-height: 0; }
.doc-page { width: 816px; max-width: 100%; min-height: 1056px; margin: 0 auto; background: var(--page);
  color: var(--page-text); box-shadow: var(--shadow-1); border: 1px solid var(--border); padding: 96px;
  font: 11pt/1.5 Arial, "Segoe UI", sans-serif; outline: none; white-space: pre-wrap; overflow-wrap: break-word;
  word-break: normal; tab-size: 4; caret-color: var(--accent); }
.doc-page:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.doc-page p { margin: 0 0 4pt; min-height: 1.5em; }
.doc-page h1, .doc-page h2, .doc-page h3, .doc-page h4, .doc-page h5, .doc-page h6 { font-weight: 400; margin: 14pt 0 6pt; line-height: 1.3; }
.doc-page h1 { font-size: 20pt; }
.doc-page h2 { font-size: 16pt; }
.doc-page h3 { font-size: 14pt; color: #434343; }
.doc-page h4 { font-size: 12pt; color: #666; }
.doc-page h5, .doc-page h6 { font-size: 11pt; color: #666; }
:root[data-theme="dark"] .doc-page h3, :root[data-theme="dark"] .doc-page h4 { color: var(--text-2); }
.doc-page p[data-style="title"] { font-size: 26pt; line-height: 1.2; margin: 0 0 3pt; }
.doc-page p[data-style="subtitle"] { font-size: 15pt; color: #666; margin: 0 0 16pt; }
.doc-page ul, .doc-page ol { margin: 0 0 4pt; padding-left: 36px; }
.doc-page li { margin: 0 0 2pt; padding-left: 4px; }
.doc-page ul ul { list-style-type: circle; }
.doc-page ul ul ul { list-style-type: square; }
.doc-page ol ol { list-style-type: lower-alpha; }
.doc-page ol ol ol { list-style-type: lower-roman; }
.doc-page a { color: #1155cc; text-decoration: underline; cursor: text; }
:root[data-theme="dark"] .doc-page a { color: #8ab4ff; }
.doc-page code, .doc-page font[face*="mono"] { font-family: var(--mono); font-size: .93em; background: var(--surface-2);
  border-radius: 3px; padding: 0 2px; }
.doc-page[contenteditable="false"] { caret-color: transparent; }
.doc-foot { position: fixed; left: 16px; bottom: 14px; font-size: 12.5px; color: var(--text-2); background: var(--surface);
  padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow-1); border: 1px solid var(--border); }
.link-tip { position: fixed; z-index: 600; display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-2);
  font-size: 13px; max-width: 420px; }
.link-tip a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }

/* ---------------------------------------------------------------- sheets */
.formula-bar { display: flex; align-items: stretch; margin: 0 12px; height: 32px; flex: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px 8px 0 0; border-bottom: 0; overflow: hidden; }
.name-box { width: 90px; flex: none; border: 0; border-right: 1px solid var(--border); background: transparent; padding: 0 10px;
  outline: none; font-size: 13px; }
.name-box:focus { background: var(--surface-2); }
.fx { display: grid; place-items: center; width: 34px; color: var(--text-3); font: italic 600 14px Georgia, serif;
  border-right: 1px solid var(--border); flex: none; }
.formula-input { flex: 1; border: 0; outline: none; padding: 0 10px; background: transparent; font-size: 13px; min-width: 0;
  font-family: var(--font); }
.sheet-area { flex: 1; min-height: 0; margin: 0 12px; display: grid; grid-template-columns: 46px 1fr; grid-template-rows: 24px 1fr;
  background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; user-select: none; }
.sheet-area:focus { outline: none; }
.corner { background: var(--grid-head); border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong);
  cursor: pointer; }
.col-heads, .row-heads { position: relative; overflow: hidden; background: var(--grid-head); }
.col-heads { border-bottom: 1px solid var(--border-strong); }
.row-heads { border-right: 1px solid var(--border-strong); }
.col-heads-inner, .row-heads-inner { position: absolute; top: 0; left: 0; will-change: transform; }
.ch, .rh { position: absolute; display: flex; align-items: center; justify-content: center; font-size: 11.5px;
  color: var(--text-2); cursor: pointer; }
.ch { top: 0; height: 24px; border-right: 1px solid var(--grid-line); }
.rh { left: 0; width: 45px; border-bottom: 1px solid var(--grid-line); }
.ch.sel, .rh.sel { background: var(--grid-head-sel); color: var(--accent); font-weight: 700; }
.ch.full, .rh.full { background: var(--accent); color: var(--accent-text); }
.col-resize { position: absolute; top: 0; width: 7px; height: 24px; cursor: col-resize; z-index: 2; margin-left: -4px; }
.col-resize:hover, .col-resize.drag { background: var(--accent); opacity: .6; }
.grid-scroll { position: relative; overflow: auto; background: var(--surface); }
.grid-scroll:focus { outline: none; }
.grid-sizer { position: relative; }
.cells { position: absolute; top: 0; left: 0; }
.c { position: absolute; height: 24px; padding: 0 4px; border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line);
  font-size: 13px; line-height: 23px; white-space: pre; overflow: hidden; text-overflow: clip; color: var(--text);
  font-family: Arial, var(--font); }
.c.n { text-align: right; }
.c.b { text-align: center; }
.c.e { color: var(--danger); }
.c.ovf { overflow: visible; z-index: 1; border-right-color: transparent; }
.c.ovf-bg { background: var(--surface); }
.grid-lines { position: absolute; inset: 0; pointer-events: none; }
.sel-box { position: absolute; border: 1px solid var(--accent); background: var(--sel); pointer-events: none; z-index: 3; }
.active-box { position: absolute; border: 2px solid var(--accent); pointer-events: none; z-index: 4; }
.copy-box { position: absolute; border: 2px dashed var(--accent); pointer-events: none; z-index: 4; }
.fill-handle { position: absolute; width: 8px; height: 8px; background: var(--accent); border: 1px solid var(--surface);
  z-index: 5; cursor: crosshair; }
.fill-box { position: absolute; border: 1px dashed var(--text-2); pointer-events: none; z-index: 4; }
.cell-editor { position: absolute; z-index: 6; min-height: 24px; padding: 0 4px; border: 2px solid var(--accent);
  background: var(--surface); outline: none; font: 13px/20px Arial, var(--font); resize: none; overflow: hidden;
  box-shadow: var(--shadow-2); white-space: pre; color: var(--text); }
.add-rows { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 13px; position: absolute; left: 0; }
.sheet-tabs { display: flex; align-items: center; gap: 2px; height: 40px; margin: 0 12px 8px; padding: 0 6px; flex: none;
  background: var(--surface-2); border-radius: 0 0 8px 8px; border: 1px solid var(--border); border-top: 0; overflow-x: auto; }
.sheet-tab { height: 32px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  font-weight: 500; white-space: nowrap; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.sheet-tab:hover { background: var(--surface-3); color: var(--text); }
.sheet-tab.active { background: var(--surface); color: var(--sheet); box-shadow: var(--shadow-1); font-weight: 650; }
.sheet-tab input { width: 120px; height: 24px; border: 1px solid var(--accent); border-radius: 4px; padding: 0 6px; outline: none;
  background: var(--surface); }
.sheet-stats { margin-left: auto; padding: 0 10px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.suggest { position: absolute; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-3); min-width: 240px; max-height: 240px; overflow-y: auto; padding: 4px 0; }
.suggest div { padding: 6px 12px; cursor: pointer; font-size: 13px; }
.suggest div b { font-family: var(--mono); font-weight: 600; }
.suggest div span { color: var(--text-3); font-size: 12px; margin-left: 8px; }
.suggest div.on, .suggest div:hover { background: var(--accent-weak); }

/* ---------------------------------------------------------------- auth */
.auth { height: 100%; overflow: auto; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 36px 36px 28px;
  box-shadow: var(--shadow-2); border: 1px solid var(--border); }
.auth-card h1 { font-size: 24px; margin: 18px 0 4px; font-weight: 600; letter-spacing: -.01em; }
.auth-card p.lead { margin: 0 0 22px; color: var(--text-2); }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn.primary { height: 42px; margin-top: 6px; }
.auth-error { background: var(--danger-weak); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.auth-foot { margin-top: 18px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---------------------------------------------------------------- settings / developer pages */
.page-scroll { flex: 1; overflow: auto; padding: 8px 28px 80px; min-height: 0; }
.page-inner { max-width: 920px; }
.page-title { font-size: 22px; font-weight: 500; margin: 18px 0 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 12px 0 22px; overflow-x: auto; }
.tab { height: 44px; padding: 0 16px; border: 0; background: transparent; cursor: pointer; font-weight: 600; color: var(--text-2);
  border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; margin-bottom: 18px; background: var(--surface); }
.panel h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.panel > p { margin: 0 0 14px; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: end; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; color: var(--text-2); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13.5px; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.secret { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-radius: 10px; background: var(--surface-2);
  font: 13px var(--mono); word-break: break-all; }
.secret code { flex: 1; }
pre.code { background: #11151c; color: #dfe6f1; padding: 14px 48px 14px 16px; border-radius: 10px; overflow-x: auto;
  font: 12.5px/1.55 var(--mono); margin: 8px 0 0; position: relative; white-space: pre; }
pre.code .copy { position: absolute; top: 8px; right: 8px; color: #aab4c4; }
pre.code .copy:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.endpoint { display: grid; grid-template-columns: 74px 1fr; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--border);
  align-items: baseline; }
.endpoint:first-of-type { border-top: 0; }
.endpoint .method { font: 700 11.5px var(--mono); padding: 3px 0; border-radius: 4px; text-align: center; }
.method.GET { background: #e3f4ea; color: #17733f; }
.method.POST { background: #e6eeff; color: #2551c4; }
.method.PUT { background: #fff2dc; color: #8a5a00; }
.method.PATCH { background: #f2e8ff; color: #6a35c2; }
.method.DELETE { background: #fde9e7; color: #b42318; }
:root[data-theme="dark"] .method { filter: brightness(.85) saturate(1.2); }
.endpoint .path { font: 13px var(--mono); word-break: break-all; }
.endpoint .desc { grid-column: 2; color: var(--text-2); font-size: 13px; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: center; }
.activity-item:first-child { border-top: 0; }
.activity-item .what { flex: 1; min-width: 0; }
.activity-item .when { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.side-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 360px; max-width: 100%; z-index: 700; background: var(--surface);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column; animation: slide .16s ease-out; }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }
.side-panel .head { display: flex; align-items: center; gap: 8px; padding: 16px 12px 12px 20px; border-bottom: 1px solid var(--border); }
.side-panel .head h3 { margin: 0; flex: 1; font-size: 16px; font-weight: 600; }
.side-panel .body { flex: 1; overflow-y: auto; padding: 8px 20px 20px; }
.version { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.version .info { flex: 1; min-width: 0; }
.version .info b { display: block; font-weight: 600; font-size: 13.5px; }
.version .info span { color: var(--text-2); font-size: 12.5px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .doc-page a { color: #8ab4ff; }
  :root:not([data-theme="light"]) .doc-page h3, :root:not([data-theme="light"]) .doc-page h4,
  :root:not([data-theme="light"]) .doc-page p[data-style="subtitle"] { color: var(--text-2); }
  :root:not([data-theme="light"]) .method { filter: brightness(.85) saturate(1.2); }
}
:root[data-theme="dark"] .doc-page p[data-style="subtitle"] { color: var(--text-2); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .brand { width: auto; }
  .brand span { display: none; }
  .menu-toggle { display: inline-flex; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 280px; z-index: 500; background: var(--bg);
    box-shadow: var(--shadow-3); transform: translateX(-105%); transition: transform .18s ease; padding-top: 16px; }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, .35); }
  .main { border-radius: 0; grid-column: 1; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: 22px; z-index: 300; width: 56px; height: 56px;
    border-radius: 16px; border: 0; background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow-3); cursor: pointer; }
  .fab .icon { width: 26px; height: 26px; stroke-width: 2.2; }
  .shell[data-active="chat"] .fab { display: none; }
  .col-owner, .col-size, td.owner-col, td.size-col { display: none; }
  .filter-chips { padding: 0 12px 8px; gap: 6px; }
  .chip, .chip-group { max-width: 200px; }
  .sort-btn .sort-label { display: none; }
  .selection-bar { margin: 0 8px 8px; }
  .list-bar.over .selection-bar { left: 8px; right: 8px; }
  .storage-summary { padding: 0 12px 4px; }
  .col-modified { width: 120px; }
  .drive-head { padding: 10px 12px; }
  .files-wrap { padding: 0 8px 80px; }
  .crumbs { font-size: 18px; }
  .page-scroll { padding: 8px 16px 80px; }
  .doc-page { padding: 48px 28px; min-height: 70vh; }
  .doc-scroll { padding: 12px 8px 100px; }
  /* the editors' menus (Docs and Sheets) on a row of their own that scrolls sideways: hidden, a phone had no File,
     Edit, Format or Extensions at all; and the title is cut short rather than running under the buttons */
  .editor-head { flex-wrap: wrap; row-gap: 2px; }
  .editor-title-wrap { display: contents; }
  .editor-title-row { flex: 1; min-width: 0; overflow: hidden; }
  .menubar { flex-wrap: nowrap; order: 10; flex: 0 0 100%; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .menubar button { flex: none; }
  .editor-head .actions .btn span { display: none; }
  .uploads { right: 0; width: 100%; }
  .toasts { left: 12px; right: 12px; }
  .toast { min-width: 0; }
  .sheet-area { margin: 0 4px; }
  .formula-bar, .sheet-tabs { margin-left: 4px; margin-right: 4px; }
  .toolbar { margin-left: 4px; margin-right: 4px; }
}
@media (max-width: 520px) {
  .editor-head .save-state:not(.error) { display: none; }   /* (no room: a save that fails still shows) */
  .editor-head .actions .head-extra { display: none; }   /* (bot use and version history: in the File menu) */
  .editor-head .actions { margin-left: auto; }
  /* "Offline — will sync" or a failed save: the title and the state get a line of their own, under the buttons
     (beside them the state was hidden behind the Share button) */
  .editor-head:has(.save-state.error) .editor-title-row { order: 5; flex: 0 0 100%; }
  .search { height: 40px; }
  .col-modified { width: 104px; }
  .mod-by { display: none; }   /* (who changed it last is in the tooltip and the file's details: the name needs the room) */
  .topbar { gap: 6px; padding: 0 8px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .auth-card { padding: 28px 22px 22px; }
}

/* touch screens (no hover): checkboxes always shown, with room for a finger */
@media (hover: none) {
  .file-table td.check-cell .row-check { opacity: 1; }
  .row-check { width: 20px; height: 20px; }
  .col-check { width: 48px; }
  .card-check { display: inline-flex; width: 32px; height: 32px; }
  .card-check + .ftype { display: none; }
}

/* the owner turned off printing for viewers and commenters: Print buttons go, and a print shows nothing */
.editor-head.no-downloads ~ .toolbar [title^="Print ("] { display: none; }

/* ---------------------------------------------------------------- print */
@media print {
  body:has(.editor-head.no-downloads) #app { display: none !important; }
  body { overflow: visible; background: #fff; }
  .editor-head, .toolbar, .banner, .doc-foot, .toasts, .link-tip { display: none !important; }
  .editor, .doc-scroll { display: block; height: auto; overflow: visible; background: #fff; padding: 0; }
  .doc-page { box-shadow: none; border: 0; padding: 0; width: auto; min-height: 0; color: #000; background: #fff; }
}
