:root {
  --paper: #fff8fb;
  --surface: #ffffff;
  --surface-soft: #fff0f6;
  --ink: #181e25;
  --ink-2: #46505c;
  --muted: #68717c;
  --line: #edd1dd;
  --pink: #e21680;
  --pink-dark: #bd1069;
  --pink-soft: #ffe1ef;
  --orange: #ff633a;
  --success: #167b54;
  --warning: #a45b09;
  --danger: #bd2944;
  --shadow: 0 28px 80px rgba(145, 19, 88, .14);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --brand-gradient: linear-gradient(120deg, #e21680 0%, #fe3666 54%, #ff633a 100%);
}

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

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

::selection { background: var(--pink); color: #fff; }

:focus-visible {
  outline: 3px solid var(--pink-dark);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  transform: translateY(-180%);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.skip-link:focus { transform: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.035em;
}

.brand img { width: 38px; height: 38px; border-radius: 10px; }
.brand strong { color: var(--pink-dark); font-weight: 850; }

.button {
  min-height: 48px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  cursor: pointer;
  font-weight: 780;
  letter-spacing: -.01em;
  transition: transform .18s ease, background-color .18s, box-shadow .18s, border-color .18s;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .58; transform: none; }
.button-primary { background: var(--pink-dark); color: #fff; box-shadow: 0 12px 28px rgba(189, 16, 105, .22); }
.button-primary:hover { background: #a70d5b; box-shadow: 0 15px 34px rgba(189, 16, 105, .28); }
.button-outline { border-color: #dfa8c0; background: #fff; }
.button-outline:hover { border-color: var(--pink); background: var(--pink-soft); }
.button-quiet { min-height: 42px; padding-inline: 15px; color: var(--ink-2); }
.button-small { min-height: 44px; padding-inline: 16px; font-size: 14px; }
.button-block { width: 100%; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr);
}

.auth-aside {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100%;
  padding: 42px clamp(32px, 5vw, 76px);
  display: flex;
  flex-direction: column;
  background: #201922;
  color: #fff;
}

.auth-aside::before,
.auth-aside::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
}

.auth-aside::before {
  width: 560px;
  height: 560px;
  right: -250px;
  top: -160px;
  background: radial-gradient(circle at 40% 40%, #ff769f, #e21680 42%, transparent 70%);
  opacity: .9;
}

.auth-aside::after {
  width: 430px;
  height: 430px;
  left: -220px;
  bottom: -160px;
  background: radial-gradient(circle, #ff633a 0%, #e21680 42%, transparent 70%);
  opacity: .55;
}

.auth-aside .brand { color: #fff; }
.auth-aside .brand strong { color: #ff8dc0; }
.auth-aside-copy { max-width: 520px; margin-block: auto; padding-block: 80px; }
.auth-kicker { margin: 0 0 20px; color: #ff97c5; font-size: 12px; font-weight: 850; letter-spacing: .16em; }
.auth-aside h1 { margin: 0; font-size: clamp(44px, 5vw, 72px); line-height: 1.04; letter-spacing: -.06em; }
.auth-aside h1 em { background: linear-gradient(90deg, #ff82ba, #ff8965); background-clip: text; color: transparent; font-style: normal; }
.auth-aside-copy > p:last-of-type { max-width: 460px; margin: 26px 0 0; color: #ddd3dd; font-size: 17px; }
.auth-points { margin: 32px 0 0; padding: 0; display: grid; gap: 12px; list-style: none; color: #f7eff4; }
.auth-points li { display: flex; gap: 11px; align-items: center; }
.auth-points span { width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: #ff94c4; font-size: 12px; }
.auth-aside-footer { margin: 0; color: #a99daa; font-size: 13px; }

.auth-main {
  padding: 38px clamp(24px, 6vw, 90px);
  display: grid;
  align-content: center;
  background:
    radial-gradient(circle at 90% 8%, rgba(226, 22, 128, .09), transparent 28%),
    var(--paper);
}

.auth-top { position: absolute; top: 34px; right: clamp(24px, 5vw, 72px); color: var(--ink-2); font-size: 14px; }
.auth-top a { margin-left: 8px; color: var(--pink-dark); font-weight: 800; }
.auth-card { width: min(100%, 480px); margin-inline: auto; }
.auth-card-header { margin-bottom: 32px; }
.auth-card-header h2 { margin: 0 0 10px; font-size: clamp(34px, 4vw, 46px); line-height: 1.12; letter-spacing: -.045em; }
.auth-card-header p { margin: 0; color: var(--muted); }

.auth-form, .stack-form { display: grid; gap: 19px; }
.field { display: grid; gap: 8px; }
.role-field { margin: 0; padding: 0; border: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label, .field-label { font-size: 14px; font-weight: 750; }
.field-hint { margin: -2px 0 0; color: var(--muted); font-size: 12px; }
.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 15px;
  border: 1px solid #dcbfcb;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}

.input:hover { border-color: #ce8ead; }
.input:focus { border-color: var(--pink-dark); outline: 0; box-shadow: 0 0 0 4px rgba(226, 22, 128, .11); }
.input::placeholder { color: #9299a1; }
textarea.input { min-height: 112px; resize: vertical; }

.password-wrap { position: relative; }
.password-wrap .input { padding-right: 76px; }
.password-toggle { position: absolute; top: 5px; right: 5px; min-width: 62px; min-height: 42px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 750; }
.password-toggle:hover { background: var(--surface-soft); }

.role-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.role-option { position: relative; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }
.role-option label { min-height: 112px; padding: 17px; border: 1px solid #dcbfcb; border-radius: 15px; display: grid; align-content: start; gap: 5px; background: #fff; cursor: pointer; }
.role-option strong { font-size: 16px; }
.role-option span { color: var(--muted); font-size: 13px; font-weight: 500; }
.role-option input:checked + label { border: 2px solid var(--pink-dark); padding: 16px; background: var(--pink-soft); box-shadow: 0 0 0 3px rgba(226, 22, 128, .08); }
.role-option input:focus-visible + label { outline: 3px solid var(--pink-dark); outline-offset: 3px; }

.form-options { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 13px; }
.check-label { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check-label input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--pink-dark); }
.inline-link { color: var(--pink-dark); font-weight: 750; }
.inline-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.form-status { min-height: 24px; margin: 0; padding: 0; color: var(--muted); font-size: 14px; }
.form-status.is-error { padding: 10px 13px; border-radius: 10px; background: #fff0f2; color: var(--danger); }
.form-status.is-success { padding: 10px 13px; border-radius: 10px; background: #eaf8f2; color: var(--success); }
.form-fineprint { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }

/* Application shell */
.app-body { background: #f8f5f7; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 80;
  height: 72px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}

.app-header-inner { width: 100%; padding: 0 26px; display: flex; align-items: center; gap: 18px; }
.app-role-pill { padding: 6px 11px; border-radius: 999px; background: var(--pink-soft); color: var(--pink-dark); font-size: 12px; font-weight: 800; }
.app-header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-summary { display: grid; text-align: right; line-height: 1.3; }
.user-summary strong { font-size: 14px; }
.user-summary span { color: var(--muted); font-size: 12px; }
.sidebar-toggle { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-size: 21px; }

.app-layout { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.app-sidebar { padding: 24px 16px; border-right: 1px solid var(--line); background: #fff; }
.app-nav { display: grid; gap: 5px; }
.app-nav a { min-height: 45px; padding: 10px 13px; border-radius: 11px; display: flex; align-items: center; gap: 11px; color: var(--ink-2); font-size: 14px; font-weight: 700; }
.app-nav a:hover { background: var(--surface-soft); }
.app-nav a[aria-current="page"] { background: var(--pink-soft); color: var(--pink-dark); }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; color: currentColor; }
.sidebar-note { margin-top: 28px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fffafd; }
.sidebar-note strong { display: block; margin-bottom: 5px; font-size: 13px; }
.sidebar-note p { margin: 0; color: var(--muted); font-size: 12px; }
.sidebar-note a { display: inline-block; margin-top: 10px; color: var(--pink-dark); font-size: 12px; font-weight: 800; }

.app-main { min-width: 0; padding: 38px clamp(22px, 4vw, 58px) 64px; }
.page-heading { margin-bottom: 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin: 0 0 7px; font-size: clamp(30px, 4vw, 43px); line-height: 1.12; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); }
.page-heading .button { flex: 0 0 auto; }

.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.panel { grid-column: span 12; padding: 25px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 8px 30px rgba(41, 20, 32, .035); }
.panel-half { grid-column: span 6; }
.panel-two-thirds { grid-column: span 8; }
.panel-third { grid-column: span 4; }
.panel-header { margin-bottom: 21px; display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.panel-header h2 { margin: 0 0 5px; font-size: 19px; letter-spacing: -.025em; }
.panel-header p { margin: 0; color: var(--muted); font-size: 13px; }
.panel-tag { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--pink-dark); font-size: 11px; font-weight: 800; }

.welcome-panel { position: relative; overflow: hidden; padding: clamp(25px, 4vw, 40px); background: #211a22; color: #fff; }
.welcome-panel::after { content: ""; position: absolute; right: -100px; top: -190px; width: 440px; height: 440px; border-radius: 50%; background: var(--brand-gradient); opacity: .88; }
.welcome-panel > * { position: relative; z-index: 1; }
.welcome-panel .panel-tag { background: rgba(255,255,255,.12); color: #fff; }
.welcome-panel h2 { max-width: 670px; margin: 0 0 12px; font-size: clamp(27px, 3vw, 38px); line-height: 1.14; letter-spacing: -.04em; }
.welcome-panel p { max-width: 650px; margin: 0; color: #dcd3dc; }
.welcome-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.welcome-actions .button-outline { border-color: rgba(255,255,255,.38); background: rgba(255,255,255,.06); color: #fff; }
.welcome-actions .button-outline:hover { background: rgba(255,255,255,.14); }

.onboarding-list { margin: 0; padding: 0; display: grid; list-style: none; }
.onboarding-list li { padding: 16px 0; border-bottom: 1px solid #f0e4e9; display: grid; grid-template-columns: 38px 1fr auto; gap: 13px; align-items: center; }
.onboarding-list li:last-child { border-bottom: 0; }
.step-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pink-soft); color: var(--pink-dark); font-size: 13px; font-weight: 850; }
.onboarding-list strong { display: block; font-size: 14px; }
.onboarding-list p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.step-state { color: var(--muted); font-size: 12px; font-weight: 750; }

.empty-state { min-height: 230px; padding: 30px 18px; display: grid; place-items: center; align-content: center; text-align: center; }
.empty-icon { width: 58px; height: 58px; margin-bottom: 16px; border-radius: 18px; display: grid; place-items: center; background: var(--pink-soft); color: var(--pink-dark); font-size: 24px; }
.empty-state h3 { margin: 0 0 7px; font-size: 17px; }
.empty-state p { max-width: 430px; margin: 0; color: var(--muted); font-size: 13px; }
.empty-state .button { margin-top: 18px; }

.info-list { margin: 0; display: grid; gap: 14px; }
.info-list div { padding-bottom: 13px; border-bottom: 1px solid #f1e6ea; display: grid; grid-template-columns: 112px 1fr; gap: 12px; }
.info-list div:last-child { padding-bottom: 0; border-bottom: 0; }
.info-list dt { color: var(--muted); font-size: 13px; }
.info-list dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 700; }
.panel-third .info-list div { grid-template-columns: 82px minmax(0, 1fr); gap: 8px; }

.metric-grid { grid-column: span 12; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.metric { padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.metric span { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 10px; font-size: 27px; letter-spacing: -.035em; }
.metric small { display: block; margin-top: 5px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 680px; font-size: 13px; }
.data-table th { padding: 11px 13px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-size: 12px; }
.data-table td { padding: 14px 13px; border-bottom: 1px solid #f3e8ec; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.role-badge, .status-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.role-badge { background: var(--pink-soft); color: var(--pink-dark); }
.status-badge { background: #e7f6ef; color: var(--success); }
.status-badge.is-inactive { background: #f1eff0; color: var(--muted); }
.loading-row td { height: 120px; color: var(--muted); text-align: center; }

.notice { padding: 14px 16px; border: 1px solid #f1c98f; border-radius: 12px; background: #fff9ec; color: #72410c; font-size: 13px; }
.notice strong { display: block; margin-bottom: 3px; }
.dashboard-status { margin: 0 0 20px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: none; background: rgba(24, 30, 37, .45); }

@media (max-width: 980px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { min-height: auto; padding: 28px 26px 36px; }
  .auth-aside-copy { margin: 55px 0 0; padding: 0; }
  .auth-aside h1 { font-size: clamp(38px, 8vw, 58px); }
  .auth-points, .auth-aside-footer { display: none; }
  .auth-main { position: relative; padding-block: 70px; }
  .auth-top { top: 22px; }
  .panel-two-thirds, .panel-third { grid-column: span 12; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .app-header-inner { padding-inline: 15px; }
  .app-header .brand span { display: none; }
  .app-role-pill { margin-right: auto; }
  .user-summary { display: none; }
  .sidebar-toggle { display: grid; place-items: center; order: -1; }
  .app-layout { grid-template-columns: 1fr; }
  .app-sidebar { position: fixed; inset: 72px auto 0 0; z-index: 100; width: min(82vw, 286px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 50px rgba(35, 18, 27, .14); }
  .app-sidebar.is-open { transform: translateX(0); }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .modal-backdrop { display: block; }
  .app-main { padding: 27px 18px 50px; }
  .page-heading { align-items: start; flex-direction: column; }
  .panel-half { grid-column: span 12; }
  .welcome-panel::after { opacity: .46; }
}

@media (max-width: 560px) {
  .auth-aside { padding-inline: 20px; }
  .auth-main { padding: 68px 20px 44px; }
  .auth-top { right: 20px; }
  .auth-card-header { margin-bottom: 26px; }
  .field-row, .role-options { grid-template-columns: 1fr; }
  .role-option label { min-height: 88px; }
  .form-options { align-items: flex-start; flex-direction: column; }
  .app-role-pill { display: none; }
  .app-header-actions { gap: 2px; }
  .metric-grid { grid-template-columns: 1fr; }
  .panel { padding: 20px; border-radius: 16px; }
  .onboarding-list li { grid-template-columns: 34px 1fr; }
  .step-state { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
