:root {
  --bg: #f4efe5;
  --panel: #fffdf8;
  --panel-strong: #fffdf8;
  --ink: #1f2937;
  --subtle: #6b7280;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --line: #d7d1c7;
  --danger: #be123c;
  --danger-soft: #ffe4e6;
  --shadow: 0 4px 12px rgba(54, 43, 24, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans KR", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

body.resizing,
body.resizing * {
  cursor: col-resize !important;
  user-select: none;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1440px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

.hero,
.upload-strip,
.toolbar,
.table-panel,
.empty-state,
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero,
.upload-strip,
.toolbar,
.table-panel,
.empty-state,
.modal-card {
  padding: 20px 24px;
}

.eyebrow,
.detail-kicker {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.08;
  margin-bottom: 14px;
}

.hero {
  margin-bottom: 14px;
}

.hero-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.hero-summary-button {
  width: auto;
  min-width: 132px;
  align-self: flex-start;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.hero-admin-button {
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.admin-toolbox-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-admin-button.sort-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.hero-copy {
  max-width: 70ch;
  margin-bottom: 0;
  color: #374151;
  line-height: 1.7;
}

.upload-strip {
  margin-bottom: 16px;
}

.section-toggle-row,
.sheet-option-toggle-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-toggle-button,
.option-hide-button {
  width: auto;
}

#collapsed-microsoft-help {
  margin: 0;
}

.upload-collapsed {
  padding-bottom: 18px;
}

.reimport-timer {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(255, 255, 255, 0.82);
  color: #0f766e;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(240px, auto);
  gap: 14px;
  align-items: end;
}

.cloud-import-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(215, 209, 199, 0.8);
}

.cloud-import-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cloud-import-actions .ghost-button {
  width: auto;
}

.reimport-settings {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.reimport-settings label {
  display: grid;
  gap: 6px;
  min-width: 140px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f766e;
}

.reimport-settings input,
.reimport-settings select {
  min-height: 42px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font: inherit;
}

.upload-block,
.toolbar-block {
  min-width: 0;
}

.upload-block label,
.toolbar label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

input[type="file"],
input[type="search"],
select,
button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
}

input[type="file"],
input[type="search"],
select {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
}

button {
  cursor: pointer;
  padding: 12px 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
}

.tiny-button {
  width: auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.danger-button {
  background: #be123c;
}

.helper,
.upload-message,
#detail-subtitle,
.toolbar-meta {
  color: var(--subtle);
  font-size: 0.92rem;
}

#sheet-subtitle {
  margin: 6px 0 0;
  color: blue;
  font-size: 1rem;
}

.helper,
.upload-message {
  margin-bottom: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

.toolbar-simple {
  grid-template-columns: minmax(0, 1fr) auto;
}

.toolbar-meta {
  display: grid;
  gap: 6px;
  white-space: nowrap;
  align-self: center;
}

.search-controls {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.search-controls button {
  width: auto;
  min-width: 100px;
}

.search-block {
  min-width: 0;
}

.sheet-switcher {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.sheet-nav {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
}

.sheet-tabs-viewport {
  overflow: hidden;
}

.sheet-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}

.sheet-tabs::-webkit-scrollbar {
  display: none;
}

.sheet-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 6px 4px 10px;
  background: rgba(255, 255, 255, 0.74);
}

.sheet-tab.active {
  background: #fff;
  border-color: rgba(15, 118, 110, 0.24);
}

.sheet-tab-button {
  width: auto;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 4px 2px;
  font-weight: 600;
  line-height: 1.1;
}

.sheet-tab.active .sheet-tab-button {
  color: var(--accent-strong);
}

.sheet-tab-delete {
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: #dc2626;
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.desktop-detail-panel {
  position: sticky;
  top: 16px;
  min-height: 520px;
  max-height: min(88vh, calc(100vh - 120px));
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 22px;
}

.desktop-detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.desktop-detail-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.desktop-detail-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 20px;
  border: 1px dashed rgba(15, 118, 110, 0.22);
  border-radius: 12px;
  color: var(--subtle);
  text-align: center;
  line-height: 1.6;
}

.desktop-detail-list {
  max-height: calc(min(88vh, calc(100vh - 120px)) - 92px);
  overflow: auto;
  padding-right: 4px;
}

.sheet-caption {
  margin-bottom: 14px;
}

.sheet-caption-main {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.sheet-caption-main h2 {
  margin-bottom: 0;
}

.sheet-range-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sheet-range-bar .range-trigger {
  width: auto;
  min-width: 160px;
}

#toggle-sheet-options {
  min-width: 82px;
  padding-inline: 14px;
}

.sort-trigger.sort-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.sort-modal-body {
  display: grid;
  gap: 16px;
  margin: 18px 0 8px;
}

.sort-field {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.sort-field span {
  color: var(--accent-strong);
}

.range-trigger {
  width: auto;
  white-space: nowrap;
}

.edit-mode-toggle.edit-mode-on {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.range-group {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(15, 118, 110, 0.1);
}

.range-group select {
  width: auto;
  min-width: 116px;
  padding: 8px 10px;
}

.range-label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-strong);
  white-space: nowrap;
}

.range-tilde {
  color: var(--subtle);
}

.column-editor-wrap {
  overflow-x: auto;
  margin-bottom: 12px;
}

.column-editor {
  display: flex;
  gap: 8px;
  min-width: max-content;
}

.editor-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.editor-table td {
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  background: rgba(255, 255, 255, 0.96);
}

.editor-table td:last-child {
  border-right: none;
}

.inline-editor {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 8px;
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
}

.column-editor-cell,
.column-group-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  min-height: 72px;
  border-radius: 0;
  border: none;
  box-shadow: none;
  height: 100%;
  justify-content: center;
}

.compact-editor-cell {
  min-height: 56px;
}

.editor-cell {
  position: sticky;
}

.editor-spacer {
  background: #f8fafc !important;
}

.column-group-marker {
  min-width: 180px;
  justify-content: center;
}

.column-group-marker.hide-group {
  background: #fffbea;
}

.column-group-marker.delete-group {
  background: var(--danger-soft);
}

.column-group-marker span {
  font-size: 0.9rem;
  font-weight: 700;
}

.column-group-marker button {
  width: auto;
  align-self: flex-start;
}

.column-editor-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.col-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
}

.table-wrap {
  --edge-scroll-size: 14px;
  --edge-scroll-gap: 8px;
  --edge-inset: calc(var(--edge-scroll-size) + var(--edge-scroll-gap) + 2px);
  --native-scrollbar-width: 16px;
  --native-scrollbar-height: 16px;
  overflow: hidden;
  max-height: min(88vh, calc(100vh - 180px));
  min-height: 360px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  position: relative;
}

.table-stage {
  position: absolute;
  top: var(--edge-inset);
  left: var(--edge-inset);
  right: var(--native-scrollbar-width);
  bottom: var(--native-scrollbar-height);
}

.edge-scroll {
  position: absolute;
  z-index: 12;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  box-shadow: none;
}

.edge-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  top: var(--edge-scroll-gap);
  left: var(--edge-inset);
  right: var(--native-scrollbar-width);
  height: var(--edge-scroll-size);
}

.edge-scroll-left {
  overflow-y: auto;
  overflow-x: hidden;
  left: var(--edge-scroll-gap);
  top: var(--edge-inset);
  bottom: var(--native-scrollbar-height);
  width: var(--edge-scroll-size);
}

.edge-scroll-inner {
  min-height: 1px;
}

.edge-scroll-inner-vertical {
  min-width: 1px;
}

.freeze-grid {
  display: grid;
  height: 100%;
  min-width: 100%;
  min-height: 0;
}

.freeze-pane {
  position: relative;
  overflow: hidden;
  background: var(--panel-strong);
}

.freeze-corner-pane,
.freeze-top-pane {
  border-bottom: 1px solid var(--line);
}

.freeze-corner-pane,
.freeze-left-pane {
  border-right: 1px solid var(--line);
}

.freeze-main-pane {
  overflow: auto;
  background: #fff;
}

.simple-main-pane {
  height: 100%;
  overflow: auto;
  background: #fff;
}

.simple-main-table {
  width: max-content;
  min-width: 100%;
}

.freeze-track {
  will-change: auto;
}

.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.table-footer .ghost-button {
  width: auto;
  min-width: 180px;
}

.table-meta {
  margin: 0;
  color: var(--subtle);
  font-size: 0.9rem;
}

.table-meta button {
  display: inline-block;
  width: auto;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
}

.meta-divider {
  margin: 0 8px;
}

.persist-note {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-placeholder {
  padding: 28px 20px;
  color: var(--subtle);
  text-align: center;
}

.freeze-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
}

.action-col {
  width: 88px;
}

.freeze-table td {
  position: relative;
  padding: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
  background: #fff;
}

.freeze-table tr:last-child td {
  border-bottom: none;
}

.virtual-spacer-row td {
  padding: 0;
  border-right: none;
  border-bottom: none;
  background: transparent !important;
}

.virtual-spacer-cell {
  pointer-events: none;
}

.freeze-corner-table td,
.freeze-top-table td {
  background: #fffefb;
}

.freeze-top-table td,
.freeze-left-table td:nth-child(1),
.freeze-left-table td:nth-child(2),
.freeze-corner-table td {
  background: #d9eef8;
}

.freeze-top-table td .cell-content,
.freeze-left-table td:nth-child(1) .cell-content,
.freeze-left-table td:nth-child(2) .cell-content,
.freeze-corner-table td .cell-content {
  color: #0b3b53;
  font-weight: 700;
}

.freeze-corner-pane {
  z-index: 4;
}

.freeze-top-pane {
  z-index: 3;
}

.freeze-left-pane {
  z-index: 2;
}

.row-action-cell {
  min-width: 88px;
  padding: 6px;
  background: #f8fafc;
}

.row-action-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  height: 100%;
}

