/* ============================================================
   Excel Replica — chrome styling (Excel 2019/365 colorful theme)
   ============================================================ */

@font-face {
  font-family: "Carlito";
  src: url("../fonts/carlito-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carlito";
  src: url("../fonts/carlito-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Carlito";
  src: url("../fonts/carlito-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Carlito";
  src: url("../fonts/carlito-latin-700-italic.woff2") format("woff2");
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  --xl-green: #217346;
  --xl-green-dark: #185c37;
  --xl-green-darker: #124a2c;
  --xl-green-hover: #2c8452;
  --xl-green-press: #14512f;
  --xl-ribbon-bg: #f3f2f1;
  --xl-ribbon-border: #d2d0ce;
  --xl-btn-hover: #d8d6d4;
  --xl-btn-press: #c6c4c2;
  --xl-btn-checked: #cfcecd;
  --xl-text: #323130;
  --xl-text-dim: #605e5c;
  --xl-grid-line: #d8d9da;
  --xl-header-bg: #f5f5f5;
  --xl-header-border: #d0cfce;
  --xl-header-text: #444444;
  --xl-header-sel-bg: #d2f0e0;
  --xl-header-sel-text: #0c5132;
  --xl-header-full-bg: #217346;
  --xl-sel-fill: rgba(33, 115, 70, 0.08);
  --ui-font: "Segoe UI", "Segoe UI Web (West European)", -apple-system, "Helvetica Neue", "Liberation Sans", Arial, sans-serif;
  --cell-font: "Carlito", "Calibri", "Segoe UI", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--ui-font);
  font-size: 12px;
  color: var(--xl-text);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font-family: inherit; border: none; background: none; cursor: default; }
svg { display: block; }

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ===================== Title bar ===================== */
#titlebar {
  height: 32px;
  background: var(--xl-green);
  display: flex;
  align-items: center;
  color: #fff;
  flex: none;
}
#qat { display: flex; align-items: center; height: 100%; padding-left: 6px; }
#autosave {
  display: flex; align-items: center; gap: 5px;
  height: 100%; padding: 0 8px;
  font-size: 12px;
}
#autosave:hover { background: var(--xl-green-hover); }
.as-toggle {
  width: 26px; height: 14px; border-radius: 7px;
  background: #fff; position: relative; display: inline-block;
}
.as-knob {
  position: absolute; top: 2px; left: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--xl-green);
  transition: left 0.12s ease;
}
#autosave.on .as-knob { left: 14px; }
.qat-sep { width: 1px; height: 16px; background: rgba(255,255,255,0.35); margin: 0 4px; }
.qat-btn {
  width: 30px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.qat-btn svg { width: 15px; height: 15px; }
.qat-btn:hover:not(:disabled) { background: var(--xl-green-hover); }
.qat-btn:active:not(:disabled) { background: var(--xl-green-press); }
.qat-btn:disabled { color: rgba(255,255,255,0.45); }
.qat-drop { padding: 0 4px; height: 100%; display: flex; align-items: center; }
.qat-drop svg { width: 12px; height: 12px; }
.qat-drop:hover { background: var(--xl-green-hover); }
#doc-title {
  flex: none;
  margin: 0 auto;
  font-size: 12px;
  padding: 0 12px;
  white-space: nowrap;
}
#qat, #title-right { flex: 1 1 0; }
#title-right { display: flex; justify-content: flex-end; align-items: center; height: 100%; }
#title-search {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: none;
}
#user-badge {
  width: 26px; height: 26px; border-radius: 50%;
  background: #a6a6a6; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; margin-right: 8px;
}
.win-btn {
  width: 44px; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.win-btn svg { width: 11px; height: 11px; }
.win-btn:hover { background: var(--xl-green-hover); }
.win-close:hover { background: #e81123; }

/* ===================== Ribbon ===================== */
#ribbon { flex: none; background: var(--xl-ribbon-bg); }
#ribbon-tab-row {
  height: 28px;
  background: var(--xl-green);
  display: flex;
  align-items: flex-end;
}
#file-tab {
  height: 100%; padding: 0 16px;
  display: flex; align-items: center;
  color: #fff; font-size: 12px;
}
#file-tab:hover { background: var(--xl-green-hover); }
#file-tab:active { background: var(--xl-green-press); }
#ribbon-tabs { display: flex; height: 100%; }
.ribbon-tab {
  height: 100%; padding: 0 12px;
  display: flex; align-items: center;
  color: #fff; font-size: 12px;
  white-space: nowrap;
}
.ribbon-tab:hover:not(.active) { background: var(--xl-green-hover); }
.ribbon-tab.active {
  background: var(--xl-ribbon-bg);
  color: var(--xl-green);
  font-weight: 600;
}
#ribbon-tab-right { margin-left: auto; display: flex; height: 100%; align-items: center; padding-right: 6px; }
.tab-right-item {
  height: 100%; padding: 0 10px;
  display: flex; align-items: center; gap: 5px;
  color: #fff; font-size: 12px;
}
.tab-right-item svg { width: 14px; height: 14px; }
.tab-right-item:hover { background: var(--xl-green-hover); }
#ribbon-body {
  position: relative;
  border-bottom: 1px solid var(--xl-ribbon-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.07);
}
#ribbon-body.collapsed { display: none; }
#ribbon-content {
  height: 94px;
  display: flex;
  align-items: stretch;
  padding: 2px 4px 0 4px;
  overflow: hidden;
}
#ribbon-collapse {
  position: absolute; right: 4px; bottom: 2px;
  width: 22px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--xl-text-dim);
  border-radius: 2px;
}
#ribbon-collapse svg { width: 12px; height: 12px; }
#ribbon-collapse:hover { background: var(--xl-btn-hover); }

