:root {
  --bg: #f3f5f9; --card: #ffffff; --ink: #0f1a2c; --sub: #5b6678; --faint: #8d97a8; --line: #e6eaf1;
  --brand: #0b1f3a; --brand-2: #1d4ed8; --accent: #2f6bff; --accent-soft: #e8efff;
  --good: #0f9f6e; --good-soft: #e3f7ef; --warn: #b7791f; --warn-soft: #fff4dc; --bad: #d64545; --bad-soft: #fdeaea;
  --shadow: 0 1px 2px rgba(15, 26, 44, .04), 0 8px 24px rgba(15, 26, 44, .06);
  --radius: 18px;
  --nav-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b111b; --card: #141c29; --ink: #e8edf5; --sub: #a3aec0; --faint: #707c90; --line: #222c3b;
    --accent: #5b8cff; --accent-soft: #1b2a4a;
    --good: #34c792; --good-soft: #10291f; --warn: #e2b04a; --warn-soft: #2e2410; --bad: #ff7676; --bad-soft: #351616;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
body.no-nav { padding-bottom: 24px; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
svg.i { width: 22px; height: 22px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* 상단 바 */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: 30px; border-radius: 9px; }
.brand-text { line-height: 1.15; }
.brand-text b { display: block; font-size: 15px; letter-spacing: .02em; }
.brand-text span { font-size: 11.5px; color: var(--faint); letter-spacing: .12em; }
.who { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; white-space: nowrap; letter-spacing: -.04em;
}
.icon-btn { border: 0; background: none; color: var(--sub); padding: 6px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--line); }

.view { max-width: 640px; margin: 0 auto; padding: 4px 16px 16px; }

/* 하단 탭 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs-inner { display: flex; width: 100%; max-width: 640px; }
.tabs button {
  flex: 1; height: var(--nav-h); border: 0; background: none; color: var(--faint); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 600; position: relative;
}
.tabs button.on { color: var(--accent); }
.tabs .badge-n {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

/* 카드 */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 16px; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h2 small { font-size: 13px; color: var(--faint); font-weight: 500; }
.section-title { font-size: 13px; color: var(--sub); font-weight: 600; margin: 22px 4px 10px; }
.muted { color: var(--sub); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--faint); padding: 18px 0 6px; font-size: 14px; }

