/* ========== GLOBAL RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  max-width: 100%;
}

@supports not (overflow: clip) {
  html {
    overflow-x: hidden;
  }
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.2s ease;
  max-width: 100%;
}

/* ========== DARK THEME (default - FULL COVERAGE) ========== */
body.dark {
  --bg: #0f1117;
  --bg2: #161820;
  --bg3: #1e2030;
  --bg4: #252840;
  --surface: #1a1d2e;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --accent: #FD6802;
  --accent-rgb: 253, 104, 2;
  --accent2: #ff8f42;
  --accent-glow: rgba(253, 104, 2, 0.28);
  --green: #00d68f;
  --green-glow: rgba(0,214,143,0.2);
  --red: #ff4d6d;
  --red-glow: rgba(255,77,109,0.2);
  --blue: #3d8ef8;
  --blue-glow: rgba(61,142,248,0.2);
  --amber: #ffb547;
  --text: #e8eaf6;
  --text2: #9ea3c0;
  --text3: #555a7a;
  --shadow: 0 8px 32px rgba(0,0,0,0.45);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.3);
  --toggle-bg: #2d2f3e;
  --toggle-icon: #ffdd88;
  --header-bg: rgba(15,17,23,0.92);
  --overlay-bg: rgba(0,0,0,0.7);
  --scrollbar-track: #161820;
  --scrollbar-thumb: #252840;
  --table-hover: rgba(255,255,255,0.03);
  --input-bg: #1e2030;
  --card-shadow: 0 8px 32px rgba(0,0,0,0.45);
}

/* ========== LIGHT THEME (FULL COVERAGE) ========== */
body.light {
  --bg: #f5f7fe;
  --bg2: #eef2fa;
  --bg3: #ffffff;
  --bg4: #e9edf5;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border2: rgba(0, 0, 0, 0.15);
  --accent: #FD6802;
  --accent-rgb: 253, 104, 2;
  --accent2: #ff7a1a;
  --accent-glow: rgba(var(--accent-rgb), 0.2);
  --green: #0f9d6e;
  --green-glow: rgba(15,157,110,0.12);
  --red: #e5484d;
  --red-glow: rgba(229,72,77,0.1);
  --blue: #2f7be4;
  --blue-glow: rgba(47,123,228,0.1);
  --amber: #e68a2e;
  --text: #1a1f2e;
  --text2: #4a4f6e;
  --text3: #7c7f9e;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --toggle-bg: #e2e6f0;
  --toggle-icon: #FD6802;
  --header-bg: rgba(245,247,254,0.92);
  --overlay-bg: rgba(0,0,0,0.4);
  --scrollbar-track: #eef2fa;
  --scrollbar-thumb: #cbd5e1;
  --table-hover: rgba(var(--accent-rgb), 0.04);
  --input-bg: #ffffff;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

/* Apply all theme variables to EVERY element */
body {
  background-color: var(--bg);
  color: var(--text);
}

/* SCROLLBAR THEMED */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ========== HEADER ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: 64px;
  max-width: 100%;
  min-width: 0;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 clamp(10px, 3vw, 20px);
  gap: clamp(6px, 1.5vw, 12px);
}

.hamburger {
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.2s;
}
.hamburger:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.logo-image {
  height: 34px;
  max-width: min(220px, 42vw);
  width: auto;
  object-fit: contain;
  display: block;
}
.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
  flex-shrink: 0;
}
.logo-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--text), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.hdr-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.hdr-search i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 12px;
}
.hdr-search input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px 8px 32px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}
.hdr-search input::placeholder {
  color: var(--text3);
}
.hdr-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}
.hdr-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.hdr-icon:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}
.hdr-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--bg3);
}

.lang-select {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 10px;
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}
.lang-select:hover {
  background: var(--bg4);
}
.lang-select select {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  outline: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all 0.18s;
}
.user-chip:hover {
  background: var(--bg4);
  border-color: var(--border2);
}
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.25);
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s ease;
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  transform: translateY(-1px);
}
.ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.ava--has-photo .ava__txt {
  display: none;
}
.ava__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ava__txt {
  position: relative;
  z-index: 1;
  line-height: 1;
}
.ava__txt--icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.ava__txt--icon i {
  font-size: 13px;
  opacity: 0.95;
}
.ava-info {
  line-height: 1.25;
}
.ava-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}
.ava-role {
  font-size: 10.5px;
  color: var(--text3);
}

