:root {
  color-scheme: light;
  --bg: #f4f7fa;
  --panel: #ffffff;
  --panel-strong: #fbfcf7;
  --text: #172336;
  --muted: #627086;
  --line: #dfe7ef;
  --nav: #17324d;
  --blue: #1f67b1;
  --green: #9abc3c;
  --teal: #287f73;
  --amber: #d8901f;
  --red: #d94a43;
  --shadow: 0 14px 32px rgba(23, 35, 54, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden],
.view-section[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
.file-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--nav);
  padding: 0 14px;
  font-weight: 700;
}

button:hover,
.file-button:hover {
  border-color: #b9cf74;
}

.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(900px, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin-bottom: 20px;
}

.brand-logo-image {
  width: 30px;
  height: 32px;
  flex: 0 0 30px;
  object-fit: contain;
}

.brand strong {
  display: block;
  color: var(--nav);
  font-size: 1.15rem;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 5px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 12px;
}

.nav-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #425067;
  padding: 11px 12px;
  text-align: left;
  font-weight: 700;
}

.nav-list button.active,
.nav-list button:hover {
  background: #eef5e6;
  color: var(--nav);
}

.nav-list button.active {
  box-shadow: inset 3px 0 0 var(--green);
}

.side-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.side-panel small,
.side-panel strong {
  display: block;
}

.side-panel small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.side-panel strong {
  margin: 4px 0 10px;
  color: var(--nav);
  font-size: 1.05rem;
}

.ghost-button {
  width: 100%;
  background: #fff;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #eef5e6;
  color: var(--teal);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.role-badge.admin {
  background: #e5f2ff;
  color: var(--blue);
}

.admin-login-panel {
  display: grid;
  gap: 10px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.admin-login-form {
  display: grid;
  gap: 10px;
}

.admin-login-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.login-message {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
}

.main {
  min-width: 0;
  padding: 24px 28px 46px;
  display: grid;
  gap: 18px;
}

.system-switch-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #d8e5b4;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #f6faeb;
  color: var(--nav);
  padding: 13px 16px;
}

.system-switch-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.system-switch-copy small {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 700;
}

.system-switch-copy strong {
  font-size: 1rem;
}

.system-switch-copy > span {
  color: var(--muted);
  font-size: 0.78rem;
}

.system-switch-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--nav);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.system-switch-action b {
  font-size: 1.1rem;
}

.topbar,
.section-head,
.top-actions,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 4px;
}

.topbar h1,
.section-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 1.85rem;
  font-weight: 800;
}

.section-head h2 {
  font-size: 1.18rem;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  min-height: 86px;
  line-height: 1.55;
  resize: vertical;
}

.top-actions > select {
  width: 190px;
}

.filter-field {
  display: grid;
  gap: 4px;
  min-width: 136px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.filter-field select {
  min-height: 38px;
  padding: 8px 10px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.section,
.panel,
.metric-card,
.person-card,
.coach-card,
.rank-card,
.graph-card,
.forecast-card,
.health-item,
.brief-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section,
.panel {
  padding: 18px;
}

.input-grid,
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 18px;
}

.input-grid {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.input-panel,
.compact-panel {
  min-width: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: #44536a;
  font-size: 0.86rem;
  font-weight: 700;
}

.upload-summary,
.server-status {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 800;
}

.upload-summary {
  margin-top: 10px;
}

.server-status {
  margin-top: 10px;
  background: #f6faeb;
  color: var(--nav);
}

.target-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.target-field {
  display: grid;
  gap: 7px;
  color: #44536a;
  font-size: 0.86rem;
  font-weight: 700;
}

.compact-head {
  margin-top: 16px;
}

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

.employee-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.employee-chip {
  display: inline-grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--nav);
  padding: 8px 10px;
  font-size: 0.84rem;
  font-weight: 700;
}

.employee-chip small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.table-actions {
  margin-top: 0;
  flex-wrap: nowrap;
}

.table-actions button {
  min-height: 32px;
  padding: 0 10px;
}

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

.danger-button {
  background: #fff2f1;
  color: var(--red);
  border-color: #fff2f1;
}

.button-row {
  justify-content: flex-start;
  margin-top: 16px;
  flex-wrap: wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.metric-card {
  min-height: 116px;
  padding: 16px;
  border-top: 4px solid var(--nav);
}

.metric-card:nth-child(2) { border-top-color: var(--teal); }
.metric-card:nth-child(3) { border-top-color: var(--green); }
.metric-card:nth-child(4) { border-top-color: #eb8297; }
.metric-card:nth-child(5) { border-top-color: var(--amber); }

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--nav);
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
}

.metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
}

.delta-positive { color: var(--teal) !important; }
.delta-negative { color: var(--red) !important; }

.dashboard-summary {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.dashboard-visuals {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr);
  gap: 18px;
  margin-top: 18px;
}

.dashboard-main-grid.two-col {
  grid-template-columns: minmax(0, 1fr) minmax(460px, 1fr);
}

.dashboard-main-grid .chart-panel-wide {
  grid-column: auto;
}

.dashboard-chart {
  min-height: 330px;
}

.dashboard-chart svg,
.donut-chart svg {
  height: 330px;
}

.donut-chart {
  min-height: 330px;
  display: grid;
  place-items: center;
}

.employee-volume-chart {
  min-height: 420px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eef5d9;
  color: #4f6f13;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.dashboard-rank-table {
  margin-top: 0;
}

.dashboard-rank-table table {
  min-width: 0;
}

