/* ============================================================
   小米考勤 · Base layout, device frame & app shell
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-15);
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--brand); text-decoration: none; }
img, svg { display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: var(--brand-200); }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon--sm { width: 16px; height: 16px; stroke-width: 2; }
.icon--xs { width: 13px; height: 13px; stroke-width: 2.1; }
.icon--lg { width: 26px; height: 26px; stroke-width: 1.7; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ============================================================
   Desktop stage / presentation
   ============================================================ */
.stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(32px, 6vw, 96px);
  height: 100dvh; width: 100%;
  padding: 32px clamp(24px, 5vw, 80px);
  overflow: hidden;
  background:
    radial-gradient(900px 620px at 88% 12%, rgba(22, 119, 255, .10), transparent 62%),
    radial-gradient(760px 520px at 6% 90%, rgba(255, 105, 0, .07), transparent 60%),
    radial-gradient(1200px 800px at 50% 50%, #fbfcfe 0%, #eef2f8 68%, #e7ecf4 100%);
}
.stage::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 46%, #000 0%, transparent 72%);
  pointer-events: none;
}
.stage-brand {
  position: relative; z-index: 2;
  width: min(360px, 30vw);
  animation: stageIn .8s var(--ease-out) both;
}
.brand-mark { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--mi-orange);
  color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -.5px;
  box-shadow: 0 8px 18px -6px rgba(255, 105, 0, .6);
  font-family: var(--font-num);
}
.brand-line { width: 1px; height: 22px; background: var(--line); }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: .02em; color: var(--text-1); display: flex; flex-direction: column; line-height: 1.25; }
.brand-name em { font-style: normal; font-size: 10px; font-weight: 600; letter-spacing: .18em; color: var(--text-3); text-transform: uppercase; margin-top: 3px; }
.stage-brand h1 {
  font-size: clamp(30px, 3.3vw, 42px);
  line-height: 1.24; letter-spacing: -.02em; font-weight: 800;
  color: #101828;
  margin-bottom: 18px;
}
.stage-desc { font-size: 14px; line-height: 1.85; color: var(--text-2); max-width: 340px; }
.stage-desc b { color: var(--text-1); font-weight: 600; }
.stage-features { margin-top: 26px; display: grid; gap: 12px; }
.stage-features li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px rgba(15, 23, 42, .04); }
.dot.blue { background: var(--brand); }
.dot.green { background: var(--success); }
.dot.orange { background: var(--mi-orange); }
.dot.purple { background: var(--purple); }
.stage-hint {
  margin-top: 30px; font-size: 12px; color: var(--text-3);
  padding: 10px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, .6); border: 1px dashed var(--line);
  backdrop-filter: blur(8px);
}
.stage-foot { margin-top: 34px; font-size: 10.5px; letter-spacing: .08em; color: var(--text-4); text-transform: uppercase; }

.device-wrap {
  position: relative; z-index: 2;
  display: grid; place-items: center;
  flex: none;
}
.device {
  position: relative;
  zoom: var(--device-scale, 1);
  animation: deviceIn 1s var(--ease-out) both;
}
.device-shadow {
  position: absolute; left: 8%; right: 8%; bottom: -26px; height: 60px;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, .30), transparent 70%);
  filter: blur(14px); z-index: -1;
}
.device-frame {
  width: 414px; height: 868px;
  padding: 12px;
  border-radius: 58px;
  background: linear-gradient(155deg, #2a2d34 0%, #101216 36%, #0a0b0e 100%);
  box-shadow:
    0 44px 90px -28px rgba(15, 23, 42, .55),
    0 18px 40px -20px rgba(15, 23, 42, .35),
    inset 0 0 0 1.5px rgba(255, 255, 255, .10),
    inset 0 1px 1px rgba(255, 255, 255, .22);
}
.screen {
  position: relative;
  width: 390px; height: 844px;
  border-radius: 46px;
  overflow: hidden;
  background: var(--bg);
  display: flex; flex-direction: column;
  isolation: isolate;
  transition: background var(--dur-2);
}
.dynamic-island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 116px; height: 31px; border-radius: 18px;
  background: #05060a; z-index: 80;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.dynamic-island::after {
  content: ""; position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #1d2a44, #070a12 70%);
  box-shadow: inset 0 0 2px rgba(90, 150, 255, .5);
}