.row-action-buttons-single {
  align-items: center;
  min-height: 28px;
}

.editor-spacer-cell {
  background: #f6f2ea !important;
}

.editor-cell-pane {
  background: #fffefb !important;
}

.row-resize-handle {
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 10px;
  cursor: row-resize;
}

.cell-content {
  display: block;
  overflow: hidden;
  line-height: 1.35;
  max-height: calc(1.35em * 2 + 6px);
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.search-hit {
  background: #fff3a3;
  color: #111827;
  border-radius: 4px;
  padding: 0 2px;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.12);
}

.cell-content-manual {
  max-height: none;
  overflow: visible;
}

.empty-grid-cell {
  min-width: 24px;
  background: rgba(255, 255, 255, 0.86);
}

.restore-row td {
  padding: 6px 12px;
  background: #fffbea;
}

.restore-row.deleted td {
  background: var(--danger-soft);
}

.restore-row-box {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
}

.restore-row-box button {
  width: auto;
  padding: 4px 10px;
  font-size: 0.78rem;
}

.selected-row td {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  outline-offset: -2px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.detail-item {
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 118, 110, 0.08);
}

.detail-item.title-field {
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.detail-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--accent-strong);
}

.detail-item span {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1.05rem;
  line-height: 1.5;
}

.detail-modal-card {
  width: min(820px, calc(100% - 24px));
  max-height: min(88vh, 920px);
  overflow: hidden;
}

