/* ==========================================================================
   Sharnia Panel — stylesheet
   Design language: quiet instrument panel. One accent (signal green) marks
   what's live/active; everything else stays low-contrast ink & slate so the
   accent actually reads as a signal instead of decoration.
   ========================================================================== */
@font-face{
    font-family:'Vazirmatn';
    src: url('../fonts/Vazirmatn[wght].woff2') format('woff2-variations'),
         url('../fonts/Vazirmatn[wght].woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
  }

:root {
  /* neutrals */
  --bg: #f2f4f7;
  --panel: #ffffff;
  --panel-alt: #eef2f6;
  --panel-raised: #dde3ea;
  --border: #e3e7ed;
  --border-strong: #cbd2db;
  --text: #17212e;
  --text-dim: #5b6572;
  --text-faint: #8a93a0;

  /* brand accent */
  --accent: #d4063a;
  --accent-strong: #be1010;
  --accent-dim: rgba(15, 126, 168, 0.12);

  /* semantic */
  --success: #0f9d58;
  --success-dim: rgba(15, 157, 88, 0.12);
  --warn: #d97706;
  --warn-dim: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.12);

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 10px 24px -10px rgba(17, 24, 39, 0.16);
  --shadow-lg: 0 26px 60px -22px rgba(17, 24, 39, 0.28);

  /* layout */
  --header-h: 56px;
  --footer-h: 34px;
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  font-size: 14.5px;
  line-height: 1.7;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(720px 420px at 88% -8%, rgba(52, 211, 163, 0.07), transparent 60%),
    radial-gradient(600px 380px at -5% 100%, rgba(235, 160, 90, 0.05), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: rgba(43, 63, 73, 0.85); color: #fff; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-raised); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   Login screen
   ========================================================================== */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  background: var(--bg);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 500px at 20% 15%, rgba(52, 211, 163, 0.09), transparent 55%),
    radial-gradient(700px 460px at 85% 90%, rgba(235, 160, 90, 0.06), transparent 55%);
}

.login-grid-mark {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(700px 500px at 50% 40%, #000 0%, transparent 75%);
  opacity: 0.6;
}

.login-card {
  position: relative;
  width: min(388px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-mark {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 18px;
}

.login-card h1 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.login-card p.sub {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 26px;
}

.login-success{display:none;align-items:center;gap:8px;padding:10px 12px;margin-bottom:12px;
  border-radius:10px;font-size:13px;color:#34d3a3;background:rgba(52,211,163,.12);border:1px solid rgba(52,211,163,.3)}
.login-success.show{display:flex}
.auth-switch{margin-top:14px;text-align:center;font-size:13px;opacity:.85}
.auth-switch button{background:none;border:0;padding:0;color:var(--accent);cursor:pointer;font:inherit}

.field {
  margin-bottom: 15px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.field .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field input, .field textarea {
  width: 100%;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 40px 11px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: none;
}

.select-menu{
  width: 100%;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: "Vazirmatn";
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.select-menu:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); outline: none; }

.field select {
    cursor: pointer;
}

.field select option {
  background: var(--panel);
  color: var(--text);
  text-align: center;
  align-items: center;
  align-content: center;
}

.field .icon {
  position: absolute;
  right: 12px;
  color: var(--text-faint);
  display: flex;
}

.field .toggle-pass {
  position: absolute;
  left: 5px;
  color: var(--text-faint);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  padding: 12px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.field .toggle-pass:hover { color: var(--accent); background: var(--accent-dim); }

.login-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--danger-dim);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--danger);
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.login-error.show { display: flex; }

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-sm); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }

.btn-secondary {
  width: 100%;
  background: var(--panel-alt);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-secondary:active { transform: scale(0.99); }
.btn-secondary:disabled { opacity: 0.6; cursor: progress; }

.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-secondary .spinner { border-color: rgba(23, 33, 46, 0.25); border-top-color: var(--text); }
.spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ==========================================================================
   App shell — header / footer / sidebar / main
   ========================================================================== */

.app-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}
.app-shell.active { opacity: 1; visibility: visible; }

/* --- header --- */
.app-header {
  height: var(--header-h);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.header-left { display: flex; align-items: center; gap: 10px; }

.burger {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.burger:hover { background: var(--accent); color: #fff; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-strong); font-weight: 700; font-size: 12px;
  overflow: hidden;
}
.brand-mark img { width: 20px; height: 20px; object-fit: contain; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.brand-name span { color: var(--text-faint); font-weight: 400; }

.header-right { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--accent); color: #fff; }
.icon-btn .dot {
  position: absolute; top: 6px; left: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--warn);
  border: 1.5px solid var(--panel);
}

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px 4px 10px;
  border-radius: 20px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  cursor: pointer;
  margin-right: 4px;
}
.user-chip:hover { border-color: var(--border-strong); }
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.user-chip .u-name { font-size: 12.5px; color: var(--text-dim); }

/* --- body: sidebar + main --- */
.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  transition: width 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), min-width 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-x: hidden;
  z-index: 15;
}

.app-body.collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
  min-width: var(--sidebar-w-collapsed);
}

.sidebar-section-label {
  font-size: 11px;
  color: var(--text-faint);
  padding: 12px 10px 6px;
  white-space: nowrap;
}
.app-body.collapsed .sidebar-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { flex: none; width: 18px; height: 18px; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.nav-item:hover { background: var(--panel-alt); color: var(--text); }
.nav-item.is-active {
  background: var(--accent-dim);
  color: var(--accent);
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.nav-badge {
  margin-right: auto;
  background: var(--success);
  color: #fff;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 20px;
}
.app-body.collapsed .nav-badge, .app-body.collapsed .nav-item span { display: none; }

.sidebar-divider { height: 1px; background: var(--border); margin: 10px 4px; }

.sidebar-foot {
  margin-top: auto;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  overflow: hidden;
}
.app-body.collapsed .sidebar-foot { justify-content: center; padding: 10px 0; }
.sidebar-foot .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); flex: none;
  box-shadow: 0 0 0 0 var(--accent-dim);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,163,0.5); }
  70% { box-shadow: 0 0 0 7px rgba(52,211,163,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,163,0); }
}
.app-body.collapsed .sidebar-foot span.txt { display: none; }
.sidebar-foot .txt { font-size: 11.5px; color: var(--text-dim); }
.sidebar-foot .txt b { color: var(--text); font-weight: 600; }

/* --- main content / view host --- */
.main-wrap {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 22px 26px 32px;
  position: relative;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.view-head h2 { font-size: 19px; margin: 0 0 3px; font-weight: 600; letter-spacing: -0.01em; }
.view-head p { margin: 0; color: var(--text-dim); font-size: 13px; }

.view-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 5;
}
.view-loading.show { display: flex; }

