/* =====================================================
   SUPERADMIN V2 – CONTROL CENTER LAYOUT
   Behåller färgerna, bygger om layouten för stor högerpanel
   ===================================================== */

#sa-v2-root {
  min-height: 100vh;
  padding: 18px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #2ec4b6, #3a86ff);
  font-family: Arial, sans-serif;
  color: white;
}

/* ================= TOPBAR ================= */

#sa-v2-root .sa-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  position: relative;
}

#sa-v2-root .sa-back-main {
  background: #ef4444;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

#sa-v2-root .sa-close-wrap {
  position: absolute;
  top: 0;
  right: 0;
}

#sa-v2-root .sa-close-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #facc15;
  color: #1f2937;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

#sa-v2-root .sa-close-text {
  position: absolute;
  top: 52px;
  right: 0;
  font-size: 12px;
  color: red;
  font-weight: 600;
  white-space: nowrap;
}

/* ================= LAYOUT ================= */

#sa-v2-root .sa-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: calc(100vh - 90px);
}

/* ================= LEFT PANEL ================= */

#sa-v2-root #userList {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
}

#sa-v2-root #list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding-right: 4px;
}

/* ================= INPUT ================= */

#sa-v2-root input,
#sa-v2-root select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  margin-bottom: 10px;
  box-sizing: border-box;
}

/* ================= NEW BUTTON ================= */

#sa-v2-root .sa-btn-new {
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* ================= USER CARD ================= */

#sa-v2-root .sa-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(145deg, #4c8dff, #2f5fd0);
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
  border: 2px solid transparent;
}

#sa-v2-root .sa-user-card:hover {
  transform: translateY(-2px);
}

#sa-v2-root .sa-user-card.selected {
  border-color: #00ff88;
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.45);
}

#sa-v2-root .sa-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

#sa-v2-root .sa-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#sa-v2-root .avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #fff;
}

#sa-v2-root .sa-user-info {
  flex: 1;
  min-width: 0;
}

#sa-v2-root .sa-user-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.1;
}

#sa-v2-root .sa-user-role {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

#sa-v2-root .sa-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

#sa-v2-root .sa-status-dot.on {
  background: #00ff88;
}

#sa-v2-root .sa-status-dot.off {
  background: #ff4d4d;
}

/* ================= RIGHT PANEL ================= */

#sa-v2-root #userPanel {
  flex: 1;
  min-width: 0;
  padding: 8px 6px 8px 8px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

/* ================= EMPTY ================= */

#sa-v2-root .sa-empty {
  color: white;
  font-size: 26px;
  font-weight: 600;
  text-align: left;
  margin-top: 40px;
}

/* ================= HEADER ================= */

#sa-v2-root .sa-user-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  color: white;
  margin-bottom: 14px;
}

#sa-v2-root .sa-back {
  background: #ef4444;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

#sa-v2-root .sa-selected {
  display: flex;
  align-items: center;
  gap: 14px;
}

#sa-v2-root .sa-avatar-big {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  color: white;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

#sa-v2-root .sa-avatar-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #999;
  border: 2px solid #0f172a;
}

#sa-v2-root .sa-avatar-dot.on {
  background: #00ff88;
}

#sa-v2-root .sa-avatar-dot.off {
  background: #ff4d4d;
}

#sa-v2-root .sa-user-meta-line {
  font-size: 13px;
  opacity: 0.95;
  margin-top: 4px;
}

/* ================= TABS ================= */

#sa-v2-root .sa-user-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 18px;
  flex-wrap: wrap;
}

#sa-v2-root .sa-tab {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.82);
  color: #0f172a;
}

#sa-v2-root .sa-tab.active {
  background: #0f172a;
  color: white;
  box-shadow: 0 0 12px rgba(15, 23, 42, 0.35);
}

/* ================= CONTROL CENTER ================= */

#sa-v2-root .sa-control-center,
#sa-v2-root .sa-panel-wrap {
  width: 100%;
}

#sa-v2-root .sa-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

