:root {
  --bg: #eef3fb;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.74);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --text: #172033;
  --muted: #6b7588;
  --title: #0f172a;
  --accent: #2d64d4;
  --accent-strong: #1e49ac;
  --accent-soft: rgba(45, 100, 212, 0.12);
  --accent-glow: rgba(45, 100, 212, 0.24);
  --success: #228157;
  --warning: #d46c2f;
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.14);
  --shadow-md: 0 16px 35px rgba(15, 23, 42, 0.1);
  --shadow-sm: 0 10px 22px rgba(15, 23, 42, 0.07);
  --radius-2xl: 30px;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body[data-app-type="xlsx"] {
  --accent: #228157;
  --accent-strong: #166341;
  --accent-soft: rgba(34, 129, 87, 0.12);
  --accent-glow: rgba(34, 129, 87, 0.2);
}

body[data-app-type="pptx"] {
  --accent: #d46c2f;
  --accent-strong: #aa4f1d;
  --accent-soft: rgba(212, 108, 47, 0.12);
  --accent-glow: rgba(212, 108, 47, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(94, 135, 231, 0.18), transparent 26%),
    radial-gradient(circle at 100% 18%, rgba(255, 183, 94, 0.14), transparent 24%),
    linear-gradient(180deg, #f6f8fc 0%, #eef3fb 54%, #e9eff9 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 36%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 38%, white);
  outline-offset: 2px;
}

code {
  padding: 0.12rem 0.38rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  background: linear-gradient(135deg, #13336f 0%, #1d4fad 40%, #2c66d7 100%);
  color: #fff;
  box-shadow: 0 18px 40px rgba(20, 44, 92, 0.25);
}

.icon-btn,
.ghost-btn,
.primary-btn {
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
}

.icon-btn,
.ghost-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.primary-btn {
  color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 255, 0.94));
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
}

.topbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.product-badge {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.topbar-title {
  font-size: 1.04rem;
  font-weight: 800;
}

.topbar-subtitle {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-layout {
  flex: 1;
  padding: 22px;
}

.home-view,
.workspace-view {
  display: none;
}

.active-view {
  display: block;
}

.hero-card,
.info-card,
.launch-card,
.toolbar-host,
.editor-host,
.slide-thumb,
.doc-page,
.sheet-shell,
.sheet-tabs,
.slide-canvas-wrap,
.slide-sidebar,
.status-pill,
.workspace-header {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.home-view {
  display: none;
}

.home-view.active-view {
  display: block;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: var(--radius-2xl);
  display: grid;
  gap: 24px;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6), transparent 68%);
  pointer-events: none;
}

.hero-copy {
  display: grid;
  gap: 16px;
  align-content: start;
}

.eyebrow,
.section-kicker,
.toolbar-section-title {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
}

.hero-card h1,
.section-head h2 {
  margin: 0;
  color: var(--title);
  line-height: 1.04;
}

.hero-card h1 {
  max-width: 12ch;
  font-size: clamp(2.1rem, 4vw, 3.4rem);
}

.hero-card p,
.info-card p,
.launch-card span,
.workspace-summary,
.doc-note,
.status-pill,
.section-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-trustbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trust-pill,
.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
  font-weight: 700;
}

.hero-open-btn {
  min-height: 64px;
  width: min(100%, 320px);
  padding: 0 22px;
  justify-self: start;
  border-radius: 20px;
  font-size: 1.04rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, white));
  box-shadow: 0 18px 38px var(--accent-glow);
}

.folder-icon {
  margin-right: 10px;
}

.suite-showcase {
  position: relative;
  min-height: 280px;
  display: grid;
  place-items: center;
}

.showcase-card {
  position: absolute;
  width: min(100%, 320px);
  min-height: 168px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 20px 42px rgba(15, 23, 42, 0.12);
}

.showcase-card.doc {
  transform: rotate(-8deg) translate(-34px, -8px);
}

.showcase-card.sheet {
  transform: translate(36px, 20px);
}

.showcase-card.slide {
  transform: rotate(8deg) translate(0, 74px);
}

.showcase-app {
  margin-bottom: 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.showcase-lines {
  display: grid;
  gap: 10px;
}

.showcase-lines span,
.mini-slide-band,
.mini-grid span {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(45, 100, 212, 0.18), rgba(45, 100, 212, 0.07));
}

.showcase-lines.compact {
  gap: 8px;
}

.w-80 { width: 80%; height: 16px; }
.w-72 { width: 72%; height: 12px; }
.w-64 { width: 64%; height: 14px; }
.w-56 { width: 56%; height: 12px; }
.w-44 { width: 44%; height: 10px; }

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.mini-grid span {
  height: 24px;
  border-radius: 8px;
}

.mini-slide-band {
  width: 100%;
  height: 50px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 75%, white));
}

