/* =====================================================================
   HTS-HRMS mobile — "Aurora" skin (1.6.2)
   Same design language as the web portal: deep-space ground, drifting
   light-fields, glass cards, the HTS orange→blue gradient, Sora display.
   Every selector m.js / index.html use is preserved.
   ===================================================================== */
:root {
  --bg: #070a12; --bg-2: rgba(8, 12, 22, .6);
  --panel: rgba(19, 26, 42, .66); --panel-solid: #131a2a;
  --border: rgba(148, 168, 210, .15); --border-bright: rgba(148, 168, 210, .3);
  --text: #eaf0fa; --dim: #8b96ac;
  --accent: #4f8cff; --accent-2: #6ba3ff; --orange: #ff9438;
  --green: #3ecf8e; --amber: #f5b83d; --red: #ff6b6b; --purple: #b57bff;
  --grad: linear-gradient(120deg, #ff9438 0%, #ff6a3d 28%, #4f8cff 72%, #38c8ff 100%);
  --display: "Sora", "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, .9, .3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

/* Ambient aurora light-fields (fixed, behind everything). */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(70px); opacity: .5; pointer-events: none;
}
body::before {
  width: 90vw; height: 90vw; top: -38vw; right: -28vw;
  background: radial-gradient(circle at 30% 30%, rgba(79,140,255,.34), transparent 65%);
  animation: drift1 24s ease-in-out infinite alternate;
}
body::after {
  width: 80vw; height: 80vw; bottom: -34vw; left: -26vw;
  background: radial-gradient(circle at 60% 60%, rgba(255,122,52,.22), transparent 65%);
  animation: drift2 30s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(-8vw, 6vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(7vw, -5vh) scale(1.1); } }

/* ---- banner / toast ---- */
.banner { background: rgba(58,42,12,.92); color: #ffd27a; font-size: 12.5px; padding: 8px 14px; padding-top: calc(8px + var(--safe-t)); text-align: center; backdrop-filter: blur(8px); }
.banner.bad { background: rgba(58,20,20,.92); color: #ffb3b3; }
.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--panel-solid); border: 1px solid var(--border-bright); padding: 11px 17px; border-radius: 13px;
  font-size: 13.5px; opacity: 0; transition: all .3s var(--ease); z-index: 60; max-width: 90vw; text-align: center;
  box-shadow: 0 14px 40px rgba(2,5,14,.6);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--red); box-shadow: 0 8px 30px rgba(255,107,107,.2); }
.toast.ok { border-color: rgba(62,207,142,.55); box-shadow: 0 8px 30px rgba(62,207,142,.16); }

/* ---- login ---- */
.screen.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 18px; position: relative; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .5; pointer-events: none; }
.orb.o1 { width: 300px; height: 300px; top: -80px; left: -40px; background: radial-gradient(circle, rgba(79,140,255,.5), transparent 70%); animation: float1 12s ease-in-out infinite alternate; }
.orb.o2 { width: 260px; height: 260px; bottom: -70px; right: -50px; background: radial-gradient(circle, rgba(255,122,52,.42), transparent 70%); animation: float2 14s ease-in-out infinite alternate; }
@keyframes float1 { to { transform: translate(30px, 24px) scale(1.12); } }
@keyframes float2 { to { transform: translate(-26px, -20px) scale(1.08); } }
.login-card {
  width: 100%; max-width: 390px; position: relative;
  background: var(--panel); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-bright); border-radius: 20px; padding: 30px 24px;
  box-shadow: 0 20px 60px rgba(2,5,14,.6), inset 0 1px 0 rgba(255,255,255,.06);
  animation: cardIn .6s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.login-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: 21px; padding: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .5; pointer-events: none;
}
.brand { font-family: var(--display); font-size: 25px; font-weight: 800; letter-spacing: -.02em; }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 0; }
.sub { color: var(--dim); font-size: 13px; margin: 6px 0 16px; }
.login-card label, .form label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 13px 0 6px; font-weight: 600; }
.login-card input, .form input, .form select {
  width: 100%; padding: 12px 13px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus, .form input:focus, .form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.16); }
.login-card button {
  width: 100%; margin-top: 20px; padding: 13px; border: none; border-radius: 11px;
  background: var(--grad); background-size: 160% 100%; color: #fff; font-weight: 700; font-size: 15px; font-family: var(--display);
  box-shadow: 0 8px 26px rgba(79,140,255,.32);
  transition: background-position .5s var(--ease), transform .15s;
}
.login-card button:active { transform: scale(.98); background-position: 90% 0; }
.login-card button:disabled { opacity: .6; }
.err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 16px; }
.hint { color: var(--dim); font-size: 12px; margin-top: 16px; text-align: center; line-height: 1.5; }

