:root {
  color-scheme: light;
  --brand-green: #82a793;
  --brand-graphite: #595757;
  --navy-950: #222c27;
  --navy-900: #304039;
  --navy-800: #3d5148;
  --blue-600: #557867;
  --blue-500: #82a793;
  --cyan-400: #b9cfc3;
  --green-500: #648f7b;
  --red-600: #c73c4d;
  --ink-900: #302f2f;
  --ink-700: #595757;
  --ink-500: #7b7f7c;
  --line: #e2e8e4;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --shadow: 0 24px 70px rgba(34, 44, 39, 0.16);
  font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink-900);
}

button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.loading-view {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--navy-950);
  color: #cbd5e8;
}

.loading-view p { margin: 0; font-size: 14px; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-shell {
  width: 112px;
  height: 68px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 9px 28px rgba(14, 25, 20, 0.22);
}

.brand-logo-shell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cms-label {
  color: #fff;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.015em;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(520px, 1.1fr);
}

.auth-intro {
  position: relative;
  overflow: hidden;
  padding: clamp(42px, 6vw, 88px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 85% 18%, rgba(130, 167, 147, 0.3), transparent 24%),
    radial-gradient(circle at 15% 84%, rgba(185, 207, 195, 0.17), transparent 28%),
    var(--navy-950);
  color: #fff;
}

.auth-intro::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: 8%;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 50%;
  box-shadow: 0 0 0 58px rgba(255,255,255,0.025), 0 0 0 118px rgba(255,255,255,0.018);
}

.auth-intro > * { position: relative; z-index: 1; }

.eyebrow {
  margin: clamp(74px, 13vh, 132px) 0 16px;
  color: #b9cfc3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.eyebrow.dark { margin: 0 0 5px; color: var(--blue-600); }

.auth-intro h1 {
  margin: 0;
  font-size: clamp(38px, 4.2vw, 64px);
  line-height: 1.16;
  letter-spacing: -0.055em;
}

.intro-copy {
  max-width: 540px;
  margin: 26px 0 0;
  color: #bdc9c2;
  font-size: 16px;
  line-height: 1.78;
  word-break: keep-all;
}

.intro-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #bdc9c2;
  font-size: 13px;
}

.intro-status span, .api-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9bc4ae;
  box-shadow: 0 0 0 5px rgba(130, 167, 147, 0.15);
}

.auth-panel {
  padding: 48px 7vw;
  display: grid;
  place-items: center;
  background: var(--surface);
}

.auth-card { width: min(100%, 480px); }
.login-card { width: min(100%, 430px); }

.step-label, .panel-kicker {
  margin: 0 0 10px;
  color: var(--blue-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.auth-card h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.045em;
}

.card-copy {
  margin: 13px 0 30px;
  color: var(--ink-500);
  line-height: 1.65;
  word-break: keep-all;
}

.identity-summary {
  margin: 0 0 26px;
  padding: 17px 20px;
  display: grid;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8f9fc;
}

.identity-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.identity-summary dt { color: var(--ink-500); font-size: 13px; }
.identity-summary dd { margin: 0; font-size: 13px; font-weight: 750; }

form { display: grid; gap: 20px; }

.field { display: grid; gap: 8px; }
.field > span:first-child { font-size: 13px; font-weight: 750; }

.field input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid #cfd6e3;
  border-radius: 10px;
  outline: none;
  color: var(--ink-900);
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(130, 167, 147, 0.18);
}

.field small { color: var(--ink-500); font-size: 12px; }

.password-field { position: relative; display: block; }
.password-field input { padding-right: 64px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  height: 34px;
  padding: 0 9px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
}