/* Theme Switch Button */
.theme-switch {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-switch:hover {
  background: var(--bg4);
  transform: scale(0.96);
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== GLOBAL TABLE PAGINATION ========== */
.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 10px 0 16px;
}
.table-pager-info {
  font-size: 12px;
  color: var(--text3);
  min-width: 88px;
  text-align: center;
}
.table-pager-btn {
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.table-pager-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}
.table-pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* OVERLAY */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* Below sidebar drawer, above page content — was 150 vs sidebar 100, overlay hid the menu on mobile */
  z-index: 240;
  background: var(--overlay-bg);
  backdrop-filter: blur(3px);
}
.overlay.show {
  display: block;
}

/* SIDEBAR */
.sidebar {
  width: 248px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 18px 10px 28px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Above overlay (240) so mobile drawer is visible and clickable; below header (300) */
  z-index: 280;
  -webkit-overflow-scrolling: touch;
}
/* Collapse only on desktop — on mobile, .collapsed + .open tied on transform and the drawer stayed off-screen */
@media (min-width: 861px) {
  .sidebar.collapsed {
    transform: translateX(-100%);
  }
}
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 10px 5px;
  display: block;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
  position: relative;
}
.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}
.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}
.nav-item.open,
.nav-item.active {
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.04));
  color: var(--accent2);
}
.nav-item.open::before,
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}
.nav-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.2s;
  color: var(--text3);
}
.nav-item.open .nav-arrow {
  transform: rotate(90deg);
}
.subnav {
  padding: 2px 0 4px;
  display: block;
}
.sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 38px;
  border-radius: 10px;
  color: var(--text3);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s;
  margin-bottom: 1px;
  position: relative;
  text-decoration: none;
}
.sub-item i {
  font-size: 11px;
  width: 13px;
  text-align: center;
}
.sub-item:hover {
  background: var(--bg3);
  color: var(--text2);
}
.sub-item.active {
  color: var(--accent2);
  background: rgba(var(--accent-rgb), 0.1);
}
.divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

/* LAYOUT — min-width:0 prevents flex children from forcing page-wide horizontal scroll */
.layout {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.main {
  margin-left: 248px;
  padding: calc(64px + 26px) 26px 60px;
  min-height: 100vh;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: var(--bg);
}
@supports not (overflow: clip) {
  .main {
    overflow-x: hidden;
  }
}
.main.full {
  margin-left: 0;
}

/* BREADCRUMB */
.bc {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text3);
  margin-bottom: 22px;
  max-width: 100%;
  row-gap: 4px;
}
.bc a {
  color: var(--accent2);
  text-decoration: none;
  font-weight: 600;
}
.bc a:hover {
  text-decoration: underline;
}
.bc i {
  font-size: 9px;
}

/* STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: fup 0.4s both;
  box-shadow: var(--shadow-sm);
}
.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-ico {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.si-p {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent2);
}
.si-g {
  background: rgba(0, 214, 143, 0.14);
  color: var(--green);
}
.si-r {
  background: rgba(255, 77, 109, 0.13);
  color: var(--red);
}
.si-b {
  background: rgba(61, 142, 248, 0.14);
  color: var(--blue);
}
.stat-val {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.stat-lbl {
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 2px;
}
.stat-chg {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}
.up {
  color: var(--green);
}
.dn {
  color: var(--red);
}
.ne {
  color: var(--text3);
}

/* CARD */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  animation: fup 0.4s 0.25s both;
  box-shadow: var(--card-shadow);
  max-width: 100%;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.card-ttl {
  flex: 1;
  min-width: 0;
}
.card-ttl h2 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.card-ttl p {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.card-acts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* FILTER BAR */
.fbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: var(--surface);
}
.ftab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text3);
  background: transparent;
  font-family: inherit;
  transition: all 0.15s;
}
.ftab.is-loading {
  opacity: 0.9;
  cursor: wait;
  pointer-events: none;
}
.ftab:hover {
  color: var(--text);
  border-color: var(--border2);
  background: var(--bg3);
}
.ftab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 14px var(--accent-glow);
}
.fsearch {
  margin-left: auto;
  position: relative;
  min-width: 0;
  max-width: 100%;
}
.fsearch i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 11px;
}
.fsearch input {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px 6px 30px;
  font-size: 12.5px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  width: min(200px, 100%);
  max-width: 100%;
  box-sizing: border-box;
  transition: all 0.2s;
}
.fsearch input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn-ghost {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-ghost:hover {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}
.btn-red {
  background: linear-gradient(135deg, var(--red), #ff2d55);
  color: #fff;
  box-shadow: 0 4px 14px var(--red-glow);
}
.btn-blue {
  background: linear-gradient(135deg, var(--blue), #6aaaff);
  color: #fff;
  box-shadow: 0 4px 14px var(--blue-glow);
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* TABLE — horizontal scroll contained inside card, not the viewport */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  width: 100%;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
thead tr {
  background: var(--bg2);
}
thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}
thead th:first-child {
  padding-left: 22px;
  width: 56px;
}
thead th:last-child {
  text-align: center;
  width: 110px;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.13s;
  animation: fup 0.3s 0.32s both;
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--table-hover);
}
tbody td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text2);
  vertical-align: middle;
}
tbody td:first-child {
  padding-left: 22px;
  color: var(--text3);
  font-weight: 600;
}

