@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');
:root {
  --bg-base:         #0b0c14;
  --bg-surface:      #0f1019;
  --bg-card:         #141620;
  --bg-card-hover:   #191c2a;
  --bg-input:        #0f1019;
  --bg-modal:        #141620;
  --bg-sidebar:      #0c0d16;
  --bg-header:       rgba(11, 12, 20, 0.85);

  --border:          rgba(255, 255, 255, 0.07);
  --border-strong:   rgba(255, 255, 255, 0.12);
  --border-accent:   rgba(74, 140, 255, 0.4);

  --text-primary:    #e4e6f0;
  --text-secondary:  #7b8099;
  --text-muted:      #4a4f66;
  --text-accent:     #4a8cff;

  --accent:          #4a8cff;
  --accent-glow:     rgba(74, 140, 255, 0.18);
  --accent-bright:   #6ea8ff;
  --accent-dim:      rgba(74, 140, 255, 0.08);

  --success:         #10b981;
  --success-bg:      rgba(16, 185, 129, 0.1);
  --success-border:  rgba(16, 185, 129, 0.3);

  --danger:          #ef4444;
  --danger-bg:       rgba(239, 68, 68, 0.1);
  --danger-border:   rgba(239, 68, 68, 0.3);

  --warning:         #f59e0b;
  --warning-bg:      rgba(245, 158, 11, 0.1);
  --warning-border:  rgba(245, 158, 11, 0.3);

  --info:            #22d3ee;
  --info-bg:         rgba(34, 211, 238, 0.1);

  --sidebar-width:   248px;
  --header-height:   60px;

  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       14px;
  --radius-xl:       20px;
  --radius-full:     999px;

  --shadow-sm:       0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:       0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.6);

  --transition:      0.2s ease;
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --font-ui:   'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

a { color: var(--text-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-bright); }
img { display: block; max-width: 100%; }
button { font-family: var(--font-ui); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-ui); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }
#preloader {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s, visibility 0.4s;
}
#preloader.hidden { opacity: 0; visibility: hidden; }

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar-nav-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
  transition: transform var(--transition-slow);
}

.navbar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.navbar-logo img { height: 32px; width: auto; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.sidebar-nav ul { list-style: none; }

.nav-item { position: relative; }

.nav-item > a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.nav-item > a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.nav-item.active > a,
.nav-item > a.active-link {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-item.active > a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item .icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item .text { flex: 1; }
.dropdown-nav {
  list-style: none;
  padding: 2px 0 4px 44px;
}
.dropdown-nav li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  margin: 1px 8px 1px 0;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 400;
  transition: all var(--transition);
}
.dropdown-nav li a:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.dropdown-nav li a.active-link,
.dropdown-nav li a[href="/apikey"].active-page {
  color: var(--accent);
  background: var(--accent-dim);
  position: relative;
}
.dropdown-nav li a.active-link::before,
.dropdown-nav li a[href="/apikey"].active-page::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.dropdown-nav li a i { width: 16px; font-size: 0.78rem; color: var(--text-muted); }
.dropdown-nav.collapse { display: none; }
.dropdown-nav.collapse.show { display: block; }
.divider { padding: 8px 16px; }
.divider hr { border: none; border-top: 1px solid var(--border); }
.sidebar-section-label {
  padding: 12px 24px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.user-section {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-section .input-style-3 { margin-bottom: 10px; }
.ip-selector-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
  padding-left: 2px;
}
.nav-item-has-children > a::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.7rem;
  margin-left: auto;
  transition: transform var(--transition);
  color: var(--text-muted);
}
.nav-item-has-children > a[aria-expanded="true"]::after { transform: rotate(180deg); }
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 400;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}
.overlay.active { opacity: 1; visibility: visible; }
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.main-wrapper.sidebar-collapsed { margin-left: 0; }
.header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 300;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header .container-fluid { width: 100%; }
.header .row { display: flex; align-items: center; width: 100%; }

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
#menu-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
#menu-toggle:hover { border-color: var(--border-strong); color: var(--text-primary); }
.profile-box { position: relative; }

.profile-box .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  background: none !important;
  border: 1px solid transparent !important;
}
.profile-box .dropdown-toggle:hover { background: var(--bg-card) !important; border-color: var(--border) !important; }

