:root {
  --primary:      #1e3a5f;
  --accent:       #2563eb;
  --accent-light: #eff6ff;
  --success:      #16a34a;
  --success-light:#dcfce7;
  --warning:      #d97706;
  --warning-light:#fef3c7;
  --danger:       #dc2626;
  --danger-light: #fee2e2;
  --bg:           #f1f5f9;
  --card:         #ffffff;
  --text:         #1e293b;
  --muted:        #64748b;
  --border:       #e2e8f0;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

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

/* ── 공통 카드 ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ── 버튼 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-outline  { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent-light); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-sm       { padding: 5px 12px; font-size: 13px; }
.btn-full     { width: 100%; }

/* ── 폼 ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-hint  { font-size: 12px; color: var(--muted); }

.input {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
.input:focus    { border-color: var(--accent); }
.input.error    { border-color: var(--danger); }
.input.success  { border-color: var(--success); }

.field-error { font-size: 12px; color: var(--danger); display: none; }
.field-error.visible { display: block; }

/* ── 알림 ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: none;
}
.alert.visible   { display: block; }
.alert-error     { background: var(--danger-light);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-success   { background: var(--success-light); color: #166534; border: 1px solid #86efac; }
.alert-warning   { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }

/* ── 배지 ── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-blue    { background: var(--accent-light);   color: #1d4ed8; }
.badge-green   { background: var(--success-light);  color: #166534; }
.badge-yellow  { background: var(--warning-light);  color: #92400e; }
.badge-red     { background: var(--danger-light);   color: #991b1b; }

/* ── 로그인 / 가입 레이아웃 ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-logo {
  margin-bottom: 24px;
  text-align: center;
}
.auth-logo h1 { font-size: 22px; font-weight: 800; color: var(--primary); }
.auth-logo p  { font-size: 13px; color: var(--muted); margin-top: 2px; }

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 32px;
}

.auth-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--primary);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: 13px; color: var(--muted); }

/* ── 대시보드 레이아웃 ── */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-brand { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.topbar-brand span { font-size: 13px; font-weight: 400; opacity: .7; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user  { font-size: 13px; opacity: .85; }

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

.page-header {
  margin-bottom: 20px;
}
.page-header h2 { font-size: 20px; font-weight: 700; color: var(--primary); }
.page-header p  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── 프로젝트 테이블 ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: #f8fafc;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

.cert-link { font-size: 12px; }

/* ── 빈 상태 ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty-state p { margin-top: 8px; font-size: 13px; }

/* ── 로딩 스피너 ── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}
.spinner-dark {
  border: 2px solid var(--border);
  border-top-color: var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row td { text-align: center; padding: 40px; color: var(--muted); }

/* ── BRN 검증 인디케이터 ── */
.brn-wrap { position: relative; }
.brn-status {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
}
.brn-ok  { color: var(--success); }
.brn-bad { color: var(--danger); }

/* ── 비밀번호 강도 ── */
.pw-strength { height: 3px; border-radius: 2px; margin-top: 4px; transition: all .3s; background: var(--border); }
.pw-strength.weak   { background: var(--danger);  width: 33%; }
.pw-strength.medium { background: var(--warning); width: 66%; }
.pw-strength.strong { background: var(--success); width: 100%; }

/* ── 사이드바 레이아웃 ── */
.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidenav {
  width: 230px;
  flex-shrink: 0;
  background: #d8e8f5;
  padding-top: 8px;
  border-right: 1px solid #bdd1e8;
}

.sidenav a {
  display: block;
  padding: 22px 28px;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: background .15s;
}

.sidenav a.active {
  font-weight: 800;
  color: var(--primary);
}

.sidenav a:hover:not(.active) {
  background: rgba(30, 58, 95, .07);
  text-decoration: none;
}

.layout > .main {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  margin: 0;
}

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidenav {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding-top: 0;
    border-right: none;
    border-bottom: 1px solid #bdd1e8;
  }
  .sidenav a {
    padding: 14px 20px;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 14px;
  }
}

/* ── 반응형 ── */
@media (max-width: 600px) {
  .auth-card { padding: 24px 20px; }
  .topbar { padding: 0 16px; }
  .topbar-user { display: none; }
  .main { padding: 16px 12px; }
}
