/* ==========================================================================
   치료멍멍 Bio Care — 디자인 시스템
   동물용 엑소좀 B2B 공급 · 수의사 진료 · 견주 경과관리 · MedVo Trio
   ========================================================================== */

:root {
  /* Brand — 녹색 프리미엄 팔레트 (emerald + deep forest)
     의미색 --ok(#16a34a)와 겹치지 않도록 브랜드는 청록 쪽으로 살짝 기울인 에메랄드를 쓴다.
     상태 배지는 항상 연한 배경 + 진한 글자(#166534)로만 표현하므로 솔리드 브랜드 면과 구분된다. */
  --brand:        #0f9c68;   /* emerald — 프리미엄 시그니처 */
  --brand-dark:   #07704a;
  --brand-light:  #d8f3e6;
  --brand-tint:   #f1fbf6;
  --brand-glow:   #38dda1;   /* 밝은 민트 — 그라디언트용 */
  --navy:         #0f2a1f;   /* deep forest — 본부/프리미엄 다크 */
  --navy-soft:    #1c4634;

  /* Accent */
  --accent:       #3fc79b;   /* 제이드 액센트 — 견주/따뜻함 */
  --accent-soft:  #e2f7ee;
  --gold:         #caa25a;   /* 프리미엄 골드 포인트 */

  /* Semantic */
  --ok:      #16a34a;
  --ok-bg:   #e7f6ec;
  --warn:    #d97706;
  --warn-bg: #fdf3e3;
  --danger:  #dc2626;
  --danger-bg:#fdeaea;
  --info:    #2563eb;
  --info-bg: #e8f0fe;

  /* Neutral — 쿨 그린 틴트 */
  --ink:      #0f2a1f;
  --ink-2:    #516860;
  --ink-3:    #8ca39a;
  --line:     #dcece4;
  --line-2:   #ecf5f1;
  --bg:       #f6fbf8;
  --surface:  #ffffff;
  --surface-2:#f7fcfa;

  --radius:   14px;
  --radius-sm:10px;
  --radius-lg:22px;
  --shadow:   0 1px 2px rgba(15,42,31,.05), 0 8px 24px rgba(15,156,104,.08);
  --shadow-lg:0 12px 40px rgba(7,112,74,.18);
  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }
.app-shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; }
.page { padding: 26px 30px 60px; max-width: 1240px; margin: 0 auto; }
@media (max-width: 720px){ .page { padding: 18px 16px 50px; } }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 244px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, #16382a 100%); color: #cfe8dd;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(15,156,104,.15);
}
.sidebar .brand { padding: 20px 20px 14px; display: flex; align-items: center; gap: 11px; }
.sidebar .brand .brand-mark { height: 30px; width: auto; filter: brightness(0) invert(1); }
.sidebar .brand .logo { width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-glow)); display: grid; place-items: center;
  font-size: 19px; box-shadow: 0 4px 14px rgba(15,156,104,.45); }
.sidebar .brand b { color: #fff; font-size: 15px; letter-spacing: -.2px; }
.sidebar .brand small { display: block; color: var(--gold); font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.side-role { margin: 4px 16px 12px; padding: 8px 12px; background: rgba(255,255,255,.06);
  border-radius: 9px; font-size: 12px; color: #a5c4b6; }
.side-role b { color: #fff; display: block; font-size: 13px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: #789688; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #cfe8dd; font-size: 14px; font-weight: 500; transition: .15s; }
.nav a .ic { width: 20px; text-align: center; font-size: 15px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: linear-gradient(135deg, var(--brand), var(--brand-glow)); color: #fff;
  box-shadow: 0 4px 16px rgba(15,156,104,.5); }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: #a5c4b6; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.side-foot a:hover { color: #fff; }

/* ---------- Topbar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 30px; height: 62px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.topbar .crumb { color: var(--ink-3); font-size: 13px; }
.topbar .spacer { flex: 1; }
.topbar .pill { background: var(--brand-light); color: var(--brand-dark);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.topbar .avatar { width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }

/* ---------- Cards ---------- */
.card { position: relative; background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s, border-color .22s; }
.card:hover { transform: translateY(-3px); border-color: var(--brand-light);
  box-shadow: 0 2px 6px rgba(15,42,31,.05), 0 18px 44px rgba(15,156,104,.16); }
/* 프리미엄 그라디언트 상단 라인 (accent 카드용) */
.card.premium { border-color: var(--brand-light); }
.card.premium::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-glow) 50%, var(--gold)); }
.card-pad { padding: 20px 22px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 12px; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px){ .grid-3,.grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 620px){ .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } }

