/* ============================================================
   Excel 2003 Chrome
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Verdana', 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: 11px;
  color: #000;
  background: #D4D0C8;
  -webkit-font-smoothing: auto;
}

#excel-window {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 2px solid;
  border-color: #FFF #808080 #808080 #FFF;
}

/* ---- Title Bar ---- */
#title-bar {
  height: 26px;
  background: linear-gradient(180deg, #0A246A 0%, #3168D5 8%, #4E91E2 40%, #3168D5 88%, #0A246A 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px;
  flex-shrink: 0;
  user-select: none;
}

#title-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  background: #217346;
  border: 1px solid #185C37;
  border-radius: 1px;
  font-size: 9px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

#title-text {
  color: #FFF;
  font-weight: bold;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-left: 2px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

#window-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.win-btn {
  width: 21px;
  height: 21px;
  font-size: 11px;
  line-height: 21px;
  text-align: center;
  background: linear-gradient(180deg, #D6DFF7 0%, #ADBEE5 45%, #8DA3D6 50%, #7F99D2 100%);
  border: 1px solid;
  border-color: #FFF #3168D5 #3168D5 #FFF;
  border-radius: 2px;
  color: #0A246A;
  cursor: default;
  padding: 0;
  font-family: inherit;
}

.win-btn.close {
  background: linear-gradient(180deg, #E8A49C 0%, #D27268 45%, #C44F44 50%, #BE4B3F 100%);
  border-color: #FFF #943A32 #943A32 #FFF;
  color: #FFF;
  font-weight: bold;
}

/* ---- Menu Bar ---- */
#menu-bar {
  height: 22px;
  background: #D4D0C8;
  display: flex;
  align-items: center;
  padding: 0 2px;
  flex-shrink: 0;
  border-bottom: 1px solid #808080;
}

.menu-item {
  padding: 2px 7px;
  cursor: default;
  user-select: none;
  font-size: 11px;
}

.menu-item:hover {
  background: #316AC5;
  color: #FFF;
}

/* ---- Toolbar ---- */
#toolbar {
  min-height: 28px;
  background: #D4D0C8;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid #808080;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 1px;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: #808080;
  margin: 0 4px;
  border-right: 1px solid #FFF;
}

.tool-btn {
  min-width: 23px;
  height: 22px;
  background: transparent;
  border: 1px solid transparent;
  cursor: default;
  font-family: inherit;
  font-size: 11px;
  padding: 0 3px;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:hover {
  border-color: #FFF #808080 #808080 #FFF;
  background: #E0DED6;
}

.tool-btn:active {
  border-color: #808080 #FFF #FFF #808080;
}

.font-select {
  width: 108px;
  height: 20px;
  font-family: inherit;
  font-size: 11px;
  border: 1px solid;
  border-color: #808080 #FFF #FFF #808080;
  background: #FFF;
  padding: 0 2px;
  -webkit-appearance: none;
  appearance: none;
  cursor: default;
}

.size-select {
  width: 38px;
  height: 20px;
  font-family: inherit;
  font-size: 11px;
  border: 1px solid;
  border-color: #808080 #FFF #FFF #808080;
  background: #FFF;
  margin-left: 3px;
  padding: 0 2px;
  -webkit-appearance: none;
  appearance: none;
  cursor: default;
}

/* ---- Formula Bar ---- */
#formula-bar {
  height: 26px;
  background: #D4D0C8;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid #808080;
}

#cell-name {
  width: 60px;
  height: 20px;
  background: #FFF;
  border: 1px solid;
  border-color: #808080 #FFF #FFF #808080;
  text-align: center;
  line-height: 20px;
  font-size: 11px;
  margin: 0 2px;
  flex-shrink: 0;
}

#formula-separator {
  width: 1px;
  height: 20px;
  background: #808080;
  margin: 0 2px;
  border-right: 1px solid #FFF;
}