.detail-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 6px;
}

.detail-close {
  width: auto;
  flex: 0 0 auto;
  font-size: 1.25rem;
}

.detail-modal-list {
  max-height: calc(88vh - 180px);
  overflow: auto;
  padding-right: 4px;
  padding-bottom: 56px;
}

.detail-modal-header .eyebrow {
  font-size: 1rem;
}

.empty-state {
  text-align: center;
  padding: 56px 24px;
}

.loading-overlay,
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.loading-overlay {
  display: grid;
  place-items: center;
  background: rgba(31, 41, 55, 0.18);
}

.loading-card {
  min-width: 220px;
  padding: 22px 24px;
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-card p {
  margin: 12px 0 0;
  font-weight: 600;
}

.download-progress-card {
  width: min(460px, calc(100% - 24px));
}

.download-progress-track {
  margin-top: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  overflow: hidden;
}

.download-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.download-progress-percent {
  margin: 14px 0 0;
  text-align: right;
  font-weight: 700;
  color: var(--accent-strong);
}

.loading-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border: 4px solid rgba(15, 118, 110, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.modal {
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 41, 55, 0.24);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100% - 24px));
}

.summary-modal-card {
  width: min(760px, calc(100% - 24px));
  max-height: min(88vh, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
}

.summary-close-row {
  justify-content: space-between;
  align-items: center;
  margin-top: 0;
  margin-bottom: 8px;
  gap: 12px;
}

.summary-close-row .ghost-button {
  width: auto;
  min-width: 120px;
}

.summary-top-presets {
  min-width: 0;
  flex: 1;
}

.summary-content {
  overflow: auto;
  padding-right: 6px;
  padding-bottom: 16px;
}

.summary-settings-panel {
  padding: 16px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  background: rgba(255, 255, 255, 0.78);
}

.summary-settings-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.summary-settings-head .ghost-button {
  width: auto;
  min-width: 96px;
}

.summary-settings-note {
  margin: 0;
  color: var(--subtle);
  font-size: 0.9rem;
  line-height: 1.5;
}

.summary-builder {
  display: grid;
  gap: 12px;
}

.summary-config-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.1);
  border-radius: 8px;
  background: #fff;
}

