/* ===================================================
   SmartX v5 — استایل اصلی
   سبز | روشن/تاریک | RTL و LTR (با ویژگی‌های منطقی) | ریسپانسیو
   =================================================== */

:root {
  --primary: #16a34a;
  --primary-dark: #0f7d38;
  --primary-light: #22c55e;
  --primary-soft: #e7f8ee;
  --bg: #f2f6f4;
  --card-bg: #ffffff;
  --card-alt: #f7faf8;
  --text-main: #17261d;
  --text-muted: #667a6f;
  --border-color: #e2ebe5;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #d97706;
  --warn-soft: #fff4e0;
  --shadow: 0 1px 3px rgba(20, 60, 35, 0.06), 0 6px 18px rgba(20, 60, 35, 0.05);
  --shadow-lg: 0 10px 30px rgba(20, 60, 35, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 268px;
  --input-bg: #ffffff;
  --sidebar-grad: linear-gradient(185deg, #0b5d2b 0%, #0f7d38 45%, #16a34a 100%);
}

[data-theme="dark"] {
  --primary-soft: #14301f;
  --bg: #0d1511;
  --card-bg: #15201a;
  --card-alt: #1a2720;
  --text-main: #e6f1ea;
  --text-muted: #93a79b;
  --border-color: #25352c;
  --danger-soft: #3a1717;
  --warn-soft: #3a2a10;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --input-bg: #101a15;
  --sidebar-grad: linear-gradient(185deg, #07351a 0%, #0b5d2b 55%, #0f7d38 100%);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button, input, select { font-family: inherit; font-size: inherit; }
h1, h2, h3, p { margin: 0; }
code { background: var(--card-alt); border: 1px solid var(--border-color); padding: 1px 6px; border-radius: 6px; font-size: 13px; direction: ltr; unicode-bidi: embed; }

/* ===== سایدبار ===== */
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-grad);
  color: #fff;
  padding: 22px 14px 14px;
  padding-top: calc(22px + env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.28s ease;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; margin-bottom: 22px; }
.brand-logo {
  background: #fff; color: var(--primary-dark);
  font-weight: 800; font-size: 16px; letter-spacing: 0.5px;
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}
.brand-logo-lg { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-size: 20px; font-weight: 600; }
.brand-name b { font-weight: 800; }
.brand-tag { font-size: 11.5px; opacity: 0.75; }

.nav-menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px;
  opacity: 0.6; padding: 14px 12px 6px; font-weight: 600;
}
.nav-menu a, .nav-logout {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14.5px; font-weight: 500;
  transition: background 0.15s, transform 0.15s;
}
.nav-menu a:hover, .nav-logout:hover { background: rgba(255, 255, 255, 0.12); }
.nav-menu a.active { background: rgba(255, 255, 255, 0.24); font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); }
.nav-icon { font-size: 17px; width: 24px; text-align: center; flex-shrink: 0; }

.logout-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.2); }
.nav-logout { width: 100%; border: 0; background: transparent; cursor: pointer; color: #ffe1e1; text-align: start; }

/* ===== بدنه اصلی ===== */
.main-content { margin-inline-start: var(--sidebar-w); min-height: 100%; display: flex; flex-direction: column; }
.content-inner { padding: 24px 28px 8px; flex: 1; width: 100%; max-width: 1280px; }

.topbar {
  background: var(--card-bg);
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 28px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.topbar-start, .topbar-end { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { font-size: 19px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { font-size: 13.5px; color: var(--text-muted); font-weight: 500; background: var(--card-alt); border: 1px solid var(--border-color); padding: 5px 12px; border-radius: 999px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border-color);
  background: var(--card-alt); color: var(--text-main); cursor: pointer; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.icon-btn:hover { background: var(--primary-soft); }
.menu-toggle { display: none; }

.lang-switch { display: inline-flex; background: var(--card-alt); border: 1px solid var(--border-color); border-radius: 11px; padding: 3px; gap: 2px; }
.lang-switch a { padding: 4px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.lang-switch a.active { background: var(--primary); color: #fff; }

.overlay { display: none; position: fixed; inset: 0; background: rgba(5, 20, 12, 0.55); z-index: 35; }
.overlay.show { display: block; }

.page-footer { text-align: center; color: var(--text-muted); font-size: 12.5px; padding: 18px 20px 24px; }

/* ===== کارت‌ها ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.section-head .section-title { margin-bottom: 0; }
.section-gap { margin-top: 8px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--text-muted); font-size: 13.5px; margin-top: 10px; }
.hint-box {
  background: var(--primary-soft); border: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent);
  color: var(--text-main); border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px; margin-top: 14px;
}
.link-more { color: var(--primary); font-size: 13.5px; font-weight: 600; }
.back-link { display: inline-block; color: var(--primary); font-weight: 600; margin-bottom: 14px; font-size: 14px; }
.form-gap { margin-top: 16px; }
.nowrap { white-space: nowrap; }

.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.hello h2 { font-size: 22px; font-weight: 800; }
.hello p { color: var(--text-muted); font-size: 13.5px; }

/* ===== کارت‌های آماری ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card .stat-grid { margin-bottom: 0; }
.stat-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card-bg); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card .stat-card { background: var(--card-alt); box-shadow: none; }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.tone-green  { background: #dcfce7; } .tone-amber { background: #fef3c7; } .tone-blue { background: #dbeafe; }
.tone-red    { background: #fee2e2; } .tone-purple { background: #ede9fe; } .tone-teal { background: #ccfbf1; }
[data-theme="dark"] .tone-green  { background: #14532d; } [data-theme="dark"] .tone-amber { background: #5b3f0a; }
[data-theme="dark"] .tone-blue   { background: #1e3a6b; } [data-theme="dark"] .tone-red   { background: #6b1d1d; }
[data-theme="dark"] .tone-purple { background: #3b2a6b; } [data-theme="dark"] .tone-teal  { background: #0f4a45; }
.stat-value { font-size: 20px; font-weight: 800; line-height: 1.3; direction: ltr; unicode-bidi: plaintext; }
[dir="rtl"] .stat-value { direction: rtl; }
.stat-label { color: var(--text-muted); font-size: 13px; }

.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.two-col .card { margin-bottom: 18px; }

/* ===== نمودار ===== */
.chart-wrap { width: 100%; overflow-x: auto; }
.chart { width: 100%; max-width: 620px; margin-inline: auto; height: auto; display: block; direction: ltr; }
.chart-grid { stroke: var(--border-color); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-bar { fill: var(--primary); }
.chart-bar:hover { fill: var(--primary-light); }
.chart-val { fill: var(--text-muted); font-size: 12px; font-weight: 600; font-family: inherit; }
.chart-lbl { fill: var(--text-muted); font-size: 15px; font-family: inherit; }

/* ===== بخش‌ها (گرید) ===== */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.area-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px;
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius);
  padding: 20px 14px; box-shadow: var(--shadow);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.card .area-card { background: var(--card-alt); box-shadow: none; }
.area-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.area-icon { font-size: 34px; line-height: 1.2; }
.area-name { font-weight: 700; font-size: 15px; }
.area-sub { color: var(--text-muted); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #9ca3af; }
.dot-on { background: var(--primary-light); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-light) 28%, transparent); }

/* ===== تجهیزات و سنسورها ===== */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.device-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card-alt); border: 1px solid var(--border-color);
  border-radius: var(--radius); padding: 14px 16px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.device-card.on {
  background: linear-gradient(160deg, var(--primary-soft), var(--card-alt));
  border-color: color-mix(in srgb, var(--primary) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-light) 14%, transparent);
}
.sensor-card.on { background: var(--card-alt); border-color: var(--border-color); box-shadow: none; }
.device-head { display: flex; justify-content: space-between; align-items: center; }
.device-ico { font-size: 28px; line-height: 1; }
.device-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.device-name { font-weight: 700; overflow-wrap: anywhere; }
.device-type { color: var(--text-muted); font-size: 12.5px; }
.device-sub { color: var(--text-muted); font-size: 11.5px; }

/* منوی سه‌نقطه */
.item-menu { position: relative; }
.item-menu summary { list-style: none; cursor: pointer; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-muted); user-select: none; }
.item-menu summary::-webkit-details-marker { display: none; }
.item-menu summary:hover, .item-menu[open] summary { background: var(--border-color); }
.item-menu-pop {
  position: absolute; inset-inline-end: 0; top: 34px; z-index: 15; width: 220px;
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.menu-form { display: flex; flex-direction: column; gap: 6px; }
.menu-note { color: var(--text-muted); font-size: 12px; text-align: center; }

/* ===== کلید روشن/خاموش ===== */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.slider { position: absolute; inset: 0; cursor: pointer; background: #c7d2cc; border-radius: 28px; transition: background 0.25s; }
[data-theme="dark"] .slider { background: #3a4a41; }
.slider::before {
  content: ''; position: absolute; width: 22px; height: 22px; top: 3px; inset-inline-start: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.25s; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }
[dir="rtl"] .switch input:checked + .slider::before { transform: translateX(-22px); }
.switch input:focus-visible + .slider { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 2px; }
.switch-lg { width: 64px; height: 34px; }
.switch-lg .slider { border-radius: 34px; }
.switch-lg .slider::before { width: 28px; height: 28px; top: 3px; inset-inline-start: 3px; }
.switch-lg input:checked + .slider::before { transform: translateX(30px); }
[dir="rtl"] .switch-lg input:checked + .slider::before { transform: translateX(-30px); }

/* ===== فرم‌ها ===== */
.form-stack { display: flex; flex-direction: column; gap: 8px; }
.form-stack.narrow { max-width: 440px; }
.form-stack label { font-weight: 600; font-size: 13.5px; margin-top: 4px; }
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { color: var(--text-muted); font-size: 12.5px; }
input[type="text"], input[type="password"], input[type="number"], input[type="time"], input[type="email"], select {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--text-main); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.inline-form input[type="text"] { flex: 1 1 200px; width: auto; }
.inline-form select { flex: 0 1 180px; width: auto; }
.rename-form { display: flex; gap: 8px; align-items: center; }
.rename-form input { width: 190px; padding: 6px 11px; }

/* انتخاب‌گر چیپی (تجهیزات / روزهای هفته) */
.chip-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 6px 14px; border: 1px solid var(--border-color); border-radius: 999px; background: var(--card-alt); font-size: 13.5px; font-weight: 500; transition: all 0.15s; }
.chip:hover span { border-color: var(--primary); }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); }

/* ===== دکمه‌ها ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 700; cursor: pointer; transition: all 0.15s; white-space: nowrap; line-height: 1.4;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-ghost { background: var(--card-alt); border-color: var(--border-color); color: var(--text-main); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-light { background: #fff; color: #b91c1c; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 2px; }

/* ===== نشان‌ها (badge) ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-soft { background: var(--card-alt); border: 1px solid var(--border-color); color: var(--text-muted); font-weight: 600; }
.badge-online { background: #dcfce7; color: #166534; }
.badge-offline { background: #fee2e2; color: #991b1b; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
[data-theme="dark"] .badge-online { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .badge-offline { background: #6b1d1d; color: #fecaca; }

/* ===== لیست‌های ردیفی ===== */
.row-list { display: flex; flex-direction: column; gap: 10px; }
.row-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--card-alt); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px 14px; }
.row-main { min-width: 0; }
.row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.row-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.empty-state { text-align: center; color: var(--text-muted); padding: 22px 10px; }
.empty-state span { font-size: 34px; display: block; margin-bottom: 4px; opacity: 0.8; }

