/* ── P7 Nexus Brand Variables ─────────────────────────────── */
:root {
  --p7-blue:    #1D6DB5;
  --p7-green:   #1A8C5B;
  --p7-orange:  #F79420;
  --p7-charcoal:#404040;
  --p7-sidebar-w: 260px;
  --p7-sidebar-w-collapsed: 68px;
  --p7-topbar-h: 60px;
}

/* ── Reset / Base ─────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #f4f6fa;
  color: var(--p7-charcoal);
  margin: 0;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.p7-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--p7-sidebar-w);
  background: var(--p7-charcoal);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.25s ease;
  overflow: hidden;
}
.p7-sidebar.collapsed { width: var(--p7-sidebar-w-collapsed); }

.p7-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--p7-topbar-h);
  text-decoration: none;
  white-space: nowrap;
}
.p7-sidebar-brand img { width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0; }
.p7-sidebar-brand span {
  font-size: 16px; font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.p7-sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.p7-nav-section {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  padding: 16px 22px 6px;
  text-transform: uppercase;
  white-space: nowrap;
}
.p7-nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 22px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.p7-nav-link i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.p7-nav-link:hover { color: #fff; background: rgba(255,255,255,0.07); }
.p7-nav-link.active {
  color: #fff;
  background: rgba(29,109,181,0.25);
  border-left-color: var(--p7-blue);
}

.p7-sidebar-footer {
  padding: 16px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.p7-sidebar-footer .p7-nav-link { padding: 8px 0; }

/* ── Topbar ───────────────────────────────────────────────── */
.p7-topbar {
  position: fixed;
  top: 0; left: var(--p7-sidebar-w); right: 0;
  height: var(--p7-topbar-h);
  background: #fff;
  border-bottom: 1px solid #e8ecf0;
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  z-index: 99;
  transition: left 0.25s ease;
}
.p7-topbar.collapsed-offset { left: var(--p7-sidebar-w-collapsed); }

.p7-topbar-title { font-size: 18px; font-weight: 600; flex: 1; }
.p7-topbar-actions { display: flex; align-items: center; gap: 12px; }

.p7-toggle-btn {
  background: none; border: none; cursor: pointer;
  color: #888; font-size: 18px; padding: 6px;
  border-radius: 6px; transition: background 0.15s;
}
.p7-toggle-btn:hover { background: #f0f0f0; color: var(--p7-charcoal); }

/* ── Main Content ─────────────────────────────────────────── */
.p7-main {
  margin-left: var(--p7-sidebar-w);
  padding-top: var(--p7-topbar-h);
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}
.p7-main.collapsed-offset { margin-left: var(--p7-sidebar-w-collapsed); }
.p7-content { padding: 28px; }

/* ── Stat Cards ───────────────────────────────────────────── */
.p7-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e8ecf0;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.p7-stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.p7-stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 16px;
}
.p7-stat-card .stat-value {
  font-size: 32px; font-weight: 700; line-height: 1;
  color: var(--p7-charcoal); margin-bottom: 4px;
}
.p7-stat-card .stat-label {
  font-size: 13px; color: #888; font-weight: 500;
}
.p7-stat-card .stat-badge {
  position: absolute; top: 20px; right: 20px;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px;
}

.icon-blue   { background: rgba(29,109,181,0.12); color: var(--p7-blue); }
.icon-green  { background: rgba(26,140,91,0.12);  color: var(--p7-green); }
.icon-orange { background: rgba(247,148,32,0.12); color: var(--p7-orange); }
.icon-gray   { background: rgba(64,64,64,0.1);    color: var(--p7-charcoal); }

/* ── Cards / Panels ───────────────────────────────────────── */
.p7-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8ecf0;
  overflow: hidden;
}
.p7-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #f0f2f5;
}
.p7-card-title { font-size: 15px; font-weight: 600; margin: 0; }
.p7-card-body  { padding: 0; }

