/* ═══════════════════════════════════════
   A&P 그룹웨어 메인 스타일
   ═══════════════════════════════════════ */

/* ── 순서 이동 버튼 ── */
.move-btn {
  border: 1px solid #cbd5e1; background: #fff; color: #475569;
  width: 24px; height: 22px; border-radius: 5px; cursor: pointer;
  font-size: 10px; line-height: 1; padding: 0; margin: 0 1px; transition: all .12s;
}
.move-btn:hover:not(:disabled) { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }
.move-btn:disabled { opacity: 0.25; cursor: default; }

/* ── 정렬 칩 ── */
.sort-chip {
  display: inline-block; padding: 4px 12px; border-radius: 16px;
  border: 1px solid #d1d5db; background: #fff; color: #64748b;
  font-size: 12px; font-weight: 500; text-decoration: none; transition: all .12s;
}
.sort-chip:hover { border-color: #1e3a5f; color: #1e3a5f; text-decoration: none; }
.sort-chip.on { background: #1e3a5f; color: #fff; border-color: #1e3a5f; }

/* ── 크게 강조된 새 작성 버튼 ── */
.big-new-btn {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #1e3a5f, #2d5586);
  color: #fff; padding: 18px 24px; border-radius: 14px;
  margin-bottom: 18px; box-shadow: 0 6px 18px rgba(30,58,95,0.25);
  transition: transform 0.15s, box-shadow 0.15s; text-decoration: none;
}
.big-new-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(30,58,95,0.35); color: #fff; text-decoration: none; }
.big-new-icon { font-size: 30px; }
.big-new-title { display: block; font-size: 18px; font-weight: 700; }
.big-new-sub   { display: block; font-size: 12px; opacity: 0.8; margin-top: 2px; }
.big-new-arrow { margin-left: auto; font-size: 24px; opacity: 0.7; }

/* ── 커스텀 확인 모달 ── */
#confirmOverlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px);
  align-items: center; justify-content: center;
}
#confirmOverlay.show { display: flex; animation: cf-fade 0.15s ease; }
@keyframes cf-fade { from { opacity: 0 } to { opacity: 1 } }
#confirmOverlay .confirm-box {
  background: #fff; border-radius: 14px; padding: 28px 28px 20px;
  width: 360px; max-width: 90vw; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: cf-pop 0.18s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes cf-pop { from { transform: scale(.9); opacity: 0 } to { transform: scale(1); opacity: 1 } }
#confirmOverlay .confirm-icon { font-size: 36px; margin-bottom: 10px; }
#confirmOverlay .confirm-msg {
  font-size: 15px; color: #1e293b; line-height: 1.6; margin-bottom: 22px;
  white-space: pre-line; font-weight: 500;
}
#confirmOverlay .confirm-actions { display: flex; gap: 10px; justify-content: center; }
#confirmOverlay .confirm-actions .btn { min-width: 90px; justify-content: center; padding: 9px 18px; }

:root {
  --primary:       #1e3a5f;
  --primary-hover: #264d7d;
  --accent:        #0066cc;
  --bg:            #f0f2f5;
  --white:         #ffffff;
  --text:          #2d3748;
  --text-light:    #718096;
  --border:        #e2e8f0;
  --sidebar-w:     220px;
  --success:       #28a745;
  --warning:       #f59e0b;
  --danger:        #dc3545;
  --info:          #3b82f6;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Malgun Gothic','맑은 고딕',sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

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

/* ── 앱 레이아웃 ── */
.app-layout { display: flex; min-height: 100vh; }
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 24px; max-width: calc(100vw - var(--sidebar-w)); }

