/* 悦居护眼卫士 · 家长控制台样式 */
:root {
  --bg: #F2F6F4;
  --card: #FFFFFF;
  --ink: #0F1F1A;
  --ink2: #5C6F68;
  --ink3: #93A29C;
  --line: #E3ECE8;
  --brand: #0E9F6E;
  --brand-d: #0A7A54;
  --brand-soft: #E4F7EF;
  --danger: #E5484D;
  --danger-soft: #FDECEC;
  --warn: #E08A00;
  --warn-soft: #FFF4E0;
  --radius: 20px;
  --shadow: 0 2px 10px rgba(16, 40, 32, .05), 0 12px 30px -18px rgba(16, 40, 32, .18);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 骨架 */
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px calc(28px + var(--safe-b)); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(135deg, #0A231B 0%, #0C3A2B 58%, #0E5039 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 18px;
  border-radius: 0 0 26px 26px;
  box-shadow: 0 10px 30px -16px rgba(10, 35, 27, .55);
}
.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand svg { flex: 0 0 auto; }
.brand b { font-size: 16.5px; font-weight: 650; letter-spacing: .3px; }
.brand span { display: block; font-size: 11px; opacity: .62; letter-spacing: 1.4px; margin-top: -2px; }
.spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  display: grid;
  place-items: center;
  transition: background .18s;
}
.icon-btn:active { background: rgba(255, 255, 255, .2); }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 14px;
  border: 1px solid rgba(227, 236, 232, .9);
}
.card.flush { padding: 0; overflow: hidden; }

.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink2);
  letter-spacing: .4px;
  margin: 26px 2px 0;
}
.sec-title::before {
  content: "";
  width: 3px; height: 13px;
  border-radius: 2px;
  background: var(--brand);
}

