:root {
  --page: #f4f7fa;
  --panel: #ffffff;
  --ink: #172336;
  --muted: #627086;
  --line: #dfe7ef;
  --navy: #17324d;
  --blue: #1f67b1;
  --green: #9abc3c;
  --teal: #287f73;
  --purple: #a855f7;
  --amber: #d8901f;
  --red: #d94a43;
  --shadow: 0 14px 32px rgba(23, 35, 54, 0.08);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1180px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: linear-gradient(135deg, #f8fbfd 0%, #edf4f1 52%, #eef2f7 100%);
}

.login-panel {
  width: 440px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 34px;
}

.brand-mark, .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark span, .logo-tree {
  width: 28px;
  height: 30px;
  background: var(--green);
  clip-path: polygon(50% 0, 78% 34%, 64% 34%, 92% 70%, 60% 70%, 60% 100%, 40% 100%, 40% 70%, 8% 70%, 36% 34%, 22% 34%);
}

.login-panel h1 {
  margin: 24px 0 10px;
  font-size: 2rem;
}

.login-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
}

label {
  display: grid;
  gap: 7px;
  color: #44536a;
  font-size: 0.86rem;
  font-weight: 800;
}

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

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

.primary-btn, .ghost-btn, .small-btn, .danger-btn {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 900;
}

.primary-btn {
  width: 100%;
  margin-top: 18px;
  background: var(--navy);
  color: #fff;
}

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

.ghost-btn, .small-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
}

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

.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 {
  min-height: 56px;
  margin-bottom: 20px;
}

.brand strong {
  display: block;
  color: var(--navy);
  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%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #425067;
  padding: 11px 12px;
  text-align: left;
  font-weight: 800;
}

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

.user-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.user-card strong, .user-card span {
  display: block;
}

.user-card span {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.user-card button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  font-weight: 800;
}

.main {
  padding: 24px 28px 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 1.85rem;
}

.period-controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.period-controls label {
  width: 120px;
}

.view {
  display: grid;
  gap: 18px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.panel, .metric-card, .report-sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel h2, .panel h3 {
  margin: 0;
}

.panel h2 {
  font-size: 1.18rem;
}

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

.metric-card {
  padding: 16px;
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 1.65rem;
}

.metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

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

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

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

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

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

th.sortable {
  cursor: pointer;
}

tbody tr:hover {
  background: #fbfcf7;
}

.rank {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #eef4fb;
  color: var(--navy);
  font-weight: 900;
}

.badge {
  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;
}

.badge.good { background: #eaf5d9; color: #456a09; }
.badge.growth { background: #e5f2ff; color: #125a9a; }
.badge.stable { background: #edf0f3; color: #526070; }
.badge.warn { background: #fff4d8; color: #8c5a00; }
.badge.drop { background: #ffe6e3; color: #b72922; }
.badge.new { background: #f1e8ff; color: #6d2ab7; }
.badge.off { background: #eeeeee; color: #747474; }

.delta-up { color: #107c41; font-weight: 900; }
.delta-down { color: var(--red); font-weight: 900; }
.delta-flat { color: var(--muted); font-weight: 900; }

.chart {
  width: 100%;
  min-height: 250px;
}

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

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

.form-grid.wide {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.competency-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 6px;
}

.competency-grid label {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 12px;
  font-weight: 900;
}

.tabs button.active {
  background: var(--navy);
  color: #fff;
}

.employee-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font-weight: 900;
  text-decoration: underline;
}

.report-sheet {
  width: 980px;
  min-height: 1380px;
  margin: 0 auto;
  padding: 70px 76px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.12);
}

.report-logo {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 120px;
}

.report-title {
  margin: 0 0 86px;
  text-align: center;
  font-size: 2rem;
  letter-spacing: 0;
}

.report-section {
  margin-top: 42px;
}

.report-section h2 {
  margin: 0 0 14px;
  font-size: 1.32rem;
}

.report-tables {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}

.report-tables table {
  font-size: 0.78rem;
}

.approval-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid #222;
}

.approval-grid div {
  min-height: 76px;
  border-right: 1px solid #222;
  padding: 10px;
  text-align: center;
  font-weight: 900;
}

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

.empty {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.hidden-by-role {
  display: none !important;
}

@media print {
  body {
    min-width: 0;
    background: #fff;
  }
  .sidebar, .topbar, .no-print, .view:not(#reportView) {
    display: none !important;
  }
  .app-shell, .main {
    display: block;
    padding: 0;
  }
  #reportView {
    display: block !important;
  }
  .report-sheet {
    width: auto;
    min-height: 0;
    border: 0;
    box-shadow: none;
    padding: 22mm 18mm;
  }
}