/* ---------- Stat tiles ---------- */
.stat { position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  transition: transform .22s cubic-bezier(.2,.7,.3,1), box-shadow .22s, border-color .22s; }
.stat:hover { transform: translateY(-3px); border-color: var(--brand-light);
  box-shadow: 0 2px 6px rgba(15,42,31,.05), 0 18px 44px rgba(15,156,104,.16); }
.stat .label { color: var(--ink-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .val { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-top: 6px; color: var(--ink); }
.stat .sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.stat .val small { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.stat.accent { background: linear-gradient(135deg, var(--brand-dark), var(--brand) 55%, var(--brand-glow)); border: none; color: #fff;
  box-shadow: 0 10px 30px rgba(15,156,104,.28); }
/* accent 타일 광택 스윕 */
.stat.accent::after { content: ''; position: absolute; top: -60%; right: -20%; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,255,255,.28), transparent 70%); pointer-events: none; }
.stat.accent:hover { box-shadow: 0 16px 42px rgba(15,156,104,.42); }
.stat.accent .label, .stat.accent .val, .stat.accent .sub { color: #fff; }
.stat.accent .sub { opacity: .85; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--brand-light); background: var(--brand-tint); transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-glow)); border-color: var(--brand);
  color: #fff; box-shadow: 0 4px 14px rgba(15,156,104,.28); }
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  border-color: var(--brand-dark); box-shadow: 0 8px 22px rgba(15,156,104,.42); transform: translateY(-2px); }
.btn-navy { background: linear-gradient(135deg, var(--navy), var(--navy-soft)); border-color: var(--navy); color: #fff;
  box-shadow: 0 4px 14px rgba(15,42,31,.25); }
.btn-navy:hover { background: linear-gradient(135deg, var(--navy-soft), #26603f); transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15,42,31,.35); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand-dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--line-2); color: var(--ink-2); }
.badge.brand { background: var(--brand-light); color: var(--brand-dark); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); } .dot.info { background: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
table.tbl th { text-align: left; padding: 12px 16px; background: var(--surface-2);
  color: var(--ink-2); font-weight: 700; font-size: 12.5px; border-bottom: 1px solid var(--line);
  white-space: nowrap; }
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover, table.tbl tr.clickable:hover { background: var(--brand-tint); cursor: pointer; }
table.tbl .mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); transition: .15s; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.textarea { resize: vertical; min-height: 90px; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }
@media (max-width: 620px){ .row { flex-direction: column; } }

/* segmented / chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2);
  transition: .15s; }
.chip:hover { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-tint); }
.chip.on { background: linear-gradient(135deg, var(--brand), var(--brand-glow)); color: #fff; border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(15,156,104,.3); }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px;
  width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--brand-light); }
.tl-item .tl-time { font-size: 12px; color: var(--ink-3); }
.tl-item .tl-title { font-weight: 700; font-size: 14px; margin: 2px 0; }
.tl-item .tl-body { font-size: 13px; color: var(--ink-2); }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; font-size: 14px; align-items: flex-start; }
.alert .ai { font-size: 18px; flex-shrink: 0; }
.alert.danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #f5c6c6; }
.alert.warn { background: var(--warn-bg); color: #92400e; border: 1px solid #f3d9a8; }
.alert.info { background: var(--info-bg); color: #1e40af; border: 1px solid #c7d7f7; }
.alert.ok { background: var(--ok-bg); color: #166534; border: 1px solid #bfe6c9; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,42,31,.55); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-back.open { display: flex; }
.modal { background: var(--surface); border-radius: 18px; max-width: 560px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal-head h3 { font-size: 17px; font-weight: 700; flex: 1; }
.modal-head .x { cursor: pointer; color: var(--ink-3); font-size: 22px; line-height: 1; }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Utility ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.between { justify-content: space-between; }
.wrap-flex { flex-wrap: wrap; }
.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-8{margin-bottom:8px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.text-c { text-align: center; }
.section-title { font-size: 20px; font-weight: 800; letter-spacing: -.4px; margin-bottom: 4px; }
.section-sub { color: var(--ink-2); font-size: 14px; margin-bottom: 20px; }
.divider { height: 1px; background: var(--line-2); margin: 18px 0; }
.progress { height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* toast */
.toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--navy); color: #fff; padding: 13px 18px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: slidein .25s ease;
  display: flex; align-items: center; gap: 10px; max-width: 340px; }
.toast.ok { background: var(--ok); } .toast.danger { background: var(--danger); } .toast.warn { background: var(--warn); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

/* mobile sidebar toggle */
.menu-btn { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink); }
@media (max-width: 900px){
  .sidebar { position: fixed; left: -260px; z-index: 90; transition: left .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .menu-btn { display: block; }
  .backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 80; }
  .backdrop.show { display: block; }
}