.td-user {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.td-user > div:last-child {
  min-width: 0;
}
.td-ava {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px var(--accent-glow);
  overflow: hidden;
  position: relative;
}
.td-ava--has-photo .td-ava__txt {
  display: none;
}
.td-ava__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.td-ava__txt {
  position: relative;
  z-index: 1;
  line-height: 1;
}
.td-name {
  font-weight: 700;
  color: var(--text);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-handle {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}
.td-info {
  display: flex;
  align-items: center;
  gap: 7px;
}
.td-info i {
  color: var(--text3);
  font-size: 11px;
}
.role-b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
}
.role-admin {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent2);
}
.role-editor {
  background: rgba(61, 142, 248, 0.15);
  color: var(--blue);
}
.role-viewer {
  background: rgba(255, 181, 71, 0.15);
  color: var(--amber);
}
.pw-dots {
  letter-spacing: 3px;
  color: var(--text3);
  font-size: 13px;
}
.status-b {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.s-active {
  background: rgba(0, 214, 143, 0.11);
  color: var(--green);
  border: 1px solid rgba(0, 214, 143, 0.25);
}
.s-active::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.s-blocked {
  background: rgba(255, 77, 109, 0.11);
  color: var(--red);
  border: 1px solid rgba(255, 77, 109, 0.25);
}
.s-blocked::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
}
.acts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.abt {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.abt:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border2);
}
.abt.edit:hover {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent2);
  border-color: var(--accent);
}
.abt.view:hover {
  background: rgba(61, 142, 248, 0.14);
  color: var(--blue);
  border-color: var(--blue);
}
.abt.del:hover {
  background: rgba(255, 77, 109, 0.12);
  color: var(--red);
  border-color: var(--red);
}

/* Button loading spinners (users, roles, etc.) */
.btn .sw-btn-icon,
.abt .sw-btn-icon,
.sw-btn .sw-btn-icon {
  display: inline-flex;
  width: 1.05em;
  justify-content: center;
  align-items: center;
}
.btn.is-loading,
.abt.is-loading,
.ftab.is-loading,
.sw-btn.is-loading {
  opacity: 0.92;
  cursor: wait;
  pointer-events: none;
  transform: none !important;
}
.btn.is-loading .sw-btn-icon-default,
.abt.is-loading .sw-btn-icon-default,
.ftab.is-loading .sw-btn-icon-default,
.sw-btn.is-loading .sw-btn-icon-default {
  display: none;
}
.btn.is-loading .sw-btn-icon-spinner,
.abt.is-loading .sw-btn-icon-spinner,
.ftab.is-loading .sw-btn-icon-spinner,
.sw-btn.is-loading .sw-btn-icon-spinner {
  display: inline-flex;
}
.btn:not(.is-loading) .sw-btn-icon-spinner,
.abt:not(.is-loading) .sw-btn-icon-spinner,
.ftab:not(.is-loading) .sw-btn-icon-spinner,
.sw-btn:not(.is-loading) .sw-btn-icon-spinner {
  display: none;
}
.abt.is-loading {
  color: var(--text3);
}

/* FOOTER */
.footer {
  text-align: center;
  margin-top: 26px;
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 16px;
}
.footer a {
  color: var(--accent2);
  text-decoration: none;
  font-weight: 600;
}
.footer i {
  color: var(--red);
}