#view {
  animation: fadein 0.25s ease;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Bento card grid (dashboard)
   ========================================================================== */

.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.c-span-8 { grid-column: span 8; }
.c-span-4 { grid-column: span 4; }
.c-span-6 { grid-column: span 6; }
.c-span-3 { grid-column: span 3; }
.c-span-12 { grid-column: span 12; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h3 { font-size: 13.5px; font-weight: 600; margin: 0; color: var(--text); }
.card-head .muted { font-size: 11.5px; color: var(--text-faint); }

.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 12px 0 3px; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--text-dim); }
.stat-delta {
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 8px;
}
.stat-delta.up { background: var(--accent-dim); color: var(--accent); }
.stat-delta.down { background: var(--danger-dim); color: var(--danger); }

.sparkline { width: 100%; height: 46px; margin-top: 10px; display: block; }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.status-row:last-child { border-bottom: none; }
.status-row .name { display: flex; align-items: center; gap: 9px; color: var(--text); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.status-dot.ok { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.status-dot.down { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-dim); }
.status-meta { color: var(--text-faint); font-size: 13px; }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
  text-align: right;
  color: var(--text-faint);
  font-weight: 500;
  font-size: 11.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--panel-alt); color: var(--text); }

.badge {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 20px;
  display: inline-block;
}
.badge.ok { background: var(--accent-dim); color: var(--accent); }
.badge.warn { background: var(--warn-dim); color: var(--warn); }
.badge.danger { background: var(--danger-dim); color: var(--danger); }

.embed-card .embed-frame-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}
.embed-card iframe {
  width: 100%;
  height: 260px;
  border: none;
  display: block;
  background: var(--bg);
}
.embed-url {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  direction: ltr;
  justify-content: flex-end;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease;
}
.link-row:hover { background: var(--panel-alt); color: var(--accent); }
.link-row svg { flex: none; width: 15px; height: 15px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
}
.empty-state svg { margin-bottom: 12px; color: var(--text-faint); }
.empty-state h4 { margin: 0 0 4px; font-size: 14.5px; color: var(--text); font-weight: 600; }
.empty-state p { margin: 0; font-size: 12.5px; max-width: 280px; }

/* =========================
   Device Item - Responsive
========================= */
.admin-command-message {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);

  padding: 12px 20px;
  border-radius: 12px;

  background: var(--text);
  color: #fff;

  font-size: 14px;
  font-weight: 600;

  opacity: 0;
  visibility: hidden;

  transition:
    opacity .2s ease,
    transform .2s ease;

  z-index: 99999;
  pointer-events: none;
}

.admin-command-message.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.admin-command-message.success {
  background: var(--success);
}

.admin-command-message.error {
  background: var(--danger);
}
.device-item {
    width: 100%;
    display: grid;
    grid-template-columns: 100px minmax(180px, 1fr) auto auto;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
    box-sizing: border-box;
    border-radius: 16px;
    background: var(--panel-alt);
    border: 1px solid rgb(222, 233, 232);
    transition: 0.2s ease;
    margin-bottom: 10px;
}

.device-item:hover {
    border-color: rgba(151, 131, 19, 0.25);
}

/* تصویر دستگاه */
.device-icon {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(164, 153, 94, 0.03);
    border: solid 1px #cdccc67a;
}

.device-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* اطلاعات */
.device-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.device-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-model {
    font-size: 13px;
    color: var(--text-dim);
}

.device-meta {
    font-size: 13px;
    color: var(--text-dim);
}

.device-location {
    font-size: 13px;
    color: var(--text-dim);
}

/* وضعیت */
.device-status {
    white-space: nowrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 11px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
}

.badge-success {
    color: var(--success);
    background: var(--success-dim);
    border: 1px solid rgba(15, 157, 88, 0.25);
}

/* دکمه‌ها */
.device-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    background: rgba(115, 121, 125, 0.14);
    transition: 0.2s ease;
}

.btn-icon:hover {
    background: var(--accent);
    color: #fff;
}

.btn-icon svg {
    width: 22px;
    height: 22px;
}

.btn-icon.danger:hover {
    background: var(--danger);
    color: #fff;
}


/* =========================
   Tablet
========================= */

@media (max-width: 900px) {

    .device-item {
        grid-template-columns: 85px minmax(0, 1fr) auto;
        gap: 15px;
        margin-bottom: 10px;
    }

    .device-icon {
        width: 85px;
        height: 85px;
    }

    .device-status {
        grid-column: 2 / -1;
        justify-self: start;
    }

    .device-actions {
        grid-column: 2 / -1;
        justify-content: flex-start;
    }
}


/* =========================
   Mobile
========================= */

@media (max-width: 600px) {

    .device-item {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 12px;
        padding: 13px;
        border-radius: 14px;
        margin-bottom: 10px;
    }

    .device-icon {
        width: 72px;
        height: 72px;
        grid-row: 1 / span 3;
    }

    .device-info {
        gap: 4px;
    }

    .device-title {
        font-size: 14px;
        white-space: normal;
        display: -webkit-box;
        overflow: hidden;
    }

    .device-model,
    .device-meta,
    .device-location {
        font-size: 11px;
    }

    .device-status {
        grid-column: 2;
        justify-self: start;
        margin-top: 3px;
    }

    .badge {
        font-size: 10px;
        padding: 5px 8px;
    }

    .device-actions {
        grid-column: 2;
        justify-content: flex-start;
        gap: 6px;
        margin-top: 3px;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        padding: 7px;
    }

    .btn-icon svg {
        width: 20px;
        height: 20px;
    }
}


/* =========================
   Very Small Mobile
========================= */

@media (max-width: 380px) {

    .device-item {
        grid-template-columns: 60px minmax(0, 1fr);
        padding: 10px;
        gap: 10px;
        margin-bottom: 10px;
    }

    .device-icon {
        width: 60px;
        height: 60px;
    }

    .device-title {
        font-size: 13px;
    }

    .badge {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}





/* --- footer --- */
.app-footer {
  height: var(--footer-h);
  min-height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
  z-index: 20;
}
.app-footer .foot-status { display: flex; align-items: center; gap: 6px; }
.app-footer .foot-status .pulse-sm {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ==========================================================================
   Mobile overlay backdrop (for sidebar-as-drawer)
   ========================================================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 15, 0.6);
  z-index: 14;
}
.sidebar-backdrop.show { display: block; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .c-span-8, .c-span-4, .c-span-6, .c-span-3 { grid-column: span 12; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 240px; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    bottom: var(--footer-h);
    right: 0;
    transform: translateX(100%);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: -20px 0 40px -20px rgba(0,0,0,0.5);
  }
  .app-body.mobile-open .sidebar {
    transform: translateX(0);
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
  }
  .app-body.collapsed .sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); }
  .app-body.collapsed .sidebar-section-label,
  .app-body.collapsed .nav-item span,
  .app-body.collapsed .nav-badge,
  .app-body.collapsed .sidebar-foot .txt { opacity: 1; display: block; }
  .app-body.collapsed .nav-badge { display: inline-block; }

  .main-wrap { padding: 16px 14px 24px; }
  .user-chip .u-name { display: none; }
  .brand-name span { display: none; }
}