.ribbon-group {
  display: flex;
  flex-direction: column;
  flex: none;
  padding: 0 2px;
  position: relative;
}
.ribbon-group::after {
  content: "";
  position: absolute; right: 0; top: 6px; bottom: 6px;
  width: 1px; background: var(--xl-ribbon-border);
}
.rg-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  padding: 2px 2px 0 2px;
  gap: 1px;
}
.rg-label {
  flex: none;
  text-align: center;
  font-size: 10.5px;
  color: var(--xl-text-dim);
  padding: 1px 12px 3px 12px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.rg-launcher {
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 2px;
  color: var(--xl-text-dim);
  position: absolute; right: 3px; bottom: 3px;
}
.rg-launcher svg { width: 10px; height: 10px; }
.rg-launcher:hover { background: var(--xl-btn-hover); color: var(--xl-text); }

/* big buttons (Paste, etc.) */
.rbtn-big {
  width: 46px;
  height: 74px;
  display: flex; flex-direction: column;
  align-items: center;
  padding-top: 4px;
  border-radius: 2px;
  font-size: 11px;
  color: var(--xl-text);
  text-align: center;
  line-height: 1.15;
}
.rbtn-big svg { width: 28px; height: 28px; margin-bottom: 3px; flex: none; }
.rbtn-big:hover:not(.disabled) { background: var(--xl-btn-hover); }
.rbtn-big:active:not(.disabled), .rbtn-big.pressed { background: var(--xl-btn-press); }
.rbtn-big .drop-arrow { margin-top: 1px; }
.rbtn-big.split { padding: 0; height: 74px; width: 46px; }
.rbtn-big.split .split-top {
  flex: 1; width: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 2px 2px 0 0;
}
.rbtn-big.split .split-top svg { width: 28px; height: 28px; margin: 0; }
.rbtn-big.split .split-bottom {
  width: 100%; padding: 1px 0 3px 0;
  display: flex; flex-direction: column; align-items: center;
  border-radius: 0 0 2px 2px;
}
.rbtn-big.split:hover .split-top, .rbtn-big.split:hover .split-bottom { background: rgba(0,0,0,0.045); }
.rbtn-big.split .split-top:hover, .rbtn-big.split .split-bottom:hover { background: var(--xl-btn-hover) !important; }
.rbtn-big.split .split-top:active, .rbtn-big.split .split-bottom:active { background: var(--xl-btn-press) !important; }

/* small buttons: icon-only or icon+label rows */
.rrow-stack { display: flex; flex-direction: column; justify-content: flex-start; gap: 0; }
.rrow { display: flex; align-items: center; height: 22px; gap: 1px; }
.rbtn {
  height: 22px;
  display: flex; align-items: center;
  padding: 0 3px;
  border-radius: 2px;
  color: var(--xl-text);
  font-size: 11px;
  white-space: nowrap;
  gap: 3px;
}
.rbtn svg { width: 16px; height: 16px; flex: none; }
.rbtn:hover:not(.disabled) { background: var(--xl-btn-hover); }
.rbtn:active:not(.disabled) { background: var(--xl-btn-press); }
.rbtn.checked { background: var(--xl-btn-checked); box-shadow: inset 0 0 0 1px #9d9b99; }
.rbtn.disabled { opacity: 0.4; }
.rbtn .drop-arrow { width: 8px; height: 8px; margin-left: 0; }
.drop-arrow { width: 8px; height: 8px; }
.rbtn-labeled { padding-right: 5px; }

/* split small buttons (border, fill color, font color) */
.rsplit { display: flex; align-items: center; height: 22px; border-radius: 2px; }
.rsplit .rs-main {
  height: 22px; padding: 0 2px;
  display: flex; align-items: center;
  border-radius: 2px 0 0 2px;
}
.rsplit .rs-main svg { width: 16px; height: 16px; }
.rsplit .rs-arrow {
  height: 22px; width: 11px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 0 2px 2px 0;
}
.rsplit .rs-arrow svg { width: 8px; height: 8px; }
.rsplit:hover { background: rgba(0,0,0,0.045); }
.rsplit .rs-main:hover, .rsplit .rs-arrow:hover { background: var(--xl-btn-hover); }
.rsplit .rs-main:active, .rsplit .rs-arrow:active { background: var(--xl-btn-press); }

/* font name / size combo */
.rcombo {
  height: 22px;
  background: #fff;
  border: 1px solid #a19f9d;
  border-radius: 2px;
  display: flex; align-items: center;
}
.rcombo input {
  border: none; outline: none;
  height: 100%;
  font-size: 11.5px;
  font-family: var(--ui-font);
  padding: 0 4px;
  min-width: 0;
  background: transparent;
}
.rcombo .combo-arrow {
  width: 14px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--xl-text-dim);
}
.rcombo .combo-arrow svg { width: 8px; height: 8px; }
.rcombo .combo-arrow:hover { background: var(--xl-btn-hover); }
.rcombo:focus-within { border-color: var(--xl-green); }
#font-name-combo { width: 120px; }
#font-name-combo input { width: 100px; }
#font-size-combo { width: 40px; }
#font-size-combo input { width: 24px; }
#number-format-combo { width: 116px; }
#number-format-combo input { width: 96px; }

.color-bar { position: absolute; left: 2px; right: 2px; bottom: 1px; height: 4px; }

/* ===================== Formula row ===================== */
#formula-row {
  height: 26px;
  display: flex;
  align-items: stretch;
  background: #fff;
  border-bottom: 1px solid var(--xl-ribbon-border);
  flex: none;
  position: relative;
  z-index: 5;
}
#name-box-wrap {
  width: 108px;
  display: flex;
  border-right: 1px solid var(--xl-ribbon-border);
  background: #fff;
}
#name-box {
  flex: 1;
  border: none; outline: none;
  padding: 0 2px 0 8px;
  font-size: 12px;
  font-family: var(--ui-font);
  min-width: 0;
}
#name-box-arrow {
  width: 17px;
  display: flex; align-items: center; justify-content: center;
  color: var(--xl-text-dim);
}
#name-box-arrow svg { width: 10px; height: 10px; }
#name-box-arrow:hover { background: #f0f0f0; }
.fx-sep { width: 1px; background: transparent; }
#fx-buttons { display: flex; border-right: 1px solid transparent; }
#fx-buttons button {
  width: 24px;
  display: flex; align-items: center; justify-content: center;
  color: var(--xl-text-dim);
}
#fx-buttons button svg { width: 11px; height: 11px; }
#fx-buttons button:disabled { color: #c8c6c4; }
#fx-buttons button:not(:disabled):hover { background: #f0f0f0; }
#fx-buttons button:not(:disabled):active { background: #e1e1e1; }
#fx-cancel:not(:disabled) { color: #b04a3f; }
#fx-enter:not(:disabled) { color: #2f6f8f; }
.fx-italic { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 13px; color: #555; }
#formula-bar {
  flex: 1;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--xl-ribbon-border);
  overflow: hidden;
}
#formula-input {
  flex: 1;
  outline: none;
  font-family: var(--cell-font);
  font-size: 12.5px;
  padding: 4px 6px 3px 6px;
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
  user-select: text;
  cursor: text;
}
#formula-input::-webkit-scrollbar { display: none; }
#formula-expand {
  width: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--xl-text-dim);
  border-left: 1px solid var(--xl-ribbon-border);
}
#formula-expand svg { width: 10px; height: 10px; }
#formula-expand:hover { background: #f0f0f0; }