/* ===== جدول ===== */
.table-scroll { overflow-x: auto; border: 1px solid var(--border-color); border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border-color); }
.data-table th { background: var(--card-alt); color: var(--text-muted); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--card-alt); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; color: var(--text-muted); font-size: 13.5px; }

/* ===== لیست فعالیت ===== */
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.activity-list li { display: flex; gap: 10px; align-items: flex-start; }
.activity-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 8px; flex-shrink: 0; }
.activity-text { font-size: 14px; }
.activity-meta { color: var(--text-muted); font-size: 12px; }

/* ===== چک‌لیست امنیتی ===== */
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.check-list li.ok { background: var(--primary-soft); }
.check-list li.bad { background: var(--warn-soft); }
.check-mark { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.check-list .ok .check-mark { background: var(--primary); color: #fff; }
.check-list .bad .check-mark { background: var(--warn); color: #fff; }
.key-box { margin-top: 14px; }
.key-box summary { cursor: pointer; font-weight: 700; color: var(--primary); }

.code-block { margin-top: 12px; background: #0f1b15; color: #d1fae5; border-radius: var(--radius-sm); overflow: hidden; direction: ltr; text-align: left; }
.code-label { padding: 8px 14px; background: #1b2e24; font-size: 12.5px; font-family: Consolas, monospace; color: #86efac; word-break: break-all; }
.code-block pre { margin: 0; padding: 12px 14px; font-family: Consolas, Menlo, monospace; font-size: 13px; overflow-x: auto; white-space: pre; line-height: 1.7; }

/* ===== هشدارها ===== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 600; font-size: 14px; transition: opacity 0.5s; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
[data-theme="dark"] .alert-success { background: #14532d; color: #bbf7d0; border-color: #166534; }
.alert.fade-out { opacity: 0; }

.alarm-banner {
  background: linear-gradient(90deg, #b91c1c, #dc2626); color: #fff;
  padding: 12px 28px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  animation: pulse-bg 1.6s ease-in-out infinite;
}
.alarm-banner-text { display: flex; flex-direction: column; font-size: 13.5px; }
.alarm-banner-text b { font-size: 16px; }
@keyframes pulse-bg { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

/* ===== پنل دزدگیر ===== */
.alarm-panel {
  display: flex; align-items: center; gap: 16px; padding: 22px 24px; margin-bottom: 18px;
  border-radius: var(--radius); border: 1px solid var(--border-color); background: var(--card-bg); box-shadow: var(--shadow);
  transition: background 0.3s, color 0.3s;
}
.alarm-ico { font-size: 38px; }
.alarm-text { flex: 1; }
.alarm-status-text { font-size: 19px; font-weight: 800; }
.alarm-status-sub { color: var(--text-muted); font-size: 13.5px; }
.alarm-panel.armed { background: linear-gradient(135deg, #7f1d1d, #b91c1c); border-color: #b91c1c; color: #fff; }
.alarm-panel.armed .alarm-status-sub { color: rgba(255, 255, 255, 0.82); }

/* ===== پیام شناور ===== */
.toast-host { position: fixed; inset-block-end: calc(18px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #14532d; color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; transition: opacity 0.4s, transform 0.4s; }
.toast-error { background: #991b1b; }
.toast.hide { opacity: 0; transform: translateY(8px); }

/* ===== صفحات ورود / نصب ===== */
.auth-body { min-height: 100%; background: var(--bg); }
.auth-lang { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); inset-inline-end: 14px; z-index: 5; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { background: var(--sidebar-grad); color: #fff; display: flex; align-items: center; justify-content: center; padding: 40px; position: relative; overflow: hidden; }
.auth-hero::before, .auth-hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.07); }
.auth-hero::before { width: 360px; height: 360px; inset-block-start: -120px; inset-inline-end: -100px; }
.auth-hero::after { width: 260px; height: 260px; inset-block-end: -90px; inset-inline-start: -70px; }
.auth-hero-inner { position: relative; max-width: 420px; z-index: 1; }
.auth-hero h2 { font-size: 34px; font-weight: 600; margin: 18px 0 8px; }
.auth-hero h2 b { font-weight: 800; }
.auth-hero p { opacity: 0.88; font-size: 15.5px; }
.auth-points { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 7vw, 90px); max-width: 560px; width: 100%; margin: 0 auto; }
.auth-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.auth-sub { color: var(--text-muted); margin-bottom: 22px; }
.auth-card .btn-block { margin-top: 10px; padding: 12px; }

/* ===== ریسپانسیو ===== */
@media (max-width: 1000px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open, [dir="ltr"] .sidebar.open { transform: none; }
  .main-content { margin-inline-start: 0; }
  .content-inner { padding: 16px 14px 6px; }
  .topbar { padding-inline: 14px; }
  .alarm-banner { padding-inline: 14px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-card { padding: 70px 22px 30px; }
}

@media (max-width: 560px) {
  .card { padding: 16px 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 12px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .form-cols { grid-template-columns: 1fr; }
  .row-item { flex-direction: column; align-items: stretch; }
  .row-actions { justify-content: space-between; }
  .rename-form input { width: 130px; }
  .area-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .device-grid { grid-template-columns: 1fr; }
  .lang-switch a { padding: 4px 8px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== عکس پروفایل / آواتار ===== */
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-block; vertical-align: middle; background: var(--card-alt); }
.avatar-letter { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-weight: 800; font-size: 13px; }
.avatar-xl { width: 112px; height: 112px; border: 3px solid var(--primary-soft); box-shadow: var(--shadow); }
.avatar-xl.avatar-letter { font-size: 44px; }
.topbar-user { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 4px; }
[dir="rtl"] .topbar-user { padding: 3px 4px 3px 12px; }
.topbar-user:hover { border-color: var(--primary); }
.topbar-user-name { overflow: hidden; text-overflow: ellipsis; }
.profile-grid { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.profile-forms { flex: 1 1 280px; min-width: 0; }
input[type="file"] { width: 100%; padding: 8px; border: 1px dashed var(--border-color); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text-main); }
.divider { border: 0; border-top: 1px solid var(--border-color); margin: 22px 0; }
.auth-links { margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.auth-links a { color: var(--primary); font-weight: 600; }
.auth-links a:hover { text-decoration: underline; }
@media (max-width: 560px) { .topbar-user { display: inline-flex; } .topbar-user-name { display: none; } .topbar-user, [dir="rtl"] .topbar-user { padding: 3px; } }

/* ===== صفحه راه‌اندازی کنترلر ===== */
.steps { margin: 0 0 16px; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.subhead { font-size: 15px; font-weight: 700; margin: 18px 0 8px; }
.pin-input { width: 90px !important; text-align: center; direction: ltr; }
.alert .code-block { margin-top: 8px; }

/* =====================================================
   بهبود کامل نسخه موبایل / Mobile refinements
   ===================================================== */
img, svg, video { max-width: 100%; }
.main-content { min-width: 0; overflow-x: clip; }
.topbar-start { flex: 1; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--text-main); }
.auth-mobile-brand .brand-logo { width: 38px; height: 38px; font-size: 15px; background: var(--primary); color: #fff; }
.auth-mobile-brand .brand-name { font-size: 20px; font-weight: 600; }
.auth-mobile-brand .brand-name b { font-weight: 800; }
body.menu-open { overflow: hidden; }

/* جدول → کارت (روی موبایل) */
@media (max-width: 640px) {
  .table-stack { border: 0; overflow: visible; }
  .table-stack .data-table, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack thead { display: none; }
  .table-stack tr { border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 6px 14px; background: var(--card-alt); }
  .table-stack tbody tr:hover { background: var(--card-alt); }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 14px; border: 0; padding: 7px 0; text-align: end; overflow-wrap: anywhere; }
  .table-stack td + td { border-top: 1px dashed var(--border-color); }
  .table-stack td[data-label]::before { content: attr(data-label); color: var(--text-muted); font-weight: 700; font-size: 12.5px; text-align: start; flex-shrink: 0; max-width: 55%; }
  .table-stack td:not([data-label]) { justify-content: flex-start; text-align: start; font-size: 15px; }
  .pagination { flex-wrap: wrap; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: min(86vw, 300px); }
  .sidebar { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: var(--sidebar-w); }
  .topbar, .content-inner, .alarm-banner, .page-footer {
    padding-left: max(14px, env(safe-area-inset-left, 0px));
    padding-right: max(14px, env(safe-area-inset-right, 0px));
  }
  .page-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  .topbar { gap: 8px; }
  .topbar-end { gap: 8px; flex-shrink: 0; }
  .topbar h1 { font-size: 17px; }

  /* iOS: فونت کمتر از 16px باعث زوم خودکار هنگام فوکوس می‌شود */
  input[type="text"], input[type="password"], input[type="number"], input[type="time"], input[type="email"], select { font-size: 16px; }

  /* اهداف لمسی بزرگ‌تر */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 8px 14px; }
  .icon-btn { width: 42px; height: 42px; }
  .nav-menu a, .nav-logout { padding: 12px 12px; }
  .item-menu summary { width: 38px; height: 38px; }
  .chip span { padding: 9px 15px; }
  .switch { width: 54px; height: 32px; }
  .slider::before { width: 26px; height: 26px; }
  .switch input:checked + .slider::before { transform: translateX(22px); }
  [dir="rtl"] .switch input:checked + .slider::before { transform: translateX(-22px); }
  .switch-lg { width: 64px; height: 34px; }
  .switch-lg .slider::before { width: 28px; height: 28px; }
  .switch-lg input:checked + .slider::before { transform: translateX(30px); }
  [dir="rtl"] .switch-lg input:checked + .slider::before { transform: translateX(-30px); }

  .auth-wrap { min-height: 100vh; min-height: 100dvh; }
  .auth-mobile-brand { display: flex; }
  .auth-card { padding-top: calc(64px + env(safe-area-inset-top, 0px)); max-width: 480px; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .content-inner { padding-top: 14px; }
  .hello h2 { font-size: 19px; }
  .hello .btn { width: 100%; }
  .section-title { font-size: 16px; }
  .section-head > .head-actions { width: 100%; }
  .section-head > .head-actions .btn, .section-head > .btn { flex: 1; }
  .head-actions { gap: 8px; }
  .head-actions form { flex: 1 1 auto; }
  .head-actions form .btn { width: 100%; }
  .rename-form { width: 100%; }
  .rename-form input { flex: 1; width: auto; min-width: 0; }

  .stat-value { font-size: 17px; }
  .stat-icon { width: 40px; height: 40px; font-size: 19px; }

  /* فرم‌های تک‌خطی: همه عناصر تمام‌عرض */
  .inline-form > * { flex: 1 1 100%; width: 100%; }
  .inline-form .btn { width: 100%; }
  .form-stack.narrow { max-width: none; }
  .profile-grid { justify-content: center; text-align: center; }
  .profile-forms { flex-basis: 100%; text-align: start; }
  .pin-input { width: 100px !important; }

  /* کارت تجهیز: چیدمان افقی و کم‌ارتفاع (آیکن | نام | کلید | منو) */
  .device-grid { gap: 10px; }
  .device-card { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 12px 14px; }
  .device-head { display: contents; }
  .device-ico { order: 1; font-size: 26px; }
  .device-info { order: 2; }
  .device-card > .switch { order: 3; }
  .device-head .item-menu { order: 4; }
  .item-menu-pop { width: min(240px, 78vw); }

  .row-item { padding: 12px; }
  .row-actions { flex-wrap: wrap; }
  .row-actions .btn { flex: 1; }
  .alarm-panel { padding: 16px; gap: 12px; }
  .alarm-ico { font-size: 30px; }
  .alarm-status-text { font-size: 16px; }
  .alarm-banner { padding-top: 12px; padding-bottom: 12px; }
  .alarm-banner .btn { width: 100%; }
  .code-block pre { font-size: 12px; }

  .toast-host { inset-inline: 14px; align-items: stretch; }
  .toast { text-align: center; }
  .auth-title { font-size: 22px; }
  .auth-hero h2 { font-size: 28px; }
}

@media (max-width: 340px) {
  .stat-grid { grid-template-columns: 1fr; }
  .area-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .area-card { padding: 14px 8px; }
  .lang-switch a { padding: 4px 6px; font-size: 11.5px; }
  .topbar h1 { font-size: 15.5px; }
}

/* افقی در گوشی (landscape) */
@media (max-height: 480px) and (orientation: landscape) {
  .auth-card { padding-top: 56px; justify-content: flex-start; }
  .sidebar { padding-top: 14px; }
}

/* =====================================================
   اصلاحات نهایی موبایل (بعد از تست با Chromium موبایل)
   ===================================================== */
.sidebar-lang { display: none; margin: 0 8px 14px; background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.22); }
.sidebar-lang a { flex: 1; text-align: center; color: rgba(255,255,255,0.85); }
.sidebar-lang a.active { background: #fff; color: var(--primary-dark); }

/* پشتیبانی مرورگرهای قدیمی‌تر که inset-* / ویژگی‌های منطقی را نمی‌شناسند */
.sidebar { top: 0; bottom: 0; }
[dir="rtl"] .sidebar { right: 0; }
[dir="ltr"] .sidebar { left: 0; }
[dir="rtl"] .main-content { margin-right: var(--sidebar-w); }
[dir="ltr"] .main-content { margin-left: var(--sidebar-w); }
[dir="rtl"] .toast-host { left: 18px; }
[dir="ltr"] .toast-host { right: 18px; }
.toast-host { bottom: 18px; }
[dir="rtl"] .item-menu-pop { left: 0; }
[dir="ltr"] .item-menu-pop { right: 0; }
[dir="rtl"] .auth-lang { left: 14px; }
[dir="ltr"] .auth-lang { right: 14px; }
.auth-lang { top: 14px; }
.slider::before { left: 3px; }
[dir="rtl"] .slider::before { left: auto; right: 3px; }

@media (max-width: 900px) {
  .topbar-lang { display: none; }
  .sidebar-lang { display: flex; }
  [dir="rtl"] .main-content, [dir="ltr"] .main-content { margin-left: 0; margin-right: 0; }
  .sidebar-lang + .nav-menu { flex: 1; }
}

@media (max-width: 560px) {
  /* کارت آماری: دو ستون، چیدمان فشرده و هم‌تراز با شروع خط */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { flex-direction: column; align-items: flex-start; text-align: start; gap: 8px; padding: 12px; }
  .stat-card > div:last-child { width: 100%; text-align: start; }
  .stat-value, [dir="rtl"] .stat-value { text-align: start; }
  .stat-label { font-size: 12px; line-height: 1.5; }
  .inline-form select, .inline-form input[type="text"], .inline-form .btn { flex: 1 1 100%; width: 100%; }
  .topbar-start h1 { font-size: 16px; }
  .alarm-panel { flex-wrap: nowrap; }
  .alarm-status-sub { display: none; }
}
@media (max-width: 340px) { .stat-grid { grid-template-columns: 1fr 1fr; } .stat-value { font-size: 15px; } }

/* ===== درگاه ایمیل ===== */
.preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 16px; }
.preset-row .hint { margin: 0; }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; font-size: 13.5px; }
.check-inline input { width: 18px; height: 18px; }
.smtp-fields { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 560px) { .preset-row .btn { flex: 1 1 calc(50% - 8px); } .preset-row .hint { flex-basis: 100%; } }

.is-hidden { display: none !important; }
.inline-label { flex: 1 1 100%; font-weight: 600; font-size: 13.5px; }

.sub-nomargin { margin: 0; }
.row-title b { overflow-wrap: anywhere; min-width: 0; }


/* ===== ورود دومرحله‌ای و Turnstile (v5.1) ===== */
.otp-input { letter-spacing: 3px; font-size: 18px; text-align: center; font-family: Consolas, Menlo, monospace; }
.turnstile-box { min-height: 65px; margin: 6px 0; display: flex; justify-content: center; }
.qr-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin: 8px 0 18px; }
.qr-box canvas { display: block; width: 210px; max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border-color); }
.qr-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; flex: 1 1 220px; }
.secret-text { direction: ltr; background: var(--card-alt); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 12px; font-size: 15px; letter-spacing: 1px; overflow-wrap: anywhere; user-select: all; }
.codes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.codes-grid code { background: rgba(0,0,0,.06); border-radius: 8px; padding: 6px 10px; font-size: 14px; text-align: center; user-select: all; font-family: Consolas, Menlo, monospace; }
[data-theme="dark"] .codes-grid code { background: rgba(255,255,255,.08); }
@media (max-width: 420px) { .codes-grid { grid-template-columns: 1fr; } }


/* ===== دربازکن‌ها (v5.2) ===== */
.door-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 10px; }
.door-card { background: var(--card-alt); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.door-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.door-ico { font-size: 26px; }
.door-name { font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.door-meta { color: var(--text-muted); font-size: 13px; }
.door-btn { min-height: 56px; font-size: 17px; }
.door-btn:disabled { opacity: .55; cursor: not-allowed; }
.door-status { min-height: 24px; font-size: 14px; font-weight: 600; }
.door-status.busy { color: var(--warn); }
.door-status.ok { color: var(--primary-dark); }
.door-status.err { color: var(--danger); }
.door-status.warn { color: var(--warn); }
[data-theme="dark"] .door-status.ok { color: var(--primary-light); }
.door-edit { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 14px; margin: 12px 0; display: flex; flex-direction: column; gap: 12px; }
.door-fields { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.door-lock { font-size: 13px; color: var(--text-muted); }
.door-auth { display: flex; gap: 8px; flex-wrap: wrap; }
.door-auth[hidden] { display: none; }
.door-auth input { flex: 1 1 140px; min-width: 0; text-align: center; letter-spacing: 2px; }

/* ===== پایش محیط (v5.4) ===== */
.nav-badge { margin-inline-start: auto; background: #dc2626; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 800; padding: 0 7px; min-width: 20px; text-align: center; }
.env-banner { background: linear-gradient(90deg, #b45309, #d97706); color: #fff; padding: 12px 28px; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
@media (max-width: 900px) { .env-banner { padding-inline: 14px; } }
.env-alert-panel { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
.env-alert-panel[hidden] { display: none; }
.env-alert-title { font-weight: 800; margin-bottom: 6px; }
.env-alert-panel ul { margin: 0; padding-inline-start: 20px; color: var(--text-main); }
.env-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.env-area-name { color: var(--text-muted); font-weight: 500; font-size: 13px; margin-inline-start: 8px; }
.env-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 6px; }
.env-tile { display: flex; flex-direction: column; gap: 6px; background: var(--card-alt); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 14px; color: inherit; text-decoration: none; transition: transform .15s, border-color .15s; }
.env-tile:hover { transform: translateY(-2px); border-color: var(--primary); }
.env-top { display: flex; align-items: center; gap: 8px; }
.env-ico { font-size: 22px; }
.env-name { font-weight: 700; overflow-wrap: anywhere; }
.env-loc { font-size: 13px; color: var(--text-muted); }
.env-value { font-size: 30px; font-weight: 800; line-height: 1.2; }
.env-value small { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.env-limits { font-size: 12.5px; color: var(--text-muted); }
.env-low, .env-high { border-color: var(--danger); background: var(--danger-soft); }
.env-low .env-value b, .env-high .env-value b { color: var(--danger); }
.env-stale, .env-nodata, .env-disabled { opacity: .72; }
.env-big { font-size: 46px; font-weight: 800; line-height: 1.2; }
.env-big small { font-size: 18px; color: var(--text-muted); }
.env-big.env-low b, .env-big.env-high b { color: var(--danger); }
.env-edit { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0; }
.env-edit summary { cursor: pointer; padding: 4px 0; }
.env-edit[open] summary { margin-bottom: 10px; }
.env-fields { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.env-fields select { min-width: 160px; }
.env-line { fill: none; stroke: var(--primary); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.env-dot { fill: var(--primary); }
.env-thr { stroke: var(--danger); stroke-width: 1.4; opacity: .8; }
.dot-bad { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.25); }

/* قوانین واکنش سنسور محیطی (v5.5) */
.rule-box { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; margin: 10px 0; display: flex; flex-direction: column; gap: 10px; }
.rule-box.rule-active { border-color: var(--danger); background: var(--danger-soft); }
.rule-active-note { color: var(--danger); font-weight: 700; }
.rule-devices summary { cursor: pointer; font-weight: 600; padding: 4px 0; }

/* تشخیص ساختار دیتابیس */
.schema-diag { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 12px; }
.schema-diag summary { cursor: pointer; font-weight: 700; }
.schema-diag-body ul { margin: 8px 0; padding-inline-start: 18px; }
.schema-diag-body li { margin: 4px 0; overflow-wrap: anywhere; }
.schema-diag-body code { direction: ltr; unicode-bidi: embed; }

/* ===== چندکاربره (v5.6) ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.user-row { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 14px; margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.user-row.user-off { opacity: .75; }
.user-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.user-id { flex: 1; min-width: 0; }
.user-name { font-weight: 700; overflow-wrap: anywhere; }
.user-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.user-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.user-form select { width: auto; min-width: 130px; }
.role-list { margin: 0; padding-inline-start: 20px; line-height: 2; }

/* نقش «عضو»: امکانات مدیریتی پنهان می‌شود (سرور هم جداگانه جلوی آن‌ها را می‌گیرد) */
body.role-member .item-menu,
body.role-member form:has(input[name="action"][value="add_device"]),
body.role-member form:has(input[name="action"][value="add_sensor"]),
body.role-member form:has(input[name="action"][value="add_scenario"]),
body.role-member form:has(input[name="action"][value="add_location"]),
body.role-member form:has(input[name="action"][value="rename_location"]),
body.role-member form:has(input[name="action"][value="delete_location"]),
body.role-member form:has(input[name="action"][value="add_controller"]) { display: none !important; }