/* ── 사이드바 ── */
.sidebar {
  position: fixed; left: 0; top: 0; width: var(--sidebar-w); height: 100vh;
  background: var(--primary); color: #fff; overflow-y: auto; z-index: 200;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-logo { font-size: 20px; font-weight: 800; letter-spacing: 2px; color: #fff; }
.brand-name { font-size: 10px; color: rgba(255,255,255,0.6); margin-top: 1px; }

.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,0.2); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-title { font-size: 11px; color: rgba(255,255,255,0.7); margin-left: 4px; }
.user-dept  { font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar-search { padding: 8px 14px 2px; }
.sidebar-search input {
  width: 100%; padding: 7px 12px; border: none; border-radius: 8px;
  background: rgba(255,255,255,0.12); color: #fff; font-size: 13px;
}
.sidebar-search input::placeholder { color: rgba(255,255,255,0.6); }
.sidebar-search input:focus { outline: none; background: rgba(255,255,255,0.2); }

.nav-list { list-style: none; padding: 6px 0; flex: 1; }
.nav-list li { }
.nav-section-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: rgba(255,255,255,0.4); padding: 8px 16px 2px; font-weight: 600;
}
.nav-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 4px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px; color: rgba(255,255,255,0.8); font-size: 12.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }
.nav-icon { width: 18px; text-align: center; }

.sidebar-footer {
  padding: 10px 16px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; gap: 10px; align-items: center;
}
.sidebar-footer-link { font-size: 12px; color: rgba(255,255,255,0.6); }
.sidebar-footer-link:hover { color: #fff; }
.logout-btn {
  background: none; border: 1px solid rgba(255,255,255,0.3); color: rgba(255,255,255,0.8);
  padding: 4px 10px; border-radius: 4px; cursor: pointer; font-size: 12px;
  transition: all 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.sidebar-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 300;
  background: var(--primary); color: #fff; border: none; padding: 8px 12px;
  border-radius: 6px; cursor: pointer; font-size: 18px;
}

/* ── 콘텐츠 헤더 ── */
.content-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.content-header h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.content-subtitle { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── 카드 ── */
.card {
  background: var(--white); border-radius: 10px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07); margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; }

/* ── 알림 ── */
.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px;
}
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--success); }
.alert-error   { background: #f8d7da; color: #721c24; border-left: 4px solid var(--danger); }

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 16px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: all 0.15s; text-decoration: none !important;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #218838; color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #c82333; color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger-outline:hover { background: #f8d7da; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* ── 폼 ── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; color: var(--text); }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }
input[type=text], input[type=number], input[type=date], input[type=time],
input[type=password], input[type=email], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 14px; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}
textarea { resize: vertical; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; }
.required { color: var(--danger); }

