/* ============================================================
   미라클컴퍼니 사내 업무 시스템 - 공통 스타일
   ============================================================ */

:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e4e8f0;
  --line-strong: #cfd6e4;
  --text: #16202f;
  --text-mid: #55617a;
  --text-dim: #8a94a8;
  --brand: #2f5fe0;
  --brand-dark: #234ab8;
  --brand-soft: #eaf0ff;
  --side: #141b2b;
  --side-hover: #1e2739;
  --ok: #12855f;
  --ok-soft: #e2f5ee;
  --warn: #b45309;
  --warn-soft: #fdf1e0;
  --danger: #c1332c;
  --danger-soft: #fdecec;
  --info: #0e7490;
  --info-soft: #e2f4f8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 27, 43, .06), 0 8px 24px rgba(20, 27, 43, .06);
  --shadow-sm: 0 1px 2px rgba(20, 27, 43, .08);
  --font: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", "맑은 고딕", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------- 로그인 화면 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% -10%, #dfe7ff 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 110%, #e6ecff 0%, transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 38px 34px 30px;
}
.auth-logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(140deg, var(--brand), #6d8cff);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px;
  margin-bottom: 18px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.4px; }
.auth-card .sub { margin: 0 0 26px; color: var(--text-dim); font-size: 13.5px; }
.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 22px;
  background: #eef1f7; padding: 4px; border-radius: 10px;
}
.auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 8px 0;
  border-radius: 7px; cursor: pointer; color: var(--text-mid);
  font-weight: 600; font-size: 14px;
}
.auth-tabs button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 폼 ---------- */
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-mid); margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=url], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 95, 224, .13);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
input:disabled, select:disabled, textarea:disabled {
  background: #f3f5f9; color: var(--text-dim); cursor: not-allowed;
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s, opacity .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 11px 16px; }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { background: #f5f7fb; }
.btn.soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn.soft:hover { background: #dde6ff; }
.btn.ok { background: var(--ok); } .btn.ok:hover { background: #0d6b4c; }
.btn.danger { background: var(--danger); } .btn.danger:hover { background: #a32b25; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn.lg { padding: 13px 22px; font-size: 15px; }

/* ---------- 레이아웃 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--side); color: #c8d0e0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  padding: 20px 20px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #232c3f;
}
.side-brand .mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), #6d8cff);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
}
.side-brand .name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.3px; }
.side-brand .name small { display: block; font-weight: 500; font-size: 11px; color: #7d8aa3; letter-spacing: 0; }

.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.side-nav .group { padding: 14px 10px 6px; font-size: 11px; color: #67728a; font-weight: 700; letter-spacing: .4px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px; color: #c8d0e0;
  font-size: 14px; font-weight: 500; margin-bottom: 2px;
}
.side-nav a:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.side-nav a.on { background: var(--brand); color: #fff; font-weight: 600; }
.side-nav a .ico { width: 18px; text-align: center; font-size: 15px; opacity: .95; }
.side-nav a .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
}

.side-user {
  border-top: 1px solid #232c3f; padding: 14px;
  display: flex; align-items: center; gap: 10px;
}
.side-user .avatar { width: 34px; height: 34px; flex: 0 0 34px; }
.side-user .meta { min-width: 0; flex: 1; }
.side-user .meta b { display: block; color: #fff; font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .meta span { font-size: 11.5px; color: #7d8aa3; }
.side-user .out {
  background: transparent; border: 1px solid #333e54; color: #9aa5bb;
  border-radius: 7px; padding: 5px 8px; cursor: pointer; font-size: 12px;
}
.side-user .out:hover { color: #fff; border-color: #4a5876; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 26px; height: 60px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; letter-spacing: -.3px; }
.topbar .today { margin-left: auto; color: var(--text-dim); font-size: 13px; }
.menu-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--text); }
.content { padding: 24px 26px 60px; max-width: 1280px; width: 100%; }

/* ---------- 카드 / 그리드 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 20px; margin-bottom: 18px;
}
.card > h2, .card > h3 {
  margin: 0 0 14px; font-size: 15px; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 8px;
}
.card > h2 .more, .card > h3 .more { margin-left: auto; font-size: 13px; font-weight: 500; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .k { font-size: 12.5px; color: var(--text-dim); font-weight: 600; margin-bottom: 6px; }
.stat .v { font-size: 25px; font-weight: 700; letter-spacing: -.6px; }
.stat .v small { font-size: 14px; font-weight: 600; color: var(--text-mid); margin-left: 2px; }
.stat .sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* ---------- 테이블 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; font-size: 12.5px; color: var(--text-mid); font-weight: 600;
  padding: 9px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
table.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fafbfe; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .row-link { cursor: pointer; }

/* ---------- 뱃지 / 칩 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: #eef1f7; color: var(--text-mid); white-space: nowrap;
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.brand { background: var(--brand-soft); color: var(--brand-dark); }
.tag.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-grid; place-items: center;
  color: #fff; font-size: 11.5px; font-weight: 700; flex: 0 0 auto;
  letter-spacing: -.3px;
}
.person { display: flex; align-items: center; gap: 9px; }
.person .nm { font-weight: 600; }
.person .rl { font-size: 12px; color: var(--text-dim); }

/* ---------- 툴바 / 필터 ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; }
.seg { display: inline-flex; background: #eef1f7; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 7px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-mid);
}
.seg button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 출퇴근 위젯 ---------- */
.punch {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: linear-gradient(120deg, #1b2439, #2b3d63);
  color: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px;
}
.punch .clock { font-size: 34px; font-weight: 700; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.punch .date { font-size: 13px; color: #a9b6d1; }
.punch .times { display: flex; gap: 26px; margin-left: 8px; }
.punch .times div span { display: block; font-size: 11.5px; color: #a9b6d1; margin-bottom: 2px; }
.punch .times div b { font-size: 17px; font-variant-numeric: tabular-nums; }
.punch .acts { margin-left: auto; display: flex; gap: 8px; }
.punch .btn.ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.punch .btn.ghost:hover { background: rgba(255,255,255,.2); }

/* ---------- 진행 바 ---------- */
.bar { height: 8px; background: #eaeef5; border-radius: 20px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 20px; transition: width .3s; }
.bar > i.warn { background: var(--warn); }
.bar > i.danger { background: var(--danger); }

/* ---------- 리스트 아이템 ---------- */
.item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 4px; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item .body { flex: 1; min-width: 0; }
.item .body .t { font-weight: 600; margin-bottom: 3px; }
.item .body .d { font-size: 13px; color: var(--text-mid); }
.item .body .m { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.item .side { text-align: right; white-space: nowrap; }

/* ---------- 칸반 ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #eef1f7; border-radius: var(--radius); padding: 12px; min-height: 160px; }
.kcol > h4 { margin: 0 0 10px; font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--text-mid); }
.kcol > h4 .cnt { margin-left: auto; background: #fff; border-radius: 20px; padding: 0 7px; font-size: 12px; }
.kcard {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin-bottom: 9px; box-shadow: var(--shadow-sm); cursor: pointer;
}
.kcard:hover { border-color: var(--brand); }
.kcard .t { font-weight: 600; font-size: 14px; margin-bottom: 5px; line-height: 1.4; }
.kcard .c { font-size: 12.5px; color: var(--text-dim); margin-bottom: 8px; }
.kcard .f { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-mid); }
.kcard .f .avatar { width: 22px; height: 22px; font-size: 10px; }

/* ---------- 모달 ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(16, 22, 34, .48);
  display: grid; place-items: center; padding: 20px; z-index: 100;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 540px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(10, 16, 28, .3);
}
.modal.wide { max-width: 760px; }
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; position: sticky; top: 0; background: #fff;
}
.modal-head h3 { margin: 0; font-size: 16.5px; }
.modal-head .x { margin-left: auto; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--text-dim); line-height: 1; }
.modal-body { padding: 20px 22px; }
.modal-foot {
  padding: 14px 22px 18px; display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff;
}

/* ---------- 계정 정보 카드 ---------- */
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.vcard {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 15px; box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--line-strong); display: flex; flex-direction: column; gap: 9px;
  overflow: hidden;
}
.vcard img { max-width: 100%; }
.vcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.vcard .vhead { display: flex; align-items: flex-start; gap: 6px; }
.vcard .vname { font-weight: 700; font-size: 14.5px; line-height: 1.35; flex: 1; word-break: break-all; }
.vcard .vsub { font-size: 12px; color: var(--text-dim); }
.vcard .vrow {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  padding: 5px 8px; background: #f7f8fc; border-radius: 7px;
}
.vcard .vrow .vlabel { color: var(--text-dim); font-size: 11.5px; width: 42px; flex: 0 0 42px; }
.vcard .vrow .vval {
  flex: 1; min-width: 0; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vcard .vfoot {
  display: flex; align-items: center; gap: 6px; padding-top: 4px;
  border-top: 1px solid var(--line); margin-top: 2px;
}
.vcard .icob {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 6px;
  padding: 3px 7px; font-size: 11.5px; cursor: pointer; color: var(--text-mid); line-height: 1.5;
}
.vcard .icob:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }

/* ---------- 대표 대시보드 ---------- */
.brief {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
  font-size: 14px; color: var(--text-mid);
}
.brief b { color: var(--text); font-size: 15.5px; }
.brief .b-item.off b { color: var(--warn); }
.brief .b-item.bad { color: var(--danger); }
.brief .b-item.bad b { color: var(--danger); }
.brief .b-item.warn { color: var(--warn); font-weight: 600; }
.brief .b-item.warn b { color: var(--warn); }
.brief .b-item.good { color: var(--ok); font-weight: 600; }
.brief .b-sep { color: var(--line-strong); }

.alertbox {
  background: #fff; border: 1px solid var(--warn); border-left: 5px solid var(--warn);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.alertbox > h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.alertline {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px dashed var(--line); font-size: 13.5px;
}
.alertline:last-child { border-bottom: 0; }
.alertline .who { width: 86px; flex: 0 0 86px; font-weight: 700; font-size: 12.5px; }
.alertline .txt { flex: 1; min-width: 0; }
.alertline .go { margin-left: auto; white-space: nowrap; }

/* 직원 현황 보드 */
.board td, .board th { vertical-align: middle; }
.board .prog { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.board .prog .bar { flex: 1; }
.board tr.off { background: #fafbfe; color: var(--text-dim); }

/* 이번 주 한눈에 */
.week { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.week th { font-size: 11.5px; color: var(--text-dim); font-weight: 600; padding: 2px; text-align: center; }
.week th.today { color: var(--brand); font-weight: 800; }
.week td.nm { text-align: left; white-space: nowrap; font-weight: 600; font-size: 12.5px; padding-right: 6px; }
.week td.d {
  text-align: center; border-radius: 6px; padding: 7px 0; background: #eef5ee;
  color: #12724f; font-weight: 700;
}
.week td.d.off   { background: #f1f3f7; color: var(--text-dim); font-weight: 500; }
.week td.d.leave { background: var(--brand-soft); color: var(--brand-dark); }
.week td.d.half  { background: var(--warn-soft); color: var(--warn); }
.week td.d.bad   { background: var(--danger-soft); color: var(--danger); }
.week td.d.hol   { background: #fdeceb; color: var(--danger); }
.week td.d.now   { box-shadow: 0 0 0 2px var(--brand); }

/* ---------- 업무 카드 ---------- */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 11px; }
.tcard {
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 13px 14px; box-shadow: var(--shadow-sm); cursor: pointer;
  border-left: 4px solid var(--line-strong);
  display: flex; flex-direction: column; gap: 8px;
}
.tcard:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.tcard.s-doing  { border-left-color: var(--brand); }
.tcard.s-review { border-left-color: var(--info); }
.tcard.s-hold   { border-left-color: var(--warn); }
.tcard.s-done   { border-left-color: var(--ok); opacity: .72; }
.tcard.overdue  { border-left-color: var(--danger); background: #fffbfb; }
.tcard .tt { font-weight: 700; font-size: 14px; line-height: 1.4; }
.tcard .tmeta { font-size: 12px; color: var(--text-dim); display: flex; gap: 8px; flex-wrap: wrap; }

.owner-head {
  display: flex; align-items: center; gap: 9px; margin: 0 0 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.owner-head .who { font-weight: 700; font-size: 14.5px; }
.owner-head .sub { font-size: 12px; color: var(--text-dim); }
.owner-head .stats { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.owner-head .mini-bar { width: 110px; }

/* 문서 썸네일 */
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs .th {
  width: 54px; height: 54px; border-radius: 7px; border: 1px solid var(--line);
  overflow: hidden; cursor: pointer; background: #f7f8fc; position: relative;
  display: grid; place-items: center; font-size: 20px; padding: 0;
}
.thumbs .th:hover { border-color: var(--brand); }
.thumbs .th img {
  width: 54px; height: 54px; max-width: 54px; max-height: 54px;
  object-fit: cover; display: block;
}
.thumbs .th .more-n {
  position: absolute; inset: 0; background: rgba(20,27,43,.62); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.viewer-img {
  max-width: 100%; max-height: 62vh; display: block; margin: 0 auto;
  border-radius: 8px; background: #f2f4f8;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chips button {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 20px;
  padding: 5px 13px; font-size: 13px; cursor: pointer; color: var(--text-mid); font-weight: 600;
}
.chips button.on { background: var(--side); color: #fff; border-color: var(--side); }

.vsec { margin-bottom: 22px; }
.vsec > h4 {
  margin: 0 0 10px; font-size: 13.5px; display: flex; align-items: center; gap: 7px;
  color: var(--text-mid);
}
.vsec > h4 .cnt { background: #eef1f7; border-radius: 20px; padding: 1px 8px; font-size: 12px; }

/* ---------- 이모지 선택기 ---------- */
.emoji-pop {
  position: fixed; z-index: 300; width: 268px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(10, 16, 28, .22); overflow: hidden;
  animation: slideIn .12s ease-out;
}
.emoji-cats { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: #f7f8fc; }
.emoji-cats button {
  flex: 1; border: 0; background: transparent; border-radius: 6px;
  padding: 5px 2px; font-size: 11.5px; font-weight: 600; color: var(--text-mid); cursor: pointer;
  white-space: nowrap;
}
.emoji-cats button.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.emoji-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 2px; padding: 8px; max-height: 190px; overflow-y: auto;
}
.emoji-grid button {
  border: 0; background: transparent; font-size: 21px; line-height: 1;
  padding: 7px 0; border-radius: 8px; cursor: pointer;
}
.emoji-grid button:hover { background: var(--brand-soft); }

.field-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.field-head label { margin: 0 !important; }
.field-head .spacer { flex: 1; }

/* ---------- 알림 토스트 ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1b2337; color: #fff; padding: 12px 16px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(10, 16, 28, .28); font-size: 14px; max-width: 340px;
  animation: slideIn .2s ease-out;
}
.toast.ok { background: #12724f; }
.toast.err { background: #a32b25; }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 상태 표시 ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--text-dim); }
.empty .ico { font-size: 30px; margin-bottom: 10px; opacity: .5; }
.loading { text-align: center; padding: 40px; color: var(--text-dim); font-size: 14px; }
.spinner {
  width: 22px; height: 22px; border: 2.5px solid var(--line-strong);
  border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 10px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert {
  border-radius: 10px; padding: 13px 15px; font-size: 13.5px; margin-bottom: 16px;
  border: 1px solid transparent; line-height: 1.6;
}
.alert.info { background: var(--info-soft); color: #0b5a6e; border-color: #b9e2ec; }
.alert.warn { background: var(--warn-soft); color: #8a4009; border-color: #f4dcb6; }
.alert.err  { background: var(--danger-soft); color: #97231e; border-color: #f3c9c7; }
.alert.ok   { background: var(--ok-soft); color: #0b5c40; border-color: #b9e6d5; }
.alert code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.col2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- 캘린더 ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--text-dim); font-weight: 600; padding: 4px 0; }
.cal .day {
  min-height: 78px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px;
  background: #fff; font-size: 12px;
}
.cal .day.out { background: #fafbfe; color: var(--text-dim); }
.cal .day.today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(47,95,224,.12); }
.cal .day .n { font-weight: 600; margin-bottom: 3px; }
.cal .day .n.sun { color: var(--danger); }
.cal .day .n.sat { color: var(--info); }
.cal .ev {
  display: block; background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 5px; padding: 1px 5px; margin-bottom: 2px; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal .ev.pending { background: var(--warn-soft); color: var(--warn); }

/* ---------- 반응형 ---------- */
@media (max-width: 1024px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: block; }
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 0 16px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .col2 { grid-template-columns: 1fr; }
  .punch { padding: 18px; gap: 14px; }
  .punch .acts { margin-left: 0; width: 100%; }
  .punch .acts .btn { flex: 1; }
  .kanban { grid-template-columns: repeat(5, 78vw); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }
}
@media print {
  .sidebar, .topbar, .toolbar, .btn { display: none !important; }
  .content { padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* ============================================================
   2차 비밀번호 입력 화면
   ============================================================ */
.pin-screen {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--side);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.pin-box {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--panel); border-radius: 18px;
  padding: 34px 28px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.pin-ico { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.pin-box h2 { font-size: 19px; margin: 0 0 10px; letter-spacing: -.4px; }
.pin-sub { font-size: 13px; color: var(--text-mid); line-height: 1.65; margin: 0 0 18px; }
.pin-sub.small { font-size: 12px; color: var(--text-dim); margin: 14px 0 0; }

.pin-input {
  width: 100%; margin-bottom: 10px;
  text-align: center; letter-spacing: 12px; text-indent: 12px;
  font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 13px 10px;
  border: 1.5px solid var(--line-strong); border-radius: 11px;
  background: var(--bg);
}
.pin-input::placeholder { letter-spacing: 4px; text-indent: 4px; font-size: 15px; font-weight: 500; }
.pin-input:focus { outline: none; border-color: var(--brand); background: #fff; }

.pin-msg { min-height: 20px; font-size: 12.5px; margin-bottom: 10px; }
.pin-msg.err { color: var(--danger); }
.pin-msg.ok  { color: var(--ok); }

.pin-box .btn { width: 100%; justify-content: center; padding: 12px; }
.pin-box .btn.ghost.sm { width: auto; margin-top: 16px; padding: 6px 14px; font-size: 12px; }
