/* ===== KNK 앱 스타일 — 모바일 우선, 국민의힘 빨강 ===== */
:root {
  --red: #E61E2B; --red-dark: #C8141F; --red-soft: #FDE8EA; --red-ink: #B3121C;
  --bg: #F6F7F9; --card: #FFFFFF; --card-2: #F1F3F6; --line: #E3E6EB;
  --ink: #16181D; --ink-soft: #5B6270; --ink-faint: #8A919E;
  --green: #1B8A4C; --green-soft: #E4F5EA; --amber: #B7791F; --amber-soft: #FFF4DE; --blue: #2457C5;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --tab-h: 58px; --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --card: #191C22; --card-2: #22262E; --line: #2C313B;
    --ink: #F2F3F5; --ink-soft: #AEB4BF; --ink-faint: #7B8290;
    --red-soft: #3A1418; --red-ink: #FF6B75; --green-soft: #12301E; --amber-soft: #33270F;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--blue); }

/* ---- 로딩 ---- */
#boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--bg); z-index: 50; }
#boot img { width: 84px; height: 84px; border-radius: 20px; }
#boot .msg { color: var(--ink-soft); font-size: 14px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 로그인 ---- */
#login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px; text-align: center; }
#login > img { width: 132px; height: 132px; border-radius: 30px; box-shadow: var(--shadow); }
#login h1 { margin: 18px 0 4px; font-size: 30px; letter-spacing: .5px; }
#login .sub { color: var(--ink-soft); margin: 18px 0 30px; font-size: 15.5px; }
.btn-google { display: inline-flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 20px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); }
.btn-google img { width: 20px; height: 20px; }
#login .note { margin-top: 22px; color: var(--ink-faint); font-size: 12.5px; }

/* ---- 앱 껍데기 ---- */
#app { display: none; min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--safe-b) + 12px); }
header.top { position: sticky; top: 0; z-index: 20; background: var(--red); color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
header.top .brand { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 21px; letter-spacing: -.3px; }
header.top .brand .kr { background: #fff; color: var(--red); font-size: 13px; font-weight: 900; padding: 2px 8px; border-radius: 999px; line-height: 1.3; }
header.top .who { font-size: 12.5px; background: rgba(255,255,255,.18); padding: 5px 10px; border-radius: 999px; }
main { padding: 14px 16px 0; max-width: 720px; margin: 0 auto; }

/* ---- 하단 탭 ---- */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b); }
nav.tabs button { flex: 1; height: var(--tab-h); border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-faint); font-size: 11px; font-weight: 600; }
nav.tabs button .ico { font-size: 20px; line-height: 1; }
nav.tabs button.on { color: var(--red-ink); }
nav.tabs button .badge { position: absolute; margin-left: 24px; margin-top: -30px; background: var(--red); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; display: flex; align-items: center; justify-content: center; }

/* ---- 공통 ---- */
.view { display: none; } .view.on { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.faint { color: var(--ink-faint); font-size: 12.5px; }
.empty { text-align: center; color: var(--ink-faint); padding: 34px 0; }
.sec-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.sec-title b { font-size: 16px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--ink-soft); }
.pill.red { background: var(--red-soft); color: var(--red-ink); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }

