/* ============================================================
   ADMIN CSS — ERP Two-Bar + Collapsible Sidebar v4.0
   Brand Bar (top) + Module Tab Bar + Left Sub-Menu Sidebar
   Yayasan Jami Ibadurrahman Banten
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --p:          #1B4F3A;
  --p-l:        #2A7055;
  --p-dark:     #0F2D20;
  --gold:       #C9A84C;
  --gold-l:     #DFC480;
  --accent:     #0D8C64;
  --danger:     #DC2626;
  --warning:    #D97706;
  --success:    #059669;
  --info:       #2563EB;

  /* Brand bar */
  --bb-h:       52px;
  --bb-bg:      #0C2419;

  /* Module tab bar */
  --mb-h:       46px;
  --mb-bg:      #E8F5EE;
  --mb-border:  #A8D4BC;

  /* Combined top height */
  --top-h:      98px; /* bb(52) + mb(46) */

  /* Sidebar */
  --sb-w:       240px;
  --sb-bg:      #FAFCFB;
  --sb-border:  #E4EDEA;
  --sb-text:    #344A3E;
  --sb-muted:   #93A99F;
  --sb-active:  #E8F5EF;
  --sb-active-c:#145C3A;
  --sb-hover:   #F2F8F5;
  --sb-accent:  #0D8C64;

  /* Page */
  --page-bg:    #EFF3F1;
  --card:       #ffffff;
  --border:     #E0E8E4;
  --border-l:   #EBF0ED;
  --radius:     10px;
  --radius-l:   14px;

  /* Inner topbar */
  --itb-h:      44px;
  --itb-bg:     #F5F8F6;
  --itb-border: #E4EDEA;

  /* Text */
  --text:       #182820;
  --text-mid:   #3F574A;
  --text-muted: #7D9589;

  --shadow-sm:  0 1px 4px rgba(0,0,0,0.07);
  --shadow:     0 2px 10px rgba(20,60,40,0.10);
  --shadow-md:  0 8px 24px rgba(20,60,40,0.13);
  --t:          all 0.16s ease;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ─────────────────────────────────────────────────────────────
   OUTER SHELL
   ───────────────────────────────────────────────────────────── */
.admin-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────────────────────
   BRAND BAR (row 1) — dark green premium
   ───────────────────────────────────────────────────────────── */
.admin-brandbar {
  height: var(--bb-h);
  background: linear-gradient(90deg, #091D14 0%, #0C2419 40%, #0F2D1E 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 600;
  box-shadow: 0 2px 0 rgba(0,0,0,0.3), 0 1px 0 rgba(13,140,100,0.12);
  flex-shrink: 0;
}

/* Brand left */
.brandbar-left {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
}
.brandbar-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border-right: 1px solid rgba(255,255,255,0.07);
  height: 100%;
  transition: var(--t);
}
.brandbar-logo-wrap:hover { background: rgba(255,255,255,0.05); }
.brandbar-logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255,255,255,0.12);
  padding: 3px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.brandbar-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.brandbar-sep-text {
  padding: 0 16px;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.brandbar-tagline {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Brand right */
.brandbar-right {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 14px;
  height: 100%;
}
.brandbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 34px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
}
.brandbar-btn:hover { background: rgba(255,255,255,0.09); color: rgba(255,255,255,0.9); }
.brandbar-btn svg { opacity: 0.6; transition: var(--t); flex-shrink: 0; }
.brandbar-btn:hover svg { opacity: 1; }
.brandbar-btn .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #F87171;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(248,113,113,0.25);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 2px rgba(248,113,113,0.25); }
  50%       { box-shadow: 0 0 0 4px rgba(248,113,113,0.10); }
}
.brandbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.08);
  margin: 0 6px;
  flex-shrink: 0;
}
.brandbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 6px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--t);
  margin-left: 4px;
}
.brandbar-user:hover { background: rgba(255,255,255,0.08); }
.brandbar-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-l));
  color: #1B4F3A;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(201,168,76,0.3);
}
.brandbar-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────
   MODULE TAB BAR — Rheologi exact style
   ───────────────────────────────────────────────────────────── */