.profile-info .info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-info .image {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
}
.profile-info .image img { width: 100%; height: 100%; object-fit: cover; }
.profile-info h6 { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.profile-info p { font-size: 0.72rem; color: var(--text-muted); line-height: 1; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 999;
  animation: dropIn 0.15s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.dropdown-menu li { list-style: none; }
.dropdown-menu li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.dropdown-menu li a:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.dropdown-menu li a i { width: 14px; font-size: 0.78rem; color: var(--text-muted); }
.dropdown-menu li.divider { border-top: 1px solid var(--border); margin: 4px 0; }

.author-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px !important;
}
.author-info .image { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 2px solid var(--border); }
.author-info .image img { width: 100%; height: 100%; object-fit: cover; }
.author-info .content h4 { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.page-header {
  padding: 28px 24px 0;
}

.page-title-group { margin-bottom: 6px; }
.page-title-group h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
  max-width: 520px;
  line-height: 1.5;
}
.breadcrumb-wrapper { margin-top: 6px; }
.breadcrumb {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb-item { font-size: 0.78rem; color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  margin-right: 6px;
  color: var(--text-muted);
  opacity: 0.5;
}
.breadcrumb-item.active { color: var(--text-secondary); }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item a:hover { color: var(--text-secondary); }
.content-area {
  padding: 20px 24px 40px;
}
.table-components .container-fluid,
.signin-section .container-fluid { padding: 20px 24px; }

.title-wrapper { padding-top: 24px !important; padding-bottom: 4px; }
.title-wrapper .title h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
}
.pt-30 { padding-top: 20px !important; }
.pt-55 { padding-top: 24px !important; }
.pt-10 { padding-top: 10px !important; }
.card-style {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}
.card-style:hover { border-color: var(--border-strong); }
.card-style.mb-30 { margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--accent-dim); color: var(--accent); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.yellow { background: var(--warning-bg); color: var(--warning); }

.stat-content h3 { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-content p { font-size: 0.78rem; color: var(--text-secondary); margin-top: 3px; }
.table-wrapper { overflow-x: auto; }
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

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

.table thead tr {
  border-bottom: 1px solid var(--border);
}
.table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.table thead th h6 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0;
}

.table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background var(--transition);
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,0.025); }

.table tbody td {
  padding: 11px 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}
.table tbody td.mono,
.table td .mono-val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-primary);
}
.table-search { position: relative; }
.table-search form {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition);
  min-width: 220px;
}
.table-search form:focus-within { border-color: var(--border-accent); }
.table-search form input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
}
.table-search form input::placeholder { color: var(--text-muted); }
.table-search form button {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  height: 100%;
  transition: color var(--transition);
}
.table-search form button:hover { color: var(--text-secondary); }
.table-pagination { display: flex; align-items: center; }
.table-pagination ul { display: flex; align-items: center; gap: 4px; list-style: none; }
.table-pagination ul li a {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
}
.table-pagination ul li a:hover { border-color: var(--border-strong); color: var(--text-primary); }
.table-pagination ul li a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.table-footer p { font-size: 0.78rem; color: var(--text-muted); }
.table-footer p span { color: var(--text-secondary); font-weight: 500; }
.main-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
  font-family: var(--font-ui);
}