/* ANIMATIONS */
@keyframes fup {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- User roles (admin) ---------- */
.roles-page .roles-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.roles-page .roles-toolbar .roles-search {
  margin-left: 0;
  flex: 1 1 220px;
  min-width: 0;
}
.roles-page .role-slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: var(--text3);
}
.roles-page .role-chip-sys {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent2);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
}
.roles-page .role-chip-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(61, 142, 248, 0.12);
  color: var(--blue);
  border: 1px solid rgba(61, 142, 248, 0.22);
}
@media (max-width: 640px) {
  .roles-page .roles-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .roles-page .roles-toolbar .btn {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 600px) {
  .roles-page .roles-toolbar .fsearch.roles-search {
    display: block !important;
    width: 100%;
    max-width: none;
  }
}

/* ---------- Role access (admin) ---------- */
.ra-page .ra-lead {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  margin: 0 0 18px;
  max-width: 72ch;
}
.ra-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 18px;
  align-items: start;
}
.ra-card .ra-card-body {
  padding: 16px clamp(14px, 3vw, 20px) 18px;
}
.ra-role-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(62vh, 640px);
  overflow-y: auto;
  padding-right: 4px;
}
.ra-role-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.ra-role-btn:hover {
  border-color: var(--border2);
  background: var(--bg3);
}
.ra-role-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(var(--accent-rgb), 0.08);
}
.ra-role-title {
  font-weight: 700;
  font-size: 14px;
}
.ra-role-meta {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ra-role-meta code {
  font-size: 11px;
  color: var(--text2);
}
.ra-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent2);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}
.ra-pill-muted {
  background: var(--bg4);
  color: var(--text3);
  border-color: var(--border);
}
.ra-hidden {
  display: none !important;
}
.ra-empty {
  font-size: 13px;
  color: var(--text3);
  padding: 16px 8px;
  line-height: 1.5;
}
.ra-empty a {
  color: var(--accent2);
}
.ra-mod-head {
  flex-wrap: wrap;
  gap: 12px;
}
.ra-mod-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ra-mod-list {
  max-height: min(62vh, 720px);
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ra-mod-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  padding: 12px 14px 12px var(--ra-depth-pad, 14px);
  transition: border-color 0.15s;
}
.ra-mod-block:hover {
  border-color: var(--border2);
}
.ra-mod-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.ra-mod-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
  flex-shrink: 0;
  font-size: 15px;
}
.ra-mod-main {
  flex: 1;
  min-width: 0;
}
.ra-mod-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ra-mod-route {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
  word-break: break-all;
}
.ra-mod-route i {
  margin-right: 6px;
  opacity: 0.7;
}
.ra-perms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 10px;
}
.ra-perm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
}
.ra-perm input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}
.ra-btn-xs {
  padding: 4px 8px !important;
  font-size: 11px !important;
  margin-left: auto;
}
.ra-mod-empty {
  font-size: 12px;
  color: var(--text3);
  margin-top: 8px;
}
.ra-status {
  font-size: 12px;
  color: var(--green);
  margin: 14px 0 0;
  min-height: 1.2em;
}
@media (max-width: 1024px) {
  .ra-grid {
    grid-template-columns: 1fr;
  }
  .ra-role-list,
  .ra-mod-list {
    max-height: none;
  }
}
@media (max-width: 600px) {
  .ra-page .ra-search.fsearch {
    display: block !important;
    width: 100%;
    max-width: none;
  }
  .ra-mod-actions {
    width: 100%;
  }
  .ra-mod-actions .btn {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }
  .ra-mod-actions .btn-accent {
    flex: 1 1 100%;
  }
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translate3d(0, 0, 0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
  }
  .main {
    margin-left: 0 !important;
    padding: calc(64px + 18px) clamp(10px, 3vw, 14px) 48px;
  }
  .hdr-search {
    display: none;
  }
  .ava-info {
    display: none;
  }
  .lang-select {
    display: none;
  }
  .fbar {
    padding: 12px clamp(12px, 3vw, 22px);
  }
  .card-head {
    padding: 16px clamp(14px, 3vw, 22px);
  }
  thead th,
  tbody td {
    padding-left: 12px;
    padding-right: 12px;
  }
  thead th:first-child,
  tbody td:first-child {
    padding-left: 14px;
  }
}

@media (max-width: 640px) {
  .header .hdr-icon {
    display: none;
  }
  tbody td {
    word-break: break-word;
  }
  .td-info {
    flex-wrap: wrap;
  }
  table {
    min-width: 560px;
  }
}

@media (max-width: 600px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat {
    padding: 14px;
  }
  .stat-val {
    font-size: 20px;
  }
  .btn span {
    display: none;
  }
  .btn {
    padding: 8px 11px;
  }
  .fsearch {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: 1fr;
  }
  .logout-btn span {
    display: none;
  }
  .logout-btn {
    padding: 0 10px;
    min-width: 36px;
    justify-content: center;
  }
  .user-chip {
    display: none;
  }
  .logo-text {
    max-width: 28vw;
  }
}