.password-toggle:hover { background: #f0f3f8; color: var(--ink-900); }

.form-message {
  margin: -4px 0 0;
  padding: 11px 13px;
  border-radius: 9px;
  background: #fff0f2;
  color: var(--red-600);
  font-size: 13px;
  line-height: 1.5;
}

.form-message.success { background: #eaf9f3; color: #147b59; }

.primary-button {
  height: 52px;
  border: 0;
  border-radius: 10px;
  background: var(--navy-900);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  transition: transform 150ms ease, background 150ms ease;
}

.primary-button:hover { background: var(--navy-800); transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: 0.62; transform: none; }
.secondary-button {
  width: 100%;
  height: 46px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 750;
}
.secondary-button:hover { border-color: #b7c8bf; background: #f7f9f8; color: var(--ink-900); }
.support-copy { margin: 22px 0 0; color: var(--ink-500); font-size: 12px; text-align: center; }

.dashboard-layout { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }

.sidebar {
  min-height: 100vh;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  background: var(--navy-950);
  color: #fff;
}

.sidebar-brand {
  align-self: flex-start;
  width: fit-content;
  padding: 0;
  margin: 0 10px 30px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border-radius: 10px;
}
.sidebar-brand:focus-visible { outline: 2px solid var(--brand-green); outline-offset: 5px; }
.sidebar-brand .brand-logo-shell { width: 92px; height: 56px; padding: 6px 8px; border-radius: 9px; }
.sidebar-brand .cms-label { font-size: 36px; }

.sidebar nav { display: grid; gap: 6px; }

.nav-item {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #aab8b0;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(130, 167, 147, 0.2); color: #fff; }

.nav-dot { width: 7px; height: 7px; border: 1.5px solid currentColor; border-radius: 50%; }
.nav-item.active .nav-dot { border-color: #b9cfc3; background: #b9cfc3; }

.sidebar-footer {
  margin-top: auto;
  padding: 18px 10px 0;
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: #829289;
  font-size: 11px;
}

.sidebar-footer button {
  width: fit-content;
  padding: 0;
  border: 0;
  background: none;
  color: #c2cec7;
  font-size: 12px;
}

.dashboard-main { min-width: 0; }

.topbar {
  height: 88px;
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar-title {
  margin: 0;
  color: var(--brand-graphite);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.025em;
}

.topbar-title span { color: var(--brand-green); }

.account-chip { display: flex; align-items: center; gap: 11px; }
.topbar .account-chip { margin-left: auto; }
.account-chip > span:last-child { display: grid; gap: 2px; }
.account-chip strong { font-size: 13px; }
.account-chip small { color: var(--ink-500); font-size: 11px; }

.account-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f0eb;
  color: var(--blue-600);
  font-size: 13px;
  font-weight: 850;
}

.dashboard-content { max-width: 1340px; padding: 34px 38px 60px; }
.dashboard-page { min-width: 0; }

.welcome-panel, .next-panel {
  padding: 28px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 9px 30px rgba(26, 42, 72, 0.045);
}

.welcome-panel h2, .next-panel h2 { margin: 0 0 8px; font-size: 23px; letter-spacing: -0.035em; }
.welcome-panel p:last-child, .next-panel p:last-child { margin: 0; color: var(--ink-500); font-size: 14px; line-height: 1.65; }

.api-badge {
  flex: 0 0 auto;
  min-width: 118px;
  height: 38px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 999px;
  background: #edf4f0;
  color: #4f7462;
  font-size: 12px;
  font-weight: 800;
}

.api-badge.checking { background: #eef2f8; color: var(--ink-500); }
.api-badge.checking span { background: #9aa6ba; box-shadow: none; }
.api-badge.error { background: #fff0f2; color: var(--red-600); }
.api-badge.error span { background: var(--red-600); box-shadow: none; }

.metric-grid {
  margin: 20px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  min-width: 0;
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.metric-card p { margin: 0 0 16px; color: var(--ink-700); font-size: 13px; font-weight: 750; }
.metric-card strong { display: block; font-size: 33px; letter-spacing: -0.045em; }
.metric-card strong small { margin-left: 4px; color: var(--ink-500); font-size: 13px; font-weight: 700; }
.metric-card > span { display: block; margin-top: 9px; color: var(--ink-500); font-size: 11px; }

.stage-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 8px;
  background: #eef2f8;
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 750;
}

.page-heading {
  padding: 29px 30px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.page-heading h2 { margin: 5px 0 8px; font-size: 28px; letter-spacing: -0.035em; }
.page-heading p:last-child { margin: 0; color: var(--ink-500); font-size: 14px; }

.owner-pill {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  background: #e8f0eb;
  color: #4f7462;
  font-size: 11px;
  font-weight: 850;
}

.admin-invite-panel {
  margin-top: 18px;
  padding: 25px 27px;
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.2fr);
  gap: 34px;
  align-items: end;
  border: 1px solid #cddbd3;
  border-radius: 15px;
  background: linear-gradient(135deg, #f7faf8, #fff);
}

.admin-invite-panel h3 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.025em; }
.admin-invite-panel > div > p:last-child { margin: 0; color: var(--ink-500); font-size: 13px; line-height: 1.65; }
.admin-invite-panel form { grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 12px; }
.admin-invite-panel .primary-button { min-width: 166px; height: 50px; padding: 0 18px; }
.admin-invite-panel .form-message { grid-column: 1 / -1; }

.activation-code-result {
  margin-top: 18px;
  padding: 24px 26px;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr);
  gap: 22px 38px;
  align-items: center;
  border: 1px solid #9ebbaa;
  border-radius: 15px;
  background: #edf5f0;
}

.activation-code-result > div > p { margin: 0 0 7px; color: #527461; font-size: 11px; font-weight: 800; }
.activation-code-result > div > strong { color: var(--navy-900); font-size: 34px; letter-spacing: 0.12em; }
.activation-code-result dl { margin: 0; display: grid; gap: 8px; }
.activation-code-result dl div { display: grid; grid-template-columns: 52px 1fr; gap: 10px; }
.activation-code-result dt { color: var(--ink-500); font-size: 11px; }
.activation-code-result dd { margin: 0; color: var(--ink-700); font-size: 12px; font-weight: 750; }
.activation-code-result > p { grid-column: 1 / -1; margin: 0; color: #7b6750; font-size: 11px; line-height: 1.55; }

.users-message {
  margin: 18px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-500);
  font-size: 13px;
}

.users-message.error { border-color: #f1c9cf; background: #fff6f7; color: var(--red-600); }

.user-table-shell {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.user-table-shell table { width: 100%; border-collapse: collapse; }
.user-table-shell th, .user-table-shell td { padding: 17px 18px; border-bottom: 1px solid var(--line); text-align: left; }
.user-table-shell th { background: #f7f9f8; color: var(--ink-500); font-size: 11px; font-weight: 800; }
.user-table-shell td { color: var(--ink-700); font-size: 13px; }
.user-table-shell tbody tr:last-child td { border-bottom: 0; }
.user-table-shell td:first-child { color: var(--ink-900); font-weight: 800; }
.user-table-shell td:first-child small { display: block; margin-top: 4px; color: var(--brand-green); font-size: 10px; }

.role-badge, .user-status {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 850;
}

.role-badge.owner { background: #e8f0eb; color: #4f7462; }
.role-badge.admin { background: #eff1f0; color: var(--ink-700); }
.user-status.active { background: #edf6f1; color: #3f775e; }
.user-status.inactive { background: #fff0f2; color: var(--red-600); }

.user-actions { min-width: 158px; white-space: nowrap; }
.user-action {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid #cbd7d0;
  border-radius: 7px;
  background: #fff;
  color: var(--ink-700);
  font-size: 10px;
  font-weight: 800;
}
.user-action + .user-action { margin-left: 6px; }
.user-action.transfer:hover { border-color: var(--brand-green); background: #f1f7f3; color: #4f7462; }
.user-action.delete { border-color: #ecd0d4; color: var(--red-600); }
.user-action.delete:hover { background: #fff4f5; }
.user-action:disabled { cursor: wait; opacity: .55; }

.pending-invitations {
  margin-top: 18px;
  padding: 22px 23px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-title-row h3 { margin: 0; font-size: 18px; }
.section-title-row > span { color: var(--brand-green); font-size: 12px; font-weight: 850; }
.pending-invitation-list { margin-top: 16px; display: grid; gap: 9px; }
.pending-invitation-list article {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-radius: 10px;
  background: #f7f9f8;
}
.pending-invitation-list article > div { display: grid; gap: 3px; }
.pending-invitation-list article > div:last-child { text-align: right; }
.pending-invitation-list strong { color: var(--ink-700); font-size: 12px; }
.pending-invitation-list span { color: var(--ink-500); font-size: 11px; }

.users-next-step {
  margin-top: 18px;
  padding: 21px 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px dashed #c9d6cf;
  border-radius: 13px;
  background: #f8faf9;
}

.users-next-step strong { color: var(--ink-700); font-size: 12px; }
.users-next-step p { margin: 5px 0 0; color: var(--ink-500); font-size: 13px; }
.users-next-step > span { color: var(--brand-green); font-size: 11px; font-weight: 800; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 12px 17px;
  transform: translateX(-50%);
  border-radius: 10px;
  background: var(--navy-950);
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 13px;
}

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-intro { min-height: 340px; padding: 38px 8vw; }
  .auth-intro .eyebrow { margin-top: 58px; }
  .auth-intro h1 { font-size: 40px; }
  .intro-status { margin-top: 44px; }
  .auth-panel { padding: 60px 8vw; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-invite-panel { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 720px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding: 15px 16px; flex-direction: row; align-items: center; }
  .sidebar-brand { margin: 0; }
  .sidebar nav { margin-left: auto; }
  .sidebar .nav-item:not(.active), .sidebar-footer { display: none; }
  .sidebar .nav-item.active { width: auto; padding: 0 12px; }
  .topbar { height: 76px; padding: 0 20px; }
  .topbar-title { font-size: 13px; letter-spacing: 0; }
  .account-chip small { display: none; }
  .dashboard-content { padding: 22px 20px 44px; }
  .welcome-panel, .next-panel { padding: 23px; align-items: flex-start; flex-direction: column; }
  .page-heading, .users-next-step { flex-direction: column; }
  .admin-invite-panel form { grid-template-columns: 1fr; }
  .activation-code-result { grid-template-columns: 1fr; }
  .activation-code-result > p { grid-column: auto; }
  .user-table-shell { overflow-x: auto; }
  .user-table-shell table { min-width: 880px; }
}

@media (max-width: 520px) {
  .auth-intro { min-height: 300px; }
  .auth-intro h1 { font-size: 34px; }
  .auth-intro .eyebrow { margin-top: 42px; }
  .eyebrow { font-size: 9px; letter-spacing: 0.1em; }
  .intro-copy { font-size: 14px; }
  .auth-panel { padding: 42px 22px 60px; }
  .auth-card h2 { font-size: 29px; }
  .identity-summary div { align-items: flex-start; flex-direction: column; gap: 5px; }
  .metric-grid { grid-template-columns: 1fr; }
  .topbar-title { max-width: 210px; line-height: 1.3; }
  .account-chip > span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