@media (max-width: 520px) {
  .app-header { padding: 0 10px; }
  .stat-value { font-size: 22px; }
  .login-card { padding: 28px 20px 22px; }
}

/* ==========================================================================
   Support Requests
   ========================================================================== */

.support-request-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.support-request-item {
  width: 100%;
  display: block;
  padding: 15px 17px;
  text-align: right;
  font-family: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition:
    background .18s ease,
    border-color .18s ease,
    transform .15s ease,
    box-shadow .18s ease;
}

.support-request-item:hover {
  background: var(--panel-alt);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.support-request-item:active {
  transform: translateY(0);
}

.support-request-item.is-new {
  border-right: 3px solid var(--accent);
}

.support-request-main {
  min-width: 0;
}

.support-request-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}

.support-request-title strong {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
}

.support-request-message {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 9px;
}

.support-request-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--text-faint);
  font-size: 11px;
}

.support-request-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


/* --- وضعیت درخواست --- */

.support-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 6px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.support-status.new {
  color: var(--success);
  background: var(--success-dim);
  border: 1px solid rgba(15, 157, 88, .24);
}

.support-status.reviewing {
  color: var(--warn);
  background: var(--warn-dim);
  border: 1px solid rgba(217, 119, 6, .20);
}

.support-status.resolved {
  color: var(--success);
  background: var(--success-dim);
  border: 1px solid rgba(15, 157, 88, .22);
}

.support-status.cancelled {
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(220, 38, 38, .20);
}


/* --- Chat --- */

.support-chat {
  display: flex;
  flex-direction: column;
  min-height: 430px;
  overflow: hidden;
  background: var(--panel-alt);
  border: 1px solid rgba(222, 233, 232, .95);
  border-radius: 14px;
}

.support-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.76);
  border-bottom: 1px solid var(--border);
}

.support-chat-head .btn {
  flex-shrink: 0;
}

.support-chat-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.support-chat-info strong {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
}

.support-chat-info span {
  color: var(--text-faint);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-chat-body {
  flex: 1;
  min-height: 260px;
  padding: 22px;
  overflow-y: auto;
  background:
    radial-gradient(
      500px 220px at 10% 0%,
      rgba(18, 119, 169, .045),
      transparent 70%
    );
}

.support-message {
  max-width: min(680px, 85%);
  padding: 12px 15px;
  border-radius: 13px;
  line-height: 1.9;
  box-shadow: 0 4px 14px rgba(20, 40, 50, .05);
}

.support-message.customer {
  margin-left: auto;
  margin-right: 0;
  background: var(--panel);
  border: 1px solid rgba(192, 196, 203, .55);
  border-top-right-radius: 5px;
}

.support-message-text {
  color: var(--text);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.support-message-time {
  margin-top: 10px;
  color: var(--text-faint);
  font-size: 12px;
  margin-right: 50px;
}


/* --- Chat footer / status --- */

.support-chat-footer {
  padding: 13px 15px;
  background: rgba(233, 233, 233, 0.39);
  border-top: 1px solid var(--border);
}

.support-status-control {
  display: flex;
  align-items: center;
  gap: 9px;
}

.support-status-control label {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

.support-status-control select {
  min-width: 150px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition:
    border-color .15s ease,
    box-shadow .15s ease,
    background .15s ease;
}

.support-status-control select:hover {
  background: var(--panel-alt);
}

.support-status-control select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.support-status-control select option {
  background: var(--panel-alt);
  color: var(--text);
  text-align: center;
  align-items: center;
  align-content: center;
}


/* --- Older button --- */

#loadOlderSupportBtn,
#loadOlderDeviceSupportBtn {
  width: auto;
  min-width: 170px;
  padding: 9px 18px;
  font-size: 12px;
}


/* --- Responsive --- */

@media (max-width: 700px) {

  .support-request-item {
    padding: 13px 14px;
  }

  .support-request-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .support-chat {
    min-height: 390px;
  }

  .support-chat-head {
    padding: 11px 12px;
  }

  .support-chat-body {
    padding: 15px;
  }

  .support-message {
    max-width: 92%;
  }

  .support-status-control {
    flex-wrap: wrap;
  }

  .support-status-control label {
    width: 100%;
    margin-left: 0;
  }

  .support-status-control select {
    flex: 1;
    min-width: 0;
  }

  .support-status-control .btn {
    flex: 0 0 auto;
    width: auto;
  }
}

.btn-pris {
  width: 120px;
  background: var(--accent);
  color: #eee;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  margin-right: 20px;
}
.btn-pris:hover { background: var(--accent-strong); }
.btn-pris:active { transform: scale(0.99); }
.btn-pris:disabled { opacity: 0.6; cursor: progress; }

.btn-secs {
  width: 120px;
  background: var(--panel-alt);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  margin-left: 20px;
}
.btn-secs:hover { background: var(--border); }
.btn-secs:active { transform: scale(0.99); }
.btn-secs:disabled { opacity: 0.6; cursor: progress; }

/* ==========================================================================
   Device Support Chat
   ========================================================================== */

.device-support-chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.device-support-message {
  padding: 14px 16px;
  background: var(--panel-alt);
  border: 1px solid rgba(222, 233, 232, .95);
  border-radius: 13px;
  box-shadow: 0 3px 12px rgba(20, 40, 50, .035);
}

.device-support-message:hover {
  border-color: rgba(18, 119, 169, .25);
}

.device-support-message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.device-support-message-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.device-support-message-title strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.device-support-message-time {
  flex-shrink: 0;
  color: var(--text-faint);
  font-size: 10px;
}

.device-support-message-body {
  padding: 0px;
  background: var(--panel-alt);
  border: 1px solid rgba(192, 196, 203, .45);
  border-radius: 11px;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.device-support-message-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 18px;
  margin-top: 9px;
  color: var(--text-faint);
  font-size: 10.5px;
}

.device-support-unread {
  color: var(--accent-strong);
  font-weight: 700;
}

.device-support-read {
  color: var(--success);
  font-weight: 600;
}

@media (max-width: 600px) {

  .device-support-message {
    padding: 12px;
  }

  .device-support-message-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .device-support-message-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

}
/* =========================================================
   Reward / Game Settings
   ========================================================= */

.settings-reward-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 18px;
    margin-top: 18px;
}

.settings-reward-filter,
.settings-reward-form {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel-alt);
}

.settings-reward-filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}