.section-head {
  margin-top: 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-head.compact {
  margin-top: 22px;
}

.section-head h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
}

.launch-grid,
.info-grid {
  display: grid;
  gap: 16px;
}

.launch-card,
.info-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.launch-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  text-align: left;
}

.launch-card::after,
.feature-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7), transparent 72%);
  pointer-events: none;
}

.launch-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
  color: var(--title);
}

.launch-card.word .app-icon { background: linear-gradient(135deg, #2d64d4, #4b89f5); }
.launch-card.excel .app-icon { background: linear-gradient(135deg, #228157, #39b578); }
.launch-card.ppt .app-icon { background: linear-gradient(135deg, #d46c2f, #f19a62); }

.app-icon,
.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  flex: 0 0 auto;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
}

.feature-card {
  padding: 20px;
}

.feature-icon {
  margin-bottom: 16px;
  font-size: 1.25rem;
}

.feature-icon.blue { background: linear-gradient(135deg, #2d64d4, #4b89f5); }
.feature-icon.green { background: linear-gradient(135deg, #228157, #39b578); }
.feature-icon.orange { background: linear-gradient(135deg, #d46c2f, #f19a62); }

.info-card h3 {
  margin: 0 0 10px;
  color: var(--title);
}

.workspace-view {
  display: none;
  gap: 16px;
}

.workspace-view.active-view {
  display: grid;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-radius: var(--radius-xl);
}

.workspace-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.workspace-app-badge {
  min-width: 62px;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-title-stack {
  min-width: 0;
}

.workspace-file-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.toolbar-host,
.editor-host {
  border-radius: var(--radius-2xl);
  overflow: hidden;
}

.toolbar-host {
  position: relative;
  padding: 12px;
}

.toolbar-host::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 48%, white));
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.toolbar-ribbon {
  align-items: stretch;
}

.toolbar-section {
  min-width: 0;
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 10px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.92), rgba(255, 255, 255, 0.78));
  border: 1px solid rgba(15, 23, 42, 0.05);
  box-shadow: var(--shadow-sm);
}

.toolbar-section.wide {
  flex: 1 1 320px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}

.compact-scroll::-webkit-scrollbar {
  height: 8px;
}

.compact-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.5);
  border-radius: 999px;
}

.toolbar button,
.sheet-tab,
.slide-thumb,
.launch-card {
  -webkit-tap-highlight-color: transparent;
}

.toolbar button,
.sheet-tab {
  min-height: 42px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.toolbar button:hover,
.sheet-tab:hover,
.slide-thumb:hover,
.launch-card:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.toolbar button.active,
.sheet-tab.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 76%, white));
  box-shadow: 0 16px 28px var(--accent-glow);
}

.formula-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cell-address {
  min-width: 68px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.06);
  font-weight: 800;
  color: var(--title);
}

.formula-wrap label {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, white));
  color: #fff;
  font-weight: 800;
}

.formula-wrap input,
.toolbar input,
.toolbar select {
  min-width: 0;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--title);
}

.formula-wrap input {
  flex: 1;
}

.toolbar-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-stack span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.field-stack.small {
  flex: 1 1 168px;
}

.color-field input {
  padding: 4px;
  min-width: 74px;
}

.editor-host {
  min-height: 68vh;
  padding: 16px;
}

.empty-state {
  min-height: 55vh;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.doc-shell {
  min-height: 58vh;
  display: flex;
  justify-content: center;
  padding: 10px 0 20px;
}

.doc-page {
  width: min(100%, 920px);
  min-height: 1200px;
  padding: clamp(24px, 5vw, 52px);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1);
}

.doc-page[contenteditable="true"]:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, white);
}

.doc-page h1,
.doc-page h2,
.doc-page p {
  margin-top: 0;
}

.doc-page h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.doc-page h2 {
  font-size: clamp(1.22rem, 3vw, 1.8rem);
}

.doc-page p,
.doc-page li {
  font-size: 1rem;
  line-height: 1.72;
}

.doc-page ul,
.doc-page ol {
  margin: 0 0 1.05rem;
  padding-left: 1.5rem;
}

.doc-page table {
  width: 100%;
  margin: 0 0 1.2rem;
  border-collapse: collapse;
  table-layout: fixed;
}

.doc-page td,
.doc-page th {
  min-width: 96px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  vertical-align: top;
}

.doc-page td:focus,
.doc-page th:focus {
  outline: none;
  background: rgba(37, 87, 197, 0.06);
}

.doc-note,
.status-pill {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(248, 250, 255, 0.82);
  box-shadow: var(--shadow-sm);
}

.sheet-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 56vh;
  border-radius: 30px;
  padding: 14px;
  overflow: hidden;
}

