/* VEIL 관리 사이트. 운영 도구라서 장식보다 읽기 쉬움이 먼저예요. */
:root {
  --bg: #0e0e11; --panel: #16161b; --panel2: #1d1d24; --line: #2a2a33; --text: #ecebe8; --mid: #a9a8b0; --low: #74737c;
  --red: #e5173f; --red-soft: #e5173f22; --ok: #3fbf7f; --warn: #e6a23c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 "Pretendard Variable", Pretendard, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* 버튼·입력 */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel2); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #444; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.red:hover { filter: brightness(1.1); }
.btn.ghost { background: none; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: default; }
input, select, textarea { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); min-width: 0; }
textarea { height: auto; padding: 8px 10px; }
input::placeholder { color: var(--low); }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(380px, 100%); }
.login-box h1 { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 0 0 4px; }
.login-box h1 img { width: 32px; height: 32px; border-radius: 6px; }
.login-box > p { color: var(--mid); margin: 0 0 20px; }
.login-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.login-tabs button { background: none; border: 0; padding: 8px 4px; margin-right: 12px; color: var(--low); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.login-tabs button.on { color: var(--text); border-color: var(--red); font-weight: 600; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--mid); }
.form input { height: 40px; font-size: 15px; }
.form .btn { height: 42px; justify-content: center; font-size: 15px; }
.err { color: #ff6b85; font-size: 13px; min-height: 1.2em; margin: 0; }
.secret { font: 600 18px/1.4 ui-monospace, Menlo, monospace; letter-spacing: .08em; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-align: center; user-select: all; word-break: break-all; }
.steps { margin: 0; padding-left: 18px; color: var(--mid); display: grid; gap: 4px; }

/* 틀: 왼쪽 메뉴 + 본문 */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100%; }
.nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 14px; font-weight: 700; }
.brand img { width: 26px; height: 26px; border-radius: 5px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--mid); }
.nav a:hover { background: var(--panel2); color: var(--text); }
.nav a.on { background: var(--panel2); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 var(--red); }
.nav a b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; display: grid; place-items: center; }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.nav .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); color: var(--low); font-size: 12.5px; display: grid; gap: 8px; }
.nav .me strong { color: var(--text); font-weight: 600; }
.main { padding: 26px 32px 60px; min-width: 0; max-width: 1180px; }
.main > h1 { font-size: 22px; margin: 0 0 4px; }
.main > .lede { color: var(--mid); margin: 0 0 20px; }

/* 상자 */
.grid { display: grid; gap: 14px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 0; }
.box > h2 { font-size: 14.5px; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.box > h2 small { color: var(--low); font-weight: 400; font-size: 12.5px; }
.todo { display: block; text-decoration: none; }
.todo span { color: var(--mid); font-size: 13px; }
.todo strong { display: block; font-size: 30px; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.todo.hot { border-color: var(--red); background: linear-gradient(180deg, var(--red-soft), var(--panel) 70%); }
.todo.hot strong { color: #ff4d6d; }
.todo:hover { border-color: #444; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--mid); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.good { color: var(--ok); } .bad { color: #ff6b85; } .warn { color: var(--warn); }
.totals { display: flex; gap: 22px; margin-bottom: 12px; color: var(--mid); font-size: 13px; }
.totals b { color: var(--text); font-size: 18px; margin-right: 3px; font-variant-numeric: tabular-nums; }

/* 7일 막대 */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 132px; }
.week .d { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; text-align: center; font-size: 11.5px; color: var(--low); }
.week .bars { display: flex; gap: 2px; align-items: end; justify-content: center; }
.week .bars i { width: 9px; min-height: 2px; border-radius: 2px 2px 0 0; background: var(--line); }
.week .bars i.m { background: var(--red); } .week .bars i.p { background: #d9d6cf; } .week .bars i.c { background: #6c6b74; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--mid); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* 목록 */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.chips { display: inline-flex; gap: 2px; padding: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.chips button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; color: var(--mid); cursor: pointer; }
.chips button.on { background: var(--panel2); color: var(--text); font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.list > li { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .t { min-width: 0; flex: 1; }
.list .t b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.list .t small { color: var(--low); display: block; margin-top: 2px; }
.list .t p { margin: 4px 0 0; color: var(--mid); overflow-wrap: anywhere; }
.list .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.tag { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: 11.5px; line-height: 19px; background: var(--panel2); border: 1px solid var(--line); color: var(--mid); margin-right: 6px; vertical-align: 1px; font-weight: 500; }
.tag.red { color: #ff6b85; border-color: #e5173f66; }
.empty { padding: 28px 16px; text-align: center; color: var(--low); }
.inline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.inline input { flex: 1; min-width: 140px; height: 30px; }
.inline select { height: 30px; }
.more { margin-top: 10px; }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.words button { border: 1px solid var(--line); background: var(--panel2); border-radius: 14px; padding: 3px 11px; cursor: pointer; }
.words button:hover { border-color: var(--red); color: #ff6b85; }
table.log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.log th { text-align: left; color: var(--low); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.log td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.log td:first-child { white-space: nowrap; color: var(--mid); font-variant-numeric: tabular-nums; }
pre.err-msg { margin: 0; white-space: pre-wrap; font: 12px/1.5 ui-monospace, Menlo, monospace; color: #ff9aac; max-height: 160px; overflow: auto; }
.hint { color: var(--low); font-size: 12.5px; margin: 8px 0 0; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #f2f1ee; color: #111; padding: 10px 16px; border-radius: 8px; font-weight: 600; transition: .2s; z-index: 10; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* 좁은 화면 (휴대폰) */
.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 5; transform: translateX(-100%); transition: transform .2s; }
  .nav.open { transform: none; box-shadow: 0 0 0 100vmax #0009; }
  .menu-btn { display: inline-flex; margin-bottom: 14px; }
  .main { padding: 18px 16px 50px; }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2 { grid-template-columns: 1fr; }
  .list > li { flex-direction: column; }
  .list .acts { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.or { display: flex; align-items: center; gap: 10px; color: var(--low); font-size: 12.5px; margin: 18px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; border-color: #e5173f66; }
