* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  font-family: "Malgun Gothic", "맑은 고딕", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* title bar */
.title-bar {
  height: 30px;
  background: #185432;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  flex: 0 0 auto;
}
.tb-icon { width: 16px; height: 16px; }

/* ribbon tabs */
.ribbon-tabs {
  background: #217346;
  color: #e8f3ec;
  display: flex;
  gap: 2px;
  font-size: 12px;
  padding: 4px 8px 0 8px;
  flex: 0 0 auto;
  overflow-x: auto;
  white-space: nowrap;
}
.ribbon-tabs span {
  padding: 5px 10px;
  border-radius: 3px 3px 0 0;
}
.ribbon-tabs span.active {
  background: #fff;
  color: #217346;
  font-weight: 600;
}

/* ribbon */
.ribbon {
  background: #fff;
  border-bottom: 1px solid #d0d0d0;
  display: flex;
  align-items: stretch;
  padding: 4px 6px;
  gap: 6px;
  flex: 0 0 auto;
  overflow-x: auto;
}
.ribbon-group {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-width: 46px;
}
.ribbon-row {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.font-row { gap: 2px; }
.ribbon-label {
  font-size: 9px;
  color: #555;
  margin-top: 2px;
  white-space: nowrap;
}
.ribbon .ico {
  font-size: 13px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  color: #333;
}
.ribbon .ico.i { font-style: italic; }
.ribbon .ico.u { text-decoration: underline; }
.ribbon-sep {
  width: 1px;
  background: #e0e0e0;
  margin: 2px 2px;
}
.fake-select {
  font-size: 11px;
  border: 1px solid #d0d0d0;
  border-radius: 2px;
  padding: 1px 2px;
  color: #333;
  background: #fff;
}
.fake-select.wide { width: 84px; }

/* formula bar */
.formula-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #d0d0d0;
  height: 26px;
  flex: 0 0 auto;
  font-size: 12px;
}
.name-box {
  width: 60px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #d0d0d0;
  color: #333;
}
.fx-btn {
  width: 26px;
  text-align: center;
  color: #217346;
  font-style: italic;
  border-right: 1px solid #d0d0d0;
  font-size: 11px;
}
.formula-input {
  flex: 1;
  padding-left: 8px;
  color: #222;
  overflow: hidden;
  white-space: nowrap;
}

/* grid */
.grid-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
  background: #fff;
}
.sheet-grid {
  display: grid;
  font-size: 12px;
  color: #1c1c1c;
}
.cell {
  border-right: 1px solid #e1e3e6;
  border-bottom: 1px solid #e1e3e6;
  display: flex;
  align-items: center;
  padding: 0 6px;
  white-space: nowrap;
  overflow: visible;
  background: #fff;
  position: relative;
}
.cell.num { justify-content: flex-end; }
.cell.center { justify-content: center; }

.col-head, .row-head {
  background: #f3f2f1;
  color: #616161;
  font-weight: 600;
  justify-content: center;
  position: sticky;
  z-index: 3;
  border-right: 1px solid #d6d6d6;
  border-bottom: 1px solid #d6d6d6;
}
.col-head { top: 0; text-align: center; }
.row-head { left: 0; text-align: center; }
.corner {
  position: sticky;
  top: 0; left: 0;
  z-index: 4;
  background: #f3f2f1;
  border-right: 1px solid #d6d6d6;
  border-bottom: 1px solid #d6d6d6;
}

.cell.up { color: #d21f1f; }
.cell.down { color: #1a5fd0; }
.cell.header-row { font-weight: 700; background: #eaf3ee; }
.cell.title-cell { font-weight: 700; font-size: 14px; overflow: visible; }
.cell.section { font-weight: 700; background: #f7f7f7; }

.cell.selected {
  outline: 2px solid #217346;
  outline-offset: -1px;
  z-index: 2;
}

/* chart sheet */
.chart-panel {
  flex: 1;
  overflow: auto;
  background: #e8e8e8;
  padding: 16px;
}
.chart-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #333;
}
.chart-select { min-width: 160px; }
.chart-obj {
  position: relative;
  background: #fff;
  border: 1px solid #b0b0b0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 20px 10px;
}
.chart-handle {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #fff;
  border: 1px solid #217346;
  z-index: 5;
}
.chart-handle.tl { top: -4px; left: -4px; }
.chart-handle.tm { top: -4px; left: 50%; margin-left: -4px; }
.chart-handle.tr { top: -4px; right: -4px; }
.chart-handle.ml { top: 50%; left: -4px; margin-top: -4px; }
.chart-handle.mr { top: 50%; right: -4px; margin-top: -4px; }
.chart-handle.bl { bottom: -4px; left: -4px; }
.chart-handle.bm { bottom: -4px; left: 50%; margin-left: -4px; }
.chart-handle.br { bottom: -4px; right: -4px; }
.chart-title {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  margin-bottom: 6px;
}
.chart-svg-wrap { width: 100%; }
.chart-svg-wrap svg { width: 100%; height: auto; display: block; }
.chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: #444;
  padding: 6px 0 2px;
}
.chart-legend .swatch {
  width: 10px; height: 10px;
  display: inline-block;
}

/* approval box (결재란) */
.cell.appr-head {
  font-weight: 700;
  font-size: 10px;
  background: #f3f2f1;
  justify-content: center;
  text-align: center;
}
.cell.appr-sign {
  background: #fff;
}

/* sheet tabs */
.sheet-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f3f2f1;
  border-top: 1px solid #d0d0d0;
  padding: 3px 6px;
  font-size: 11px;
  flex: 0 0 auto;
}
.stab {
  padding: 4px 12px;
  border-radius: 2px;
  color: #444;
}
.stab.active {
  background: #fff;
  border-top: 2px solid #217346;
  color: #217346;
  font-weight: 600;
}
.stab.add { font-weight: 700; color: #217346; padding: 4px 8px; }

/* status bar */
.status-bar {
  height: 22px;
  background: #185432;
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex: 0 0 auto;
}