.sheet-grid-wrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(252, 253, 255, 0.95), rgba(241, 246, 252, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.sheet-grid {
  --sheet-cell-width: 132px;
  --sheet-row-header-width: 64px;
  --sheet-row-height: 44px;
  --sheet-header-height: 44px;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 860px;
  width: max-content;
}

.sheet-grid th,
.sheet-grid td {
  border: 1px solid rgba(148, 163, 184, 0.22);
  width: var(--sheet-cell-width);
  min-width: var(--sheet-cell-width);
  height: var(--sheet-row-height);
  padding: 8px 10px;
  vertical-align: middle;
}

.sheet-grid thead th,
.sheet-grid tbody th {
  position: sticky;
  background: linear-gradient(180deg, rgba(240, 246, 255, 0.98), rgba(230, 238, 250, 0.95));
  color: #3b475e;
  font-weight: 800;
  z-index: 2;
}

.sheet-grid thead th:first-child,
.sheet-grid tbody th {
  width: var(--sheet-row-header-width);
  min-width: var(--sheet-row-header-width);
}

.sheet-grid thead th {
  top: 0;
}

.sheet-grid tbody th {
  left: 0;
}

.sheet-grid td {
  background: rgba(255, 255, 255, 0.92);
}

.sheet-grid td.merged-cell {
  font-weight: 700;
}

.sheet-grid .frozen-row,
.sheet-grid .frozen-col {
  position: sticky;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.18);
}

.sheet-grid .frozen-row.frozen-col {
  z-index: 5;
}

.sheet-grid td.active {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 8%, white);
}

.sheet-grid td[contenteditable="true"]:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 32%, white);
  outline-offset: -2px;
}

.sheet-tabs {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  overflow-x: auto;
  background: rgba(247, 250, 255, 0.8);
}

.ppt-shell {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 16px;
  min-height: 58vh;
}

.slide-sidebar {
  border-radius: 26px;
  padding: 12px;
  overflow: auto;
}

.slide-thumb {
  width: 100%;
  border-radius: 20px;
  padding: 10px;
  margin-bottom: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.9);
}

.slide-thumb.active {
  border-color: color-mix(in srgb, var(--accent) 36%, white);
  box-shadow: 0 18px 34px var(--accent-glow);
}

.slide-thumb-preview {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #f9fbff, #eef3fb);
  padding: 8px;
  overflow: hidden;
  font-size: 0.5rem;
}

.slide-thumb-title {
  display: block;
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--title);
}

.slide-canvas-wrap {
  border-radius: 30px;
  padding: 18px;
  display: grid;
  align-items: start;
  justify-items: center;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.62), transparent 30%),
    var(--panel);
}

.slide-canvas {
  position: relative;
  width: min(100%, 920px);
  aspect-ratio: 16 / 9;
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff, #f2f6fd);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.1);
}

.slide-title-band {
  position: absolute;
  inset: 0 0 auto 0;
  height: 30%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 76%, white));
  border-bottom-left-radius: 38% 24%;
  border-bottom-right-radius: 38% 24%;
}

.slide-shape {
  position: absolute;
  min-width: 80px;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed transparent;
  overflow: hidden;
}

.slide-shape.active {
  border-color: color-mix(in srgb, var(--accent) 70%, white);
  background: color-mix(in srgb, var(--accent) 5%, white);
}

.slide-shape[contenteditable="true"]:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 90%, white);
}

.slide-shape[data-role="title"] {
  color: #fff;
  font-size: clamp(1rem, 3vw, 2.45rem);
  font-weight: 800;
}

