/* ============================================================
   HOME ASSISTANT DASHBOARD
   Premium dark glass UI
   ============================================================ */

* {
  box-sizing: border-box;
}


:root {
  --bg: #070a0f;
  --surface: rgba(18, 23, 31, .78);
  --surface-strong: rgba(22, 28, 38, .92);
  --border: rgba(255, 255, 255, .075);
  --border-hover: rgba(255, 255, 255, .16);

  --text: #f4f7fb;
  --muted: #8792a3;
  --muted2: #5f6978;

  --blue: #68a9ff;
  --cyan: #55d6e8;
  --green: #5ddd91;
  --orange: #ffb45c;
  --red: #ff6975;
  --purple: #aa8cff;

  --radius: 22px;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "SF Pro Text",
    "Segoe UI",
    sans-serif;

  color: var(--text);

  background:
    radial-gradient(
      900px 500px at 8% -10%,
      rgba(74, 137, 255, .18),
      transparent 65%
    ),
    radial-gradient(
      700px 500px at 100% 8%,
      rgba(85, 214, 232, .09),
      transparent 65%
    ),
    radial-gradient(
      700px 600px at 50% 100%,
      rgba(120, 90, 255, .06),
      transparent 70%
    ),
    var(--bg);

  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;

  pointer-events: none;

  background-image:
    linear-gradient(
      rgba(255,255,255,.012) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255,255,255,.012) 1px,
      transparent 1px
    );

  background-size: 40px 40px;

  mask-image: linear-gradient(
    to bottom,
    black,
    transparent 80%
  );
}

.app {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 32px 32px 20px;
}

/* ============================================================
   TOP BAR
   ============================================================ */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 28px;
}

.eyebrow {
  color: var(--blue);

  font-size: 10px;
  font-weight: 800;
  letter-spacing: .22em;

  margin-bottom: 5px;
}

h1 {
  margin: 0;

  font-size: clamp(34px, 4vw, 48px);
  line-height: 1;

  letter-spacing: -.055em;
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  position: relative;

  display: flex;
  justify-content: space-between;
  align-items: center;

  min-height: 170px;
  padding: 34px 38px;

  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: 28px;

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,.085),
      rgba(255,255,255,.025)
    );

  box-shadow:
    0 25px 80px rgba(0,0,0,.30),
    inset 0 1px 0 rgba(255,255,255,.035);

  backdrop-filter: blur(24px);

  margin-bottom: 42px;
}

.hero::before {
  content: "";

  position: absolute;

  width: 400px;
  height: 400px;

  left: -160px;
  top: -240px;

  border-radius: 50%;

  background:
    radial-gradient(
      circle,
      rgba(104,169,255,.20),
      transparent 70%
    );

  pointer-events: none;
}

.hero-label {
  position: relative;

  color: var(--muted);

  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
}

.hero-value {
  position: relative;

  margin-top: 8px;

  font-size: clamp(36px, 4vw, 50px);
  line-height: 1;

  font-weight: 750;

  letter-spacing: -.055em;
}

.hero-time {
  position: relative;

  font-size: 30px;
  font-weight: 500;

  color: var(--muted);

  font-variant-numeric: tabular-nums;
}

/* ============================================================
   STATUS
   ============================================================ */

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;

  margin: -26px 0 42px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;

  min-height: 32px;
  padding: 7px 11px;

  border: 1px solid var(--border);
  border-radius: 999px;

  background: rgba(18, 23, 31, .72);

  box-shadow:
    0 8px 24px rgba(0,0,0,.14),
    inset 0 1px 0 rgba(255,255,255,.025);

  backdrop-filter: blur(18px);
}

.status-pill-label {
  color: var(--muted);

  font-size: 11px;
  font-weight: 650;
}

.status-pill-value {
  color: var(--text);

  font-size: 11px;
  font-weight: 750;
}

.status-pill--positive {
  border-color: rgba(93,221,145,.18);
}

.status-pill--positive .status-pill-value {
  color: var(--green);
}

.status-pill--warning {
  border-color: rgba(255,180,92,.18);
}

