:root {
  --brand: #e11d48;
  --brand-dark: #be123c;
  --ink: #14151a;
  --ink-soft: #6b7280;
  --line: #e6e8ee;
  --bg: #f4f5f8;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body { font-family: "Noto Sans KR", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font-family: inherit; }
a { color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 8px;
  border: none; cursor: pointer; transition: filter .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--block { width: 100%; }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--danger { background: #fef2f2; color: var(--brand); border: 1px solid #fecdd3; }
.btn--danger:hover { background: var(--brand); color: #fff; }

/* 로그인 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #1f1147, #7a0f2e); }
.login__card { background: #fff; border-radius: 18px; padding: 40px 34px; width: 100%; max-width: 380px;
  box-shadow: 0 30px 60px rgba(0,0,0,.3); text-align: center; }
.login__logo { font-weight: 900; font-size: 24px; }
.login__logo span, .sidebar__logo span { color: var(--brand); }
.login__sub { color: var(--ink-soft); font-size: 14px; margin: 8px 0 22px; }
.login__card input { width: 100%; padding: 13px 14px; border: 1px solid #d9dce3; border-radius: 10px;
  font-size: 15px; margin-bottom: 14px; }
.login__card input:focus { outline: none; border-color: var(--brand); }
.login__msg { color: var(--brand); font-size: 13px; font-weight: 700; min-height: 18px; margin-top: 10px; }
.login__hint { color: var(--ink-soft); font-size: 12px; margin-top: 14px; }
.login__hint code, .login__card code { background: var(--bg); padding: 2px 6px; border-radius: 4px; }

/* 레이아웃 */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.sidebar__logo { font-weight: 900; font-size: 22px; padding: 6px 10px 22px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar__nav button {
  display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: none;
  color: rgba(255,255,255,.75); padding: 12px 12px; border-radius: 8px; font-size: 15px; cursor: pointer; transition: all .15s;
}
.sidebar__nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar__nav button.is-active { background: var(--brand); color: #fff; }
.badge { background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; margin-left: auto; }
.sidebar__nav button.is-active .badge { background: rgba(0,0,0,.25); }
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar__foot a { color: rgba(255,255,255,.7); font-size: 14px; padding: 8px 10px; }
.sidebar__foot button { background: rgba(255,255,255,.08); border: none; color: #fff; padding: 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.sidebar__foot button:hover { background: rgba(255,255,255,.16); }

.main { padding: 0; }
.main__head { background: #fff; border-bottom: 1px solid var(--line); padding: 22px 32px; position: sticky; top: 0; z-index: 5; }
.main__head h1 { font-size: 22px; }
.main__body { padding: 28px 32px; }

/* 통계 카드 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat__label { color: var(--ink-soft); font-size: 14px; }
.stat__value { font-size: 32px; font-weight: 900; margin-top: 6px; }
.stat__value small { font-size: 14px; color: var(--brand); font-weight: 700; }

/* 툴바 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.toolbar h2 { font-size: 18px; }

/* 테이블/카드 */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table th { background: var(--bg); font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.table tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.thumb-cell { width: 56px; }
.thumb { width: 46px; height: 46px; border-radius: 8px; background-size: cover; background-position: center; background-color: var(--bg); }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; display: inline-block; }
.pill--cat { background: #eef2ff; color: #4338ca; }
.pill--new { background: #fef2f2; color: var(--brand); }
.pill--done { background: #f0fdf4; color: #16a34a; }
.pill--progress { background: #fffbeb; color: #b45309; }
.muted { color: var(--ink-soft); font-size: 13px; }
.stars { color: #f5b301; }
.feat { color: #f5b301; font-weight: 800; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }

/* 모달 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal__box { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: 90vh; display: flex; flex-direction: column; }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 18px; }
.modal__close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink-soft); }
.modal__form { padding: 24px; overflow-y: auto; }
.modal__form .field { margin-bottom: 16px; }
.modal__form label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.modal__form input, .modal__form select, .modal__form textarea {
  width: 100%; padding: 11px 13px; border: 1px solid #d9dce3; border-radius: 8px; font-size: 14px;
}
.modal__form input:focus, .modal__form select:focus, .modal__form textarea:focus { outline: none; border-color: var(--brand); }
.modal__form textarea { resize: vertical; }
.modal__form .checkbox { display: flex; align-items: center; gap: 8px; }
.modal__form .checkbox input { width: auto; }
.modal__actions { display: flex; gap: 10px; margin-top: 8px; }

/* 토스트 */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 14px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.err { background: var(--brand); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar__logo { padding: 6px 10px; }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar__foot { margin: 0 0 0 auto; flex-direction: row; border: none; padding: 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .main__body { padding: 18px; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
}
