/* Office Online — modern light Office UI. No external fonts / assets. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
:root {
  --app: #2b579a;          /* Word blue (brand accent) */
  --app-dark: #1e3f73;
  --app-weak: #eaf0f9;
  --app-weak-2: #d6e3f5;
  --accent: #2b579a;
  --chrome: #f7f7f8;
  --line: #e3e3e5;
  --ink: #242424;
  --muted: #616161;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --hover: #f2f2f2;
  --sel: #2b579a;
  --shadow-1: 0 1px 2px rgba(0,0,0,.06);
  --shadow-2: 0 8px 24px rgba(0,0,0,.14);
  --titlebar-h: 40px;
  --ribbon-tabs-h: 36px;
  --ribbon-panel-h: 66px;
}
.mode-excel { --app: #217346; --app-dark: #165534; --app-weak: #e8f3ec; --app-weak-2: #d2e7d9; --accent: #217346; --sel: #107c41; }
body {
  font-family: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Calibri, Arial, sans-serif;
  font-size: 13px; color: var(--ink); background: #f5f5f5; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
#app { height: 100vh; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- generic buttons (dashboard / dialogs) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid #d9d9d9; background: #fff; color: #2b2f36; border-radius: 6px;
  padding: 7px 13px; font-size: 13px; cursor: pointer; white-space: nowrap; line-height: 1;
}
.btn:hover { background: #f5f5f5; border-color: #c6c6c6; }
.btn.primary { background: var(--app); border-color: var(--app); color: #fff; }
.btn.primary:hover { background: var(--app-dark); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.danger { color: #c0392b; border-color: #e6c3bf; }
.btn.danger:hover { background: #fbecea; }
.link { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* ---------- dashboard ---------- */
#dashboard { overflow: auto; background: #f5f5f5; color: var(--ink); }
#dashboard :is(button, a, input, select, summary):focus-visible,
.doc-dialog :is(button, input):focus-visible { outline: 2px solid var(--app); outline-offset: 2px; }
.dash-top { flex: none; background: var(--surface-2); color: var(--ink); border-bottom: 1px solid var(--line); }
.dash-top-inner, .dash-body { width: 100%; max-width: 1280px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.dash-top-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--app); color: #fff; font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.brand h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .1px; color: var(--ink); }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dash-help { flex: none; min-height: 36px; border: 1px solid #d9d9d9; background: #fff; color: #3a3a3a; border-radius: 8px; padding: 8px 14px; font: inherit; font-size: 12.5px; cursor: pointer; }
.dash-top-right { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
.dash-help:hover { background: var(--hover); border-color: #c6c6c6; }
.dash-body { padding-top: 32px; padding-bottom: 40px; }
.dash-eyebrow { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.dash-intro h2 { font-size: 28px; font-weight: 600; letter-spacing: -.4px; line-height: 1.4; margin: 0 0 8px; }
.dash-description { color: var(--muted); line-height: 1.7; margin: 0 0 24px; }
.dash-starts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dash-start { display: flex; align-items: center; gap: 15px; width: 100%; min-width: 0; min-height: 106px; padding: 22px; text-align: left; font: inherit; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.03); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.dash-start:hover { border-color: #c6c6c6; box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.dash-start.excel:hover { border-color: #6b9b80; }
.dash-start.ppt:hover { border-color: #d24726; }
.dash-start:disabled { opacity: .6; cursor: progress; }
.start-icon { width: 42px; height: 48px; display: flex; align-items: center; justify-content: center; flex: none; position: relative; color: #fff; font-size: 24px; font-weight: 700; }
.import .start-icon { background: #edf2f8; border-radius: 4px; color: #476382; font-size: 22px; }
.import .start-icon svg { width: 20px; height: 20px; }

/* File-type badge: page silhouette + folded corner (see typeBadge() in app.js). */
.type-badge { position: relative; }
.type-badge .type-badge-shape { position: absolute; inset: 0; width: 100%; height: 100%; }
.type-badge .type-badge-tx { position: relative; line-height: 1; }
.start-copy { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.start-title { font-size: 16px; font-weight: 600; }
.start-description { color: var(--muted); font-size: 12px; line-height: 1.5; }
.start-arrow { margin-left: auto; color: #8a8a8a; font-size: 19px; }
.dash-notice { min-height: 20px; margin: 8px 0 18px; color: var(--app); font-size: 12px; }
.recent-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.recent-title { display: flex; align-items: center; gap: 10px; }
.recent-title h2 { margin: 0; font-size: 20px; font-weight: 600; white-space: nowrap; }
.doc-total { background: #efefef; border-radius: 12px; padding: 2px 9px; font-size: 12px; color: #5f5f5f; }
.doc-search-wrap { display: flex; align-items: center; position: relative; width: 290px; max-width: 100%; }
.search-symbol { position: absolute; left: 12px; color: #61728a; font-size: 23px; pointer-events: none; }
#doc-search { width: 100%; height: 40px; padding: 8px 12px 8px 36px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #d9d9d9; border-radius: 8px; }
#doc-search::placeholder { color: #8a8a8a; }
.doc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.doc-filters { display: flex; align-items: center; gap: 4px; padding: 4px; background: #efefef; border-radius: 8px; }
.doc-filter { min-height: 34px; padding: 6px 15px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #5f5f5f; font: inherit; cursor: pointer; white-space: nowrap; }
.doc-filter:hover { color: var(--ink); background: #f7f7f7; }
.doc-filter[aria-pressed=true] { border-color: #e0e0e0; background: #fff; color: var(--app); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.doc-sort { display: flex; align-items: center; gap: 8px; color: #627087; font-size: 12px; white-space: nowrap; }
#doc-sort { min-height: 36px; padding: 6px 26px 6px 10px; border: 1px solid #d9d9d9; border-radius: 6px; background: #fff; font: inherit; color: #444; }
.doc-results { margin: 12px 0 16px; min-height: 18px; font-size: 12px; color: #627087; }
.doc-list-head, .doc-card { display: grid; grid-template-columns: minmax(0, 1fr) 180px 128px; gap: 24px; align-items: center; padding: 0 22px; }
.doc-list-head { font-size: 12px; color: var(--muted); padding-top: 0; padding-bottom: 10px; }
.doc-list-head > :last-child { text-align: right; padding-right: 20px; }
.doc-grid { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.doc-card { position: relative; min-height: 84px; border-bottom: 1px solid #efefef; }
.doc-card:first-child { border-radius: 10px 10px 0 0; }
.doc-card:last-child { border-bottom: 0; border-radius: 0 0 10px 10px; }
.doc-card:hover, .doc-card:focus-within { background: #fafafa; }
.doc-open { display: flex; gap: 14px; align-items: center; min-width: 0; padding: 16px 0; text-decoration: none; color: inherit; }
.doc-open:hover .doc-name { color: var(--app); text-decoration: underline; text-underline-offset: 3px; }
.doc-icon { width: 34px; height: 40px; color: #fff; font-weight: 700; font-size: 19px; display: flex; align-items: center; justify-content: center; flex: none; position: relative; }
.doc-info { display: block; flex: 1; min-width: 0; }
.doc-name { display: block; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.6; }
.doc-kind { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.doc-meta { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-ops { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.doc-open-btn { min-height: 34px; padding: 8px 16px; text-decoration: none; color: var(--app); border-color: #d9d9d9; background: #fff; }
.doc-more { position: relative; }
.doc-more summary { display: flex; justify-content: center; align-items: center; width: 34px; height: 34px; list-style: none; border: 1px solid transparent; border-radius: 4px; color: #50627a; font-size: 24px; line-height: 1; cursor: pointer; }
.doc-more summary::-webkit-details-marker { display: none; }
.doc-more summary:hover, .doc-more[open] summary { background: var(--hover); border-color: #e5e5e5; color: var(--app); }
.doc-actions { position: absolute; right: 0; top: 40px; min-width: 168px; background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; padding: 4px; box-shadow: var(--shadow-2); z-index: 50; }
.doc-actions button, .doc-actions a { display: block; width: 100%; min-height: 34px; text-align: left; padding: 8px 12px; border: 0; border-radius: 4px; background: #fff; font: inherit; text-decoration: none; color: #35465e; cursor: pointer; }
.doc-actions button:hover, .doc-actions a:hover { background: var(--hover); color: var(--app); }
.doc-actions-label { display: block; font-size: 11px; color: #68778c; border-top: 1px solid #e9edf3; margin-top: 4px; padding: 9px 12px 3px; }
.doc-actions .doc-delete { color: #b22f25; border-top: 1px solid #e9edf3; border-radius: 0; margin-top: 4px; }
.doc-actions .doc-delete:hover { background: #fdf0ee; color: #a9251b; }
.doc-state { padding: 42px 20px; text-align: center; color: var(--muted); }
.doc-state strong { display: block; font-weight: 600; font-size: 16px; color: var(--ink); }
.doc-state p { line-height: 1.7; margin: 8px 0 18px; overflow-wrap: anywhere; }
.empty-symbol { display: block; color: #8a8a8a; font-size: 30px; margin-bottom: 10px; }
.dash-foot { margin-top: 30px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; gap: 10px; border-top: 1px solid #e5e5e5; padding-top: 20px; padding-bottom: 110px; }
.doc-dialog { border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.doc-dialog::backdrop { background: rgba(0,0,0,.32); }
.doc-dialog-description { color: #627087; line-height: 1.8; margin: 10px 0 20px; overflow-wrap: anywhere; }
.doc-rename-label { display: block; font-size: 12px; margin-bottom: 8px; }
#doc-rename { width: 100%; min-height: 42px; font: inherit; border: 1px solid #bccbdf; border-radius: 4px; padding: 9px 12px; }
.doc-dialog-error { color: #b22f25; font-size: 12px; line-height: 1.6; }
.doc-dialog .modal-actions { margin-top: 22px; }
.doc-dialog .btn { min-height: 36px; }
.doc-dialog .btn:disabled { opacity: .6; cursor: progress; }
@media (max-width: 1000px) {
  .dash-top-inner, .dash-body { padding-left: 28px; padding-right: 28px; }
  .dash-start { gap: 12px; padding: 18px 15px; }
  .start-arrow { display: none; }
  .start-description { font-size: 11px; }
  .doc-list-head, .doc-card { grid-template-columns: minmax(0, 1fr) 142px 116px; gap: 16px; padding-left: 18px; padding-right: 18px; }
  .doc-ops { gap: 8px; }
}
@media (max-width: 680px) {
  .dash-top-inner, .dash-body { padding-left: 20px; padding-right: 20px; }
  .dash-top-inner { padding-top: 16px; padding-bottom: 16px; gap: 12px; }
  .brand { gap: 10px; min-width: 0; }
  .brand-mark { width: 34px; height: 38px; font-size: 23px; }
  .brand h1 { font-size: 17px; white-space: nowrap; }
  .brand p { display: none; }
  /* The name + role badge squeeze the header to three lines on a phone. */
  .user-name, .user-role { display: none; }
  .dash-help { padding: 7px 10px; font-size: 12px; }
  .dash-body { padding-top: 26px; }
  .dash-intro h2 { font-size: 25px; }
  .dash-starts { grid-template-columns: 1fr; gap: 10px; }
  .dash-start { min-height: 82px; padding: 16px 18px; gap: 16px; }
  .start-icon { width: 36px; height: 42px; font-size: 22px; }
  .start-description { font-size: 12px; }
  .start-arrow { display: block; }
  .dash-notice { margin-bottom: 12px; }
  .recent-heading { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 14px; }
  .doc-search-wrap { width: 100%; }
  .doc-toolbar { flex-wrap: wrap; gap: 12px; }
  .doc-filters { flex: 1 1 100%; flex-wrap: wrap; }
  .doc-filter { padding: 6px 12px; }
  .doc-sort { margin-left: auto; }
  .doc-list-head { display: none; }
  .doc-card { grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 14px; }
  .doc-open { grid-column: 1; padding: 0; gap: 10px; }
  .doc-meta { grid-column: 1; grid-row: 2; padding-left: 44px; padding-top: 6px; font-size: 11px; }
  .doc-ops { grid-column: 2; grid-row: 1 / 3; gap: 3px; }
  .doc-open-btn { padding: 8px 10px; font-size: 12px; }
  .doc-name { font-size: 13px; }
  .doc-actions { min-width: 172px; }
  .doc-actions button, .doc-actions a { min-height: 42px; }
  .dash-foot { margin-top: 24px; flex-direction: column; align-items: flex-start; font-size: 11px; }
}
@media (max-width: 360px) {
  .dash-top-inner, .dash-body { padding-left: 14px; padding-right: 14px; }
  .doc-card { padding: 12px; }
  .doc-open-btn { display: none; }
  .doc-filter { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .dash-start, .toast { transition: none; }
}

/* ---------- application title bar ---------- */
.office-titlebar { flex: none; height: var(--titlebar-h); background: var(--surface-2); color: var(--ink); display: flex; align-items: center; padding: 0 8px; gap: 4px; user-select: none; border-bottom: 1px solid var(--line); position: relative; z-index: 30; }
.qat { display: flex; align-items: center; gap: 1px; }
.qat-btn { width: 28px; height: 28px; border: none; background: transparent; color: #444; border-radius: 4px; font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; }
.qat-btn:hover { background: #ebebeb; }
.qat-btn:disabled { opacity: .35; cursor: default; }
.qat-btn svg { width: 15px; height: 15px; }
.qat-sep { width: 1px; height: 18px; background: #dcdcdc; margin: 0 4px; }
.title-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; max-width: 46%; }
.tb-app-icon { width: 24px; height: 24px; border-radius: 6px; background: var(--app); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(0,0,0,.16); }
.doc-title { border: 1px solid transparent; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; padding: 4px 8px; border-radius: 4px; width: 230px; text-align: center; }
.doc-title:hover, .doc-title:focus { border-color: #d4d4d4; outline: none; background: #fff; }
.doc-app-name { font-size: 12px; color: var(--muted); white-space: nowrap; }
.title-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.save-status { color: var(--muted); font-size: 11px; min-width: 64px; text-align: right; }
.save-status[data-state="save-failed"] { color: #c42b1c; }
.presence { display: flex; align-items: center; gap: 5px; }
.avatars { display: flex; }
.avatar { width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface-2); margin-left: -6px; }
.avatar:first-child { margin-left: 0; }
.presence-count { font-size: 11px; color: var(--muted); white-space: nowrap; }
.conn { font-size: 11px; white-space: nowrap; color: #107c10; }
.conn.bad { color: #c42b1c; } .conn.mid { color: #9a6700; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: 32px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: var(--shadow-2); z-index: 80; min-width: 190px; padding: 4px; overflow: hidden; }
.menu-item { padding: 8px 12px; font-size: 12.5px; color: var(--ink); border-radius: 4px; cursor: pointer; }
.menu-item:hover { background: var(--hover); }

/* ---------- Ribbon ---------- */
.ribbon { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.03); z-index: 20; }
.ribbon-tabs { height: var(--ribbon-tabs-h); background: var(--surface); display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid #efefef; user-select: none; }
.rb-tab { padding: 0 12px; height: 28px; display: flex; align-items: center; font-size: 12.5px; color: #424242; cursor: pointer; border: 1px solid transparent; border-radius: 14px; position: relative; }
.rb-tab:hover { background: var(--hover); }
.rb-tab.active { background: var(--app-weak); border-color: transparent; color: var(--app); font-weight: 600; height: 28px; }
.rb-tab.active::after { display: none; }
.rb-keytip { position: absolute; top: -7px; left: 4px; background: #fff; color: var(--ink); border: 1px solid #b8b8b8; border-radius: 3px; font-size: 9px; font-weight: 700; line-height: 12px; min-width: 14px; text-align: center; padding: 0 2px; box-shadow: 0 1px 2px rgba(0,0,0,.14); z-index: 5; }
.rb-tab-file .rb-keytip { top: -7px; left: 4px; }
.rb-tab.rb-contextual { color: #a4371a; background: #fbeee9; }
.rb-tab.rb-contextual.active { color: #a4371a; background: #f5d9cf; }
.rb-tab.rb-contextual.active::after { display: none; }
.rb-tab-file, .rb-tab.rb-file { background: var(--app); color: #fff; font-weight: 600; height: 28px; border-radius: 14px; margin-right: 6px; padding: 0 16px; }
.rb-tab-file:hover, .rb-tab.rb-file:hover { background: var(--app-dark); }
.rb-collapse { margin-left: auto; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #666; cursor: pointer; border-radius: 4px; }
.rb-collapse:hover { background: var(--hover); }
.ribbon-panel { min-height: var(--ribbon-panel-h); display: flex; align-items: stretch; padding: 5px 8px; overflow-x: auto; overflow-y: hidden; transition: min-height .12s; scrollbar-width: thin; }
.ribbon-panel.collapsed { min-height: 0; height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden; }
.rb-panel { display: none; flex: none; align-items: stretch; }
.rb-panel.active { display: flex; }
.rb-group { position: relative; display: flex; flex-direction: row; align-items: center; justify-content: center; padding: 0; min-width: 0; }
.rb-group-body { display: flex; align-items: center; gap: 1px; min-height: 56px; flex: 1; }
.rb-group-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.rb-sep { width: 1px; align-self: center; height: 34px; background: #e6e6e6; margin: 0 10px; flex: none; }

/* ribbon buttons */
.tb-btn.rb-btn { border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.tb-btn.rb-btn:hover { background: var(--hover); border-color: transparent; }
.tb-btn.rb-btn.active { background: var(--app-weak); border-color: var(--app-weak-2); color: var(--app); }
.tb-btn.rb-btn:disabled { opacity: .35; cursor: default; background: transparent; border-color: transparent; }
.rb-big { flex-direction: column; width: 64px; height: 50px; gap: 1px; padding: 3px 2px 2px; }
.rb-big .rb-ic { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.rb-small { flex-direction: row; height: 20px; min-width: 24px; padding: 0 5px; gap: 5px; }
.rb-small .rb-ic { width: 15px; height: 15px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.rb-svg { width: 100%; height: 100%; }
.rb-glyph { font-size: 13px; font-weight: 700; line-height: 1; }
.rb-tx { font-size: 11px; white-space: nowrap; line-height: 1; }
.rb-big .rb-tx { font-size: 11px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62px; }
.rb-stack { display: flex; flex-direction: column; gap: 1px; justify-content: center; }
.rb-stack .rb-small { height: 18px; }
.rb-stack > .rb-big { flex-direction: row; width: auto; height: 20px; gap: 5px; padding: 0 6px; justify-content: flex-start; }
.rb-stack > .rb-big .rb-ic { width: 15px; height: 15px; }
.rb-stack > .rb-big .rb-tx { max-width: none; text-align: left; }
.rb-row { display: flex; align-items: center; gap: 2px; }
.rb-row .rb-field { flex: none; }
.rb-inline-label { font-size: 11px; color: var(--muted); padding: 0 3px; }
.rb-caret { font-size: 9px; color: #777; margin-left: 2px; }

/* ribbon fields & selects */
.rb-field { display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.rb-field-label, .rb-select-wrap { font-size: 10px; color: var(--muted); }
.rb-select, select.tb-sel { height: 24px; border: 1px solid #d7d7d7; border-radius: 4px; background: #fff; color: var(--ink); font-size: 12px; padding: 0 4px; max-width: 150px; }
.rb-input { height: 24px; border: 1px solid #d7d7d7; border-radius: 4px; font-size: 12px; padding: 0 6px; background: #fff; }
.rb-input:focus, .rb-select:focus { outline: none; border-color: var(--app); box-shadow: 0 0 0 1px var(--app); }
.rb-color { position: relative; }
.rb-colorbtn { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-direction: row; height: 18px; min-width: 24px; padding: 0 5px; gap: 5px; border: 1px solid transparent; border-radius: 4px; color: var(--ink); cursor: pointer; }
.rb-colorbtn:hover { background: var(--hover); }
.rb-colorbtn input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.rb-colorbar { position: absolute; left: 4px; right: 4px; bottom: 1px; height: 3px; border-radius: 1px; }
.rb-dropdown { position: relative; }
.rb-dropbtn .rb-caret { display: inline; }

/* ribbon popup menus (fixed positioning via JS using viewport coords) */
.rb-menu { position: fixed; background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; box-shadow: var(--shadow-2); z-index: 300; padding: 4px; min-width: 170px; max-height: 340px; overflow: auto; }
.rb-menu-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 4px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.rb-menu-item:hover { background: var(--hover); }
.rb-menu-item.checked { color: var(--app); font-weight: 600; }
.rb-mi-ic { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; }
.rb-mi-ic svg { width: 14px; height: 14px; }
.rb-menu-divider { height: 1px; background: #ededed; margin: 4px 2px; }

/* style gallery */
.rb-gallery-wrap { display: flex; align-items: center; height: 54px; }
.rb-gallery { display: flex; gap: 4px; overflow: hidden; max-width: 250px; height: 52px; padding: 2px; border: 1px solid #e5e5e5; border-radius: 6px; }
.rb-tile { width: 62px; height: 46px; flex: none; border: 1px solid #e0e0e0; border-radius: 4px; cursor: pointer; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.rb-tile:hover { border-color: var(--app); box-shadow: 0 0 0 1px var(--app); }
.rb-tile-prev { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink); overflow: hidden; white-space: nowrap; }
.rb-tile-label { font-size: 9px; text-align: center; color: var(--muted); background: #fafafa; border-top: 1px solid #f0f0f0; padding: 1px 0; }
.rb-gal-btns { display: flex; flex-direction: column; margin-left: 2px; }
.rb-gal-btns .rb-small { height: 18px; padding: 0 3px; }

/* ---------- Backstage (File menu) ---------- */
.backstage { position: absolute; inset: var(--titlebar-h) 0 0 0; background: #fff; z-index: 70; display: flex; }
.backstage-rail { width: 190px; background: var(--app); color: #fff; padding: 14px 0; flex: none; }
.bs-back { padding: 8px 20px 16px; font-size: 22px; cursor: pointer; }
.bs-back:hover { opacity: .8; }
.bs-rail-item { padding: 10px 22px; font-size: 13px; cursor: pointer; opacity: .9; }
.bs-rail-item:hover { background: rgba(255,255,255,.12); }
.bs-rail-item.active { background: rgba(255,255,255,.2); font-weight: 600; }
.bs-content { flex: 1; padding: 30px 40px; overflow: auto; }
.bs-content h2 { font-size: 22px; font-weight: 600; margin: 0 0 20px; color: var(--ink); }
.bs-tiles { display: flex; gap: 16px; flex-wrap: wrap; }
.bs-tile { width: 150px; border: 1px solid #e3e3e3; border-radius: 8px; padding: 16px; text-align: center; cursor: pointer; background: #fff; }
.bs-tile:hover { border-color: var(--app); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.bs-tile-ic { font-size: 30px; color: var(--app); margin-bottom: 10px; }
.bs-tile-label { font-size: 13px; font-weight: 600; color: #333; }
.bs-tile-sub { font-size: 11px; color: #888; margin-top: 4px; }
.bs-info-row { display: flex; gap: 30px; margin-bottom: 16px; font-size: 13px; }
.bs-info-row b { color: #666; font-weight: 600; min-width: 80px; display: inline-block; }
.bs-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; margin: 0 8px 10px 0; border: 1px solid var(--app); color: var(--app); background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
.bs-btn:hover { background: #eef4fc; }
.bs-list { list-style: none; padding: 0; margin: 0; }
.bs-list li { padding: 8px 10px; border-bottom: 1px solid #efefef; display: flex; justify-content: space-between; align-items: center; }
.bs-list li:hover { background: #f7f9fc; }

/* ---------- editor area ---------- */
.editor-scroll { flex: 1; min-height: 0; overflow: auto; background: #f3f2f1; position: relative; }
.editor-content { min-height: 100%; }
.statusbar { flex: none; height: 28px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 58px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 11px; color: #5f5f5f; user-select: none; }
.status-msg { white-space: nowrap; }
.status-stats { white-space: nowrap; color: var(--app); }
.status-spacer { flex: 1; }
.status-lang { white-space: nowrap; }
.status-views, .status-zoom { display: flex; align-items: center; gap: 2px; }
.status-view, .status-zoom-btn { border: none; background: transparent; color: #5f5f5f; cursor: pointer; font-size: 13px; width: 24px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.status-view:hover, .status-zoom-btn:hover { background: #eaeaea; }
.status-view.active { color: var(--app); }
.status-zoom input[type=range] { width: 90px; height: 3px; accent-color: var(--app); }
.status-zoom-label { min-width: 36px; text-align: right; }

/* ---------- Word editor ---------- */
.wo-editor-content { position: relative; padding: 28px 0 64px; display: flex; flex-direction: column; align-items: center; }
/* Stack of INDEPENDENT page canvases (true multi-page, Office 1:1). */
.wo-page-stack { position: relative; display: flex; flex-direction: column; align-items: center; }
.wo-page { position: relative; background: #fff; margin: 0; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06); counter-reset: olnum; transform-origin: top center; box-sizing: border-box; }
/* Real inter-page gutter (a flow element between two sheets), with page label. */
.wo-page-guide { position: relative; height: 22px; margin: 0; border-top: 1px dashed #9aa4b2; border-bottom: 1px solid #cfd6e0; background: linear-gradient(#eef1f5, #e7eaef); display: flex; align-items: center; justify-content: center; }
.wo-page-guide-label { position: static; font-size: 10px; color: #7a828e; background: #fff; padding: 0 5px; border: 1px solid #d9dde3; border-radius: 8px; line-height: 14px; }
.wo-block.type-pagebreak { margin: 10px -1px; height: 10px; border-top: 1px dashed #9aa4b2; background: linear-gradient(#eef1f5, #f6f8fa); text-align: center; }
.wo-pagebreak-label { position: relative; top: -8px; background: #fff; border: 1px solid #d9dde3; border-radius: 8px; padding: 0 7px; font-size: 10px; color: #7a828e; }
.wo-block { position: relative; margin: 0 0 .55em; }
.wo-editable { outline: none; min-height: 1.4em; white-space: pre-wrap; word-break: break-word; }
.wo-block.type-h1 { font-size: 2em; font-weight: 700; margin: .5em 0 .3em; }
.wo-block.type-h2 { font-size: 1.5em; font-weight: 700; margin: .5em 0 .3em; }
.wo-block.type-h3 { font-size: 1.17em; font-weight: 700; margin: .5em 0 .3em; }
.wo-block.type-quote { border-left: 3px solid #c9d3e0; padding-left: 14px; color: #5b6472; font-style: italic; }
.wo-block.type-li { padding-left: 1.6em; margin: 0 0 .25em; }
.wo-block.type-li::before { position: absolute; left: .35em; color: #333; }
.wo-block.type-li[data-list="ul"]::before { content: '•'; }
.wo-block.type-li[data-list="ol"]::before { counter-increment: olnum; content: counter(olnum) '.'; }
.wo-table-wrap { margin: 12px 0; }
.wo-table { border-collapse: collapse; width: 100%; }
.wo-cell { border: 1px solid #b9bec6; padding: 4px 7px; min-width: 46px; vertical-align: top; }
.wo-cell-edit { outline: none; min-height: 1.2em; white-space: pre-wrap; }
.wo-caret-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.wo-remote-caret { position: absolute; width: 2px; pointer-events: none; }
.wo-remote-label { position: absolute; top: -16px; left: 0; font-size: 10px; color: #fff; padding: 1px 5px; border-radius: 3px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.wo-remote-sel { position: absolute; pointer-events: none; }
.wo-preview .wo-editable { cursor: default; }
.wo-show-marks .wo-block::after { content: '¶'; color: #b9c2cf; font-size: .8em; margin-left: 2px; }
.wo-ruler { height: 20px; background: #fff; border-bottom: 1px solid #d6d9dd; margin: 0 auto 8px; position: relative; background-image: repeating-linear-gradient(90deg, #bbb 0 1px, transparent 1px 10px); background-size: 100% 6px; background-repeat: no-repeat; background-position: 0 12px; }
.wo-cols-2 .wo-page, .wo-cols-3 .wo-page { column-gap: 28px; }
.wo-cols-2 .wo-page { column-count: 2; }
.wo-cols-3 .wo-page { column-count: 3; }

/* navigation pane */
.wo-nav { position: absolute; top: 0; left: 0; width: 220px; max-height: 100%; overflow: auto; background: #fff; border-right: 1px solid #c9ccd1; box-shadow: 2px 0 8px rgba(0,0,0,.08); z-index: 25; padding: 8px 0; }
.wo-nav-head { font-size: 12px; font-weight: 600; color: #555; padding: 4px 12px 8px; border-bottom: 1px solid #eee; margin-bottom: 4px; }
.wo-nav-item { padding: 5px 12px; font-size: 12px; color: #333; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-nav-item:hover { background: #eaf1fb; color: var(--app); }
.wo-nav-item.lvl-h2 { padding-left: 24px; } .wo-nav-item.lvl-h3 { padding-left: 36px; }
.wo-nav-empty { padding: 10px 12px; font-size: 11px; color: #999; }
.wo-nav-open .wo-page-stack { margin-left: 220px; }

/* Word 1:1 interactions: cross-block selection, drag & drop, block pull */
.wo-xsel { position: absolute; background: rgba(46,120,220,.22); pointer-events: none; z-index: 4; }
.wo-vsel { position: absolute; background: rgba(217,145,0,.28); pointer-events: none; z-index: 5; }
.wo-shape-active { outline: 2px solid #1e88e5; outline-offset: 2px; }
.wo-grip { position: absolute; left: -22px; top: 2px; width: 18px; height: 18px; line-height: 18px; text-align: center; font-size: 13px; color: #9aa4b2; cursor: grab; opacity: 0; transition: opacity .1s; user-select: none; }
.wo-block { position: relative; }
.wo-block:hover > .wo-grip { opacity: 1; }
.wo-grip:active { cursor: grabbing; }
.wo-block.drop-before::before { content: ''; position: absolute; left: 0; right: 0; top: -3px; height: 2px; background: var(--app); z-index: 5; }
.wo-block.drop-after::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 2px; background: var(--app); z-index: 5; }
.wo-drag-ghost { position: fixed; z-index: 999; background: #fff; border: 1px solid #b9c6d8; border-radius: 3px; padding: 4px 10px; font-size: 12px; color: #333; box-shadow: 0 4px 14px rgba(0,0,0,.2); pointer-events: none; max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wo-editable[draggable="true"] { cursor: grab; }

/* floating mini toolbar */
.wo-mini { position: absolute; display: flex; align-items: center; gap: 2px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: var(--shadow-2); padding: 4px 5px; z-index: 30; }
.wo-mini-btn { width: 26px; height: 24px; border: 1px solid transparent; background: transparent; cursor: pointer; border-radius: 4px; font-size: 13px; }
.wo-mini-btn:hover { background: var(--hover); border-color: transparent; }
.wo-mini-sel { height: 22px; border: 1px solid #c6ccd4; border-radius: 2px; font-size: 11px; }
.wo-mini-color { width: 24px; height: 22px; border: 1px solid #c6ccd4; border-radius: 2px; background: #fff; }

/* font dialog preview */
.font-preview { flex: 1; border: 1px solid #d6d9dd; border-radius: 3px; padding: 14px; min-height: 54px; display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; }

/* workbook statistics */
.wb-stats { border: 1px solid #e5e5e5; border-radius: 8px; overflow: hidden; margin: 8px 0 4px; }
.wb-stat-row { display: flex; justify-content: space-between; padding: 7px 12px; font-size: 12px; border-bottom: 1px solid #eef0f3; }
.wb-stat-row:last-child { border-bottom: none; }
.wb-stat-row b { color: var(--app); }

/* ---------- Excel editor ---------- */
.mode-excel .editor-scroll { overflow: hidden; }
.mode-excel .editor-content { height: 100%; padding: 0; }
.sheet-editor { display: flex; flex-direction: column; height: 100%; width: 100%; }
.fx-bar { flex: none; display: flex; align-items: center; gap: 4px; padding: 4px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.fx-addr { font-weight: 600; font-size: 12px; color: var(--ink); min-width: 84px; text-align: center; border: 1px solid #dcdcdc; border-radius: 4px; padding: 4px 8px; height: 26px; background: #fff; }
.fx-sym { font-style: italic; font-family: Georgia, serif; color: var(--app); font-weight: 700; width: 26px; text-align: center; font-size: 13px; }
.fx-fn { width: 26px; text-align: center; color: #8a8a8a; cursor: default; }
.fx-input { flex: 1; border: 1px solid #dcdcdc; border-radius: 4px; padding: 4px 10px; font-size: 12px; font-family: "Consolas", "Courier New", monospace; height: 26px; background: #fff; }
.fx-input:focus { outline: none; border-color: var(--app); }
.sheet-scroll { flex: 1; min-height: 0; overflow: auto; background: #fff; outline: none; }
.sheet-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; }
.rowhead-col { width: 46px; }
.sheet-table th, .sheet-table td { padding: 0; }
.corner, .colhead, .rowhead { background: #f7f7f7; border: 1px solid #e3e3e3; color: #616161; font-size: 11px; font-weight: 600; text-align: center; }
.corner { position: sticky; left: 0; top: 0; z-index: 6; width: 46px; height: 22px; }
.colhead { position: sticky; top: 0; z-index: 4; height: 22px; min-width: 40px; cursor: pointer; }
.rowhead { position: sticky; left: 0; z-index: 3; width: 46px; height: 22px; cursor: pointer; }
.colhead:hover, .rowhead:hover { background: var(--app-weak); }
.colhead.frozen, .rowhead.frozen { box-shadow: inset -1px 0 0 #c8c8c8; }
.sheet-cell { position: relative; border: 1px solid #ececec; height: 22px; background: #fff; font-size: 12px; vertical-align: middle; overflow: visible; }
.cell-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; line-height: 20px; height: 20px; }
.sheet-cell.wrap .cell-val { white-space: normal; word-break: break-word; }
.cell-val.err { color: #d0453b; }
.sheet-cell.sel { box-shadow: inset 0 0 0 9999px rgba(33,115,70,.07); }
.sheet-cell.active { box-shadow: inset 0 0 0 2px var(--sel); z-index: 2; }
.sheet-cell.active.sel { box-shadow: inset 0 0 0 9999px rgba(33,115,70,.07), inset 0 0 0 2px var(--sel); }
.cell-edit { position: absolute; inset: 0; width: 100%; height: 100%; border: 2px solid var(--sel); box-sizing: border-box; padding: 0 3px; font-size: 12px; font-family: inherit; outline: none; z-index: 7; }
.remote-cell { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.remote-tag { position: absolute; top: -13px; left: -1px; font-size: 9px; color: #fff; padding: 0 4px; border-radius: 2px; white-space: nowrap; height: 13px; line-height: 13px; }
.sheet-preview .fx-input { background: #f7f7f7; color: #8a8a8a; }
.sheet-preview .sheet-scroll { cursor: default; }
.no-gridlines .sheet-cell { border-color: transparent; }

/* floating chart */
.chart-panel { position: absolute; right: 40px; bottom: 40px; width: 360px; height: 230px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: var(--shadow-2); z-index: 40; padding: 10px 14px; }
.chart-panel.selected { outline: 2px solid var(--app); box-shadow: 0 8px 30px rgba(33,115,70,.28); }
.chart-panel.selected::before, .chart-panel.selected::after { content: ''; position: absolute; width: 8px; height: 8px; background: #fff; border: 1px solid var(--app); }
.chart-panel.selected::before { left: -5px; top: -5px; } .chart-panel.selected::after { right: -5px; bottom: -5px; }
.chart-title { cursor: move; }
.chart-title { font-size: 13px; font-weight: 600; color: #333; margin-bottom: 6px; }
.chart-body { display: flex; align-items: flex-end; gap: 6px; height: 160px; border-bottom: 1px solid #ccc; padding: 0 4px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar { width: 70%; background: linear-gradient(180deg,#5b9bd5,#2b579a); border-radius: 2px 2px 0 0; min-height: 1px; }
.chart-label { font-size: 9px; color: #666; margin-top: 3px; white-space: nowrap; }
.chart-close { position: absolute; right: 6px; top: 6px; border: none; background: transparent; font-size: 16px; cursor: pointer; color: #888; }

/* ---------- dialogs / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.32); display: flex; align-items: center; justify-content: center; z-index: 400; padding: 20px; }
.modal { background: #fff; border-radius: 10px; padding: 24px; max-width: 560px; width: 100%; box-shadow: 0 16px 48px rgba(0,0,0,.22); max-height: 86vh; overflow: auto; }
.modal.wide { max-width: 680px; }
.modal h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.muted { color: #7a8089; margin: 0 0 14px; font-size: 12px; }
.help-list { padding-left: 18px; margin: 0 0 16px; line-height: 1.7; font-size: 12px; color: #3a4049; }
.help-list li { margin-bottom: 5px; }
.modal-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid #eef0f3; font-size: 12px; }
.modal-row input[type=text] { border: 1px solid #c6ccd4; border-radius: 3px; padding: 6px 8px; font-size: 12px; }
.modal-row input[type=color] { width: 34px; height: 28px; border: 1px solid #c6ccd4; border-radius: 3px; background: #fff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.modal-drag-handle { position: absolute; left: 0; right: 0; top: 0; height: 18px; cursor: move; background: repeating-linear-gradient(90deg, transparent 0 6px, #d9dde3 6px 7px); background-size: 100% 4px; background-repeat: no-repeat; background-position: 0 7px; }
.modal { position: relative; }
.modal-resize-grip { position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, #9aa4b2 50%, #9aa4b2 60%, transparent 60%, transparent 72%, #9aa4b2 72%, #9aa4b2 82%, transparent 82%); }
.frm-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.frm-row label { min-width: 60px; color: #555; }
.frm-row input[type=text] { flex: 1; border: 1px solid #c6ccd4; border-radius: 3px; padding: 7px 9px; font-size: 12px; }
.frm-hint { font-size: 11px; color: #888; margin-top: 4px; }
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(20px); background: #323130; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 12.5px; opacity: 0; transition: all .25s; z-index: 500; box-shadow: 0 8px 24px rgba(0,0,0,.24); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Excel selection / header / resize / fill interactions */
.colhead { position: relative; }
.colhead-label { pointer-events: none; }
.col-resizer { position: absolute; right: -3px; top: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 8; }
.col-resizer:hover { background: rgba(16,124,65,.28); }
.rowhead-label { pointer-events: none; }
.row-resizer { position: absolute; left: 0; bottom: -3px; width: 100%; height: 7px; cursor: row-resize; z-index: 8; }
.row-resizer:hover { background: rgba(16,124,65,.28); }
.colhead.head-sel, .rowhead.head-sel { background: var(--app-weak-2); color: var(--app-dark); font-weight: 700; }
/* ---- Office 1:1 mouse-pointer states -------------------------------- */
/* Cell body: big cross (Excel's thick white plus). */
.sheet-cell { cursor: cell; }
/* Column header: downward arrow; row header: rightward arrow (native Office arrows). */
.colhead { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M10 2 L10 16 M5 11 L10 16 L15 11' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 10 4, pointer; }
.rowhead { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M2 10 L16 10 M11 5 L16 10 L11 15' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 4 10, pointer; }
/* Resize borders + fill handle keep their resize/crosshair cursors (defined above). */
.col-resizer { cursor: col-resize; }
.row-resizer { cursor: row-resize; }
.fill-handle { cursor: crosshair; }
/* In-cell editing and Word text use the I-beam text cursor. */
.cell-edit, .wo-editable, .wo-cell-edit { cursor: text; }
/* Word block drag grip: grab / grabbing. */
.wo-grip { cursor: grab; }
.wo-grip:active { cursor: grabbing; }
/* Editor background (outside cells) uses the default arrow. */
.sheet-scroll { cursor: default; }
.sheet-cell.ref-pick { box-shadow: inset 0 0 0 1px #2e9e5b; background: rgba(46,158,91,.10); }
.sheet-cell.fill-preview { box-shadow: inset 0 0 0 1px #d99100; }
.fill-handle { position: absolute; right: -4px; bottom: -4px; width: 7px; height: 7px; background: var(--sel); border: 1px solid #fff; cursor: crosshair; z-index: 9; }
.fill-handle:hover { background: var(--app-dark); }

/* worksheet tabs */
.sheet-tabs { flex: none; height: 32px; display: flex; align-items: center; gap: 2px; padding: 0 8px; background: var(--surface-2); border-top: 1px solid var(--line); user-select: none; }
.sheet-tab { padding: 0 12px; height: 26px; line-height: 26px; font-size: 12px; color: #555; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.sheet-tab:hover { background: #ededed; }
.sheet-tab.active { background: #fff; color: var(--app); font-weight: 600; border-color: #e0e0e0; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.sheet-tab-add { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #5f5f5f; cursor: pointer; border-radius: 4px; }
.sheet-tab-add:hover { background: #eaeaea; }
.sheet-tab-count { margin-left: auto; font-size: 11px; color: #9aa0a8; }

/* format-cells dialog */
.fmt-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.fmt-tab { padding: 7px 16px; font-size: 12px; cursor: pointer; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; color: #555; }
.fmt-tab:hover { background: var(--hover); }
.fmt-tab.active { background: #fff; color: var(--app); font-weight: 600; border-color: var(--line); }
.fmt-body { min-height: 150px; }
.fmt-panel .rb-select { width: 160px; }

/* right-click context menu */
.ctx-menu { position: fixed; background: #fff; border: 1px solid #e2e2e2; border-radius: 8px; box-shadow: var(--shadow-2); z-index: 350; padding: 4px; min-width: 190px; }
.ctx-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 4px; font-size: 12.5px; cursor: pointer; }
.ctx-item:hover, .ctx-item.ctx-active { background: var(--hover); }
.ctx-item .rb-mi-ic { width: 16px; height: 16px; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--app); }
.ctx-item .ctx-label { flex: 1; white-space: nowrap; }
.ctx-item .ctx-shortcut { color: #9098a3; font-size: 11px; margin-left: 18px; white-space: nowrap; }
.ctx-item .ctx-caret { color: #9098a3; margin-left: 6px; }
.ctx-item.checked .rb-mi-ic { font-weight: 700; }
.ctx-item.disabled { color: #b4bac2; cursor: default; }
.ctx-item.disabled:hover, .ctx-item.disabled.ctx-active { background: transparent; }
.ctx-item.disabled .rb-mi-ic { color: #c7ccd3; }
.ctx-header { font-size: 10px; font-weight: 700; color: #8a929d; padding: 6px 14px 3px; text-transform: uppercase; letter-spacing: .4px; }
.ctx-divider { height: 1px; background: #e6e8eb; margin: 4px 0; }
.wo-mini.wo-ctx-mini { position: fixed; z-index: 351; }
.wo-mini-btn.active { background: #cde2fb; border-color: #8fb6e8; }

/* ==========================================================================
   PowerPoint editor  (PowerPoint 2013 orange)
   ========================================================================== */
.mode-ppt { --app: #d24726; --app-dark: #b23a1e; --app-weak: #fbeee9; --app-weak-2: #f5d9cf; --accent: #d24726; --sel: #d24726; }
.mode-ppt .editor-scroll { overflow: hidden; }
.mode-ppt .editor-content { height: 100%; padding: 0; min-height: 0; }
.ppt-editor { display: flex; height: 100%; background: #f3f2f1; overflow: hidden; outline: none; }

/* left thumbnail pane */
.ppt-thumbs { flex: none; width: 208px; background: #f7f7f7; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.ppt-thumbs-head { flex: none; height: 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 12px; font-size: 12px; color: #444; border-bottom: 1px solid #ececec; }
.ppt-icon-btn { border: 1px solid #dcdcdc; background: #fff; color: #444; border-radius: 4px; width: 24px; height: 24px; cursor: pointer; font-size: 15px; line-height: 1; }
.ppt-icon-btn:hover { background: #fbe9e4; border-color: var(--app); color: var(--app); }
.ppt-thumb-list { flex: 1; overflow-y: auto; padding: 10px 0 10px 14px; }
.ppt-thumb-item { position: relative; display: flex; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.ppt-thumb-num { flex: none; width: 18px; text-align: right; padding-right: 6px; font-size: 11px; color: #666; line-height: 1.2; }
.ppt-thumb-canvas { position: relative; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); border: 2px solid transparent; flex: none; }
.ppt-thumb-item.active .ppt-thumb-canvas { border-color: var(--app); box-shadow: 0 0 0 1px var(--app), 0 1px 4px rgba(0,0,0,.2); }
.ppt-thumb-inner { position: absolute; top: 0; left: 0; transform-origin: top left; }
.ppt-thumb-inner .ppt-shape { pointer-events: none; }

/* center column */
.ppt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.ppt-stage-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #e9e8e6; overflow: hidden; outline: none; position: relative; }
.ppt-sizer { position: relative; flex: none; }
.ppt-canvas { position: absolute; top: 0; left: 0; transform-origin: top left; box-shadow: 0 3px 16px rgba(0,0,0,.28); overflow: hidden; }
.ppt-canvas.show-grid { background-image: linear-gradient(rgba(0,0,0,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.06) 1px, transparent 1px); background-size: 40px 40px; }

/* shapes */
.ppt-shape { position: absolute; box-sizing: border-box; display: flex; overflow: hidden; cursor: move; user-select: none; }
.ppt-shape.kind-textbox { background: transparent; }
.ppt-shape .ppt-shape-text { width: 100%; padding: 6px 10px; white-space: pre-wrap; word-break: break-word; line-height: 1.25; outline: none; pointer-events: none; }
.ppt-shape .ppt-shape-text.editing { pointer-events: auto; cursor: text; background: rgba(255,255,255,.55); box-shadow: inset 0 0 0 1px var(--app); }
.ppt-shape-img { width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.ppt-canvas.ppt-preview .ppt-shape { cursor: default; }
.ppt-canvas.ppt-preview .ppt-sel-box { display: none; }
.ppt-shape.selected { outline: none; }
.ppt-shape.multi-selected { box-shadow: inset 0 0 0 2px rgba(210,71,38,.55); }
.ppt-multi-box { position: absolute; border: 1px dashed var(--app); pointer-events: none; z-index: 19; box-sizing: border-box; }

/* selection handles */
.ppt-sel-box { position: absolute; border: 1px solid var(--app); pointer-events: none; z-index: 20; }
.ppt-handle { position: absolute; width: 9px; height: 9px; background: #fff; border: 1px solid var(--app); border-radius: 1px; pointer-events: auto; }
.ppt-handle.h-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.ppt-handle.h-n { left: 50%; top: -5px; margin-left: -4px; cursor: ns-resize; }
.ppt-handle.h-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.ppt-handle.h-e { right: -5px; top: 50%; margin-top: -4px; cursor: ew-resize; }
.ppt-handle.h-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.ppt-handle.h-s { left: 50%; bottom: -5px; margin-left: -4px; cursor: ns-resize; }
.ppt-handle.h-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.ppt-handle.h-w { left: -5px; top: 50%; margin-top: -4px; cursor: ew-resize; }
.ppt-rotate { position: absolute; left: 50%; top: -26px; margin-left: -9px; width: 18px; height: 18px; background: #fff; border: 1px solid var(--app); border-radius: 50%; font-size: 12px; line-height: 16px; text-align: center; color: var(--app); cursor: grab; pointer-events: auto; }

/* remote selection */
.ppt-remote { position: absolute; border: 2px solid; pointer-events: none; z-index: 18; }
.ppt-remote-tag { position: absolute; top: -18px; left: -2px; font-size: 10px; color: #fff; padding: 1px 5px; border-radius: 2px; white-space: nowrap; }

/* notes pane */
.ppt-notes { flex: none; height: 78px; display: flex; align-items: flex-start; gap: 6px; padding: 6px 12px; background: #fff; border-top: 1px solid var(--line); font-size: 12px; color: #777; }
.ppt-notes-label { flex: none; padding-top: 3px; }
.ppt-notes-input { flex: 1; height: 64px; resize: none; border: 1px solid transparent; background: transparent; outline: none; font: inherit; color: #333; padding: 3px 4px; }
.ppt-notes-input:focus { border-color: var(--app); background: #fff; }

/* slide sorter view */
.ppt-sorter { flex: 1; min-height: 0; overflow: auto; background: #f3f2f1; padding: 20px; display: flex; flex-wrap: wrap; gap: 20px; align-content: flex-start; }
.ppt-sort-card { cursor: pointer; padding: 6px; background: #fff; border: 2px solid transparent; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.ppt-sort-card.active { border-color: var(--app); }
.ppt-sort-num { text-align: center; font-size: 11px; color: #666; padding-top: 4px; }

/* full-screen slideshow (online preview) */
.ppt-slideshow { position: fixed; inset: 0; z-index: 10000; background: #000; display: flex; align-items: center; justify-content: center; outline: none; cursor: pointer; }
.ppt-ss-stage { position: relative; flex: none; overflow: hidden; }
.ppt-ss-canvas { position: absolute; top: 0; left: 0; transform-origin: top left; }
.ppt-ss-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); color: #ccc; background: rgba(0,0,0,.55); padding: 5px 14px; border-radius: 14px; font-size: 12px; pointer-events: none; opacity: 0; transition: opacity .3s; }
.ppt-slideshow:hover .ppt-ss-bar { opacity: 1; }
@keyframes pptFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pptPush { from { transform: translateX(6%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes pptWipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes pptZoom { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pptFly { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ppt-ss-canvas.trans-fade { animation: pptFade .5s ease; }
.ppt-ss-canvas.trans-push { animation: pptPush .5s ease; }
.ppt-ss-canvas.trans-wipe { animation: pptWipe .5s ease; }
.ppt-ss-canvas.trans-zoom { animation: pptZoom .5s ease; }
.ppt-ss-canvas .anim-fade { animation: pptFade .7s ease .2s both; }
.ppt-ss-canvas .anim-fly { animation: pptFly .7s ease .2s both; }
.ppt-ss-canvas .anim-zoom { animation: pptZoom .7s ease .2s both; }

/* ---- MS Web-equivalent overlays (Presenter View / All Slides / Selection pane / guides / pointer) ---- */
.ppt-all-slides { position: fixed; inset: 8% 10%; z-index: 30; background: rgba(20,24,32,.96); border: 1px solid #555; border-radius: 6px; padding: 18px; display: flex; flex-wrap: wrap; gap: 12px; align-content: flex-start; overflow: auto; }
.ppt-all-slide { width: 120px; height: 74px; background: #fff; border: 2px solid #888; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; color: #333; cursor: pointer; }
.ppt-all-slide:hover { border-color: var(--app); }
.ppt-web-taskbar { position: fixed; bottom: 0; left: 0; right: 0; height: 34px; z-index: 30; background: #1b1f27; color: #ddd; font-size: 12px; display: flex; align-items: center; padding: 0 14px; border-top: 1px solid #444; }
.ppt-presenter-notes { position: fixed; right: 2%; bottom: 8%; width: 30%; max-height: 40%; z-index: 25; background: rgba(255,255,255,.94); color: #222; border: 1px solid #999; border-radius: 5px; padding: 12px 16px; font-size: 14px; line-height: 1.5; box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.ppt-slideshow[data-pointer="pen"] { cursor: crosshair; }
.ppt-slideshow[data-pointer="laser"] { cursor: none; }
.ppt-slideshow[data-pointer="eraser"] { cursor: cell; }
.ppt-slideshow.ppt-hide-pointer, .ppt-slideshow.ppt-hide-pointer * { cursor: none !important; }
.ppt-slideshow.ppt-ink-hidden .ppt-ink { display: none; }
.ppt-sel-pane { position: absolute; right: 8px; top: 8px; width: 190px; max-height: 60%; overflow: auto; z-index: 22; background: #fff; border: 1px solid #b9bec6; border-radius: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.2); padding: 6px; }
.ppt-sel-pane-title { font-weight: 700; font-size: 12px; padding: 4px 6px 8px; border-bottom: 1px solid #eee; }
.ppt-sel-pane-item { font-size: 12px; padding: 5px 8px; border-radius: 3px; cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ppt-sel-pane-item:hover { background: #fbe9e4; }
.ppt-canvas.show-guides { outline: 1px dashed rgba(210,71,38,.5); outline-offset: -1px; background-image: linear-gradient(to right, transparent 49.8%, rgba(210,71,38,.25) 49.8%, rgba(210,71,38,.25) 50.2%, transparent 50.2%), linear-gradient(to bottom, transparent 49.8%, rgba(210,71,38,.25) 49.8%, rgba(210,71,38,.25) 50.2%, transparent 50.2%); }
.ppt-editor.ppt-fullscreen .ppt-thumbs, .ppt-editor.ppt-fullscreen .ppt-notes { display: none; }
.ppt-thumbs.ppt-outline .ppt-thumb-canvas { display: none; }
.ppt-thumbs.ppt-outline .ppt-thumb-item::after { content: ' • 幻灯片标题'; font-size: 12px; color: #444; }

/* reading/preview view hides the editing chrome */
.ppt-preview .ppt-thumbs, .ppt-preview .ppt-notes { display: none; }

/* ---------- account / permissions ---------- */
.auth-overlay, .auth-recovery-overlay { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(1100px 620px at 50% -10%, #e6eef9 0%, #f5f5f5 58%, #eef1f4 100%); font-family: "Segoe UI", Arial, sans-serif; }
.auth-card { background: #fff; width: 100%; max-width: 380px; border-radius: 14px; border: 1px solid rgba(0,0,0,.05); box-shadow: 0 16px 48px rgba(0,0,0,.12); padding: 28px 28px 22px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-logo { width: 46px; height: 46px; flex: none; border-radius: 10px; background: #2b579a; color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.auth-brand h1 { margin: 0; font-size: 19px; font-weight: 600; color: #1f2d3d; }
.auth-brand p { margin: 3px 0 0; font-size: 12px; color: #7a8089; }
.auth-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e5e5e5; margin-bottom: 18px; }
.auth-tab { flex: 1; border: 0; background: transparent; padding: 11px 6px; font-size: 13px; color: #616161; cursor: pointer; border-bottom: 2px solid transparent; }
.auth-tab.active { color: #2b579a; border-bottom-color: #2b579a; font-weight: 600; }
.auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.auth-field label { font-size: 12px; color: #4a5568; font-weight: 600; }
.auth-field input { height: 40px; border: 1px solid #d9d9d9; border-radius: 8px; padding: 0 12px; font-size: 14px; outline: none; }
.auth-field input:focus { border-color: #2b579a; box-shadow: 0 0 0 3px rgba(43,87,154,.12); }
.auth-field.hidden { display: none; }
.auth-error { color: #c42b1c; font-size: 12px; min-height: 16px; margin: 2px 0 8px; line-height: 1.4; }
.auth-submit { width: 100%; height: 42px; border: 0; border-radius: 8px; background: #2b579a; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.auth-submit:hover { background: #1e4a86; }
.auth-submit:disabled { opacity: .6; cursor: progress; }
.auth-hint { margin: 16px 0 0; font-size: 11px; color: #8a8a8a; line-height: 1.6; text-align: center; }
.auth-recover { display: block; margin-top: 8px; font-size: 12px; text-align: center; color: #2b579a; text-decoration: underline; }
.auth-recovery-code {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 950;
  width: min(420px, 92vw); padding: 16px 18px; border-radius: 8px; background: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); font-family: "Segoe UI", Arial, sans-serif;
}
.auth-recovery-code h3 { margin: 0 0 6px; font-size: 15px; color: #1f2d3d; }
.auth-recovery-code p { margin: 0 0 10px; font-size: 12px; color: #4a5568; line-height: 1.5; }
.auth-recovery-code input { width: 100%; box-sizing: border-box; height: 34px; padding: 0 8px; border: 1px solid #c6ccd4; border-radius: 4px; font-family: monospace; }
.auth-recovery-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
@media print { .auth-recovery-overlay, .auth-recovery-code { display: none !important; } }

.user-chip-holder, .dash-user-chip { display: inline-flex; align-items: center; }
.user-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.user-avatar { width: 24px; height: 24px; border-radius: 50%; background: #fff; color: #2b579a; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: #eef3fb; color: #2b579a; border: 1px solid #cddcf3; }
.user-logout { font-size: 11px; border: 1px solid #c6ccd4; background: #fff; color: #46536a;
  border-radius: 3px; padding: 3px 8px; cursor: pointer; }
.user-logout:hover { background: #eef3fb; border-color: #9dbcf0; }
/* The editor title bar and the dashboard header are both light surfaces: use the
   app tint for the user chip instead of the old white-on-blue treatment. */
.title-right .user-avatar, .dash-user-chip .user-avatar { background: var(--app-weak-2); color: var(--app); }
.title-right .user-name, .dash-user-chip .user-name { color: var(--ink); }
.title-right .user-role, .dash-user-chip .user-role { background: var(--app-weak); color: var(--app); border-color: var(--app-weak-2); }
.title-right .user-logout, .dash-user-chip .user-logout { background: #fff; color: #444; border-color: #d6d6d6; }
.title-right .user-logout:hover, .dash-user-chip .user-logout:hover { background: #f2f2f2; border-color: #c4c4c4; }
.readonly-badge { font-size: 11px; color: #b2500f; background: #fdeede; border: 1px solid #f0c79a; border-radius: 4px; padding: 2px 7px; font-weight: 600; }
.readonly-badge:empty { display: none; }

.share-modal { max-width: 520px; }
.share-list { border: 1px solid #e3e7ee; border-radius: 4px; margin: 6px 0 16px; max-height: 240px; overflow: auto; }
.share-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #eef0f3; font-size: 12px; }
.share-row:last-child { border-bottom: 0; }
.share-who { flex: 1; color: #243248; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-role-tag { font-size: 11px; color: #2b579a; background: #eef3fb; border: 1px solid #cddcf3; border-radius: 3px; padding: 2px 8px; }
.share-row .rb-input { height: 28px; }
.share-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid #eef0f3; font-size: 12px; }
.share-add label { color: #4a5568; font-weight: 600; }
.share-add .rb-input { height: 30px; }
.share-add input.rb-input { flex: 1; min-width: 120px; }

/* ---------- print ---------- */
@media print {
  .office-titlebar, .ribbon, .backstage, .statusbar, .wo-caret-layer, .fx-bar, .rowhead, .colhead, .corner, .ppt-thumbs, .ppt-notes, .ppt-slideshow, .ctx-menu { display: none !important; }
  #dashboard, #modal-root, .toast, .auth-overlay { display: none !important; }
  .editor-scroll { overflow: visible; background: #fff; }
  .wo-editor-content { padding: 0; }
  .wo-page { box-shadow: none; margin: 0; }
  .wo-page-guide { break-after: page; height: 0; border: 0; }
  .wo-page-guide-label, .wo-pagebreak-label { display: none; }
  .ppt-stage-wrap { background: #fff; }
  .ppt-canvas { box-shadow: none; }
  .ppt-sel-box, .ppt-remote { display: none !important; }
  body, #app, .view, #editor-view { height: auto; overflow: visible; }
}

/* ---------- product layer (P0/P1) ---------- */
.wo-dock {
  position: fixed; right: 12px; bottom: 40px; z-index: 60;
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  width: 112px; max-height: calc(100vh - 130px); overflow: auto; padding: 6px;
  background: rgba(255,255,255,.98); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.wo-dock-btn {
  position: relative; display: flex; align-items: center; justify-content: flex-start; gap: 7px;
  width: 100%; padding: 5px 9px; font-size: 11px; line-height: 1.4; color: #3a3a3a; text-align: left;
  background: #fff; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.wo-dock-btn:hover { background: var(--hover); border-color: #e5e5e5; color: var(--app); }
.wo-dock-icon { width: 14px; height: 14px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--app); }
.wo-dock-icon svg { width: 14px; height: 14px; }
.wo-dock-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-dock-badge {
  position: absolute; top: -6px; right: -6px; min-width: 15px; height: 15px; padding: 0 3px;
  font-size: 10px; line-height: 15px; text-align: center; color: #fff; background: #d24726; border-radius: 8px;
}
.wo-dock-btn:focus-visible { outline: 2px solid var(--app); outline-offset: 1px; }
@media (max-width: 680px) {
  /* A vertical rail covers the document cards on a phone; lay it out as a
     scrollable strip above the status bar instead. */
  .wo-dock {
    left: 8px; right: 8px; bottom: 32px; width: auto; max-height: none;
    flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 4px; padding: 5px;
  }
  .wo-dock-btn { width: auto; flex: 0 0 auto; padding: 6px 9px; }
  .wo-dock { scrollbar-width: none; }
  .wo-dock::-webkit-scrollbar { display: none; }
  .dash-body { padding-bottom: 78px; }
}
@media print { .wo-dock { display: none !important; } }

.product-dialog { width: min(720px, 92vw); max-height: 84vh; overflow: auto; }
.product-body { margin: 10px 0; }
.product-list { max-height: 46vh; overflow: auto; border: 1px solid #eef0f3; border-radius: 6px; }
.product-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid #eef0f3; font-size: 13px;
}
.product-row:last-child { border-bottom: 0; }
.product-row.unread { background: #f2f7ff; }
.product-row-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.product-title { font-weight: 600; color: #243b53; }
.product-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
.product-form .rb-input { height: 30px; }
.product-textarea { width: 100%; min-height: 64px; padding: 8px; border: 1px solid #d9e1eb; border-radius: 5px; font: inherit; }
.product-link-input { flex: 1; min-width: 220px; }
.product-diff { margin-top: 10px; padding: 10px; background: #fafbfc; border: 1px solid #eef0f3; border-radius: 6px; font-size: 12px; }
.diff-added { color: #137333; font-family: monospace; }
.diff-removed { color: #c5221f; font-family: monospace; }
.product-comment { padding: 10px 12px; border-bottom: 1px solid #eef0f3; }
.product-comment.resolved { opacity: .6; }
.product-comment-head { font-size: 12px; color: #4a5568; }
.product-comment-text { margin: 5px 0; white-space: pre-wrap; }
.product-quote { font-size: 12px; color: #6b7785; border-left: 3px solid #d9e1eb; padding-left: 8px; }
.product-reply { margin: 4px 0 4px 14px; font-size: 12px; color: #374151; }
.product-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.product-template { padding: 12px; border: 1px solid #e3e8ef; border-radius: 8px; background: #fff; }
.product-template-icon { font-size: 22px; color: #2b579a; font-weight: 700; }
.product-template p { font-size: 12px; margin: 6px 0 10px; }
.btn.tiny { padding: 2px 7px; font-size: 11px; }
.btn.danger, .btn.tiny.danger { color: #c5221f; border-color: #f0c9c5; }
.btn.danger:hover { background: #fdecea; }

/* ---------- P2: i18n / accessibility / touch ---------- */
.wo-lang-btn {
  position: fixed; left: 8px; bottom: 3px; z-index: 62;
  width: 40px; height: 22px; border-radius: 5px; border: 1px solid #dcdcdc;
  background: #fff; color: var(--app); font-size: 11px; font-weight: 700;
  cursor: pointer; box-shadow: none;
}
.wo-lang-btn:hover { background: var(--app-weak); border-color: var(--app-weak-2); }
.wo-lang-btn:focus-visible, .wo-skip-link:focus { outline: 2px solid var(--app); outline-offset: 2px; }
.wo-skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 999; padding: 8px 14px;
  background: #fff; color: #2b579a; border: 2px solid #2b579a; border-radius: 4px;
  font-size: 13px; text-decoration: none; transition: top .15s;
}
.wo-skip-link:focus { top: 12px; }
.wo-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
@media (pointer: coarse) {
  .wo-dock-btn, .wo-lang-btn, .qat-btn, .status-view, .status-zoom-btn { min-width: 44px; min-height: 44px; }
  .wo-dock { width: min(144px, 60vw); max-height: calc(100vh - 140px); }
  .wo-dock-btn { font-size: 12px; padding: 8px 10px; }
  .doc-card { min-height: 64px; }
  .sheet-cell { min-height: 32px; }
  * { -webkit-tap-highlight-color: transparent; }
  html { touch-action: manipulation; }
}
@media (prefers-reduced-motion: reduce) { .wo-skip-link { transition: none; } }
@media print { .wo-lang-btn, .wo-skip-link { display: none !important; } }

/* ---------- real spell check ---------- */
.spell-dialog {
  position: fixed; right: 16px; top: 16px; z-index: 400;
  width: min(360px, 92vw); padding: 14px 16px; background: #fff;
  border: 1px solid #d9e1eb; border-radius: 8px; box-shadow: 0 12px 40px rgba(20,40,80,.25);
  font-family: "Segoe UI", Arial, sans-serif;
}
.spell-dialog h3 { margin: 0 0 6px; font-size: 15px; color: #1f2d3d; }
.spell-dialog p { font-size: 12px; margin: 0 0 8px; color: #5a6675; line-height: 1.5; }
.spell-list { max-height: 220px; overflow: auto; margin: 8px 0 12px; padding-left: 18px; font-size: 12px; color: #243b53; }
.spell-list li { margin: 3px 0; }
.spell-err .cell-val { text-decoration: underline wavy #c5221f; text-underline-offset: 2px; }
.sheet-spellcheck .sheet-scroll { box-shadow: inset 0 0 0 2px rgba(43,87,154,.18); }
@media print { .spell-dialog { display: none !important; } }

/* ---------- real hidden-slide / hidden-heading states ---------- */
.ppt-thumb-hidden { opacity: .5; }
.ppt-thumb-hidden .ppt-thumb-canvas { filter: grayscale(1); }
.ppt-thumb-hidden .ppt-thumb-num { text-decoration: line-through; }
.wo-hide-headings .rowhead, .wo-hide-headings .colhead, .wo-hide-headings .corner { visibility: hidden; }
.ppt-shape-linked { outline: 2px dotted rgba(43,87,154,.6); outline-offset: 2px; }
.ppt-shape-grouped { box-shadow: 0 0 0 2px rgba(210,71,38,.35); }
.show-pagebreaks .wo-pagebreak-row > td, .page-break-preview .wo-pagebreak-row > td { border-top: 2px dashed #d24726 !important; }
.wo-printarea-cell { box-shadow: inset 0 0 0 1px rgba(43,87,154,.3); }
/* Keep the centred document title from colliding with the right-hand controls
   on narrower desktops. */
@media (max-width: 1400px) { .doc-app-name { display: none; } }
@media (max-width: 1180px) {
  .doc-title { width: 200px; }
  .save-status { display: none; }
  .presence-count { display: none; }
}
@media (max-width: 1100px) { .presence { display: none; } }
@media (max-width: 980px) { #conn { display: none; } }