.settings-reward-filter-title strong {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.settings-reward-filter-title .muted {
    font-size: 12px;
}

.settings-reward-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.settings-field-full {
    width: 100%;
}

.settings-field label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
}

.settings-field select,
.settings-field input,
.settings-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    outline: none;
    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
    font-family: inherit;
}

.settings-field select,
.settings-field input {
    height: 44px;
    padding: 0 13px;
    font-size: 13px;
}

.settings-field textarea {
    min-height: 105px;
    padding: 12px 13px;
    resize: vertical;
    line-height: 1.8;
    font-size: 13px;
}

.settings-field select {
    cursor: pointer;
}

.settings-field select option {
  background: var(--panel-alt);
  color: var(--text);
  text-align: center;
  align-items: center;
  align-content: center;
}

.settings-field input::placeholder,
.settings-field textarea::placeholder {
    color: var(--text-faint);
}

.settings-field select:focus,
.settings-field input:focus,
.settings-field textarea:focus {
    border-color: var(--accent);
    background: var(--panel);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Selected devices information */

.settings-reward-selected {
    margin-top: 15px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text-dim);
    font-size: 12px;
    line-height: 1.8;
}

.settings-reward-selected strong {
    color: var(--accent);
    font-weight: 800;
}

/* Form */

.settings-reward-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-reward-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: auto;
    padding-top: 2px;
}

#saveRewardSettingsBtn {
    min-height: 44px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    transition:
        transform 0.18s ease,
        opacity 0.18s ease,
        box-shadow 0.18s ease;
}

#saveRewardSettingsBtn:hover {
    transform: translateY(-1px);
}

#saveRewardSettingsBtn:active {
    transform: translateY(0);
}

#saveRewardSettingsBtn:disabled {
    cursor: wait;
    opacity: 0.55;
    transform: none;
}

/* اگر btn-primary از قبل استایل دارد، این بخش فقط ظاهر این دکمه را تثبیت می‌کند */

.settings-reward-form .btn-primary {
    box-shadow: var(--shadow-sm);
}

.settings-reward-form .btn-primary:hover {
    box-shadow: var(--shadow-md);
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 900px) {

    .settings-reward-panel {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 600px) {

    .settings-reward-filter,
    .settings-reward-form {
        padding: 15px;
        border-radius: 15px;
    }

    .settings-reward-filter-grid {
        grid-template-columns: 1fr;
    }

    .settings-reward-filter-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .settings-reward-actions {
        justify-content: stretch;
    }

    #saveRewardSettingsBtn {
        width: 100%;
    }

}

.settings-password-panel {
    display: grid;
    grid-template-columns:
        minmax(160px, .8fr)
        minmax(240px, 1.4fr)
        minmax(180px, .9fr)
        auto;
    gap: 14px;
    align-items: end;
    margin-top: 18px;
}

.settings-password-actions {
    display: flex;
    align-items: flex-end;
}

.settings-generated-password {
    grid-column: 1 / -1;

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

    min-height: 70px;
    padding: 14px 18px;

    border: 1px solid rgba(54, 223, 195, .15);
    border-radius: 14px;

    background: rgba(54, 223, 195, .045);
}

.settings-generated-password span {
    color: rgb(88, 21, 165);
    font-size: 20px;
}

.settings-generated-password strong {
    font-size: 28px;
    letter-spacing: 5px;
    color: #551595;
    font-weight: 900;
}

@media (max-width: 900px) {
    .settings-password-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-password-actions {
        align-items: stretch;
    }
}

@media (max-width: 600px) {
    .settings-password-panel {
        grid-template-columns: 1fr;
    }

    .settings-generated-password {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

.icon-btn {
  position: relative;
}

.notification-count {
  position: absolute;
  top: -5px;
  right: -7px;

  min-width: 18px;
  height: 18px;
  padding: 0 4px;

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

  border-radius: 999px;

  background: var(--danger);
  color: #fff;

  font-size: 10px;
  font-weight: 700;
  line-height: 1;

  direction: ltr;
  pointer-events: none;
}


.monitoring-card {
  overflow: hidden;
}

.monitoring-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 2px;
}

.monitoring-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
}

.monitoring-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.monitoring-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
}

.monitoring-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.monitoring-row-main strong {
  font-size: 13px;
}

.monitoring-row-main span {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitoring-row-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--text-faint);
  font-size: 11px;
}

.device-process-item {
  display: grid;
  grid-template-columns: 95px 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
}

.device-process-item time {
  color: var(--text-faint);
  font-size: 11px;
}

.process-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-dim);
}

.process-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.process-content strong {
  font-size: 13px;
}

.process-content span {
  color: var(--text-dim);
  font-size: 12px;
}

.process-content small {
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   SHARNIA LIVE MONITORING
   ========================================================================== */

.monitoring-mode .main-wrap {
    flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 22px 26px 32px;
  position: relative;
}

.monitoring-page {
    height: calc(
        100vh
        - var(--header-h)
        - var(--footer-h)
        - 40px
    );

    min-height: 0;

    display: flex;
    flex-direction: column;

    gap: 14px;
}


/* --------------------------------------------------------------------------
   LIVE BAR
   -------------------------------------------------------------------------- */

.monitoring-livebar {

    flex: 0 0 auto;

    min-height: 68px;

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

    padding: 12px 18px;

    border-radius: 16px;

    background:
        linear-gradient(
            135deg,
            rgba(176, 228, 223, 0.08),
            rgba(236, 236, 229, 0.96) 45%,
            rgba(236, 231, 238, 0.459)
        );

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

    box-shadow: var(--shadow-md);

    position: relative;
    overflow: hidden;
}


.monitoring-livebar::before {

    content: "";

    position: absolute;

    width: 260px;
    height: 100px;

    left: -70px;
    top: -60px;

    background:
        radial-gradient(
            circle,
            rgba(238, 234, 232, 0.12),
            transparent 70%
        );

    pointer-events: none;
}


.monitoring-live-status {

    display: flex;
    align-items: center;

    gap: 11px;

    position: relative;
    z-index: 1;
}


.monitoring-live-orb {

    width: 11px;
    height: 11px;

    border-radius: 50%;

    background: var(--success);

    box-shadow: 0 0 0 4px var(--success-dim);

    animation:
        monitoringPulse 2s cubic-bezier(.4,0,.2,1) infinite;

    flex: none;
}


@keyframes monitoringPulse {

    0% {
        box-shadow:
            0 0 0 0 rgba(52,211,163,.42),
            0 0 12px rgba(52,211,163,.4);
    }

    70% {
        box-shadow:
            0 0 0 9px rgba(52,211,163,0),
            0 0 20px rgba(52,211,163,.55);
    }

    100% {
        box-shadow:
            0 0 0 0 rgba(52,211,163,0),
            0 0 12px rgba(52,211,163,.4);
    }
}


.monitoring-live-status strong {

    display: block;

    font-size: 13px;

    font-weight: 700;

    color: var(--text);
}


.monitoring-live-status small {

    display: block;

    margin-top: 1px;

    color: var(--text-dim);

    font-size: 11px;
}


.monitoring-live-time {

    display: flex;
    align-items: center;

    gap: 8px;

    position: relative;
    z-index: 1;
}


.monitoring-live-time span {
  color: var(--text);
  font-size: 12px;
  font-weight: 600
}


.monitoring-live-time strong {

    color: var(--text);

    font-size: 12px;

    font-weight: 600;
}


/* OFFLINE */

.monitoring-livebar.is-offline {

    background:
        linear-gradient(
            135deg,
            rgba(233, 8, 49, 0.09),
            rgba(235, 225, 220, 0.97)
        );

    border-color:
        rgba(229,105,127,.28);
}


.monitoring-livebar.is-offline
.monitoring-live-orb {

    background: var(--danger);

    box-shadow:
        0 0 0 4px var(--danger-dim),
        0 0 18px rgba(229,105,127,.45);

    animation:
        monitoringOfflinePulse 1s ease-in-out infinite;
}


@keyframes monitoringOfflinePulse {

    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .35;
        transform: scale(.72);
    }
}


