:root {
  --ink: #29221D;
  --ink-2: #3F3F3E;
  --muted: #6B7075;
  --line: #E4E6EA;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --accent: #5CC8FF;
  --accent-ink: #0E6FA3;
  --accent-soft: #E6F6FF;
  --ok: #2EB872;
  --warn: #F5A623;
  --bad: #E5484D;
  --sidebar: #1F1B18;
  --sidebar-2: #2B2521;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 4px 16px rgba(20, 20, 20, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Pretendard, -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); }
a { color: var(--accent-ink); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
code { background: #f0f2f5; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: 0 0 236px; background: var(--sidebar); color: #E9E6E2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.logo-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--ink); font-weight: 900; font-size: 20px; display: grid; place-items: center; letter-spacing: -1px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,.55); margin-top: 2px; }
.nav { padding: 12px 12px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; color: rgba(255,255,255,.78); font-weight: 600; margin-bottom: 2px; }
.nav-item .ico { width: 20px; text-align: center; opacity: .8; font-size: 15px; }
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: var(--accent); color: var(--ink); }
.nav-item.active .ico { opacity: 1; }
.nav-sub { display: none; padding: 4px 0 6px 30px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub a { display: flex; align-items: center; gap: 6px; padding: 7px 12px; color: rgba(255,255,255,.6); border-radius: 7px; font-size: 13px; }
.nav-sub a:hover { color: #fff; background: var(--sidebar-2); }
.nav-sub a.active { color: var(--accent); font-weight: 700; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: inline-block; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; gap: 8px; }
.smtp-pill { font-size: 11.5px; color: rgba(255,255,255,.6); padding: 6px 10px; border-radius: 999px; background: var(--sidebar-2); display: flex; align-items: center; gap: 6px; }
.smtp-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.smtp-pill.ok::before { background: var(--ok); }
.smtp-pill.bad::before { background: var(--bad); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 19px; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.hamburger { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
.content { padding: 24px 28px 48px; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

/* ---------- cards / grid ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15.5px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; font-weight: 400; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi.accent { background: var(--ink); color: #fff; }
.kpi.accent .label, .kpi.accent .hint { color: rgba(255,255,255,.6); }
.kpi.accent .value { color: var(--accent); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .input, .select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; outline: none; transition: border .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92,200,255,.2); }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.field .help { font-size: 12px; color: var(--muted); }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent-ink); width: 15px; height: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; user-select: none; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input { display: none; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { background: #f6f7f9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #000; }
.btn-accent { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.btn-accent:hover { background: #3fbdfd; }
.btn-danger { color: var(--bad); border-color: #f3c6c8; }
.btn-danger:hover { background: #fff1f1; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.8); }
.btn-ghost:hover { background: var(--sidebar-2); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--accent-ink); padding: 0; cursor: pointer; font-weight: 600; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 10px 16px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #FAFBFC; white-space: nowrap; }
tr:hover td { background: #FAFCFE; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.empty { color: var(--muted); text-align: center; padding: 28px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 13px; }

/* ---------- tags ---------- */
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #EEF0F3; color: var(--ink-2); }
.tag.ok { background: #E3F7EC; color: #1B7F4B; }
.tag.bad { background: #FDE8E9; color: #B3262B; }
.tag.warn { background: #FFF3DC; color: #9A6A0C; }
.tag.info { background: var(--accent-soft); color: var(--accent-ink); }
.tag.dark { background: var(--ink); color: #fff; }

/* ---------- bars ---------- */
.bar { height: 8px; background: #EEF0F3; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.ok { background: var(--ok); }
.bar > i.bad { background: var(--bad); }
.stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #EEF0F3; }
.stack i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.c-reply { background: var(--ok); } .c-interest { background: var(--accent); } .c-meeting { background: #8064A2; } .c-reject { background: var(--bad); } .c-none { background: #CBD0D6; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,18,16,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: min(760px, 100%); max-height: 90vh; overflow: auto; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(1100px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#toastRoot { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: pop .2s ease; max-width: 360px; }
.toast.bad { background: var(--bad); }
.toast.ok { background: #1B7F4B; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.error-text { color: var(--bad); font-size: 13px; margin: 6px 0 10px; }
.note { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; line-height: 1.6; }
.note.warn { background: #FFF7E6; border-left-color: var(--warn); }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.dropzone input { display: none; }
.preview-box { background: #FAFBFC; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat-line { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.stat-line b { font-size: 16px; }
.progress { height: 6px; background: #EEF0F3; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.sub-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.sub-nav a { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-weight: 600; color: var(--ink-2); font-size: 13px; }
.sub-nav a.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, #2b2521 0, #1F1B18 60%); }
.login-card { background: #fff; border-radius: 18px; padding: 34px 34px 26px; width: min(420px, 92vw); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-title { font-weight: 900; font-size: 22px; letter-spacing: -.3px; }
.login-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.login-foot { color: var(--muted); font-size: 12px; text-align: center; margin: 18px 0 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .grid-6 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; transition: left .2s; z-index: 40; }
  .sidebar.open { left: 0; }
  .hamburger { display: block; }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-6, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 세일즈 대시보드 ---------- */
.center { text-align: center; }
.acc { color: var(--accent-ink); }
.input.sm, .select.sm { padding: 5px 7px; font-size: 12.5px; width: auto; min-width: 0; }
.input.sm { width: 150px; }
.sdash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.sdash-head h2 { font-size: 24px; margin-top: 4px; }
.skpis { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.skpi { flex: 1 1 150px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.skpi-top { display: flex; align-items: center; gap: 8px; }
.skpi-no { font-size: 12px; font-weight: 800; color: var(--accent-ink); }
.skpi-label { font-size: 13.5px; font-weight: 600; }
.skpi-val { display: flex; align-items: baseline; gap: 4px; }
.skpi-val b { font-size: 30px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.skpi-val span { font-size: 13px; }
.skpi-sub { font-size: 12px; color: var(--muted); }
.skpi.hero { flex-grow: 1.6; background: var(--ink); border-color: var(--ink); color: #fff; }
.skpi.hero .skpi-no, .skpi.hero .skpi-val b { color: var(--accent); }
.skpi.hero .skpi-sub { color: rgba(255,255,255,.75); }
.sdash-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; align-items: stretch; }
.sdash-replies { flex: 2 1 560px; min-width: 0; margin-bottom: 0; border: 2px solid var(--accent); }
.sdash-replies .table-wrap { max-height: 396px; overflow: auto; }
.sdash-replies thead th { position: sticky; top: 0; z-index: 1; }
.sdash-replies td { white-space: nowrap; }
.seyebrow { font-size: 12px; font-weight: 800; color: var(--accent-ink); margin-bottom: 2px; }
.sweek { flex: 1 1 280px; min-width: 0; background: var(--ink); color: #fff; border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.sweek-sub { font-size: 12px; color: rgba(255,255,255,.7); }
.sweek-title { font-size: 24px; font-weight: 800; margin-top: 4px; }
.sweek-line { display: flex; justify-content: space-between; font-size: 13px; color: rgba(255,255,255,.75); margin-bottom: 6px; }
.sweek-bar { height: 8px; background: rgba(255,255,255,.18); border-radius: 4px; overflow: hidden; }
.sweek-bar i { display: block; height: 100%; background: #fff; border-radius: 4px; }
.sweek-reply { background: #fff; color: var(--ink); border-radius: 10px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.sweek-reply b { font-size: 30px; color: var(--accent-ink); }
.sweek-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 13px; }
.sweek-mini div { background: rgba(255,255,255,.1); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.sweek-mini span { color: rgba(255,255,255,.7); }
.sweek-mini b { font-size: 18px; }
.sweek-next { font-size: 13px; color: rgba(255,255,255,.75); border-top: 1px solid rgba(255,255,255,.18); padding-top: 12px; }
.sweek-next strong { color: #fff; }
table.sweekly th[scope=row] { background: none; font-size: 13.5px; color: var(--ink); font-weight: 600; }
table.sweekly th[scope=row] span { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
table.sweekly th.acc, table.sweekly td.acc, table.sdb th.acc, table.sdb td.acc { color: var(--accent-ink); font-weight: 700; }
table.sweekly tr.now td, table.sweekly tr.now th, tr.now td { background: var(--accent-soft); }
tr.total th, tr.total td { font-weight: 800; background: #FAFBFC; border-bottom: 0; color: var(--ink); font-size: 13px; }
.spill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.spill.done { background: #EEF0F3; color: #4A5468; }
.spill.now { background: var(--ink); color: #fff; }
.spill.plan { background: #fff; color: #4A5468; border: 1px dashed #A3ACBD; }
.sfunnel { display: flex; flex-direction: column; gap: 12px; }
.sfunnel-line { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.stodo { display: flex; flex-direction: column; }
.stodo a, .stodo > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13.5px; }
.stodo a:last-child, .stodo > div:last-child { border-bottom: 0; }
.stodo a.strong { font-weight: 700; }
.stodo.plain > div { justify-content: flex-start; line-height: 1.6; }
.sbig { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
table.sdb th[scope=row] { background: none; color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
table.sdb .pf { color: var(--ink-2); font-size: 12.5px; }
table.sdb th.pf { font-size: 11.5px; }
details.shold > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
details.shold > summary::before { content: '▸'; color: var(--muted); }
details.shold[open] > summary::before { content: '▾'; }

/* 대시보드 오늘 발송 한도 막대 (밝은 카드용) */
.qbar-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted, #667085); margin-bottom: 6px; }
.qbar { height: 8px; background: #e9ecf2; border-radius: 4px; overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--accent-ink, #1c8fd1); border-radius: 4px; }
.check > span.lbl { display: inline; }
