:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(148, 163, 184, 0.32);
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --primary-dark: #1d4ed8;
  --danger: #ef4444;
  --success: #16a34a;
  --ring: rgba(37, 99, 235, 0.16);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.13);
  --soft-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --blur: blur(22px) saturate(180%);

  --ribbon-btn-border: rgba(148, 163, 184, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.14), transparent 30%),
    radial-gradient(circle at 86% 14%, rgba(99, 102, 241, 0.10), transparent 32%),
    linear-gradient(135deg, #f6f8fc 0%, #eef2f9 45%, #f3f1fa 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
  filter: blur(10px);
  opacity: 0.42;
  animation: float-orb 16s ease-in-out infinite alternate;
}

body::before {
  left: -160px;
  top: 60px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.20), transparent 68%);
}

body::after {
  right: -140px;
  bottom: -110px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.16), transparent 68%);
  animation-delay: -6s;
}

button,
input,
select {
  font: inherit;
}

/* ---------- 登录页 ---------- */
.login-page {
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(420px, 100%);
  padding: 40px 36px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  background: linear-gradient(150deg, rgba(255,255,255,0.92), rgba(255,255,255,0.66));
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.9);
  animation: page-rise 0.55s cubic-bezier(.2,.8,.2,1) both;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
  letter-spacing: -0.02em;
  text-align: center;
  background: linear-gradient(120deg, #111827, #2563eb 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-card p {
  margin: 0 0 28px;
  color: var(--muted);
  text-align: center;
}

.login-card form {
  display: grid;
  gap: 16px;
}

.login-card label {
  display: grid;
  gap: 7px;
  font-weight: 650;
  font-size: 14px;
}

.login-card input {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.86);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card button {
  width: 100%;
  margin-top: 10px;
}

.login-status {
  min-height: 24px;
  margin-top: 16px;
  text-align: center;
  color: var(--danger);
  font-weight: 700;
}

/* ---------- 通用按钮 ---------- */
button,
.back-link,
.button-like {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--text);
  padding: 8px 14px;
  font-weight: 650;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255,255,255,0.7);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

button:hover,
.back-link:hover,
.button-like:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.09), 0 0 0 4px var(--ring);
}

button:active,
.back-link:active,
.button-like:active {
  transform: translateY(0) scale(0.97);
}

button.primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: rgba(37, 99, 235, 0.6);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255,255,255,0.3);
}

button.primary:hover {
  background: linear-gradient(135deg, #4b91ff, #1d4ed8);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.34), 0 0 0 4px var(--ring);
}

button.danger {
  color: #fff;
  background: linear-gradient(135deg, #f87171, #ef4444);
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.22), inset 0 1px 0 rgba(255,255,255,0.3);
}

button.danger:hover {
  background: linear-gradient(135deg, #fca5a5, #dc2626);
  box-shadow: 0 14px 30px rgba(239, 68, 68, 0.28), 0 0 0 4px rgba(239,68,68,0.14);
}

input,
select {
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.6) !important;
  box-shadow: 0 0 0 4px var(--ring);
}

/* ---------- 首页 ---------- */
.home-page {
  display: grid;
  place-items: center;
  padding: 32px;
}

.home-shell {
  width: min(1040px, 100%);
  animation: page-rise 0.7s cubic-bezier(.2,.8,.2,1) both;
}

.hero {
  margin-bottom: 40px;
  text-align: center;
}

.eyebrow {
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 13px;
}

.hero h1 {
  margin: 10px 0 14px;
  font-size: clamp(40px, 7vw, 72px);
  letter-spacing: -0.055em;
  line-height: 1;
  background: linear-gradient(120deg, #0f172a, #2563eb 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
}

.app-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.app-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 32px 30px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: linear-gradient(150deg, rgba(255,255,255,0.92), rgba(255,255,255,0.6));
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.9);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s ease;
}

.app-card::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,0.6), transparent 65%);
  transform: translateX(-70%) rotate(8deg);
  transition: transform 0.7s ease;
}