.primary-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.primary-btn:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.success-btn {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.success-btn:hover { filter: brightness(1.1); color: #fff; }

.danger-btn {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.danger-btn:hover { filter: brightness(1.1); color: #fff; }

.secondary-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.secondary-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.outline-btn {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.outline-btn:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.btn-hover { }
.rounded-full { border-radius: var(--radius-full) !important; }
.w-100 { width: 100%; justify-content: center; }
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.action-btn.edit { color: var(--accent); background: var(--accent-dim); }
.action-btn.edit:hover { background: var(--accent); color: #fff; }
.action-btn.delete { color: var(--danger); background: var(--danger-bg); }
.action-btn.delete:hover { background: var(--danger); color: #fff; }
.action-btn.view { color: var(--info); background: var(--info-bg); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-blue  { background: var(--accent-dim); color: var(--accent); border-color: rgba(74,140,255,0.2); }
.badge-green { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-red   { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.badge-yellow{ background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-gray  { background: rgba(255,255,255,0.05); color: var(--text-secondary); border-color: var(--border); }
.role-admin   { background: rgba(168,85,247,0.12); color: #c084fc; border-color: rgba(168,85,247,0.25); }
.role-reseller{ background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.role-user    { background: var(--accent-dim); color: var(--accent); border-color: rgba(74,140,255,0.2); }
.input-group { margin-bottom: 16px; }
.input-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.input-group .hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.input-style-1 { margin-bottom: 16px; }
.input-style-1 label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.input-style-1 input,
.input-style-1 select,
.input-style-1 textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color var(--transition);
  outline: none;
}
.input-style-1 input:focus,
.input-style-1 select:focus,
.input-style-1 textarea:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-style-1 input::placeholder,
.input-style-1 textarea::placeholder { color: var(--text-muted); }
.input-style-3 {
  position: relative;
  margin-bottom: 12px;
}
.input-style-3 input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 40px 9px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: border-color var(--transition);
  outline: none;
}
.input-style-3 input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-style-3 input::placeholder { color: var(--text-muted); }
.input-style-3 .icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}
.select-style-2 { margin-bottom: 12px; }
.select-style-2 .select-position { position: relative; }
.select-style-2 .select-position::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
}
.select-style-2 select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 36px 9px 14px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.select-style-2 select:focus { border-color: var(--border-accent); }
.select-style-2 select option { background: var(--bg-card); }
.modal-dark-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}
.modal-dark-overlay.active { opacity: 1; visibility: visible; }

.modal-popup {
  background: var(--bg-modal);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 24px;
  min-width: 380px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.5);
  transform: translateY(-12px) scale(0.97);
  transition: transform var(--transition-slow);
  position: relative;
}
.modal-dark-overlay.active .modal-popup { transform: none; }
.modal-popup.transformeaseinmodal { }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header .modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.close-modal-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.85rem;
}
.close-modal-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.modal-content { background: none !important; border: none !important; padding: 0 !important; }
.notification-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  pointer-events: none;
}
.notification-container .notification {
  pointer-events: all;
}

.notification {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  isolation: isolate;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: notifIn 0.25s ease;
  font-size: 0.85rem;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.notification.red {
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-left: 3px solid var(--danger);
  background: #2a1618;
}

.notification.green {
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-left: 3px solid var(--success);
  background: #102a22;
}

.notification.blue {
  border: 1px solid rgba(74, 140, 255, 0.35);
  border-left: 3px solid var(--accent);
  background: #141f36;
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 12px 24px 0;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger);  }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.62rem;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
  font-style: normal;
  font-weight: 700;
  transition: all var(--transition);
}
.help-tip:hover { background: var(--accent-dim); border-color: var(--border-accent); color: var(--accent); }
.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  pointer-events: none;
  z-index: 1000;
  font-weight: 400;
  font-style: normal;
}
.help-tip:hover::after { opacity: 1; visibility: visible; }
.signin-section { min-height: 100vh; display: flex; align-items: center; }
.auth-row { min-height: 100vh; }

.auth-cover-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-surface) 0%, #0d1026 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.auth-cover-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.5;
}
.auth-cover-wrapper::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74,140,255,0.12) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.auth-cover { position: relative; z-index: 1; text-align: center; padding: 40px; }
.auth-cover h1 { font-size: 2rem; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.auth-cover p { color: var(--text-secondary); font-size: 0.9rem; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 32px;
}
.auth-brand img { height: 38px; }

.auth-feature-list {
  list-style: none;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.auth-feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.auth-feature-list li i { color: var(--accent); width: 16px; }

.signin-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px;
  background: var(--bg-base);
}

.form-wrapper { width: 100%; max-width: 360px; }
.form-wrapper h6 { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.form-wrapper > p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 28px; line-height: 1.5; }
.mfa-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}
.mfa-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.mfa-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-lg);
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.4rem;
  color: var(--accent);
}
.mfa-card h4 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.mfa-card p  { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 24px; }
.info-panel {
  background: var(--accent-dim);
  border: 1px solid rgba(74,140,255,0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.info-panel i { color: var(--accent); margin-top: 1px; flex-shrink: 0; font-size: 0.85rem; }
.info-panel p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.info-panel strong { color: var(--text-primary); }
.error-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.error-code {
  font-size: 6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  margin-bottom: 12px;
}
.error-message { font-size: 1.1rem; color: var(--text-primary); margin-bottom: 8px; font-weight: 600; }
.error-sub { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 28px; }
.api-endpoint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
}
.api-method {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.method-get  { background: var(--success-bg); color: var(--success); }
.method-post { background: var(--accent-dim); color: var(--accent); }
.method-del  { background: var(--danger-bg);  color: var(--danger);  }
.method-put  { background: var(--warning-bg); color: var(--warning); }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.code-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  overflow-x: auto;
  color: var(--text-secondary);
}
button, a, [onclick], select, input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 1024px) {
  .sidebar-nav-wrapper {
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 600;
  }
  .sidebar-nav-wrapper.sidebar-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,0.6);
  }
  .main-wrapper { margin-left: 0 !important; }
  .overlay { display: block; pointer-events: none; }
  .overlay.active { pointer-events: all; }
  .header { padding: 0 16px; }
  section[style*="padding:24px"],
  section[style*="padding: 24px"] {
    padding: 16px !important;
  }
  .table-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .table-toolbar .table-search { width: 100%; }
  .table-toolbar .table-search form { width: 100%; }
  .table-toolbar .table-search input { width: 100%; }
  .table-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .table-pagination { align-self: flex-end; }
  .modal-popup {
    width: calc(100vw - 32px) !important;
    min-width: unset !important;
    max-width: calc(100vw - 32px) !important;
  }
  .card-style { padding: 16px; }
  .info-panel { flex-direction: column; gap: 8px; }
  .settings-section-header { gap: 10px; }
}
@media (max-width: 640px) {

  #stat-cards .card-style { padding: 12px !important; }
  #stat-cards .card-style > div:first-child { width: 30px !important; height: 30px !important; font-size: 0.78rem !important; }
  #stat-cards div[id^="stat-"] { font-size: 1.1rem !important; }

  html { font-size: 14px; }
  .sidebar-nav-wrapper {
    width: 100%;
    max-width: 280px;
  }
  .header { padding: 0 12px; height: 56px; }
  :root { --header-height: 56px; }

  #menu-toggle {
    padding: 6px 11px;
    font-size: 0.8rem;
  }
  .profile-info .image { width: 28px; height: 28px; }
  .profile-info h6 { font-size: 0.8rem; }
  .profile-info p  { display: none; }
  #activeIpDisplay { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  section[style*="padding:24px"],
  section[style*="padding: 24px"] {
    padding: 12px !important;
  }
  div[style*="margin-bottom:20px"] > div[style*="display:flex"][style*="justify-content:space-between"] {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  nav[style*="display:flex"][style*="font-size:0.78rem"] { display: none !important; }
  .card-style { padding: 12px; border-radius: var(--radius-md); }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 540px; font-size: 0.8rem; }

  .table thead th { padding: 8px 10px; }
  .table tbody td { padding: 9px 10px; }
  .action-btn { width: 30px; height: 30px; font-size: 0.78rem; }
  .table-toolbar { gap: 6px; }
  .main-btn { padding: 8px 12px; font-size: 0.8rem; gap: 5px; }
  .table-search form { min-width: unset; }
  .table-pagination ul li a { width: 28px; height: 28px; font-size: 0.75rem; }
  .modal-dark-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-popup {
    width: 100% !important;
    min-width: unset !important;
    max-width: 100% !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
    margin: 0 !important;
    max-height: 90vh;
    overflow-y: auto;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .modal-popup::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border-strong);
    border-radius: 99px;
    margin: 0 auto 16px;
  }
  .notification-container {
    bottom: 16px;
    right: 12px;
    left: auto;
    max-width: calc(100vw - 24px);
  }
  .notification { font-size: 0.82rem; }
  .alert { margin: 8px 12px 0; }
  div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns:1fr 340px"] {
    grid-template-columns: 1fr !important;
  }
  .settings-section { padding: 16px; }
  .settings-section-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .settings-section-header > div:last-child { width: 100%; }
  .settings-section-header > div:last-child .main-btn { width: 100%; justify-content: center; }
  .cache-action-row {
    flex-direction: column;
    align-items: stretch;
  }
  .cache-action-row .main-btn { width: 100%; justify-content: center; }
  .cache-action-row .input-style-3 { max-width: unset !important; }
  .info-panel { padding: 10px 12px; }
  .info-panel p { font-size: 0.78rem; }
  .dropdown-menu {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    min-width: unset;
    animation: slideUp 0.2s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
  .dropdown-menu li { list-style: none; }
.dropdown-menu li a { padding: 12px 14px; font-size: 0.88rem; }
  .author-info { padding: 12px 14px !important; }
  div > h2[style*="font-size:1.35rem"] { font-size: 1.15rem !important; }
  .table-footer { padding-top: 10px; margin-top: 10px; }
  .table-footer p { font-size: 0.75rem; }
  .help-tip::after {
    left: 0;
    transform: none;
    max-width: 200px;
  }
  .user-section { padding: 10px; }
  .ip-selector-bar { padding: 8px; }
  .main-wrapper {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
@media (max-width: 380px) {
  html { font-size: 13px; }
  .header { padding: 0 10px; }
  section[style*="padding:24px"],
  section[style*="padding: 24px"] { padding: 10px !important; }
  .card-style { padding: 10px; }
  #activeIpDisplay { display: none; }
}
@media (max-width: 768px) {
  .login-page { grid-template-columns: 1fr !important; }
  .login-left  { display: none !important; }
  .login-right { min-height: 100vh; padding: 32px 20px; }
  .login-form-box { max-width: 100%; }
}
@media (max-width: 480px) {
  .mfa-wrap { padding: 16px; }
  .mfa-card { padding: 24px 18px; }
}
.sidebar-nav-wrapper {
  will-change: transform;
  backface-visibility: hidden;
}
body.sidebar-is-open { overflow: hidden; }
body.modal-is-open   { overflow: hidden; }
.d-flex        { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.flex-wrap     { flex-wrap: wrap; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.ml-15         { margin-left: 10px; }
.mr-15         { margin-right: 10px; }
.mb-10         { margin-bottom: 8px; }
.mb-15         { margin-bottom: 12px; }
.mb-25         { margin-bottom: 20px; }
.mb-30         { margin-bottom: 20px; }
.pt-40         { padding-top: 32px; }
.text-sm       { font-size: 0.82rem; }
.text-gray     { color: var(--text-muted); }
.text-medium   { font-weight: 500; }
.text-primary  { color: var(--text-primary) !important; }
.text-center   { text-align: center; }
.fw-500        { font-weight: 500; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-lg-12 { flex: 0 0 100%; max-width: 100%; }
.col-12    { flex: 0 0 100%; max-width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 0; }
.green { color: var(--success) !important; }
.red   { color: var(--danger)  !important; }
.font-mono { font-family: var(--font-mono); }
.darkTheme { }
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checkbox-wrapper input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-wrapper label { font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; }
.toggle {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: #fff; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.fade-up { animation: fadeUp 0.3s ease both; }
.fade-up-delay-1 { animation-delay: 0.05s; }
.fade-up-delay-2 { animation-delay: 0.1s; }
.fade-up-delay-3 { animation-delay: 0.15s; }
.of-h-dd { overflow-x: hidden; }
.bg-primary-100 { background: var(--bg-surface); }
.bg-transparent { background: transparent; }
.border-0 { border: none; }
.table-responsive { overflow-x: auto; }
.container-fluid { padding: 0; }
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.header-ip-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
@media (max-width: 480px) {
  .header-ip-pill { display: none; }
}
.action {
  display: inline-flex;
  align-items: center;
}
button.text-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--danger-border);
  color: var(--danger);
  cursor: pointer;
  font-size: 0.72rem;
  transition: all var(--transition);
  margin: 0 2px;
  opacity: 0.7;
}
button.text-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  opacity: 1;
}
#ips td:last-child,
#ips th:last-child {
  white-space: nowrap;
}
button.text-success {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
  margin: 0 2px;
}
button.text-success:hover {
  background: var(--success);
  color: #fff;
}
button.text-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
  margin: 0 2px;
}
button.text-primary:hover {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 1024px) {
  .sidebar-nav-wrapper { transform: translateX(-100%); }
  .sidebar-nav-wrapper.sidebar-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
}
@media (min-width: 1025px) {
  #menu-toggle { display: none; }
}

.modal-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  max-width: calc(100vw - 32px);
  z-index: 900;
}
#modal-dark-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 800;
}