.slide-shape[data-role="body"] {
  color: var(--text);
  font-size: clamp(0.84rem, 1.6vw, 1.2rem);
  line-height: 1.55;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

@media (min-width: 960px) {
  .hero-card {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 420px);
    align-items: center;
  }

  .launch-grid,
  .info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .workspace-header {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace-metrics {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .app-topbar {
    grid-template-columns: auto 1fr;
  }

  .topbar-actions {
    grid-column: 1 / -1;
  }

  .ppt-shell {
    grid-template-columns: 1fr;
  }

  .slide-sidebar {
    display: flex;
    gap: 12px;
    overflow-x: auto;
  }

  .slide-thumb {
    min-width: 150px;
    margin-bottom: 0;
  }
}

@media (max-width: 720px) {
  .main-layout {
    padding: 14px;
  }

  .hero-card,
  .workspace-header,
  .toolbar-host,
  .editor-host,
  .slide-sidebar,
  .slide-canvas-wrap,
  .sheet-shell,
  .launch-card,
  .info-card {
    border-radius: 22px;
  }

  .hero-card {
    padding: 22px;
  }

  .showcase-card {
    position: relative;
    width: 100%;
  }

  .showcase-card.doc,
  .showcase-card.sheet,
  .showcase-card.slide {
    transform: none;
  }

  .suite-showcase {
    min-height: auto;
    gap: 12px;
  }

  .toolbar {
    gap: 10px;
  }

  .toolbar-section {
    width: 100%;
  }

  .formula-wrap {
    flex-wrap: wrap;
  }

  .formula-wrap input {
    width: 100%;
  }

  .doc-page {
    min-height: 68vh;
    padding: 22px;
    border-radius: 24px;
  }

  .editor-host {
    padding: 12px;
  }
}

@media (max-width: 520px) {
  .app-topbar {
    padding: 12px 14px;
  }

  .main-layout {
    padding: 10px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .icon-btn,
  .ghost-btn,
  .primary-btn,
  .toolbar button,
  .sheet-tab {
    min-height: 44px;
  }

  .hero-card h1 {
    max-width: none;
    font-size: clamp(1.85rem, 10vw, 2.5rem);
  }

  .workspace-title-wrap {
    align-items: flex-start;
  }

  .workspace-file-name,
  .workspace-summary {
    white-space: normal;
  }

  .cell-address {
    min-width: 58px;
  }
}

:root {
  --topbar-start: #13336f;
  --topbar-mid: #1d4fad;
  --topbar-end: #2c66d7;
}

body[data-app-type="docx"] {
  --topbar-start: #14337a;
  --topbar-mid: #2457c5;
  --topbar-end: #4b89f5;
}

body[data-app-type="xlsx"] {
  --topbar-start: #13492f;
  --topbar-mid: #1e6a45;
  --topbar-end: #31a56a;
}

body[data-app-type="pptx"] {
  --topbar-start: #8a3a10;
  --topbar-mid: #c35a22;
  --topbar-end: #ef8c4f;
}

.app-topbar {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.16), transparent 24%),
    linear-gradient(135deg, var(--topbar-start) 0%, var(--topbar-mid) 42%, var(--topbar-end) 100%);
}

.hero-actions {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(220px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.hero-helper-card,
.suite-panel,
.insight-card,
.glance-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 255, 0.82));
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: var(--shadow-sm);
}

.hero-helper-card {
  min-height: 64px;
  padding: 14px 16px;
  border-radius: 20px;
  display: grid;
  gap: 6px;
  align-content: center;
}

.helper-title,
.insight-label,
.suite-panel-head {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.helper-copy,
.glance-copy {
  color: var(--muted);
  line-height: 1.5;
}

.suite-strip,
.insight-grid,
.workspace-glance {
  display: grid;
  gap: 14px;
}

.suite-strip {
  margin-top: 18px;
}

.suite-panel,
.insight-card,
.glance-card {
  border-radius: 22px;
  padding: 18px;
}

.suite-panel::after,
.insight-card::after,
.glance-card::after,
.hero-helper-card::after {
  content: "";
  position: absolute;
  inset: auto -34px -38px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent 72%);
  pointer-events: none;
}

.suite-panel.word { box-shadow: 0 18px 32px rgba(45, 100, 212, 0.11); }
.suite-panel.excel { box-shadow: 0 18px 32px rgba(34, 129, 87, 0.11); }
.suite-panel.ppt { box-shadow: 0 18px 32px rgba(212, 108, 47, 0.12); }

.suite-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.suite-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, white));
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, white);
}

.suite-panel strong,
.insight-card strong,
.glance-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--title);
  font-size: 1rem;
}

.suite-panel p,
.insight-card p,
.glance-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.insight-grid {
  margin-top: 16px;
}

.workspace-glance {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.glance-card {
  min-height: 112px;
}

.glance-value {
  display: block;
  margin: 8px 0 4px;
  color: var(--title);
  font-size: 1.12rem;
  font-weight: 850;
}

.toolbar-host {
  position: sticky;
  top: 84px;
  z-index: 25;
  box-shadow: var(--shadow-md);
}

.editor-host {
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.55), transparent 24%),
    linear-gradient(180deg, rgba(249, 251, 255, 0.9), rgba(240, 245, 252, 0.88));
}

.workspace-header,
.toolbar-host,
.editor-host,
.workspace-glance {
  scroll-margin-top: 96px;
}

.doc-shell,
.ppt-shell {
  position: relative;
}

.doc-shell::before,
.ppt-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.5), transparent 30%);
}

.slide-sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 255, 0.86));
}

.sheet-tab {
  font-weight: 700;
}

.sheet-grid td,
.slide-shape,
.doc-page {
  transition: box-shadow 140ms ease, border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

@media (min-width: 960px) {
  .suite-strip,
  .insight-grid,
  .workspace-glance {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 959px) {
  .workspace-glance {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .hero-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .toolbar-host {
    top: 76px;
  }

  .suite-panel,
  .insight-card,
  .glance-card,
  .hero-helper-card {
    border-radius: 18px;
  }
}

@media (max-width: 520px) {
  .toolbar-host {
    top: 70px;
  }

  .hero-open-btn {
    width: 100%;
  }
}
