:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-2: #edf4f1;
  --ink: #18201c;
  --muted: #5f6b63;
  --line: #cad5ce;
  --line-strong: #9fb0a6;
  --accent: #167d63;
  --accent-2: #2f6db3;
  --accent-3: #c57a18;
  --danger: #ba3f3f;
  --active: #d8ece6;
  --selected: #e7f1ff;
  --header: #ecf0e9;
  --shadow: 0 20px 60px rgba(30, 42, 35, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  overflow: hidden;
  min-width: 1120px;
  height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f8fafc;
}

html,
body {
  overscroll-behavior: none;
}

button,
input,
textarea {
  font: inherit;
}

button,
.file-button {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 9px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

button:hover,
.file-button:hover {
  border-color: #dce3ea;
  background: #ffffff;
  color: #0f5f4a;
}

button:disabled {
  color: #9aa49e;
  background: #eef1ed;
  cursor: not-allowed;
}

button.is-active {
  border-color: #8fcab7;
  background: #e8f4ef;
  color: #0f5f4a;
  box-shadow: inset 0 0 0 1px #8fcab7;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #174b69;
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  height: 100vh;
  min-height: 0;
  padding: 0 10px 10px;
  gap: 8px;
}

.sheet-chrome,
.formula-row,
.workspace,
.status-strip {
  width: min(2040px, 100%);
  min-width: 0;
  margin: 0 auto;
}

.sheet-chrome {
  display: grid;
  gap: 3px;
  padding: 8px 0 0;
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  gap: 16px;
}

.document-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  color: #ffffff;
  background: #2fa34a;
  font-weight: 800;
  letter-spacing: 0;
}

.document-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  overflow: hidden;
  max-width: 520px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-copy p {
  color: var(--muted);
  font-size: 11px;
}

.chrome-icon {
  width: 28px;
  min-width: 28px;
  padding: 0;
  color: #4d575f;
  font-size: 17px;
}

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

.local-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 16px;
  color: #174b69;
  background: #c9e7ff;
  font-weight: 700;
  font-size: 13px;
}

.locale-toggle {
  min-height: 32px;
  border-color: #d5dee8;
  border-radius: 999px;
  padding: 0 12px;
  background: #ffffff;
  color: #26323c;
  font-size: 12px;
  font-weight: 750;
}

.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #38424d;
  font-weight: 800;
}

.account-menu {
  position: absolute;
  top: 48px;
  right: 16px;
  z-index: 30;
  width: 240px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(33, 42, 37, 0.18);
}

.account-menu[hidden] {
  display: none;
}

.account-menu-title {
  font-weight: 800;
}

.account-menu p {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.account-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 30px;
  border: 0;
  background: transparent;
}

.menu-row {
  display: flex;
  align-items: center;
  min-height: 24px;
  gap: 2px;
  padding-left: 44px;
}

.menu-row button {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 13px;
}

.menu-row button.is-open {
  background: #e8edf4;
}

.menu-popover {
  position: fixed;
  z-index: 20;
  width: min(360px, calc(100vw - 24px));
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 8px 0;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(20, 31, 43, 0.18);
}

.menu-popover[hidden] {
  display: none;
}

.menu-popover section {
  display: grid;
  gap: 2px;
  padding: 6px 0;
  border-bottom: 1px solid #e4e8ed;
}

.menu-popover section:last-child {
  border-bottom: 0;
}

.menu-popover button {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  min-height: 36px;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0 18px;
  color: #1f252b;
  background: transparent;
  font-size: 14px;
  text-align: left;
}

.menu-popover button:hover {
  background: #eef3f9;
  color: #1f252b;
}

.menu-popover span {
  color: #4b5560;
  font-weight: 750;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 42px;
  min-width: 0;
  border-radius: 999px;
  padding: 4px 10px;
  gap: 0;
  background: #edf2f8;
  scrollbar-width: thin;
}

