:root {
  color-scheme: dark;
  --bg: #071521;
  --bg-soft: #0b2031;
  --panel: rgba(15, 42, 59, 0.72);
  --panel-strong: rgba(18, 49, 67, 0.92);
  --line: rgba(177, 218, 225, 0.14);
  --text: #f3f8f8;
  --muted: #98afb8;
  --mint: #83dfca;
  --mint-bright: #b1f1df;
  --gold: #ffc66c;
  --blue: #74b8ff;
  --violet: #b9a4ff;
  --danger: #ff8f8f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.26);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 14% 4%, rgba(39, 122, 132, .22), transparent 32rem),
    radial-gradient(circle at 88% 18%, rgba(53, 91, 146, .18), transparent 30rem),
    linear-gradient(160deg, #071521 0%, #0a1b29 48%, #07131d 100%);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
[hidden] { display: none !important; }

.ambient { position: fixed; width: 26rem; height: 26rem; border-radius: 50%; filter: blur(100px); opacity: .12; pointer-events: none; }
.ambient-one { background: var(--mint); left: -14rem; top: 30%; }
.ambient-two { background: var(--blue); right: -14rem; bottom: 3%; }

.glass-panel {
  background: linear-gradient(145deg, rgba(18, 48, 65, .86), rgba(11, 31, 45, .72));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.eyebrow { margin: 0 0 .65rem; color: var(--mint); font-size: .72rem; font-weight: 800; letter-spacing: .18em; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 27rem; min-width: 0; padding: 2.3rem; border-radius: 30px; position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; width: 12rem; height: 12rem; right: -5rem; top: -6rem; border-radius: 50%; background: rgba(131, 223, 202, .09); }
.login-mark, .brand-mark { color: var(--mint); }
.login-mark { width: 4rem; height: 4rem; display: grid; place-items: center; margin-bottom: 1.6rem; border: 1px solid rgba(131, 223, 202, .25); border-radius: 18px; background: rgba(131, 223, 202, .07); }
.login-mark svg, .brand-mark svg { width: 70%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.login-card h1 { font-size: clamp(2rem, 8vw, 3rem); line-height: 1; margin: 0; letter-spacing: -.05em; }
.login-copy { color: var(--muted); line-height: 1.7; margin: 1rem 0 1.8rem; }
.login-card label { display: block; color: #c8d5d9; font-size: .84rem; margin-bottom: .55rem; }
.password-wrap { position: relative; }
.password-wrap input { width: 100%; height: 3.45rem; padding: 0 4rem 0 1rem; color: var(--text); background: rgba(4, 16, 25, .55); border: 1px solid var(--line); border-radius: 14px; }
.password-wrap input::placeholder { color: #617782; }
.icon-button { position: absolute; right: .55rem; top: .55rem; height: 2.35rem; padding: 0 .65rem; color: var(--muted); border: 0; background: transparent; font-size: .8rem; }
.primary-button { width: 100%; height: 3.45rem; margin-top: 1rem; border: 0; border-radius: 14px; color: #06231e; background: linear-gradient(135deg, var(--mint-bright), var(--mint)); font-weight: 800; box-shadow: 0 12px 32px rgba(79, 194, 168, .2); }
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-button:disabled { opacity: .6; cursor: wait; transform: none; }
.form-error { min-height: 1.25rem; color: var(--danger); font-size: .84rem; margin: .75rem 0 0; }
.secure-note { display: flex; align-items: center; gap: .5rem; color: #69828b; font-size: .76rem; margin-top: .65rem; }
.secure-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px var(--mint); }

.dashboard { width: min(100% - 2rem, 1240px); margin: 0 auto; padding-bottom: 2rem; }
.topbar { min-height: 5.8rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .8rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 2.7rem; height: 2.7rem; display: grid; place-items: center; border-radius: 14px; background: rgba(131, 223, 202, .08); border: 1px solid rgba(131, 223, 202, .18); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .98rem; letter-spacing: .06em; }
.brand small { margin-top: .2rem; color: #65808b; font-size: .52rem; letter-spacing: .14em; }
.topbar-actions { display: flex; align-items: center; gap: .8rem; }
.status-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .75rem; color: var(--muted); background: rgba(9, 30, 43, .7); border: 1px solid var(--line); border-radius: 999px; font-size: .76rem; }
.status-badge span { width: .48rem; height: .48rem; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px currentColor; }
.status-badge.online span { background: var(--mint); }
.status-badge.offline span { background: var(--danger); }
.ghost-button, .page-button { padding: .62rem .9rem; color: #c4d1d5; background: rgba(12, 34, 48, .72); border: 1px solid var(--line); border-radius: 11px; }
.ghost-button:hover, .page-button:hover { border-color: rgba(131, 223, 202, .4); color: var(--text); }

.hero-section { min-height: 23rem; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; position: relative; overflow: hidden; }
.hero-copy { position: relative; z-index: 2; padding-left: clamp(0rem, 2vw, 1.5rem); }
.hero-copy h1 { max-width: 48rem; margin: 0; font-size: clamp(3rem, 7vw, 6.2rem); line-height: .95; letter-spacing: -.065em; }
.hero-copy h1 em { color: var(--mint-bright); font-style: normal; }
.last-updated { color: var(--muted); margin-top: 1.25rem; }
.hero-orbit { min-height: 22rem; position: relative; }
.sun-core { position: absolute; width: 8rem; height: 8rem; left: 48%; top: 44%; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff0c2, var(--gold) 42%, #ee9d47 100%); box-shadow: 0 0 55px rgba(255, 198, 108, .26), 0 0 120px rgba(255, 198, 108, .12); }
.orbit { position: absolute; left: 48%; top: 44%; border: 1px solid rgba(182, 222, 221, .17); border-radius: 50%; transform: translate(-50%, -50%) rotate(-14deg); }
.orbit-a { width: 15rem; height: 15rem; }
.orbit-b { width: 23rem; height: 11rem; }
.cloud-shape { position: absolute; height: 2.5rem; border-radius: 999px; background: rgba(199, 225, 228, .12); backdrop-filter: blur(8px); }
.cloud-shape::before, .cloud-shape::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.cloud-shape::before { width: 3.4rem; height: 3.4rem; left: 1.5rem; bottom: .3rem; }
.cloud-shape::after { width: 2.4rem; height: 2.4rem; right: 1.4rem; bottom: .5rem; }
.cloud-a { width: 9rem; left: 4%; top: 30%; }
.cloud-b { width: 8rem; right: 0; bottom: 18%; opacity: .55; }

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.metric-card { min-height: 12.5rem; padding: 1.35rem; border-radius: var(--radius); border: 1px solid var(--line); position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 11rem; height: 11rem; right: -6rem; bottom: -7rem; border-radius: 50%; background: currentColor; opacity: .07; }
.temperature-card { color: var(--gold); background: linear-gradient(145deg, rgba(80, 55, 34, .46), rgba(27, 39, 44, .8)); }
.pressure-card { color: var(--blue); background: linear-gradient(145deg, rgba(33, 66, 92, .5), rgba(19, 39, 51, .8)); }
.altitude-card { color: var(--mint); background: linear-gradient(145deg, rgba(27, 75, 67, .45), rgba(17, 42, 48, .82)); }
.metric-heading { display: flex; justify-content: space-between; align-items: center; color: #c8d7d9; font-size: .86rem; }
.metric-icon { width: 2.45rem; height: 2.45rem; display: grid; place-items: center; border-radius: 50%; color: currentColor; background: rgba(255, 255, 255, .055); font-size: .7rem; font-weight: 800; }
.metric-value { display: flex; align-items: baseline; gap: .35rem; margin-top: 1.55rem; }
.metric-value strong { color: var(--text); font-size: clamp(2.7rem, 5vw, 4.25rem); line-height: .9; letter-spacing: -.06em; }
.metric-value small { font-size: 1rem; color: currentColor; }
.metric-card p { color: #718a92; font-size: .78rem; margin: 1rem 0 0; }

.content-section, .history-section { padding-top: 5rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 1.2rem; }
.section-heading h2 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); letter-spacing: -.04em; }
.range-tabs { display: flex; padding: .28rem; background: rgba(8, 25, 36, .66); border: 1px solid var(--line); border-radius: 13px; }
.range-tab { min-height: 2.4rem; padding: 0 .9rem; color: var(--muted); border: 0; border-radius: 9px; background: transparent; font-size: .82rem; }
.range-tab.active { color: #09251f; background: var(--mint); font-weight: 800; }
.custom-range { display: flex; align-items: end; gap: .9rem; padding: 1rem; margin-bottom: 1rem; border-radius: 16px; }
.custom-range label { display: grid; gap: .45rem; color: var(--muted); font-size: .75rem; }
.custom-range input, .history-actions select { height: 2.65rem; padding: 0 .8rem; color: var(--text); background: rgba(5, 20, 30, .72); border: 1px solid var(--line); border-radius: 10px; color-scheme: dark; }
.primary-button.compact { width: auto; height: 2.65rem; margin: 0; padding: 0 1.1rem; }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.chart-card { min-width: 0; padding: 1.3rem; border-radius: var(--radius); }
.chart-wide { grid-column: 1 / -1; }
.chart-title, .chart-title > div { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.chart-title h3 { margin: 0; font-size: .95rem; }
.chart-title > strong { color: var(--muted); font-size: .75rem; font-weight: 500; }
.chart-dot { width: .55rem; height: .55rem; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.temp-dot { color: var(--gold); background: var(--gold); }
.pressure-dot { color: var(--blue); background: var(--blue); }
.alt-dot { color: var(--mint); background: var(--mint); }
.chart { min-height: 15rem; margin: .8rem -.4rem 0; }
.chart svg { width: 100%; height: 15rem; display: block; overflow: visible; }
.chart-empty { min-height: 15rem; display: grid; place-items: center; color: #647c84; font-size: .85rem; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.stat-row span { color: #6f8790; font-size: .7rem; }
.stat-row b { display: block; margin-top: .3rem; color: #d9e5e6; font-size: .82rem; }

.history-actions { display: flex; gap: .65rem; }
.table-shell { border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 1rem 1.15rem; text-align: left; border-bottom: 1px solid var(--line); }
th { color: #748c94; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
td { color: #c7d5d8; font-size: .82rem; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: rgba(131, 223, 202, .035); }
.empty-cell { height: 8rem; text-align: center; color: #617982; }
.reading-pill { display: inline-flex; min-width: 4.3rem; align-items: center; justify-content: center; padding: .35rem .55rem; border-radius: 8px; background: rgba(255, 255, 255, .045); }
.received { display: inline-flex; align-items: center; gap: .4rem; color: var(--mint); }
.received::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.pagination { min-height: 4rem; padding: .8rem 1.1rem; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.pagination > div { display: flex; gap: .5rem; }
.page-button:disabled { opacity: .35; cursor: not-allowed; }

footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 3rem .5rem 1rem; color: #526a74; font-size: .75rem; }
.text-button { color: #6e8992; border: 0; background: none; text-decoration: underline; text-underline-offset: 3px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%); padding: .8rem 1rem; color: #09251f; background: var(--mint-bright); border-radius: 12px; box-shadow: var(--shadow); font-weight: 700; font-size: .82rem; transition: transform .25s ease; }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .hero-section { min-height: 22rem; grid-template-columns: 1fr; }
  .hero-orbit { position: absolute; inset: 0 0 0 45%; opacity: .55; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .altitude-card { grid-column: 1 / -1; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-wide { grid-column: auto; }
  .range-heading { align-items: start; flex-direction: column; }
  .range-tabs { width: 100%; overflow-x: auto; }
  .range-tab { flex: 1 0 auto; }
}

@media (max-width: 560px) {
  .dashboard { width: min(100% - 1rem, 1240px); }
  .topbar { min-height: 4.7rem; }
  .brand small, .status-badge { display: none; }
  .brand strong { font-size: .9rem; }
  .brand-mark { width: 2.35rem; height: 2.35rem; }
  .ghost-button { padding: .55rem .72rem; }
  .hero-section { min-height: 18.5rem; }
  .hero-copy h1 { font-size: clamp(2.7rem, 15vw, 4.2rem); }
  .hero-orbit { inset: 0 0 0 35%; transform: scale(.8); }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .metric-card { min-height: 10.6rem; padding: 1rem; border-radius: 18px; }
  .altitude-card { grid-column: 1 / -1; min-height: 9.5rem; }
  .metric-value strong { font-size: 2.6rem; }
  .metric-heading { font-size: .76rem; }
  .content-section, .history-section { padding-top: 3.7rem; }
  .section-heading { align-items: start; flex-direction: column; }
  .custom-range { align-items: stretch; flex-direction: column; }
  .custom-range label, .custom-range input, .primary-button.compact { width: 100%; }
  .chart-card { padding: 1rem; border-radius: 18px; }
  .chart, .chart svg { min-height: 13rem; height: 13rem; }
  .history-actions { width: 100%; }
  .history-actions select { flex: 1; min-width: 0; }
  footer { align-items: flex-start; flex-direction: column; }
  .login-card { padding: 1.6rem; border-radius: 24px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .login-shell { align-items: start; padding-block: .7rem; }
  .login-card { padding: 1.2rem 1.5rem; }
  .login-mark { width: 2.7rem; height: 2.7rem; margin-bottom: .8rem; }
  .login-copy { margin: .6rem 0 .9rem; }
  .hero-section { min-height: 15rem; }
  .hero-copy h1 { font-size: 3.5rem; }
  .hero-orbit { transform: scale(.7); }
}

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

