/* ============================================================
   PMS - style.css
   ============================================================ */

:root {
  --bg:       #f5f6fa;
  --surface:  #ffffff;
  --surface2: #f9f9fc;
  --border:   #e4e6ef;
  --border2:  #d0d3e8;
  --text0:    #1a1d2e;
  --text1:    #4a4f6a;
  --text2:    #9197b3;
  --accent:   #3b6ef5;
  --accent-bg:#eef3fe;
  --green:    #22c993;
  --green-bg: #eafaf5;
  --amber:    #f5a623;
  --amber-bg: #fef6e7;
  --red:      #e8505b;
  --red-bg:   #fdeced;
  --purple:   #7c5bf5;
  --sidebar-w:220px;
  --header-h: 52px;
  --font:     'Noto Sans KR', sans-serif;
  --mono:     'JetBrains Mono', monospace;
  --radius:   8px;
  --shadow:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}
[data-theme="dark"] {
  --bg:       #10121a;
  --surface:  #181c28;
  --surface2: #1e2235;
  --border:   #272d42;
  --border2:  #323858;
  --text0:    #e8eaf5;
  --text1:    #8f96b8;
  --text2:    #555d7a;
  --accent:   #5b85f7;
  --accent-bg:#1a2340;
  --green:    #2ed4a0;
  --green-bg: #0f2820;
  --amber:    #f5b030;
  --amber-bg: #2a1f0a;
  --red:      #f06070;
  --red-bg:   #2a1015;
  --purple:   #9b7ef8;
  --shadow:   0 1px 3px rgba(0,0,0,0.3);
}

/* ── RESET ── */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html,body { height:100%; font-family:var(--font); background:var(--bg); color:var(--text0); font-size:13px; line-height:1.5; }
button { font-family:var(--font); cursor:pointer; border:none; background:none; }
a { text-decoration:none; color:inherit; }

/* ── APP SHELL ── */
.app { display:flex; height:100vh; overflow:hidden; }