.admin-modulebar {
  height: var(--mb-h);
  background: var(--mb-bg);
  border-bottom: 2px solid var(--mb-border);
  display: flex;
  align-items: flex-end;   /* tabs sit on bottom edge = rounded-t only visible */
  justify-content: flex-end;
  position: sticky;
  top: var(--bb-h);
  z-index: 599;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
  gap: 2px;
}
.admin-modulebar::-webkit-scrollbar { display: none; }

/* ── Exact Rheologi tab style ───────────────────────────────── */
.module-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2D6A4F;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
  border-radius: 8px 8px 0 0;  /* rounded-t-lg */
  border-bottom: none;
  margin-bottom: -2px;          /* overlap the bar border */
  position: relative;
  line-height: 1;
}
.module-tab:hover {
  background: #C8E6D5;
  color: #1B4F3A;
}
.module-tab.active {
  background: #1B5E42;
  color: #ffffff;
  box-shadow: 0 -2px 8px rgba(27,94,66,0.20), 0 2px 0 #1B5E42;
}

/* Icon: show on desktop, hide on mobile (Rheologi style) */
.module-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.14s;
}
.module-tab:hover .module-tab-icon,
.module-tab.active .module-tab-icon { opacity: 1; }

@media (max-width: 768px) {
  .module-tab-icon { display: none; }
}

.module-tab-label {
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

/* Per-module active colors */
.module-tab--org:hover   { background: #BBF7D0; color: #14532D; }
.module-tab--org.active  { background: #14532D; box-shadow: 0 -2px 8px rgba(20,83,45,0.25), 0 2px 0 #14532D; color: #fff; }

.module-tab--com:hover   { background: #BFDBFE; color: #1E3A8A; }
.module-tab--com.active  { background: #1E3A8A; box-shadow: 0 -2px 8px rgba(30,58,138,0.25), 0 2px 0 #1E3A8A; color: #fff; }

/* Mobile toggle */
.modulebar-toggle {
  display: none;
  align-items: center;
  padding: 0 14px;
  font-size: 1rem;
  color: var(--text-mid);
  cursor: pointer;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────
   ADMIN BODY = Sidebar + Main
   ───────────────────────────────────────────────────────────── */
.admin-body {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--top-h));
}

/* ─────────────────────────────────────────────────────────────
   LEFT SIDEBAR — collapsible sub-menu
   ───────────────────────────────────────────────────────────── */
.admin-sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  transition: width 0.22s ease, min-width 0.22s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.admin-sidebar::-webkit-scrollbar { width: 3px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Collapsed state */
.admin-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px 13px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
  white-space: nowrap;
  background: var(--sb-bg);
}
.sidebar-header-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sb-muted);
}
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sb-muted);
  transition: var(--t);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--sb-border); color: var(--p); }

/* Sub-menu items */
.sidebar-nav { flex: 1; padding: 10px 0; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px 11px 18px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sb-text);
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  margin: 2px 8px;
  border-radius: 9px;
  position: relative;
}
.sidebar-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--sb-accent);
  border-radius: 0 2px 2px 0;
  transition: height 0.15s ease;
}
.sidebar-item:hover {
  background: var(--sb-hover);
  color: var(--p);
}
.sidebar-item.active {
  background: var(--sb-active);
  color: var(--sb-active-c);
  font-weight: 600;
}
.sidebar-item.active::before { height: 60%; }
.sidebar-item-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  opacity: 0.65;
  transition: var(--t);
}
.sidebar-item:hover .sidebar-item-icon,
.sidebar-item.active .sidebar-item-icon { opacity: 1; }
.sidebar-item-tag {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(201,168,76,0.15);
  color: #92400E;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-nav-divider {
  height: 1px;
  background: var(--sb-border);
  margin: 6px 12px;
  opacity: 0.6;
}