.monitoring-livebar.is-offline
.monitoring-live-status strong {

    color: var(--text);
}


/* --------------------------------------------------------------------------
   THREE MAIN CARDS
   -------------------------------------------------------------------------- */

.monitoring-grid {

    flex: 1;

    min-height: 0;

    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 14px;
}


.monitoring-card {

    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    position: relative;

    overflow: hidden;

    border-radius: 18px;

    background:
        linear-gradient(
            145deg,
            rgba(242, 242, 243, 0.94),
            rgba(251, 253, 253, 0.98) 55%
        );

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

    box-shadow: var(--shadow-md);

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


.monitoring-card:hover {

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

    box-shadow: var(--shadow-lg);
}


.monitoring-card-glow {

    position: absolute;

    width: 230px;
    height: 130px;

    top: -80px;
    right: -70px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(52,211,163,.09),
            transparent 68%
        );

    pointer-events: none;
}


.monitoring-card-sms
.monitoring-card-glow {

    background:
        radial-gradient(
            circle,
            rgba(123,163,238,.09),
            transparent 68%
        );
}


.monitoring-card-rewards
.monitoring-card-glow {

    background:
        radial-gradient(
            circle,
            rgba(235,160,90,.10),
            transparent 68%
        );
}


/* --------------------------------------------------------------------------
   CARD HEADER
   -------------------------------------------------------------------------- */

.monitoring-card-head {

    flex: 0 0 auto;

    min-height: 76px;

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

    padding: 14px 16px;

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

    position: relative;
    z-index: 2;
}


.monitoring-title-wrap {

    display: flex;
    align-items: center;

    gap: 11px;

    min-width: 0;
}


.monitoring-title-icon {

    width: 42px;
    height: 42px;

    flex: none;

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

    border-radius: 12px;

    background: rgba(82, 19, 158, 0.93);

    color: #fff;

    border: 1px solid rgba(52,211,163,.12);
}


.monitoring-title-icon svg {

    width: 21px;
    height: 21px;
}


.sms-icon {

    background: rgba(9, 102, 117, 0.93);
    color: #FFF;
    border-color: rgba(123,163,238,.12);
}


.reward-icon {

    background: rgba(80, 17, 7, 0.93);
    color: #fff;
    border-color: rgba(235,160,90,.12);
}


.monitoring-title-wrap h3 {

    margin: 0;

    font-size: 13.5px;

    font-weight: 700;

    color: var(--text);
}


.monitoring-title-wrap span {

    display: block;

    margin-top: 2px;

    color: var(--text-faint);

    font-size: 10.5px;
}


.monitoring-count {

    min-width: 28px;
    height: 28px;

    padding: 0 8px;

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

    border-radius: 9px;

    background: var(--panel-alt);

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

    color: var(--text-dim);

    font-size: 11px;
}


/* --------------------------------------------------------------------------
   INTERNAL SCROLL
   -------------------------------------------------------------------------- */

.monitoring-list {

    flex: 1;

    min-height: 0;

    overflow-y: auto;

    overflow-x: hidden;

    padding: 4px 7px 8px;

    scrollbar-gutter: stable;
}


.monitoring-list::-webkit-scrollbar {

    width: 6px;
}


.monitoring-list::-webkit-scrollbar-thumb {

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

    border-radius: 20px;
}


.monitoring-list::-webkit-scrollbar-thumb:hover {

    background: rgba(52,211,163,.28);
}


/* --------------------------------------------------------------------------
   PROCESS ROW
   -------------------------------------------------------------------------- */

.monitoring-process-row {

    display: grid;

    grid-template-columns:
        40px
        minmax(0,1fr);

    align-items: center;

    gap: 10px;

    min-height: 67px;

    padding: 9px 8px;

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

    transition:
        background .18s ease,
        transform .18s ease;
}


.monitoring-process-row:hover {

    background: rgba(17, 24, 39, .035);
}


.monitoring-row-time {

    color: var(--text-faint);

    font-size: 10px;

    text-align: right;

    white-space: nowrap;
}


.monitoring-process-icon {

    width: 40px;
    height: 40px;

    border-radius: 11px;

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

    color: #fff;
}


.monitoring-process-icon svg {

    width: 19px;
    height: 19px;
}


.monitoring-process-content {

    min-width: 0;
}


.monitoring-process-content strong {

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;

    font-size: 12px;

    font-weight: 600;
}


.monitoring-process-content small {

    display: block;

    margin-top: 3px;

    color: var(--text-faint);

    font-size: 9.5px;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;

    direction: ltr;

    text-align: right;
}