.app-card:hover {
  transform: translateY(-8px) scale(1.012);
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255,255,255,0.95);
}

.app-card:hover::before {
  transform: translateX(70%) rotate(8deg);
}

.card-icon {
  display: grid;
  place-items: center;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  color: #fff;
  font-size: 34px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 14px 30px rgba(0,0,0,0.16);
}

.word-card .card-icon {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.excel-card .card-icon {
  background: linear-gradient(135deg, #34d399, #059669);
}

.app-card strong,
.app-card small {
  display: block;
  position: relative;
}

.app-card strong {
  margin-bottom: 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.app-card small {
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

/* ---------- 顶部栏 / 工具条 ---------- */
.topbar,
.toolbar,
.formula-bar,
.excel-ribbon,
.word-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  overflow-x: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
}

.back-link {
  padding: 7px 12px;
  font-weight: 700;
}

.title-input,
.formula-bar input,
select {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 13px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

select {
  min-height: 38px;
  padding: 8px 40px 8px 14px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.55)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%232563eb' d='M5.7 7.8a1 1 0 0 1 1.4 0L10 10.7l2.9-2.9a1 1 0 1 1 1.4 1.4l-3.6 3.6a1 1 0 0 1-1.4 0L5.7 9.2a1 1 0 0 1 0-1.4Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  background-size: 100% 100%, 18px 18px;
  box-shadow: 0 2px 8px rgba(15,23,42,0.05), inset 0 1px 0 rgba(255,255,255,0.7);
  cursor: pointer;
}

select:hover {
  border-color: rgba(37,99,235,0.42);
  background-color: rgba(255,255,255,0.96);
  box-shadow: 0 8px 18px rgba(15,23,42,0.08), 0 0 0 4px var(--ring);
}

select option {
  background: #ffffff;
  color: var(--text);
  font-weight: 500;
}

.title-input {
  min-width: 250px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.status {
  min-width: 120px;
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

.status.error {
  color: var(--danger);
}

.user-info {
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Word / Excel 工具条（精修）---------- */
.word-ribbon {
  align-items: stretch;
  gap: 0;
  border-bottom-color: var(--border);
}

.word-ribbon {
  gap: 0;
}

.ribbon-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px 5px 16px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.ribbon-group:first-child {
  padding-left: 4px;
}

.ribbon-group:last-child {
  border-right: none;
}

.ribbon-group strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-right: 4px;
}

.ribbon-hint {
  color: var(--muted);
  font-size: 12px;
}

/* ribbon 内普通按钮变小方块图标风格 */
.word-ribbon button,
.word-ribbon .button-like,
.excel-ribbon button,
.excel-ribbon .button-like {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: none;
  background: transparent;
  border-color: transparent;
}

.word-ribbon button:hover,
.word-ribbon .button-like:hover,
.excel-ribbon button:hover,
.excel-ribbon .button-like:hover {
  background: var(--primary-light);
  border-color: rgba(37,99,235,0.22);
  box-shadow: none;
  transform: none;
}

.word-ribbon button:active,
.excel-ribbon button:active {
  transform: scale(0.95);
  background: rgba(37,99,235,0.16);
}

.word-ribbon label,
.excel-ribbon label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.word-ribbon input[type="color"],
.excel-ribbon input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.word-ribbon select,
.excel-ribbon select {
  min-height: 34px;
  padding: 6px 36px 6px 12px;
  font-size: 13px;
}

.compact-input {
  width: 140px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  background: rgba(255,255,255,0.82);
}

.excel-ribbon {
  align-items: stretch;
  gap: 0;
  border-bottom-color: var(--border);
}

/* ---------- Word 工作区 ---------- */
.word-workspace {
  padding: 40px 16px;
  animation: page-rise 0.55s cubic-bezier(.2,.8,.2,1) both;
}

.word-page {
  width: min(var(--word-page-width, 210mm), 100%);
  min-height: var(--word-page-height, 297mm);
  margin: 0 auto;
  padding: var(--word-margin-top, 25mm) var(--word-margin-right, 25mm) var(--word-margin-bottom, 25mm) var(--word-margin-left, 25mm);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
  line-height: 1.75;
  outline: none;
  transition: box-shadow 0.25s ease;
}

.word-page:focus {
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14), 0 0 0 4px var(--ring);
}

.word-page h1 { font-size: 1.9em; }
.word-page h2 { font-size: 1.5em; }
.word-page h3 { font-size: 1.2em; }

.word-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
}

.word-page td,
.word-page th {
  border: 1px solid #cbd5e1;
  padding: 7px 9px;
  min-width: 48px;
}

.word-page img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 14px auto;
  border-radius: 10px;
}

.word-page blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--primary);
  color: var(--muted);
  background: var(--primary-light);
  border-radius: 0 8px 8px 0;
}

