:root{
  /* Epopsio Brand */
  --primary: #E31E2F;
  --primary-dark: #7A0B13;
  --primary-soft: rgba(227, 30, 47, 0.18);
  --primary-soft-2: rgba(122, 11, 19, 0.18);

  /* Legacy variable mapping (UI only) */
  --aurora-blue: var(--primary);
  --aurora-purple: var(--primary-dark);
  --aurora-purple-dark: #7A0B13;

  /* Neutrals */
  --text-black: #0B0E14;
  --text-dark: #1B1F2A;
  --text-muted: #5C6475;
  --border: #E6E8EF;

  /* Surfaces */
  --bg: #F6F7FB;
  --card: #FFFFFF;
  --sidebar: #12141B;
  --sidebar-2: #181C26;

  --radius: 14px;
  --shadow: 0 10px 24px rgba(11, 14, 20, 0.08);
  --shadow-soft: 0 6px 16px rgba(11, 14, 20, 0.06);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
}

a{ color:inherit; text-decoration:none; }
button, input{ font:inherit; }

/* ===== Layout ===== */
.app{
  display:flex;
  min-height:100vh;
}

.sidebar{
  width:270px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color:#fff;
  padding:22px 16px;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 10px 18px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom:14px;
}

.brand img{
  height:34px;
  width:auto;
  display:block;
}

.brand .brand-title{
  display:flex;
  flex-direction:column;
  line-height:1.1;
}
.brand .brand-title strong{
  font-size:14px;
  letter-spacing:0.5px;
}
.brand .brand-title span{
  font-size:12px;
  color: rgba(255,255,255,0.7);
}

.nav{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius: 12px;
  color: rgba(255,255,255,0.78);
  border: 1px solid transparent;
}

.nav a i{ width:18px; text-align:center; }

.nav a:hover{
  background: rgba(255,255,255,0.06);
  color:#fff;
}

.nav a.active{
  background: linear-gradient(90deg, var(--primary-soft), var(--primary-soft-2));
  border-color: rgba(255,255,255,0.10);
  color:#fff;
}

.main{
  flex:1;
  min-width:0;
  padding:26px;
}

/* ===== Topbar ===== */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.page-title h1{
  margin:0;
  font-size:22px;
  letter-spacing:0.2px;
  color: var(--text-black);
}
.page-title p{
  margin:6px 0 0 0;
  color: var(--text-muted);
  font-size:13px;
}

.badge-online{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:600;
  color:#0D7A3A;
}
.badge-online .dot{
  width:10px; height:10px; border-radius:99px;
  background:#19C37D;
  box-shadow: 0 0 0 4px rgba(25,195,125,0.15);
}

.grid-two{
  display:grid;
  grid-template-columns: 1fr 2fr;
  gap:16px;
}
@media (max-width: 1100px){
  .grid-two{ grid-template-columns: 1fr; }
}

.top-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  max-width:100%;
}

.btn{
  border: 1px solid var(--border);
  background: #fff;
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  box-shadow: var(--shadow-soft);
}
.btn:hover{ transform: translateY(-1px); }

.btn-primary{
  border: none;
  color:#fff;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}
.btn-primary:hover{ filter: brightness(1.03); }
.btn-primary:focus-visible{
  outline: 3px solid rgba(227, 30, 47, 0.28);
  outline-offset: 2px;
}
.btn-primary:disabled{
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.input.ep-validation-invalid,
input.ep-validation-invalid,
select.ep-validation-invalid,
textarea.ep-validation-invalid{
  border-color: var(--primary) !important;
  background: rgba(227, 30, 47, 0.06) !important;
  box-shadow: 0 0 0 3px rgba(227, 30, 47, 0.12) !important;
}
.ep-validation-message{
  display:none;
  margin-top:6px;
  color:#B42318;
  font-size:12px;
  font-weight:700;
  line-height:1.35;
}
.ep-validation-field-invalid > label:first-child{
  color:#B42318;
}

.avatar{
  display:none;
}

/* ===== Cards / Grid ===== */
.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:16px;
  margin-top:14px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}

.kpi{
  grid-column: span 3;
  min-height: 110px;
}
@media (max-width: 1100px){
  .kpi{ grid-column: span 6; }
}
@media (max-width: 720px){
  .sidebar{ display:none; }
  .main{ padding:18px; }
  .kpi{ grid-column: span 12; }
}

.kpi-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  color: var(--text-muted);
  font-size:12px;
  text-transform: uppercase;
  letter-spacing:0.08em;
}

.kpi-value{
  margin-top:10px;
  font-size:34px;
  font-weight:800;
  color: var(--text-black);
}