.monitoring-device {

    display: inline-flex;

    align-items: center;

    gap: 5px;

    color: var(--text-dim);

    font-size: 10.5px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.monitoring-device-dot {

    width: 5px;
    height: 5px;

    flex: none;

    border-radius: 50%;

    background: var(--accent);

    box-shadow: 0 0 7px rgba(52,211,163,.55);
}


/* --------------------------------------------------------------------------
   SMS
   -------------------------------------------------------------------------- */

.monitoring-message-row {

    padding: 13px 9px;

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

    transition: background .18s ease;
}


.monitoring-message-row:hover {

    background: rgba(17, 24, 39, .035);
}


.monitoring-message-top {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;
}

.monitoring-device-name {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;
}


.monitoring-phone {

    direction: ltr;

    color: var(--text);

    font-size: 12px;

    font-weight: 600;
}


.monitoring-message-top time {

    color: var(--text-faint);

    font-size: 10px;
}


.monitoring-message-text {

    margin-top: 7px;

    color: var(--text-dim);

    font-size: 11px;

    line-height: 1.8;

    display: -webkit-box;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;

    overflow: hidden;
}


.monitoring-message-footer {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 8px;

    margin-top: 8px;
}


.monitoring-game {

    padding: 2px 7px;

    border-radius: 6px;

    background: rgba(123,163,238,.09);

    color: #7ba3ee;

    font-size: 9.5px;
}


/* --------------------------------------------------------------------------
   REWARDS
   -------------------------------------------------------------------------- */

.monitoring-reward-row {

    display: flex;

    gap: 11px;

    padding: 13px 9px;

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

    transition: background .18s ease;
}


.monitoring-reward-row:hover {

    background: rgba(17, 24, 39, .035);
}


.monitoring-reward-medal {

    width: 40px;
    height: 40px;

    flex: none;

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

    border-radius: 11px;

    background: rgba(15, 126, 168, 0.85);

    color: #FFF;

    border: 1px solid rgba(235,160,90,.12);
}


.monitoring-reward-medal svg {

    width: 20px;
    height: 20px;
}


.monitoring-reward-content {

    min-width: 0;

    flex: 1;
}


.monitoring-reward-main {

    color: var(--text);

    font-size: 12px;

    font-weight: 700;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.monitoring-reward-user {

    margin-top: 3px;

    color: var(--text-dim);

    direction: ltr;

    text-align: right;

    font-size: 10.5px;
}


.monitoring-reward-meta {

    display: flex;

    align-items: center;

    gap: 8px;

    margin-top: 8px;

    color: var(--text-faint);

    font-size: 9.5px;

    flex-wrap: wrap;
}


.monitoring-reward-meta time {

    direction: ltr;
}


/* --------------------------------------------------------------------------
   EMPTY
   -------------------------------------------------------------------------- */

.monitoring-empty {

    min-height: 260px;

    display: flex;

    flex-direction: column;

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

    text-align: center;

    padding: 30px;
}


.monitoring-empty-icon {

    width: 50px;
    height: 50px;

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

    border-radius: 15px;

    background: rgba(17, 24, 39, .035);

    color: var(--text-faint);

    margin-bottom: 12px;
}


.monitoring-empty-icon svg {

    width: 22px;
    height: 22px;
}


.monitoring-empty strong {

    color: var(--text);

    font-size: 12px;
}


.monitoring-empty span {

    margin-top: 4px;

    color: var(--text-faint);

    font-size: 10.5px;
}


/* --------------------------------------------------------------------------
   LOADING
   -------------------------------------------------------------------------- */

.monitoring-loading {

    height: 100%;

    min-height: 280px;

    display: flex;

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

    gap: 5px;
}


.monitoring-loading span {

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--accent);

    animation:
        monitoringLoading 1.1s infinite ease-in-out;
}


.monitoring-loading span:nth-child(2) {
    animation-delay: .15s;
}


.monitoring-loading span:nth-child(3) {
    animation-delay: .3s;
}


@keyframes monitoringLoading {

    0%, 80%, 100% {
        opacity: .25;
        transform: scale(.7);
    }

    40% {
        opacity: 1;
        transform: scale(1);
    }
}


/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {

    .monitoring-grid {

        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 10px;
    }

    .monitoring-card-head {
        padding: 12px;
    }

    .monitoring-title-icon {

        width: 38px;
        height: 38px;
    }

    .monitoring-title-wrap h3 {
        font-size: 12.5px;
    }
}


@media (max-width: 980px) {

    .monitoring-mode .main-wrap {
        overflow-y: auto;
    }

    .monitoring-page {
        height: auto;
    }

    .monitoring-grid {

        grid-template-columns:
            1fr;

        min-height: 900px;
    }

    .monitoring-card {

        min-height: 430px;
    }
}


@media (max-width: 600px) {

    .monitoring-mode .main-wrap {
        padding: 12px;
    }

    .monitoring-livebar {

        min-height: 62px;

        padding: 10px 12px;
    }

    .monitoring-live-time span {
        display: none;
    }

    .monitoring-grid {
        gap: 10px;
    }
}
/* ==========================================================================\n   FINAL UI POLISH — unified Sharnia design system\n   ========================================================================== */

:root {
  --surface-soft: #f7f9fb;
  --surface-hover: #f0f4f7;
  --accent-soft: rgba(15, 126, 168, .10);
  --accent-border: rgba(15, 126, 168, .20);
  --shadow-panel: 0 8px 28px rgba(17, 24, 39, .07);
}

/* Keep all decorative states inside the same visual language. */
body::before {
  background:
    radial-gradient(760px 420px at 90% -8%, rgba(15, 126, 168, .055), transparent 62%),
    radial-gradient(620px 400px at -8% 105%, rgba(15, 126, 168, .035), transparent 64%);
}

.login-screen::before {
  background:
    radial-gradient(900px 500px at 18% 12%, rgba(15, 126, 168, .075), transparent 58%),
    radial-gradient(760px 460px at 88% 92%, rgba(15, 126, 168, .045), transparent 58%);
}

.login-grid-mark {
  opacity: .42;
}

.app-header {
  box-shadow: 0 1px 0 rgba(17, 24, 39, .02), 0 5px 18px rgba(17, 24, 39, .035);
}

.sidebar {
  box-shadow: 1px 0 0 rgba(17, 24, 39, .015);
}

.nav-item {
  min-height: 38px;
}

.nav-item.is-active {
  font-weight: 600;
  background: var(--accent-soft);
}

.sidebar-foot {
  background: var(--surface-soft);
}

.main-wrap {
  scrollbar-gutter: stable;
}

.view-head h2 {
  letter-spacing: -.025em;
}

.card {
  box-shadow: var(--shadow-panel);
}

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

.btn,
.btn-icon,
.icon-btn,
.burger,
.user-chip,
.nav-item,
.support-request-item,
.device-item,
.settings-reward-filter,
.settings-reward-form,
.settings-password-panel {
  -webkit-tap-highlight-color: transparent;
}

.field input,
.field textarea,
.select-menu,
.settings-field select,
.settings-field input,
.settings-field textarea,
.support-status-control select {
  min-height: 42px;
}

.field textarea,
.settings-field textarea {
  min-height: 100px;
  resize: vertical;
}

/* Settings panels */
.settings-reward-panel,
.settings-password-panel {
  gap: 14px;
}

.settings-generated-password {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.settings-generated-password span,
.settings-generated-password strong {
  color: var(--accent-strong);
}

/* Monitoring: one palette, same contrast hierarchy as the rest of the app. */
.monitoring-livebar {
  background:
    linear-gradient(135deg,
      rgba(15, 126, 168, .045),
      rgba(255, 255, 255, .94) 52%,
      rgba(15, 126, 168, .025));
  border-color: var(--accent-border);
}

.monitoring-livebar::before {
  background: radial-gradient(circle, rgba(15, 126, 168, .08), transparent 70%);
}

@keyframes monitoringPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15,126,168,.28), 0 0 10px rgba(15,126,168,.20);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(15,126,168,0), 0 0 18px rgba(15,126,168,.30);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15,126,168,0), 0 0 10px rgba(15,126,168,.20);
  }
}