.page-body {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  padding: 24px 32px;
  box-sizing: border-box;
}

.page-body .card-style {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 24px;
}

.page-body .card-style .table-wrapper {
  flex: 1;
  min-height: 0;
}

@media (max-width: 1024px) {
  .page-body {
    height: auto;
  }
  .page-body .card-style {
    flex: none;
  }
  .page-body .card-style .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

#users td, #ips td {
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#users td p, #ips td p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.text-danger i, button.text-success i, button.text-primary i {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}

#keys td.key-cell .key-value {
  filter: blur(6px);
  opacity: 0.7;
  transition: filter .18s ease, opacity .18s ease;
  user-select: text;
  -webkit-user-select: text;
}

#keys tr:hover td.key-cell .key-value,
#keys td.key-cell.revealed .key-value,
#keys td.key-cell:focus .key-value {
  filter: blur(0);
  opacity: 1;
}

@media (max-width: 768px) {
  #keys tr:hover td.key-cell .key-value {
    filter: blur(6px);
    opacity: 0.7;
  }

  #keys td.key-cell.revealed .key-value {
    filter: blur(0);
    opacity: 1;
  }
}

.rules-sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.rules-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

.rules-sidebar-footer {
  flex-shrink: 0;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
}

.sidebar-footer-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ip-selector-input,
.ip-jump-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.ip-selector-input {
  padding: 10px 12px;
  font-size: 0.875rem;
  min-height: 44px;
  appearance: auto;
  -webkit-appearance: auto;
  cursor: pointer;
}

