/* 제목 없는 스프레드시트: 공통 배치. 색은 themes/*.css의 변수로만 바뀐다.
 * 원칙: 애니메이션·트랜지션 없음. 상태 변화는 셀 배경색과 글자만. */
*, *::before, *::after {
  box-sizing: border-box;
  transition: none !important;
  animation: none !important;
}
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #FFFFFF;
}
body {
  font-family: "Malgun Gothic", "맑은 고딕", "Segoe UI", system-ui, sans-serif;
  font-size: 12px;
  color: #222326;
  -webkit-font-smoothing: auto;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100vh; }
#topbar { flex: none; position: relative; z-index: 20; }

/* ---------- 수식 줄 ---------- */
#fxbar {
  flex: none; display: flex; align-items: center; gap: 0;
  height: 28px; padding: 0 6px;
  background: #FFFFFF; border-bottom: 1px solid #D9D9D9;
}
#namebox {
  width: 92px; height: 20px; padding: 0 6px;
  border: 1px solid #D0D0D0; border-radius: 0; background: #FFFFFF; outline: none;
}
.fx-label {
  padding: 0 10px; margin-left: 6px; color: #8A8A8A; font-style: italic;
  border-left: 1px solid #D9D9D9; line-height: 20px;
}
#fx { flex: 1; height: 20px; border: none; outline: none; background: transparent; }

