/* DIOIOT UI – Global CSS (theme + responsive) */

:root{
  --purple:#7c3aed;
  --accent:#22c1d2;
  --accent2:#1a4bb8;
  --radius:16px;
  --radiusLg:18px;

  --L-bg:#f5f6fb;
  --L-card:#ffffff;
  --L-line:#e7e7ef;
  --L-text:#111827;
  --L-muted:#6b7280;

  --D-bg:#070a10;
  --D-top:#0a0d14;
  --D-card:#151a24;
  --D-line:rgba(255,255,255,.10);
  --D-text:#e5e7eb;
  --D-muted:rgba(229,231,235,.55);
}

*{box-sizing:border-box}

html[data-theme="light"]{
  --bg: var(--L-bg);
  --card: var(--L-card);
  --line: var(--L-line);
  --text: var(--L-text);
  --muted: var(--L-muted);

  --sideBg:#ffffff;
  --sideLine: var(--L-line);
  --navText:#4b5563;
  --navActiveBg:#f2eaff;
  --navActiveText: var(--purple);
}

html[data-theme="dark"]{
  --bg: var(--D-bg);
  --card: var(--D-card);
  --line: var(--D-line);
  --text: var(--D-text);
  --muted: var(--D-muted);

  --sideBg:#0b0f18;
  --sideLine: rgba(255,255,255,.10);
  --navText: rgba(229,231,235,.75);
  --navActiveBg: rgba(124,58,237,.18);
  --navActiveText:#ffffff;
}

body{
  margin:0;
  font-family: "Lato", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  color: var(--text);
}

.topbar{
  height:56px;
  background: var(--purple);
  color:#fff;
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 16px;
  position:sticky; top:0; z-index:50;
}
.brand{display:flex;align-items:center;gap:10px;font-weight:900;letter-spacing:.2px}
.brand img{height:26px;width:auto;display:block}
.spacer{flex:1}
.chip{
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.22);
  padding:8px 12px;
  border-radius: 12px;
  font-size: 13px;
  display:flex; gap:8px; align-items:center;
  white-space:nowrap;
  cursor:pointer;
  user-select:none;
}

.wrap{display:flex; min-height: calc(100vh - 56px);}
.sidebar{
  width:72px;
  background: var(--sideBg);
  border-right: 1px solid var(--sideLine);
  padding:12px 0;
  display:flex; flex-direction:column;
  align-items:center; gap:10px;
}
.navbtn{
  width:46px;height:46px;border-radius:14px;
  display:grid;place-items:center;
  text-decoration:none;
  color: var(--navText);
  font-size:18px;
}
.navbtn.active{
  background: var(--navActiveBg);
  color: var(--navActiveText);
}
.content{flex:1; padding:18px;}

.pageTitle{
  font-size:20px;font-weight:900;margin: 2px 0 12px;
  display:flex;align-items:center;gap:10px;
}
.drop{font-size:14px;color:var(--muted);font-weight:800}

.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radiusLg);
  padding:14px;
}

.mTop{display:none;}
.bottomnav{display:none;}

@media (max-width: 900px){
  .topbar{ display:none; }
  .sidebar{ display:none; }
  .content{ padding:14px; padding-bottom:92px; }

  .mTop{
    display:flex;
    position:sticky; top:0; z-index:60;
    padding: 14px 14px 10px;
    backdrop-filter: blur(10px);
  }
  html[data-theme="dark"] .mTop{
    background: linear-gradient(180deg, rgba(10,13,20,.92) 0%, rgba(10,13,20,.60) 70%, rgba(10,13,20,0) 100%);
  }
  html[data-theme="light"] .mTop{
    background: linear-gradient(180deg, rgba(245,246,251,.95) 0%, rgba(245,246,251,.70) 70%, rgba(245,246,251,0) 100%);
  }

  .mTopInner{
    width:100%;
    display:flex; align-items:center; justify-content:space-between; gap:12px;
  }
  .plantBtn{
    display:flex; flex-direction:column; gap:2px;
    text-decoration:none;
    max-width: 62vw;
    color: var(--text);
  }
  .plantBtn .name{
    font-weight:900; font-size:16px; line-height:1.1;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .plantBtn .sub{ font-size:12px; font-weight:800; color: var(--muted); }

  .icons{display:flex; gap:10px; align-items:center}
  .iconbtn{
    width:40px;height:40px;border-radius:14px;
    display:grid;place-items:center;
    text-decoration:none;
    user-select:none;
  }
  html[data-theme="dark"] .iconbtn{
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.06);
    color:#fff;
  }
  html[data-theme="light"] .iconbtn{
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(255,255,255,.70);
    color:#111827;
  }

  .bottomnav{
    position:fixed; left:0; right:0; bottom:0;
    height:76px;
    display:flex; align-items:center; justify-content:space-around;
    z-index:70;
    backdrop-filter: blur(10px);
  }
  html[data-theme="dark"] .bottomnav{
    background: var(--D-top);
    border-top: 1px solid var(--D-line);
  }
  html[data-theme="light"] .bottomnav{
    background: rgba(255,255,255,.88);
    border-top: 1px solid rgba(0,0,0,.08);
  }

  .bitem{
    text-decoration:none;
    font-size:12px;
    display:flex; flex-direction:column; align-items:center; gap:6px;
    min-width:64px;
  }
  html[data-theme="dark"] .bitem{ color:#9ca3af; }
  html[data-theme="dark"] .bitem.active{ color:#fff; }
  html[data-theme="light"] .bitem{ color:#6b7280; }
  html[data-theme="light"] .bitem.active{ color:#111827; }
  .bicon{font-size:20px;line-height:1}
}

/* Modals */
.overlay{
  position:fixed; inset:0;
  background: rgba(0,0,0,.45);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:999;
  padding: 16px;
}
.overlay.show{ display:flex; }

.modal{
  width: min(560px, 92vw);
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 30px 90px rgba(0,0,0,.25);
}
.modalHead{
  padding: 14px 14px;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  border-bottom: 1px solid var(--line);
}
.modalTitle{ font-weight:900; }
.xbtn{
  width:40px;height:40px;border-radius:12px;
  border:1px solid var(--line);
  background: transparent;
  cursor:pointer;
  display:grid;place-items:center;
  font-weight:900;
  color: var(--text);
}
.modalBody{ padding: 14px; }
.list{ display:grid; gap:10px; }
.rowItem{
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.55);
  cursor:pointer;
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  font-weight:800;
  color: var(--text);
}
html[data-theme="dark"] .rowItem{ background: rgba(255,255,255,.04); }
.rowItem small{ font-weight:800; color: var(--muted); }

.searchInput{
  width:100%;
  height:52px;
  border-radius: 14px;
  border:1px solid var(--line);
  padding: 0 14px;
  font-weight:800;
  outline:none;
  background: transparent;
  color: var(--text);
}

/* ===== Auth / Login ===== */
.guest-body{ min-height:100vh; }

.auth-bg{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.auth-card{
  width:100%;
  max-width:420px;
  border-radius:18px;
  padding:22px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  backdrop-filter: blur(6px);
}

.auth-logo{
  display:flex;
  justify-content:center;
  margin-bottom:14px;
}
.auth-logo img{
  max-width:220px;
  height:auto;
}

.auth-form{ display:flex; flex-direction:column; gap:10px; }
.auth-input{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.12);
  outline:none;
}
.auth-btn{
  padding:12px 14px;
  border-radius:12px;
  border:0;
  cursor:pointer;
  font-weight:700;
}
