:root {
  --bg: #ffffff;
  --sidebar: #f7f8fa;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --today: #ef4444;
  --danger: #dc2626;
  font-family: "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

.calendar-app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  background: var(--panel);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--sidebar);
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  overflow: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1rem;
}

.folder-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.folder-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.folder-card.drop-target {
  border-color: #93c5fd;
  background: #f8fbff;
}

.folder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.folder-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.folder-name {
  font-size: 0.84rem;
  font-weight: 700;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collapse-btn {
  width: 22px;
  min-width: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  line-height: 1;
}

.project-visibility-btn {
  min-width: 40px;
  font-size: 0.68rem;
  padding: 3px 6px;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 0.72rem;
  padding: 4px 6px;
  min-width: 24px;
  height: 22px;
  cursor: pointer;
  line-height: 1;
}

.icon-btn.danger {
  color: #b91c1c;
}

.inline-edit {
  width: 100%;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.82rem;
}

.calendar-items {
  display: grid;
  gap: 6px;
}

.calendar-items[hidden] {
  display: none;
}

.calendar-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.calendar-item.dragging {
  opacity: 0.5;
}

.calendar-item.drop-target {
  border-color: #60a5fa;
  background: #eff6ff;
}

.calendar-item.selected {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.calendar-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.calendar-name {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  font-size: 0.82rem;
  cursor: pointer;
}

.calendar-toggle {
  width: 16px;
  height: 16px;
}

.mini-panel {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.mini-month-label {
  margin: 0 0 8px;
  font-size: 0.86rem;
}

.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.mini-day {
  padding: 0;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}

.mini-day.today {
  color: #fff;
  background: var(--today);
  border-color: var(--today);
}

.calendar-main {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 8px;
}

.calendar-app.list-mode {
  grid-template-columns: 320px 1fr;
}

.calendar-app.list-mode #monthLabel,
.calendar-app.list-mode #importStatus,
.calendar-app.list-mode #monthView,
.calendar-app.list-mode .toolbar-left,
.calendar-app.list-mode .import-compact,
.calendar-app.list-mode #importCsvBtn {
  display: none;
}

.month-view,
.list-view,
.gantt-view {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.month-view[hidden],
.list-view[hidden],
.gantt-view[hidden] {
  display: none !important;
}

.month-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.calendar-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.list-view {
  display: flex;
  flex-direction: column;
  padding: 0 100px 150px;
}

.gantt-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.gantt-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.gantt-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.gantt-header,
.gantt-row {
  display: grid;
  grid-template-columns: 320px 1fr;
}

.gantt-head-label {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  background: #f9fafb;
  position: sticky;
  left: 0;
  z-index: 3;
}

.gantt-head-time {
  display: flex;
  flex-direction: column;
  background: #f9fafb;
}

.gantt-month-row,
.gantt-day-row {
  display: grid;
}

.gantt-month-row {
  border-bottom: 1px solid var(--border);
}

.gantt-day-row {
  border-bottom: 1px solid var(--border);
}

.gantt-month-head {
  padding: 5px 8px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #4b5563;
  border-right: 1px solid #eef1f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-day-head {
  padding: 4px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: #6b7280;
  border-right: 1px solid #eef1f4;
}

.gantt-day-head.week-scale {
  padding: 8px 2px;
}

.gantt-day-head.month-scale {
  padding: 8px 2px;
}

.gantt-day-weekday {
  font-size: 0.58rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #9ca3af;
}

.gantt-day-num {
  margin-top: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #4b5563;
}

.gantt-day-head.week-scale .gantt-day-num {
  margin-top: 0;
  font-size: 0.64rem;
}

.gantt-day-head.month-scale .gantt-day-num {
  margin-top: 0;
  font-size: 0.66rem;
}

.gantt-day-meta {
  margin-top: 2px;
  font-size: 0.56rem;
  color: #9ca3af;
}

.gantt-body {
  overflow: auto;
  min-height: 0;
}

.gantt-row-label {
  padding: 8px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid #eef1f4;
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 2;
}

.gantt-row-title {
  font-size: 0.82rem;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row-meta {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row-label-group {
  background: #f8fafc;
}

.gantt-row-label-project {
  background: #f3f6fb;
}

.gantt-row-label-calendar {
  background: #f8fbff;
}

.gantt-row-group-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1f2937;
}

.gantt-row-calendar-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gantt-label-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.gantt-row-lane-group {
  background-color: #fafbfd;
}

.gantt-group-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  width: 10px;
  color: #6b7280;
  font-size: 0.66rem;
  line-height: 1;
  cursor: pointer;
}

.gantt-group-toggle:hover {
  color: #111827;
}

.gantt-row-label-calendar {
  padding-left: 20px;
}

.gantt-row-label-event {
  padding-left: 28px;
}

.gantt-row-lane {
  position: relative;
  height: 44px;
  border-bottom: 1px solid #eef1f4;
  background-color: #fff;
}

.gantt-bar {
  position: absolute;
  top: 8px;
  height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  user-select: none;
}

.gantt-group-bar {
  cursor: default;
}

.gantt-event-bar {
  position: absolute;
  cursor: url("./cursor-hand-open.svg") 8 5, grab;
}

.gantt-event-bar:active {
  cursor: url("./cursor-hand-grab.svg") 8 5, grabbing;
}

.gantt-bar-text {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-handle {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 1;
}

.gantt-handle-left {
  left: 3px;
  cursor: ew-resize;
}

.gantt-handle-right {
  right: 3px;
  cursor: ew-resize;
}

.gantt-event-bar:hover .gantt-handle,
.gantt-event-bar.is-editing .gantt-handle {
  opacity: 1;
}

.gantt-empty {
  margin: 0;
  padding: 16px;
  color: #6b7280;
  font-size: 0.85rem;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 7px 11px;
  cursor: pointer;
  font-size: 0.82rem;
}

.nav-btn:hover {
  background: #f9fafb;
}

.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.view-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.view-pill {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.view-pill.active {
  background: #f3f4f6;
  font-weight: 700;
}

.import-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.78rem;
  color: var(--muted);
  background: #fff;
}

#importStatus {
  margin: 0;
}

.import-compact input {
  width: 170px;
  max-width: 26vw;
  font-size: 0.75rem;
}

.month-label {
  margin: 0;
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.import-status {
  margin: 0;
  min-height: 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.weekdays div {
  padding: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  border-right: 1px solid var(--border);
}

.weekdays div:last-child {
  border-right: 0;
}

.calendar-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.calendar-board {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.list-table-wrap {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-count {
  color: #6b7280;
  font-size: 0.78rem;
  margin-right: 6px;
}

.list-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.event-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.event-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  color: #4b5563;
  text-align: left;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
}

.event-table thead th:first-child {
  width: 52px;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f9fafb;
  text-align: right;
}

.event-table thead th.selected {
  background: #dbeafe;
  color: #1e3a8a;
}

.event-table tbody td {
  border-bottom: 1px solid #f0f2f5;
  border-right: 1px solid #f5f6f8;
  padding: 9px 8px;
  vertical-align: middle;
}

.event-table tbody th.row-number {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 52px;
  text-align: right;
  color: #6b7280;
  font-weight: 600;
  border-right: 1px solid #eef1f4;
  border-bottom: 1px solid #f0f2f5;
  background: #f9fafb;
  padding: 9px 8px;
}

.event-table tbody th.row-number.selected {
  background: #dbeafe;
  color: #1e3a8a;
}

.event-table thead th:not(:last-child),
.event-table tbody td:not(:last-child) {
  border-right: 1px solid #eef1f4;
}

.table-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.82rem;
  background: #fff;
}

.sheet-cell {
  min-width: 100%;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 6px 7px;
  font-size: 0.82rem;
  background: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}

.sheet-cell:focus {
  outline: none;
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #2563eb;
}

.sheet-cell.selected {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.sheet-cell.active {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #2563eb;
}

.sheet-cell.calendar-name-cell {
  --calendar-hue: 210;
  position: relative;
  padding-left: 12px;
  color: hsl(var(--calendar-hue), 62%, 30%);
  font-weight: 600;
}

.sheet-cell.calendar-name-cell::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 999px;
  background: hsl(var(--calendar-hue), 78%, 46%);
  pointer-events: none;
}

.calendar-color {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.event-table tbody tr:hover {
  background: #f9fbff;
}

.table-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 2px 8px;
}

.table-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.event-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.day-cell {
  min-height: 0;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  text-align: left;
  padding: 4px 6px;
  cursor: pointer;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 4px;
  overflow: hidden;
}

.day-cell:hover {
  background: #fcfcfd;
}

.day-cell.outside {
  background: #fafafa;
}

.day-number {
  font-size: 0.86rem;
  color: #4b5563;
}

.day-cell.outside .day-number {
  opacity: 0.45;
}

.day-cell.today .day-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--today);
  color: #fff;
}

.day-events {
  display: none;
}

.day-events-empty {
  display: none;
}

.event-chip {
  position: absolute;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 5px;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid hsl(var(--event-hue), 70%, 78%);
  background: hsl(var(--event-hue), 78%, 90%);
  color: hsl(var(--event-hue), 58%, 24%);
  user-select: none;
  min-height: 17px;
  pointer-events: auto;
  z-index: 5;
  cursor: url("./cursor-hand-open.svg") 8 5, grab;
}

.event-chip.dragging {
  opacity: 0.45;
  cursor: url("./cursor-hand-grab.svg") 8 5, grabbing;
}

.event-chip:active {
  cursor: url("./cursor-hand-grab.svg") 8 5, grabbing;
}

.event-chip.is-selected {
  background: hsl(var(--event-hue), 78%, 84%);
  border-color: hsl(var(--event-hue), 78%, 52%);
  box-shadow:
    inset 0 0 0 1px hsl(var(--event-hue), 78%, 46%),
    0 0 0 1px hsl(var(--event-hue), 78%, 46%);
}

.event-chip-title {
  min-width: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-handle {
  position: relative;
  width: 9px;
  height: 12px;
  border-radius: 6px;
  background: transparent;
  cursor: ew-resize;
  flex: 0 0 auto;
  opacity: 0;
  transition: opacity 120ms ease;
}

.event-handle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.event-handle:not(.hidden):hover,
.event-handle:not(.hidden):active {
  opacity: 1;
}

.event-handle.hidden {
  opacity: 0;
  pointer-events: none;
}

body.event-dragging,
body.event-dragging *,
body.gantt-dragging,
body.gantt-dragging * {
  cursor: url("./cursor-hand-grab.svg") 8 5, grabbing !important;
}

.day-cell.drag-target {
  outline: 2px solid #93c5fd;
  outline-offset: -2px;
}

.event-dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(460px, calc(100% - 24px));
}

#eventForm {
  display: grid;
  gap: 10px;
}

#eventText,
#eventCalendarSelect {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 1rem;
}

.selected-events {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.selected-events li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.event-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.delete-event {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
}

menu button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: #fff;
}

.event-context-menu {
  position: fixed;
  z-index: 40;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
  padding: 8px;
}

.context-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 6px;
}