/* ── Tables ───────────────────────────────────────────────── */
.p7-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.p7-table th {
  background: #f8f9fb;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: #888; padding: 12px 20px;
  text-align: left; white-space: nowrap;
}
.p7-table td {
  padding: 13px 20px;
  border-top: 1px solid #f0f2f5;
  vertical-align: middle;
  color: var(--p7-charcoal);
}
.p7-table tbody tr:hover { background: #fafbfc; }
.p7-table .text-mono { font-family: monospace; font-size: 12px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge-active    { background: #e6f7ee; color: #1A8C5B; font-weight: 600; }
.badge-pending   { background: #fff4e5; color: #d97706; font-weight: 600; }
.badge-suspended { background: #fde8e8; color: #c0392b; font-weight: 600; }
.badge-rejected  { background: #f3f3f3; color: #888;    font-weight: 600; }
.badge-revoked   { background: #f3f3f3; color: #888;    font-weight: 600; }
.badge-expired   { background: #fde8e8; color: #c0392b; font-weight: 600; }
.badge-chat      { background: rgba(29,109,181,0.1); color: var(--p7-blue);   font-weight: 600; }
.badge-chat_plus { background: rgba(247,148,32,0.12); color: var(--p7-orange); font-weight: 600; }

.p7-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 20px; font-size: 11px; white-space: nowrap;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-p7-primary {
  background: var(--p7-blue); color: #fff; border: none;
  padding: 8px 18px; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.btn-p7-primary:hover { background: #1a5fa0; color: #fff; }

.btn-p7-outline {
  background: transparent; color: var(--p7-charcoal);
  border: 1px solid #d8dde5; padding: 7px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.btn-p7-outline:hover { border-color: var(--p7-blue); color: var(--p7-blue); }

.btn-p7-danger {
  background: #fde8e8; color: #c0392b; border: none;
  padding: 5px 12px; border-radius: 6px; font-size: 12px;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-p7-danger:hover { background: #f5c6c6; }

.btn-p7-success {
  background: #e6f7ee; color: #1A8C5B; border: none;
  padding: 5px 12px; border-radius: 6px; font-size: 12px;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-p7-success:hover { background: #c3edd6; }

/* ── Search / Filter Bar ──────────────────────────────────── */
.p7-filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid #f0f2f5;
  flex-wrap: wrap;
}
.p7-search {
  position: relative; flex: 1; min-width: 200px;
}
.p7-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #aaa; font-size: 13px;
}
.p7-search input {
  width: 100%; padding: 8px 12px 8px 34px;
  border: 1px solid #e0e4ea; border-radius: 8px;
  font-size: 13px; outline: none;
  transition: border-color 0.15s;
}
.p7-search input:focus { border-color: var(--p7-blue); }

.p7-filter-select {
  padding: 8px 12px; border: 1px solid #e0e4ea;
  border-radius: 8px; font-size: 13px; outline: none;
  background: #fff; cursor: pointer;
}

/* ── Login Page ───────────────────────────────────────────── */
.p7-login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1D6DB5 0%, #1a5fa0 40%, #404040 100%);
}
.p7-login-card {
  background: #fff; border-radius: 16px; padding: 48px 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.p7-login-logo {
  text-align: center; margin-bottom: 32px;
}
.p7-login-logo img { width: 56px; margin-bottom: 12px; }
.p7-login-logo h1 { font-size: 22px; font-weight: 700; color: var(--p7-charcoal); margin: 0; }
.p7-login-logo p  { font-size: 13px; color: #888; margin: 4px 0 0; }

.p7-form-group { margin-bottom: 18px; }
.p7-form-group label { font-size: 13px; font-weight: 600; color: #555; display: block; margin-bottom: 6px; }
.p7-form-group input {
  width: 100%; padding: 10px 14px;
  border: 1px solid #e0e4ea; border-radius: 8px;
  font-size: 14px; outline: none; transition: border-color 0.15s;
}
.p7-form-group input:focus { border-color: var(--p7-blue); }

.p7-login-btn {
  width: 100%; padding: 12px;
  background: var(--p7-blue); color: #fff;
  border: none; border-radius: 8px; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.p7-login-btn:hover { background: #1a5fa0; }

.p7-error-msg {
  background: #fde8e8; color: #c0392b; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}

/* ── Avatar / User pill ───────────────────────────────────── */
.p7-user-pill {
  display: flex; align-items: center; gap: 8px;
  background: #f4f6fa; border-radius: 30px;
  padding: 6px 14px 6px 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--p7-charcoal);
  text-decoration: none;
}
.p7-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--p7-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}

/* ── Pagination ───────────────────────────────────────────── */
.p7-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid #f0f2f5;
  font-size: 13px; color: #888;
}
.p7-pagination-links { display: flex; gap: 4px; }
.p7-page-btn {
  padding: 5px 10px; border-radius: 6px; border: 1px solid #e0e4ea;
  background: #fff; cursor: pointer; font-size: 12px;
  text-decoration: none; color: var(--p7-charcoal);
  transition: all 0.15s;
}
.p7-page-btn:hover, .p7-page-btn.active {
  background: var(--p7-blue); color: #fff; border-color: var(--p7-blue);
}

/* ── Forms ────────────────────────────────────────────────── */
.p7-form-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8ecf0;
  max-width: 760px;
}
.p7-form-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid #f0f2f5;
}
.p7-form-card-body { padding: 28px; }

.p7-form-section {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--p7-blue);
  margin: 24px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8ecf0;
}
.p7-form-section:first-child { margin-top: 0; }

.p7-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.p7-form-grid.cols-1 { grid-template-columns: 1fr; }
.p7-form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.span-2 { grid-column: span 2; }

.p7-form-group { display: flex; flex-direction: column; gap: 5px; }
.p7-form-group label {
  font-size: 12px; font-weight: 600; color: #555;
}
.p7-form-group .p7-hint {
  font-size: 11px; color: #aaa; margin-top: 2px;
}

.p7-field {
  padding: 9px 12px;
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  font-size: 13.5px;
  width: 100%;
  outline: none;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--p7-charcoal);
}
.p7-field:focus {
  border-color: var(--p7-blue);
  box-shadow: 0 0 0 3px rgba(29,109,181,0.1);
}
.p7-field.error { border-color: #e74c3c; }

.p7-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--p7-blue); }
.p7-checkbox-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid #e0e4ea;
  border-radius: 8px; cursor: pointer;
}
.p7-checkbox-row label { cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--p7-charcoal); }

.p7-field-error {
  font-size: 11px; color: #e74c3c; margin-top: 3px;
}

.p7-form-actions {
  display: flex; gap: 10px; align-items: center;
  padding-top: 24px; margin-top: 8px;
  border-top: 1px solid #f0f2f5;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .p7-sidebar { width: var(--p7-sidebar-w-collapsed); }
  .p7-sidebar .p7-nav-link span,
  .p7-sidebar .p7-sidebar-brand span,
  .p7-sidebar .p7-nav-section { display: none; }
  .p7-topbar  { left: var(--p7-sidebar-w-collapsed); }
  .p7-main    { margin-left: var(--p7-sidebar-w-collapsed); }
}

@media (max-width: 768px) {
  .p7-sidebar { transform: translateX(-100%); width: var(--p7-sidebar-w); }
  .p7-sidebar.mobile-open {
    transform: translateX(0);
  }
  .p7-sidebar.mobile-open .p7-nav-link span,
  .p7-sidebar.mobile-open .p7-sidebar-brand span,
  .p7-sidebar.mobile-open .p7-nav-section { display: block; }
  .p7-topbar  { left: 0; }
  .p7-main    { margin-left: 0; }
  .p7-content { padding: 16px; }
  .hide-mobile { display: none !important; }
}

/* ── Misc ─────────────────────────────────────────────────── */
.text-blue   { color: var(--p7-blue); }
.text-green  { color: var(--p7-green); }
.text-orange { color: var(--p7-orange); }
.text-muted  { color: #888; font-size: 13px; }
.fw-600 { font-weight: 600; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { text-align: center; padding: 60px 20px; color: #aaa; }
.empty-state i { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; margin: 0; }
