:root {
  --brand: #4db6e6;        /* KOREA SMA 로고 블루 */
  --brand-light: #eaf7fd;
  --brand-dark: #1f3c66;   /* 사이드바/헤더 네이비 */
  --brand-darker: #16294a;
  --admin-accent: #b45309; /* 관리자 영역 은은한 포인트 */
  --bg: #f3f6fa;
  --card: #ffffff;
  --border: #e4e9f1;
  --text: #1e293b;
  --muted: #6b7688;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Pretendard", "Malgun Gothic", "맑은 고딕", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }

/* ===================== 인트라넷 앱 셸 (사이드바 + 콘텐츠) ===================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-dark) 0%, var(--brand-darker) 100%);
  color: #dbe6f5;
  display: flex;
  flex-direction: column;
  padding: 22px 0;
}
.sidebar .brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 22px 20px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar .brand-block img { width: 30px; height: 30px; object-fit: contain; }
.sidebar .brand-block .name { font-weight: 700; font-size: 14.5px; color: #fff; line-height: 1.3; }
.sidebar .brand-block .sub { font-size: 10.5px; color: #93a8c7; letter-spacing: .03em; }

.sidebar .mode-tag {
  margin: 0 20px 18px 20px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  display: inline-block;
  background: rgba(255,255,255,0.1);
  color: #cfe1f7;
}
.sidebar.admin .mode-tag { background: rgba(180, 83, 9, 0.25); color: #fcd9a8; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; flex: 1; }
.sidebar nav a {
  color: #b9c7de;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(255,255,255,0.13); color: #fff; font-weight: 600; }
.sidebar .icon { width: 18px; text-align: center; opacity: .9; }

.sidebar .sidebar-footer {
  padding: 14px 20px 4px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 12px;
  color: #8ba0c2;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar-inner .page-title { font-size: 16.5px; font-weight: 700; color: var(--text); }
.topbar-inner .user-chip {
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted);
}
.topbar-inner .user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-inner .logout-link { color: var(--muted); font-size: 12.5px; margin-left: 6px; }

.content { padding: 26px 28px 40px 28px; max-width: 1120px; width: 100%; }

/* ===================== 카드 / 테이블 / 폼 ===================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.03);
}
.card h2 { margin-top: 0; font-size: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #f8fafc; }

.btn {
  display: inline-block;
  background: var(--brand-dark);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  cursor: pointer;
}
.btn:hover { background: var(--brand-darker); text-decoration: none; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn.ghost { background: #fff; color: var(--brand-dark); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--brand-dark); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

input[type=text], input[type=password], input[type=file], select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 12px;
  background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
label { font-size: 12.5px; color: var(--muted); display: block; margin-bottom: 4px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.admin { background: #ede9fe; color: #5b21b6; }
.badge.user { background: #e0f2fe; color: #075985; }

.msg { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 16px; }
.msg.error { background: #fee2e2; color: #991b1b; }
.msg.ok { background: #dcfce7; color: #166534; }
.msg.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.muted { color: var(--muted); font-size: 13px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex.between { justify-content: space-between; }
.preview-box { text-align: center; }
.preview-box img { max-width: 100%; border-radius: 8px; margin: 0 auto; }
.preview-box iframe { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: 8px; }
pre.preview-text { text-align: left; background: #f8fafc; padding: 14px; border-radius: 8px; max-height: 70vh; overflow: auto; white-space: pre-wrap; word-break: break-all; }

.stat-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 160px; margin-bottom: 0; }
.stat-card .stat-label { color: var(--muted); font-size: 12.5px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }

/* ===================== 로그인 스플릿 화면 ===================== */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}
.login-visual {
  flex: 1.1;
  background: linear-gradient(135deg, var(--brand-dark) 0%, #2c5a92 55%, var(--brand) 130%);
  color: #fff;
  padding: 56px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-visual::before {
  content: "";
  position: absolute; right: -120px; top: -120px;
  width: 380px; height: 380px; border-radius: 50%;
  background: rgba(255,255,255,0.07);
}
.login-visual::after {
  content: "";
  position: absolute; right: 60px; bottom: -160px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.login-visual .lv-top { position: relative; z-index: 1; }
.login-visual .lv-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 60px; }
.login-visual .lv-brand img { width: 34px; height: 34px; }
.login-visual .lv-brand span { font-weight: 700; font-size: 16px; }
.login-visual h1 { font-size: 32px; line-height: 1.35; margin: 0 0 16px 0; font-weight: 800; }
.login-visual p.desc { color: #dbe7f7; font-size: 14.5px; line-height: 1.7; max-width: 420px; }
.login-visual .lv-stats { position: relative; z-index: 1; display: flex; gap: 34px; margin-top: 20px; }
.login-visual .lv-stats .n { font-size: 20px; font-weight: 800; }
.login-visual .lv-stats .l { font-size: 11.5px; color: #c6d8ef; margin-top: 2px; }

.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 40px;
}
.login-form-box { width: 100%; max-width: 340px; }
.login-form-box h2 { font-size: 22px; margin: 0 0 6px 0; }
.login-form-box .lead { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }
.login-form-box .field-icon { position: relative; }
.login-form-box .field-icon input { padding-left: 34px; }
.login-form-box .field-icon .fi { position: absolute; left: 10px; top: 11px; color: #9aa7bb; font-size: 14px; }
.login-form-box .btn { width: 100%; padding: 11px; font-size: 14.5px; margin-top: 4px; }
.login-form-box .switch-link { text-align: center; margin-top: 22px; font-size: 13px; color: var(--muted); }
.login-form-box .switch-link a { font-weight: 700; }

.admin-login .login-visual {
  background: linear-gradient(135deg, #2b2f38 0%, #3d4453 55%, var(--admin-accent) 145%);
}

@media (max-width: 860px) {
  .login-visual { display: none; }
  .sidebar { display: none; }
  .content { padding: 18px; }
}