.dashboard-rank-table td,
.dashboard-rank-table th {
  padding: 12px 9px;
}

.rank-name {
  color: var(--blue);
  font-weight: 800;
}

.score-pill {
  display: inline-flex;
  justify-content: center;
  min-width: 48px;
  border-radius: 999px;
  background: #dff6ef;
  color: var(--teal);
  padding: 4px 9px;
  font-size: 0.82rem;
  font-weight: 800;
}

.delta.up {
  color: #107c41;
  font-weight: 900;
}

.delta.down {
  color: var(--red);
  font-weight: 900;
}

.delta.flat {
  color: var(--muted);
  font-weight: 900;
}

.badge,
.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 900;
  background: #e5f2ff;
  color: #125a9a;
}

.grade.S {
  background: #eaf5d9;
  color: #456a09;
}

.grade.A {
  background: #e5f2ff;
  color: #125a9a;
}

.grade.B {
  background: #edf0f3;
  color: #526070;
}

.grade.C {
  background: #fff4d8;
  color: #8c5a00;
}

.grade.D {
  background: #ffe6e3;
  color: #b72922;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 16px;
}

.table-wrap.flat {
  margin-top: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 0.91rem;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  background: #f4f8fb;
  color: #31445c;
  font-size: 0.82rem;
  font-weight: 700;
}

tbody tr:hover {
  background: #fbfcf7;
}

.analysis-grid,
.coaching-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.person-card,
.coach-card,
.rank-card,
.graph-card,
.forecast-card,
.health-item {
  padding: 14px;
}

.forecast-card small,
.forecast-card strong,
.health-item small,
.health-item strong {
  display: block;
}

.forecast-card small,
.health-item small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.forecast-card strong,
.health-item strong {
  margin-top: 7px;
  color: var(--nav);
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: keep-all;
}

.person-card h3,
.coach-card h3,
.rank-card h3,
.graph-card h3 {
  margin: 0 0 10px;
  color: var(--nav);
  font-size: 1rem;
}

.person-card ul,
.coach-card ul,
.text-block ul,
.final-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.rank-grid,
.graph-grid,
.forecast-grid,
.health-list {
  display: grid;
  gap: 12px;
}

.rank-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rank-row,
.comparison-item,
.alert-item,
.brief-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.brief-line {
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
  padding: 14px;
  font-weight: 700;
}

.rank-row:last-child,
.comparison-item:last-child,
.alert-item:last-child,
.brief-line:last-child {
  border-bottom: 0;
}

.comparison-list,
.alert-list,
.text-block,
.final-card,
.briefing {
  margin-top: 12px;
  line-height: 1.65;
}

.status-red {
  color: var(--red);
  font-weight: 900;
}

.status-yellow {
  color: #8c5a00;
  font-weight: 900;
}

.status-green {
  color: #456a09;
  font-weight: 900;
}

.briefing {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.graph-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.bar-line {
  display: grid;
  grid-template-columns: 80px 1fr 56px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.bar-track {
  height: 12px;
  background: #e7ecef;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.mini-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 150px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.mini-bar {
  position: relative;
  flex: 1;
  min-width: 14px;
  background: linear-gradient(180deg, var(--green), var(--blue));
  border-radius: 5px 5px 0 0;
}

.mini-bar span {
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
}

.chart-section-head {
  align-items: flex-end;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chart-controls label {
  display: grid;
  gap: 5px;
  min-width: 145px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.chart-controls select {
  min-height: 36px;
  padding: 7px 10px;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 18px;
}

.history-stat {
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 6px;
  background: #fbfcf7;
  padding: 12px;
}

.history-stat small,
.history-stat strong {
  display: block;
}

.history-stat small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.history-stat strong {
  margin-top: 5px;
  color: var(--nav);
  font-size: 1.12rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-panel {
  min-width: 0;
  padding: 16px;
}

.chart-panel-wide {
  grid-column: span 2;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-title h3 {
  margin: 0;
  color: var(--nav);
  font-size: 0.98rem;
}

.panel-title span,
.muted {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.svg-chart {
  min-height: 260px;
}

.svg-chart svg {
  display: block;
  width: 100%;
  height: 270px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-top: 8px;
  color: #405069;
  font-size: 0.8rem;
  font-weight: 800;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.chart-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.chart-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-weight: 800;
}

.compare-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.compare-name-btn.selected {
  border-color: #81a72e;
  background: #eef7df;
  color: var(--nav);
  box-shadow: inset 0 0 0 1px rgba(154, 188, 60, 0.32);
}

.compare-name-btn {
  justify-content: center;
  min-height: 42px;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.compare-name-btn:hover {
  border-color: #9abc3c;
  background: #f7faed;
}

.compare-name-btn:active {
  transform: translateY(1px);
}

.compare-name-btn.selected::before {
  content: "✓";
  margin-right: 7px;
  color: #456a09;
}

@media (max-width: 1180px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(4, 1fr);
  }

  .nav-list button {
    justify-content: center;
    text-align: center;
  }

  .metric-grid,
  .analysis-grid,
  .coaching-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid,
  .history-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .main {
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .system-switch-banner,
  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .input-grid,
  .split-grid,
  .briefing,
  .graph-grid,
  .rank-grid,
  .metric-grid,
  .analysis-grid,
  .coaching-grid,
  .chart-grid,
  .history-summary,
  .compare-picker {
    grid-template-columns: 1fr;
  }

  .chart-panel-wide {
    grid-column: auto;
  }

  .chart-section-head {
    align-items: flex-start;
  }
}