.word-statusbar {
  width: min(var(--word-page-width, 210mm), 100%);
  margin: 16px auto 0;
  padding: 9px 18px;
  color: var(--muted);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.74);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--soft-shadow);
}

/* ---------- Excel 工作区 ---------- */
.spreadsheet-shell {
  position: relative;
  height: calc(100vh - 118px);
  min-height: 520px;
  margin: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.9);
  animation: page-rise 0.55s cubic-bezier(.2,.8,.2,1) both;
}

.spreadsheet-mount {
  width: 100%;
  height: 100%;
  min-height: 520px;
  overflow: hidden;
}

.excelhtml-range-move-preview {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
  pointer-events: none;
  border: 2px dashed #2563eb;
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.28);
}

.excelhtml-range-move-preview.invalid {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.28);
}

.excel-app-page .x-spreadsheet {
  width: 100%;
  height: 100%;
  min-height: 520px;
  background: rgba(255,255,255,0.92);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.excel-app-page .x-spreadsheet-toolbar {
  display: flex !important;
  visibility: visible !important;
  min-height: 42px;
  height: 42px;
  flex-shrink: 0;
  overflow: visible;
  z-index: 8;
  background: rgba(255,255,255,0.94) !important;
  border-bottom: 1px solid var(--border) !important;
}

.excel-app-page .x-spreadsheet-toolbar .x-spreadsheet-toolbar-btns {
  display: inline-flex !important;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.excel-app-page .x-spreadsheet-toolbar .x-spreadsheet-toolbar-btn {
  background: transparent;
  border-color: transparent;
  color: #111827;
  border-radius: 8px;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.excel-app-page .x-spreadsheet-toolbar .x-spreadsheet-toolbar-btn:hover,
.excel-app-page .x-spreadsheet-toolbar .x-spreadsheet-toolbar-btn.active {
  background: var(--primary-light);
  border-color: rgba(37,99,235,0.32);
  box-shadow: 0 0 0 3px var(--ring);
}

.excel-app-page .x-spreadsheet-icon {
  width: 18px;
  height: 18px;
}

.excel-app-page .x-spreadsheet-icon .x-spreadsheet-icon-img {
  opacity: 0.9;
  filter: contrast(1.3) brightness(0.6);
}

.excel-app-page .x-spreadsheet-dropdown .x-spreadsheet-dropdown-content,
.excel-app-page .x-spreadsheet-menu,
.excel-app-page .x-spreadsheet-contextmenu {
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  background: rgba(255,255,255,0.96) !important;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 20px 50px rgba(15,23,42,0.16), inset 0 1px 0 rgba(255,255,255,0.9) !important;
  overflow: hidden;
}

.excel-app-page .x-spreadsheet-dropdown .x-spreadsheet-dropdown-content {
  padding: 6px;
  z-index: 1001;
}

.excel-app-page .x-spreadsheet-dropdown .x-spreadsheet-dropdown-title {
  border-radius: 9px;
  transition: background 0.18s ease;
}

.excel-app-page .x-spreadsheet-dropdown .x-spreadsheet-dropdown-title:hover {
  background: var(--primary-light);
}

.excel-app-page .x-spreadsheet-menu > li,
.excel-app-page .x-spreadsheet-dropdown .x-spreadsheet-item {
  border-radius: 9px;
  color: var(--text);
}

.excel-app-page .x-spreadsheet-menu > li:hover,
.excel-app-page .x-spreadsheet-menu > li.active,
.excel-app-page .x-spreadsheet-dropdown .x-spreadsheet-item:hover {
  background: var(--primary-light) !important;
}

.excel-app-page .x-spreadsheet-contextmenu {
  width: 230px;
  max-width: min(280px, calc(100vw - 24px));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  z-index: 1000;
}

.excel-app-page .x-spreadsheet-contextmenu .x-spreadsheet-item {
  min-height: 30px;
  line-height: 30px;
}

.vendor-missing {
  max-width: 760px;
  margin: 48px auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
}

.vendor-missing pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #e5e7eb;
}

/* ---------- 旧版自研表格组件 (兼容) ---------- */
.formula-bar {
  position: sticky;
  top: 56px;
  z-index: 15;
}

#activeCellLabel {
  min-width: 56px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.82);
  font-weight: 800;
  text-align: center;
}