.summary-section-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.summary-section-toolbar .ghost-button {
  width: auto;
}

.summary-config-row,
.summary-config-item {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}

.summary-config-row label,
.summary-config-item label {
  display: grid;
  gap: 5px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.summary-config-row input,
.summary-config-row select,
.summary-config-item input,
.summary-config-item select {
  min-height: 38px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font: inherit;
}

.summary-config-items {
  display: grid;
  gap: 8px;
}

.summary-color-group {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.summary-color-control {
  display: grid;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--subtle);
}

.summary-color-control input {
  width: 42px;
  min-height: 38px;
  padding: 2px;
}

.summary-config-sum {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.04);
}

.summary-sum-topline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.summary-sum-topline .ghost-button {
  width: auto;
}

.summary-sum-topline strong {
  color: var(--accent-strong);
}

.summary-config-sum-fields {
  padding-top: 4px;
}

.summary-config-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-config-actions .ghost-button {
  width: auto;
}

.summary-add-section {
  width: auto;
}

.summary-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.summary-block {
  padding: 16px 0;
  border-top: 1px solid rgba(215, 209, 199, 0.8);
}

.summary-block:first-child {
  border-top: none;
  padding-top: 0;
}

.summary-title {
  margin: 0 0 10px;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
}

.summary-line {
  margin: 0;
  color: #374151;
  line-height: 1.7;
  font-size: 1rem;
  white-space: pre-wrap;
}

.summary-settings-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: start;
  gap: 14px;
}

.summary-settings-titlebox {
  display: grid;
  gap: 4px;
}

.summary-settings-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.summary-settings-actions .ghost-button,
.summary-preset-strip .ghost-button {
  width: auto;
}

.primary-soft {
  border-color: rgba(15, 118, 110, 0.34);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.summary-preset-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(140px, 220px);
  gap: 8px;
  align-items: end;
  max-width: 100%;
}

.summary-preset-strip.view-only {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.summary-preset-buttons {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.summary-preset-scroll {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-strong);
  font-size: 1.35rem;
  line-height: 1;
}

.summary-preset-mobile {
  display: none;
}

.summary-preset-button {
  flex: 0 0 auto;
  min-height: 36px;
  max-width: 140px;
  padding: 0 10px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-preset-button.active {
  border-color: rgba(15, 118, 110, 0.56);
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.18);
}

.summary-preset-name {
  display: grid;
  gap: 4px;
  color: var(--subtle);
  font-size: 0.78rem;
  font-weight: 700;
}

.summary-preset-name input {
  min-height: 36px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font: inherit;
}

#current-file {
  display: none;
}

.summary-config-section {
  gap: 8px;
  padding: 12px 14px;
  border-color: rgba(15, 118, 110, 0.18);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.03);
}

.summary-section-titleline {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) auto minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.summary-title-field,
.summary-config-item label {
  display: grid;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-strong);
}

.summary-title-field input,
.summary-title-field select,
.summary-config-item input,
.summary-config-item select {
  min-height: 36px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  font: inherit;
}