.status-pill--warning .status-pill-value {
  color: var(--orange);
}

.status-pill--negative {
  border-color: rgba(255,105,117,.18);
}

.status-pill--negative .status-pill-value {
  color: var(--red);
}

.status-pill--neutral .status-pill-value {
  color: var(--muted);
}

/* ============================================================
   SECTIONS
   ============================================================ */

section {
  margin-bottom: 42px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 12px;

  margin-bottom: 16px;

  font-size: 21px;
  font-weight: 750;

  letter-spacing: -.025em;
}

.section-subtitle {
  color: var(--muted2);

  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   GRIDS
   ============================================================ */

.dashboard-grid {
  display: grid;
  gap: 13px;
}

.environment-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.appliance-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.garden-grid {
  grid-template-columns:
    2fr
    repeat(3, minmax(0, 1fr));
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  position: relative;

  overflow: hidden;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.065),
      rgba(255,255,255,.018)
    );

  box-shadow:
    0 14px 45px rgba(0,0,0,.20),
    inset 0 1px 0 rgba(255,255,255,.025);

  backdrop-filter: blur(18px);

  transition:
    transform .2s ease,
    border-color .2s ease,
    box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-3px);

  border-color: var(--border-hover);

  box-shadow:
    0 20px 55px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(255,255,255,.04);
}

/* ============================================================
   METRICS
   ============================================================ */

.metric-card {
  min-height: 176px;
  padding: 22px;
}

.metric-icon {
  width: 42px;
  height: 42px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 18px;

  border-radius: 14px;

  background: rgba(255,255,255,.055);

  font-size: 21px;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04);
}

.metric-label {
  color: var(--muted);

  font-size: 12px;
  font-weight: 650;

  letter-spacing: .01em;
}

.metric-value {
  display: inline-block;

  margin-top: 5px;

  font-size: 39px;
  line-height: 1;

  font-weight: 750;

  letter-spacing: -.055em;

  font-variant-numeric: tabular-nums;
}

.metric-unit {
  display: inline-block;

  margin-left: 5px;

  color: var(--muted2);

  font-size: 13px;
  font-weight: 600;
}

/* ============================================================
   ENERGY FLOW
   ============================================================ */

.energy-flow-card {
  min-height: 560px;
  padding: 26px;
}

.energy-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 4px;
}

.energy-flow-kicker {
  color: var(--blue);

  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}

.energy-flow-status {
  margin-top: 6px;

  color: var(--muted);

  font-size: 13px;
  font-weight: 600;
}

.energy-flow-svg {
  display: block;
  width: 100%;
  height: auto;

  margin-top: 8px;
}

.energy-flow-svg--mobile {
  display: none;
}

.energy-connector,
.energy-flow {
  fill: none;
  stroke-linecap: round;
}

.energy-connector {
  stroke: rgba(104,169,255,.22);
  stroke-width: 4;
}

.energy-flow {
  stroke: rgba(255,255,255,.10);
  stroke-width: 5;
  stroke-dasharray: 2 16;
  transition:
    stroke .3s ease,
    opacity .3s ease;
}

.energy-flow.is-active {
  stroke: var(--cyan);

  filter: drop-shadow(0 0 5px rgba(85,214,232,.75));

  animation: energy-flow 1.1s linear infinite;
}

.energy-node rect {
  fill: rgba(18, 23, 31, .82);
  stroke: rgba(255,255,255,.09);
  stroke-width: 1.5;
}

.energy-node--solar rect {
  fill: rgba(255,180,92,.08);
  stroke: rgba(255,180,92,.20);
}

.energy-node--combiner rect {
  fill: rgba(104,169,255,.10);
  stroke: rgba(104,169,255,.24);
}

.energy-node--battery rect {
  fill: rgba(170,140,255,.08);
  stroke: rgba(170,140,255,.20);
}

.energy-node text {
  text-anchor: middle;
}

.energy-node-icon {
  font-size: 20px;
}

