/* ============== 기본 ============== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Apple SD Gothic Neo',
    'Malgun Gothic', sans-serif;
  background: #f3f4f6;
  color: #111827;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  background: #fff;
  width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: #3b82f6; }
code { background:#f3f4f6; padding:2px 6px; border-radius:4px; font-size:12px; }

/* ============== 로그인 ============== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #06b6d4 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  padding: 40px 36px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 420px;
}
.login-title {
  font-size: 24px;
  margin: 0 0 4px;
  text-align: center;
  color: #1e293b;
}
.login-title i { color: #3b82f6; margin-right: 6px; }
.login-sub {
  text-align: center;
  color: #6b7280;
  margin: 0 0 28px;
  font-size: 13px;
}
.login-form label {
  display: block;
  font-size: 12px;
  color: #475569;
  margin: 12px 0 6px;
  font-weight: 600;
}
.btn-primary {
  width: 100%;
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  transition: background .2s;
}
.btn-primary:hover { background: #2563eb; }
.login-hint {
  margin-top: 18px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.7;
}
.error-box {
  background: #fef2f2;
  color: #b91c1c;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 12px;
  border-left: 3px solid #ef4444;
}

/* ============== 상단바 ============== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-title i { color: #3b82f6; }
.topbar-link:hover { color: #3b82f6; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-badge {
  background: #f3f4f6;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.user-badge i.fa-crown { color: #f59e0b; }
.btn-ghost {
  background: transparent;
  border: 1px solid #e5e7eb;
  padding: 7px 11px;
  border-radius: 6px;
  color: #4b5563;
  position: relative;
  transition: all .15s;
}
.btn-ghost:hover { background: #f3f4f6; color: #111827; }
.notif-bell { position: relative; }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* 탭 */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-top: 1px solid #f1f5f9;
  overflow-x: auto;
}
.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 13px;
  color: #64748b;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab-btn:hover { color: #3b82f6; }
.tab-btn.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  font-weight: 600;
}
.tab-btn i { margin-right: 5px; }

