/* ─── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg-base: #0a0c10;
  --bg-surface: #0f1318;
  --bg-elevated: #151a22;
  --bg-hover: #1c2330;
  --bg-active: #1e2a3a;

  --border: #1e2738;
  --border-light: #243044;

  --text-primary: #e8edf5;
  --text-secondary: #8a97aa;
  --text-muted: #4e5d72;

  --accent: #2d7cf6;
  --accent-hover: #3d8cf8;
  --accent-dim: rgba(45, 124, 246, 0.12);
  --accent-border: rgba(45, 124, 246, 0.3);

  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --green-border: rgba(34, 197, 94, 0.25);

  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --red-border: rgba(239, 68, 68, 0.25);

  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.12);

  --purple: #a855f7;
  --purple-dim: rgba(168, 85, 247, 0.12);

  --sidebar-width: 260px;
  --topbar-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: 'Poppins', sans-serif; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: 'Poppins', sans-serif; }

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

/* ─── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  min-height: 70px;
}

.sidebar-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
}

.brand-tag {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
}

.sidebar-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 20px;
  margin-top: 2px;
  display: inline-block;
  width: fit-content;
}

.role-admin {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.role-user {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section {
  margin-bottom: 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item i { font-size: 17px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.logout-btn {
  color: var(--text-muted);
  width: 100%;
}

.logout-btn:hover {
  background: var(--red-dim);
  color: var(--red);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* ─── Main Content ────────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ─── Topbar ──────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-menu {
  display: none;
  color: var(--text-secondary);
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
}

.topbar-menu:hover { color: var(--text-primary); background: var(--bg-hover); }

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.topbar-title i { font-size: 18px; color: var(--text-secondary); }

.breadcrumb-link {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-link:hover { color: var(--accent); }

.breadcrumb-sep {
  color: var(--text-muted) !important;
  font-size: 14px !important;
}

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

/* ─── Content Body ────────────────────────────────────────────────────────────── */
.content-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── Stats Grid ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon-blue { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.stat-icon-green { background: var(--green-dim); color: var(--green); border: 1px solid var(--green-border); }
.stat-icon-red { background: var(--red-dim); color: var(--red); border: 1px solid var(--red-border); }
.stat-icon-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(168,85,247,0.25); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Section Card ───────────────────────────────────────────────────────────── */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-title i { font-size: 17px; color: var(--accent); }

/* ─── Server Grid ────────────────────────────────────────────────────────────── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
}

.server-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.server-card:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
}

.server-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.server-status-dot.status-online { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.server-status-dot.status-offline { background: var(--red); }
.server-status-dot.status-unknown { background: var(--text-muted); }

.server-os-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.server-card-body {}
.server-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.server-host, .server-owner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.server-host i, .server-owner i { font-size: 13px; color: var(--text-muted); }

.server-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.server-card-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

/* ─── Tags / Badges ──────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.tag-firewall {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.tag-status-online {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.tag-status-offline {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.tag-status-unknown {
  background: rgba(78,93,114,0.2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tag-admin {
  background: var(--purple-dim);
  color: var(--purple);
  border: 1px solid rgba(168,85,247,0.25);
}

.tag-user {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-self {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  margin-left: 6px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
}

.btn i { font-size: 16px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-success {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-sm i { font-size: 14px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-xs i { font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-label i { font-size: 14px; }
.form-label-hint { font-size: 11px; color: var(--text-muted); text-transform: none; font-weight: 400; letter-spacing: 0; }

.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:focus {
  border-color: var(--accent);
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238a97aa' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select.form-control option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

textarea.form-control { resize: vertical; min-height: 70px; }

.input-group {
  display: flex;
  gap: 0;
}

.input-group .form-control {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  flex: 1;
}

.input-addon {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0 12px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.input-addon:hover { color: var(--text-primary); background: var(--bg-hover); }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

.required { color: var(--red); margin-left: 2px; }

.form-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.form-section-title i { color: var(--accent); font-size: 16px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-section-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.server-form { padding: 20px; }
.rule-form { padding: 20px; }

/* Button group select (TCP/UDP/etc) */
.btn-group-select {
  display: flex;
  gap: 6px;
}

.btn-group-item {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-group-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-group-item.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-group-item.action-allow.active {
  background: var(--green-dim);
  border-color: var(--green-border);
  color: var(--green);
}

.btn-group-item.action-deny.active {
  background: var(--red-dim);
  border-color: var(--red-border);
  color: var(--red);
}

/* Firewall hint */
.firewall-hint {
  background: rgba(45, 124, 246, 0.06);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  margin-top: -8px;
  margin-bottom: 0;
}

.hint-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.hint-content i { color: var(--accent); font-size: 14px; flex-shrink: 0; margin-top: 1px; }

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 0;
}

.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-danger {
  background: var(--red-dim);
  border: 1px solid var(--red-border);
  color: var(--red);
}

.alert-success {
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  color: var(--green);
}

.alert-info {
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}

.alert-warning {
  background: var(--yellow-dim);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--yellow);
}