.context-group {
  display: grid;
  gap: 4px;
}

.context-item {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 7px;
  padding: 6px;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.context-item:hover {
  background: #f6f8ff;
  border-color: #d7e5ff;
}

.context-folder {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  margin-top: 6px;
}

@media (max-width: 1100px) {
  .calendar-app {
    grid-template-columns: 280px 1fr;
  }

  .import-compact input {
    width: 120px;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .calendar-app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .calendar-main {
    min-height: 620px;
  }

  .list-view {
    padding: 0 18px 24px;
  }

  .gantt-header,
  .gantt-row {
    grid-template-columns: 220px 1fr;
  }
}

.sheet-grid {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.sheet-col-strip {
  position: relative;
  height: 40px;
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
  overflow: hidden;
}

.sheet-corner {
  position: absolute;
  left: 0;
  top: 0;
  width: 58px;
  height: 40px;
  border-right: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #6b7280;
  cursor: pointer;
  z-index: 3;
  background: #f3f4f6;
}

.sheet-col-head {
  position: absolute;
  top: 0;
  height: 40px;
  padding: 10px 8px;
  border-right: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  background: #f9fafb;
}

.sheet-col-head.selected {
  background: #dbeafe;
  color: #1d4ed8;
}

.sheet-head-input {
  width: 100%;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  font-size: 0.82rem;
  padding: 4px 6px;
}

.sheet-body {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100% - 40px);
  min-height: 0;
  overflow: hidden;
}

.sheet-row-strip {
  position: relative;
  border-right: 1px solid var(--border);
  background: #f9fafb;
  overflow: hidden;
  min-height: 0;
}

.sheet-row-head {
  position: absolute;
  left: 0;
  width: 58px;
  display: grid;
  place-items: center end;
  padding-right: 10px;
  border-bottom: 1px solid #edf0f4;
  color: #6b7280;
  font-size: 0.78rem;
  cursor: pointer;
}

.sheet-row-head.selected {
  background: #dbeafe;
  color: #1d4ed8;
}

.sheet-scroll {
  position: relative;
  height: 100%;
  overflow: auto;
  min-height: 0;
}

.sheet-canvas {
  position: relative;
}

.sheet-grid .sheet-cell {
  position: absolute;
  min-width: 0;
  width: auto;
  border-right: 1px solid #eef1f4;
  border-bottom: 1px solid #edf0f4;
  padding: 7px 8px;
  font-size: 0.82rem;
  color: #111827;
  background: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.sheet-grid .sheet-cell.selected {
  background: #eff6ff;
}

.sheet-grid .sheet-cell.row-selected {
  background: #eef4ff;
}

.sheet-grid .sheet-cell.col-selected {
  background: #f5f9ff;
}

.sheet-grid .sheet-cell.active {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  z-index: 2;
}

.sheet-grid .sheet-cell.editing {
  padding: 0;
  background: #fff;
}

.sheet-cell-editor {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 7px 8px;
  font-size: 0.82rem;
  color: #111827;
  background: #fff;
  user-select: text;
}

.sheet-calendar-editor-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
}

.sheet-calendar-editor-wrap .sheet-cell-editor {
  flex: 1 1 auto;
  min-width: 0;
}

.sheet-calendar-picker {
  width: 34px;
  border: 0;
  border-left: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0 4px;
}

.sheet-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #7f1d1d;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.85rem;
}