.tool-group {
  display: inline-flex;
  position: relative;
  align-items: center;
  flex: 0 0 auto;
  min-height: 30px;
  gap: 2px;
  padding: 0 8px;
  border-right: 1px solid #d4dbe3;
}

.tool-group:last-child {
  border-right: 0;
}

.toolbar [aria-label="Table operations"],
.toolbar [aria-label="Filter"],
.toolbar [aria-label="Clipboard and fill"],
.toolbar [aria-label="Text display"],
#demoButton,
#clearButton,
#saveButton,
#narrowColumnButton,
#widenColumnButton,
#shortenRowButton,
#heightenRowButton,
[data-vertical-align],
[data-border-style="none"],
#createBoxButton,
#clearBoxesButton,
[data-format-painter],
#exportJsonButton,
#exportCsvButton,
#exportExcelButton,
.toolbar .file-button {
  display: none;
}

.toolbar-menu-button { max-width: 132px; }
.toolbar-menu-button.compact { width: 58px; }
.toolbar-menu-button.color-tool { width: 34px; min-width: 34px; font-weight: 800; }

.toolbar-popover {
  position: absolute;
  top: calc(100% + 6px);
  z-index: 20;
  width: 230px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(33, 42, 37, 0.18);
}

.font-menu { left: 82px; }
.size-menu { left: 178px; width: 96px; }
.color-palette { left: 230px; display: grid; grid-template-columns: repeat(4, 28px); gap: 6px; width: 140px; }
.toolbar-popover[hidden] { display: none; }

.toolbar-popover button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: transparent;
}

.color-palette button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  color: transparent;
}

.color-palette button:first-child {
  grid-column: 1 / -1;
  width: 100%;
  border-radius: 4px;
  color: var(--ink);
}