.formula-bar input {
  min-width: 420px;
  flex: 1;
}

.sheet-shell {
  height: calc(100vh - 162px);
  overflow: auto;
  background: #fff;
}

.sheet {
  display: grid;
  width: max-content;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.cell,
.header-cell,
.corner-cell {
  min-width: 0;
  height: 30px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
  overflow: hidden;
  white-space: nowrap;
}

.corner-cell,
.header-cell {
  position: sticky;
  z-index: 4;
  background: #f3f4f6;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  user-select: none;
}

.corner-cell {
  left: 0;
  top: 0;
  z-index: 8;
  width: 54px;
}

.column-header { top: 0; position: sticky; }
.row-header { left: 0; width: 54px; position: sticky; }
.column-header, .row-header { overflow: visible; }

.column-resize-handle,
.row-resize-handle {
  position: absolute;
  display: block;
  background: transparent;
  z-index: 10;
}

.column-resize-handle { top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; }
.row-resize-handle { left: 0; right: 0; bottom: -4px; height: 8px; cursor: row-resize; }

.column-resize-handle:hover,
.row-resize-handle:hover,
.resizing-sheet .column-resize-handle,
.resizing-sheet .row-resize-handle {
  background: rgba(37, 99, 235, 0.22);
}

.sheet.can-resize-column { cursor: col-resize; }
.sheet.can-resize-row { cursor: row-resize; }
.resizing-sheet { cursor: grabbing; user-select: none; }

.cell { background: #fff; outline: none; }
.cell.selected { background-color: var(--primary-light) !important; }
.cell.active { box-shadow: inset 0 0 0 2px var(--primary); z-index: 3; }
.cell.move-target { box-shadow: inset 0 0 0 3px #16a34a; z-index: 4; }
.moving-selection,
.moving-selection .cell { cursor: move; user-select: none; }

.toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

@keyframes float-orb {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(28px, -22px, 0) scale(1.08); }
}

@keyframes page-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media print {
  body { background: #fff !important; }

  body::before,
  body::after,
  .topbar,
  .word-ribbon,
  .word-statusbar {
    display: none !important;
  }

  .word-workspace { padding: 0 !important; }

  .word-page {
    width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media screen and (min-width: 320px) and (max-width: 480px) {
  .excel-app-page .x-spreadsheet-toolbar { display: flex !important; }
}

@media (max-width: 720px) {
  .word-page { padding: 26px; border-radius: 8px; }
  .title-input,
  .formula-bar input { min-width: 220px; }
  .spreadsheet-shell { margin: 8px; border-radius: 12px; }
  .ribbon-group { padding: 5px 10px; }
}