@font-face {
  font-family: "Pretendard Variable";
  src: url("./assets/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #eef6fb;
  --panel: #ffffff;
  --panel-soft: #f3f8fc;
  --ink: #101d2c;
  --muted: #66788a;
  --line: #d5e3ed;
  --accent: #1686c9;
  --accent-dark: #0876b9;
  --accent-soft: #eaf7ff;
  --brand-gradient: linear-gradient(135deg, #29a9ff 0%, #5528d1 100%);
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(23, 33, 43, 0.1);
  --font-sans: "Pretendard Variable", "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
:focus-visible { outline: 3px solid rgba(41, 169, 255, 0.38); outline-offset: 2px; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { border: 0; border-radius: var(--radius); cursor: pointer; font-weight: 800; }
button:disabled { cursor: progress; opacity: .65; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.followup-shell { width: min(1560px, 100%); margin: 0 auto; padding: 18px; }
.topbar, .notice-panel, .toolbar, .followup-panel, .admin-panel, .summary-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}
.eyebrow { margin: 0 0 3px; color: var(--accent-dark); font-size: 12px; font-weight: 900; }
h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
.header-actions, .topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.topbar-actions a {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #344557;
  font-size: 14px;
  font-weight: 850;
}
.topbar-actions a:hover { border-color: rgba(41, 169, 255, .55); }
.topbar-actions a.active { border-color: var(--accent); background: var(--brand-gradient); color: #fff; }

.account-menu { position: relative; }
.account-menu summary {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #344557;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-avatar {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 9px;
}
.account-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: min(300px, calc(100vw - 24px));
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(16, 29, 44, .18);
}
.account-popover strong { overflow: hidden; text-overflow: ellipsis; }
.account-popover > span { color: var(--muted); font-size: 12px; }
.account-popover a, .account-popover button {
  display: grid;
  min-height: 38px;
  margin-top: 6px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.server-monitor {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafb;
}
.server-monitor span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff;
  color: #465769;
  font-size: 12px;
  font-weight: 900;
}
.server-monitor .status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--accent);
}
.server-monitor .status-dot.warning::before { background: var(--danger); }

.notice-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 12px 14px;
  box-shadow: none;
}
.notice-copy { display: flex; align-items: center; gap: 10px; }
.notice-icon {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
}
.notice-panel strong { display: block; margin-bottom: 2px; font-size: 13px; }
.notice-panel p, .followup-panel header p, .admin-panel p { color: var(--muted); font-size: 12px; }
.notice-panel button, .admin-panel button, dialog footer button:last-child {
  min-height: 38px;
  padding: 0 13px;
  background: var(--brand-gradient);
  color: #fff;
}

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.summary-grid article { min-height: 88px; padding: 14px 16px; }
.summary-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 850; }
.summary-grid strong { display: block; margin-top: 7px; font-size: 24px; line-height: 1; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 190px 150px auto; align-items: end; gap: 10px; padding: 14px; }
.search-field { display: grid; gap: 6px; }
.toolbar label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 850; }
.toolbar input, .toolbar select, dialog input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }
.secondary-button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); background: #fff; color: #344557; }

.followup-panel { margin-top: 12px; overflow: hidden; }
.followup-panel > header, .admin-content section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.followup-panel h2, .admin-panel h2 { margin-bottom: 3px; font-size: 16px; }
.result-count {
  min-width: 48px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
.followup-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  padding: 10px;
  background: var(--panel-soft);
}
.followup-card { padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.followup-card:hover { border-color: #acd4ee; box-shadow: 0 8px 22px rgba(18, 71, 109, .08); }
.followup-card.overdue { border-color: #e7aaa5; box-shadow: inset 3px 0 0 var(--danger); }
.followup-card.done { opacity: .68; }
.followup-card header { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.followup-card h3 { margin: 0 0 4px; font-size: 16px; }
.followup-card .client-profile-link { color: var(--ink); text-decoration-color: rgba(17, 134, 125, .3); text-underline-offset: 3px; }
.followup-card .client-profile-link:hover { color: var(--accent-dark); }
.followup-meta { display: flex; flex-wrap: wrap; gap: 4px 7px; color: var(--muted); font-size: 11px; }
.role-badge, .state-badge {
  border-radius: 999px;
  padding: 4px 7px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}
.state-badge.overdue { color: var(--danger); background: var(--danger-soft); }
.checklist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.checklist label {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.checklist label:hover { border-color: #acd4ee; background: var(--accent-soft); }
.checklist input { flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--accent); }
.checklist label.not-applicable { color: var(--muted); background: #f3f5f7; cursor: default; }
.checklist label.not-applicable:hover { border-color: var(--line); }
.checklist label.not-applicable span { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 6px; min-width: 0; width: 100%; word-break: keep-all; overflow-wrap: anywhere; }
.checklist label.not-applicable small { padding: 2px 6px; border-radius: 999px; background: #e2e8f0; color: #64748b; font-size: 9px; white-space: nowrap; }
.card-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 10px; }
.empty-state { grid-column: 1 / -1; padding: 64px 20px; color: var(--muted); text-align: center; }

.admin-panel { margin-top: 12px; overflow: hidden; }
.admin-panel > summary { padding: 15px 17px; cursor: pointer; font-size: 13px; font-weight: 900; }
.admin-content { display: grid; gap: 12px; padding: 0 14px 14px; }
.admin-content section { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.manager-list { display: grid; }
.manager-row { display: grid; grid-template-columns: 110px 1fr 1.5fr auto; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.manager-row:first-child { border-top: 0; }
.manager-row span { color: var(--muted); }
.manager-row button { min-height: 34px; padding: 0 11px; background: var(--accent-soft); color: var(--accent-dark); }
.backfill-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; }

dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 12px; color: var(--ink); box-shadow: 0 28px 80px rgb(15 35 52 / 30%); }
dialog::backdrop { background: rgb(13 31 47 / 48%); }
dialog form { display: grid; gap: 14px; padding: 20px; }
dialog form > header, dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
dialog form > header button { width: 36px; height: 36px; border-radius: 50%; background: #edf2f5; font-size: 21px; }
dialog label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; }
dialog .active-check { display: flex; align-items: center; }
dialog .active-check input { width: 18px; min-height: 18px; }
dialog footer { justify-content: flex-end; }
dialog footer button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); background: #fff; }

.toast-stack { position: fixed; z-index: 50; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { max-width: 380px; padding: 12px 15px; border-radius: var(--radius); background: #263a4d; color: #fff; box-shadow: 0 12px 32px rgb(0 0 0 / 20%); }
.toast.error { background: var(--danger); }

@media (max-width: 1180px) {
  .followup-list { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .followup-shell { width: min(100%, 720px); padding: 10px; }
  .topbar { grid-template-columns: 1fr; }
  .header-actions { align-items: stretch; flex-direction: column; }
  .topbar-actions { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; }
  .account-menu { align-self: flex-end; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .checklist { grid-template-columns: 1fr; }
  .manager-row { grid-template-columns: 90px 1fr auto; }
  .manager-row span { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .notice-panel, .backfill-panel { align-items: stretch; flex-direction: column; }
  .notice-panel button { width: 100%; }
  .toolbar { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .account-label { display: none; }
  .card-footer { align-items: flex-start; flex-direction: column; }
}