[data-color-value="#000000"] { background-color: #000000 !important; }
[data-color-value="#ffffff"] { background-color: #ffffff !important; }
[data-color-value="#5f6368"] { background-color: #5f6368 !important; }
[data-color-value="#d93025"] { background-color: #d93025 !important; }
[data-color-value="#f9ab00"] { background-color: #f9ab00 !important; }
[data-color-value="#188038"] { background-color: #188038 !important; }
[data-color-value="#1967d2"] { background-color: #1967d2 !important; }
[data-color-value="#9334e6"] { background-color: #9334e6 !important; }
[data-color-value="#fce8e6"] { background-color: #fce8e6 !important; }
[data-color-value="#fef7e0"] { background-color: #fef7e0 !important; }
[data-color-value="#e6f4ea"] { background-color: #e6f4ea !important; }
[data-color-value="#e8f0fe"] { background-color: #e8f0fe !important; }
[data-color-value="#f3e8fd"] { background-color: #f3e8fd !important; }
[data-color-value="#e0f2f1"] { background-color: #e0f2f1 !important; }

.toolbar button,
.toolbar .file-button,
.toolbar .color-button {
  min-height: 28px;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  white-space: nowrap;
}

.toolbar-input {
  width: 112px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 12px;
  background: #ffffff;
  font-size: 13px;
}

.toolbar-select {
  width: 104px;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
}

.find-replace-panel {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(30, 42, 35, 0.1);
}

.find-replace-panel[hidden] {
  display: none;
}

.find-replace-panel input {
  min-height: 32px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: #fbfdfb;
}

.find-replace-panel button {
  min-height: 32px;
  border-color: var(--line);
  background: #f8fafc;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.color-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  cursor: pointer;
}

.color-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.formula-row {
  display: grid;
  grid-template-columns: 88px 1fr 88px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.name-box,
.formula-bar {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface);
}

.name-box {
  text-transform: uppercase;
  text-align: center;
  font-weight: 700;
}

.formula-bar {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  min-width: 0;
}

.workspace {
  display: block;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.sheet-frame {
  position: relative;
  overflow: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet-tabs-bar {
  display: flex;
  position: sticky;
  bottom: 32px;
  z-index: 18;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #f7f9fb;
}

.sheet-tabs {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
}

.sheet-tabs-bar button {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #ffffff;
  font-size: 13px;
  white-space: nowrap;
}

.sheet-tabs button.is-active {
  border-color: var(--accent);
  color: #0f5f4a;
  background: #d9f0e8;
  font-weight: 800;
}

.fill-handle {
  position: absolute;
  z-index: 5;
  width: 10px;
  min-width: 10px;
  height: 10px;
  min-height: 10px;
  border: 1px solid #ffffff;
  border-radius: 2px;
  padding: 0;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(22, 125, 99, 0.4);
  cursor: crosshair;
}

.fill-handle.is-dragging {
  background: var(--accent-2);
}

.shape-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  transform-origin: top left;
}

.sheet-shape {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(33, 42, 37, 0.1);
}

.sheet-grid {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  table-layout: fixed;
  font-size: 13px;
}

.sheet-grid th,
.sheet-grid td {
  width: 112px;
  min-width: 112px;
  height: 34px;
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sheet-grid th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #425048;
  background: var(--header);
  font-weight: 700;
  text-align: center;
  user-select: none;
}

.sheet-grid .corner,
.row-head {
  width: 48px;
  min-width: 48px;
}

.sheet-grid .corner {
  left: 0;
  z-index: 4;
  cursor: cell;
}

.row-head {
  position: sticky;
  left: 0;
  z-index: 2;
  color: #536059;
  background: var(--header);
  text-align: center;
  font-weight: 700;
  cursor: cell;
}

.sheet-grid th[data-col] {
  cursor: cell;
}

.sheet-grid th.filtered-column {
  color: #0f5f4a;
  background: #d9f0e8;
}

.sheet-grid th.filtered-column::after {
  content: " ▾";
  color: var(--accent);
  font-size: 10px;
}

.cell-input {
  width: 100%;
  height: 33px;
  border: 0;
  outline: none;
  padding: 0 8px;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  line-height: 32px;
  resize: none;
}

.cell-input[data-text-wrap="overflow"] {
  overflow: visible;
  white-space: pre;
}

.cell-input[data-text-wrap="clip"] {
  overflow: hidden;
  text-overflow: clip;
  white-space: pre;
}

.cell-input[data-text-wrap="wrap"] {
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 17px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.cell-input:focus {
  background: var(--active);
  box-shadow: inset 0 0 0 2px var(--accent);
}

td.active-cell {
  background: var(--active);
}

td.selected-cell {
  background: var(--selected);
}

td.formula-cell .cell-input {
  color: #204f8f;
}

td.error-cell .cell-input {
  color: var(--danger);
  font-weight: 700;
}

td.note-cell,
td.validated-cell {
  position: relative;
}

td.note-cell::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-top: 9px solid var(--accent-3);
  border-left: 9px solid transparent;
  pointer-events: none;
}

td.validated-cell::before {
  content: "▾";
  position: absolute;
  right: 4px;
  bottom: 2px;
  color: #718078;
  font-size: 10px;
  pointer-events: none;
}

td.invalid-cell .cell-input {
  color: var(--danger);
  background: #fff1f1;
  box-shadow: inset 0 0 0 1px #e6b8b8;
}

.sheet-grid td.frozen-row,
.sheet-grid td.frozen-col,
.sheet-grid th.frozen-row-head,
.sheet-grid th.frozen-col-head {
  position: sticky;
  background: #fffef9;
}

.sheet-grid td.frozen-row {
  top: 34px;
  z-index: 2;
}

.sheet-grid th.frozen-row-head {
  top: 34px;
  z-index: 3;
}

.sheet-grid td.frozen-col {
  left: 48px;
  z-index: 2;
}

.sheet-grid th.frozen-col-head {
  left: 48px;
  z-index: 4;
}

.sheet-grid td.frozen-corner-cell {
  z-index: 5;
}

.sheet-chart {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 10px;
  overflow: hidden;
  background: rgba(255, 254, 249, 0.96);
  pointer-events: none;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(54px, 0.7fr) minmax(60px, 1.5fr) auto;
  align-items: center;
  gap: 7px;
  color: #26342e;
  font-size: 11px;
}

.chart-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-row i {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.chart-row b {
  min-width: 34px;
  text-align: right;
}

.status-strip {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  padding: 0 10px;
  gap: 14px;
  background: #ffffff;
  color: #3f4a43;
  font-size: 12px;
}

.status-strip b {
  color: #657068;
  font-weight: 700;
}

.status-error-button {
  min-height: 24px;
  margin-left: auto;
  border-color: #dce4dc;
  background: #f8fafc;
  font-size: 12px;
}

.status-error-button.has-errors {
  border-color: #e6b8b8;
  color: var(--danger);
  background: #fff1f1;
}

.error-panel {
  position: absolute;
  right: 0;
  bottom: 36px;
  z-index: 25;
  width: min(420px, calc(100vw - 24px));
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(20, 31, 43, 0.18);
}

.error-panel-title {
  margin-bottom: 8px;
  font-weight: 750;
}

.error-list {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}

.error-list button {
  justify-content: flex-start;
  border-color: #e6edf2;
  background: #f8fafc;
  text-align: left;
}

.command-bank {
  display: none;
}

#errorCount.has-errors {
  color: var(--danger);
  font-weight: 800;
}

@media (max-width: 900px) {
  html,
  body {
    min-width: 0;
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 8px;
  }

  .title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    flex-direction: row;
    min-height: 0;
    gap: 8px;
  }

  .document-identity {
    width: auto;
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 13px;
  }

  h1 {
    max-width: calc(100vw - 176px);
    font-size: 16px;
  }

  .chrome-icon {
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
  }

  .document-identity .chrome-icon {
    display: none;
  }

  .chrome-actions {
    width: auto;
    justify-self: end;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .chrome-actions::-webkit-scrollbar,
  .menu-row::-webkit-scrollbar,
  .toolbar::-webkit-scrollbar,
  .sheet-tabs::-webkit-scrollbar,
  .status-strip::-webkit-scrollbar {
    display: none;
  }

  .local-pill {
    display: none;
  }

  .locale-toggle,
  .user-avatar {
    min-height: 30px;
  }

  .account-menu {
    top: 92px;
    right: 8px;
    width: min(280px, calc(100vw - 16px));
    max-height: 58dvh;
    overflow: auto;
  }

  .menu-row {
    overflow-x: auto;
    padding-left: 0;
    min-height: 34px;
    gap: 3px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .menu-row button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .menu-popover {
    left: 8px !important;
    right: 8px;
    width: auto;
    max-height: 70dvh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .menu-popover button {
    grid-template-columns: 58px 1fr;
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
  }

  .toolbar {
    justify-content: flex-start;
    min-height: 40px;
    border-radius: 16px;
    padding: 4px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tool-group {
    min-height: 32px;
    padding: 0 5px;
  }

  .toolbar button,
  .toolbar .file-button,
  .toolbar .color-button {
    min-height: 32px;
    padding: 0 8px;
    font-size: 13px;
  }

  .toolbar-input {
    width: 76px;
    min-height: 32px;
    padding: 0 8px;
  }

  .toolbar-select {
    width: 96px;
    min-height: 32px;
  }

  .toolbar-menu-button {
    max-width: 104px;
  }

  .toolbar-menu-button.compact {
    width: 50px;
  }

  .toolbar [aria-label="Number formatting"],
  .toolbar [aria-label="Alignment"],
  .toolbar [aria-label="Structure"],
  #zoomOutButton,
  #zoomInButton {
    display: none;
  }

  .toolbar-popover {
    position: fixed;
    left: 8px !important;
    right: 8px;
    top: 148px;
    width: auto;
    max-width: none;
    max-height: 58dvh;
    overflow: auto;
  }

  .color-palette {
    grid-template-columns: repeat(7, 28px);
    width: auto;
  }

  .find-replace-panel {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px;
  }

  .find-replace-panel button {
    min-height: 34px;
  }

  .formula-row {
    grid-template-columns: 56px minmax(0, 1fr) 62px;
    gap: 6px;
    padding: 8px;
  }

  .formula-row button {
    grid-column: auto;
    min-height: 34px;
    padding: 0 8px;
    font-size: 12.5px;
  }

  .name-box,
  .formula-bar {
    min-height: 34px;
    padding: 0 9px;
    font-size: 13px;
  }

  .workspace {
    min-height: 0;
  }

  .sheet-frame {
    min-height: 0;
    height: 100%;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 10px 26px rgba(30, 42, 35, 0.12);
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .sheet-grid {
    font-size: 13px;
  }

  .sheet-grid th,
  .sheet-grid td {
    width: 92px;
    min-width: 92px;
    height: 34px;
  }

  .sheet-grid .corner,
  .sheet-grid .row-head {
    width: 40px;
    min-width: 40px;
  }

  .sheet-grid td.frozen-col,
  .sheet-grid th.frozen-col-head {
    left: 40px;
  }

  .cell-input {
    height: 33px;
    padding: 0 7px;
    font-size: 14px;
    line-height: 33px;
  }

  .fill-handle {
    width: 16px;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    border-radius: 4px;
  }

  .sheet-tabs-bar {
    position: relative;
    bottom: auto;
    min-height: 42px;
    padding: 6px;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
  }

  .sheet-tabs {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sheet-tabs-bar button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .status-strip {
    min-height: 38px;
    overflow-x: auto;
    gap: 10px;
    border-radius: 8px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .status-error-button {
    flex: 0 0 auto;
    margin-left: 0;
  }

  .error-panel {
    right: 0;
    bottom: 42px;
    width: calc(100vw - 16px);
    max-height: 56dvh;
    overflow: auto;
  }

  .toolbar [data-align],
  .toolbar [data-number-format],
  .toolbar [data-decimal],
  #exportXlsxButton {
    display: none;
  }
}

@media (max-width: 520px) {
  .app-shell {
    gap: 5px;
    padding: 6px;
  }

  .sheet-chrome {
    gap: 2px;
    padding-top: 4px;
  }

  .title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
  }

  .document-identity {
    width: auto;
  }

  .document-identity .chrome-icon {
    display: none;
  }

  .document-copy p {
    display: none;
  }

  h1 {
    max-width: calc(100vw - 180px);
    font-size: 17px;
  }

  .chrome-actions {
    width: auto;
    justify-self: end;
  }

  .local-pill {
    display: none;
  }

  .locale-toggle {
    min-width: 82px;
    padding: 0 10px;
  }

  .user-avatar {
    width: 34px;
    height: 34px;
  }

  .account-menu {
    top: 48px;
  }

  .menu-row {
    min-height: 32px;
  }

  .menu-row button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12.5px;
  }

  .toolbar {
    min-height: 38px;
    padding: 3px 5px;
  }

  .tool-group {
    min-height: 30px;
    padding: 0 4px;
  }

  .toolbar button,
  .toolbar .file-button,
  .toolbar .color-button {
    min-height: 30px;
    padding: 0 7px;
  }

  .toolbar [aria-label="Font"],
  .toolbar [aria-label="Text style"] {
    border-right: 0;
  }

  .toolbar [data-align],
  .toolbar [data-number-format],
  .toolbar [data-decimal],
  #exportXlsxButton {
    display: none;
  }

  .formula-row {
    grid-template-columns: 52px minmax(0, 1fr) 58px;
    padding: 6px;
  }

  .formula-row button {
    grid-column: auto;
    min-height: 34px;
    padding: 0 8px;
    font-size: 12.5px;
  }

  .name-box,
  .formula-bar {
    min-height: 34px;
  }

  .sheet-tabs-bar {
    min-height: 40px;
    padding: 5px;
    gap: 5px;
  }

  .sheet-tabs-bar button {
    min-height: 32px;
    padding: 0 9px;
  }

  .sheet-grid th,
  .sheet-grid td {
    width: 86px;
    min-width: 86px;
  }
}