.sidebar-footer {
  border-top: 1px solid var(--sb-border);
  padding: 10px 8px;
  flex-shrink: 0;
}
.sidebar-footer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
  border-radius: 9px;
}
.sidebar-footer-item:hover { color: var(--p); background: var(--sb-hover); }
.sidebar-footer-item.logout:hover { color: var(--danger); background: #FEF2F2; }

/* ─────────────────────────────────────────────────────────────
   EXPAND BUTTON (when sidebar is collapsed)
   ───────────────────────────────────────────────────────────── */
.sidebar-expand-btn {
  display: none;
  position: sticky;
  top: var(--top-h);
  left: 0;
  z-index: 100;
  width: 22px;
  height: 60px;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-left: none;
  border-radius: 0 6px 6px 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--sb-muted);
  writing-mode: initial;
  transition: var(--t);
  flex-shrink: 0;
  margin-top: 20px;
}
.sidebar-expand-btn:hover { background: var(--sb-hover); color: var(--p); }
.sidebar-expand-btn.visible { display: flex; }

/* ─────────────────────────────────────────────────────────────
   MAIN CONTENT AREA
   ───────────────────────────────────────────────────────────── */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Inner breadcrumb bar */
.admin-inner-topbar {
  height: var(--itb-h);
  background: var(--itb-bg);
  border-bottom: 1px solid var(--itb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  gap: 14px;
  flex-shrink: 0;
  position: sticky;
  top: var(--top-h);
  z-index: 100;
}
.inner-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.77rem;
}
.breadcrumb-item { color: var(--text-muted); font-weight: 500; }
.breadcrumb-sep { color: var(--border); font-size: 0.7rem; }
.breadcrumb-sep::before { content: '>'; font-weight: 400; }
.breadcrumb-item.current { color: var(--text); font-weight: 600; }

.inner-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topbar-view-site {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--p);
  color: white;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  transition: var(--t);
}
.topbar-view-site:hover { background: var(--p-l); }

/* Content */
.admin-content { flex: 1; padding: 20px 24px; }
.flash-wrap { padding: 14px 24px 0; }

/* ─────────────────────────────────────────────────────────────
   STATS GRID
   ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-widget {
  background: white;
  border-radius: var(--radius-l);
  padding: 15px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 3px solid var(--widget-color, var(--p));
  box-shadow: var(--shadow-sm);
  transition: var(--t);
}
.stat-widget:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-widget-info { flex: 1; min-width: 0; }
.stat-widget-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 4px; }
.stat-widget-value { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 3px; }
.stat-widget-sub { font-size: 0.69rem; color: var(--widget-color, var(--text-muted)); font-weight: 500; }
.stat-widget-icon { font-size: 1.85rem; opacity: 0.65; flex-shrink: 0; }

/* ─────────────────────────────────────────────────────────────
   CARDS
   ───────────────────────────────────────────────────────────── */
.admin-card {
  background: white;
  border-radius: var(--radius-l);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.admin-card-header {
  padding: 11px 17px;
  border-bottom: 1px solid var(--border-l);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FAFCFB;
}
.admin-card-title { font-size: 0.87rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 7px; }
.admin-card-body { padding: 17px; }
.admin-card-footer { padding: 10px 17px; border-top: 1px solid var(--border-l); background: #FAFCFB; }

/* ─────────────────────────────────────────────────────────────
   TABLES
   ───────────────────────────────────────────────────────────── */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th {
  padding: 9px 12px;
  text-align: left;
  background: #F5F8F6;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-l); color: var(--text); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #F8FBF9; }
.admin-table .actions { display: flex; align-items: center; gap: 5px; }
.admin-table .thumbnail-cell img { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); }

/* ─────────────────────────────────────────────────────────────
   TOOLBAR, FORMS, BUTTONS, BADGES, ALERTS, MODAL
   (all inherited from previous versions, just size-tuned)
   ───────────────────────────────────────────────────────────── */
.admin-toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; flex-wrap: wrap; }
.admin-search { position: relative; flex: 1; min-width: 180px; }
.admin-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.82rem; pointer-events: none; }
.admin-search .admin-input { padding-left: 32px; }

.admin-form-group { margin-bottom: 15px; }
.admin-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.admin-form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; }
.admin-label { display: block; font-size: 0.76rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.admin-label .req { color: var(--danger); margin-left: 2px; }
.admin-label .hint { font-weight: 400; color: var(--text-muted); font-size: 0.7rem; margin-left: 6px; }
.admin-input, .admin-select, .admin-textarea { width: 100%; padding: 8px 12px; background: white; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 0.82rem; font-family: var(--font); color: var(--text); transition: var(--t); outline: none; }
.admin-input:focus, .admin-select:focus, .admin-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,140,100,0.08); }
.admin-input:disabled, .admin-select:disabled { background: var(--page-bg); color: var(--text-muted); }
.admin-textarea { resize: vertical; min-height: 88px; }
.admin-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238A9E95' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.input-help { font-size: 0.7rem; color: var(--text-muted); margin-top: 3px; }