/* 출퇴근 히어로 */
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 22px 20px 20px; margin-bottom: 14px;
  background: radial-gradient(120% 90% at 100% 0%, #3b6dff 0%, rgba(59, 109, 255, 0) 60%), linear-gradient(160deg, #0b1f3a 0%, #13305c 55%, #1d4ed8 100%);
  box-shadow: 0 14px 34px rgba(29, 78, 216, .28);
}
.hero::after {
  content: ""; position: absolute; right: -60px; bottom: -80px; width: 220px; height: 220px; border-radius: 50%;
  border: 28px solid rgba(255, 255, 255, .06);
}
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero .greet { font-size: 14px; opacity: .85; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hero .chip.in { background: rgba(52, 211, 153, .18); color: #6ef0bd; }
.hero .chip.out { background: rgba(251, 191, 36, .18); color: #ffd36b; }
.clock { font-size: 52px; font-weight: 800; letter-spacing: -.02em; margin-top: 18px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.clock .sec { font-size: 24px; opacity: .55; font-weight: 700; margin-left: 4px; }
.hero .date { opacity: .8; font-size: 14px; margin-top: 4px; }
.progress { margin-top: 20px; position: relative; z-index: 1; }
.progress-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #7dd3fc, #ffffff); transition: width .6s ease; }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; opacity: .85; margin-top: 8px; }

.punch-wrap { display: flex; flex-direction: column; align-items: center; padding: 6px 0 2px; }
.punch-btn {
  width: 168px; height: 168px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 21px; font-weight: 800;
  background: linear-gradient(150deg, #3d7bff, #1d4ed8); box-shadow: 0 12px 30px rgba(47, 107, 255, .38), inset 0 -4px 0 rgba(0, 0, 0, .12);
  transition: transform .12s ease, box-shadow .12s ease;
}
.punch-btn small { font-size: 12.5px; font-weight: 600; opacity: .85; }
.punch-btn svg.i { width: 30px; height: 30px; }
.punch-btn:active { transform: scale(.96); }
.punch-btn.out { background: linear-gradient(150deg, #24324a, #0b1f3a); box-shadow: 0 12px 30px rgba(11, 31, 58, .35), inset 0 -4px 0 rgba(0, 0, 0, .2); }
.punch-btn.ext { background: linear-gradient(150deg, #f0a92b, #c77d0a); box-shadow: 0 12px 30px rgba(199, 125, 10, .32), inset 0 -4px 0 rgba(0, 0, 0, .12); }
.punch-btn:disabled { opacity: .6; cursor: default; }
.punch-hint { font-size: 13px; color: var(--sub); margin-top: 14px; text-align: center; }

.reasons { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.pill {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 8px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.pill.on { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--bg); border-radius: 14px; padding: 12px; }
.stat .k { font-size: 12px; color: var(--faint); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v.dim { color: var(--faint); font-weight: 600; }

/* 폼 */
label.f { display: block; font-size: 13px; color: var(--sub); font-weight: 600; margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink);
  font: inherit; outline: none; transition: border-color .15s, background .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--card); }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 12px 0 4px; cursor: pointer; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1 1 0; min-width: 0; }
.row > .btn { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.btn {
  appearance: none; border: 0; background: var(--bg); color: var(--ink); padding: 12px 16px; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.dark { background: var(--brand); color: #fff; }
.btn.good { background: var(--good-soft); color: var(--good); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; margin-top: 18px; padding: 14px; }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.link { background: none; padding: 0; color: var(--accent); font-weight: 600; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 2px; }
.list > li:last-child { padding-bottom: 0; }
.line1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.day { display: flex; gap: 14px; align-items: center; }
.day-date { width: 48px; flex: 0 0 auto; text-align: center; border-radius: 12px; background: var(--bg); padding: 6px 0; }
.day-date b { display: block; font-size: 18px; line-height: 1.1; }
.day-date span { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.day-date.sun span, .day-date.sun b { color: var(--bad); }
.day-date.sat span, .day-date.sat b { color: var(--accent); }
.day-body { flex: 1; min-width: 0; }
.day-time { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-meta { font-size: 13px; color: var(--sub); margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--sub); }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.blue { background: var(--accent-soft); color: var(--accent); }
.person { display: flex; gap: 12px; align-items: center; }
.person .avatar { cursor: default; flex: 0 0 auto; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.summary .stat { background: var(--card); box-shadow: var(--shadow); }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--faint); font-weight: 600; font-size: 12.5px; }
tr:last-child td { border-bottom: 0; }

/* 로그인 */
.auth-hero {
  margin: -4px -16px 0; padding: 40px 24px 70px; color: #fff; text-align: center;
  background: radial-gradient(100% 80% at 100% 0%, #3b6dff 0%, rgba(59, 109, 255, 0) 60%), linear-gradient(160deg, #0b1f3a 0%, #13305c 60%, #1d4ed8 100%);
}
.auth-hero img { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }
.auth-hero h1 { font-size: 22px; margin: 16px 0 4px; letter-spacing: -.02em; }
.auth-hero p { margin: 0; opacity: .75; font-size: 14px; }
.auth-card { margin-top: -44px; position: relative; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 6px; }
.seg button { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--faint); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.note { font-size: 13px; color: var(--sub); background: var(--bg); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.good { background: var(--good-soft); color: var(--good); }
.consent ul { padding-left: 18px; margin: 8px 0; }
.consent li { margin: 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; max-width: calc(100% - 32px); z-index: 10;
  font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}
.toast.err { background: var(--bad); color: #fff; }
body.no-nav .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

@media (min-width: 720px) {
  .clock { font-size: 60px; }
  .view { padding-top: 12px; }
}
.card.alert { border: 1.5px solid var(--warn); }
.note svg.i { width: 16px; height: 16px; vertical-align: -3px; }