.summary-section-toolbar {
  padding-top: 2px;
  gap: 8px;
}

.summary-section-toolbar .ghost-button,
.summary-config-actions .ghost-button,
.summary-sum-topline .ghost-button {
  min-height: 34px;
  padding: 0 10px;
}

.summary-config-items {
  gap: 6px;
}

.summary-config-item {
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr) auto auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(15, 118, 110, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.summary-config-sum {
  gap: 6px;
  padding: 8px;
}

.summary-sum-topline {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.summary-color-control {
  min-width: 56px;
  gap: 4px;
  white-space: nowrap;
}

.summary-color-control input {
  width: 46px;
  min-height: 36px;
  border-radius: 8px;
}

.summary-line-list {
  display: grid;
  gap: 4px;
}

.summary-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.45;
  white-space: normal;
}

.summary-line-label {
  min-width: 110px;
  font-weight: 700;
}

.summary-line-value {
  font-variant-numeric: tabular-nums;
}

.summary-close-row .ghost-button {
  min-width: 72px;
  min-height: 42px;
  padding: 0 18px;
  border-color: rgba(55, 65, 81, 0.3);
  background: #f3f4f6;
  color: #1f2937;
  font-size: 0.98rem;
  font-weight: 800;
}

.summary-section-titleline {
  grid-template-columns: minmax(190px, 1.25fr) auto minmax(190px, 1fr);
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(15, 118, 110, 0.12);
}

.summary-ratio-base-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: rgba(240, 253, 250, 0.65);
}

.manager-summary-button {
  min-width: 132px;
}

.manager-summary-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.manager-count-values {
  grid-column: 1 / -1;
}

.manager-summary-table {
  display: grid;
  grid-template-columns: minmax(90px, 0.9fr) minmax(110px, 1fr) minmax(100px, 0.8fr) minmax(80px, 0.6fr);
  gap: 0;
  overflow-x: auto;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
}

.manager-summary-row {
  display: contents;
}

.manager-summary-table > div,
.manager-summary-row > div {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(15, 118, 110, 0.1);
  white-space: nowrap;
  min-width: 0;
}

.manager-summary-table > .manager-summary-row {
  padding: 0;
  border-bottom: 0;
  white-space: normal;
}

.manager-summary-head {
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
  font-weight: 900;
}

.summary-config-section {
  position: relative;
  padding: 14px 16px 16px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-left: 6px solid #0f766e;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0.98) 22%);
  box-shadow: 0 1px 0 rgba(15, 118, 110, 0.08), 0 10px 24px rgba(16, 24, 40, 0.04);
}

.summary-config-section:nth-of-type(2n) {
  border-left-color: #2563eb;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.06), rgba(255, 255, 255, 0.98) 22%);
}

.summary-config-section:nth-of-type(3n) {
  border-left-color: #7c3aed;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.055), rgba(255, 255, 255, 0.98) 22%);
}

.summary-section-toolbar {
  padding-top: 10px;
}

.summary-toggle-button {
  border-color: rgba(15, 118, 110, 0.45);
  background: #ccfbf1;
  color: #115e59;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
  font-weight: 900;
}

.summary-toggle-button:hover {
  background: #99f6e4;
}

.summary-settings-actions #toggle-summary-settings {
  border-color: rgba(37, 99, 235, 0.36);
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 900;
}

.summary-settings-actions #save-summary-settings {
  min-width: 86px;
}

