:root {
  --bg: #08101f;
  --bg-2: #0d1628;
  --panel: #111b2f;
  --panel-2: #18243a;
  --border: rgba(255, 255, 255, 0.06);
  --text: #eef4ff;
  --muted: #97a8c5;
  --green: #4dd265;
  --blue: #2d7df6;
  --red: #ff5252;
  --purple: #8748ff;
  --amber: #ffae1a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  background: radial-gradient(circle at top, #14233c 0%, var(--bg) 42%);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(41, 88, 179, 0.18), transparent 24rem),
    linear-gradient(180deg, #0d1729 0%, #08101f 100%);
}

.dashboard-body {
  overflow-x: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 22px 16px 18px;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(14, 26, 47, 0.98), rgba(9, 17, 31, 0.98));
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 22px;
}

.brand-block strong {
  display: block;
  font-size: 1.02rem;
  color: #53d86a;
}

.brand-block span {
  color: #e6ebf5;
  font-size: 0.88rem;
}

.brand-mark {
  width: 30px;
  height: 30px;
  color: #53d86a;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.sidebar-nav {
  display: grid;
  gap: 22px;
}

.nav-section {
  display: grid;
  gap: 8px;
}

.section-label {
  padding: 0 10px;
  color: #798aa8;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.sidebar-link {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: #eaf0fb;
  text-decoration: none;
  font-size: 0.98rem;
}

