/* ============================================
   AUREVIA ADMIN PANEL — extends base.css
   Visually distinct from investor portal: left sidebar,
   operational density over marketing polish.
   ============================================ */

body.admin {
  background: #EFEDE7;
  min-height: 100vh;
  display: flex;
}

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ink);
  color: #ABA79B;
  min-height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 0;
}

.admin-sidebar .logo {
  color: var(--cream);
  font-size: 16px;
  padding: 0 24px;
  margin-bottom: 6px;
}
.admin-sidebar .logo-mark { border-color: var(--cream); width:18px; height:18px; }
.admin-role-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7A776E;
  padding: 0 24px;
  margin-bottom: 28px;
}

.admin-nav-group { margin-bottom: 4px; }
.admin-nav-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #62605A;
  padding: 18px 24px 8px;
}
.admin-sidebar a {
  display: block;
  padding: 10px 24px;
  font-size: 13.5px;
  color: #C7C4BA;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}
.admin-sidebar a:hover { background: rgba(255,255,255,0.04); color: var(--cream); }
.admin-sidebar a.active {
  background: rgba(140,117,80,0.15);
  border-left-color: var(--brass);
  color: var(--cream);
}
.admin-sidebar-footer { margin-top: auto; padding: 20px 24px 0; border-top: 1px solid rgba(255,255,255,0.08); }
.admin-sidebar-footer a { padding: 12px 0; color: #ABA79B; }

.admin-content { flex: 1; min-width: 0; }

.admin-topbar {
  background: var(--cream);
  border-bottom: 1px solid var(--hairline);
  padding: 0 40px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar-title { font-family: 'Fraunces', serif; font-size: 19px; }
.admin-topbar-user { font-size: 13px; color: var(--gray); display:flex; align-items:center; gap:16px; }
.admin-search {
  border: 1px solid var(--hairline);
  padding: 8px 14px;
  font-size: 13px;
  width: 260px;
  background: var(--bg);
}

.admin-main { padding: 40px; }
@media (max-width: 900px) { .admin-main { padding: 24px 20px; } .admin-topbar { padding: 0 20px; } }

.demo-banner-admin {
  background: #2C2418;
  color: #E8C989;
  text-align: center;
  padding: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* Sidebar collapse for mobile */
.admin-mobile-toggle { display: none; }
@media (max-width: 900px) {
  .admin-sidebar { display: none; }
  .admin-mobile-toggle {
    display: block;
    background: none;
    border: 1px solid var(--hairline);
    padding: 8px 14px;
    font-size: 12px;
  }
  .admin-sidebar.open {
    display: flex;
    position: fixed;
    z-index: 200;
    height: 100vh;
    left: 0; top: 0;
  }
}

/* ---------- KPI grid ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-bottom: 40px;
}
@media (max-width: 900px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
.kpi-card { background: var(--cream); padding: 26px 24px; }
.kpi-label { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gray-light); margin-bottom: 12px; }
.kpi-value { font-family: 'Fraunces', serif; font-size: 26px; }

/* ---------- Panel / card ---------- */
.a-panel { background: var(--cream); border: 1px solid var(--hairline); }
.a-panel-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.a-panel-head h2 { font-size: 16px; font-weight: 500; font-family: 'Inter', sans-serif; }
.a-panel-body { padding: 24px; }

/* ---------- Data table (admin) ---------- */
.a-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.a-table thead th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-light);
  padding: 12px 20px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--hairline);
  font-weight: 400;
  white-space: nowrap;
}
.a-table tbody td { padding: 14px 20px; border-bottom: 1px solid var(--hairline); color: var(--ink-soft); }
.a-table tbody tr:last-child td { border-bottom: none; }
.a-table tbody tr:hover { background: var(--bg-warm); cursor: default; }
.a-table .mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--gray); }
.a-table-scroll { overflow-x: auto; }

.a-row-actions { display: flex; gap: 14px; }
.a-row-actions a, .a-row-actions button {
  font-size: 12px;
  color: var(--brass-deep);
  border-bottom: 1px solid transparent;
  background: none;
  border-top: none; border-left: none; border-right: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  padding: 0;
}
.a-row-actions a:hover, .a-row-actions button:hover { border-bottom-color: var(--brass-deep); }