.admin-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius); font-size: 0.8rem; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; transition: var(--t); font-family: var(--font); text-decoration: none; white-space: nowrap; line-height: 1.4; }
.admin-btn-primary   { background: var(--p); color: white; }
.admin-btn-primary:hover { background: var(--p-l); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(27,79,58,0.25); }
.admin-btn-success   { background: var(--success); color: white; border-color: var(--success); }
.admin-btn-success:hover { background: #047857; }
.admin-btn-warning   { background: var(--warning); color: white; border-color: var(--warning); }
.admin-btn-warning:hover { background: #B45309; }
.admin-btn-danger    { background: var(--danger); color: white; border-color: var(--danger); }
.admin-btn-danger:hover { background: #B91C1C; }
.admin-btn-info      { background: var(--info); color: white; border-color: var(--info); }
.admin-btn-info:hover { background: #1D4ED8; }
.admin-btn-outline   { background: transparent; border-color: var(--border); color: var(--text); }
.admin-btn-outline:hover { background: var(--page-bg); }
.admin-btn-ghost     { background: transparent; color: var(--text-mid); }
.admin-btn-ghost:hover { background: var(--page-bg); color: var(--text); }
.admin-btn-sm { padding: 4px 10px; font-size: 0.74rem; }
.admin-btn-lg { padding: 10px 20px; font-size: 0.87rem; }
.admin-btn-icon { width: 30px; height: 30px; padding: 0; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.w-100 { width: 100%; }

.admin-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 0.67rem; font-weight: 600; white-space: nowrap; }
.badge-success   { background: #D1FAE5; color: #065F46; }
.badge-warning   { background: #FEF3C7; color: #92400E; }
.badge-danger    { background: #FEE2E2; color: #991B1B; }
.badge-info      { background: #DBEAFE; color: #1E40AF; }
.badge-secondary { background: #F3F4F6; color: #6B7280; }
.badge-primary   { background: #D1FAE5; color: var(--p); }

.admin-alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 0.82rem; font-weight: 500; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; }
.admin-alert-success { background: #D1FAE5; color: #065F46; border-color: #A7F3D0; }
.admin-alert-error   { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.admin-alert-warning { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.admin-alert-info    { background: #DBEAFE; color: #1E40AF; border-color: #BFDBFE; }

.admin-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9999; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.admin-modal-overlay.open { display: flex; }
.admin-modal { background: white; border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 80px rgba(0,0,0,0.22); animation: modalIn 0.2s ease; }
@keyframes modalIn { from { opacity:0; transform:scale(0.96) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
.admin-modal-header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-modal-title { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.admin-modal-close { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--page-bg); font-size: 0.95rem; transition: var(--t); border: none; color: var(--text-mid); }
.admin-modal-close:hover { background: #FEE2E2; color: var(--danger); }
.admin-modal-body { padding: 20px; }
.admin-modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

.upload-zone { border: 2px dashed var(--border); border-radius: 10px; padding: 24px 16px; text-align: center; cursor: pointer; transition: var(--t); position: relative; overflow: hidden; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(13,140,100,0.03); }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { font-size: 1.8rem; margin-bottom: 7px; opacity: 0.4; }
.upload-text { font-weight: 600; color: var(--text); font-size: 0.84rem; }
.upload-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 3px; }
.upload-preview img { max-height: 100px; border-radius: 7px; object-fit: cover; border: 2px solid var(--border); margin: 10px auto 0; }

/* ─────────────────────────────────────────────────────────────
   LOGIN
   ───────────────────────────────────────────────────────────── */
.admin-login-page { min-height: 100vh; background: linear-gradient(135deg, #0A1410 0%, #0F1E17 40%, #1B4F3A 100%); display: flex; align-items: center; justify-content: center; padding: 24px; position: relative; }
.admin-login-page::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 50% at 20% 30%, rgba(201,168,76,0.1) 0%, transparent 70%), radial-gradient(ellipse 40% 60% at 80% 70%, rgba(13,140,100,0.12) 0%, transparent 70%); pointer-events: none; }
.login-card { background: white; border-radius: 16px; padding: 36px; width: 100%; max-width: 400px; box-shadow: 0 32px 80px rgba(0,0,0,0.35); position: relative; z-index: 1; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { width: 52px; height: 52px; border-radius: 10px; margin: 0 auto 10px; object-fit: contain; }
.login-title { font-size: 1.2rem; font-weight: 800; color: var(--p); margin-bottom: 3px; }
.login-subtitle { font-size: 0.78rem; color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────
   htmx progress bar
   ───────────────────────────────────────────────────────────── */
#htmx-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9999; background: transparent; pointer-events: none; transition: opacity 0.3s; opacity: 0; }
#htmx-progress.htmx-request { opacity: 1; background: linear-gradient(90deg, #0D8C64, #4EEDB9, #C9A84C, #0D8C64); background-size: 200%; animation: htmxProg 1.5s linear infinite; }
@keyframes htmxProg { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─────────────────────────────────────────────────────────────
   UTILITIES
   ───────────────────────────────────────────────────────────── */
.text-right { text-align: right; } .text-center { text-align: center; }
.d-flex { display: flex; } .align-center { align-items: center; }
.gap-1{gap:4px} .gap-2{gap:8px} .gap-3{gap:12px} .gap-4{gap:16px}
.mt-2{margin-top:8px} .mt-3{margin-top:12px} .mt-4{margin-top:20px}
.mb-2{margin-bottom:8px} .mb-3{margin-bottom:12px} .mb-4{margin-bottom:20px}
.fw-600{font-weight:600} .fw-700{font-weight:700} .fw-800{font-weight:800}
.text-muted{color:var(--text-muted)} .text-sm{font-size:0.77rem} .text-xs{font-size:0.68rem}
.divider{border:none;border-top:1px solid var(--border);margin:15px 0}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px}
.actions{display:flex;gap:5px;align-items:center}

/* ─────────────────────────────────────────────────────────────
   TABS (page-level)
   ───────────────────────────────────────────────────────────── */
.admin-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.admin-tab { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: var(--t); text-decoration: none; }
.admin-tab:hover { color: var(--p); }
.admin-tab.active { color: var(--p); border-bottom-color: var(--accent); }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .brandbar-btn:not(.user-btn) { display: none; }
}
@media (max-width: 1024px) {
  .admin-form-row-3 { grid-template-columns: 1fr 1fr; }
  :root { --sb-w: 185px; }
}
@media (max-width: 768px) {
  :root { --top-h: 86px; }
  .admin-modulebar { display: none; }
  .modulebar-toggle { display: flex; }
  .admin-sidebar {
    position: fixed;
    top: var(--bb-h);
    left: 0;
    height: calc(100vh - var(--bb-h));
    z-index: 400;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 16px rgba(0,0,0,0.15);
    width: 220px !important;
    min-width: 220px !important;
  }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 12px; }
  .flash-wrap { padding: 12px 12px 0; }
  .admin-form-row { grid-template-columns: 1fr; }
  .admin-form-row-3 { grid-template-columns: 1fr; }
  .brandbar-user-name { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 24px 18px; }
  .admin-toolbar { flex-direction: column; align-items: stretch; }
  .admin-modal { max-width: 100%; border-radius: 16px 16px 0 0; align-self: flex-end; }
  .admin-modal-overlay { align-items: flex-end; padding: 0; }
}

/* Mobile overlay for sidebar */
.sidebar-mobile-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 390;
  backdrop-filter: blur(2px);
  top: var(--bb-h);
}
.sidebar-mobile-backdrop.show { display: block; }

/* ── Site Context Badges (module tab bar) ─────────────────── */
.module-tab-inner {
  display: flex;
  align-items: center;
  gap: 5px;
}

.site-badge {
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 20px;
  letter-spacing: 0.02em;
  line-height: 1.4;
  vertical-align: middle;
}
.site-badge--org {
  background: #D1FAE5;
  color: #065F46;
}
.site-badge--com {
  background: #DBEAFE;
  color: #1E40AF;
}
.site-badge--shared {
  background: #FEF3C7;
  color: #92400E;
}



/* ── Sidebar Group Labels ──────────────────────────────────── */
.sidebar-nav-group-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sb-muted);
  padding: 13px 18px 5px;
  margin-top: 2px;
}

/* ── Sidebar Site Context Indicator ───────────────────────── */
.sidebar-site-ctx {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  letter-spacing: 0.03em;
}
.sidebar-site-ctx--org {
  background: #D1FAE5;
  color: #065F46;
}
.sidebar-site-ctx--com {
  background: #DBEAFE;
  color: #1E40AF;
}
.sidebar-site-ctx--shared {
  background: #FEF3C7;
  color: #92400E;
}

/* ── Generic & ISO Module Component Styles ────────────────── */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}
.admin-page-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--p-dark, #0F2D20);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-page-sub {
  font-size: 0.84rem;
  color: var(--text-mid, #3F574A);
  margin: 4px 0 0;
}

/* Card */
.card {
  background: white;
  border-radius: var(--radius-l, 14px);
  border: 1px solid var(--border, #E0E8E4);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  margin-bottom: 20px;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-l, #EBF0ED);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}
.card-body { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-l, #EBF0ED);
  background: #FAFCFB;
}

/* Form */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text, #182820);
  margin-bottom: 5px;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  background: white;
  border: 1.5px solid var(--border, #E0E8E4);
  border-radius: var(--radius, 10px);
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--text, #182820);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  box-sizing: border-box;
}
.form-control:focus {
  border-color: var(--accent, #0D8C64);
  box-shadow: 0 0 0 3px rgba(13,140,100,0.1);
}
select.form-control {
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius, 10px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary   { background: var(--p, #1B4F3A); color: white; }
.btn-primary:hover { background: var(--p-l, #2A7055); transform: translateY(-1px); }
.btn-success   { background: var(--success, #059669); color: white; }
.btn-success:hover { background: #047857; transform: translateY(-1px); }
.btn-danger    { background: var(--danger, #DC2626); color: white; }
.btn-danger:hover { background: #B91C1C; }
.btn-warning   { background: var(--warning, #D97706); color: white; }
.btn-warning:hover { background: #B45309; }
.btn-secondary, .btn-ghost { background: transparent; color: var(--text-mid, #3F574A); border: 1.5px solid var(--border, #E0E8E4); }
.btn-secondary:hover, .btn-ghost:hover { background: #F3F6F4; color: var(--text, #182820); }
.btn-sm        { padding: 4px 10px; font-size: 0.74rem; border-radius: 6px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #DBEAFE; color: #1E40AF; }
.badge-muted   { background: #F3F4F6; color: #4B5563; }

/* Stat Cards */
.stat-card {
  background: white;
  border-radius: var(--radius-l, 14px);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid var(--border, #E0E8E4);
}
.stat-icon { font-size: 1.6rem; margin-bottom: 6px; }
.stat-val { font-size: 1.5rem; font-weight: 800; color: var(--text, #182820); }
.stat-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; color: var(--sb-muted, #93A99F); margin-top: 2px; }

/* Modal Overlay */
.admin-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(12,36,25,0.55);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.admin-modal-overlay.open,
.admin-modal-overlay.active {
  display: flex !important;
}
.admin-modal {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border, #E0E8E4);
}
.admin-modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-l, #EBF0ED);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-modal-header h3 { font-size: 1.05rem; font-weight: 800; margin: 0; color: var(--text, #182820); }
.modal-close-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #8A9E95; }
.modal-close-btn:hover { color: #182820; }
.admin-modal-body { padding: 20px 22px; }
.admin-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-l, #EBF0ED);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #FAFCFB;
}

/* Utilities */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 18px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 18px !important; }
.py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border-l, #EBF0ED); font-size: 0.84rem; text-align: left; }
.table th { background: #F8FAF9; font-size: 0.72rem; text-transform: uppercase; color: var(--text-mid, #3F574A); font-weight: 700; }
.table tr:hover td { background: #FAFCFB; }
.fw-bold { font-weight: 700; }
.text-muted { color: #7A8379; }
.text-center { text-align: center; }
.text-right { text-align: right; }

