:root {
  color-scheme: light;
  font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  color: #0e1117;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; }
body { font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button, .download-button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: 266px; padding: 76px 20px 24px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: #f0f2f6;
}
.sidebar h2 { margin: 0 0 22px; font-size: 20px; line-height: 1.25; }
.sidebar label, .field-label { display: grid; gap: 8px; margin: 0 0 18px; font-size: 13px; font-weight: 400; }
.sidebar input[type="number"], .sidebar select {
  width: 100%; height: 42px; padding: 8px 12px;
  border: 0; border-radius: 8px; background: #fff;
}
.multi-select { position: relative; margin: -4px 0 16px; }
.multi-select summary {
  min-height: 78px; padding: 8px 10px; display: flex; align-items: flex-start; justify-content: space-between;
  list-style: none; border-radius: 8px; background: #fff; cursor: pointer;
}
.multi-select summary::-webkit-details-marker { display: none; }
.year-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.year-pills span { padding: 5px 8px; border-radius: 3px; color: #fff; background: #2c6bed; font-weight: 600; }
.year-pills em { color: #6b7280; font-style: normal; padding-top: 6px; }
.chevron { padding: 5px 2px 0 8px; font-size: 19px; }
.multi-options {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
  padding: 8px; border: 1px solid #d5d8de; border-radius: 8px; background: #fff; box-shadow: 0 4px 18px rgb(0 0 0 / 12%);
}
.multi-options label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px; }
.cloud-button, .download-button, .expander, .sidebar-account a {
  border: 1px solid #c6c9cf; border-radius: 8px; background: #fff;
}
.cloud-button { width: 100%; min-height: 62px; padding: 8px 18px; line-height: 1.45; }
.sidebar-account { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: #5f6570; font-size: 12px; }
.sidebar-account a { padding: 5px 8px; }
.sidebar-account form { margin: 0; }
.text-button { padding: 0; border: 0; color: #075ec7; background: none; }

.report-main { margin-left: 266px; padding: 118px 48px 48px; }
.report-main > h1 { max-width: 1190px; margin: 0 auto 94px; font-size: 42px; line-height: 1.15; letter-spacing: -.5px; font-weight: 700; }
.report-main > .tabs, .report-main > .messages, .report-main > .tab-panel { max-width: 1190px; margin-left: auto; margin-right: auto; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid #d9dadd; overflow-x: auto; }
.tabs a { flex: none; padding: 10px 12px 12px; border-bottom: 2px solid transparent; font-size: 14px; white-space: nowrap; }
.tabs a:first-child { padding-left: 0; padding-right: 16px; }
.tabs a.active { color: #0057d9; border-bottom-color: #2c6bed; }
.tab-panel { padding-top: 18px; }
.caption { margin: 0 0 18px; color: #6d727d; font-size: 14px; }

.expander { margin: 0 0 16px; overflow: hidden; }
.expander > summary { padding: 10px 16px; cursor: pointer; font-size: 16px; }
.expander > summary::marker { font-size: 12px; }
.details-body { padding: 4px 16px 16px; }
.add-item-form { display: grid; grid-template-columns: 3fr 2fr auto; gap: 14px; align-items: end; padding: 8px 16px 18px; }
.add-item-form label, .control-form label { display: grid; gap: 8px; font-size: 13px; }
.add-item-form input, .add-item-form select, .control-form select {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 0; border-radius: 8px; background: #f0f2f6;
}
.add-item-form button, .primary, .download-button {
  min-height: 40px; padding: 8px 16px; border: 1px solid #c6c9cf; border-radius: 8px; background: #fff; font-weight: 500;
}
.add-item-form button:disabled { color: #9ba0aa; background: #f3f4f6; cursor: not-allowed; }
.primary { border-color: #ff4b4b; color: #fff; background: #ff4b4b; }

.dataframe { width: 100%; overflow: auto; border: 1px solid #d9dadd; border-radius: 8px; background: #fff; }
.dataframe table { min-width: 100%; border-collapse: collapse; white-space: nowrap; }
.dataframe th, .dataframe td { height: 36px; padding: 7px 9px; border-right: 1px solid #d9dadd; border-bottom: 1px solid #d9dadd; text-align: right; font-weight: 400; }
.dataframe th { color: #6d727d; background: #f7f8fa; text-align: left; }
.dataframe tr:last-child td { border-bottom: 0; }
.dataframe th:last-child, .dataframe td:last-child { border-right: 0; }
.dataframe th:first-child, .dataframe th:nth-child(2), .dataframe td:first-child, .dataframe td:nth-child(2) { text-align: left; }
.editor-frame { max-height: 567px; margin-top: 10px; }
.editor-frame th { position: sticky; top: 0; z-index: 3; }
.editor-frame th:first-child, .editor-frame td:first-child { position: sticky; left: 0; min-width: 192px; max-width: 192px; z-index: 2; background: #fff; }
.editor-frame th:first-child { z-index: 5; background: #f7f8fa; }
.editor-frame th:nth-child(2), .editor-frame td:nth-child(2) { position: sticky; left: 192px; min-width: 400px; max-width: 400px; z-index: 2; background: #fff; }
.editor-frame th:nth-child(2) { z-index: 5; background: #f7f8fa; }
.editor-frame td input:not([type="hidden"]) { width: 76px; padding: 3px 1px; border: 0; background: transparent; text-align: right; outline-color: #2c6bed; }
.editor-frame .total { font-weight: 600; background: #fafafa; }
.spacer-row td { height: 34px; color: #9aa0aa; background: #fff; }
.save-row { display: flex; gap: 20px; align-items: center; margin: 14px 0 22px; }

.metric-grid { display: grid; gap: 0; margin: 12px 0 32px; }
.metric-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { padding: 0 18px 0 0; background: transparent; }
.metric span { display: block; margin-bottom: 8px; font-size: 14px; }
.metric strong { display: block; font-size: 30px; line-height: 1.2; font-weight: 400; }
.section-title, .kpi-title { margin: 26px 0 16px; font-size: 28px; line-height: 1.25; }
.calculation-frame { min-height: 260px; max-height: 320px; }

.control-form { display: grid; gap: 16px; margin: 0 0 16px; }
.control-form.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.control-form.single-control { grid-template-columns: 1fr; margin-top: 16px; }
.control-form .wide-control { grid-column: 1 / -1; }
.checkbox-control { display: flex !important; grid-template-columns: auto 1fr; align-items: center; justify-content: start; font-size: 16px !important; }
.checkbox-control input { width: 18px; height: 18px; margin: 0 6px 0 0; }
.chart-frame { width: 100%; height: 560px; display: block; border: 0; }
.info, .notice, .message { margin: 16px 0; padding: 18px 16px; border-radius: 8px; }
.info { color: #0054a6; background: #dcecff; }
.notice { color: #7a5500; background: #fff1c2; }
.message { border: 1px solid #f1d67a; background: #fff7db; }
.message.success { border-color: #95d5b0; background: #e7f7ee; }
.message.error { border-color: #eba3a3; background: #fff0f0; }
.legacy-messages { width: min(1190px, calc(100% - 32px)); margin: 16px auto; }
.detail-frame { max-height: 530px; }
.kpi-frame { min-height: 220px; max-height: 420px; }
.logic-list p { margin: 8px 0; color: #0e1117; }
.download-button { display: inline-flex; align-items: center; margin-top: 0; }

.login-card { width: min(430px, calc(100% - 32px)); margin: 10vh auto; padding: 28px; border: 1px solid #d9dadd; border-radius: 10px; }
.login-card h1 { margin: 0 0 8px; font-size: 32px; }
.login-card p { color: #6d727d; }
.login-card form { display: grid; gap: 16px; margin-top: 22px; }
.login-card label { display: grid; gap: 7px; }
.login-card input { min-height: 42px; padding: 8px 12px; border: 1px solid #c6c9cf; border-radius: 8px; }

@media (max-width: 1050px) {
  .sidebar { position: static; width: 100%; padding: 22px; }
  .sidebar #period-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .sidebar h2, .sidebar .field-label, .sidebar-account { grid-column: 1 / -1; }
  .sidebar label { margin-bottom: 0; }
  .multi-select { margin: 0; }
  .cloud-button { min-height: 42px; align-self: end; }
  .sidebar-account { margin-top: 16px; }
  .report-main { margin-left: 0; padding: 42px 20px; }
  .report-main > h1 { margin-bottom: 46px; font-size: 35px; }
  .editor-frame th:first-child, .editor-frame td:first-child { position: static; }
  .editor-frame th:nth-child(2), .editor-frame td:nth-child(2) { left: 0; min-width: 310px; max-width: 310px; }
}
@media (max-width: 700px) {
  .sidebar #period-form, .control-form.two-columns, .add-item-form { grid-template-columns: 1fr; }
  .report-main { padding: 32px 14px; }
  .report-main > h1 { margin-bottom: 34px; font-size: 29px; }
  .metric-grid.five, .metric-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 8px; }
  .metric strong { font-size: 23px; }
  .editor-frame th:nth-child(2), .editor-frame td:nth-child(2) { position: static; min-width: 280px; max-width: 280px; }
}