/* ---------- Filter bar ---------- */
.a-filter-bar { display: flex; gap: 12px; flex-wrap: wrap; padding: 16px 24px; border-bottom: 1px solid var(--hairline); background: var(--bg); }
.a-filter-bar select, .a-filter-bar input {
  border: 1px solid var(--hairline);
  padding: 8px 12px;
  font-size: 12.5px;
  background: var(--cream);
  font-family: 'Inter', sans-serif;
}

/* ---------- Buttons ---------- */
.a-btn {
  display: inline-block;
  font-size: 13px;
  padding: 10px 20px;
  background: var(--ink);
  color: var(--cream);
  border: 1px solid var(--ink);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s ease;
}
.a-btn:hover { background: var(--brass-deep); border-color: var(--brass-deep); }
.a-btn-outline { background: transparent; color: var(--ink); }
.a-btn-outline:hover { background: var(--ink); color: var(--cream); }
.a-btn-sm { padding: 7px 14px; font-size: 12px; }
.a-btn-danger { background: #8C3B2E; border-color: #8C3B2E; }
.a-btn-danger:hover { background: #6E2E24; border-color: #6E2E24; }

/* ---------- Modal ---------- */
.a-modal-backdrop {
  position: fixed; inset: 0; background: rgba(18,24,27,0.55);
  display: none; align-items: center; justify-content: center;
  z-index: 500; padding: 24px;
}
.a-modal-backdrop.open { display: flex; }
.a-modal {
  background: var(--cream);
  width: 100%; max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 36px;
}
.a-modal h2 { font-size: 20px; font-weight: 400; margin-bottom: 6px; }
.a-modal .modal-sub { font-size: 13px; color: var(--gray); margin-bottom: 28px; }
.a-modal-close { position: absolute; top: 20px; right: 20px; }
.a-modal-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ---------- Confirm dialog ---------- */
.a-confirm-text { font-size: 14px; color: var(--ink-soft); line-height: 1.6; margin-bottom: 24px; }

/* ---------- Two column form grid ---------- */
.a-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
@media (max-width: 560px) { .a-form-grid { grid-template-columns: 1fr; } }

/* ---------- Audit log ---------- */
.audit-item {
  display: grid;
  grid-template-columns: 150px 140px 1fr 120px;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12.5px;
  align-items: center;
}
.audit-item:last-child { border-bottom: none; }
.audit-time { font-family: 'IBM Plex Mono', monospace; color: var(--gray-light); }
.audit-actor { color: var(--ink-soft); font-weight: 500; }
.audit-desc { color: var(--gray); }
.audit-ip { font-family: 'IBM Plex Mono', monospace; color: var(--gray-light); text-align: right; }
@media (max-width: 720px) { .audit-item { grid-template-columns: 1fr; gap: 4px; } .audit-ip { text-align:left; } }

/* Section title in main content */
.a-page-head { margin-bottom: 28px; display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; }
.a-page-head h1 { font-family: 'Fraunces', serif; font-size: 26px; font-weight: 400; }
.a-page-head .eyebrow { display: block; margin-bottom: 8px; }

/* Role badges */
.role-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 9px;
  background: var(--bg-warm);
  color: var(--brass-deep);
  border: 1px solid var(--hairline);
}

/* ---------- Badges (shared pattern with investor portal) ---------- */
.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 2px;
  white-space: nowrap;
  display: inline-block;
}
.badge-active { background: #E7F0EA; color: #3C6B4C; }
.badge-pending { background: #F5EFE1; color: #8C6D2E; }
.badge-completed { background: #E7F0EA; color: #3C6B4C; }
.badge-matured { background: #E9E7F0; color: #524F8C; }
.badge-closed { background: #EFEDE8; color: #6B6862; }
.badge-cancelled { background: #F7ECEA; color: #8C3B2E; }
.badge-rejected { background: #F7ECEA; color: #8C3B2E; }
.badge-suspended { background: #F7ECEA; color: #8C3B2E; }
.badge-processing { background: #F5EFE1; color: #8C6D2E; }
.badge-approved { background: #E7F0EA; color: #3C6B4C; }
