@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Black+Han+Sans&display=swap');

:root {
  --bg: #f2f2f5;
  --surface: #ffffff;
  --ink: #231916;
  --muted: #86868b;
  --border: #e5e5ea;
  --primary: #231916;
  --accent: #da0b17;
  --accent-dim: #fdeaeb;
  --ok: #2d7a4a;
  --ok-dim: #e8f5ed;
  --warn: #c0392b;
  --warn-dim: #fdecea;
  --info: #1a5fa8;
  --info-dim: #e8f0fc;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 16px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --radius: 16px;
  --brand-font: 'Black Han Sans', 'Pretendard', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ─── LAYOUT ─── */
.app { max-width: 430px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }
.screen { display: none; min-height: 100vh; padding-bottom: 80px; }
.screen.active { display: block; animation: fadeUp .2s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ─── HEADER ─── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 -1px 0 var(--border);
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-logo { display: flex; align-items: center; gap: 10px; transition: opacity .1s; }
.header-logo:active { opacity: .6; }
.logo-img { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; background: var(--primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 800; overflow: hidden; }
.logo-img img { width: 100%; height: 100%; object-fit: cover; }
.company-name { font-size: 16px; font-weight: 700; font-family: var(--brand-font); letter-spacing: .2px; }
.user-badge { background: var(--accent-dim); color: var(--accent); font-size: 11px; font-weight: 600; padding: 5px 11px; border-radius: 20px; }
.user-badge.admin { background: var(--primary); color: #fff; }

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: rgba(255,255,255,.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 1px 0 var(--border);
  display: flex; z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px 10px; cursor: pointer; border: none; background: none;
  color: var(--muted); font-size: 10px; font-weight: 600; gap: 3px;
  transition: color .15s, transform .15s;
}
.nav-item:active { transform: scale(.92); }
.nav-item.active { color: var(--accent); }
.nav-icon {
  font-size: 19px; line-height: 1; width: 34px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; transition: background .2s;
}
.nav-item.active .nav-icon { background: var(--accent-dim); }

/* ─── 실시간 알림 배지 (관리자: 새 작업내용 제출 시 근무확인 탭에 표시) ─── */
.nav-icon { position: relative; }
.nav-badge-dot {
  position: absolute; top: -1px; right: -1px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); border: 1.5px solid var(--surface);
}

/* ─── CARDS ─── */
.card { background: var(--surface); border: 1px solid rgba(0,0,0,.04); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; }

/* ─── STAT GRID ─── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid rgba(0,0,0,.04); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-num { font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono'; letter-spacing: -.5px; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 500; }
.stat-card.accent { background: var(--primary); border-color: var(--primary); }
.stat-card.accent .stat-num, .stat-card.accent .stat-label { color: #fff; }
.stat-card.warn .stat-num { color: var(--warn); }

/* ─── LIST ITEMS ─── */
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--surface); border: 1px solid rgba(0,0,0,.04); border-radius: var(--radius);
  margin-bottom: 8px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.list-item:active { transform: scale(.98); box-shadow: none; }
.list-avatar { width: 42px; height: 42px; border-radius: 12px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0; }
.list-content { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 600; letter-spacing: -.1px; }
.list-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.badge-ok { background: var(--ok-dim); color: var(--ok); }
.badge-warn { background: var(--warn-dim); color: var(--warn); }
.badge-info { background: var(--info-dim); color: var(--info); }
.badge-muted { background: var(--bg); color: var(--muted); }

/* ─── BUTTONS ─── */
.btn {
  width: 100%; padding: 15px; border: none; border-radius: 14px;
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .1s ease, opacity .15s ease, background .15s ease;
  letter-spacing: -.2px;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: #362a26; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:active { opacity: .85; }
.btn-outline { background: var(--bg); border: none; color: var(--ink); }
.btn-outline:active { background: var(--border); }
.btn-sm { padding: 9px 15px; font-size: 13px; width: auto; border-radius: 10px; }
.btn-row { display: flex; gap: 8px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.form-input {
  width: 100%; padding: 13px 14px; border: 1.5px solid transparent;
  border-radius: 12px; font-family: inherit; font-size: 15px; background: var(--bg);
  color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-input::placeholder { color: #a3a3a8; }
.form-input:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(35,25,22,.06); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868b' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-textarea { resize: none; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ─── UPLOAD ZONE ─── */
.upload-zone {
  border: 1.5px dashed #c7c7cc; border-radius: 14px;
  padding: 24px; text-align: center; cursor: pointer;
  transition: all .15s; background: var(--bg);
}
.upload-zone:hover { border-color: var(--primary); background: var(--surface); }
.upload-icon { font-size: 30px; margin-bottom: 8px; opacity: .8; }
.upload-text { font-size: 14px; color: var(--muted); }
.upload-text b { color: var(--ink); }
.upload-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preview-thumb { width: 68px; height: 68px; border-radius: 12px; object-fit: cover; border: 1px solid rgba(0,0,0,.06); }

/* ─── CHECKLIST ─── */
.checklist-group { margin-bottom: 16px; }
.checklist-group-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; padding: 0 4px; }
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; background: var(--surface); border-radius: 13px;
  margin-bottom: 6px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s;
  border: 1.5px solid rgba(0,0,0,.04);
}
.check-item:active { transform: scale(.98); }
.check-item.checked { border-color: var(--ok); background: var(--ok-dim); }
.check-box { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; color: transparent; font-size: 13px; }
.check-item.checked .check-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-label { font-size: 14px; font-weight: 500; flex: 1; }
.check-item.checked .check-label { color: var(--ok); }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,16,14,.4);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 200; padding: 0; transition: background .2s;
}
.modal-overlay.open { display: flex; }
.modal {
  background: rgba(255,255,255,.96);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-radius: 22px 22px 0 0;
  width: 100%; max-width: 430px; padding: 24px 20px;
  max-height: 85vh; overflow-y: auto;
  animation: slideUp .3s cubic-bezier(.32,.72,0,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.modal-handle { width: 36px; height: 5px; background: var(--border); border-radius: 3px; margin: 0 auto 20px; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; letter-spacing: -.2px; }

/* ─── SECTION ─── */
.section { padding: 20px 16px 0; }
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.3px; }
.section-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ─── SEGMENT CONTROL (iOS 스타일 탭 전환) ─── */
.segment { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; margin-bottom: 16px; gap: 2px; }
.segment button {
  flex: 1; border: none; background: none; padding: 9px 8px; border-radius: 9px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.segment button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ─── STATUS DOTS ─── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--accent); }
.dot-muted { background: var(--muted); }

/* ─── DIVIDER ─── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ─── TAG ─── */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }

/* ─── MAP BUTTONS ─── */
.map-btns { display: flex; gap: 8px; margin-top: 12px; }
.map-btn { flex: 1; padding: 10px; border: none; border-radius: 12px; background: var(--bg); font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all .15s; color: var(--ink); }
.map-btn:active { transform: scale(.96); background: var(--border); }
.map-btn .map-icon { font-size: 19px; }

/* ─── LOGIN ─── */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px;
  background: radial-gradient(120% 90% at 50% 0%, #34281f 0%, var(--primary) 55%);
}
.login-logo { text-align: center; margin-bottom: 48px; }
/* 커스텀 업로드 로고(원형 배지)는 자르지 않고 비율 그대로 담기게 padding + contain 사용 */
.login-logo .logo-circle { width: 72px; height: 72px; border-radius: 22px; background: var(--accent); margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 800; color: #fff; overflow: hidden; padding: 8px; box-sizing: border-box; }
.login-logo .logo-circle img { width: 100%; height: 100%; object-fit: contain; }
/* AIM COMPANY 워드마크 로고: 고정 height로 인해 잘려 보이던 문제를 max-width/height + auto 로 수정.
   overflow: visible 인 컨테이너 안에서 object-fit: contain 으로 비율을 유지한 채 전체가 보이게 한다. */
.login-logo .login-wordmark {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: 80%;
  max-height: 64px;
  object-fit: contain;
  margin: 0 auto 8px;
}
.login-logo h1 { font-size: 24px; font-weight: 700; color: #fff; letter-spacing: -.2px; }
.login-logo p { font-size: 13px; color: rgba(255,255,255,.55); margin-top: 6px; }
.login-card { background: rgba(255,255,255,.98); border-radius: 24px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card h2 { font-size: 21px; font-weight: 700; margin-bottom: 4px; letter-spacing: -.3px; }
.login-card p { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

/* ─── NOTICE ─── */
.notice-item { background: var(--surface); border: 1px solid rgba(0,0,0,.04); border-radius: var(--radius); padding: 16px; margin-bottom: 8px; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .12s ease; }
.notice-item:active { transform: scale(.99); }
.notice-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.notice-title { font-size: 15px; font-weight: 700; letter-spacing: -.1px; }
.notice-date { font-size: 11px; color: var(--muted); }
.notice-preview { font-size: 13px; color: var(--muted); line-height: 1.5; }
.notice-attachments { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.attach-badge { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--info-dim); color: var(--info); font-weight: 600; }

/* ─── ADMIN TABLE ─── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { background: var(--bg); padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.admin-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.admin-table tr:last-child td { border-bottom: none; }

/* ─── SETTINGS ─── */
.setting-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.setting-item:last-child { border-bottom: none; }
.setting-label { font-size: 15px; font-weight: 500; letter-spacing: -.1px; }
.setting-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.setting-arrow { color: #c7c7cc; font-size: 18px; }

/* ─── TOAST ─── */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-10px);
  background: rgba(35,25,22,.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  color: #fff; padding: 12px 20px; border-radius: 14px; font-size: 14px; font-weight: 500;
  z-index: 300; display: none; white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.show { display: block; animation: toastIn .25s cubic-bezier(.32,.72,0,1); }
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(-16px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* ─── TIME FORMAT ─── */
.time-display { font-family: 'JetBrains Mono'; font-size: 13px; color: var(--muted); }

/* ─── EMPTY STATE ─── */
.empty { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 44px; margin-bottom: 12px; opacity: .5; }
.empty-text { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.empty-sub { font-size: 13px; color: var(--muted); }

/* ─── HEADER BACK ─── */
.header-back { display: flex; align-items: center; gap: 8px; }
.back-btn { width: 34px; height: 34px; border-radius: 10px; border: none; background: var(--bg); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: transform .1s; }
.back-btn:active { transform: scale(.92); }

/* ─── FAB ─── */
.fab {
  position: fixed; bottom: 90px; right: 50%; transform: translateX(calc(215px - 100%));
  width: 54px; height: 54px; border-radius: 18px; background: var(--accent); border: none;
  box-shadow: 0 8px 20px rgba(218,11,23,.35); cursor: pointer; font-size: 22px; color: #fff;
  display: flex; align-items: center; justify-content: center; z-index: 90;
  transition: transform .12s ease;
}
.fab:active { transform: translateX(calc(215px - 100%)) scale(.92); }

@media (max-width: 430px) {
  .app { max-width: 100%; }
  .fab { right: 20px; transform: none; }
  .fab:active { transform: scale(.92); }
  .bottom-nav { max-width: 100%; }
  /* 좁은 화면에서도 로고 전체가 항상 보이도록 살짝 더 여유 있게 축소 */
  .login-logo .login-wordmark { max-width: 72%; max-height: 52px; }
}