/* ── SIDEBAR ── */
.sidebar {
  width:var(--sidebar-w); flex-shrink:0;
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  overflow-y:auto;
  transition:transform 0.22s ease;
}
.sidebar-logo {
  height:var(--header-h);
  display:flex; align-items:center;
  padding:0 20px;
  border-bottom:1px solid var(--border);
  gap:8px; flex-shrink:0;
}
.logo-mark {
  width:28px; height:28px; border-radius:7px;
  background:var(--accent);
  display:flex; align-items:center; justify-content:center;
}
.logo-mark svg { width:15px; height:15px; stroke:#fff; stroke-width:2.5; fill:none; }
.logo-text { font-size:15px; font-weight:700; color:var(--text0); letter-spacing:-0.02em; }

.nav-group { padding:16px 12px 4px; }
.nav-group-label {
  font-size:10px; font-weight:600; letter-spacing:0.08em;
  text-transform:uppercase; color:var(--text2);
  padding:0 8px; margin-bottom:4px;
}
.nav-item {
  display:flex; align-items:center; justify-content:space-between;
  padding:7px 10px; border-radius:6px;
  cursor:pointer; color:var(--text1);
  transition:all 0.15s; font-size:13px; font-weight:400;
  margin-bottom:1px;
}
.nav-item:hover { background:var(--surface2); color:var(--text0); }
.nav-item.active { background:var(--accent-bg); color:var(--accent); font-weight:500; }
.nav-item-left { display:flex; align-items:center; gap:8px; }
.nav-badge {
  font-size:10px; font-weight:600;
  background:var(--accent); color:#fff;
  padding:1px 6px; border-radius:10px; min-width:18px; text-align:center;
}
.nav-badge.red { background:var(--red); }
.nav-badge.amber { background:var(--amber); }

.sidebar-footer {
  margin-top:auto; padding:12px;
  border-top:1px solid var(--border);
}
.user-card {
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:6px;
  cursor:pointer; transition:background 0.15s;
}
.user-card:hover { background:var(--surface2); }
.user-avatar {
  width:30px; height:30px; border-radius:8px; flex-shrink:0;
  background:linear-gradient(135deg,var(--accent),var(--purple));
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700; color:#fff;
}
.user-name { font-size:13px; font-weight:600; color:var(--text0); }
.user-role { font-size:11px; color:var(--text2); }
.user-actions { margin-left:auto; display:flex; gap:4px; }
.icon-btn {
  width:28px; height:28px; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  color:var(--text2); transition:all 0.15s; position:relative;
}
.icon-btn:hover { background:var(--surface2); color:var(--text1); }
.notif-dot {
  position:absolute; top:4px; right:4px;
  width:14px; height:14px; border-radius:50%;
  background:var(--red); color:#fff;
  font-size:8px; font-weight:700;
  display:flex; align-items:center; justify-content:center;
  border:2px solid var(--surface);
}
.sidebar-copyright {
  font-size:10px; color:var(--text2);
  padding:8px 20px 12px; text-align:left;
}

/* ── MAIN AREA ── */
.main-area { flex:1; display:flex; flex-direction:column; overflow:hidden; }

/* ── TOPBAR ── */
.topbar {
  height:var(--header-h); flex-shrink:0;
  background:var(--surface);
  border-bottom:1px solid var(--border);
  display:flex; align-items:center;
  padding:0 24px; gap:12px;
}
.topbar-hamburger {
  display:none; width:32px; height:32px; border-radius:6px;
  align-items:center; justify-content:center; flex-direction:column; gap:4px;
  background:var(--surface2); border:1px solid var(--border); cursor:pointer;
}
.topbar-hamburger span { width:14px; height:1.5px; background:var(--text1); border-radius:2px; }
.topbar-title {
  font-size:15px; font-weight:600; color:var(--text0);
  display:flex; align-items:center; gap:10px;
}
.topbar-title svg { color:var(--text2); width:16px; height:16px; flex-shrink:0; }
.topbar-spacer { flex:1; }
.search-box {
  display:flex; align-items:center; gap:8px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:6px; padding:6px 12px;
  color:var(--text2); font-size:12px; font-family:var(--font);
  min-width:200px; cursor:text; transition:border-color 0.15s;
}
.search-box:hover { border-color:var(--accent); }
.search-box svg { width:13px; height:13px; flex-shrink:0; }
.kbd {
  margin-left:auto; font-size:10px;
  background:var(--border); color:var(--text2);
  padding:2px 5px; border-radius:4px; font-family:var(--mono);
}
.theme-btn {
  width:32px; height:32px; border-radius:6px;
  background:var(--surface2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  color:var(--text2); transition:all 0.15s;
}
.theme-btn:hover { border-color:var(--accent); color:var(--accent); }
.theme-btn svg { width:14px; height:14px; }
.topbar-new-btn {
  display:flex; align-items:center; gap:6px;
  padding:6px 14px; border-radius:6px;
  background:var(--accent); color:#fff;
  font-size:12px; font-weight:600; font-family:var(--font);
  transition:opacity 0.15s;
}
.topbar-new-btn:hover { opacity:0.88; }

/* ── PAGE ── */
.page-wrap { flex:1; overflow-y:auto; padding:24px; }
.page { display:none; }
.page.active { display:block; animation:fadeUp 0.15s ease; }
@keyframes fadeUp { from{opacity:0;transform:translateY(5px);} to{opacity:1;transform:none;} }

/* ── STAT CARDS ── */
.stats-row { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:20px; }
.stat-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:18px 20px;
  box-shadow:var(--shadow);
}
.stat-label {
  font-size:12px; color:var(--text2); font-weight:500;
  margin-bottom:10px; display:flex; align-items:center; justify-content:space-between;
}
.stat-label svg { width:14px; height:14px; color:var(--text2); }
.stat-value { font-size:26px; font-weight:700; color:var(--text0); font-family:var(--mono); letter-spacing:-0.02em; }
.stat-unit { font-size:12px; color:var(--text2); margin-top:4px; }

/* ── CONTENT GRID ── */
.content-grid { display:grid; grid-template-columns:1fr 340px; gap:16px; }

/* ── CARD ── */
.card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow);
  margin-bottom:14px; overflow:hidden;
}
.card:last-child { margin-bottom:0; }
.card-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 18px; border-bottom:1px solid var(--border);
}
.card-title {
  font-size:13px; font-weight:600; color:var(--text0);
  display:flex; align-items:center; gap:8px;
}
.card-title svg { width:14px; height:14px; color:var(--accent); }
.card-action { font-size:12px; color:var(--accent); cursor:pointer; }
.card-action:hover { text-decoration:underline; }