/* ---- app shell ---- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex; justify-content: space-between; align-items: center; padding: 13px 16px 10px;
  padding-top: calc(13px + var(--safe-t)); position: sticky; top: 0; z-index: 10;
  background: rgba(10, 14, 25, .72); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.who { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.who-sub { color: var(--dim); font-size: 12px; }
.date { color: var(--dim); font-size: 12.5px; text-align: right; }
main { flex: 1; padding: 12px 14px calc(92px + var(--safe-b)); }

.screen { animation: riseIn .4s var(--ease) both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } }

.card {
  position: relative; overflow: hidden;
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 10px 28px rgba(2,5,14,.4);
}
.card.today::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2.5px; background: var(--grad);
}
.lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin-bottom: 6px; font-weight: 700; }
.row { display: flex; gap: 12px; }
.row > div { flex: 1; }
.row.between { justify-content: space-between; align-items: center; }
.big { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.status-line { margin-top: 10px; font-size: 13px; color: var(--dim); }
.p { color: var(--dim); font-size: 13.5px; margin: 0 0 10px; }
.msg { font-size: 13px; color: var(--dim); margin-top: 8px; min-height: 16px; }
.msg.err { color: var(--red); } .msg.ok { color: var(--green); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); color: var(--dim); }
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 7px currentColor; }
.pill.green { color: var(--green); border-color: rgba(62,207,142,.42); background: rgba(62,207,142,.08); }
.pill.amber { color: var(--amber); border-color: rgba(245,184,61,.42); background: rgba(245,184,61,.08); }
.pill.red { color: var(--red); border-color: rgba(255,107,107,.42); background: rgba(255,107,107,.08); }
.pill.purple { color: var(--purple); border-color: rgba(181,123,255,.42); background: rgba(181,123,255,.08); }

/* ---- location ---- */
.loc-main { font-weight: 700; font-size: 15px; font-family: var(--display); }
.loc-main.in { color: var(--green); text-shadow: 0 0 18px rgba(62,207,142,.4); }
.loc-main.out { color: var(--amber); text-shadow: 0 0 18px rgba(245,184,61,.35); }
.loc-main.bad { color: var(--red); }
.loc-sub { color: var(--dim); font-size: 12.5px; margin-top: 3px; }