.energy-node-label {
  fill: var(--muted);

  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

.energy-node-subtitle {
  fill: var(--blue);

  font-size: 13px;
  font-weight: 750;
  letter-spacing: .08em;
}

.energy-node-value {
  fill: var(--text);

  font-size: 14px;
  font-weight: 750;
}

.energy-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 13px;

  margin-top: 13px;
}

.energy-summary-card {
  min-height: 104px;
  padding: 18px;
}

.energy-summary-card span {
  display: block;

  color: var(--muted);

  font-size: 11px;
  font-weight: 650;
}

.energy-summary-card strong {
  display: block;

  margin-top: 10px;

  color: var(--text);

  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.025em;
}

@keyframes energy-flow {
  to {
    stroke-dashoffset: -18;
  }
}

/* ============================================================
   APPLIANCES
   ============================================================ */

.appliance-card {
  min-height: 250px;
  padding: 24px;
}

.appliance-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.appliance-icon {
  width: 48px;
  height: 48px;

  flex: 0 0 48px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 15px;

  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.10),
      rgba(255,255,255,.035)
    );

  font-size: 23px;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04);
}

.appliance-name {
  font-size: 17px;
  font-weight: 720;

  letter-spacing: -.02em;
}

.appliance-state {
  margin-top: 4px;

  color: var(--muted);

  font-size: 12px;
}

.program {
  margin-top: 29px;

  font-size: 21px;
  font-weight: 720;

  letter-spacing: -.025em;
}

.phase {
  margin-top: 6px;

  color: var(--muted);

  font-size: 13px;
}

.progress {
  height: 7px;

  margin-top: 25px;

  overflow: hidden;

  border-radius: 99px;

  background: rgba(255,255,255,.065);
}

.progress-bar {
  width: 0;
  height: 100%;

  border-radius: inherit;

  background:
    linear-gradient(
      90deg,
      var(--blue),
      var(--cyan),
      var(--green)
    );

  box-shadow:
    0 0 15px rgba(85,214,232,.25);

  transition: width .5s ease;
}

.remaining {
  margin-top: 10px;

  text-align: right;

  color: var(--muted);

  font-size: 12px;
}

/* ============================================================
   OVEN
   ============================================================ */

.oven-temperature {
  margin-top: 37px;

  font-size: 56px;
  line-height: 1;

  font-weight: 750;

  letter-spacing: -.065em;

  font-variant-numeric: tabular-nums;
}

.oven-temperature small {
  color: var(--muted);

  font-size: 17px;
  font-weight: 600;
}

/* ============================================================
   SUPPLIES
   ============================================================ */

.supplies-card {
  min-height: 250px;
  padding: 24px;
}

.supply-row {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 10px 0;

  border-bottom: 1px solid var(--border);

  color: var(--muted);

  font-size: 12px;
}

.supply-row:last-child {
  border-bottom: 0;
}

.supply-row strong {
  color: var(--text);

  font-size: 13px;

  font-variant-numeric: tabular-nums;
}

/* ============================================================
   MOWER
   ============================================================ */

.mower-card {
  padding: 24px;
}

.mower-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mower-icon {
  width: 55px;
  height: 55px;

  flex: 0 0 55px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 17px;

  background:
    rgba(93,221,145,.09);

  box-shadow:
    inset 0 0 0 1px rgba(93,221,145,.06);

  font-size: 28px;
}

.mower-state {
  margin-top: 4px;

  color: var(--green);

  font-size: 12px;
  font-weight: 650;
}

.battery {
  margin-left: auto;

  padding: 7px 10px;

  border-radius: 10px;

  background:
    rgba(93,221,145,.09);

  color: var(--green);

  font-size: 12px;
  font-weight: 750;
}

.mower-details {
  display: grid;
  grid-template-columns: 1fr 1fr;

  gap: 15px;

  margin-top: 29px;
}

.mower-details div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mower-details span {
  color: var(--muted);

  font-size: 11px;
}

.mower-details strong {
  font-size: 17px;
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  display: flex;
  justify-content: space-between;

  padding: 10px 4px 22px;

  color: var(--muted2);

  font-size: 10px;

  letter-spacing: .02em;
}