/* ── TASK ROW ── */
.task-row {
  display:flex; align-items:center; gap:10px;
  padding:9px 18px; border-bottom:1px solid var(--border);
  cursor:pointer; transition:background 0.12s;
}
.task-row:last-child { border-bottom:none; }
.task-row:hover { background:var(--surface2); }
.chk {
  width:15px; height:15px; border-radius:4px;
  border:1.5px solid var(--border2); flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all 0.15s;
}
.chk.on { background:var(--green); border-color:var(--green); }
.chk.on::after { content:'✓'; font-size:9px; color:#fff; font-weight:700; }
.task-pri { width:4px; height:4px; border-radius:50%; flex-shrink:0; margin-top:1px; }
.task-body { flex:1; min-width:0; }
.task-title { font-size:13px; color:var(--text0); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.task-title.done { text-decoration:line-through; color:var(--text2); }
.task-proj { font-size:11px; color:var(--text2); margin-top:1px; }
.task-due { font-size:11px; color:var(--text2); white-space:nowrap; flex-shrink:0; }
.task-due.over { color:var(--red); }

/* ── SCHEDULE ROW ── */
.sched-row {
  display:flex; gap:12px;
  padding:10px 18px; border-bottom:1px solid var(--border);
  cursor:pointer; transition:background 0.12s;
}
.sched-row:last-child { border-bottom:none; }
.sched-row:hover { background:var(--surface2); }
.sched-bar { width:3px; border-radius:2px; flex-shrink:0; align-self:stretch; }
.sched-time { font-family:var(--mono); font-size:11px; color:var(--text2); white-space:nowrap; padding-top:1px; min-width:38px; }
.sched-title { font-size:13px; color:var(--text0); font-weight:500; }
.sched-tag { font-size:11px; color:var(--text2); margin-top:2px; }

/* ── PROJECT ROW ── */
.proj-row {
  display:flex; align-items:center; gap:12px;
  padding:10px 18px; border-bottom:1px solid var(--border);
  cursor:pointer; transition:background 0.12s;
}
.proj-row:last-child { border-bottom:none; }
.proj-row:hover { background:var(--surface2); }
.proj-color-bar { width:3px; height:36px; border-radius:2px; flex-shrink:0; }
.proj-info { flex:1; min-width:0; }
.proj-name { font-size:13px; font-weight:500; color:var(--text0); }
.proj-meta { font-size:11px; color:var(--text2); margin-top:1px; }
.proj-prog { height:3px; background:var(--border); border-radius:2px; margin-top:6px; overflow:hidden; }
.proj-bar { height:100%; border-radius:2px; }

/* ── PILLS ── */
.pill {
  display:inline-flex; align-items:center;
  padding:2px 8px; border-radius:10px;
  font-size:11px; font-weight:500; white-space:nowrap;
}
.pill-blue  { background:var(--accent-bg); color:var(--accent); }
.pill-green { background:var(--green-bg);  color:var(--green);  }
.pill-amber { background:var(--amber-bg);  color:var(--amber);  }
.pill-red   { background:var(--red-bg);    color:var(--red);    }
.pill-gray  { background:var(--surface2);  color:var(--text2);  border:1px solid var(--border); }

/* ── TABLE ── */
.data-table { width:100%; border-collapse:collapse; }
.data-table th {
  padding:9px 16px; text-align:center;
  font-size:11px; font-weight:600; letter-spacing:0.05em;
  color:var(--text2); background:var(--surface2);
  border-bottom:1px solid var(--border); white-space:nowrap;
}
.data-table td {
  padding:10px 16px; font-size:13px; color:var(--text1); text-align:center;
  border-bottom:1px solid var(--border); vertical-align:middle;
}
.data-table tr:last-child td { border-bottom:none; }
.data-table tbody tr { cursor:pointer; transition:background 0.12s; }
.data-table tbody tr:hover { background:var(--surface2); }
.data-table td.primary { color:var(--text0); font-weight:500; text-align:left; }

/* ── EMPTY ── */
.empty { padding:36px; text-align:center; color:var(--text2); font-size:13px; }

/* ── BOTTOM TAB (mobile) ── */
.bottom-tab {
  display:none; position:fixed; bottom:0; left:0; right:0;
  background:var(--surface); border-top:1px solid var(--border);
  height:56px; z-index:200;
  justify-content:space-around; align-items:center;
}
.tab-btn {
  flex:1; display:flex; flex-direction:column; align-items:center; gap:2px;
  cursor:pointer; padding:6px 4px;
  color:var(--text2); font-size:10px; font-weight:500;
  transition:color 0.15s;
}
.tab-btn svg { width:20px; height:20px; }
.tab-btn.active { color:var(--accent); }

/* ── OVERLAY ── */
.overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:150; }
.overlay.on { display:block; }

/* ── RESPONSIVE ── */
@media(max-width:1100px) {
  .content-grid { grid-template-columns:1fr; }
  .stats-row { grid-template-columns:repeat(2,1fr); }
}
@media(max-width:680px) {
  .sidebar { position:fixed; top:0; left:0; bottom:0; z-index:300; transform:translateX(-100%); }
  .sidebar.open { transform:none; }
  .topbar-hamburger { display:flex; }
  .search-box { display:none; }
  .page-wrap { padding:14px; padding-bottom:72px; }
  .stats-row { grid-template-columns:repeat(2,1fr); gap:8px; }
  .stat-value { font-size:22px; }
  .bottom-tab { display:flex; }
  .topbar-new-btn span { display:none; }
}

/* ── MODAL ── */
.modal-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,0.45); z-index:500;
  align-items:center; justify-content:center;
}
.modal-overlay.on { display:flex; }
.modal {
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; width:90%; max-width:680px;
  max-height:88vh; display:flex; flex-direction:column;
  box-shadow:0 8px 32px rgba(0,0,0,0.18);
}
.modal-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border);
}
.modal-title { font-size:15px; font-weight:600; color:var(--text0); }
.modal-close {
  width:28px; height:28px; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  color:var(--text2); cursor:pointer; font-size:14px;
  transition:all 0.15s;
}
.modal-close:hover { background:var(--surface2); color:var(--text0); }
.modal-body { padding:20px; overflow-y:auto; flex:1; }
.modal-foot {
  padding:14px 20px; border-top:1px solid var(--border);
  display:flex; justify-content:flex-end; gap:8px;
}