/* ---------------------------------------------------------------- 登录 */
.auth-hero {
  text-align: center;
  padding: 52px 20px 26px;
}
.auth-hero .logo {
  width: 76px; height: 76px;
  border-radius: 24px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #12B886, #0A7A54);
  box-shadow: 0 16px 34px -14px rgba(14, 159, 110, .7);
}
.auth-hero h1 { font-size: 23px; margin: 0 0 6px; font-weight: 700; letter-spacing: -.3px; }
.auth-hero p { margin: 0; color: var(--ink2); font-size: 13.5px; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--ink2);
  font-weight: 600;
  margin: 0 0 6px 2px;
}
.field input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #FBFDFC;
  outline: none;
  transition: border-color .18s, background .18s;
}
.field input:focus { border-color: var(--brand); background: #fff; }
.field input::placeholder { color: #AEBBB6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 50px;
  padding: 0 20px;
  border-radius: 14px;
  font-weight: 650;
  font-size: 15px;
  transition: transform .12s, opacity .18s, background .18s;
  width: 100%;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: linear-gradient(135deg, #12B886, #0A7A54); color: #fff; box-shadow: 0 10px 22px -12px rgba(10, 122, 84, .9); }
.btn.ghost { background: var(--brand-soft); color: var(--brand-d); }
.btn.line { background: #fff; border: 1.5px solid var(--line); color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm { height: 40px; font-size: 13.5px; border-radius: 12px; padding: 0 14px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.switch-line {
  text-align: center;
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--ink2);
}
.switch-line b { color: var(--brand-d); font-weight: 650; }

.err {
  background: var(--danger-soft);
  color: #B4282C;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  display: none;
}
.err.show { display: block; }

/* ---------------------------------------------------------------- 设备卡 */
.dev {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(227, 236, 232, .9);
  padding: 17px 18px 15px;
  margin-top: 14px;
  transition: transform .14s;
}
.dev:active { transform: scale(.99); }

.dev-head { display: flex; align-items: flex-start; gap: 10px; }
.dev-name { font-size: 16.5px; font-weight: 680; letter-spacing: -.2px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; margin-right: 5px;
  background: var(--ink3);
  box-shadow: 0 0 0 3px rgba(147, 162, 156, .16);
}
.dot.on { background: #12B886; box-shadow: 0 0 0 3px rgba(18, 184, 134, .18); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.dev-meta { font-size: 12.5px; color: var(--ink3); margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 650;
  padding: 4px 9px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand-d);
  white-space: nowrap;
}
.badge.lock { background: var(--danger-soft); color: var(--danger); }
.badge.rest { background: var(--warn-soft); color: var(--warn); }
.badge.off { background: #F0F3F2; color: var(--ink3); }

.bar {
  height: 8px; border-radius: 5px;
  background: #EDF3F0; overflow: hidden; margin-top: 13px;
}
.bar > i {
  display: block; height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, #12B886, #0A7A54);
  transition: width .5s cubic-bezier(.22,.61,.36,1);
}
.bar.warn > i { background: linear-gradient(90deg, #F5B544, #E08A00); }
.bar.full > i { background: linear-gradient(90deg, #F27A7E, #E5484D); }

.dev-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 8px; font-size: 12.5px; color: var(--ink2);
}
.dev-foot b { font-size: 15px; color: var(--ink); font-weight: 700; }

.quick { display: flex; gap: 8px; margin-top: 13px; }
.quick .btn { height: 40px; font-size: 13.5px; border-radius: 12px; }

/* ---------------------------------------------------------------- 详情 */
.hero {
  background: linear-gradient(135deg, #0A231B, #0C3A2B 60%, #0E5039);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 14px;
  box-shadow: 0 14px 34px -18px rgba(10, 35, 27, .6);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -50px; top: -60px;
  width: 190px; height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(18,184,134,.34), transparent 68%);
}
.hero h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.hero .sub { font-size: 12.5px; opacity: .68; margin-top: 3px; }
.hero .big {
  font-size: 40px; font-weight: 700; letter-spacing: -1.4px;
  margin: 16px 0 0; line-height: 1;
}
.hero .big small { font-size: 15px; font-weight: 500; opacity: .7; margin-left: 4px; letter-spacing: 0; }
.hero .cap { font-size: 12px; opacity: .6; margin-top: 6px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12);
  padding: 5px 11px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  backdrop-filter: blur(6px);
}
.pill.live { background: rgba(18, 184, 134, .22); color: #7FF0C4; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat {
  background: rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 11px 13px;
}
.stat .k { font-size: 11px; opacity: .6; }
.stat .v { font-size: 17px; font-weight: 680; margin-top: 3px; letter-spacing: -.3px; }

.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

.seg {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px;
}
.seg button {
  flex: 1 1 60px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink2);
  transition: all .15s;
}
.seg button.on, .seg button:active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-d);
}

/* 分应用 */
.app-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid #F0F5F3;
}
.app-row:last-child { border-bottom: none; }
.app-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex: 0 0 auto;
}
.app-name { flex: 1; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-time { font-size: 13.5px; font-weight: 650; color: var(--ink2); }

/* 图表 */
.chart { margin-top: 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-x { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink3); margin-top: 6px; padding: 0 2px; }

/* 步进器 */
.row-set {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid #F0F5F3;
}
.row-set:last-child { border-bottom: none; }
.row-set .lab { font-size: 14.5px; font-weight: 550; }
.row-set .hint { font-size: 11.5px; color: var(--ink3); margin-top: 1px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 10px;
  background: #F3F7F5; color: var(--ink);
  font-size: 19px; font-weight: 500;
  display: grid; place-items: center;
  transition: background .15s;
}
.stepper button:active { background: var(--brand-soft); }
.stepper .val {
  min-width: 62px; text-align: center;
  font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 时间 */
.time-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.time-row input[type=time] {
  flex: 1; height: 46px; padding: 0 12px;
  border-radius: 12px; border: 1.5px solid var(--line);
  background: #FBFDFC; text-align: center; font-weight: 600;
}
.time-row span { color: var(--ink3); font-size: 13px; }

/* 开关 */
.sw { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw i {
  position: absolute; inset: 0;
  background: #DCE5E1; border-radius: 15px;
  transition: background .2s;
}
.sw i::after {
  content: ""; position: absolute;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  transition: transform .2s;
}
.sw input:checked + i { background: var(--brand); }
.sw input:checked + i::after { transform: translateX(20px); }

/* 时间线 */
.tl { position: relative; padding-left: 22px; }
.tl::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px;
  width: 2px; background: #EDF3F0; border-radius: 2px;
}
.tl-item { position: relative; padding: 8px 0; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 14px;
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--brand);
}
.tl-item.lock::before { border-color: var(--danger); }
.tl-item.policy::before { border-color: var(--warn); }
.tl-item .t { font-size: 14px; font-weight: 550; }
.tl-item .d { font-size: 11.5px; color: var(--ink3); margin-top: 1px; }

.empty {
  text-align: center; padding: 38px 20px; color: var(--ink3); font-size: 13.5px;
}
.empty svg { opacity: .32; margin-bottom: 12px; }

.add-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 52px; margin-top: 14px;
  border-radius: 16px;
  border: 1.6px dashed #C8D6D0;
  color: var(--ink2); font-weight: 600; font-size: 14.5px;
  background: rgba(255,255,255,.6);
}

/* 弹层 */
.sheet-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 22, 17, .48);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(20px + var(--safe-b));
  animation: up .24s cubic-bezier(.22,.61,.36,1);
  max-height: 90vh; overflow-y: auto;
}
@keyframes up { from { transform: translateY(100%); } }
.sheet h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.sheet .desc { color: var(--ink2); font-size: 13px; margin: 0 0 16px; }
.sheet .btn { margin-top: 10px; }

.grab {
  width: 38px; height: 4px; border-radius: 3px;
  background: #E2EAE6; margin: 0 auto 16px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%) translateY(10px);
  background: rgba(15, 31, 26, .93);
  color: #fff; font-size: 13.5px; font-weight: 550;
  padding: 11px 20px; border-radius: 14px;
  z-index: 99; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
  max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.skel {
  height: 108px; border-radius: var(--radius);
  background: linear-gradient(100deg, #EDF3F0 30%, #F6FAF8 50%, #EDF3F0 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite;
  margin-top: 14px;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }

.loading-bar {
  position: fixed; top: 0; left: 0; height: 2.5px; z-index: 100;
  background: linear-gradient(90deg, #12B886, #7FF0C4);
  border-radius: 0 3px 3px 0;
  transition: width .25s, opacity .3s;
  width: 0; opacity: 0;
}

.tip {
  font-size: 12px;
  color: var(--ink3);
  margin-top: 10px;
  line-height: 1.6;
}
.code {
  background: #0D211B;
  color: #9FEBCB;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
  padding: 11px 13px;
  border-radius: 12px;
  overflow-x: auto;
  white-space: pre;
  margin-top: 8px;
  line-height: 1.65;
}