.kpi-sub{
  margin-top:6px;
  color: var(--text-muted);
  font-size:12px;
}

.icon-pill{
  width:34px; height:34px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
}
.icon-blue{ background: rgba(227,30,47,0.95); }
.icon-purple{ background: rgba(122,11,19,0.95); }
.icon-dark{ background: rgba(27,31,42,0.92); }
.icon-warn{ background: #F59E0B; }

.section{
  grid-column: span 12;
}

.table{
  width:100%;
  border-collapse: collapse;
  margin-top:10px;
}

.table-wrap{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
}

.table-wrap .table{
  margin-top:0;
}

.devices-registry-table{
  min-width: 1040px;
  table-layout: fixed;
}

.devices-registry-table th:nth-child(3),
.devices-registry-table td:nth-child(3){
  width: 108px;
  max-width: 108px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.devices-registry-table th:nth-child(11),
.devices-registry-table td:nth-child(11){
  width: 210px;
}

.devices-registry-table .actions{
  white-space: normal;
  line-height: 1.9;
}

.devices-registry-table .actions a{
  display: inline-block;
  margin: 2px 0 2px 8px;
  white-space: nowrap;
}

.table th, .table td{
  border-top: 1px solid var(--border);
  padding:10px 8px;
  text-align:left;
  font-size:13px;
}

.table th{
  color: var(--text-muted);
  font-weight:700;
  font-size:12px;
  text-transform: uppercase;
  letter-spacing:0.06em;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border: 1px solid var(--border);
  background: #fff;
}
.pill.ok{ color:#0D7A3A; border-color: rgba(25,195,125,0.25); background: rgba(25,195,125,0.10); }
.pill.note,
.pill.warn{ color:#92400E; border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.12); }
.pill.danger{ color:#A61B1B; border-color: rgba(220,38,38,0.28); background: rgba(220,38,38,0.10); }
.pill.gray{ color:#4B5563; border-color: rgba(107,114,128,0.28); background: rgba(107,114,128,0.10); }
.pill.info{ color:#1D4ED8; border-color: rgba(59,130,246,0.28); background: rgba(59,130,246,0.10); }

/* ===== Roles page helpers ===== */
.split{
  display:grid;
  grid-template-columns: 340px 1fr;
  gap:16px;
}
@media (max-width: 980px){
  .split{ grid-template-columns: 1fr; }
}

.input{
  width:100%;
  padding:10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  outline:none;
  background:#fff;
}
.input:focus{
  border-color: rgba(227,30,47,0.55);
  box-shadow: 0 0 0 4px rgba(227,30,47,0.12);
}

.role-card{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding:12px;
  margin-top:10px;
  cursor:pointer;
  background:#fff;
}
.role-card:hover{ transform: translateY(-1px); }
.role-card.active{
  border-color: rgba(122,11,19,0.45);
  box-shadow: 0 0 0 4px rgba(122,11,19,0.10);
}

.permission-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 0;
  border-top: 1px solid var(--border);
  font-size:13px;
}
.permission-row:first-child{ border-top:none; }

/* ===== Form controls ===== */
.select{
  padding:10px 12px;
  border-radius:12px;
  border: 1px solid var(--border);
  background:#fff;
  color: var(--text-dark);
  outline:none;
}
.select:focus{
  border-color: rgba(227,30,47,0.55);
  box-shadow: 0 0 0 4px rgba(227,30,47,0.12);
}

/* ===== Modal (used by users.html) ===== */
/* Small helper text under inputs */
.help-text{
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: #7a8192;
  font-weight: 500;
}

.modal-backdrop{
  position:fixed;
  inset:0;
  background: rgba(11,14,20,0.55);
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:18px;
  overflow:auto;
  z-index: 50;
}
.modal{
  width:min(760px,100%);
  background:#fff;
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
  max-height: calc(100vh - 36px);
  display:flex;
  flex-direction:column;
  margin: auto 0;
}
.modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding-bottom:12px;
  border-bottom:1px solid var(--border);
}
.modal-title{
  font-size:16px;
  font-weight:800;
  color:var(--text-black);
}
.modal-subtitle{
  margin-top:6px;
  font-size:12px;
  color:var(--text-muted);
}
.modal-body{
  padding-top:14px;
  overflow:auto;
  min-height: 0;
}
.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding-top:14px;
  border-top:1px solid var(--border);
  margin-top:14px;
}
.modal-foot{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding-top:14px;
  border-top:1px solid var(--border);
  margin-top:14px;
}
.icon-btn{
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  width:38px;
  height:38px;
  cursor:pointer;
  box-shadow: var(--shadow-soft);
}
.icon-btn:hover{ transform: translateY(-1px); }

/* ===== Users page form layout ===== */
.form-row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 860px){
  .form-row{ grid-template-columns: 1fr; }
}
.field label{
  display:block;
  font-size:12px;
  color:var(--text-muted);
  margin:0 0 6px 0;
}
.chips{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding:10px;
  border:1px dashed rgba(227,30,47,0.35);
  border-radius:12px;
  background: rgba(227,30,47,0.04);
}
.chip-btn{
  border:1px solid var(--border);
  background:#fff;
  padding:8px 10px;
  border-radius:999px;
  cursor:pointer;
  font-size:12px;
  font-weight:700;
  color: var(--text-dark);
}
.chip-btn.on{
  border-color: rgba(122,11,19,0.45);
  background: rgba(122,11,19,0.12);
  color: var(--primary-dark);
}

/* --- Epopsio Admin Polish --- */
.table td, .table th { vertical-align: middle; }
.actions a {
  margin-left: 10px;
  cursor: pointer;
  transition: color .16s ease;
}
.actions a:hover,
.actions a:focus-visible {
  color: var(--primary-dark) !important;
}
.pill { display:inline-flex; align-items:center; justify-content:center; min-width:70px; }
.modal { max-width: 900px; }
.modal .input { height: 44px; }
.errorline { margin-top: 12px; }

/* === EPOPSIO SIDEBAR BRAND STACK FIX (AUTO) === */
.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 18px;
  padding-bottom: 18px;
  text-align: center;
}

.sidebar .brand img,
.sidebar .brand .logo,
.sidebar .brand .brand-logo {
  display: block;
  max-width: 170px;
  height: auto;
  margin: 0 auto;
}

.sidebar .brand-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  margin-top: 2px;
}

.sidebar .brand-title strong {
  display: block;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.sidebar .brand-title span {
  display: block;
  opacity: 0.85;
  font-weight: 500;
  margin-top: 4px;
}
/* === END EPOPSIO SIDEBAR BRAND STACK FIX (AUTO) === */

/* === RELEASE OVERRIDE: UNIFIED LIGHT SIDEBAR === */
.sidebar{
  width: 270px;
  flex: 0 0 270px;
  background: #FFFFFF;
  color: var(--text-black);
  border-right: 1px solid var(--border);
}

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

.sidebar .brand-title strong{
  color: var(--text-black);
}

.sidebar .brand-title span{
  color: var(--text-muted);
  opacity: 1;
}

.nav a{
  color: var(--text-black);
}

.nav-section{
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.nav-section-title{
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999999;
}

.nav-section-items{
  padding-left: 12px;
}

.tab-strip{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

.tab-btn{
  appearance:none;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text-black);
  border-radius:999px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;
  transition:all .2s ease;
}

.tab-btn:hover{
  border-color:rgba(122,11,19,0.25);
  color:var(--primary-dark);
  background:rgba(122,11,19,0.06);
}

.tab-btn.active{
  border-color:rgba(122,11,19,0.25);
  color:var(--primary-dark);
  background:rgba(122,11,19,0.10);
}

.tab-panel{
  display:none;
}

.tab-panel.active{
  display:block;
}

.status-grid{
  display:grid;
  gap:12px;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
}

.status-card{
  padding:14px;
}

.status-label{
  font-size:11px;
  color:var(--text-muted);
  text-transform:uppercase;
  letter-spacing:0.08em;
  font-weight:700;
}

.status-value{
  margin-top:8px;
  font-size:18px;
  font-weight:800;
  color:var(--text-black);
}

.form-feedback{
  margin-top:14px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  font-size:13px;
  font-weight:600;
}

.form-feedback.success{
  color:#0D7A3A;
  border-color:rgba(25,195,125,0.25);
  background:rgba(25,195,125,0.10);
}

.form-feedback.error{
  color:#A61B1B;
  border-color:rgba(220,38,38,0.28);
  background:rgba(220,38,38,0.10);
}

.form-feedback.note{
  color:var(--primary-dark);
  border-color:rgba(122,11,19,0.25);
  background:rgba(122,11,19,0.08);
}

.nav a:hover{
  background: rgba(122,11,19,0.10);
  border-color: rgba(122,11,19,0.25);
  color: var(--primary-dark);
}

.nav a.active{
  background: rgba(122,11,19,0.10);
  border-color: rgba(122,11,19,0.25);
  color: var(--primary-dark);
}
/* === END RELEASE OVERRIDE: UNIFIED LIGHT SIDEBAR === */