.ip-jump-form {
  margin-top: 8px;
}

.ip-jump-input {
  padding: 9px 12px;
  font-size: 0.82rem;
  min-height: 44px;
  -webkit-appearance: none;
}

.rules-clickable {
  cursor: pointer;
}

.rules-header-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.rules-header-spacer {
  flex: 1;
}

#profileMenu {
  display: none;
}

.rules-content {
  padding: 24px 32px;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.section-heading {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.section-copy {
  max-width: 820px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 24px;
}

.rules-card {
  padding: 24px;
}

.rules-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.rules-search {
  position: relative;
  flex: 1 1 340px;
  min-width: 260px;
}

.rules-search-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 42px 11px 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-sizing: border-box;
}

.rules-search-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted);
  pointer-events: none;
}

.rules-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.rules-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.rules-table thead th {
  text-align: left;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.rules-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  vertical-align: middle;
}

.rules-table tbody tr:last-child td {
  border-bottom: none;
}

.rule-cell-mono {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 0.84rem;
}

.rule-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  white-space: nowrap;
}

.rule-type-badge.tcp-generic {
  border-color: rgba(59, 130, 246, 0.28);
}

.rule-type-badge.udp-adaptive {
  border-color: rgba(16, 185, 129, 0.28);
}

.rule-type-badge.drop {
  border-color: rgba(239, 68, 68, 0.28);
}