/* ===================== Grid ===================== */
#grid-area {
  flex: 1;
  display: flex;
  min-height: 0;
  background: #fff;
  position: relative;
}
#grid-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
#grid-canvas {
  position: absolute;
  top: 0; left: 0;
  cursor: cell;
}
#cell-editor {
  position: absolute;
  display: none;
  outline: none;
  border: 2px solid #217346;
  background: #fff;
  font-family: var(--cell-font);
  font-size: 14.6px;
  padding: 0 3px;
  white-space: pre;
  overflow: hidden;
  z-index: 30;
  user-select: text;
  cursor: text;
  line-height: normal;
}
#autocomplete {
  position: absolute;
  display: none;
  background: #fff;
  border: 1px solid #c8c6c4;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.25);
  z-index: 50;
  min-width: 180px;
  max-height: 190px;
  overflow-y: auto;
  font-size: 12px;
}
#autocomplete .ac-item {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 4px;
  height: 18px;
  white-space: nowrap;
}
#autocomplete .ac-item svg { width: 13px; height: 13px; flex: none; }
#autocomplete .ac-item.selected { background: #cde6f7; }
#fn-hint {
  position: absolute;
  display: none;
  background: #fff;
  border: 1px solid #c8c6c4;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.2);
  padding: 3px 8px;
  font-size: 11.5px;
  color: var(--xl-text-dim);
  z-index: 49;
  white-space: nowrap;
}
#fn-hint b { color: var(--xl-text); font-weight: 700; }
#fn-hint .ac-desc { color: var(--xl-text-dim); }
#drag-tip {
  position: absolute;
  display: none;
  background: #fff;
  border: 1px solid #c8c6c4;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.2);
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--cell-font);
  color: var(--xl-text);
  z-index: 40;
  pointer-events: none;
  white-space: nowrap;
}

