@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #3182f6;
  --primary-hover: #1b64da;
  --primary-light: #ebf3fe;
  --bg: #f2f4f6;
  --bg-card: #ffffff;
  --border: #e5e8eb;
  --border-light: #f8f9fa;
  --text-1: #191f28;
  --text-2: #333d4b;
  --text-3: #4e5968;
  --text-4: #8b95a1;
  --text-5: #b0b8c1;
  --success: #00c73c;
  --danger: #f04452;
  --warning: #ff9e0d;
  --tab-h: 72px;
  --header-h: 56px;
  --safe-top: env(safe-area-inset-top, 44px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%; width: 100%;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Pages ── */
.page {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  background: var(--bg);
  transition: opacity 0.2s;
}
.page.active { display: flex; }

/* ── Login ── */
#pg-login {
  background: #fff;
  justify-content: flex-start;
  align-items: center;
  padding: calc(var(--safe-top) + 60px) 32px 40px;
  gap: 0;
  overflow-y: auto;
}
.login-logo { font-size: 30px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.login-sub { font-size: 14px; color: var(--text-4); margin-top: 4px; margin-bottom: 52px; }
.input-wrap { width: 100%; margin-bottom: 12px; }
.input-wrap input {
  width: 100%; padding: 17px 18px;
  border: 1.5px solid var(--border);
  border-radius: 14px; font-size: 16px;
  color: var(--text-1); outline: none;
  background: #f8f9fa;
  transition: border-color 0.2s, background 0.2s;
  font-family: inherit;
}
.input-wrap input:focus { border-color: var(--primary); background: #fff; }
.input-wrap input::placeholder { color: var(--text-5); }

.btn { border: none; cursor: pointer; font-family: inherit; transition: all 0.15s; }
.btn-primary {
  width: 100%; padding: 18px;
  background: var(--primary); color: #fff;
  border-radius: 14px; font-size: 17px; font-weight: 700;
  margin-top: 8px;
}
.btn-primary:active { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--text-5); cursor: not-allowed; }

.auto-login-row {
  margin-top: 18px; display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text-3);
}
.toggle {
  width: 44px; height: 26px; background: var(--border);
  border-radius: 13px; position: relative;
  cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; background: #fff;
  border-radius: 50%; transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle.on::after { transform: translateX(18px); }

/* ── Header ── */
.app-header {
  background: #fff; flex-shrink: 0;
  padding: calc(var(--safe-top) + 14px) 20px 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 10;
}
.header-title { font-size: 18px; font-weight: 700; color: var(--text-1); }
.header-greeting { font-size: 14px; color: var(--text-4); }
.header-name { font-size: 19px; font-weight: 700; color: var(--text-1); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6bb5ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; color: #fff; cursor: pointer;
}
.back-btn {
  width: 36px; height: 36px; display: flex;
  align-items: center; justify-content: center;
  cursor: pointer; margin-left: -6px;
}

/* ── Scroll area ── */
.scroll-area {
  flex: 1; overflow-y: auto;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px);
  -webkit-overflow-scrolling: touch;
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ── Card ── */
.card {
  background: var(--bg-card); border-radius: 20px;
  padding: 20px; margin: 12px 16px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card-label { font-size: 12px; color: var(--text-4); font-weight: 500; margin-bottom: 6px; }

/* ── Today card ── */
.today-card {
  background: var(--primary); border-radius: 20px;
  margin: 12px 16px 0; padding: 22px; color: #fff;
}
.today-date { font-size: 13px; opacity: 0.8; margin-bottom: 2px; }
.today-dow { font-size: 26px; font-weight: 800; margin-bottom: 18px; letter-spacing: -0.5px; }
.today-stats { display: flex; }
.today-stat { flex: 1; }
.today-stat + .today-stat { border-left: 1px solid rgba(255,255,255,0.2); padding-left: 16px; }
.today-stat-label { font-size: 11px; opacity: 0.75; margin-bottom: 2px; }
.today-stat-value { font-size: 19px; font-weight: 700; }

/* ── Attend card ── */
.attend-card {
  background: #fff; border-radius: 20px;
  margin: 12px 16px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.04); overflow: hidden;
}
.attend-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border-light); }
.attend-header-row { display: flex; align-items: center; justify-content: space-between; }
.attend-title { font-size: 16px; font-weight: 700; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.badge-off { background: var(--bg); color: var(--text-4); }
.badge-on  { background: #e8f5e9; color: var(--success); }
.attend-body { padding: 16px 20px; }
.attend-times { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.attend-time-item { flex: 1; }
.attend-time-label { font-size: 11px; color: var(--text-4); margin-bottom: 3px; }
.attend-time-val { font-size: 22px; font-weight: 700; color: var(--text-1); }
.attend-time-val.empty { font-size: 16px; color: var(--text-5); font-weight: 500; }
.attend-divider { width: 1px; height: 38px; background: var(--border-light); }
.btn-attend {
  width: 100%; padding: 16px; border-radius: 14px;
  font-size: 16px; font-weight: 700; border: none;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn-attend-in { background: var(--primary); color: #fff; }
.btn-attend-in:active { background: var(--primary-hover); }
.btn-attend-out { background: #fff3f4; color: var(--danger); border: 1.5px solid #fde8ea; }
.btn-attend-done { background: var(--bg); color: var(--text-5); cursor: default; }

/* ── Quick menu ── */
.quick-grid { display: flex; gap: 10px; }
.quick-item {
  flex: 1; background: var(--bg); border-radius: 16px;
  padding: 18px 8px; text-align: center; cursor: pointer;
  transition: background 0.15s;
}
.quick-item:active { background: var(--border); }
.quick-icon { font-size: 26px; margin-bottom: 7px; }
.quick-label { font-size: 13px; font-weight: 700; color: var(--text-1); }

/* ── Franchise list ── */
.fran-item {
  background: #fff; border-radius: 16px; padding: 16px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: all 0.15s; box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.fran-item:active { transform: scale(0.98); background: var(--border-light); }
.fran-icon {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--primary-light); display: flex;
  align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.fran-info { flex: 1; min-width: 0; }
.fran-name { font-size: 15px; font-weight: 700; color: var(--text-1); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fran-addr { font-size: 12px; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fran-status { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 7px; flex-shrink: 0; }
.s-active   { background: #e8f5e9; color: var(--success); }
.s-warn     { background: #fff8e1; color: var(--warning); }
.s-inactive { background: var(--bg); color: var(--text-5); }

/* ── Search ── */
.search-bar-wrap { padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.search-bar { display: flex; align-items: center; background: var(--bg); border-radius: 14px; padding: 0 14px; gap: 10px; height: 46px; }
.search-bar input { flex: 1; border: none; background: transparent; font-size: 15px; color: var(--text-1); outline: none; font-family: inherit; }
.search-bar input::placeholder { color: var(--text-5); }
.filter-chips { display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; flex-shrink: 0; background: #fff; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip { padding: 7px 15px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: all 0.15s; border: 1.5px solid var(--border); background: #fff; color: var(--text-3); }
.chip.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── Detail ── */
.detail-hero { background: #fff; padding: 20px; margin-bottom: 8px; }
.detail-icon-wrap { width: 60px; height: 60px; border-radius: 18px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 14px; }
.detail-name { font-size: 24px; font-weight: 800; color: var(--text-1); margin-bottom: 4px; }
.detail-type { font-size: 14px; color: var(--text-4); margin-bottom: 16px; }
.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-tag { padding: 5px 13px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.info-section { background: #fff; margin: 0 0 8px; padding: 20px; }
.info-section-title { font-size: 12px; font-weight: 700; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.info-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.info-label { font-size: 12px; color: var(--text-4); margin-bottom: 2px; }
.info-value { font-size: 15px; font-weight: 600; color: var(--text-1); }
.info-link { color: var(--primary); }

/* ── My page ── */
.profile-card { background: linear-gradient(135deg, var(--primary), #1b64da); border-radius: 20px; margin: 12px 16px 0; padding: 24px; color: #fff; }
.profile-avatar { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.profile-name { font-size: 23px; font-weight: 800; margin-bottom: 2px; }
.profile-depart { font-size: 13px; opacity: 0.8; }
.menu-list { background: #fff; border-radius: 20px; margin: 12px 16px 0; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.menu-item { display: flex; align-items: center; padding: 17px 20px; gap: 14px; cursor: pointer; border-bottom: 1px solid var(--border-light); transition: background 0.1s; }
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--border-light); }
.menu-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.menu-text { flex: 1; font-size: 15px; font-weight: 600; color: var(--text-1); }
.menu-arrow { color: var(--text-5); font-size: 18px; }

/* ── Bottom Tab ── */
.bottom-tab {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-light);
  display: none; align-items: center; z-index: 100;
}
.bottom-tab.visible { display: flex; }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; padding: 10px 0; }
.tab-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.tab-label { font-size: 10px; font-weight: 600; color: var(--text-5); }
.tab-item.active .tab-label { color: var(--primary); }

/* ── Bottom Sheet ── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: none; align-items: flex-end; z-index: 200;
}
.overlay.open { display: flex; }
.sheet {
  width: 100%; background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 8px 24px calc(24px + var(--safe-bottom));
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 12px auto 22px; }
.sheet-title { font-size: 22px; font-weight: 800; color: var(--text-1); margin-bottom: 6px; }
.sheet-sub { font-size: 14px; color: var(--text-4); margin-bottom: 24px; line-height: 1.5; }
.gps-box { background: var(--bg); border-radius: 16px; padding: 16px; display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.gps-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); flex-shrink: 0; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(0,199,60,0.2); } 50% { box-shadow: 0 0 0 7px rgba(0,199,60,0.08); } }
.gps-addr { font-size: 14px; font-weight: 600; color: var(--text-1); }
.gps-meta { font-size: 12px; color: var(--text-4); margin-top: 2px; }
.sheet-btn { width: 100%; padding: 17px; border-radius: 14px; font-size: 17px; font-weight: 700; border: none; cursor: pointer; font-family: inherit; margin-bottom: 10px; }
.sheet-btn-primary { background: var(--primary); color: #fff; }
.sheet-btn-primary:active { background: var(--primary-hover); }
.sheet-btn-danger { background: #fff3f4; color: var(--danger); border: 1.5px solid #fde8ea; }
.sheet-btn-cancel { background: var(--bg); color: var(--text-3); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px);
  left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--text-1); color: #fff;
  padding: 13px 22px; border-radius: 12px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  opacity: 0; transition: all 0.28s; z-index: 400; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Loading / Skeleton ── */
.skeleton { background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.loading-wrap { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.skel-row { height: 76px; border-radius: 16px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-5); }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-text { font-size: 15px; font-weight: 600; }

/* ── Error message ── */
.error-msg { font-size: 13px; color: var(--danger); margin-top: 8px; text-align: center; min-height: 18px; }
