:root {
  font-family: "Segoe UI", "Microsoft JhengHei UI", sans-serif;
  color: #173b43;
  background: #f3f7f5;
  font-synthesis: none;
  --deep: #123f48;
  --teal: #126d73;
  --teal-dark: #0a5660;
  --muted: #708486;
  --line: #e0e9e5;
  --panel-shadow: 0 10px 30px rgb(25 67 67 / 6%);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: linear-gradient(180deg, #edf4f0 0, #f5f8f6 290px, #f3f7f5 100%); line-height: 1.5; }
button, input { font: inherit; }
button { border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.screen { min-height: 100vh; padding: max(env(safe-area-inset-top), 12px) 20px max(env(safe-area-inset-bottom), 18px); }
.lock-screen { display: grid; place-items: center; background: radial-gradient(ellipse at 50% 0, rgb(215 234 225 / 75%), transparent 62%); }
.lock-card { width: min(100%, 420px); padding: 36px 34px 28px; border: 1px solid rgb(222 234 228 / 90%); border-radius: 16px; background: #fff; box-shadow: 0 22px 65px rgb(22 69 66 / 10%); text-align: center; }
.lock-logo { display: block; width: min(100%, 280px); height: auto; max-height: 96px; margin: 0 auto 17px; object-fit: contain; }
.lock-kicker { margin: 0 0 8px !important; color: #71928a !important; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.lock-card h1 { margin: 0 0 8px; color: var(--deep); font-size: 23px; letter-spacing: .04em; }
.lock-card > p:not(.lock-kicker):not(.error) { margin: 0 0 20px; color: #738685; font-size: 13px; }
.lock-card input, .control-row input, .date-range input { width: 100%; border: 1px solid #cbd9d3; border-radius: 8px; padding: 12px 13px; background: #fff; color: #173b43; outline: none; }
.lock-card input:focus, .control-row input:focus, .date-range input:focus { border-color: #5f9e91; box-shadow: 0 0 0 3px rgb(18 109 115 / 12%); }
.primary, .secondary { min-height: 43px; border-radius: 8px; padding: 11px 15px; font-weight: 700; transition: background .18s ease, transform .18s ease; }
.primary { background: var(--teal-dark); color: #fff; }
.primary:hover { background: #084a53; }
.secondary { background: #e7f0ec; color: #215e5b; }
.secondary:hover { background: #dbeae3; }
.lock-card .primary { width: 100%; margin-top: 12px; }
.error { min-height: 20px !important; margin: 9px 0 0 !important; color: #b33f36 !important; font-size: 12px; }
.app-screen { width: min(960px, 100%); margin: 0 auto; }
.app-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 0 13px; }
.app-brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.app-brand img { width: 112px; height: 49px; flex: none; object-fit: contain; }
.app-brand span { display: grid; gap: 3px; padding-left: 13px; border-left: 1px solid #d5e3dc; }
.app-brand small { color: #78918b; font-size: 8px; letter-spacing: .12em; }
.app-brand strong { color: var(--deep); font-size: 16px; letter-spacing: .03em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.portal-link, .icon-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 11px; border: 1px solid #d7e4de; border-radius: 7px; background: #fff; color: #587672; font-size: 12px; }
.portal-link:hover { color: var(--teal-dark); border-color: #abcac0; }
.icon-button { font-weight: 700; }
.control-card, .follow-card, .list-section, .follow-section { margin: 11px 0; padding: 19px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--panel-shadow); }
.control-card { padding: 19px 22px 14px; }
.control-row { display: grid; grid-template-columns: 105px minmax(0, 1fr); align-items: center; gap: 12px; margin-bottom: 11px; }
.control-row label { color: #365c5c; font-size: 13px; font-weight: 750; }
.control-row input { padding: 10px 12px; }
.control-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.install-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.install-button { min-height: 41px; width: 100%; margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #c9ded6; border-radius: 8px; background: #f1f7f4; color: #176c69; font-size: 12px; font-weight: 650; }
.install-button:hover { background: #e8f2ed; }
.platform-icon { width: 19px; height: 19px; flex: 0 0 auto; fill: currentColor; }
.ios-button { border-color: #d9dfe2; background: #f4f6f6; color: #43535a; }
.android-button { border-color: #cce4d2; background: #eff8f0; color: #287346; }
.install-note { margin: 7px 0 0; color: #849390; text-align: center; font-size: 10px; }
.status { margin-top: 13px; padding: 10px 12px; border-radius: 7px; text-align: center; font-size: 12px; font-weight: 700; }
.status.connected { background: #eaf5ed; color: #237142; }
.status.connecting { background: #fbf4e4; color: #8e6925; }
.status.disconnected { background: #fbefed; color: #a0473d; }
.last-updated { margin-top: 6px; color: #849391; text-align: center; font-size: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin: 14px 0; }
.stat-card { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #21484d; text-align: left; box-shadow: 0 5px 16px rgb(25 67 67 / 4%); transition: transform .16s ease, box-shadow .16s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--panel-shadow); }
.stat-card span { font-size: 13px; font-weight: 750; }
.stat-card strong { font-size: 29px; font-weight: 750; }
.stat-card.blue { border-top: 3px solid #3c82b6; }
.stat-card.green { border-top: 3px solid #51946a; }
.stat-card.red { border-top: 3px solid #c96a5e; }
.stat-card.gray { border-top: 3px solid #829093; }
.follow-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.follow-card h2, .list-heading h2 { margin: 0; color: var(--deep); font-size: 16px; }
.follow-card p { margin: 4px 0 0; color: #778a88; font-size: 11px; line-height: 1.6; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.text-button { min-height: 34px; padding: 7px 9px; border-radius: 6px; background: #f1f6f3; color: #236d6d; font-size: 12px; font-weight: 700; }
.record-list { display: grid; gap: 8px; }
.record { padding: 12px 14px; border: 1px solid #e3ebe7; border-radius: 8px; background: #fcfdfc; }
.record-main { display: flex; justify-content: space-between; gap: 10px; }
.record-serial { color: #176a70; font-weight: 850; letter-spacing: .04em; }
.record-name { color: #23484d; font-weight: 750; }
.record-sub { margin-top: 5px; color: #687e7d; font-size: 11px; white-space: pre-wrap; }
.record-missing { border-left: 3px solid #c28d51; }
.record-missing .record-name { font-size: 14px; }
.empty-state { padding: 22px; color: #83918f; text-align: center; font-size: 12px; }
.date-range { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 8px; margin-bottom: 12px; }
.date-range label { color: #607774; font-size: 11px; }
.date-range input { margin-top: 4px; padding: 9px 8px; }
.toast { position: fixed; z-index: 9; left: 50%; bottom: 22px; max-width: calc(100% - 32px); padding: 10px 16px; transform: translate(-50%, 20px); border: 1px solid rgb(255 255 255 / 15%); border-radius: 8px; background: #163f46; color: #fff; text-align: center; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
:focus-visible { outline: 3px solid rgb(47 126 119 / 35%); outline-offset: 2px; }
@media (max-width: 720px) {
  .screen { padding-inline: 13px; }
  .app-header { min-height: 68px; }
  .app-brand { gap: 9px; }
  .app-brand img { width: 85px; height: 40px; }
  .app-brand span { padding-left: 9px; }
  .app-brand small { font-size: 7px; }
  .app-brand strong { font-size: 13px; }
  .portal-link, .icon-button { min-height: 35px; padding: 7px 8px; font-size: 10px; }
  .header-actions { gap: 6px; }
  .control-card, .follow-card, .list-section, .follow-section { padding: 14px; }
  .control-card { padding: 15px; }
  .control-row { grid-template-columns: 78px minmax(0, 1fr); gap: 8px; }
  .control-row label { font-size: 11px; }
  .control-actions { gap: 8px; }
  .primary, .secondary { min-height: 41px; padding: 9px 10px; font-size: 12px; }
  .install-actions { gap: 7px; }
  .install-button { min-height: 39px; gap: 5px; padding: 6px; font-size: 10px; }
  .install-note { font-size: 9px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { min-height: 70px; padding: 12px; }
  .stat-card span { font-size: 12px; }
  .stat-card strong { font-size: 25px; }
  .follow-card { align-items: flex-start; flex-direction: column; }
  .follow-card button { width: 100%; }
  .date-range { grid-template-columns: 1fr 1fr; }
  .date-range button { grid-column: 1 / -1; }
}
@media (max-width: 380px) {
  .app-brand img { width: 68px; }
  .portal-link { display: none; }
  .control-row { grid-template-columns: 69px minmax(0, 1fr); }
  .install-button { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