@media (max-width: 900px) {
  .summary-settings-head,
  .summary-section-titleline,
  .summary-ratio-base-row,
  .summary-config-row,
  .summary-config-item {
    grid-template-columns: 1fr;
  }

  .summary-preset-strip {
    grid-template-columns: minmax(140px, 1fr) minmax(150px, 1fr);
    align-items: end;
  }

  .summary-preset-strip.view-only {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-preset-buttons,
  .summary-preset-scroll {
    display: none;
  }

  .summary-preset-mobile {
    display: grid;
    gap: 4px;
    color: var(--subtle);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .summary-preset-mobile select {
    min-height: 40px;
    border: 1px solid rgba(15, 118, 110, 0.18);
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    font: inherit;
    font-weight: 800;
  }

  .summary-preset-button {
    display: none;
  }

  .summary-preset-name {
    min-width: 0;
  }

  .summary-settings-actions {
    justify-content: flex-start;
  }

  .manager-summary-table {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow-x: visible;
    border: 0;
    border-radius: 0;
  }

  .manager-summary-head {
    display: none;
  }

  .manager-summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04);
  }

  .manager-summary-table > .manager-summary-row {
    padding: 10px;
    border-bottom: 1px solid rgba(15, 118, 110, 0.16);
  }

  .manager-summary-row > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    font-weight: 800;
    color: #111827;
  }

  .manager-summary-row > div::before {
    content: attr(data-label);
    color: var(--accent-strong);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
  }

  .summary-close-row {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-close-row .ghost-button {
    align-self: flex-end;
  }

  .summary-line {
    flex-wrap: wrap;
  }

  .summary-line-label {
    min-width: 0;
  }
}

.modal-actions,
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.sheet-checklist {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  margin-top: 16px;
}

.sheet-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 118, 110, 0.08);
}

.onedrive-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.onedrive-crumb {
  width: auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border: 1px solid rgba(15, 118, 110, 0.12);
}

.onedrive-entry-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(15, 118, 110, 0.08);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
}

.onedrive-entry-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.onedrive-entry-title {
  font-weight: 700;
  word-break: break-word;
}

.onedrive-entry-meta {
  color: var(--subtle);
  font-size: 0.9rem;
  word-break: break-word;
}

.onedrive-entry-kind {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.onedrive-empty {
  margin: 0;
  padding: 16px;
  color: var(--subtle);
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1180px) {
  .upload-row,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .desktop-detail-panel {
    display: none;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .search-controls {
    grid-template-columns: 1fr;
  }

  .toolbar-meta {
    white-space: normal;
  }

  .cloud-import-row {
    flex-direction: column;
    align-items: stretch;
  }

  .cloud-import-actions .ghost-button {
    width: 100%;
  }

  .table-wrap {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 14px, 100%);
    padding-top: 10px;
  }

  .hero,
  .upload-strip,
  .toolbar,
  .table-panel,
  .modal-card {
    padding: 16px;
  }

  h1 {
    font-size: 2rem;
  }

  .hero {
    padding: 12px 14px;
    border-radius: 18px;
  }

  .hero-top-row {
    flex-direction: row;
    align-items: center;
  }

  .hero-top-row .eyebrow {
    display: none;
  }

  .hero-top-row h1 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.2;
  }

  .hero-actions {
    flex: 0 0 auto;
    gap: 8px;
    align-items: center;
  }

  .hero-summary-button {
    width: auto;
    min-width: 112px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    white-space: nowrap;
  }

  .hero-admin-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .admin-toolbox-icon {
    width: 21px;
    height: 21px;
  }

  .toolbar {
    padding: 12px;
    border-radius: 18px;
    gap: 8px;
  }

  .toolbar-block label {
    margin-bottom: 6px;
    font-size: 0.88rem;
  }

  .search-controls {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .search-controls input[type="search"] {
    grid-column: 1 / -1;
    order: 1;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 1rem;
  }

  .search-controls select {
    order: 2;
    min-height: 42px;
    padding: 0 10px;
    border-radius: 12px;
  }

  .search-controls button {
    order: 3;
    min-width: 76px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
  }

  .toolbar-meta {
    display: none;
  }

  .sheet-switcher {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .sheet-nav {
    width: 40px;
    height: 40px;
  }

  .sheet-caption-main {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .sheet-caption-main h2 {
    min-width: 0;
    font-size: 1.35rem;
  }

  .sheet-option-toggle-row,
  .sheet-range-bar {
    width: auto;
    justify-content: flex-end;
  }

  #toggle-sheet-options {
    min-width: 70px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
  }

  .sheet-range-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .sheet-range-bar .range-trigger,
  .section-toggle-button {
    width: 100%;
  }

  .range-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .range-group select {
    min-width: 0;
    flex: 1 1 140px;
  }

  .detail-modal-header {
    flex-direction: column;
  }

  .detail-modal-list {
    max-height: calc(100vh - 220px);
    padding-bottom: 160px;
  }
}