.rule-type-badge.holepunch {
  border-color: rgba(245, 158, 11, 0.28);
}

.action-btn {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  transition: 0.2s ease;
}

.action-btn:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
}

.table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.table-summary {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.table-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-indicator {
  min-width: 42px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-primary);
  font-weight: 600;
}

.empty-state {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.modal-popup-wide {
  max-width: 560px;
}

.modal-popup-medium {
  max-width: 520px;
}

.modal-popup-small {
  max-width: 460px;
}

.modal-intro {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.modal-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.modal-field {
  margin-bottom: 14px;
}

.modal-field-spaced {
  margin-bottom: 16px;
}

.modal-field input,
.modal-field select,
.modal-field-spaced input,
.modal-field-spaced select {
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.profile-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  backdrop-filter: blur(4px);
}

.profile-sheet {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  border-top: 1px solid var(--border);
  max-height: 70vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 99px;
  margin: 0 auto 16px;
}

.profile-sheet-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.profile-sheet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.profile-sheet-name {
  font-weight: 600;
  color: var(--text-primary);
}

.profile-sheet-role {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.profile-sheet-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}

.profile-sheet-link-danger {
  color: var(--danger);
  border-bottom: none;
}

.profile-sheet-link-icon {
  width: 18px;
  color: var(--text-muted);
}

.profile-sheet-link-danger .profile-sheet-link-icon {
  color: inherit;
}

@media (max-width: 640px) {
  .rules-content {
    padding: 20px 16px;
  }

  .rules-toolbar {
    align-items: stretch;
  }

  .rules-toolbar > * {
    width: 100%;
  }

  .modal-popup {
    width: calc(100vw - 24px);
  }
}
