/* 두레몰 관리자 — 데스크톱 우선, 정보 밀도 높게 / 고객 화면과 같은 초록 계열 */
:root { --g: #0B6B3A; --g2: #16874A; --gs: #EAF5EC; --navy: #0E3A78; --or: #F59E0B; --red: #D92D20; --ink: #111; --ink2: #4B5563; --ink3: #8A8F98; --line: #E5E7EB; --bg: #F5F6F8; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: Pretendard, -apple-system, "Malgun Gothic", sans-serif; font-size: 14px; color: var(--ink); background: var(--bg); display: flex; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

/* 사이드 */
.side { width: 232px; flex: none; background: #0F2A1C; color: #DDE7E1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.side-logo img { background: #fff; border-radius: 9px; padding: 2px; }
.side-logo b { display: block; font-size: 18px; color: #fff; }
.side-logo small { font-size: 11px; color: #9FC4AE; }
#menu { flex: 1; padding: 6px 10px; }
.mgroup { font-size: 11px; color: #7FA08C; margin: 16px 10px 6px; font-weight: 700; letter-spacing: .04em; }
#menu a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 8px; color: #DDE7E1; font-weight: 600; }
#menu a:hover { background: rgba(255,255,255,.06); }
#menu a.on { background: var(--g2); color: #fff; }
#menu a .n { background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 800; }
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }

/* 상단 */
.main { flex: 1; min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 24px; height: 60px; }
.top h1 { font-size: 18px; font-weight: 800; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.role { font-size: 12px; color: var(--ink3); display: flex; align-items: center; gap: 6px; }
.role select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; color: var(--ink); background: #fff; }
.who { font-size: 13px; font-weight: 700; }
.burger { display: none; border: 0; background: none; font-size: 22px; }
#view { padding: 22px 24px 60px; }

/* 공통 */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.card + .card { margin-top: 16px; }
.card h2 { font-size: 15px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .r { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--g); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid2 > .card + .card, .grid3 > .card + .card { margin-top: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.kpi small { color: var(--ink3); font-weight: 600; }
.kpi b { display: block; font-size: 24px; font-weight: 900; margin-top: 4px; letter-spacing: -.02em; }
.kpi .d { font-size: 12px; font-weight: 700; }
.up { color: var(--g2); } .down { color: var(--red); }
.todo { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.todo a { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-radius: 10px; background: var(--bg); font-weight: 700; }
.todo a b { font-size: 20px; color: var(--g); }
.todo a.warn b { color: var(--red); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #C5C9D0; }
.btn.p { background: var(--g); border-color: var(--g); color: #fff; }
.btn.r { background: #fff; border-color: #F3B1AB; color: var(--red); }
.btn.n { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.s { height: 28px; padding: 0 10px; font-size: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.in, .sel, .ta { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0; }
.ta { height: auto; padding: 8px 10px; width: 100%; min-height: 90px; resize: vertical; }
.in:focus, .sel:focus, .ta:focus { outline: 2px solid #A7D7B8; border-color: var(--g2); }
label.f { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink2); }
label.f .in, label.f .sel { width: 100%; }
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fgrid .full { grid-column: 1 / -1; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 700; color: var(--ink3); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--g); border-color: var(--g); }
.tabs a small { background: var(--bg); border-radius: 999px; padding: 1px 7px; margin-left: 4px; font-size: 11px; color: var(--ink2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 0 12px; height: 34px; font-weight: 700; color: var(--ink2); cursor: pointer; }
.seg button.on { background: var(--g); color: #fff; }

/* 표 */
.tw { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { background: #FAFAFB; text-align: left; font-weight: 700; color: var(--ink2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 10px 12px; border-bottom: 1px solid #F0F1F3; vertical-align: middle; }
.t tr:hover td { background: #FAFDFB; }
.t tr.click { cursor: pointer; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t .c { text-align: center; }
.t input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--g); }
.bulk { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--gs); border-radius: 10px; margin-bottom: 10px; font-weight: 700; flex-wrap: wrap; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; color: var(--ink3); font-size: 12px; }
.empty { padding: 40px; text-align: center; color: var(--ink3); }

/* 배지 */
.b { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; background: #EEF0F3; color: var(--ink2); }
.b.g { background: var(--gs); color: var(--g); }
.b.r { background: #FDECEC; color: var(--red); }
.b.o { background: #FFF4E0; color: #B45309; }
.b.n { background: #E8EEF8; color: var(--navy); }
.b.k { background: #111; color: #fff; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--ink3); }
.mini { font-size: 12px; }

/* 차트 */
.chart { width: 100%; height: 220px; }
.hbar { display: grid; grid-template-columns: 90px 1fr 80px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbar i { display: block; height: 12px; border-radius: 6px; background: var(--g2); }

/* 드로어 / 모달 */
.drawer { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 50; display: flex; justify-content: flex-end; }
.drawer-in { width: min(720px, 100%); background: #fff; height: 100%; overflow-y: auto; padding: 22px 24px 40px; box-shadow: -10px 0 30px rgba(0,0,0,.15); }
.dh { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.dh h2 { font-size: 18px; font-weight: 900; }
.dh .x { margin-left: auto; border: 0; background: none; font-size: 22px; cursor: pointer; }
.sec { margin-top: 18px; }
.sec h3 { font-size: 13px; font-weight: 800; color: var(--ink2); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink3); }
.kv dd { margin: 0; font-weight: 600; }
.log { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.log li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); position: relative; }
.log li::before { content: ""; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--g2); }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-in { background: #fff; border-radius: 14px; width: min(980px, 100%); max-height: 92vh; overflow-y: auto; padding: 22px 24px; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px); opacity: 0; background: #111; color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 700; z-index: 90; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 파트너 트리 */
.tree { font-size: 13px; }
.tree a { display: flex; justify-content: space-between; gap: 6px; padding: 7px 10px; border-radius: 8px; }
.tree a:hover { background: var(--bg); }
.tree a.on { background: var(--gs); color: var(--g); font-weight: 800; }
.tree .l1 { padding-left: 22px; } .tree .l2 { padding-left: 40px; }
.tree small { color: var(--ink3); }
.pthumb { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; font-size: 22px; background: #F3F1EC; }
.upload { border: 2px dashed #C9CED6; border-radius: 12px; padding: 18px; text-align: center; color: var(--ink3); cursor: pointer; display: block; }
.upload:hover { border-color: var(--g2); color: var(--g); }
.imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.imgs img, .imgs div { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); display: grid; place-items: center; font-size: 34px; background: #F3F1EC; }
.matrix td, .matrix th { text-align: center; }
.check-list label { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.note { background: #FFF8DB; border: 1px solid #F3D774; border-radius: 10px; padding: 10px 12px; font-size: 12px; color: #6B5300; }

@media (max-width: 1100px) { .kpis, .todo { grid-template-columns: 1fr 1fr; } .grid2, .grid3 { grid-template-columns: 1fr; } .fgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .side { position: fixed; z-index: 70; left: -240px; transition: .2s; } .side.open { left: 0; }
  .burger { display: block; } #view { padding: 14px; } .top { padding: 0 12px; } .who { display: none; }
  .fgrid { grid-template-columns: 1fr; }
}