#formula-input {
  flex: 1;
  height: 20px;
  background: #FFF;
  border: 1px solid;
  border-color: #808080 #FFF #FFF #808080;
  line-height: 20px;
  padding: 0 4px;
  font-size: 11px;
  font-family: inherit;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-right: 2px;
}

#excel-window.fullscreen {
  border: none;
}

/* ---- Toolbar Mini-Icons (pure CSS, Win2003 style) ---- */
.icon-btn {
  padding: 2px;
}

.tb-icon {
  display: block;
  width: 16px;
  height: 16px;
  position: relative;
}

.new-icon {
  background: #FFF;
  border: 1px solid #808080;
  border-top-color: #C0C0C0;
  border-left-color: #C0C0C0;
}
.new-icon::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 5px 5px 0;
  border-color: transparent #D4D0C8 transparent transparent;
}

.open-icon {
  background: #FFD659;
  border: 1px solid #996600;
  border-radius: 1px;
  height: 12px;
  margin-top: 4px;
}
.open-icon::before {
  content: '';
  position: absolute;
  top: -4px; left: 0;
  width: 7px; height: 4px;
  background: #FFD659;
  border: 1px solid #996600;
  border-bottom: none;
  border-radius: 1px 1px 0 0;
}

.save-icon {
  background: #3366CC;
  border: 1px solid #1A3366;
  border-radius: 1px;
}
.save-icon::before {
  content: '';
  position: absolute;
  top: 1px; left: 3px;
  width: 8px; height: 5px;
  background: #D4D0C8;
}
.save-icon::after {
  content: '';
  position: absolute;
  bottom: 1px; left: 2px;
  width: 10px; height: 6px;
  background: #FFF;
  border: 1px solid #808080;
}

.print-icon {
  background: #E8E8E8;
  border: 1px solid #808080;
  height: 10px;
  margin-top: 6px;
  border-radius: 1px 1px 0 0;
}
.print-icon::before {
  content: '';
  position: absolute;
  top: -5px; left: 2px;
  width: 10px; height: 5px;
  background: #FFF;
  border: 1px solid #C0C0C0;
}
.print-icon::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 2px;
  width: 10px; height: 3px;
  background: #FFF;
  border: 1px solid #C0C0C0;
}

.copy-icon {
  border: 1px solid #808080;
  background: #FFF;
  width: 12px; height: 12px;
}
.copy-icon::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border: 1px solid #808080;
  background: #FFF;
}

.paste-icon {
  background: #FFD659;
  border: 1px solid #996600;
  border-radius: 1px;
  width: 10px;
}
.paste-icon::after {
  content: '';
  position: absolute;
  top: 2px; right: -4px;
  width: 10px; height: 12px;
  background: #FFF;
  border: 1px solid #808080;
}

.align-btn {
  padding: 3px 4px;
}

.align-lines {
  display: block;
  width: 14px;
  height: 12px;
  position: relative;
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
}
.align-lines::before,
.align-lines::after {
  content: '';
  position: absolute;
  height: 2px;
  background: #000;
}
.align-lines::before { top: 2px; }
.align-lines::after  { top: 6px; }

.align-lines.left::before { left: 0; width: 10px; }
.align-lines.left::after  { left: 0; width: 12px; }

.align-lines.center::before { left: 2px; width: 10px; }
.align-lines.center::after  { left: 1px; width: 12px; }

.align-lines.right::before { right: 0; left: auto; width: 10px; }
.align-lines.right::after  { right: 0; left: auto; width: 12px; }

/* Toggle buttons (CAM / SEG) */
.toggle-btn {
  font-size: 9px;
  font-weight: bold;
  padding: 0 4px;
  min-width: 30px;
  letter-spacing: 0.5px;
}
.toggle-btn.active {
  background: #C0D0A0;
  border-color: #808080 #FFF #FFF #808080;
}
.toggle-btn:not(.active) {
  background: #D4D0C8;
  color: #808080;
}
