/* =========================================================
   main.css
   - 자재과 내부 도구 허브 공통 스타일
   - index: 업무 바로가기 + 상시/월별 업무
   ========================================================= */

/* ====== 기본 토큰 ====== */
:root {
  --app-text-900: #111827;
  --app-text-700: #374151;
  --app-text-600: #4b5563;
  --app-line-200: #e5e7eb;
  --app-bg-soft: #f5f6f8;
  --app-bg-card: #ffffff;
  --app-primary: #3b82f6;
}

/* ====== Reset ====== */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body.app-body {
  font-family: 'Noto Sans KR', 'Malgun Gothic', system-ui, -apple-system,
    sans-serif;
  background: var(--app-bg-soft);
  color: var(--app-text-900);
}

/* ====== 헤더 ====== */
.app-header {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--app-line-200);
  z-index: 10;
}
.app-header__inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.app-logo {
  font-weight: 800;
  color: var(--app-text-900);
}
.app-nav {
  display: flex;
  gap: 10px;
}
.app-nav__link {
  text-decoration: none;
  color: var(--app-text-700);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.app-nav__link:hover {
  background: #f3f4f6;
  color: var(--app-text-900);
}
.app-nav__link.is-active {
  background: var(--app-primary);
  color: #fff;
}

/* ====== 메인 구조 ====== */
.app-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px;
}
.app-section {
  background: #fff;
  border: 1px solid var(--app-line-200);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
.app-section__title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 14px 0;
  color: var(--app-text-900);
}

/* ====== 공통 링크 ====== */
.app-link-ghost {
  font-size: 14px;
  color: var(--app-primary);
  text-decoration: none;
}
.app-link-ghost:hover {
  text-decoration: underline;
}

/* ====== 히어로 (다른 페이지에서 사용할 수 있게 유지) ====== */
.app-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: center;
}
.app-hero__imgwrap {
  width: 100%;
  aspect-ratio: 16/9;
  border: 1px solid var(--app-line-200);
  border-radius: 14px;
  overflow: hidden;
}
.app-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================================================
   업무 바로가기 카드 (index 상단)
   ========================================================= */

.card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* 각 카드: 이미지 왼쪽 + 텍스트 오른쪽 */
.card {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 calc(50% - 16px);
  background-color: var(--app-bg-card);
  border: 1px solid var(--app-line-200);
  border-radius: 12px;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

/* 카드 이미지: 작게 정렬 */
.card__media img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

/* 카드 텍스트 */
.card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card__title {
  font-weight: 600;
  font-size: 16px;
  color: var(--app-text-900);
}
.card__subtitle {
  font-size: 14px;
  color: #6b7280;
}

/* 반응형: 카드 */
@media (max-width: 900px) {
  .card {
    flex: 1 1 100%;
  }
}
@media (max-width: 600px) {
  .app-main {
    padding: 12px;
  }
  .app-section {
    padding: 12px 14px;
  }
  .card {
    padding: 10px;
  }
  .card__media img {
    width: 60px;
    height: 60px;
  }
}

/* =========================================================
   자재과 업무 블록 (상시 + 월별)
   ========================================================= */

.task-block {
  margin-bottom: 28px;
}
.task-block:last-child {
  margin-bottom: 0;
}

.task-block__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.task-block__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--app-text-900);
}

/* 상단 태그 배지 */
.mt-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #64748b;
  border: 1px solid var(--app-line-200);
  background: linear-gradient(180deg, #fafafa, #f3f4f6);
  font-weight: 600;
  letter-spacing: 0.1px;
}

/* 공통 그리드 베이스 */
.mt-standing-grid {
  display: grid;
  gap: 14px;
}

/* 상시 업무용: 3컬럼 */
.task-block:first-of-type .mt-standing-grid {
  grid-template-columns: repeat(3, 1fr);
}

/* 월별 업무용: 1컬럼 (카테고리별 가로형 카드) */
#mtMonthSummary {
  grid-template-columns: 1fr;
}

/* 공통 카드 베이스 */
.mt-card {
  background: var(--app-bg-card);
  border: 1px solid var(--app-line-200);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.06);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.mt-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.09);
}

/* 상시 업무 카드 타이틀/리스트 */
.task-block:first-of-type .mt-card h4 {
  margin: 0 0 10px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--app-text-900);
}
.task-block:first-of-type .mt-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.task-block:first-of-type .mt-card ul > li {
  position: relative;
  padding-left: 14px;
  line-height: 1.4;
  word-break: keep-all;
  font-size: 13.5px;
}
.task-block:first-of-type .mt-card ul > li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #cbd5e1;
}
.task-block:first-of-type .mt-card .empty {
  font-size: 13.5px;
  color: #94a3b8;
  border: 1px dashed var(--app-line-200);
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
}

/* 반응형: 상시 업무 그리드 세로로 */
@media (max-width: 1180px) {
  .task-block:first-of-type .mt-standing-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================
   월 선택 컨트롤 (월별 업무 상단)
   ============================ */

.mt-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 4px 0 0 0;
}

.mt-label {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mt-select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 150px;
}
.mt-select:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}
.mt-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* ============================
   월별 업무(테이블 느낌)
   ============================ */

/* 월별 카드: 좌측 헤더 + 우측 리스트 가로 2열 */
#mtMonthSummary.mt-standing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* ← 두 줄(2열)로 정렬 */
  gap: 14px;
}

#mtMonthSummary .mt-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  box-shadow: none; /* 상시보다 가볍게 */
  border-radius: 10px;
}

/* 왼쪽: 카테고리 · 월 제목 열 */
#mtMonthSummary .mt-card h3 {
  margin: 0;
  flex: 0 0 160px;
  font-size: 14px;
  font-weight: 700;
  color: var(--app-text-900);
  padding-right: 12px;
  border-right: 1px solid var(--app-line-200);
  line-height: 1.5;
}

/* 오른쪽: 업무 리스트 열 */
#mtMonthSummary .mt-card ul {
  flex: 1;
  margin: 0;
  padding: 0 0 0 16px;
  list-style: none;
  display: grid;
  gap: 4px;
}
#mtMonthSummary .mt-card ul > li {
  position: relative;
  padding-left: 10px;
  line-height: 1.5;
  font-size: 13.5px;
  word-break: keep-all;
}
#mtMonthSummary .mt-card ul > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #cbd5e1;
}

/* 월별: "등록된 업무 없음" 표시 */
#mtMonthSummary .mt-card ul > li.empty,
#mtMonthSummary .mt-card .empty {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px dashed var(--app-line-200);
  background: #f9fafb;
  color: #94a3b8;
  font-size: 13px;
}

/* 반응형: 월별 카드도 세로로 쌓기 */
@media (max-width: 900px) {
  #mtMonthSummary .mt-card {
    flex-direction: column;
  }
  #mtMonthSummary .mt-card h3 {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--app-line-200);
    padding-bottom: 8px;
    margin-bottom: 6px;
  }
  #mtMonthSummary .mt-card ul {
    padding-left: 0;
  }
}

/* =========================================================
   푸터
   ========================================================= */
.app-footer {
  padding: 20px 16px;
  color: #6b7280;
}
.app-footer__inner {
  max-width: 1600px;
  margin: 0 auto;
  border-top: 1px solid var(--app-line-200);
  padding-top: 12px;
  font-size: 13px;
}

.app-section-work {
  display: gird;
  grid-template-columns: repeat(2, 1fr); /* ← 여기! 2열로 설정 */
  gap: 14px;
  background: #fff;
  border: 1px solid var(--app-line-200);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
}