/* ---- 버튼 ---- */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 11px; padding: 10px 14px; font-weight: 700; font-size: 14px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:active { background: var(--red-dark); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn.danger { color: var(--red-ink); }
.btn.block { width: 100%; padding: 14px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; }

/* ---- 폼 ---- */
.field { display: block; font-size: 12.5px; color: var(--ink-soft); font-weight: 700; margin: 12px 0 5px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; font-size: 15px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--red); background: var(--card); }
textarea { min-height: 96px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; margin: 10px 0; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.chip.on { background: var(--red); border-color: var(--red); color: #fff; }

/* ---- 목록 항목 ---- */
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.item .t { font-weight: 800; font-size: 15px; }
.item .m { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.item .d { margin-top: 6px; font-size: 13.5px; color: var(--ink); white-space: pre-wrap; }
.item.clickable { cursor: pointer; }
.item.clickable:active { background: var(--card-2); }

/* ---- 일정 ---- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head .lbl { flex: 1; text-align: center; font-weight: 900; font-size: 16px; }
.cal-head button { width: 40px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 15px; }
.ev { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev .date { min-width: 46px; text-align: center; }
.ev .date b { display: block; font-size: 20px; line-height: 1; color: var(--red-ink); }
.ev .date span { font-size: 11px; color: var(--ink-faint); }
.ev .body .t { font-weight: 700; }
.ev .body .m { font-size: 12.5px; color: var(--ink-soft); }
.ev.today .date b { color: var(--red); }

/* ---- 상단 안내 배너 ---- */
.banner { background: var(--amber-soft); color: var(--amber); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.banner.red { background: var(--red-soft); color: var(--red-ink); }
.banner.green { background: var(--green-soft); color: var(--green); }

/* ---- 토스트 ---- */
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 18px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; }

/* ---- 상세 시트 ---- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: none; }
.sheet-bg.on { display: block; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: var(--bg); border-radius: 18px 18px 0 0; padding: 14px 16px calc(24px + var(--safe-b)); z-index: 45; transform: translateY(100%); transition: transform .22s; }
.sheet.on { transform: translateY(0); }
.sheet .grab { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 0 auto 12px; }
.hist { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 12px; }
.hist .h { margin-bottom: 10px; }
.hist .h .w { font-size: 12px; color: var(--ink-faint); }
.hist .h .c { font-size: 13.5px; white-space: pre-wrap; }

/* ===== 2단계: 상단 메뉴(PC) · 더보기 · 칸반 · 표 · 인쇄 ===== */
header.top .topnav { display: none; flex: 1; margin: 0 18px; gap: 2px; overflow-x: auto; }
header.top .topnav button { border: 0; background: transparent; color: rgba(255,255,255,.85); font-weight: 700; font-size: 14px; padding: 8px 10px; border-radius: 9px; white-space: nowrap; position: relative; }
header.top .who.on { background: rgba(255,255,255,.35); }
header.top .topnav button.on { background: rgba(255,255,255,.2); color: #fff; }
header.top .topnav button .badge { position: absolute; top: 0; right: 0; background: #fff; color: var(--red); font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; display: flex; align-items: center; justify-content: center; font-weight: 800; }
header.top .who { cursor: pointer; white-space: nowrap; }
@media (min-width: 900px) {
  header.top .topnav { display: flex; }
  nav.tabs { display: none; }
  #app { padding-bottom: 24px; }
  main { max-width: 1120px; padding: 20px 24px 0; }
  #toast { bottom: 28px; }
  .sheet { left: 50%; right: auto; width: min(720px, 94vw); transform: translate(-50%, 100%); border-radius: 18px 18px 0 0; }
  .sheet.on { transform: translate(-50%, 0); }
}
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.more-btn { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 6px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; box-shadow: var(--shadow); }
.more-btn .ico { font-size: 26px; }
.more-btn .badge { position: absolute; top: 8px; right: 10px; background: var(--red); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px; display: flex; align-items: center; justify-content: center; }

/* 칸반 */
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.kanban .col { background: var(--card-2); border-radius: var(--radius); padding: 10px; min-height: 80px; }
.kanban .col > .h { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 14px; padding: 2px 4px 8px; }
.kanban .col > .h .cnt { background: var(--card); border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--ink-soft); }
.kanban .item { margin-bottom: 8px; }
.kanban .item:last-child { margin-bottom: 0; }
.seg { display: flex; background: var(--card-2); border-radius: 11px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 4px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--ink-soft); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.pill.blue { background: #E4ECFB; color: var(--blue); }
.pill.gray { background: var(--card-2); color: var(--ink-faint); }
.late { color: var(--red-ink); font-weight: 800; }
.due { color: var(--ink-soft); }
.tag { display: inline-block; font-size: 11px; background: var(--card-2); color: var(--ink-soft); border-radius: 6px; padding: 1px 6px; margin-right: 3px; }

/* 표 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--card); border-radius: var(--radius-sm); overflow: hidden; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { background: var(--card-2); font-size: 12.5px; color: var(--ink-soft); }
.tbl-wrap { overflow-x: auto; }

/* 초안 상자 */
.draft { background: var(--card-2); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0; }
.draft .h { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 13.5px; margin-bottom: 6px; }
.draft textarea { min-height: 120px; font-size: 14px; }

/* 조직도 선택기 */
.picker-list { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.picker-list .g { padding: 8px 12px; font-weight: 800; background: var(--card-2); font-size: 13px; position: sticky; top: 0; }
.picker-list .i { padding: 9px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; cursor: pointer; }
.picker-list .i:active { background: var(--card-2); }
.picker-list .i .n { font-weight: 700; }
.picker-list .i.sub .n { padding-left: 14px; font-weight: 600; }
.picker-list .i .t { color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; }

/* 주간보고 · 인쇄 */
.report h2 { font-size: 18px; margin: 18px 0 8px; }
.report h4 { margin: 12px 0 6px; font-size: 14px; color: var(--ink-soft); }
.report ul { padding-left: 18px; margin: 4px 0; }
@media print {
  header.top, nav.tabs, .sheet, .sheet-bg, #toast, .noprint { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .card, .item { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .view { display: none; } .view.on { display: block; }
}