/* ─── Server Info Card ───────────────────────────────────────────────────────── */
.server-info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.server-info-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.server-info-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.server-info-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.server-info-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.server-info-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}

.server-info-meta i { font-size: 13px; color: var(--text-muted); }

.server-info-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.server-info-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.server-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.status-online { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-dot.status-offline { background: var(--red); }
.status-dot.status-unknown { background: var(--text-muted); }

/* ─── Two Column Layout ──────────────────────────────────────────────────────── */
.two-col-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}

/* ─── Rules List ─────────────────────────────────────────────────────────────── */
.rules-list {
  display: flex;
  flex-direction: column;
}

.rule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.rule-item:last-child { border-bottom: none; }
.rule-item:hover { background: var(--bg-hover); }

.rule-number {
  width: 28px;
  height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.rule-action-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rule-action-dot.allow { background: var(--green); }
.rule-action-dot.deny { background: var(--red); }

.rule-info {
  flex: 1;
  min-width: 0;
}

.rule-main {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-from {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rule-port { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.rule-proto-tag {
  font-size: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.rule-action-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.rule-action-tag.allow {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.rule-action-tag.deny {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red-border);
}

/* ─── Activity Log ───────────────────────────────────────────────────────────── */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 30px;
  height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.activity-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.activity-user {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.activity-action {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Users List ─────────────────────────────────────────────────────────────── */
.users-list {
  display: flex;
  flex-direction: column;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--bg-hover); }

.user-row-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.user-row-info {
  flex: 1;
  min-width: 0;
}

.user-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.user-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-row-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.user-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state i {
  font-size: 48px;
  color: var(--text-muted);
  display: block;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Loading State ──────────────────────────────────────────────────────────── */
.loading-state {
  padding: 40px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 440px;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.modal-header h3 i { color: var(--yellow); }

.modal-close {
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
}

.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body {
  padding: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.rule-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 12px;
  font-family: monospace;
  color: var(--text-secondary);
}

/* ─── Form Page ──────────────────────────────────────────────────────────────── */
.form-page-container {
  max-width: 800px;
}

/* ─── Danger Zone ────────────────────────────────────────────────────────────── */
.danger-zone {
  margin: 0 20px 20px;
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.danger-zone-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  padding: 10px 16px;
  background: var(--red-dim);
  border-bottom: 1px solid var(--red-border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.danger-zone-content {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.danger-zone-content > div > strong {
  font-size: 13px;
  color: var(--text-primary);
  display: block;
  margin-bottom: 3px;
}

.danger-zone-content > div > p {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Text utilities ─────────────────────────────────────────────────────────── */
.text-muted {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

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

  .two-col-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .topbar-menu {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    margin-left: 0;
  }

  .content-body {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .server-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .topbar-title span { display: none; }
  .topbar-title span:last-child { display: block; }

  .form-row { grid-template-columns: 1fr; }

  .server-info-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 6px 10px; }

  .activity-time { display: none; }

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

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-value { font-size: 20px; }

  .server-info-meta { gap: 8px; }

  .btn-group-select { flex-wrap: wrap; }
}
