/* ProjectX 공통 스타일 */

:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1f2933;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --orange: #ea580c;
  --red: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* 상단 네비게이션 */
.topnav {
  background: #0f172a;
  color: #fff;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 20px;
}
.topnav .brand {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}
.topnav a {
  color: #cbd5e1;
  padding: 6px 4px;
}
.topnav a.active {
  color: #fff;
  border-bottom: 2px solid var(--primary);
}
.topnav .spacer {
  flex: 1;
}
.topnav .user-info {
  color: #cbd5e1;
  font-size: 13px;
}

/* 레이아웃 */
.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 20px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px;
}

/* 카드 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* KPI 그리드 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.kpi .label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi .value {
  font-size: 20px;
  font-weight: 700;
}
.kpi .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 테이블 */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}
th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
}
th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--muted);
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 배지 / 상태 라벨 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.green {
  background: #dcfce7;
  color: var(--green);
}
.badge.orange {
  background: #ffedd5;
  color: var(--orange);
}
.badge.red {
  background: #fee2e2;
  color: var(--red);
}
.badge.gray {
  background: #e2e8f0;
  color: var(--muted);
}
.badge.blue {
  background: #dbeafe;
  color: var(--primary);
}

/* 폼 */
label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--muted);
}
input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.form-row {
  margin-bottom: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* 버튼 */
button,
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
button:hover,
.btn:hover {
  background: var(--primary-dark);
}
button.secondary {
  background: #e2e8f0;
  color: var(--text);
}
button.secondary:hover {
  background: #cbd5e1;
}
button.danger {
  background: var(--red);
}

/* 로그인 화면 */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  width: 360px;
  background: var(--card);
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-box h1 {
  font-size: 22px;
  text-align: center;
  margin: 0 0 24px;
}

/* 알림 메시지 */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}
.alert.error {
  background: #fee2e2;
  color: var(--red);
}
.alert.success {
  background: #dcfce7;
  color: var(--green);
}
.alert.warn {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

/* 빈 상태 */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

/* 모달 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  width: 460px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 {
  margin: 0 0 16px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* 진행바 */
.progress {
  background: #e2e8f0;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
}
.progress > span.green {
  background: var(--green);
}
.progress > span.orange {
  background: var(--orange);
}
.progress > span.red {
  background: var(--red);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar .field {
  min-width: 140px;
}