/* ============== 홈(조직 선택) ============== */
.home-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px;
}
.home-h2 {
  font-size: 28px;
  color: #1e293b;
  margin: 0 0 6px;
  text-align: center;
}
.home-desc {
  text-align: center;
  color: #64748b;
  margin: 0 0 50px;
}
.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.org-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .25s;
  border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.org-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.1);
}
.org-card .icon {
  font-size: 48px;
  margin-bottom: 16px;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.org-card .name {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}
.org-card .desc {
  font-size: 13px;
  color: #64748b;
  min-height: 36px;
}
.org-card .enter-btn {
  margin-top: 16px;
  background: #f1f5f9;
  color: #475569;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.org-card:hover .enter-btn { background: #3b82f6; color: #fff; }

/* ============== 대시보드 ============== */
.dash-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.loading {
  text-align: center;
  padding: 40px;
  color: #6b7280;
}

/* 섹션 카드 */
.section-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}
.btn-action {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}
.btn-action:hover { background: #2563eb; }
.btn-action.danger { background: #ef4444; }
.btn-action.danger:hover { background: #dc2626; }
.btn-action.success { background: #10b981; }
.btn-action.success:hover { background: #059669; }
.btn-action.warning { background: #f59e0b; }
.btn-action.secondary { background: #6b7280; }
.btn-tiny {
  background: transparent;
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: #6b7280;
}
.btn-tiny:hover { background: #f3f4f6; }

/* ============== 업무 카드 ============== */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.task-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  border-left: 4px solid #94a3b8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: all .15s;
}
.task-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-2px); }
.task-card.priority-urgent { border-left-color: #ef4444; }
.task-card.priority-high { border-left-color: #f59e0b; }
.task-card.priority-normal { border-left-color: #3b82f6; }
.task-card.priority-low { border-left-color: #94a3b8; }
.task-card.status-review { background: #fffbeb; border-left-color: #f59e0b; }
.task-card.status-approved { opacity: .7; }

.task-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.task-title {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
  flex: 1;
}
.task-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-pending { background: #f1f5f9; color: #64748b; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-review { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 10px;
}
.task-meta i { margin-right: 3px; }
.deadline-overdue { color: #ef4444; font-weight: 700; }
.deadline-soon { color: #f59e0b; font-weight: 700; }

.progress-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  transition: width .3s;
}
.progress-text {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  text-align: right;
}

/* 직원 현황 */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.member-card {
  background: #fff;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  display: flex;
  gap: 12px;
  align-items: center;
}
.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  position: relative;
}
.member-avatar.admin { background: #f59e0b; }
.status-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
}
.dot-working { background: #10b981; }
.dot-meeting { background: #f59e0b; }
.dot-break { background: #06b6d4; }
.dot-offline { background: #94a3b8; }
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 700; font-size: 13px; color: #1e293b; }
.member-position { font-size: 11px; color: #64748b; }
.member-status-msg {
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 4px;
  word-break: break-all;
}

.status-form {
  background: #fef9c3;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid #fde68a;
}
.status-form select { width: auto; min-width: 100px; }
.status-form input { flex: 1; }

/* 공지사항 */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item {
  background: #fff;
  padding: 16px;
  border-radius: 10px;
  border-left: 4px solid #3b82f6;
  cursor: pointer;
  transition: all .15s;
}
.notice-item:hover { background: #f8fafc; }
.notice-item.important { border-left-color: #ef4444; background: #fef2f2; }
.notice-item.unread { box-shadow: 0 0 0 2px #fde68a; }
.notice-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.notice-title {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
}
.notice-title .badge-imp {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}
.notice-meta {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  gap: 12px;
  margin-top: 6px;
}
.notice-content-preview {
  font-size: 12px;
  color: #475569;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.read-status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
}
.read-status-badge.read { background: #d1fae5; color: #065f46; }
.read-status-badge.unread { background: #fef3c7; color: #92400e; }

/* 인사/재무 시트 (테이블) */
.sheet-wrap { overflow-x: auto; }
.sheet-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.sheet-table th, .sheet-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}
.sheet-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}
.sheet-table tr:hover { background: #f8fafc; }
.amount-income { color: #10b981; font-weight: 700; }
.amount-expense { color: #ef4444; font-weight: 700; }
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary-card {
  background: #fff;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}
.summary-card.income { border-left: 4px solid #10b981; }
.summary-card.expense { border-left: 4px solid #ef4444; }
.summary-card.balance { border-left: 4px solid #3b82f6; }
.summary-label { font-size: 12px; color: #64748b; }
.summary-value { font-size: 22px; font-weight: 700; color: #1e293b; margin-top: 4px; }

/* 알림 패널 */
.notif-panel {
  position: fixed;
  top: 60px;
  right: 24px;
  width: 380px;
  max-height: 500px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notif-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notif-list {
  overflow-y: auto;
  max-height: 440px;
}
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f8fafc;
  cursor: pointer;
  transition: background .15s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-title { font-weight: 600; font-size: 13px; color: #1e293b; }
.notif-msg { font-size: 12px; color: #64748b; margin-top: 4px; }
.notif-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.notif-empty {
  padding: 40px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}

/* 모달 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title { font-size: 16px; font-weight: 700; color: #1e293b; margin: 0; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 18px;
  color: #6b7280;
  cursor: pointer;
}
.modal-body { padding: 20px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin: 12px 0 4px;
}
.modal textarea { min-height: 80px; resize: vertical; }

/* 업무 상세 */
.task-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.task-detail-meta div { font-size: 12px; }
.task-detail-meta strong { color: #1e293b; display: block; margin-bottom: 2px; font-size: 11px; color: #64748b; text-transform: uppercase; }

.task-updates {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.update-item {
  background: #f8fafc;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  border-left: 3px solid #94a3b8;
}
.update-item.type-progress { border-left-color: #3b82f6; }
.update-item.type-submit { border-left-color: #f59e0b; }
.update-item.type-approve { border-left-color: #10b981; }
.update-item.type-reject { border-left-color: #ef4444; }
.update-item.type-comment { border-left-color: #6366f1; }
.update-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.update-author { font-weight: 700; color: #1e293b; }
.update-time { font-size: 10px; color: #94a3b8; }
.update-content { color: #475569; white-space: pre-wrap; word-break: break-word; }

/* 읽음 현황 */
.read-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 12px;
}
.read-table th, .read-table td {
  padding: 8px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}
.read-table th { background: #f8fafc; font-size: 11px; color: #64748b; }

/* 모바일 */
@media (max-width: 640px) {
  .topbar-inner { padding: 10px 16px; }
  .tabs { padding: 0 16px; }
  .tab-btn { padding: 10px 12px; font-size: 12px; }
  .dash-main { padding: 16px; }
  .home-main { padding: 30px 16px; }
  .notif-panel { width: calc(100vw - 32px); right: 16px; }
  .user-badge { display: none; }
  .org-grid { grid-template-columns: 1fr; }
  .task-grid { grid-template-columns: 1fr; }
  .home-h2 { font-size: 22px; }
}
