:root {
  color-scheme: dark;
  --bg: #070b13;
  --panel: rgba(18, 25, 39, 0.78);
  --panel-solid: #111827;
  --line: rgba(148, 163, 184, 0.17);
  --text: #f3f6fb;
  --muted: #95a3b8;
  --accent: #57e6bd;
  --accent-2: #56a8ff;
  --danger: #ff8585;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body { min-height: 100vh; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 18%, rgba(25, 150, 130, .18), transparent 27rem),
    radial-gradient(circle at 83% 22%, rgba(47, 110, 205, .16), transparent 26rem),
    linear-gradient(135deg, #070b13 0%, #090e18 52%, #070b13 100%);
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.hidden { display: none !important; }

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 430px);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(13, 19, 31, .82);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .44);
  backdrop-filter: blur(22px);
}

.portal-mark {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  padding: 13px;
  margin-bottom: 27px;
  border: 1px solid rgba(87, 230, 189, .35);
  border-radius: 16px;
  background: rgba(87, 230, 189, .08);
}

.portal-mark span {
  width: 6px;
  border-radius: 8px;
  background: var(--accent);
}
.portal-mark span:nth-child(1) { height: 13px; opacity: .58; }
.portal-mark span:nth-child(2) { height: 25px; }
.portal-mark span:nth-child(3) { height: 18px; opacity: .78; }

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

h1, h2, p { margin-top: 0; }
.login-card h1 { margin-bottom: 27px; font-size: clamp(28px, 6vw, 36px); letter-spacing: -.035em; }

label {
  display: block;
  margin: 17px 0 8px;
  color: #c7d0dd;
  font-size: 13px;
  font-weight: 650;
}

input {
  width: 100%;
  height: 50px;
  border: 1px solid #2a3548;
  border-radius: 12px;
  outline: none;
  background: #0b111d;
  color: white;
  padding: 0 14px;
  transition: border-color .18s, box-shadow .18s;
}

input:focus {
  border-color: rgba(87, 230, 189, .72);
  box-shadow: 0 0 0 3px rgba(87, 230, 189, .1);
}

input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }

.eye-button {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: #93a3b7;
  background: transparent;
  cursor: pointer;
}
.eye-button:hover { color: white; background: rgba(255,255,255,.055); }
.eye-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.eye-closed { display: none; }
.eye-button.showing .eye-open { display: none; }
.eye-button.showing .eye-closed { display: block; }

.form-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.primary-button {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  color: #04110d;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}
.primary-button:hover { filter: brightness(1.06); }
.primary-button:disabled { opacity: .58; cursor: wait; }

.dashboard {
  position: relative;
  width: min(1180px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
}

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: white;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -.01em;
}
.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 24px var(--accent);
}

.account { display: flex; align-items: center; gap: 16px; }
.account strong { color: #ccd5e2; font-size: 13px; }

.quiet-button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #ccd5e2;
  background: rgba(255,255,255,.025);
  cursor: pointer;
}
.quiet-button:hover { background: rgba(255,255,255,.07); }

.admin-link {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid rgba(87,230,189,.25);
  border-radius: 11px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  background: rgba(87,230,189,.06);
}

.portal-groups { display: grid; gap: 42px; padding-top: 46px; }
.device-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 17px;
  color: #c8d2df;
  font-size: 13px;
  font-weight: 700;
}
.device-heading::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.ai-card {
  min-height: 146px;
  display: flex;
  flex-direction: column;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--text);
  background: linear-gradient(145deg, rgba(21,29,44,.86), rgba(12,18,29,.82));
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.ai-card:hover {
  transform: translateY(-3px);
  border-color: rgba(87,230,189,.38);
  background: linear-gradient(145deg, rgba(24,35,49,.96), rgba(13,21,33,.94));
}

.card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.ai-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(86,168,255,.23);
  border-radius: 12px;
  color: #a8d1ff;
  background: rgba(86,168,255,.08);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .03em;
}
.card-arrow { color: #67758a; transition: color .18s, transform .18s; }
.ai-card:hover .card-arrow { color: var(--accent); transform: translate(2px, -2px); }
.ai-card h3 { margin: auto 0 0; font-size: 20px; letter-spacing: -.025em; }

.empty-state {
  padding: 74px 20px;
  border: 1px dashed #2b3749;
  border-radius: 18px;
  text-align: center;
  background: rgba(14,21,33,.55);
}
.empty-state h2 { margin: 0; color: var(--muted); font-size: 18px; }

@media (max-width: 920px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .login-card { padding: 31px 24px; border-radius: 20px; }
  .dashboard { width: min(100% - 26px, 1180px); }
  .topbar { height: 67px; }
  .card-grid { grid-template-columns: 1fr; }
  .ai-card { min-height: 132px; }
  .portal-groups { gap: 38px; }
}