#sa-v2-root .sa-summary-card {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#sa-v2-root .sa-summary-label {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}

#sa-v2-root .sa-summary-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

#sa-v2-root .sa-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

#sa-v2-root .sa-main-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#sa-v2-root .sa-box,
#sa-v2-root .sa-panel-toolbar,
#sa-v2-root .sa-audit-box {
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#sa-v2-root .sa-box-title,
#sa-v2-root .sa-panel-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
}

#sa-v2-root .sa-panel-sub,
#sa-v2-root .sa-note,
#sa-v2-root .sa-empty-mini {
  color: #4b5563;
  font-size: 13px;
}

#sa-v2-root .sa-box-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#sa-v2-root .sa-box-grid > div {
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
}

#sa-v2-root .sa-inline-actions,
#sa-v2-root .sa-quick-actions,
#sa-v2-root .sa-panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

#sa-v2-root .sa-inline-btn,
#sa-v2-root .sa-quick-btn,
#sa-v2-root .sa-panel-btn {
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 600;
  background: #0f172a;
  color: white;
}

#sa-v2-root .sa-mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#sa-v2-root .sa-mini-row,
#sa-v2-root .sa-audit-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  font-size: 14px;
}

#sa-v2-root .sa-audit-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ================= LEGACY CARDS / FORM ================= */

#sa-v2-root .grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

#sa-v2-root .card {
  width: 260px;
  min-height: 120px;
  border-radius: 16px;
  padding: 20px;
  background: linear-gradient(180deg, #0f172a, #1e293b);
  color: white;
  position: relative;
  cursor: pointer;
  transition: 0.25s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 2px solid transparent;
}

#sa-v2-root .card:hover {
  transform: translateY(-6px) scale(1.02);
}

#sa-v2-root .card.ok {
  border: 2px solid #00ff88;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
}

#sa-v2-root .card.bad {
  border: 2px solid #ff4d4d;
  box-shadow: 0 0 12px rgba(255, 77, 77, 0.6);
}

#sa-v2-root .card.warn {
  border: 2px solid #facc15;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.6);
}

#sa-v2-root .card.info {
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

#sa-v2-root .card-action {
  margin-top: 10px;
  font-size: 12px;
  opacity: 0.7;
  text-align: right;
}

#sa-v2-root .card input,
#sa-v2-root .card select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  margin-bottom: 10px;
}

#sa-v2-root .card button {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: #22c55e;
  color: white;
  cursor: pointer;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1200px) {
  #sa-v2-root .sa-summary-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  #sa-v2-root .sa-main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #sa-v2-root .sa-layout {
    flex-direction: column;
  }

  #sa-v2-root #userList {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  #sa-v2-root #list {
    max-height: 280px;
  }

  #sa-v2-root #userPanel {
    max-height: none;
    overflow: visible;
    width: 100%;
  }

  #sa-v2-root .sa-box-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #sa-v2-root .sa-summary-grid {
    grid-template-columns: 1fr;
  }

  #sa-v2-root .sa-user-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #sa-v2-root .sa-selected {
    align-items: flex-start;
  }
}
.sa-status-grid{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.sa-status-card{
  border:1px solid #cbd5e1;
  border-radius:10px;
  padding:6px 10px;
  font-weight:700;
  cursor:pointer;
  transition:transform .12s ease, opacity .12s ease, box-shadow .12s ease;
}

.sa-status-card:hover{
  transform:translateY(-1px);
  box-shadow:0 4px 10px rgba(0,0,0,.10);
}

.sa-status-card.ok{
  background:#dcfce7;
  border-color:#22c55e;
  color:#166534;
}

.sa-status-card.warn{
  background:#fef3c7;
  border-color:#f59e0b;
  color:#92400e;
}

.sa-status-card.error{
  background:#fee2e2;
  border-color:#ef4444;
  color:#991b1b;
}

.sa-status-card.neutral{
  background:#e2e8f0;
  border-color:#94a3b8;
  color:#334155;
}