.sidebar-link.active {
  background: linear-gradient(90deg, #4169ff, #4b52e8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sidebar-link.dimmed {
  color: #d4def1;
  opacity: 0.9;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(180deg, #b3c0db, #596987);
  color: #08101f;
  font-weight: 700;
}

.user-meta {
  display: grid;
  gap: 2px;
}

.user-meta strong {
  font-size: 0.98rem;
}

.user-meta span {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}

.dashboard-main {
  padding: 22px 18px 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 0 2px 18px;
  border-bottom: 1px solid var(--border);
}

.page-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.clock-widget {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.clock-widget span {
  color: var(--muted);
  font-size: 0.82rem;
}

.clock-widget strong {
  font-size: 1.08rem;
}

.outline-button,
.filter-pill,
.view-button,
.action-button {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.outline-button,
.filter-pill,
.view-button {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #eaf0fb;
  border: 1px solid var(--border);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding-top: 20px;
}

.stat-card,
.panel,
.auth-card {
  background: linear-gradient(180deg, rgba(22, 33, 53, 0.98), rgba(17, 27, 47, 0.98));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px 18px 14px;
}

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

.stat-head span {
  display: block;
  color: #dfe7f7;
  font-size: 0.92rem;
}

.stat-head strong {
  display: block;
  margin-top: 8px;
  font-size: 2.05rem;
  font-weight: 700;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-weight: 700;
  color: #fff;
}

.accent-green .stat-icon,
.accent-green .sparkline path {
  background: rgba(77, 210, 101, 0.22);
  color: var(--green);
  stroke: var(--green);
}

.accent-blue .stat-icon,
.accent-blue .sparkline path {
  background: rgba(45, 125, 246, 0.22);
  color: var(--blue);
  stroke: var(--blue);
}

.accent-red .stat-icon,
.accent-red .sparkline path {
  background: rgba(255, 82, 82, 0.2);
  color: var(--red);
  stroke: var(--red);
}

.accent-purple .stat-icon,
.accent-purple .sparkline path {
  background: rgba(135, 72, 255, 0.22);
  color: var(--purple);
  stroke: var(--purple);
}

.accent-amber .stat-icon,
.accent-amber .sparkline path {
  background: rgba(255, 174, 26, 0.22);
  color: var(--amber);
  stroke: var(--amber);
}

.trend {
  margin: 8px 0 14px;
  font-size: 0.9rem;
}

.trend.positive,
.positive {
  color: var(--green);
}

.trend.negative,
.negative {
  color: var(--red);
}

.sparkline {
  display: block;
  width: 100%;
  height: 42px;
}

.sparkline path {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.65fr 1.1fr;
  gap: 14px;
  margin-top: 14px;
}

.tables-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 18px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.06rem;
}

.legend {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-dot.green {
  background: var(--green);
}

.legend-dot.red {
  background: var(--red);
}

.chart-stage {
  position: relative;
  height: 318px;
  border-radius: 14px;
  padding: 14px 10px 32px;
  background: linear-gradient(180deg, rgba(10, 22, 42, 0.5), rgba(10, 22, 42, 0.2));
  overflow: hidden;
}

.grid-lines {
  position: absolute;
  inset: 14px 10px 32px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 20%, 10% 100%;
  border-radius: 12px;
}

.big-chart {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 250px;
}

.line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.green-line {
  stroke: var(--green);
}

.red-line {
  stroke: var(--red);
}

.green-area {
  fill: url(#greenFill);
}

.red-area {
  fill: url(#redFill);
}

.chart-labels {
  position: absolute;
  right: 16px;
  left: 16px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  color: #9aa9c1;
  font-size: 0.82rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #edf5ff;
}

.live-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.live-badge.connected::before {
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.live-badge.waiting::before {
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
}

.connection-layout,
.qr-hero-layout {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.qr-preview,
.qr-hero-box {
  display: grid;
  place-items: center;
  min-height: 170px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.qr-preview img,
.qr-hero-box img {
  display: block;
  width: 100%;
  height: auto;
}

.qr-placeholder {
  color: #0c1323;
  font-size: 2rem;
  font-weight: 700;
}

.connection-meta {
  display: grid;
  gap: 10px;
}

.connection-meta.full {
  gap: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-row strong {
  text-align: right;
  font-size: 0.94rem;
}

.panel-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.panel-actions.wide {
  margin-top: 10px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  background: #223355;
}

.action-button.blue {
  background: rgba(45, 125, 246, 0.22);
  color: #88b7ff;
}

.action-button.red {
  background: rgba(255, 82, 82, 0.18);
  color: #ff8e8e;
}

.table-panel {
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead th {
  padding: 12px 10px;
  color: #c0cde3;
  text-align: left;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody td {
  padding: 14px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #eef4ff;
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
}

.badge.green {
  background: rgba(77, 210, 101, 0.18);
  color: #84eb97;
}

.badge.red {
  background: rgba(255, 82, 82, 0.18);
  color: #ff9494;
}

.badge.amber {
  background: rgba(255, 174, 26, 0.18);
  color: #ffcb68;
}

.badge.purple {
  background: rgba(135, 72, 255, 0.18);
  color: #bf9bff;
}

.badge.slate {
  background: rgba(152, 166, 192, 0.18);
  color: #d0daed;
}

.footer-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 14px;
}

.metric-block {
  display: grid;
  gap: 10px;
}

.metric-block span {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-block strong {
  font-size: 1.05rem;
}

.metric-block em {
  margin-left: 8px;
  font-style: normal;
  font-size: 0.88rem;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.progress-track i.red {
  background: var(--red);
}

.progress-track i.blue {
  background: var(--blue);
}

.steps-list {
  margin: 0;
  padding-left: 20px;
  color: #dfe7f7;
  line-height: 1.9;
}

.ip-whitelist-list {
  display: grid;
  gap: 14px;
}

.ip-script-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.ip-script-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.ip-script-head h3 {
  margin: 0 0 8px;
}

.ip-script-head p {
  color: var(--muted);
}

.ip-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ip-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 16px;
}

.ip-add-row input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e1728;
  color: #fff;
  font: inherit;
}

.scripts-list {
  display: grid;
  gap: 14px;
}

.script-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.script-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.script-card-head h3 {
  margin: 0 0 8px;
}

.script-card-head p {
  color: var(--muted);
}

.script-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.meta-tile {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.meta-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.meta-tile strong {
  display: block;
  font-size: 1rem;
  word-break: break-word;
}

.roles-list {
  display: grid;
  gap: 12px;
}

.compact-form {
  gap: 12px;
}

.dark-select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0e1728;
  color: #fff;
  font: inherit;
}

.users-page-grid {
  grid-template-columns: 1.2fr 0.8fr;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.logs-grid {
  display: grid;
  gap: 12px;
}

.users-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.users-intro-card {
  padding: 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.users-intro-card strong {
  display: block;
  margin-bottom: 8px;
}

.users-intro-card p {
  color: var(--muted);
}

.mini-stat-card {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(22, 33, 53, 0.98), rgba(17, 27, 47, 0.98));
  box-shadow: var(--shadow);
}

.mini-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 10px;
}

.mini-stat-card strong {
  font-size: 1.75rem;
}

.panel-subcopy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.users-list-panel {
  margin-top: 14px;
}

.users-list-head {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr 0.8fr 1.6fr;
  gap: 14px;
  padding: 0 6px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.users-list-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.user-row-card {
  display: grid;
  grid-template-columns: 1.1fr 3.4fr;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.user-primary {
  display: grid;
  gap: 14px;
  align-content: start;
}

.user-primary h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.user-primary p {
  color: var(--muted);
}

.user-primary-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.15fr 0.8fr 1.6fr;
  gap: 12px;
  align-items: start;
}

.user-cell,
.user-actions-card {
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-height: 100%;
}

.user-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.user-cell strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 8px;
}

.user-cell small {
  display: block;
  color: var(--muted);
  line-height: 1.6;
}

.user-actions-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.user-actions-card small {
  color: var(--muted);
  line-height: 1.6;
}

.user-edit-button {
  width: 100%;
}

.role-card {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.role-card strong {
  display: block;
  margin: 10px 0 6px;
}

.role-card p {
  color: var(--muted);
}

.dashboard-dialog {
  width: min(560px, calc(100% - 24px));
  padding: 0;
  border: 0;
  background: transparent;
}

.dashboard-dialog::backdrop {
  background: rgba(4, 9, 18, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-card {
  margin: 0;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(22, 33, 53, 0.99), rgba(17, 27, 47, 0.99));
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
}

.dialog-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dialog-head h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.dialog-head p {
  color: var(--muted);
}

.dialog-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dialog-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dialog-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 1rem;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 32px;
}

.auth-title {
  margin: 0 0 10px;
  font-size: 2.1rem;
}

.auth-copy {
  margin-bottom: 22px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: #dbe5f6;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0e1728;
  color: #fff;
  font: inherit;
}

.submit-button {
  min-height: 48px;
  border-radius: 12px;
  background: linear-gradient(90deg, #3b66ff, #4f4de6);
  color: #fff;
}

.form-message {
  min-height: 20px;
  color: #ff9e9e;
}

.users-topbar {
  padding-bottom: 22px;
}

.users-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.breadcrumb-sep {
  margin: 0 8px;
  color: #6f85a8;
}

.users-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  padding: 22px 0 20px;
}

.users-stat-card {
  display: flex;
  gap: 14px;
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(22, 33, 53, 0.98), rgba(17, 27, 47, 0.98));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.scripts-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 22px 0 20px;
}

.users-stat-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  font-weight: 700;
  color: #fff;
}

.users-stat-copy {
  display: grid;
  gap: 4px;
}

.users-stat-copy span {
  color: #dce6f8;
}

.users-stat-copy strong {
  font-size: 2rem;
}

.users-stat-copy small {
  color: var(--muted);
}

.users-stat-card.accent-blue .users-stat-icon {
  background: linear-gradient(180deg, rgba(49, 88, 255, 0.95), rgba(60, 76, 230, 0.95));
}

.users-stat-card.accent-green .users-stat-icon {
  background: linear-gradient(180deg, rgba(56, 188, 88, 0.95), rgba(31, 150, 69, 0.95));
}

.users-stat-card.accent-red .users-stat-icon {
  background: linear-gradient(180deg, rgba(243, 163, 16, 0.98), rgba(217, 123, 11, 0.94));
}

.users-stat-card.accent-purple .users-stat-icon {
  background: linear-gradient(180deg, rgba(139, 63, 255, 0.98), rgba(92, 56, 226, 0.94));
}

.users-stat-card.accent-amber .users-stat-icon {
  background: linear-gradient(180deg, rgba(41, 105, 255, 0.98), rgba(18, 83, 229, 0.94));
}

.users-table-panel {
  padding: 18px;
}

.users-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 180px auto;
  gap: 14px;
  margin-bottom: 18px;
}

.search-shell input,
.compact-select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0e1728;
  color: #fff;
  font: inherit;
}

.compact-button {
  min-height: 48px;
}

.users-table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.users-table thead th {
  padding: 18px 16px;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  color: #dce6f8;
  background: rgba(255, 255, 255, 0.03);
}

.users-table tbody td {
  padding: 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #eff4ff;
  vertical-align: middle;
}

.users-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-user-copy {
  display: grid;
  gap: 4px;
}

.table-user-copy strong {
  font-size: 0.98rem;
}

.table-user-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.user-photo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #4169ff, #4b52e8);
  color: #fff;
  font-weight: 700;
  flex: 0 0 42px;
}

.user-photo.large {
  width: 72px;
  height: 72px;
  flex-basis: 72px;
  font-size: 1.3rem;
}

.user-photo img,
.avatar.image-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-photo.fallback {
  background: linear-gradient(180deg, rgba(65, 105, 255, 0.92), rgba(70, 201, 133, 0.82));
}

.table-actions {
  display: flex;
  gap: 8px;
}

.icon-action {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

.icon-action.blue {
  background: linear-gradient(180deg, #355cff, #4b52e8);
}

.icon-action.amber {
  background: linear-gradient(180deg, #f3a310, #d47b0a);
}

.icon-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.users-table-footer {
  padding: 14px 6px 2px;
  color: var(--muted);
}

.scripts-table-panel,
.scripts-footer-panel {
  padding: 18px;
}

.scripts-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 200px auto;
  gap: 14px;
  margin-bottom: 18px;
}

.scripts-toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.script-name-cell strong {
  font-size: 1rem;
}

.api-key-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-icon-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
}

.muted-inline {
  color: var(--muted);
}

.requests-cell {
  display: grid;
  grid-template-columns: auto 120px auto;
  align-items: center;
  gap: 12px;
}

.progress-inline {
  position: relative;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(97, 121, 160, 0.25);
}

.progress-inline-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #37c767, #57de7d);
}

.success-text {
  color: #57de7d;
}

.danger-text {
  color: #ff6d6d;
}

.scripts-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.scripts-footer-card {
  padding: 6px 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.scripts-footer-card:first-child {
  border-left: 0;
}

.scripts-footer-card strong {
  display: block;
  margin-bottom: 8px;
}

.scripts-footer-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.ip-selector-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.ip-selector-toolbar {
  grid-template-columns: minmax(320px, 1fr) auto;
  margin-bottom: 0;
}

.selector-field span {
  margin-bottom: 8px;
}

.dialog-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.span-full {
  grid-column: 1 / -1;
}

.profile-preview-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-preview-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.profile-page-grid {
  grid-template-columns: 360px minmax(0, 1fr);
}

.profile-summary-panel,
.profile-form-panel {
  padding: 20px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.profile-hero h2 {
  margin: 0 0 8px;
}

.profile-hero p {
  margin: 0 0 10px;
  color: var(--muted);
}

.profile-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-meta-grid {
  display: grid;
  gap: 12px;
}

.profile-form-standalone {
  padding: 0;
}

.scripts-table td .badge {
  text-transform: none;
}

.roles-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

.roles-list-panel,
.roles-permissions-panel,
.role-info-card {
  padding: 18px;
}

.roles-list-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.role-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.role-list-item.active {
  border-color: rgba(66, 97, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(66, 97, 255, 0.35);
  background: rgba(35, 58, 128, 0.25);
}

.role-list-item strong {
  display: block;
  margin-bottom: 6px;
}

.role-list-item span {
  color: var(--muted);
}

.role-info-card {
  margin-top: 16px;
}

.role-info-grid {
  display: grid;
  gap: 10px;
}

.permissions-groups {
  display: grid;
  gap: 16px;
}

.permission-module-card {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.permission-table {
  display: grid;
}

.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.permission-row:first-child {
  border-top: 0;
}

.permission-row strong {
  display: block;
  margin-bottom: 6px;
}

.permission-row span {
  color: var(--muted);
}

.avatar.image-avatar {
  overflow: hidden;
  padding: 0;
}

@media (max-width: 1400px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .scripts-stats-grid,
  .scripts-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .dashboard-grid,
  .tables-grid,
  .footer-metrics,
  .stats-grid,
  .users-summary-grid,
  .users-stats-grid,
  .user-row-card,
  .user-grid,
  .users-list-head {
    grid-template-columns: 1fr;
  }

  .users-toolbar,
  .scripts-toolbar,
  .profile-page-grid,
  .roles-layout,
  .dialog-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dashboard-main {
    padding: 18px 12px 22px;
  }

  .topbar,
  .connection-layout,
  .qr-hero-layout,
  .panel-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .page-title {
    font-size: 1.55rem;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

  .script-meta-grid,
  .ip-add-row {
    grid-template-columns: 1fr;
  }

  .users-list-head {
    display: none;
  }

  .users-table {
    min-width: 760px;
  }

  .scripts-toolbar-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .requests-cell {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
