:root {
  --bg: #0b1220;
  --card: #131c31;
  --card2: #1b2540;
  --line: #26314f;
  --text: #e8edf7;
  --muted: #94a3c4;
  --accent: #4f7cff;
  --accent2: #3a63e0;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Tahoma, "Vazirmatn", sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #16223f 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 960px; margin: 0 auto; padding: 18px 16px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }

.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 700; cursor: pointer; color: #fff; background: var(--accent); transition: .15s; font-family: inherit; }
.btn:hover { background: var(--accent2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.red { background: var(--red); }
.btn.green { background: var(--green); }
.btn.amber { background: var(--amber); color: #1b1200; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

input, select, textarea {
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; width: 100%;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

.device { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s; }
.device:hover { border-color: var(--accent); transform: translateY(-2px); }
.device .name { font-weight: 800; font-size: 17px; margin-bottom: 8px; display:flex; align-items:center; gap:8px; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.pill.on { background: rgba(34,197,94,.15); color: #86efac; }
.pill.off { background: rgba(148,163,196,.15); color: var(--muted); }
.pill.locked { background: rgba(239,68,68,.15); color: #fca5a5; }
.pill.open { background: rgba(34,197,94,.15); color: #86efac; }
.meta { color: var(--muted); font-size: 12px; margin-top: 6px; }

.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login { width: 100%; max-width: 360px; }

.toast { position: fixed; bottom: 20px; right: 50%; transform: translateX(50%); background: #0f1830; border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; }
.toast.show { opacity: 1; bottom: 34px; }
.toast.err { border-color: var(--red); }

.window-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.window-row input[type=time] { width: 120px; }
.day-block { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.day-block .day-title { font-weight: 700; margin-bottom: 8px; }

.tag { display:inline-flex; align-items:center; gap:6px; background: var(--card2); border:1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: 12px; margin: 3px; }
.tag button { background: none; border: 0; color: var(--red); cursor: pointer; font-size: 14px; }
.tags { display:flex; flex-wrap: wrap; margin: 6px 0; }

.back { color: var(--accent); cursor: pointer; font-size: 14px; margin-bottom: 12px; display:inline-block; }
.enroll-box { background:#0f1830; border:1px dashed var(--line); border-radius:10px; padding:12px; font-family: monospace; font-size: 13px; word-break: break-all; }
.small { font-size: 12px; color: var(--muted); }
.section-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing:.5px; margin: 18px 0 8px; }
