:root {
  --ink: #173234;
  --muted: #667b7c;
  --line: #dce6e4;
  --canvas: #f4f7f6;
  --surface: #ffffff;
  --teal-950: #073f42;
  --teal-900: #0b5558;
  --teal-800: #106b6e;
  --teal-700: #148083;
  --teal-100: #d9efed;
  --teal-50: #edf8f7;
  --sand: #f2e8d8;
  --sand-deep: #c89554;
  --danger: #b63c48;
  --warning: #9a6508;
  --shadow-sm: 0 1px 2px rgba(8, 49, 51, .05), 0 8px 26px rgba(8, 49, 51, .06);
  --shadow-lg: 0 24px 64px rgba(3, 38, 40, .18);
  --radius: 1rem;
  --bs-primary: #0f6d70;
  --bs-primary-rgb: 15, 109, 112;
  --bs-link-color: #0b6669;
  --bs-link-hover-color: #084d50;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-font-sans-serif: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 96% 2%, rgba(20, 128, 131, .08), transparent 28rem),
    var(--canvas);
  letter-spacing: -.012em;
}

button, input, select, textarea { letter-spacing: inherit; }

a { text-underline-offset: .2em; }

.skip-link {
  position: fixed;
  z-index: 10000;
  top: .75rem;
  left: .75rem;
  transform: translateY(-200%);
  padding: .65rem 1rem;
  color: white;
  background: var(--teal-950);
  border-radius: .5rem;
}

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

:focus-visible {
  outline: 3px solid rgba(15, 109, 112, .28) !important;
  outline-offset: 2px;
}

.startup {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
}

.brand-mark {
  display: inline-grid;
  width: 2.65rem;
  height: 2.65rem;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: linear-gradient(145deg, var(--teal-700), var(--teal-950));
  border-radius: .8rem .8rem .8rem .25rem;
  box-shadow: 0 8px 18px rgba(11, 85, 88, .22);
  font-size: 1.2rem;
  font-weight: 800;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: inherit;
  text-decoration: none;
}

.wordmark strong { display: block; font-size: 1rem; line-height: 1.05; letter-spacing: -.03em; }

.btn {
  --bs-btn-border-radius: .65rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-padding-y: .58rem;
  font-weight: 650;
}

.btn-primary {
  --bs-btn-bg: var(--teal-800);
  --bs-btn-border-color: var(--teal-800);
  --bs-btn-hover-bg: var(--teal-900);
  --bs-btn-hover-border-color: var(--teal-900);
  --bs-btn-active-bg: var(--teal-950);
  --bs-btn-active-border-color: var(--teal-950);
  --bs-btn-disabled-bg: #77a9aa;
  --bs-btn-disabled-border-color: #77a9aa;
}

.btn-outline-primary {
  --bs-btn-color: var(--teal-800);
  --bs-btn-border-color: #6da8a9;
  --bs-btn-hover-bg: var(--teal-800);
  --bs-btn-hover-border-color: var(--teal-800);
  --bs-btn-active-bg: var(--teal-900);
}

.btn-subtle {
  color: var(--teal-900);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
}

.btn-subtle:hover { color: var(--teal-950); background: var(--teal-100); }

.form-control, .form-select {
  min-height: 2.75rem;
  border-color: #cddbd9;
  border-radius: .65rem;
}

.form-control:focus, .form-select:focus {
  border-color: #54a1a2;
  box-shadow: 0 0 0 .22rem rgba(15, 109, 112, .12);
}

.form-label { margin-bottom: .4rem; font-size: .875rem; font-weight: 700; }
.form-text { color: var(--muted); }
.required::after { content: " *"; color: var(--danger); }