/* scrollbars */
#vscroll {
  width: 15px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: #f1f1f1;
  border-left: 1px solid #e0e0e0;
}
.scroll-arrow {
  height: 15px; width: 15px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #8b8b8b;
}
.scroll-arrow svg { width: 9px; height: 9px; }
.scroll-arrow:hover { background: #d8d8d8; color: #333; }
.scroll-arrow:active { background: #c0c0c0; }
#vscroll-track { flex: 1; position: relative; }
#vscroll-thumb {
  position: absolute;
  left: 2px; right: 2px;
  background: #c1c1c1;
  border-radius: 0;
  min-height: 18px;
}
#vscroll-thumb:hover { background: #a8a8a8; }
#vscroll-thumb.dragging { background: #909090; }
#hscroll {
  width: 220px;
  flex: none;
  display: flex;
  background: #f1f1f1;
  border-left: 1px solid #e0e0e0;
}
#hscroll-track { flex: 1; position: relative; }
#hscroll-thumb {
  position: absolute;
  top: 2px; bottom: 2px;
  background: #c1c1c1;
  min-width: 18px;
}
#hscroll-thumb:hover { background: #a8a8a8; }
#hscroll-thumb.dragging { background: #909090; }

/* ===================== Sheet bar ===================== */
#sheetbar {
  height: 25px;
  flex: none;
  display: flex;
  align-items: stretch;
  background: #f7f7f7;
  border-top: 1px solid #cfcfcf;
  overflow: hidden;
}
#sheet-nav { display: flex; align-items: center; padding: 0 2px; }
.snav {
  width: 20px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #7a7a7a;
}
.snav svg { width: 10px; height: 10px; }
.snav:hover { background: #e2e2e2; color: #333; }
.snav.disabled { color: #c4c4c4; pointer-events: none; }
#sheet-tabs {
  display: flex;
  align-items: stretch;
  overflow: hidden;
  flex: none;
  max-width: 60%;
}
.sheet-tab {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  color: #444;
  background: #f7f7f7;
  border-right: 1px solid #d5d5d5;
  position: relative;
  white-space: nowrap;
}
.sheet-tab:hover:not(.active) { background: #ffffff; color: var(--xl-green); }
.sheet-tab.active {
  background: #ffffff;
  color: var(--xl-green-dark);
  font-weight: 700;
  box-shadow: inset 0 2px 0 var(--xl-green);
  border-top: none;
}
.sheet-tab.drag-over-left::before {
  content: ""; position: absolute; left: -1px; top: 3px; bottom: 3px;
  width: 2px; background: var(--xl-green);
}
.sheet-tab.drag-over-right::after {
  content: ""; position: absolute; right: -1px; top: 3px; bottom: 3px;
  width: 2px; background: var(--xl-green);
}
.sheet-tab .tab-color {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
}
.sheet-tab input {
  border: none; outline: 1px solid var(--xl-green);
  font-size: 12px; font-family: var(--ui-font);
  width: 70px;
  padding: 1px 2px;
}
#add-sheet {
  width: 24px;
  display: flex; align-items: center; justify-content: center;
  color: #666;
}
#add-sheet svg { width: 13px; height: 13px; }
#add-sheet:hover { background: #e2e2e2; color: var(--xl-green); }
#sheetbar-fill { flex: 1; }

/* ===================== Status bar ===================== */
#statusbar {
  height: 22px;
  flex: none;
  background: var(--xl-green);
  color: #fff;
  display: flex;
  align-items: center;
  font-size: 11.5px;
}
#status-mode {
  padding: 0 12px 0 10px;
  min-width: 64px;
}
#status-a11y {
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px;
  height: 100%;
}
#status-a11y svg { width: 12px; height: 12px; }
#status-a11y:hover { background: var(--xl-green-hover); }
#status-circ {
  display: flex; align-items: center;
  padding: 0 10px;
  height: 100%;
  cursor: pointer;
  white-space: nowrap;
}
#status-circ:hover { background: var(--xl-green-hover); }
#status-fill { flex: 1; }
#status-stats { display: flex; height: 100%; }
#status-stats .stat {
  padding: 0 10px;
  display: flex; align-items: center;
  height: 100%;
  white-space: nowrap;
}
#status-stats .stat:hover { background: var(--xl-green-hover); }
#status-views { display: flex; height: 100%; margin-left: 6px; }
.sview {
  width: 26px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.9);
}
.sview svg { width: 13px; height: 13px; }
.sview:hover { background: var(--xl-green-hover); }
.sview.active { background: var(--xl-green-press); }
#zoom-controls {
  display: flex; align-items: center;
  height: 100%;
  padding-right: 6px;
}
#zoom-out, #zoom-in {
  width: 22px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