/* ---------- 격자 ---------- */
#grid-host { flex: 1; position: relative; overflow: hidden; background: #FFFFFF; }
.sg { position: absolute; inset: 0; overflow: hidden; }
.sg table { border-collapse: collapse; table-layout: fixed; }
.sg th, .sg td {
  border: 1px solid #E5E5E5; padding: 0 4px;
  white-space: nowrap; font-weight: normal; vertical-align: middle;
}
.sg th {
  background: var(--hdr-bg); color: var(--hdr-fg);
  font-size: 11px; text-align: center; border-color: #DADADA; padding: 0;
  overflow: hidden; user-select: none;
}
.sg th.corner { background: var(--hdr-bg); }
.sg th.hl { background: var(--hdr-hl-bg); color: var(--hdr-hl-fg); }
.sg td { overflow: visible; cursor: cell; }
.sg td .cv { position: relative; z-index: 1; }
.sg td.clip { overflow: hidden; }
.sg td.act { cursor: pointer; }
.sg td.muted { color: #8A8A8A; }
.sg td.head { background: var(--head-bg); color: var(--head-fg); font-weight: 700; }
.sg td.num { text-align: right; }
.sg tr:hover td.ri { background: var(--row-hover); cursor: pointer; }
.sg td.btn { cursor: pointer; color: var(--link-fg); }
.sg td.btn:hover { background: var(--row-hover); }
.sg td.on { background: var(--soft); font-weight: 700; }
.sg td.input { padding: 0; }
.sg td.input input, .sg td.input select {
  width: 100%; height: 100%; border: none; outline: none; padding: 0 4px; background: #FFFFFF;
}
.sg td.input input:focus, .sg td.input select:focus { background: #FFFDF5; }

.sg-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 2; }
.ov { position: absolute; pointer-events: none; }
.ov-sel { border: 2px solid var(--sel); }
.ov-range { border: 1px solid #A6A6A6; }
.ov-board { border: 1px solid #9E9E9E; }
.ov-card { border: 1px solid #C6C6C6; }

/* 시트 위에 놓인 개체: 그림자·둥근 모서리 최소화 */
.obj { position: absolute; z-index: 3; }
.obj-card {
  background: #FFFFFF; border: 1px solid #C6C6C6; padding: 10px 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
}
.obj-card:hover { background: var(--row-hover); }
.obj-card.on { border: 2px solid var(--sel); background: var(--soft); padding: 9px 11px; }
.obj-card .card-title { font-weight: 700; font-size: 13px; }
.obj-card .card-sub { color: #6B6B6B; }
.cellbtn {
  display: flex; align-items: center; justify-content: center;
  background: #FFFFFF; border: 1px solid #C6C6C6; cursor: pointer; padding: 0 6px;
  white-space: nowrap; overflow: hidden;
}
.cellbtn:hover { background: var(--row-hover); }
.cellbtn.primary { background: var(--soft); border-color: var(--sel); font-weight: 700; }
.cellbtn[disabled] { color: #A0A0A0; cursor: default; background: #FAFAFA; }

/* 알림 미리보기 카드 */
.notif-card { background: #FFFFFF; border: 1px solid #C6C6C6; padding: 10px; width: 300px; }
.notif-card .nc-row { display: flex; gap: 10px; align-items: flex-start; }
.notif-card .nc-icon { width: 32px; height: 32px; flex: none; }
.notif-card .nc-title { font-weight: 700; }
.notif-card .nc-body { color: #444; margin-top: 2px; white-space: normal; }
.notif-card .nc-meta { color: #8A8A8A; margin-top: 4px; font-size: 11px; }
.notif-card .nc-ask { margin-top: 10px; padding-top: 8px; border-top: 1px solid #E5E5E5; }
.notif-card .nc-actions { display: flex; gap: 6px; margin-top: 6px; }
.notif-card .nc-actions .cellbtn { height: 22px; flex: 1; }

/* ---------- 시트 탭 ---------- */
#tabs {
  flex: none; height: 28px; display: flex; align-items: stretch;
  background: var(--tabs-bg); border-top: 1px solid #D9D9D9; user-select: none;
}
#tabs .tab-btn {
  width: 30px; display: flex; align-items: center; justify-content: center; color: #6B6B6B; font-size: 13px;
}
#tabs .tab {
  display: flex; align-items: center; padding: 0 14px; cursor: pointer; color: var(--tab-fg);
  border-right: 1px solid #DADADA;
}
#tabs .tab:hover { background: var(--tab-hover); }
#tabs .tab.on {
  background: var(--tab-active-bg); color: var(--tab-active-fg); font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--tab-line);
}
#tabs .tab.off { color: #A8A8A8; cursor: default; }

/* ---------- 상태바 ---------- */
#statusbar {
  flex: none; height: 22px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; background: var(--status-bg); color: var(--status-fg); border-top: 1px solid #D9D9D9;
  white-space: nowrap; overflow: hidden;
}
#st-right span { margin-left: 18px; }

/* ---------- 메뉴 드롭다운 ---------- */
.menu-item { cursor: default; user-select: none; }
.dropdown {
  position: fixed; z-index: 50; min-width: 240px; max-width: 460px;
  background: #FFFFFF; border: 1px solid #BDBDBD; padding: 4px 0; color: #222326;
}
.dropdown .dd-item {
  display: flex; justify-content: space-between; gap: 24px; padding: 5px 16px 5px 28px; cursor: pointer;
  position: relative; white-space: nowrap;
}
.dropdown .dd-item:hover { background: var(--row-hover); }
.dropdown .dd-item.disabled { color: #9A9A9A; cursor: default; white-space: normal; }
.dropdown .dd-item.disabled:hover { background: transparent; }
.dropdown .dd-item .dd-hint { color: #8A8A8A; }
.dropdown .dd-item.checked::before { content: "✓"; position: absolute; left: 10px; }
.dropdown .dd-head { padding: 6px 16px 4px 16px; color: #8A8A8A; font-size: 11px; }
.dropdown .dd-sep { height: 1px; background: #E5E5E5; margin: 4px 0; }

/* 문서 제목 바꾸기 */
.doc-title { cursor: text; padding: 1px 4px; border: 1px solid transparent; }
.doc-title:hover { border-color: var(--title-hover); }
.doc-title-input { font: inherit; padding: 1px 4px; border: 1px solid var(--sel); outline: none; min-width: 220px; color: #222326; background: #FFFFFF; }

/* 시트 위 입력 칸 */
.obj-input { border: 1px solid #C6C6C6; padding: 0 6px; background: #FFFFFF; outline: none; height: 100%; width: 100%; }
.obj-input:focus { border-color: var(--sel); }

/* 초기 설정: 테마 카드 안의 작은 상단 미리보기 */
.mini { height: 24px; display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 11px; }
.mini img { width: 14px; height: 14px; }
.mini-dark { background: #2B7A57; color: #FFFFFF; }
.mini-light { background: #FFFFFF; color: #222326; border: 1px solid #E1E3E6; }
.mini-menu { height: 18px; display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 10px; }
.mini-menu.dark { background: #2B7A57; color: #FFFFFF; }
.mini-menu.light { background: #FFFFFF; color: #5E6166; }
.card-logo { width: 40px; height: 40px; }
.ri-icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 6px; }