/* ── FORM ── */
.form-group { margin-bottom:14px; }
.form-group:last-child { margin-bottom:0; }
.form-label { font-size:12px; font-weight:500; color:var(--text1); margin-bottom:5px; display:block; }
.form-input {
  width:100%; padding:8px 10px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:6px; font-family:var(--font); font-size:13px;
  color:var(--text0); outline:none; transition:border-color 0.15s;
}
.form-input:focus { border-color:var(--accent); }
textarea.form-input { resize:vertical; min-height:80px; }
select.form-input { cursor:pointer; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

/* ── TOAST ── */
#toast-wrap { position:fixed; bottom:24px; right:24px; z-index:600; display:flex; flex-direction:column; gap:8px; }
.toast {
  padding:10px 16px; border-radius:8px;
  font-size:13px; font-weight:500;
  background:var(--surface); border:1px solid var(--border);
  box-shadow:0 4px 12px rgba(0,0,0,0.15);
  opacity:0; transform:translateY(8px);
  transition:all 0.25s ease; min-width:200px;
}
.toast.show { opacity:1; transform:none; }
.toast-success { border-color:var(--green); color:var(--green); }
.toast-error   { border-color:var(--red);   color:var(--red);   }

/* ── BTN PRIMARY ── */
.btn-primary { background:var(--text0); color:var(--surface); }
.btn-primary:hover { opacity:0.82; }

/* ── 모달 확인 버튼 ── */
#modal-confirm {
  background: none !important;
  color: var(--text1) !important;
  border: none !important;
  font-weight: 600;
}
#modal-confirm:hover { opacity: 0.82; }

/* ── Pikaday 커스텀 ── */
.pika-single {
  font-family: var(--font) !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
  color: var(--text0) !important;
}
.pika-title { background: var(--surface) !important; }
.pika-label { color: var(--text0) !important; background: var(--surface) !important; }
.pika-prev, .pika-next { color: var(--text1) !important; opacity: 0.7; }
.pika-prev:hover, .pika-next:hover { opacity: 1; }
.pika-table th { color: var(--text2) !important; font-size: 11px; }
.pika-button {
  color: var(--text1) !important;
  background: none !important;
  border-radius: 6px !important;
}
.pika-button:hover {
  background: var(--surface2) !important;
  color: var(--text0) !important;
}
.is-today .pika-button {
  color: var(--accent) !important;
  font-weight: 700;
}
.is-selected .pika-button {
  background: var(--accent) !important;
  color: #fff !important;
}
/* 토요일 파란색, 일요일 빨간색 */
.pika-table td:first-child .pika-button { color: var(--red) !important; }
.pika-table td:last-child .pika-button  { color: var(--accent) !important; }
.is-selected td:first-child .pika-button,
.is-selected td:last-child .pika-button { color: #fff !important; }

/* ── date input 기본 아이콘 제거 ── */
input[type="date"]::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
}

/* ── 태그 ── */
.tag-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap; margin: 2px;
}
.tag-add-btn {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; color: var(--text2);
  border: 1px dashed var(--border2);
  cursor: pointer; margin: 2px;
  transition: all 0.15s;
}
.tag-add-btn:hover { border-color: var(--accent); color: var(--accent); }
.tag-wrap { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 6px; }
.tag-selected { outline: 2px solid currentColor; outline-offset: 1px; }