/* wage portal style — clean member portal feel (ref: newlabs.me) */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: #1c2533;
  background: #f4f6fa;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea {
  font: inherit; color: inherit; border: 1px solid #d8dde6;
  background: #fff; padding: 10px 12px; border-radius: 6px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #2563eb40; border-color: #2563eb; }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid #e5e9f0; }

/* ========== Top Bar (logo + language switcher) ========== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  padding: 0 24px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.01em; color: #0b1a36;
}
.topbar .brand .logo-dot {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900; font-size: 14px;
}
.lang-switch { display: flex; gap: 6px; align-items: center; }
.lang-switch .lang-btn {
  width: 30px; height: 22px; border-radius: 3px;
  border: 1px solid #e5e9f0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #4a5878;
  background: #fff;
}
.lang-switch .lang-btn.active { border-color: #2563eb; color: #2563eb; }
.lang-switch .flag {
  width: 24px; height: 16px; border-radius: 2px; display: inline-block;
  background-size: cover; background-position: center;
}
.flag-ko { background: linear-gradient(180deg, #fff 50%, #cd2e3a 50%); }
.flag-cn { background: #de2910; }
.flag-vn { background: #da251d; }
.flag-jp { background: radial-gradient(circle, #bc002d 30%, #fff 30%); }
.flag-us { background: linear-gradient(180deg, #b22234 10%, #fff 10%, #fff 20%, #b22234 20%, #b22234 30%, #fff 30%); }

/* ========== Auth (Login / Register) ========== */
.auth-wrap {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: #fff; border: 1px solid #e5e9f0; border-radius: 12px;
  padding: 36px 32px; box-shadow: 0 4px 20px rgba(10,22,40,0.06);
}
.auth-card .auth-logo {
  text-align: center; margin-bottom: 22px;
  font-size: 22px; font-weight: 900; color: #0b1a36; letter-spacing: -0.02em;
}
.auth-card h1 {
  font-size: 18px; font-weight: 700; color: #1c2533;
  margin-bottom: 24px; text-align: center;
}
.auth-card .form-row { margin-bottom: 12px; }
.auth-card label { display: block; font-size: 13px; color: #4a5878; margin-bottom: 6px; }
.auth-card .checkbox-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #4a5878; margin: 12px 0 18px;
}
.auth-card .checkbox-row input { width: auto; }
.auth-card .btn-primary {
  width: 100%; padding: 12px; border-radius: 6px;
  background: #2563eb; color: #fff; font-weight: 700; font-size: 15px;
  transition: background .15s;
}
.auth-card .btn-primary:hover { background: #1d4ed8; }
.auth-card .divider {
  text-align: center; color: #94a0b8; font-size: 12px;
  margin: 18px 0; position: relative;
}
.auth-card .divider::before, .auth-card .divider::after {
  content: ''; position: absolute; top: 50%; width: calc(50% - 25px);
  height: 1px; background: #e5e9f0;
}
.auth-card .divider::before { left: 0; }
.auth-card .divider::after { right: 0; }
.auth-card .alt-link {
  display: block; text-align: center; color: #2563eb;
  font-size: 14px; font-weight: 600; padding: 10px;
}
.auth-card .alt-link:hover { text-decoration: underline; }
.error-msg {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 12px;
}

/* ========== Member Portal Layout ========== */
.portal {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 64px);
}
.portal-side {
  background: #fff; border-right: 1px solid #e5e9f0; padding: 24px 0;
}
.portal-side .user-card {
  padding: 0 20px 20px; border-bottom: 1px solid #e5e9f0; margin-bottom: 16px;
}
.portal-side .user-card .name {
  font-weight: 700; font-size: 15px; color: #0b1a36; margin-bottom: 4px;
}
.portal-side .user-card .meta {
  font-size: 12px; color: #6b7a95;
}
.portal-side .user-card .rank-badge {
  display: inline-block; background: #eef4ff; color: #2563eb;
  padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; margin-top: 6px;
}
.portal-nav { list-style: none; }
.portal-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 14px; color: #4a5878;
  border-left: 3px solid transparent; transition: all .12s;
}
.portal-nav li a:hover { background: #f7f9fc; color: #1c2533; }
.portal-nav li a.active {
  background: #eef4ff; color: #2563eb; border-left-color: #2563eb; font-weight: 600;
}
.portal-main {
  padding: 28px 32px;
}
.page-title {
  font-size: 22px; font-weight: 800; color: #0b1a36; margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.page-sub { font-size: 13px; color: #6b7a95; margin-bottom: 24px; }

/* ========== KPI Cards ========== */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.kpi-card {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 10px;
  padding: 18px 20px;
}
.kpi-card .label { font-size: 12px; color: #6b7a95; margin-bottom: 8px; font-weight: 600; }
.kpi-card .value { font-size: 22px; font-weight: 800; color: #0b1a36; letter-spacing: -0.02em; }
.kpi-card .unit { font-size: 13px; font-weight: 600; color: #6b7a95; margin-left: 4px; }
.kpi-card .delta { font-size: 12px; color: #16a34a; font-weight: 600; margin-top: 6px; }
.kpi-card.accent {
  background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
  color: #fff; border-color: transparent;
}
.kpi-card.accent .label, .kpi-card.accent .value, .kpi-card.accent .unit { color: #fff; }
.kpi-card.accent .label { opacity: .85; }

.progress-row { margin-top: 10px; }
.progress { background: #e5e9f0; height: 6px; border-radius: 3px; overflow: hidden; }
.progress .bar { height: 100%; background: linear-gradient(90deg, #2563eb, #06b6d4); border-radius: 3px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: #6b7a95; margin-top: 6px; }

/* ========== Tables ========== */
.panel {
  background: #fff; border: 1px solid #e5e9f0; border-radius: 10px; overflow: hidden;
  margin-bottom: 18px;
}
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid #e5e9f0;
  display: flex; align-items: center; justify-content: space-between;
}
.panel-head h2 { font-size: 15px; font-weight: 700; color: #0b1a36; }
.panel-body { padding: 18px; }
.panel-body.no-pad { padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; font-size: 13px; }
thead { background: #f7f9fc; }
thead th { font-weight: 700; color: #4a5878; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { border-top: 1px solid #eef0f5; }
tbody tr:hover { background: #fafbfd; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700;
}
.badge.b-green { background: #dcfce7; color: #166534; }
.badge.b-amber { background: #fef3c7; color: #92400e; }
.badge.b-red { background: #fee2e2; color: #991b1b; }
.badge.b-blue { background: #dbeafe; color: #1e40af; }
.badge.b-gray { background: #e5e9f0; color: #4a5878; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 600;
  transition: all .12s;
}
.btn.b-primary { background: #2563eb; color: #fff; }
.btn.b-primary:hover { background: #1d4ed8; }
.btn.b-outline { background: #fff; color: #2563eb; border: 1px solid #2563eb; }
.btn.b-outline:hover { background: #eef4ff; }
.btn.b-ghost { background: transparent; color: #4a5878; }
.btn.b-ghost:hover { background: #f7f9fc; }
.btn.b-danger { background: #ef4444; color: #fff; }
.btn.b-sm { padding: 5px 10px; font-size: 12px; }

/* ========== Tree ========== */
.tree { font-size: 13px; }
.tree-node {
  padding: 8px 12px; margin: 4px 0;
  background: #f7f9fc; border-radius: 6px;
  display: flex; align-items: center; gap: 12px;
}
.tree-node .nm { font-weight: 700; color: #0b1a36; }
.tree-node .un { color: #6b7a95; font-size: 12px; }
.tree-node .stats { margin-left: auto; font-size: 12px; color: #6b7a95; }
.tree-children { padding-left: 24px; border-left: 2px solid #e5e9f0; margin-left: 12px; }

/* ========== Toast ========== */
.toast {
  position: fixed; top: 80px; right: 24px;
  background: #0b1a36; color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 14px; z-index: 1000;
  box-shadow: 0 8px 24px rgba(10,22,40,0.2);
  opacity: 0; transform: translateY(-10px); transition: all .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #b91c1c; }
.toast.ok { background: #16a34a; }

/* ========== Mobile ========== */
@media (max-width: 880px) {
  .topbar { padding: 0 14px; height: 56px; }
  .portal { grid-template-columns: 1fr; }
  .portal-side {
    border-right: 0; border-bottom: 1px solid #e5e9f0; padding: 12px 0;
  }
  .portal-side .user-card { padding: 0 14px 14px; }
  .portal-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px; }
  .portal-nav li a {
    padding: 8px 12px; border-left: 0; border-radius: 6px; font-size: 13px;
  }
  .portal-nav li a.active { background: #2563eb; color: #fff; border-left: 0; }
  .portal-main { padding: 18px 14px; }
  .auth-card { padding: 28px 22px; }
}
