/* INDEXMAKER 워크스페이스 */
@font-face { font-family: 'Pretendard'; src: url('/assets/fonts/Pretendard-Regular.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url('/assets/fonts/Pretendard-Medium.otf') format('opentype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url('/assets/fonts/Pretendard-SemiBold.otf') format('opentype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url('/assets/fonts/Pretendard-Bold.otf') format('opentype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Pretendard'; src: url('/assets/fonts/Pretendard-ExtraBold.otf') format('opentype'); font-weight: 800; font-display: swap; }
:root {
  --brand-cyan: #00AEEF;
  --brand-pink: #FF4D8D;
  --brand-gray: #A7A9AC;
  --dark: #2b2d31;
  --dark2: #1f2124;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #26282b;
  --muted: #8a8f96;
  --border: #e3e7ea;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }

/* 로그인 */
#login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--dark2) 0%, var(--dark) 60%, #0d3b52 100%); }
.login-box { background: #fff; padding: 44px 40px; border-radius: 16px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.login-logo { width: 190px; margin-bottom: 14px; }
.login-box h1 { font-size: 17px; font-weight: 600; color: var(--muted); margin-bottom: 24px; }
.login-box input { width: 100%; padding: 12px 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.login-box input:focus { outline: 2px solid var(--brand-cyan); border-color: transparent; }
.login-hint { margin-top: 18px; color: var(--muted); font-size: 12px; }

/* 레이아웃 */
#app { display: flex; min-height: 100vh; }
#sidebar { width: 230px; background: var(--dark2); color: #cfd3d8; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; }
.sidebar-logo { padding: 20px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo img { width: 150px; filter: drop-shadow(0 0 1px rgba(255,255,255,.4)); }
#nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section { font-size: 11px; color: #6b7076; padding: 14px 10px 6px; letter-spacing: .5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: #cfd3d8; font-size: 14px; margin-bottom: 2px; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--brand-cyan); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
#user-info { margin-bottom: 8px; font-size: 13px; }
#user-info .u-name { font-weight: 700; color: #fff; }
#user-info .u-pos { color: #8a8f96; font-size: 12px; }

#main { flex: 1; margin-left: 230px; display: flex; flex-direction: column; }
#topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
#page-title { font-size: 19px; font-weight: 700; }
#content { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }

/* 알림 */
.btn-noti { position: relative; background: #eef2f5; border: none; font-size: 13px; font-weight: 600; cursor: pointer; padding: 8px 14px; border-radius: 8px; font-family: inherit; color: var(--text); }
.btn-noti:hover { filter: brightness(.96); }
#noti-badge { position: absolute; top: -6px; right: -8px; background: var(--brand-pink); color: #fff; font-size: 10px; border-radius: 999px; padding: 2px 6px; font-weight: 700; }
#noti-panel { position: fixed; top: 62px; right: 24px; width: 360px; max-height: 480px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.15); z-index: 100; }
.noti-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.noti-item.unread { background: #eef8fe; }
.noti-item .noti-time { color: var(--muted); font-size: 11px; margin-top: 3px; }

/* 카드/공통 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

.btn { border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; cursor: pointer; font-weight: 600; background: #e9edf0; color: var(--text); }
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--brand-cyan); color: #fff; }
.btn-pink { background: var(--brand-pink); color: #fff; }
.btn-dark { background: var(--dark); color: #fff; }
.btn-ghost { background: transparent; color: #9aa0a6; border: 1px solid rgba(255,255,255,.2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-danger { background: #e5484d; color: #fff; }

table.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); border-bottom: 2px solid var(--border); padding: 9px 10px; white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.tbl tr:hover td { background: #f8fafb; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.b-gray { background: #eceff1; color: #607080; }
.b-cyan { background: #d8f2fd; color: #0281b3; }
.b-pink { background: #ffe3ee; color: #d81b60; }
.b-green { background: #dcf5e5; color: #1d8a4a; }
.b-red { background: #fde5e5; color: #c62828; }
.b-yellow { background: #fff3d6; color: #b07d1a; }

.empty { color: var(--muted); text-align: center; padding: 30px 0; font-size: 13px; }
.error-msg { color: #e5484d; font-size: 12px; margin-top: 8px; min-height: 16px; }

/* 폼 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.fld { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input.inp, select.inp, textarea.inp { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff; }
input.inp:focus, select.inp:focus, textarea.inp:focus { outline: 2px solid var(--brand-cyan); border-color: transparent; }
textarea.inp { resize: vertical; min-height: 90px; }

/* 모달 */
#modal-backdrop { position: fixed; inset: 0; background: rgba(15,18,20,.5); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; }
#modal { background: #fff; border-radius: 14px; width: 780px; max-width: 100%; padding: 26px; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
#modal .tbl-scroll { overflow-x: auto; }
#modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* 토스트 */
#toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 13px; z-index: 300; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* 할 일 */
.todo-layout { display: grid; grid-template-columns: 240px 1fr; gap: 18px; }
.todo-lists .list-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; margin-bottom: 4px; }
.todo-lists .list-item:hover { background: #eef2f5; }
.todo-lists .list-item.active { background: var(--brand-cyan); color: #fff; font-weight: 600; }
.todo-lists .list-item.today-list { background: #ffe3ee; color: #d81b60; font-weight: 700; margin-bottom: 8px; }
.todo-lists .list-item.today-list.active { background: var(--brand-pink); color: #fff; }
.todo-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.todo-item.done .t-title { text-decoration: line-through; color: var(--muted); }
.todo-item input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand-cyan); cursor: pointer; }
.todo-item .t-title { flex: 1; cursor: pointer; }
.todo-item .t-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.todo-item .t-star { cursor: pointer; font-size: 15px; }
.todo-add { display: flex; gap: 8px; margin-bottom: 14px; }
.todo-add input { flex: 1; }

/* 스케줄(간트) */
.gantt-wrap { overflow-x: auto; }
.gantt { display: grid; gap: 2px; min-width: 900px; }
.gantt-row { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 8px; }
.gantt-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-track { position: relative; height: 30px; background: #f0f3f5; border-radius: 6px; }
.gantt-bar { position: absolute; top: 4px; bottom: 4px; border-radius: 5px; font-size: 11px; color: #fff; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; cursor: pointer; }
.gantt-head { display: grid; grid-template-columns: 130px 1fr; gap: 8px; margin-bottom: 4px; }
.gantt-days { display: grid; position: relative; font-size: 10px; color: var(--muted); }
.gantt-days span { text-align: center; border-left: 1px dashed #e3e7ea; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--brand-pink); z-index: 2; }

/* 인쇄 (견적서/인보이스) */
.doc-print { background: #fff; padding: 40px; max-width: 800px; margin: 0 auto; border: 1px solid var(--border); }
.doc-print .doc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.doc-print .doc-head img { width: 160px; }
.doc-print h1.doc-title { font-size: 26px; letter-spacing: 6px; text-align: center; margin: 18px 0 26px; border-bottom: 3px solid var(--dark); padding-bottom: 12px; }
.doc-print table.doc-tbl { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc-print .doc-tbl th { background: #f0f3f5; border: 1px solid #cfd5da; padding: 8px; font-size: 12px; }
.doc-print .doc-tbl td { border: 1px solid #cfd5da; padding: 8px; font-size: 13px; }
.doc-print .doc-total td { font-weight: 700; background: #fafbfc; }
.doc-meta { font-size: 13px; line-height: 1.9; }
@media print {
  body * { visibility: hidden; }
  #modal-backdrop, #modal { position: static !important; box-shadow: none !important; padding: 0 !important; overflow: visible !important; }
  .doc-print, .doc-print * { visibility: visible; }
  .doc-print { position: absolute; left: 0; top: 0; width: 100%; border: none; }
  .no-print { display: none !important; }
}

/* 달력 뷰 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; min-width: 720px; }
.cal-week { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 92px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: #fff; overflow: hidden; }
.cal-empty { background: #f7f9fa; border-style: dashed; }
.cal-today { outline: 2px solid var(--brand-cyan); }
.cal-date { font-size: 11px; font-weight: 700; margin-bottom: 3px; }
.cal-red { color: #d81b60; }
.cal-item { font-size: 10px; color: #fff; border-radius: 4px; padding: 1px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* 대시보드 */
.dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.dash-banner { background: linear-gradient(120deg, var(--dark2), #0d3b52); color: #fff; border-radius: var(--radius); padding: 22px 26px; margin-bottom: 18px; display: flex; justify-content: space-between; align-items: center; }
.dash-banner b { color: var(--brand-cyan); }
.mini-item { display: flex; justify-content: space-between; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-item:last-child { border-bottom: none; }
.mini-item .mm { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 주간보고 */
.week-group { margin-bottom: 20px; }
.week-group h4 { font-size: 14px; margin-bottom: 8px; color: var(--dark); }
.report-card { border-left: 4px solid var(--brand-cyan); }
.report-card .rc-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.report-card pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.7; }
.report-sub { font-size: 12px; color: var(--muted); margin: 6px 0 2px; font-weight: 700; }

/* 권한 체크박스 */
.perm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.perm-grid label { display: flex; gap: 6px; align-items: center; font-size: 13px; background: #f4f6f8; padding: 8px 10px; border-radius: 8px; cursor: pointer; }

/* 모바일 (폰·태블릿) */
.btn-menu { display: none; background: #eef2f5; border: none; border-radius: 8px; padding: 8px 12px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--text); }
#nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,18,20,.45); z-index: 350; }
@media (max-width: 900px) {
  html, body { overflow-x: hidden; max-width: 100vw; }
  #app, #main, #content { max-width: 100vw; min-width: 0; }
  /* iOS는 입력창 글자가 16px 미만이면 포커스 시 자동 확대됨 → 16px로 고정 */
  .inp, select.inp, textarea.inp, .login-box input, .todo-add input { font-size: 16px; }
  #sidebar { transform: translateX(-105%); transition: transform .22s ease; width: 250px; z-index: 400; box-shadow: 8px 0 32px rgba(0,0,0,.35); }
  body.nav-open #sidebar { transform: none; }
  body.nav-open #nav-backdrop { display: block; }
  #main { margin-left: 0; }
  .btn-menu { display: inline-block; }
  #topbar { padding: 12px 14px; }
  #page-title { font-size: 16px; }
  #content { padding: 14px 12px 60px; }
  .grid-2, .dash-grid, .form-grid, .todo-layout { grid-template-columns: 1fr; }
  .dash-banner { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 18px; }
  .card { overflow-x: auto; }
  .toolbar { gap: 6px; }
  .btn { padding: 8px 12px; }
  #modal { padding: 18px 14px; border-radius: 12px; }
  #modal-backdrop { padding: 14px 8px; }
  .doc-print { padding: 18px 14px; }
  #noti-panel { left: 8px; right: 8px; width: auto; }
  .perm-grid { grid-template-columns: repeat(2, 1fr); }
  .todo-add { flex-wrap: wrap; }
  .todo-add .inp { min-width: 0; }
  .login-box { width: 100%; max-width: 380px; padding: 32px 22px; }
}