.surface {
  background: var(--surface);
  border: 1px solid rgba(209, 224, 222, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty-icon, .icon-tile {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--teal-800);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: .8rem;
  font-size: 1.15rem;
  font-weight: 800;
}

.icon-tile.sand { color: #83551a; background: #fbf5e9; border-color: #ecdfc5; }
.icon-tile.rose { color: #9c3540; background: #fceff0; border-color: #f2d4d7; }

/* Authentication */
.auth-page {
  min-height: 100vh;
  background: var(--canvas);
}

.auth-panel {
  display: grid;
  min-height: 100vh;
  padding: clamp(1.5rem, 5vw, 5rem);
  place-content: center;
}

.auth-box { width: min(100%, 27rem); }
.auth-box h1 { margin: 3rem 0 .4rem; font-size: 1.8rem; font-weight: 750; letter-spacing: -.045em; }
.auth-box .lead-copy { color: var(--muted); }

/* Portal shell */
.portal-shell { min-height: 100vh; display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); }

.sidebar {
  position: sticky;
  z-index: 1020;
  top: 0;
  display: flex;
  height: 100vh;
  padding: 1.25rem 1rem;
  flex-direction: column;
  color: #d8eceb;
  background: var(--teal-950);
}

.sidebar .wordmark { padding: .3rem .6rem 1.6rem; color: white; }
.sidebar .brand-mark { width: 2.25rem; height: 2.25rem; background: white; color: var(--teal-900); box-shadow: none; }
.side-nav { display: grid; gap: .3rem; }
.side-link {
  display: flex;
  width: 100%;
  padding: .72rem .8rem;
  align-items: center;
  gap: .7rem;
  color: #bdd8d7;
  background: transparent;
  border: 0;
  border-radius: .65rem;
  text-align: left;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
}
.side-link:hover { color: white; background: rgba(255, 255, 255, .07); }
.side-link.active { color: white; background: rgba(255, 255, 255, .13); box-shadow: inset 3px 0 #85cfca; }
.side-icon { width: 1.4rem; color: #8bc4c1; text-align: center; font-size: 1.05rem; }
.sidebar-user { margin-top: auto; padding: .85rem; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); border-radius: .8rem; }
.sidebar-user strong { display: block; color: white; font-size: .9rem; }
.sidebar-user small { display: block; overflow: hidden; color: #9ac5c4; text-overflow: ellipsis; white-space: nowrap; }

.portal-main { min-width: 0; }
.topbar {
  position: sticky;
  z-index: 1010;
  top: 0;
  display: flex;
  min-height: 4.65rem;
  padding: .75rem clamp(1rem, 3vw, 2.5rem);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(244, 247, 246, .9);
  border-bottom: 1px solid rgba(207, 222, 220, .8);
  backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 760; letter-spacing: -.035em; }
.topbar p { margin: .15rem 0 0; color: var(--muted); font-size: .78rem; }
.mobile-brand { display: none; }
.page-content { width: min(100%, 93rem); margin: 0 auto; padding: clamp(1.15rem, 3vw, 2.5rem); }

.eyebrow { color: var(--teal-700); font-size: .72rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.page-heading { margin: .25rem 0 .35rem; font-size: clamp(1.65rem, 3vw, 2.25rem); font-weight: 760; letter-spacing: -.055em; }
.page-subtitle { max-width: 52rem; margin: 0; color: var(--muted); line-height: 1.65; }
.section-heading { margin: 0; font-size: 1.08rem; font-weight: 750; letter-spacing: -.025em; }
.section-copy { margin: .25rem 0 0; color: var(--muted); font-size: .84rem; }

.summary-card { height: 100%; padding: 1.25rem; }
.summary-card .summary-value { margin-top: .75rem; font-size: 2rem; font-weight: 780; letter-spacing: -.06em; line-height: 1; }
.summary-card .summary-label { color: var(--muted); font-size: .82rem; }

.filter-bar { padding: 1rem; }
.search-wrap { position: relative; }
.search-wrap .search-symbol { position: absolute; z-index: 2; top: 50%; left: .9rem; transform: translateY(-50%); color: #77908f; }
.search-wrap input { padding-left: 2.45rem; }

.table-card { overflow: hidden; }
.table { margin: 0; --bs-table-bg: transparent; --bs-table-hover-bg: var(--teal-50); }
.table > :not(caption) > * > * { padding: .9rem 1rem; border-bottom-color: #e6eeec; vertical-align: middle; }
.table thead th { color: #6b8180; background: #f9fbfa; font-size: .72rem; font-weight: 800; letter-spacing: .035em; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.employee-link { color: var(--ink); font-weight: 730; text-decoration: none; }
.employee-link:hover { color: var(--teal-800); text-decoration: underline; }
.subvalue { display: block; margin-top: .15rem; color: var(--muted); font-size: .76rem; }

.status-badge {
  display: inline-flex;
  padding: .3rem .55rem;
  align-items: center;
  gap: .35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}
.status-badge::before { content: ""; width: .38rem; height: .38rem; background: currentColor; border-radius: 50%; opacity: .8; }
.status-good { color: #14705a; background: #e7f6ef; border-color: #c7e8db; }
.status-pending { color: #8a5a05; background: #fff6df; border-color: #f0dfb3; }
.status-bad { color: #a33845; background: #fcecef; border-color: #f1d0d5; }
.status-neutral { color: #587071; background: #eef3f2; border-color: #dce6e4; }
.status-info { color: #17647c; background: #e9f5f8; border-color: #cce5eb; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 23rem); gap: 1.25rem; align-items: start; }
.detail-card { padding: 1.35rem; }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.data-item { min-width: 0; padding: .95rem 0; border-bottom: 1px solid #e6eeec; }
.data-item:nth-child(odd) { padding-right: 1.25rem; }
.data-item:nth-child(even) { padding-left: 1.25rem; border-left: 1px solid #e6eeec; }
.data-item dt { margin-bottom: .28rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.data-item dd { overflow-wrap: anywhere; margin: 0; font-weight: 650; }
.action-stack { display: grid; gap: .65rem; }

.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; top: .7rem; bottom: .7rem; left: .45rem; width: 1px; background: #d4e2e0; }
.timeline-item { position: relative; padding: 0 0 1.15rem 1.7rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; z-index: 1; top: .3rem; left: .17rem; width: .58rem; height: .58rem; background: var(--teal-700); border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px #9bc9c6; }

/* Profile */
.profile-hero { overflow: hidden; position: relative; padding: clamp(1.5rem, 4vw, 2.25rem); color: white; background: linear-gradient(120deg, var(--teal-950), var(--teal-800)); }
.profile-hero::after { content: ""; position: absolute; width: 15rem; height: 15rem; right: -4rem; top: -7rem; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.avatar { display: grid; width: 4.25rem; height: 4.25rem; place-items: center; flex: 0 0 auto; color: var(--teal-950); background: #d9efed; border: 3px solid rgba(255,255,255,.45); border-radius: 1.2rem; font-size: 1.45rem; font-weight: 800; }
.profile-hero h2 { margin: 0; font-size: 1.65rem; font-weight: 760; letter-spacing: -.045em; }
.profile-hero p { margin: .25rem 0 0; color: #c8e5e3; }

/* Invite */
.invite-page { min-height: 100vh; padding: clamp(1rem, 4vw, 3.5rem); background: linear-gradient(180deg, #e9f4f2 0, var(--canvas) 24rem); }
.invite-wrap { width: min(100%, 56rem); margin: 0 auto; }
.invite-head { display: flex; padding: .5rem 0 2.25rem; align-items: center; justify-content: space-between; }
.invite-card { overflow: hidden; box-shadow: var(--shadow-lg); }
.invite-banner { padding: 1.45rem clamp(1.25rem, 4vw, 2.5rem); color: white; background: linear-gradient(110deg, var(--teal-950), var(--teal-800)); }
.invite-body { padding: clamp(1.25rem, 5vw, 3rem); }
.steps { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0 0 2.25rem; padding: 0; list-style: none; }
.step { position: relative; display: flex; align-items: center; gap: .65rem; color: #819392; font-size: .82rem; font-weight: 700; }
.step::after { content: ""; position: absolute; z-index: 0; top: 50%; right: .75rem; left: 2.5rem; height: 1px; background: #d2dfdd; }
.step:last-child::after { display: none; }
.step-number { position: relative; z-index: 1; display: grid; width: 1.9rem; height: 1.9rem; place-items: center; color: #708382; background: #edf2f1; border-radius: 50%; }
.step.active { color: var(--teal-900); }
.step.active .step-number, .step.done .step-number { color: white; background: var(--teal-800); }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.suggestion-option { position: relative; }
.suggestion-option input { position: absolute; opacity: 0; }
.suggestion-option label { display: block; padding: .9rem 1rem; border: 1px solid #ccdcd9; border-radius: .75rem; cursor: pointer; }
.suggestion-option label strong { display: block; }
.suggestion-option label small { color: var(--muted); }
.suggestion-option input:checked + label { border-color: var(--teal-700); background: var(--teal-50); box-shadow: 0 0 0 2px rgba(15,109,112,.1); }
.suggestion-option input:focus-visible + label { outline: 3px solid rgba(15,109,112,.25); outline-offset: 2px; }
.review-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.review-list li { display: flex; padding: .8rem 0; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.review-list span { color: var(--muted); }
.review-list strong { text-align: right; }

/* AI assistant */
.chat-card { display: grid; min-height: 36rem; grid-template-rows: auto 1fr auto; overflow: hidden; }
.chat-head { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.chat-log { overflow-y: auto; display: flex; max-height: 56vh; padding: 1.25rem; flex-direction: column; gap: .9rem; }
.message { max-width: min(82%, 46rem); padding: .85rem 1rem; border-radius: 1rem; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { align-self: flex-end; color: white; background: var(--teal-800); border-bottom-right-radius: .25rem; }
.message.assistant { align-self: flex-start; background: #eef4f3; border: 1px solid #dce7e5; border-bottom-left-radius: .25rem; }
.message-meta { display: block; margin-top: .35rem; opacity: .65; font-size: .68rem; }
.chat-form { padding: 1rem; background: #fafcfb; border-top: 1px solid var(--line); }

/* Modal and feedback */
.modal-content { border: 0; border-radius: 1rem; box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font-weight: 760; letter-spacing: -.03em; }
.danger-panel { padding: 1rem; color: #812d37; background: #fff3f4; border: 1px solid #f1d5d8; border-radius: .75rem; }
.copy-box { display: flex; gap: .5rem; padding: .65rem; background: #f2f7f6; border: 1px solid var(--line); border-radius: .7rem; }
.copy-box code { overflow: auto; display: block; flex: 1; padding: .4rem; color: var(--teal-950); white-space: nowrap; }
.inline-alert { padding: .8rem 1rem; border-radius: .65rem; font-size: .88rem; }
.inline-alert.error { color: #8f2e39; background: #fff0f2; border: 1px solid #f2cfd4; }
.inline-alert.warning { color: #7b540d; background: #fff7e6; border: 1px solid #eeddb9; }
.inline-alert.info { color: #14576c; background: #edf7f9; border: 1px solid #cce5ea; }
.toast { --bs-toast-border-color: rgba(13, 75, 78, .15); box-shadow: 0 12px 30px rgba(7, 46, 48, .16); }
.toast.toast-error .toast-header { color: #8f2e39; background: #fff0f2; }
.toast.toast-success .toast-header { color: #12604e; background: #e9f7f0; }
.busy-screen { position: fixed; z-index: 2000; inset: 0; display: grid; place-items: center; background: rgba(7, 63, 66, .24); backdrop-filter: blur(2px); }
.busy-screen[hidden] { display: none; }
.noscript-message { position: fixed; z-index: 9999; right: 1rem; bottom: 1rem; left: 1rem; padding: 1rem; color: white; background: #932f3b; border-radius: .5rem; text-align: center; }
.skeleton { min-height: 1rem; background: linear-gradient(90deg, #edf2f1 25%, #f8faf9 50%, #edf2f1 75%); background-size: 200% 100%; border-radius: .35rem; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 991.98px) {
  .auth-panel { min-height: 100vh; }
  .portal-shell { display: block; }
  .sidebar { position: fixed; right: 0; bottom: 0; left: 0; top: auto; height: auto; padding: .45rem .6rem max(.45rem, env(safe-area-inset-bottom)); flex-direction: row; background: rgba(7, 63, 66, .97); box-shadow: 0 -8px 30px rgba(5, 39, 41, .16); }
  .sidebar .wordmark, .sidebar-user { display: none; }
  .side-nav { width: 100%; display: flex; justify-content: space-around; gap: .2rem; }
  .side-link { min-width: 4rem; padding: .48rem .55rem; flex-direction: column; justify-content: center; gap: .12rem; border-radius: .5rem; font-size: .66rem; text-align: center; }
  .side-link.active { box-shadow: inset 0 2px #85cfca; }
  .side-icon { height: 1.25rem; }
  .portal-main { padding-bottom: 4.5rem; }
  .mobile-brand { display: block; }
  .topbar { min-height: 4rem; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
  .page-content { padding: 1rem; }
  .topbar { padding: .65rem 1rem; }
  .topbar .topbar-subcopy { display: none; }
  .data-grid { grid-template-columns: 1fr; }
  .data-item:nth-child(odd), .data-item:nth-child(even) { padding-right: 0; padding-left: 0; border-left: 0; }
  .table-responsive .table { min-width: 45rem; }
  .invite-page { padding: .75rem; }
  .invite-head { padding-bottom: 1rem; }
  .invite-body { padding: 1.15rem; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .review-list li { display: block; }
  .review-list strong { display: block; margin-top: .15rem; text-align: left; }
  .message { max-width: 92%; }
}

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

@media print {
  .sidebar, .topbar, .btn, .filter-bar { display: none !important; }
  .portal-shell { display: block; }
  .page-content { padding: 0; }
  .surface { box-shadow: none; }
}