#zoom-out:hover, #zoom-in:hover { background: var(--xl-green-hover); }
#zoom-slider {
  width: 100px; height: 100%;
  position: relative;
  display: flex; align-items: center;
}
#zoom-track {
  position: absolute; left: 4px; right: 4px;
  height: 2px; background: rgba(255,255,255,0.55);
}
#zoom-mid {
  position: absolute; left: 50%; top: 5px; bottom: 5px;
  width: 1px; background: rgba(255,255,255,0.7);
}
#zoom-thumb {
  position: absolute;
  width: 8px; height: 14px;
  background: #f3f2f1;
  border: 1px solid #999;
  top: 4px;
  margin-left: -4px;
}
#zoom-level {
  min-width: 44px;
  text-align: right;
  padding: 0 6px;
  height: 100%;
  display: flex; align-items: center; justify-content: flex-end;
}
#zoom-level:hover { background: var(--xl-green-hover); }

/* ===================== Menus ===================== */
#menu-layer { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.menu {
  position: absolute;
  background: #ffffff;
  border: 1px solid #c8c6c4;
  box-shadow: 3px 3px 8px rgba(0,0,0,0.3);
  padding: 2px 0;
  min-width: 180px;
  pointer-events: auto;
  font-size: 12px;
  color: var(--xl-text);
  max-height: 80vh;
  overflow-y: auto;
}
.menu-item {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 14px 0 4px;
  gap: 6px;
  white-space: nowrap;
  position: relative;
}
.menu-item .mi-icon {
  width: 22px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.menu-item .mi-icon svg { width: 16px; height: 16px; }
.menu-item:hover:not(.disabled) { background: #f0f0f0; }
.menu-item.disabled { color: #a19f9d; }
.menu-item .mi-label { flex: 1; }
.menu-item .mi-shortcut { color: #8a8886; margin-left: 24px; font-size: 11px; }
.menu-item .mi-sub { margin-left: 18px; }
.menu-item .mi-sub svg { width: 9px; height: 9px; }
.menu-item .mi-check { width: 14px; text-align: center; }
.menu-sep { height: 1px; background: #e1dfdd; margin: 3px 6px; }
.menu-title {
  padding: 4px 10px 3px 10px;
  font-weight: 600;
  color: var(--xl-text-dim);
  font-size: 11px;
}
.menu input.menu-inline-input {
  margin: 4px 10px;
  width: calc(100% - 20px);
  border: 1px solid #a19f9d;
  padding: 2px 4px;
  font-size: 12px;
  font-family: var(--ui-font);
}

/* color palette inside menus */
.color-palette { padding: 4px 8px; }
.cp-row { display: flex; gap: 2px; margin-bottom: 2px; }
.cp-swatch {
  width: 15px; height: 15px;
  border: 1px solid rgba(0,0,0,0.18);
}
.cp-swatch:hover { outline: 2px solid #f2a33c; outline-offset: 0; position: relative; z-index: 2; }
.cp-label { font-size: 11px; color: var(--xl-text-dim); padding: 3px 0 2px 0; }
.cp-theme-col { display: flex; flex-direction: column; gap: 0; }
.cp-theme-col .cp-swatch { border-top: none; }
.cp-theme-col .cp-swatch:first-child { border-top: 1px solid rgba(0,0,0,0.18); margin-bottom: 3px; }

/* filter dropdown */
.filter-menu { min-width: 220px; padding-bottom: 6px; }
.filter-list {
  margin: 4px 10px;
  border: 1px solid #c8c6c4;
  max-height: 150px;
  overflow-y: auto;
  padding: 2px 4px;
  background: #fff;
}
.filter-item { display: flex; align-items: center; gap: 5px; height: 19px; font-size: 12px; }
.filter-buttons { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 10px 2px 10px; }
.filter-buttons button {
  border: 1px solid #a19f9d;
  background: #fff;
  padding: 3px 14px;
  font-size: 12px;
  border-radius: 2px;
}
.filter-buttons button:hover { border-color: var(--xl-green); background: #f3f9f5; }
.filter-buttons button.primary { background: var(--xl-green); border-color: var(--xl-green); color: #fff; }

/* dropdown panels (font list etc.) */
.dropdown-list { max-height: 320px; overflow-y: auto; min-width: 160px; }
.dd-item {
  padding: 3px 12px;
  white-space: nowrap;
}
.dd-item:hover, .dd-item.selected { background: #f0f0f0; }

/* ===================== Dialogs ===================== */
#dialog-layer {
  position: fixed; inset: 0;
  z-index: 2000;
  display: none;
  background: rgba(255,255,255,0.0);
}
#dialog-layer.visible { display: block; }
.dialog {
  position: absolute;
  background: #ffffff;
  border: 1px solid #8a8886;
  box-shadow: 4px 6px 14px rgba(0,0,0,0.35);
  font-size: 12px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
}
.dialog-title {
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 4px 0 10px;
  font-size: 12px;
  background: #fff;
  border-bottom: 1px solid #e1dfdd;
  flex: none;
}
.dialog-title .dt-label { flex: 1; }
.dialog-title .dt-close {
  width: 30px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #555;
}
.dialog-title .dt-close svg { width: 10px; height: 10px; }
.dialog-title .dt-close:hover { background: #e81123; color: #fff; }
.dialog-body { padding: 10px 12px; flex: 1; overflow: auto; }
.dialog-footer {
  padding: 8px 12px 10px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
}
.dialog-footer button {
  min-width: 72px;
  padding: 4px 12px;
  border: 1px solid #a19f9d;
  background: #fff;
  font-size: 12px;
  border-radius: 2px;
}
.dialog-footer button:hover { border-color: var(--xl-green); }
.dialog-footer button.primary {
  background: var(--xl-green);
  border-color: var(--xl-green);
  color: #fff;
}
.dialog-footer button.primary:hover { background: var(--xl-green-dark); }
.dialog label { display: flex; align-items: center; gap: 6px; }
.dialog input[type="text"], .dialog input[type="number"], .dialog select {
  border: 1px solid #a19f9d;
  padding: 3px 5px;
  font-size: 12px;
  font-family: var(--ui-font);
  border-radius: 2px;
  outline: none;
}
.dialog input:focus, .dialog select:focus { border-color: var(--xl-green); }

/* Format Cells dialog */
.fc-tabs {
  display: flex;
  border-bottom: 1px solid #c8c6c4;
  padding: 6px 8px 0 8px;
  gap: 2px;
}
.fc-tab {
  padding: 4px 12px;
  border: 1px solid transparent;
  border-bottom: none;
  font-size: 12px;
}
.fc-tab.active {
  border-color: #c8c6c4;
  background: #fff;
  position: relative;
  top: 1px;
}
.fc-tab:hover:not(.active) { background: #f0f0f0; }
.fc-body { padding: 12px; min-height: 300px; }
.fc-cat-list {
  width: 110px;
  border: 1px solid #c8c6c4;
  height: 240px;
  overflow-y: auto;
}
.fc-cat {
  padding: 3px 8px;
}
.fc-cat.selected { background: var(--xl-green); color: #fff; }
.fc-cat:hover:not(.selected) { background: #f0f0f0; }
.fc-sample {
  border: 1px solid #c8c6c4;
  padding: 4px 8px;
  min-height: 22px;
  font-family: var(--cell-font);
  margin-bottom: 10px;
  background: #fff;
}
.fc-grid-2col { display: flex; gap: 14px; }
.fc-right { flex: 1; }
.fc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.fc-formats-list {
  border: 1px solid #c8c6c4;
  height: 150px;
  overflow-y: auto;
  font-family: var(--ui-font);
}
.fc-fmt-item { padding: 2px 8px; font-family: var(--cell-font); }
.fc-fmt-item.selected { background: var(--xl-green); color: #fff; }
.fc-fmt-item:hover:not(.selected) { background: #f0f0f0; }
.fc-note { color: var(--xl-text-dim); font-size: 11px; margin-top: 8px; line-height: 1.4; }
.border-preset {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 4px 8px; border: 1px solid transparent; border-radius: 2px;
  gap: 2px; font-size: 11px; color: var(--xl-text-dim);
}
.border-preset:hover { background: #f0f0f0; }
.border-preset svg { width: 26px; height: 26px; }

/* generic focus ring suppression */
:focus { outline: none; }

::selection { background: #b5d7c4; }
#cell-editor::selection, #cell-editor *::selection,
#formula-input::selection, #formula-input *::selection { background: #bfd9ea; }