/* ============================================================
   AUTH
   ============================================================ */

#auth {
  display: flex;
  align-items: center;
  gap: 8px;
}

#auth button {
  border: 1px solid var(--border);

  border-radius: 11px;

  padding: 9px 13px;

  background: var(--surface-strong);
  color: var(--text);

  cursor: pointer;

  font-weight: 600;

  transition:
    background .2s ease,
    border-color .2s ease;
}

#auth button:hover {
  background: rgba(255,255,255,.08);
  border-color: var(--border-hover);
}

#loginForm {
  display: flex;
  gap: 7px;
}

#loginForm input {
  width: 130px;

  padding: 10px 11px;

  border: 1px solid var(--border);
  border-radius: 11px;

  outline: none;

  background: var(--surface-strong);
  color: var(--text);

  font: inherit;
}

#loginForm input:focus {
  border-color: rgba(104,169,255,.45);
  box-shadow: 0 0 0 3px rgba(104,169,255,.08);
}

#loginForm button {
  border: 0;

  border-radius: 11px;

  padding: 10px 15px;

  background:
    linear-gradient(
      135deg,
      #5799ff,
      #6aafff
    );

  color: white;

  font-weight: 700;

  cursor: pointer;
}

/* ============================================================
   HIDDEN
   ============================================================ */

.hidden {
  display: none !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1250px) {
  .environment-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .appliance-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .garden-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .energy-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .app {
    padding: 18px 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .hero {
    min-height: 135px;
    padding: 25px;
    border-radius: 23px;
  }

  .hero-time {
    font-size: 22px;
  }

  .environment-grid,
  .appliance-grid,
  .garden-grid {
    grid-template-columns: 1fr;
  }

  .energy-flow-card {
    min-height: 0;
    padding: 20px 14px;
  }

  .energy-flow-svg--desktop {
    display: none;
  }

  .energy-flow-svg--mobile {
    display: block;

    margin-top: 16px;
  }

  .energy-summary-grid {
    grid-template-columns: 1fr;
  }

  .energy-summary-card {
    min-height: 0;
  }

  .status-pills {
    margin-top: -30px;
  }

  .metric-card {
    min-height: 150px;
  }

  #loginForm {
    flex-wrap: wrap;
  }
}

/* ============================================================
   MOWER EXTRAS
   ============================================================ */

.mower-title {
  min-width: 0;
}

.mower-rain {
  color: var(--muted);
}

.mower-online {
  color: var(--muted2);

  font-size: 11px;
  font-weight: 600;
}

.mower-footer {
  display: flex;
  justify-content: flex-end;

  margin-top: 18px;

  padding-top: 12px;

  border-top: 1px solid var(--border);
}

/* 3D House styles */
.house-section {
  display:flex;
  justify-content:center;
  margin-bottom:42px;
}

.house-svg, .house-flow-svg {
  width:100%;
  max-width:400px;
  height:auto;
  display:block;
  margin:0 auto;
}

.panel {
  fill:#000; stroke:#111;stroke-width:.5;
  transition:filter .3s ease;
}
.panel.active {
  filter: drop-shadow(0 0 6px #55d6e8) drop-shadow(0 0 12px #55d6e8);
  animation: panelGlow 1.5s linear infinite;
}

@keyframes panelGlow {
  0% {filter:none;}
  50% {filter:drop-shadow(0 0 8px #55d6e8);}
  100% {filter:none;}
}

 .flow-solar-home,
.flow-home-to-grid,
.flow-grid-to-home {
  opacity:0;
  stroke:#55d6e8;
  stroke-width:2;
  fill:none;
  stroke-dasharray:4 4;
}

.flow-solar-home.active,
.flow-home-to-grid.active,
.flow-grid-to-home.active {
  opacity:1;
  animation:dashMove 1.5s linear infinite;
  filter: drop-shadow(0 0 4px #55d6e8);
}

@keyframes dashMove {
  0% {stroke-dashoffset:0;}
  100% {stroke-dashoffset:-8;}
}

/* End of 3D House styles */

.house-section {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}