.monitoring-card {
  background: linear-gradient(145deg, #fff, #f8fafc 100%);
}

.monitoring-card-glow,
.monitoring-card-sms .monitoring-card-glow,
.monitoring-card-rewards .monitoring-card-glow {
  background: radial-gradient(circle, rgba(15,126,168,.075), transparent 68%);
}

.monitoring-title-icon,
.sms-icon,
.reward-icon {
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: rgba(15,126,168,.18);
}

.monitoring-count {
  background: var(--surface-soft);
}

.monitoring-process-row:hover,
.monitoring-message-row:hover,
.monitoring-reward-row:hover {
  background: var(--surface-soft);
}

.monitoring-process-icon {
  background: rgba(15, 126, 168, 0.85);
}

.monitoring-device-dot {
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Tables and list rows */
table.data-table tbody tr {
  transition: background .15s ease;
}

table.data-table tr:hover td {
  background: var(--surface-hover);
}

/* Make action controls visually consistent. */
.btn-icon {
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface-soft);
}

.btn-icon:hover {
  border-color: var(--accent);
}



.device-edit, .user-edit {
  background: var(--success);
  border: 0;
  color: #fff;
}
.device-edit:hover, .user-edit:hover {
  background: #0c7d47;
}
.device-open {
  background: var(--accent);
  border: 0;
  color: #fff;
}
.device-open:hover {
  background: var(--accent-strong);
}

.device-delete, .user-delete {
  background: var(--danger);
  border: 0;
  color: #fff;
}
.device-delete:hover, .user-delete:hover {
  background: #b91c1c;
}

/* --------------------------------------------------------------------------
   Responsive final pass
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .main-wrap {
    padding: 18px 16px 28px;
  }

  .view-head {
    margin-bottom: 16px;
  }

  .bento {
    gap: 12px;
  }

  .card {
    padding: 16px;
  }

  .monitoring-mode .main-wrap {
    padding: 16px;
  }

  .monitoring-page {
    height: auto;
    min-height: 0;
  }

  .monitoring-grid {
    min-height: 0;
  }
}

@media (max-width: 860px) {
  body {
    overflow: hidden;
  }

  .app-header {
    padding-inline: 12px;
  }

  .main-wrap {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar {
    border-left: 1px solid var(--border-strong);
  }

  .sidebar-backdrop.show {
    backdrop-filter: blur(2px);
  }
}

@media (max-width: 700px) {
  .main-wrap,
  .monitoring-mode .main-wrap {
    padding: 14px 12px 22px;
  }

  .view-head {
    align-items: flex-start;
    gap: 7px;
  }

  .view-head h2 {
    font-size: 17px;
  }

  .view-head p {
    font-size: 12px;
  }

  .card {
    border-radius: 14px;
    padding: 14px;
  }

  .card-head {
    margin-bottom: 11px;
  }

  .monitoring-livebar {
    min-height: 60px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .monitoring-live-status {
    gap: 9px;
  }

  .monitoring-live-time strong {
    font-size: 11px;
  }

  .monitoring-card {
    border-radius: 15px;
  }

  .monitoring-card-head {
    min-height: 68px;
    padding: 11px 12px;
  }

  .monitoring-title-wrap {
    gap: 9px;
  }

  .monitoring-title-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .monitoring-title-icon svg {
    width: 19px;
    height: 19px;
  }

  .monitoring-title-wrap h3 {
    font-size: 12.5px;
  }

  .monitoring-list {
    max-height: 390px;
  }

  .settings-password-panel,
  .settings-reward-panel {
    border-radius: 14px;
  }
}

@media (max-width: 520px) {
  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: 13px;
  }

  .header-right {
    gap: 3px;
  }

  .user-chip {
    padding-inline: 5px 7px;
    margin-right: 0;
  }

  .main-wrap,
  .monitoring-mode .main-wrap {
    padding-inline: 10px;
  }

  .view-head h2 {
    font-size: 16px;
  }

  .monitoring-grid {
    gap: 9px;
  }

  .monitoring-card {
    min-height: 0;
  }
}

@media (max-width: 380px) {
  .app-header {
    padding-inline: 8px;
  }

  .burger,
  .icon-btn {
    width: 30px;
    height: 30px;
  }

  .main-wrap,
  .monitoring-mode .main-wrap {
    padding-inline: 8px;
  }

  .card {
    padding: 12px;
  }

  .monitoring-card-head {
    padding-inline: 10px;
  }
}

/* =========================================================
   GPS DEVICE VIEW
   ========================================================= */

.device-view-shell {
  position: relative;
  width: 100%;
  height: calc(100vh - 90px);
  min-height: 620px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}


.device-view-topbar {
  height: 68px;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}


.device-view-title {
  display: flex;
  align-items: center;
  gap: 16px;
}


.device-back-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: inherit;
}


.device-back-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}


.device-live-title {
  display: flex;
  align-items: center;
  gap: 10px;
}


.device-live-title strong {
  color: var(--text);
  font-size: 15px;
}


.device-serial {
  direction: ltr;
  color: var(--text-faint);
  font-size: 11px;
}


.device-update-note {
  font-size: 10px;
  color: var(--text-faint);
}


.device-connection {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}


.device-connection i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
  background: var(--text-faint);
}


.device-connection.online {
  color: var(--success);
}


.device-connection.online i {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-dim);
}


.device-connection.warn {
  color: var(--warn);
}


.device-connection.warn i {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-dim);
}


.device-connection.offline {
  color: var(--danger);
}


.device-connection.offline i {
  background: var(--danger);
}


.device-speed {
  direction: ltr;
  display: flex;
  align-items: baseline;
  gap: 5px;
}


.device-speed strong {
  font-size: 25px;
  color: var(--text);
}


.device-speed span {
  color: var(--text-faint);
  font-size: 11px;
}


/* =========================================================
   GPS PAGE
   ========================================================= */

.gps-device-page {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-alt);
}


.gps-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}


.gps-map .ol-zoom {
  left: auto;
  right: 20px;
  top: 20px;
}


.gps-map .ol-control button {
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}


.gps-map .ol-control button:hover {
  background: var(--panel-alt);
  color: var(--text);
}


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

.gps-status-panel {
  position: absolute;
  z-index: 10;
  top: 18px;
  left: 18px;
  width: 335px;
  max-height: calc(100% - 36px);
  overflow-y: auto;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}


.gps-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 15px;
}