/* ---- punch button ---- */
.punch {
  width: 100%; border: none; border-radius: 20px; padding: 24px 16px; margin: 4px 0 12px;
  background: var(--grad); background-size: 200% 100%; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; overflow: hidden;
  box-shadow: 0 14px 38px rgba(79,140,255,.32);
  transition: transform .12s, box-shadow .2s; animation: punchGlow 3.5s ease-in-out infinite alternate;
}
@keyframes punchGlow { to { box-shadow: 0 14px 46px rgba(255,122,52,.34); background-position: 60% 0; } }
.punch::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  animation: shine 4.5s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -80%; } 100% { left: 130%; } }
.punch:active { transform: scale(.97); }
.punch:disabled { opacity: .55; box-shadow: none; animation: none; }
.punch.out { background: linear-gradient(120deg, #ff9438, #ff5c7a 70%, #ff6b6b); box-shadow: 0 14px 38px rgba(255,107,107,.28); animation: none; }
.punch-lbl { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.punch-sub { font-size: 12.5px; opacity: .92; }

.queue { background: rgba(58,42,12,.85); border: 1px solid rgba(255,210,122,.3); color: #ffd27a; border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; backdrop-filter: blur(8px); }
.queue button { background: none; border: 1px solid #ffd27a; color: #ffd27a; border-radius: 8px; padding: 4px 10px; font-size: 12px; }

/* ---- lists ---- */
.list .item { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid rgba(148,168,210,.09); gap: 10px; }
.list .item:last-child { border-bottom: none; }
.item .main { font-weight: 600; font-size: 14px; }
.item .sub { color: var(--dim); font-size: 12px; margin: 2px 0 0; }
.item .right { text-align: right; white-space: nowrap; }
.item .amt { font-weight: 700; font-size: 15px; font-family: var(--display); font-variant-numeric: tabular-nums; }
.empty { color: var(--dim); font-size: 13px; padding: 8px 0; }
.link { background: none; border: none; color: var(--accent); font-size: 13px; padding: 0; }

/* ---- history ---- */
.totals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.totals div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 6px; text-align: center; }
.totals b { display: block; font-size: 18px; font-family: var(--display); font-variant-numeric: tabular-nums; }
.totals span { font-size: 10.5px; color: var(--dim); }
.code { display: inline-block; min-width: 30px; text-align: center; font-weight: 700; font-size: 12px; padding: 3px 6px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--border); }
.code.P { color: var(--green); } .code.HD, .code.MP { color: var(--amber); } .code.A { color: var(--red); } .code.L { color: var(--purple); } .code.H, .code.WO { color: var(--dim); }

/* ---- leave ---- */
.balances { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.bal {
  background: var(--panel); border: 1px solid var(--border); border-left-width: 3px; border-radius: 12px;
  padding: 10px 8px; text-align: center; backdrop-filter: blur(10px);
}
.bal b { display: block; font-size: 21px; font-family: var(--display); font-variant-numeric: tabular-nums; }
.bal span { font-size: 10.5px; color: var(--dim); }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  width: 100%; margin-top: 14px; padding: 13px; border: none; border-radius: 11px;
  background: var(--grad); background-size: 160% 100%; color: #fff; font-weight: 700; font-size: 14.5px; font-family: var(--display);
  box-shadow: 0 6px 20px rgba(79,140,255,.28); transition: transform .12s, background-position .4s var(--ease);
}
.btn:active { transform: scale(.98); background-position: 90% 0; }
.btn.ghost { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.danger { background: rgba(255,107,107,.12); color: var(--red); border: 1px solid rgba(255,107,107,.4); box-shadow: none; }
.btn:disabled { opacity: .6; }
.ver { color: var(--dim); font-size: 11.5px; text-align: center; margin-top: 12px; font-family: var(--display); }

/* ---- profile ---- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 13.5px; }
.kv .k { color: var(--dim); }

/* ---- bottom tabs ---- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; z-index: 20;
  background: rgba(10, 14, 25, .82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border); padding: 5px 6px calc(5px + var(--safe-b));
}
.tabs button {
  flex: 1; background: none; border: none; color: var(--dim); padding: 8px 0 7px; font-size: 10.5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 12px; position: relative;
  transition: color .2s, background .2s, transform .15s;
}
.tabs button .ic { font-size: 19px; transition: transform .2s var(--ease); }
.tabs button.active { color: #fff; background: linear-gradient(180deg, rgba(79,140,255,.18), rgba(79,140,255,.05)); font-weight: 700; }
.tabs button.active .ic { transform: translateY(-2px) scale(1.12); }
.tabs button.active::before {
  content: ""; position: absolute; top: -6px; left: 25%; right: 25%; height: 3px; border-radius: 3px;
  background: var(--grad); box-shadow: 0 0 12px rgba(79,140,255,.6);
}
.tabs button:active { transform: scale(.94); }

/* ---- confirm sheet ---- */
.sheet { position: fixed; inset: 0; background: rgba(4,7,14,.66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-end; z-index: 50; }
.sheet-card {
  width: 100%; background: var(--panel-solid); border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + var(--safe-b)); border-top: 1px solid var(--border-bright);
  box-shadow: 0 -18px 50px rgba(2,5,14,.6); animation: sheetIn .3s var(--ease) both;
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
.sheet-title { font-family: var(--display); font-weight: 800; font-size: 17px; margin-bottom: 10px; }
.selfie { width: 100%; max-height: 46vh; object-fit: cover; border-radius: 14px; background: #000; border: 1px solid var(--border); }
.sheet-loc { font-size: 13.5px; color: var(--dim); margin: 10px 0 4px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { margin-top: 10px; }

/* ---- HTS brand ---- */
.logo-chip { background: #fff; border-radius: 12px; display: inline-flex; align-items: center; padding: 10px 14px; box-shadow: 0 6px 22px rgba(0,0,0,.35); }
.logo-chip img { display: block; height: 38px; width: auto; }
.logo-chip.lg { margin-bottom: 12px; animation: chipFloat 5s ease-in-out infinite alternate; }
@keyframes chipFloat { to { transform: translateY(-4px); } }

.apk-link {
  display: block; margin-top: 12px; text-align: center; padding: 11px; border-radius: 11px;
  background: rgba(62,207,142,.09); border: 1px solid rgba(62,207,142,.4); color: var(--green);
  text-decoration: none; font-size: 13px; font-weight: 600;
}
.apk-link:active { background: rgba(62,207,142,.18); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