/* ---------- Status bar ---------- */
.status-bar {
  height: var(--status-h); flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 26px 0 34px;
  font-family: var(--font-num);
  font-size: 14px; font-weight: 600; letter-spacing: .01em;
  color: var(--text-1);
  position: relative; z-index: 40;
  transition: color var(--dur-2);
  pointer-events: none;
}
.status-icons { display: flex; align-items: center; gap: 5px; }
.status-icons svg { height: 12px; width: auto; }
.status-icons .sig { width: 17px; }
.status-icons .wifi { width: 16px; }
.status-icons .battery { width: 25px; }
.screen.bar-invert .status-bar { color: #fff; }

/* ---------- Navbar ---------- */
.navbar {
  height: var(--nav-h); flex: none;
  display: flex; align-items: center; gap: 2px;
  padding: 0 10px 0 6px;
  position: relative; z-index: 35;
  transition: background var(--dur-2), border-color var(--dur-2);
}
.navbar[hidden] { display: none !important; }
.nav-btn {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; color: var(--text-1);
  transition: background var(--dur-1), transform var(--dur-1);
}
.nav-btn:active { background: rgba(15, 23, 42, .06); transform: scale(.94); }
.nav-title {
  font-size: var(--fs-17); font-weight: 650; letter-spacing: -.01em;
  flex: 1; min-width: 0; padding-left: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-actions { display: flex; align-items: center; gap: 2px; }
.nav-text-btn {
  height: 34px; padding: 0 10px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--brand);
  display: inline-flex; align-items: center; gap: 4px;
}
.nav-text-btn .icon { width: 16px; height: 16px; }
.nav-text-btn:active { background: var(--brand-100); }
.navbar.is-solid {
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line-2);
}
.navbar.is-invert .nav-title, .navbar.is-invert .nav-btn { color: #fff; }

/* ---------- View / pages ---------- */
.view {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  position: relative; z-index: 10;
}
.view::-webkit-scrollbar { width: 0; height: 0; }
.page {
  min-height: 100%;
  padding: 4px var(--gutter) 28px;
  animation: pageIn var(--dur-3) var(--ease-out) both;
}
.page--flush { padding: 0 0 28px; }
.page--no-tab { padding-bottom: 14px; }
.page.is-leaving { animation: pageOut .2s ease forwards; }

/* ---------- Tab bar ---------- */
.tabbar {
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  flex: none;
  display: flex; align-items: flex-start;
  padding-top: 7px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line-2);
  position: relative; z-index: 50;
}
.tabbar[hidden] { display: none !important; }
.tab-item {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 3px 0 0; height: 50px;
  color: var(--text-3);
  transition: color var(--dur-1);
  -webkit-tap-highlight-color: transparent;
}
.tab-item .icon { width: 23px; height: 23px; stroke-width: 1.7; transition: transform var(--dur-2) var(--ease-spring); }
.tab-label { font-size: 10px; font-weight: 550; letter-spacing: .01em; line-height: 1.2; }
.tab-item.is-active { color: var(--brand); }
.tab-item.is-active .icon { transform: translateY(-1px) scale(1.04); stroke-width: 2; }
.tab-item:active .icon { transform: scale(.9); }
.tab-badge {
  position: absolute; top: 0; left: calc(50% + 6px);
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700; font-style: normal;
  display: grid; place-items: center;
  border: 1.5px solid var(--card);
  box-shadow: 0 1px 4px rgba(245, 63, 63, .4);
}
.home-indicator {
  position: absolute; bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px;
  background: var(--text-1); opacity: .82; z-index: 70;
  pointer-events: none;
}
body.theme-dark .home-indicator { background: #e5e6eb; opacity: .6; }

/* ============================================================
   Typography helpers
   ============================================================ */
.t-h1 { font-size: var(--fs-24); font-weight: 750; letter-spacing: -.02em; line-height: 1.3; }
.t-h2 { font-size: var(--fs-20); font-weight: 700; letter-spacing: -.015em; line-height: 1.35; }
.t-h3 { font-size: var(--fs-17); font-weight: 650; letter-spacing: -.01em; }
.t-body { font-size: var(--fs-15); }
.t-sm { font-size: var(--fs-13); }
.t-xs { font-size: var(--fs-12); }
.t-cap { font-size: var(--fs-11); }
.tnum { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.muted-2 { color: var(--text-2); }
.strong { font-weight: 650; }
.center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; }
.row-b { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.gap-2 { gap: 2px; } .gap-4 { gap: 4px; } .gap-6 { gap: 6px; }
.gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-6 { margin-top: 6px; } .mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.divider { height: 1px; background: var(--line-2); }
.divider--inset { margin-left: 52px; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pageOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-6px); } }
@keyframes stageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes deviceIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.86); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pulseRing {
  0% { transform: scale(.86); opacity: .55; }
  70% { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -220px 0; } 100% { background-position: 220px 0; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes checkDraw { to { stroke-dashoffset: 0; } }
@keyframes badgePop { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.spin { animation: spin 1s linear infinite; }

/* ============================================================
   Small screens → native app surface
   ============================================================ */
@media (max-width: 760px) {
  .stage { display: block; padding: 0; background: var(--bg); }
  .stage::before, .stage-brand, .device-shadow { display: none; }
  .device-wrap { width: 100%; height: 100dvh; display: block; }
  .device { zoom: 1 !important; transform: none !important; animation: none; width: 100%; height: 100%; }
  .device-frame { width: 100%; height: 100%; padding: 0; border-radius: 0; background: var(--bg); box-shadow: none; }
  .screen { width: 100%; height: 100%; border-radius: 0; }
  .dynamic-island { display: none; }
  .status-bar { padding-top: max(6px, env(safe-area-inset-top)); height: calc(var(--status-h) + env(safe-area-inset-top)); }
  .home-indicator { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