.gps-panel-kicker {
  display: block;
  color: var(--accent);
  font-size: 10px;
  margin-bottom: 4px;
}


.gps-panel-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}


.gps-status-badge {
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 20px;
  background: var(--success-dim);
  color: var(--success);
  font-size: 10px;
}


.gps-status-badge.offline {
  background: var(--danger-dim);
  color: var(--danger);
}


.gps-status-badge.warn {
  background: var(--warn-dim);
  color: var(--warn);
}


.gps-status-badge.unknown {
  background: var(--panel-raised);
  color: var(--text-faint);
}


.gps-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}


.gps-status-item {
  min-width: 0;
  padding: 10px;
  border-radius: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}


.gps-status-label {
  display: block;
  color: var(--text-faint);
  font-size: 9px;
  margin-bottom: 5px;
}


.gps-status-value {
  color: var(--text);
  font-size: 12px;
}


/* =========================================================
   LAST POINT
   ========================================================= */

.gps-last-point {
  margin-top: 12px;
  padding: 12px;
  border-radius: 11px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
}


.gps-point-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}


.gps-point-head strong {
  font-size: 11px;
  color: var(--text);
}


.gps-point-head span {
  color: var(--text-faint);
  font-size: 9px;
}


.gps-coordinate {
  direction: ltr;
  display: flex;
  gap: 10px;
  margin-top: 8px;
}


.gps-coordinate span {
  color: var(--text-dim);
  font-family: monospace;
  font-size: 10px;
}


/* =========================================================
   COMMANDS
   ========================================================= */

.gps-command-section {
  margin-top: 15px;
}


.gps-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}


.gps-section-head strong {
  font-size: 11px;
  color: var(--text);
}


.gps-section-head span {
  font-size: 10px;
  color: var(--text-faint);
}


.gps-command-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}


.gps-command-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px;
  border-radius: 9px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}


.gps-command-main {
  min-width: 0;
}


.gps-command-main strong {
  display: block;
  color: var(--text-dim);
  font-size: 10px;
  direction: ltr;
  text-align: right;
}


.gps-command-main span {
  display: block;
  color: var(--text-faint);
  font-size: 8px;
  margin-top: 3px;
}


.gps-command-status {
  flex-shrink: 0;
  font-size: 8px;
  padding: 4px 7px;
  border-radius: 12px;
}


.gps-command-status.pending {
  color: var(--warn);
  background: var(--warn-dim);
}


.gps-command-status.success {
  color: var(--success);
  background: var(--success-dim);
}


.gps-command-status.error {
  color: var(--danger);
  background: var(--danger-dim);
}


.gps-command-status.info {
  color: var(--text-dim);
  background: var(--panel-raised);
}


.gps-command-empty {
  color: var(--text-faint);
  text-align: center;
  padding: 15px;
  font-size: 10px;
}


/* =========================================================
   MAP TOOLS
   ========================================================= */

.gps-map-tools {
  position: absolute;
  z-index: 15;
  right: 65px;
  bottom: 18px;
  display: flex;
  gap: 5px;
  padding: 5px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}


.gps-map-tool {
  border: 0;
  border-radius: 7px;
  padding: 7px 11px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}


.gps-map-tool:hover {
  background: var(--panel-alt);
  color: var(--text);
}


.gps-map-tool.active {
  background: var(--accent);
  color: #fff;
}


.gps-map-tool.loading {
  opacity: .55;
  pointer-events: none;
}


/* =========================================================
   MARKER INFO
   ========================================================= */

.gps-marker-info {
  position: absolute;
  z-index: 12;
  right: 20px;
  bottom: 75px;
  width: 230px;
}


.gps-marker-card {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(15px);
}


.gps-marker-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}


.gps-marker-title strong {
  color: var(--text);
  font-size: 11px;
}


.gps-marker-speed {
  color: var(--accent);
  font-size: 10px;
  direction: ltr;
}


.gps-marker-row {
  display: flex;
  justify-content: space-between;
  padding-top: 6px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}


.gps-marker-row span {
  color: var(--text-faint);
  font-size: 9px;
}


.gps-marker-row strong {
  color: var(--text-dim);
  font-size: 9px;
}


/* =========================================================
   REPLAY BAR
   ========================================================= */

.gps-replay-bar {
  position: absolute;
  z-index: 15;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-radius: 14px;
  max-width: calc(100% - 220px);
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}


.gps-replay-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--panel-alt);
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}


.gps-replay-btn:hover {
  background: var(--border);
  color: var(--text);
}


.gps-replay-play {
  background: var(--accent);
  color: #fff;
}


.gps-replay-play:hover {
  background: var(--accent-strong);
}


.gps-replay-slider {
  flex: 1;
  min-width: 70px;
  accent-color: var(--accent);
  cursor: pointer;
}


.gps-replay-time {
  flex-shrink: 0;
  direction: ltr;
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}


.gps-replay-speed {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}


.gps-replay-speed-btn {
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-dim);
  font-size: 9px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}


.gps-replay-speed-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}


/* =========================================================
   LOADING
   ========================================================= */

.gps-loading-screen {
  position: absolute;
  inset: 0;
  z-index: 25;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-dim);
  background: var(--panel-alt);
}


.gps-loading-screen .spinner {
  border-color: rgba(23, 33, 46, .15);
  border-top-color: var(--accent);
  width: 22px;
  height: 22px;
}


.gps-loading-screen strong {
  font-size: 12px;
  font-weight: 500;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 900px) {

  .device-view-shell {
    height: calc(100vh - 70px);
    min-height: 550px;
  }

  .device-view-topbar {
    height: 60px;
    min-height: 60px;
  }

  .device-live-title {
    flex-wrap: wrap;
    gap: 5px 8px;
  }

  .gps-status-panel {
    width: 285px;
    left: 10px;
    top: 10px;
    max-height: 55%;
  }

  .gps-marker-info {
    right: 10px;
    bottom: 65px;
  }

  .gps-replay-bar {
    max-width: calc(100% - 20px);
  }

}


@media (max-width: 600px) {

  .device-view-title {
    gap: 7px;
  }

  .device-back-btn {
    padding: 7px 8px;
    font-size: 10px;
  }

  .device-live-title strong {
    font-size: 12px;
  }

  .device-serial {
    display: none;
  }

  .device-speed strong {
    font-size: 19px;
  }

  .gps-status-panel {
    width: calc(100% - 20px);
    left: 10px;
    top: 10px;
    max-height: 48%;
  }

  .gps-map-tools {
    right: 10px;
    bottom: 10px;
  }

  .gps-marker-info {
    display: none !important;
  }

  .gps-replay-bar {
    left: 10px;
    right: 10px;
    bottom: 60px;
    transform: none;
    max-width: none;
    padding: 6px 10px;
  }

  .gps-replay-time {
    display: none;
  }

}