/* ── 뱃지 ── */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-warning  { background: #fff3cd; color: #856404; }
.badge-success  { background: #d4edda; color: #155724; }
.badge-danger   { background: #f8d7da; color: #721c24; }
.badge-primary  { background: #cce5ff; color: #004085; }
.badge-secondary{ background: #e9ecef; color: #495057; }

/* ── 탭 ── */
.tab-bar {
  display: flex; gap: 4px; border-bottom: 2px solid var(--border);
  margin-bottom: 16px; flex-wrap: wrap;
}
.tab-item {
  padding: 9px 18px; color: var(--text-light); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-item:hover { color: var(--primary); text-decoration: none; }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.filter-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; font-size: 13px; }
.filter-chip {
  padding: 3px 10px; border-radius: 20px; border: 1px solid var(--border);
  font-size: 12px; color: var(--text-light); background: var(--white); transition: all 0.15s;
}
.filter-chip:hover, .filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }

/* ── 테이블 ── */
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th { background: #f8fafc; font-weight: 600; padding: 10px 12px; text-align: left; border-bottom: 2px solid var(--border); color: var(--text-light); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.doc-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.doc-table tbody tr:hover { background: #f8fafc; }
.doc-title-cell { max-width: 300px; }
.doc-title-cell a { color: var(--text); font-weight: 500; }
.doc-title-cell a:hover { color: var(--accent); }
.doc-no { display: block; font-size: 11px; color: var(--text-light); margin-top: 2px; }
.date-cell { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.center { text-align: center; }
.type-badge {
  display: inline-block; padding: 2px 7px; background: #eef2ff; color: #3730a3;
  border-radius: 4px; font-size: 11px; font-weight: 500; white-space: nowrap;
}

/* ── 홈 그리드 ── */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.quick-links { margin-bottom: 16px; }
.quick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px; background: var(--bg); border-radius: 8px;
  color: var(--text); font-size: 12px; text-align: center; transition: all 0.15s;
  border: 1px solid var(--border);
}
.quick-item:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(30,58,95,0.2); }
.quick-item span { font-size: 11px; }
.empty-msg { color: var(--text-light); font-size: 13px; text-align: center; padding: 20px; }
.doc-no-display { font-size: 13px; color: var(--success); font-weight: 600; margin-top: 4px; display: block; }

/* ── 입력 테이블 (작성 폼) ── */
.table-scroll { overflow-x: auto; }
.input-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.input-table th { background: #f8fafc; font-weight: 600; padding: 8px 10px; border: 1px solid var(--border); text-align: center; white-space: nowrap; }
.input-table td { padding: 4px; border: 1px solid var(--border); }
.input-table input { border: none; background: transparent; padding: 6px 6px; }
.input-table input:focus { background: #fffbf0; outline: none; }
.input-table tfoot td { background: #f0f4ff; font-weight: 600; }
.total-label { text-align: center; padding: 8px; }
.btn-del { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 0 4px; }
.btn-del:hover { color: #721c24; }

/* ── 잔업자 ── */
.ot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.ot-group-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--primary); }
.ot-input-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ot-input-table th { background: #dde8f5; padding: 7px; border: 1px solid #a8c0df; text-align: center; }
.ot-input-table td { padding: 6px; border: 1px solid var(--border); }
.ot-input-table input { width: 100%; border: none; background: transparent; font-size: 12px; }
.ot-toggle {
  width: 36px; height: 28px; border-radius: 4px; border: 1px solid #ccc;
  font-size: 18px; cursor: pointer; font-weight: 700; transition: all 0.15s;
}
.ot-toggle.active   { background: #d4edda; border-color: var(--success); color: var(--success); }
.ot-toggle.inactive { background: #f8d7da; border-color: var(--danger);  color: var(--danger);  }

/* ── 로그인 ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a5f, #264d7d); }
.login-container { background: var(--white); border-radius: 16px; padding: 40px 36px; width: 380px; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { font-size: 36px; font-weight: 800; color: var(--primary); letter-spacing: 4px; }
.login-header h1 { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 6px; }
.login-header p { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.login-form .form-group { margin-bottom: 16px; }
.login-hint { text-align: center; font-size: 12px; color: var(--text-light); margin-top: 14px; }
.login-hint code { background: var(--bg); padding: 2px 6px; border-radius: 4px; }

/* ── 문서 번호 표시 ── */
.doc-no-display {
  font-size: 12px; color: #28a745; background: #d4edda;
  padding: 2px 8px; border-radius: 4px; display: inline-block;
}

/* 반응형 */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .main-content { margin-left: 0; padding: 60px 16px 16px; max-width: 100vw; }
  .home-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .ot-grid { grid-template-columns: 1fr; }
  .content-header { flex-direction: column; }
  .action-bar { width: 100%; flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── 파일 드래그 앤 드롭 업로드 ── */
.dropzone {
  position: relative;
  border: 2px dashed #c3cfe0;
  border-radius: 10px;
  background: #f8fafc;
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: #1e3a5f; background: #f1f5fb; }
.dropzone.dragover { border-color: #1e3a5f; background: #e8f0fb; }
.dropzone input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.dropzone .dz-icon { font-size: 28px; line-height: 1; }
.dropzone .dz-text { margin-top: 6px; color: #475569; font-size: 14px; }
.dropzone .dz-text b { color: #1e3a5f; }
.dropzone .dz-sub { margin-top: 4px; color: #94a3b8; font-size: 12px; }
.dz-files { list-style: none; margin: 10px 0 0; padding: 0; }
.dz-files li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin-top: 6px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 7px;
  font-size: 13px; color: #334155;
}
.dz-files li .dz-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-files li .dz-size { color: #94a3b8; font-size: 12px; }
.dz-files li .dz-rm {
  border: none; background: #fee2e2; color: #dc2626;
  width: 22px; height: 22px; border-radius: 5px; cursor: pointer; font-size: 13px; line-height: 1;
}
.dz-files li .dz-rm:hover { background: #fecaca; }
