/* ==========================================
   GLOBAL RESET
========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}

:root { --app-vh: 1vh; }

html,
body {
  height: calc(var(--app-vh, 1vh) * 100);
  min-height: calc(var(--app-vh, 1vh) * 100);
  width: 100%;
  max-width: 100%;
  overflow: hidden; /* prevent double-scroll; inner panels handle scrolling */
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;  /* handles mobile browser bars */
  margin: 0;
  display: flex;
  flex-direction: column; /* just in case more roots are added */
  overflow-x: hidden;     /* stop horizontal scrolling / protruding */
}

/* ==========================================
   THEMES
========================================== */

body.theme-dark {
  background: radial-gradient(circle at top, #020617, #020617 60%, #030712);
  color: #e5e7eb;
}

body.theme-light {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  color: #111827;
}

/* ==========================================
   SIGN-IN
========================================== */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.screen.active {
  display: flex;
}

.signin-box {
  width: 320px;
  border-radius: 18px;
  padding: 24px 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

body.theme-dark .signin-box {
  background: #020617;
  border: 1px solid #111827;
}

body.theme-light .signin-box {
  background: #f9fafb;
  border: 1px solid #d4d4d8;
}

.signin-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.signin-box h2 {
  margin-bottom: 6px;
}

.muted {
  font-size: 13px;
  opacity: 0.7;
}

.signin-box select,
.signin-box input {
  width: 100%;
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #1f2937;
  font-size: 13px;
}

body.theme-dark .signin-box select,
body.theme-dark .signin-box input {
  background: #020617;
  color: #e5e7eb;
}

body.theme-light .signin-box select,
body.theme-light .signin-box input {
  background: #f9fafb;
  color: #111827;
  border-color: #d4d4d8;
}

.signin-box select:focus,
.signin-box input:focus {
  outline: 1px solid #22c55e;
}

.signin-box button {
  width: 100%;
  margin-top: 14px;
}

/* ==========================================
   BRANDING & BUTTONS
========================================== */

.logo-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 25% 20%, #22c55e, #065f46);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6);
}

.logo-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

.logo-title {
  font-size: 20px;
  font-weight: 700;
}

.primary-btn,
.secondary-btn {
  border-radius: 999px;
  padding: 7px 14px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
}

/* Dark theme buttons */
body.theme-dark .primary-btn {
  background: #16a34a;
  color: #ecfdf5;
  border-color: #16a34a;
}
body.theme-dark .primary-btn:hover {
  background: #22c55e;
}
body.theme-dark .secondary-btn {
  background: transparent;
  color: #e5e7eb;
  border-color: #334155;
}
body.theme-dark .secondary-btn:hover {
  background: #020617;
}

/* Light theme buttons */
body.theme-light .primary-btn {
  background: #16a34a;
  color: #ecfdf5;
  border-color: #16a34a;
}
body.theme-light .primary-btn:hover {
  filter: brightness(1.05);
}
body.theme-light .secondary-btn {
  background: #f3f4f6;
  color: #111827;
  border-color: #d4d4d8;
}
body.theme-light .secondary-btn:hover {
  background: #e5e7eb;
}

/* Tiny link-style button */
.tiny-link-btn {
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid currentColor;
  cursor: pointer;
}
.tiny-link-btn:hover {
  opacity: 0.85;
}

/* ==========================================
   MAIN LAYOUT
========================================== */

.hidden {
  display: none !important;
}

body { overflow-x: hidden; }

#mainLayout {
  flex: 1;
  display: flex;
  height: calc(var(--app-vh, 1vh) * 100);
  min-height: calc(var(--app-vh, 1vh) * 100);
  width: 100%;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 260px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid;
}

body.theme-dark #sidebar {
  background: #020617;
  border-right-color: #111827;
}

body.theme-light #sidebar {
  background: #f3f4f6;
  border-right-color: #d4d4d8;
}

#sidebar-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Sidebar brand banner (large logo in top-left corner) */
#sidebar-header .brand-banner {
  width: 100%;
  height: 84px; /* matches the red-highlight area in your screenshot */
  border-radius: 16px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55);
}

body.theme-dark #sidebar-header .brand-banner {
  background: linear-gradient(135deg, #16a34a, #065f46);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

body.theme-light #sidebar-header .brand-banner {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

#sidebar-header .brand-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 520px) {
  #sidebar-header .brand-banner {
    height: 76px;
  }
}

#sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
}

body.theme-dark #sidebar-profile {
  background: #030712;
}

body.theme-light #sidebar-profile {
  background: #e5e7eb;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 20% 20%, #22c55e, #15803d);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 10px 20px rgba(0,0,0,0.35);
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.side-role {
  font-size: 12px;
  opacity: 0.7;
}

#sidebar-tools {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-block {
  padding: 12px;
  border-radius: 14px;
}

body.theme-dark .sidebar-block {
  background: #030712;
}

body.theme-light .sidebar-block {
  background: #ffffff;
  border: 1px solid #e5e7eb;
}

.sidebar-block h4 {
  font-size: 14px;
  margin-bottom: 6px;
}

.sidebar-block input,
.sidebar-block select {
  width: 100%;
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 13px;
}

.hold-period-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hold-period-row select {
  max-width: 110px;
}

body.theme-dark .sidebar-block input,
body.theme-dark .sidebar-block select {
  background: #020617;
  border-color: #111827;
  color: #e5e7eb;
}

body.theme-light .sidebar-block input,
body.theme-light .sidebar-block select {
  background: #f9fafb;
  border-color: #d4d4d8;
  color: #111827;
}

/* Image attachment group */
.image-attach-group {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.image-attach-group input[type="file"] {
  font-size: 11px;
}
.image-attach-label {
  font-size: 12px;
  opacity: 0.8;
}
.image-attach-hint {
  font-size: 10px;
  opacity: 0.7;
}

.image-count-hint {
  font-size: 11px;
  margin-top: 4px;
  color: #9ca3af;
}

body.theme-light .image-count-hint {
  color: #6b7280;
}

/* Delivery note + location */
.delivery-note {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  border-radius: 8px;
  padding: 6px 8px;
}

body.theme-dark .delivery-note {
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.5);
  color: #fed7aa;
}

body.theme-light .delivery-note {
  background: #fffbeb;
  border: 1px solid #fed7aa;
  color: #92400e;
}

.delivery-mode-label {
  font-size: 11px;
  margin-bottom: 4px;
  opacity: 0.9;
}

.delivery-point-input {
  margin-top: 6px;
  width: 100%;
  min-height: 52px;
  resize: vertical;
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid;
}

body.theme-dark .delivery-point-input {
  background: #020617;
  border-color: #111827;
  color: #e5e7eb;
}

body.theme-light .delivery-point-input {
  background: #f9fafb;
  border-color: #d4d4d8;
  color: #111827;
}

.help-btn {
  margin-top: auto;
  width: 100%;
  justify-content: center;
  display: flex;
  align-items: center;
}

/* Main column */
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
/* Icon button */
.icon-btn{
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.icon-btn:active{ transform: scale(0.98); }

/* Menu coin button */
/* Welcome text should not break layout */
.welcome-text{
  /* Keep greeting + name + selfie on one clean line */
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Name + selfie badge */
.user-badge{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.user-badge__label{
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.user-badge__avatar{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.user-badge__avatar.user-badge__avatar--ph{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
  background: rgba(46, 204, 113, 0.22);
  border: 1px solid rgba(46, 204, 113, 0.45);
}

.topbar-left{
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-overlay{
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 40;
}
body.theme-dark .sidebar-overlay{ background: rgba(0,0,0,0.55); }
body.theme-light .sidebar-overlay{ background: rgba(0,0,0,0.35); }

body.sidebar-open .sidebar-overlay{
  opacity: 1;
  pointer-events: auto;
}

.sidebar-close{
  display: none; /* shown on mobile */
  position: absolute;
  top: 10px;
  right: 10px;
}
#topbar {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid;
}

body.theme-dark #topbar {
  background: #020617;
  border-bottom-color: #111827;
}

body.theme-light #topbar {
  background: #f9fafb;
  border-bottom-color: #d4d4d8;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* Make Mode/Logout look like compact "key" buttons (less pill-like, more professional) */
#topbar .secondary-btn{
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 0;
  height: 36px;
  line-height: 1;
  font-size: 12px;
  letter-spacing: 0.2px;
}

/* Content: summary + fixed tabs + flexible panels */
#content {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden; /* inner panel lists will scroll */
}



/* ===== PANEL ZONE (tabs + sliding panels) ===== */
#panelZone{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* ==========================================
   SUMMARY (ESCROW + TILES)
========================================== */

#summarySection {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 2px;
}

/* Escrow cards row */
#escrowSummaryRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Escrow card base */
.escrow-card {
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  min-width: 220px;
  flex: 1 1 220px;
  max-width: 280px; /* ≈ quarter width on desktop */
}

body.theme-dark .escrow-card {
  background: linear-gradient(135deg, #020617, #042f2e);
  border-color: #16a34a;
}

body.theme-light .escrow-card {
  background: linear-gradient(135deg, #e5e7eb, #d4d4d8);
  border-color: #9ca3af;
  color: #111827;
}

/* Specific accents */
body.theme-dark #escrowPendingCard {
  border-color: #f97316;
}
body.theme-light #escrowPendingCard {
  border-color: #f97316;
}
body.theme-dark #escrowReleasedCard {
  border-color: #22c55e;
}
body.theme-light #escrowReleasedCard {
  border-color: #22c55e;
}

.escrow-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.escrow-padlock {
  font-size: 14px;
}

.escrow-amount {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
}

.escrow-sub {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

/* STATUS TILES – one row, six columns */
#statusGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.status-tile {
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid;
  transition: background 0.18s ease, border-color 0.18s ease,
    transform 0.12s ease, box-shadow 0.12s ease;
}

/* Colour codes */
.status-tile.pending {
  border-left: 3px solid #78350f;
  background: rgba(120, 53, 15, 0.14);
}
.status-tile.transit {
  border-left: 3px solid #0ea5e9;
  background: rgba(14, 165, 233, 0.14);
}
.status-tile.delivered {
  border-left: 3px solid #22c55e;
  background: rgba(34, 197, 94, 0.14);
}
.status-tile.held {
  border-left: 3px solid #f97316;
  background: rgba(249, 115, 22, 0.14);
}
.status-tile.completed {
  border-left: 3px solid #16a34a;
  background: rgba(22, 163, 74, 0.14);
}
.status-tile.disputes {
  border-left: 3px solid #dc2626;
  background: rgba(220, 38, 38, 0.16);
}

/* Intensity */
.status-intensity-0 {
}
.status-intensity-1 {
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.3);
}
.status-intensity-2 {
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4);
  transform: translateY(-1px);
}
.status-intensity-3 {
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.5);
  transform: translateY(-2px);
}

.status-tile-label {
  opacity: 0.7;
}

.status-tile-value {
  font-size: 15px;
  font-weight: 700;
}

/* ==========================================
   PANELS + SLIDER + COLOURED TABS
========================================== */

#panelNav {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.panel-tab {
  flex: 1;
  font-size: 12px;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.panel-tab-label {
  flex: 1;
}

.panel-tab-count {
  min-width: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  text-align: center;
  border: 1px solid currentColor;
}

/* Base tab colours (dark) */
body.theme-dark .panel-tab {
  border-color: #1f2937;
  color: #9ca3af;
}
body.theme-dark .tab-transactions {
  border-color: #16a34a;
  color: #bbf7d0;
}
body.theme-dark .tab-catalogue {
  border-color: #3b82f6;
  color: #bfdbfe;
}
body.theme-dark .tab-requests {
  border-color: #f97316;
  color: #fed7aa;
}

/* Base tab colours (light) */
body.theme-light .panel-tab {
  border-color: #d4d4d8;
  color: #4b5563;
}
body.theme-light .tab-transactions {
  border-color: #16a34a;
  color: #166534;
}
body.theme-light .tab-catalogue {
  border-color: #3b82f6;
  color: #1d4ed8;
}
body.theme-light .tab-requests {
  border-color: #f97316;
  color: #9a3412;
}

/* Active states */
.panel-tab.active {
  border-width: 1px;
}

body.theme-dark .tab-transactions.active {
  background: #16a34a;
  color: #ecfdf5;
}
body.theme-dark .tab-catalogue.active {
  background: #3b82f6;
  color: #eff6ff;
}
body.theme-dark .tab-requests.active {
  background: #f97316;
  color: #111827;
}

body.theme-light .tab-transactions.active {
  background: #16a34a;
  color: #ecfdf5;
}
body.theme-light .tab-catalogue.active {
  background: #3b82f6;
  color: #eff6ff;
}
body.theme-light .tab-requests.active {
  background: #f97316;
  color: #111827;
}

#panelShell {
  position: relative;
  flex: 1;
  overflow-y: auto;   /* ✅ allow vertical scroll on the main panel area */
  overflow-x: hidden; /* keep horizontal hidden so carousel still behaves */
  min-height: 0;
}

/* Carousel that holds the 3 panels */
#panelCarousel {
  align-items: stretch;
  display: flex;
  width: 100%;          /* same width as shell */
  height: 100%;
  transition: transform 0.25s ease-out;
}

/* Each panel always takes 100% width of the shell */
.panel {
  min-height: 0;
  flex: 0 0 100%;       /* 🔑 one full-width panel at a time */
  border-radius: 14px;
  padding: 12px;
  border: 1px solid;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.theme-dark .panel {
  background: #020617;
  border-color: #111827;
}

body.theme-light .panel {
  background: #f9fafb;
  border-color: #d4d4d8;
}

.panel h3 {
  margin-bottom: 6px;
}

/* Header row for panels with tools on the right */
.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

/* Filter box in catalogue header */
.catalogue-filter-box {
  display: flex;
  align-items: center;
  gap: 4px;
}

.catalogue-filter-input {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  min-width: 160px;
  max-width: 220px;
}

.catalogue-filter-clear {
  border-radius: 999px;
  border: 1px solid #6b7280;
  background: transparent;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
}

/* Light / dark mode tweaks */
body.theme-dark .catalogue-filter-input {
  background: #020617;
  color: #e5e7eb;
  border-color: #4b5563;
}

body.theme-light .catalogue-filter-input {
  background: #ffffff;
  color: #111827;
  border-color: #d4d4d8;
}

body.theme-dark .catalogue-filter-clear {
  color: #e5e7eb;
  border-color: #6b7280;
}

body.theme-light .catalogue-filter-clear {
  color: #4b5563;
  border-color: #9ca3af;
}


.catalogue-filter-box {
  flex-wrap: wrap;
}

.catalogue-filter-select {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  min-width: 150px;
  max-width: 220px;
}

body.theme-dark .catalogue-filter-select {
  background: #020617;
  color: #e5e7eb;
  border-color: #4b5563;
}

body.theme-light .catalogue-filter-select {
  background: #ffffff;
  color: #111827;
  border-color: #d4d4d8;
}

/* Seller create item category select */
.category-select {
  width: 100%;
  margin: 6px 0 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #334155;
  background: #0b1220;
  color: #e5e7eb;
  font-size: 12px;
}

body.theme-light .category-select {
  background: #ffffff;
  color: #111827;
  border-color: #d4d4d8;
}

.catalogue-category-header {
  margin: 10px 0 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.65);
}

body.theme-light .catalogue-category-header {
  border-color: #e5e7eb;
  background: rgba(243, 244, 246, 0.9);
}

/* Lists inside panels scroll independently */
.panel .list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

/* arrows */
.panel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
}

body.theme-dark .panel-arrow {
  border-color: #111827;
  background: #020617;
  color: #e5e7eb;
}
body.theme-light .panel-arrow {
  border-color: #d4d4d8;
  background: #f3f4f6;
  color: #111827;
}

#panelPrev {
  left: 4px;
}
#panelNext {
  right: 4px;
}

/* ==========================================
   TRANSACTIONS
========================================== */

.tx-card {
  border-radius: 12px;
  padding: 10px 10px;
  margin-bottom: 8px;
  border-left: 3px solid #1f2937;
  border-right: 1px solid #111827;
  border-top: 1px solid #111827;
  border-bottom: 1px solid #111827;
  font-size: 12px;
}

body.theme-dark .tx-card {
  background: #020617;
}
body.theme-light .tx-card {
  background: #ffffff;
  border-color: #e5e7eb;
}

.tx-party {
  font-weight: 600;
}

.tx-meta {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 2px;
}

.tx-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 8px;
}

.status-pill {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* coloured statuses for tx */
.status-awaiting-payment {
  background: #1e3a8a;
  color: #dbeafe;
  border-color: #1d4ed8;
}

.status-pending {
  background: #431407;
  color: #fed7aa;
  border-color: #78350f;
}
.status-held {
  background: #713f12;
  color: #ffedd5;
  border-color: #b45309;
}
.status-in-transit {
  background: #0ea5e9;
  color: #eff6ff;
  border-color: #0284c7;
}
.status-delivered {
  background: #22c55e;
  color: #022c22;
  border-color: #16a34a;
}
.status-completed {
  background: #16a34a;
  color: #ecfdf5;
  border-color: #16a34a;
}
.status-disputed {
  background: #dc2626;
  color: #fee2e2;
  border-color: #b91c1c;
}
.status-refunded {
  background: #4b5563;
  color: #e5e7eb;
  border-color: #6b7280;
}

.tx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tx-actions .card-btn {
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid #1f2937;
  background: transparent;
  cursor: pointer;
}

.dispute-note {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  border-radius: 8px;
  padding: 6px 8px;
}

body.theme-dark .dispute-note {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.7);
  color: #fecaca;
}

body.theme-light .dispute-note {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

body.theme-dark .tx-actions .card-btn {
  background: #020617;
  color: #e5e7eb;
}
body.theme-light .tx-actions .card-btn {
  background: #f3f4f6;
  color: #111827;
  border-color: #d4d4d8;
}

.tx-actions .card-btn.primary {
  background: #16a34a;
  border-color: #16a34a;
  color: #ecfdf5;
}

.tx-actions .card-btn:hover {
  filter: brightness(1.1);
}

.tx-timer {
  font-size: 11px;
  opacity: 0.8;
}

/* ==========================================
   CATALOGUE
========================================== */

.item-card {
  display: flex;
  gap: 10px;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid;
  margin-bottom: 8px;
}

body.theme-dark .item-card {
  background: #020617;
  border-color: #111827;
}
body.theme-light .item-card {
  background: #ffffff;
  border-color: #e5e7eb;
}

.item-card img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
}

.item-main {
  flex: 1;
}

.item-title {
  font-size: 13px;
  font-weight: 600;
}

.item-meta {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
}

.item-desc {
  font-size: 11px;
  color: #cbd5f5;
  margin-top: 2px;
}

body.theme-light .item-desc {
  color: #4b5563;
}

.item-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.item-actions input {
  width: 50px;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 11px;
}

body.theme-dark .item-actions input {
  background: #020617;
  border-color: #111827;
  color: #e5e7eb;
}
body.theme-light .item-actions input {
  background: #f3f4f6;
  border-color: #d4d4d8;
  color: #111827;
}

/* Availability pill */
.avail-pill {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  display: inline-block;
  background: rgba(22, 163, 74, 0.2);
  color: #bbf7d0;
  margin-top: 4px;
}

body.theme-light .avail-pill {
  background: #dcfce7;   /* soft light green */
  color: #166534;        /* dark green text */
}

/* Note on seller own item */
.item-owner-note {
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.75;
}

/* ==========================================
   REQUESTS
========================================== */

.req-card {
  display: flex;
  gap: 8px;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid;
  margin-bottom: 8px;
  font-size: 11px;
}

body.theme-dark .req-card {
  background: #020617;
  border-color: #111827;
}
body.theme-light .req-card {
  background: #ffffff;
  border-color: #e5e7eb;
}

.req-card img {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
}

/* ==========================================
   TOAST & MODAL
========================================== */

#toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
}

body.theme-dark #toast {
  background: #1f2937;
  color: #f9fafb;
}
body.theme-light #toast {
  background: #111827;
  color: #f9fafb;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Modal */
#modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: grid;
  place-items: center;
  z-index: 40;
}

#modal {
  padding: 16px 18px;
  border-radius: 14px;
  width: 320px;
  border: 1px solid;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

body.theme-dark #modal {
  background: #020617;
  border-color: #111827;
}
body.theme-light #modal {
  background: #f9fafb;
  border-color: #d4d4d8;
  color: #111827;
}

#modal h3 {
  margin-bottom: 6px;
}

#modal p {
  font-size: 13px;
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-field {
  margin-bottom: 8px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-field label {
  font-weight: 500;
  font-size: 12px;
}

.modal-field select,
.modal-field textarea,
.modal-field input[type="file"] {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid;
}

body.theme-dark .modal-field select,
body.theme-dark .modal-field textarea,
body.theme-dark .modal-field input[type="file"] {
  background: #020617;
  border-color: #111827;
  color: #e5e7eb;
}

body.theme-light .modal-field select,
body.theme-light .modal-field textarea,
body.theme-light .modal-field input[type="file"] {
  background: #f9fafb;
  border-color: #d1d5db;
  color: #111827;
}

.modal-hint {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 4px;
}

/* Item preview overlay (large catalogue image) */
#itemPreviewOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  display: grid;
  place-items: center;
  z-index: 45;
}

#itemPreviewOverlay.hidden {
  display: none !important;
}

.item-preview-modal {
  max-width: 480px;
  width: 90%;
  border-radius: 14px;
  border: 1px solid;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

body.theme-dark .item-preview-modal {
  background: #020617;
  border-color: #111827;
  color: #e5e7eb;
}
body.theme-light .item-preview-modal {
  background: #f9fafb;
  border-color: #d4d4d8;
  color: #111827;
}

.item-preview-image-shell {
  position: relative;
  width: 100%;
  max-height: 260px;
  overflow: hidden;
  background: #020617;
}

body.theme-light .item-preview-image-shell {
  background: #0f172a;
}

.item-preview-image {
  width: 100%;
  display: block;
  max-height: 260px;
  object-fit: contain;
}

/* arrows for next/prev image */
.item-preview-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.8);
  color: #f9fafb;
}

body.theme-light .item-preview-arrow {
  background: rgba(15, 23, 42, 0.9);
}

.item-preview-arrow.arrow-left {
  left: 8px;
}

.item-preview-arrow.arrow-right {
  right: 8px;
}

/* 1/15 counter */
.item-preview-counter {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
}

.item-preview-image {
  width: 100%;
  display: block;
  max-height: 260px;
  object-fit: contain;
  background: #020617;
}

body.theme-light .item-preview-image {
  background: #0f172a;
}

.item-preview-body {
  padding: 12px 14px 14px;
  font-size: 13px;
}

.item-preview-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.item-preview-meta {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.item-preview-details {
  font-size: 12px;
  opacity: 0.95;
  margin-bottom: 6px;
}

.item-preview-owner-note {
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 8px;
}

.item-preview-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Make catalogue thumbnails clearly tappable */
.item-card img {
  cursor: pointer;
  border-radius: 8px;
}

/* ==========================================
   RESPONSIVE (PHONE)
========================================== */
#mainLayout,
#main,
#content,
#panelShell {
  max-width: 100%;
}

#panelShell {
  min-height: 0; /* lets it flex properly inside #content */
}

#auditPanel{ /* overridden to match theme */ }

.audit-entry {
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}
.audit-entry:last-child {
  border-bottom: none;
}

.audit-entry .meta {
  font-weight: 600;
}
.audit-entry .details {
  color: #555;
}

/* ========== RESPONSIVE (PHONE) ========== */
@media (max-width: 900px) {
  /* Off-canvas sidebar on phones/tablets */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: calc(var(--app-vh, 1vh) * 100);
    width: 66vw;
    max-width: 520px;
    min-width: 280px;
    transform: translateX(-105%);
    transition: transform 200ms ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 50;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  .sidebar-close { display: inline-flex; }

  /* Main takes full width */
  #mainLayout {
    width: 100%;
    max-width: 100vw;
    height: calc(var(--app-vh, 1vh) * 100);
    min-height: calc(var(--app-vh, 1vh) * 100);
  }

  #topbar {
    padding: 0 10px;
  }

  #content {
    padding: 12px;
  }

  /* Make the sliding panel area (tabs + panels) occupy ~2/3 of the screen */
  #content{
    height: 100%;
    gap: 10px;
  }
  #summarySection{
    flex: 0 0 auto;
    /* let summary shrink to content to remove blank space */
    max-height: none;
    overflow: hidden;
}
  #panelZone{
    flex: 1 1 auto;
    min-height: 0;
  }
  #panelShell{
    flex: 1 1 auto;
    min-height: 0;
  }

  /* --- Mobile: make the top summary fit with NO scrolling --- */
  #summarySection{
    overflow: hidden;
  }
  #escrowSummaryRow{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .escrow-card{
    min-width: 0;
    max-width: none;
    padding: 8px 10px;
    border-radius: 12px;
  }
  .escrow-label{ font-size: 10px; }
  .escrow-amount{ font-size: 18px; }
  .escrow-sub{ font-size: 10px; }

  #statusGrid{
    gap: 5px;
  }
  .status-tile{
    padding: 4px 6px;
    border-radius: 9px;
    font-size: 10px;
  }
  .status-tile-label{ font-size: 10px; }
  .status-tile-value{ font-size: 13px; }




  .sidebar-block input,
  .sidebar-block select {
    font-size: 12px;
  }

  .tx-card,
  .item-card,
  .req-card {
    margin-bottom: 12px;
  }
}




/* ===== MENU COIN + DASHES ===== */
.menu-coin-btn{
  width: 48px;
  height: 52px;
  padding: 6px 6px 8px;
  border-radius: 14px;
  overflow: visible;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
}

.menu-coin-img{
  width: 38px; /* ~10mm on many mobile screens */
  height: 38px;
  border-radius: 999px;
  object-fit: contain;
  object-position: center;
  display: block;
}

.menu-dashes{
  width: 18px;
  height: 10px;
  display: block;
  position: relative;
  opacity: 0.95;
}

.menu-coin-btn .menu-dashes::before{
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(currentColor 0 0) 0 0 / 100% 2px no-repeat,
    linear-gradient(currentColor 0 0) 0 4px / 100% 2px no-repeat,
    linear-gradient(currentColor 0 0) 0 8px / 100% 2px no-repeat;
}

/* Small right-pointing arrow head next to the hamburger lines */
.menu-coin-btn .menu-dashes::after{
  content: "";
  position: absolute;
  top: 50%;
  right: -8px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  opacity: 0.9;
}

body.theme-dark .menu-coin-btn{ color: rgba(255,255,255,0.9); }
body.theme-light .menu-coin-btn{ color: rgba(17,24,39,0.9); }

/* Hide the toggle on desktop (sidebar is visible there) */
@media (min-width: 901px){
  #sidebarToggleBtn{ display: none; }
  .menu-dashes{ display:none; }
}



/* ===== Header coin + DSS strip ===== */
.menu-dashes { display: none !important; }

.menu-coin-btn{
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border-radius: 999px !important;
}

.menu-coin-img{
  width: 30px !important;   /* ~8mm */
  height: 30px !important;  /* ~8mm */
  object-fit: contain !important;
  transform: none !important;
  filter: none !important;
}

/* Dynamic Strip Screen (DSS) */
.dss-bar{
  display: none;
  height: 28px; /* ~4-7mm depending on device density */
  margin: 6px 12px 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 0;
  background: rgba(16, 24, 36, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 22px rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
}

.dss-toggle{
  height: 28px;
  min-width: 44px;
  padding: 0 8px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.95);
  border-right: 1px solid rgba(255,255,255,0.10);
  cursor: pointer;
}

.dss-lines{
  width: 16px;
  height: 12px;
  display: inline-block;
  border-radius: 3px;
  background:
    linear-gradient(rgba(255,255,255,0.90), rgba(255,255,255,0.90)) 0 0 / 100% 2px no-repeat,
    linear-gradient(rgba(255,255,255,0.90), rgba(255,255,255,0.90)) 0 50% / 100% 2px no-repeat,
    linear-gradient(rgba(255,255,255,0.90), rgba(255,255,255,0.90)) 0 100% / 100% 2px no-repeat;
  opacity: 0.95;
}

.dss-arrow{
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid rgba(255,255,255,0.90);
  opacity: 0.95;
}

.dss-textwrap{
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
}

.dss-hint{
  font-size: 14px;
  opacity: 0.95;
}

.dss-text{
  font-size: 12px;
  line-height: 1;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dss-text.dss-marquee{
  display: inline-block;
  white-space: nowrap;
  animation: dss-marquee 8s linear infinite;
}

@keyframes dss-marquee{
  0%{ transform: translateX(0); }
  100%{ transform: translateX(-45%); }
}


/* ===== Transaction Record File (tap a transaction card) ===== */
#txRecordOverlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: grid;
  place-items: center;
  z-index: 46; /* above item preview */
}
#txRecordOverlay.hidden{ display:none !important; }

.tx-record-modal{
  width: min(520px, 94vw);
  max-height: calc(100dvh - 60px);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid;
  box-shadow: 0 18px 55px rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
}

body.theme-dark .tx-record-modal{
  background: #020617;
  border-color: #111827;
  color: #e5e7eb;
}
body.theme-light .tx-record-modal{
  background: #f9fafb;
  border-color: #d4d4d8;
  color: #111827;
}

.tx-record-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

body.theme-light .tx-record-header{
  border-bottom-color: rgba(0,0,0,0.10);
}

.tx-record-header-title{
  font-weight: 900;
  letter-spacing: .2px;
  text-align:center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-record-body{
  padding: 14px 14px 90px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: calc(100dvh - 170px);
}

.tx-record-party{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

body.theme-light .tx-record-party{
  border-color: rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
}

.tx-record-avatar{
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.20);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  letter-spacing: .6px;
  user-select:none;
  flex: none;
  background-size: cover;
  background-position: center;
}

body.theme-light .tx-record-avatar{
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.06);
}

.tx-record-party-name{
  font-weight: 900;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}
.tx-record-party-sub{
  opacity: 0.85;
  font-size: 13px;
  margin-top: 2px;
  line-height: 1.35;
}

.tx-record-item{
  display:flex;
  gap: 12px;
  align-items:center;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}
body.theme-light .tx-record-item{
  border-color: rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
}

.tx-record-item-img{
  width: 90px;
  height: 90px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.18);
  flex: none;
  cursor: pointer;
}

body.theme-light .tx-record-item-img{
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.06);
}

.tx-record-item-title{
  font-weight: 900;
  font-size: 15px;
  line-height: 1.2;
}
.tx-record-item-sub{
  margin-top: 4px;
  opacity: 0.88;
  font-size: 13px;
  line-height: 1.35;
}

.tx-record-section{
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}
body.theme-light .tx-record-section{
  border-color: rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.03);
}

.tx-record-section-title{
  font-weight: 900;
  margin-bottom: 10px;
}

.tx-record-kv{
  display:grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 10px 12px;
  align-items: start;
  font-size: 13px;
}
.tx-record-kv .k{ opacity: 0.85; }
.tx-record-kv .v{ font-weight: 700; word-break: break-word; }

.tx-record-timeline{
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.tx-tl-row{
  display:flex;
  gap: 10px;
  align-items:flex-start;
}
.tx-tl-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 5px;
  background: rgba(255,255,255,0.28);
  flex:none;
}
body.theme-light .tx-tl-dot{ background: rgba(0,0,0,0.25); }

.tx-tl-text{ flex:1; }
.tx-tl-title{ font-weight: 900; }
.tx-tl-time{ opacity: 0.85; font-size: 12px; margin-top: 2px; }


/* ===== Records-management style for Transaction File ===== */
.tx-record-tools{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px dashed rgba(255,255,255,0.14);
  flex-wrap: wrap;
}
body.theme-light .tx-record-tools{
  border-bottom-color: rgba(0,0,0,0.14);
}
.tx-record-ref{
  font-weight: 900;
  letter-spacing: .2px;
  opacity: 0.95;
}
.tx-record-tool-buttons{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content:flex-end;
}

.tx-record-body{
  position: relative;
  /* paper-like feel */
  background-image: linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 100% 28px;
}
body.theme-light .tx-record-body{
  background-image: linear-gradient(to bottom, rgba(0,0,0,0.04) 1px, transparent 1px);
}

.tx-record-stamp{
  position:absolute;
  top: 12px;
  right: 12px;
  transform: rotate(-10deg);
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.22);
  font-weight: 1000;
  letter-spacing: .8px;
  font-size: 12px;
  user-select:none;
  text-transform: uppercase;
}
body.theme-light .tx-record-stamp{
  border-color: rgba(0,0,0,0.20);
  background: rgba(0,0,0,0.06);
}

.tx-record-meta-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.03);
}
body.theme-light .tx-record-meta-grid{
  border-color: rgba(0,0,0,0.16);
  background: rgba(0,0,0,0.02);
}
.tx-record-meta-cell .k{
  font-size: 12px;
  opacity: 0.8;
}
.tx-record-meta-cell .v{
  font-size: 13px;
  font-weight: 900;
  margin-top: 2px;
  word-break: break-word;
}

.tx-record-party{
  margin-top: 12px;
  flex-direction: column;
  text-align: center;
  justify-content: center;
}
.tx-record-party-text{ display:block; }
.tx-record-party-name{ max-width: 100%; }

.tx-record-avatar{
  width: 92px;
  height: 92px;
  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.tx-record-item{
  align-items: center;
}
.tx-record-item-meta{
  text-align:left;
}
@media (max-width: 420px){
  .tx-record-item{ flex-direction: column; align-items: stretch; }
  .tx-record-item-img{ width: 100%; height: 180px; }
  .tx-record-item-meta{ text-align:left; }
  .tx-record-meta-grid{ grid-template-columns: 1fr; }
}

/* Print only the record */
@media print{
  body.print-tx-record *{ visibility: hidden !important; }
  body.print-tx-record #txRecordOverlay,
  body.print-tx-record #txRecordOverlay *{ visibility: visible !important; }

  body.print-tx-record #txRecordOverlay{
    position: static !important;
    inset: auto !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body.print-tx-record .tx-record-modal{
    width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }
  body.print-tx-record .tx-record-header,
  body.print-tx-record .tx-record-tools{
    display: none !important;
  }
  body.print-tx-record .tx-record-body{
    max-height: none !important;
    overflow: visible !important;
    background-image: none !important;
  }
  body.print-tx-record .secondary-btn{ display:none !important; }
}


/* ===========================
   Transactions: Search/Filter Bar
   =========================== */

.tx-filter-bar{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  margin: 6px 0 10px;
  padding: 0;
  background: transparent;
  border: none;
}

.tx-filter-input{
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  min-width: 170px;
  max-width: 260px;
  background: transparent;
  color: inherit;
  outline: none;
  flex: 1 1 200px;
}

.tx-filter-select, .tx-filter-date{
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #4b5563;
  min-width: 130px;
  max-width: 220px;
  background: transparent;
  color: inherit;
  outline: none;
}

.tx-filter-datewrap{
  display:flex;
  align-items:center;
  gap: 4px;
}

.tx-filter-tag{
  font-size: 11px;
  opacity: 0.8;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  white-space: nowrap;
}

body.theme-light .tx-filter-tag{
  border-color: rgba(0,0,0,0.14);
  background: rgba(0,0,0,0.04);
}

.tx-filter-clear{
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid #6b7280;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
/* ===========================
   Transaction Record: File Cover + Signatures
   =========================== */
.tx-record-cover{
  margin: 10px 0 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px dashed rgba(255,255,255,0.18);
}
.tx-cover-title{
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}
.tx-cover-sub{
  opacity: 0.85;
  font-size: 13px;
  margin-bottom: 10px;
}
.tx-cover-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.tx-cover-box{
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
}
.tx-cover-box-title{
  font-weight: 700;
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 6px;
}
.tx-cover-row{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tx-cover-row:last-child{ border-bottom: none; }
.tx-cover-k{ opacity: 0.85; }
.tx-cover-v{ font-weight: 650; text-align:right; }

.tx-record-signatures{
  margin: 10px 0 2px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
}
.tx-sig-title{
  font-weight: 800;
  margin-bottom: 10px;
}
.tx-sig-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tx-sig-line{
  padding: 10px 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.16);
}
.tx-sig-label{
  opacity: 0.85;
  font-size: 12px;
  margin-bottom: 10px;
}
.tx-sig-blank{
  height: 22px;
  border-bottom: 2px solid rgba(255,255,255,0.35);
  margin-bottom: 8px;
}
.tx-sig-meta{
  opacity: 0.8;
  font-size: 12px;
}

/* Print: make the record look more like a formal file */
@media print{
  body.print-tx-record .tx-record-cover,
  body.print-tx-record .tx-record-signatures{
    border-color: rgba(0,0,0,0.35) !important;
    background: #fff !important;
    color:#000 !important;
  }
  body.print-tx-record .tx-cover-box,
  body.print-tx-record .tx-sig-line{
    background: #fff !important;
    color:#000 !important;
    border-color: rgba(0,0,0,0.22) !important;
  }
}

/* tx-filter theme tweaks */
body.theme-dark .tx-filter-input,
body.theme-dark .tx-filter-select,
body.theme-dark .tx-filter-date{
  background: #020617;
  color: #e5e7eb;
  border-color: #4b5563;
}
body.theme-light .tx-filter-input,
body.theme-light .tx-filter-select,
body.theme-light .tx-filter-date{
  background: #ffffff;
  color: #111827;
  border-color: #d4d4d8;
}

@media (max-width: 420px){
  .tx-record-tool-buttons{
    width: 100%;
    justify-content: space-between;
  }
  .tx-record-ref{
    width: 100%;
  }
}



/* =========================
   ADMIN DASHBOARD (role=admin)
   ========================= */
.admin-only{ display:none !important; }
body.is-admin .admin-only{ display:block !important; }
body.is-admin #panelNav .admin-only{ display:flex !important; }

#panel-admin{
  padding-bottom: 18px;
}

.admin-header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.admin-badge{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.14);
  background:rgba(255,255,255,0.06);
  font-weight:800;
  letter-spacing:0.3px;
}

.admin-subnav{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin: 6px 0 10px;
}

.admin-subtab{
  padding:6px 10px;
  font-size:12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(255,255,255,0.05);
  color:#fff;
  cursor:pointer;
  font-weight:800;
  letter-spacing:0.2px;
}

.admin-subtab.active{
  border-color: rgba(126,211,255,0.55);
  background: rgba(126,211,255,0.12);
}

.admin-view{ display:none; }
.admin-view.active{ display:block; }

.admin-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}

@media (max-width: 520px){
  .admin-grid{ grid-template-columns: 1fr; }
}

.admin-card{
  border-radius:16px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  padding:12px;
}

.admin-card h4{
  margin:0 0 8px;
  font-size:13px;
  letter-spacing:0.35px;
  opacity:0.9;
  text-transform:uppercase;
}

.admin-metric{
  font-size:22px;
  font-weight:900;
  letter-spacing:0.2px;
}

.admin-subtext{
  margin-top:6px;
  opacity:0.85;
  font-size:13px;
  line-height:1.25;
}

.admin-toolbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom:10px;
}

.admin-toolbar input,
.admin-toolbar select{
  height:40px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color:#fff;
  padding: 0 12px;
  outline:none;
}

.admin-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
}

.admin-table th,
.admin-table td{
  padding:10px 10px;
  font-size:13px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  vertical-align:top;
  word-break:break-word;
}

.admin-table th{
  text-transform:uppercase;
  letter-spacing:0.35px;
  font-size:12px;
  opacity:0.85;
  background: rgba(255,255,255,0.04);
}

.admin-table tr:last-child td{ border-bottom:none; }

.admin-mini-btn{
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  color:#fff;
  cursor:pointer;
  font-weight:800;
  font-size:12px;
}

.admin-mini-btn.danger{
  border-color: rgba(255,80,80,0.35);
  background: rgba(255,80,80,0.10);
}

.admin-note{
  opacity:0.85;
  font-size:13px;
  line-height:1.35;
  margin: 6px 0 12px;
}


/* =========================
   ADMIN PANEL SCROLL FIX
   ========================= */
#panel-admin 

/* =========================
   AUDIT PANEL TOGGLE + EXPAND
   ========================= */


.audit-panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 8px;
}

.audit-panel-title{
  font-weight: 800;
  letter-spacing: 0.3px;
}

.audit-panel-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.mini-btn{
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: inherit;
  cursor: pointer;
}

.audit-panel .audit-list{
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 205px;
  padding-right: 4px;
}

/* Expanded full-screen audit view */


.audit-panel.expanded .audit-list{
  max-height: calc(100dvh - 92px);
}


/* --- Admin scroll fixes (mobile) --- */
#panel-admin{
  min-height: 0;
}
#panel-admin .admin-scroll{
  flex: 1;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#panel-admin .admin-view{
  min-height: 0;
}

/* --- Audit log: inline expand/collapse (no popup overlay) --- */
.audit-panel{
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  padding: 10px;
  max-height: 240px;
  overflow: hidden;
}
.audit-panel .audit-panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 8px;
}
.audit-panel .audit-panel-title{
  font-weight: 800;
  opacity: 0.95;
}
.audit-panel .audit-panel-actions{
  display:flex;
  gap:8px;
}
.audit-panel .audit-list{
  overflow-y: auto;
  max-height: 190px;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}
.audit-panel.expanded{
  position: static;         /* ✅ keep inline */
  inset: auto;
  z-index: auto;
  max-height: 70vh;         /* ✅ just taller */
  overflow: hidden;
  box-shadow: none;
  background: rgba(255,255,255,0.04);
}
.audit-panel.expanded .audit-list{
  max-height: calc(70vh - 54px);
}


/* Admin scroll: ensure vertical scrolling works on mobile */
#panel-admin .admin-scroll{ touch-action: pan-y; overscroll-behavior: contain; }

@media (max-width: 720px){
  #panel-admin .admin-scroll{ max-height: 55vh; }
}

.audit-empty{ opacity: .8; padding: 10px 6px; font-size: 13px; }


/* --- Admin scroll area improvements (mobile) --- */
.admin-scroll{
  overflow-y:auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  max-height: calc(100dvh - 360px);
  padding-bottom: 22px;
}
@media (max-width: 520px){
  .admin-scroll{ max-height: calc(100dvh - 330px); }
}

/* --- Audit list visibility --- */
.audit-panel{border:1px solid rgba(255,255,255,0.12); border-radius:16px; padding:12px; background: rgba(0,0,0,0.25);}
.audit-panel .audit-list{max-height: 240px;}
.audit-entry{padding:10px 10px; border:1px solid rgba(255,255,255,0.10); border-radius:12px; margin-bottom:8px; background: rgba(255,255,255,0.03);}
.audit-entry-meta{font-size:12px; opacity:0.92; font-weight:700;}
.audit-entry-details{font-size:12px; opacity:0.86; margin-top:4px; word-break: break-word;}
.audit-empty{opacity:0.75; padding:10px;}


/* --- Auth (Welcome + Sign-in stacked) --- */
#signinScreen {
  padding: 18px;
  box-sizing: border-box;
}
.signin-box{
  width: min(560px, 92vw);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.auth-welcome{
  text-align: center;
  padding: 6px 2px 10px;
}
.auth-welcome-logo{
  display:flex;
  justify-content:center;
  margin-bottom: 10px;
}
.auth-welcome-logo img{
  width: 86px;
  height: 86px;
  object-fit: contain;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  padding: 10px;
}
.auth-welcome-title{
  font-size: 28px;
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 8px;
}
.auth-welcome-sub{
  font-size: 14px;
  opacity: 0.92;
  line-height: 1.35;
  margin: 0 auto 10px;
  max-width: 42ch;
}
.auth-welcome-note{
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.35;
  margin: 0 auto 12px;
  max-width: 46ch;
}
.auth-welcome-linkrow{
  display:flex;
  justify-content:center;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.auth-link{
  color: #60a5fa;
  text-decoration: underline;
  font-weight: 700;
}
.auth-divider{
  height:1px;
  background: rgba(255,255,255,0.10);
  margin: 10px 0 14px;
}


/* ===== PSP / BoZ readiness polish ===== */
.compliance-note{
  margin: 8px 14px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid;
}
body.theme-dark .compliance-note{
  background: rgba(59,130,246,0.10);
  border-color: rgba(96,165,250,0.35);
  color: #dbeafe;
}
body.theme-light .compliance-note{
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

#partnerDisclosureBar{
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.auth-staff-row{
  display:flex;
  justify-content:center;
  align-items:center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

#linkStaffAccess,
#staffAccessLink{
  color: #22c55e;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
}

body.theme-light #linkStaffAccess,
body.theme-light #staffAccessLink{
  color: #166534;
}

body.theme-dark #linkStaffAccess,
body.theme-dark #staffAccessLink{
  color: #86efac;
}

.auth-role-note{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
}
body.theme-dark .auth-role-note{
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: #cbd5e1;
}
body.theme-light .auth-role-note{
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  color: #475569;
}

.role-badge,
.staff-role-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  border: 1px solid;
}
body.theme-dark .role-badge,
body.theme-dark .staff-role-badge{
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.10);
  color: #e5e7eb;
}
body.theme-light .role-badge,
body.theme-light .staff-role-badge{
  background: #f8fafc;
  border-color: #dbe4ee;
  color: #1f2937;
}
.staff-role-badge.admin{ background: rgba(59,130,246,0.14); border-color: rgba(59,130,246,0.35); }
.staff-role-badge.risk,
.staff-role-badge.risk_agent{ background: rgba(249,115,22,0.14); border-color: rgba(249,115,22,0.35); }
.staff-role-badge.accounts,
.staff-role-badge.accounts_agent,
.staff-role-badge.finance,
.staff-role-badge.finance_agent{ background: rgba(34,197,94,0.14); border-color: rgba(34,197,94,0.35); }
.staff-role-badge.compliance,
.staff-role-badge.compliance_agent{ background: rgba(168,85,247,0.14); border-color: rgba(168,85,247,0.35); }

.case-timeline,
.audit-timeline{
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.case-timeline-item,
.audit-timeline-item{
  position: relative;
  padding: 10px 12px 10px 16px;
  border-radius: 12px;
  border: 1px solid;
}
.case-timeline-item::before,
.audit-timeline-item::before{
  content: "";
  position: absolute;
  left: 8px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
}
body.theme-dark .case-timeline-item,
body.theme-dark .audit-timeline-item{
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.09);
  color: #dbeafe;
}
body.theme-light .case-timeline-item,
body.theme-light .audit-timeline-item{
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}

.partner-processed,
.status-chip.partner-processed{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  border: 1px solid;
}
body.theme-dark .partner-processed,
body.theme-dark .status-chip.partner-processed{
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.35);
  color: #bbf7d0;
}
body.theme-light .partner-processed,
body.theme-light .status-chip.partner-processed{
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}

@media (max-width: 640px){
  .compliance-note{
    margin: 8px 10px 0;
    padding: 9px 10px;
    font-size: 11px;
  }
  .auth-welcome-title{
    font-size: 24px;
  }
  .auth-welcome-sub,
  .auth-welcome-note{
    max-width: 100%;
  }
}

/* =====================================================
   RISK / STAFF CONSOLE CONTRAST OVERRIDES
   Improves readability for admin/issues/risk workstations
   ===================================================== */
body.theme-dark #panel-admin,
body.theme-dark #adminView-issues,
body.theme-dark .admin-view,
body.theme-dark .admin-card,
body.theme-dark .audit-panel,
body.theme-dark .issues-card,
body.theme-dark .issues-queue-wrap {
  color: #f8fafc;
}

body.theme-dark .admin-card,
body.theme-dark .audit-panel,
body.theme-dark #adminView-issues .issues-card,
body.theme-dark #adminView-issues .issues-queue-wrap {
  background: rgba(8, 15, 35, 0.88) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

body.theme-dark .admin-card h4,
body.theme-dark .admin-note,
body.theme-dark .admin-subtext,
body.theme-dark .issues-kv,
body.theme-dark .issues-kv b,
body.theme-dark .issues-meta,
body.theme-dark .issues-title,
body.theme-dark .issues-tl-top,
body.theme-dark .issues-tl-row,
body.theme-dark .issues-action-item,
body.theme-dark .audit-entry,
body.theme-dark .audit-entry-meta,
body.theme-dark .audit-entry-details,
body.theme-dark .mini-btn,
body.theme-dark .admin-mini-btn,
body.theme-dark .admin-subtab,
body.theme-dark .risk-queue-filter,
body.theme-dark .issues-lane-btn,
body.theme-dark .issues-callout,
body.theme-dark .issues-alert,
body.theme-dark #panel-admin select,
body.theme-dark #panel-admin input,
body.theme-dark #panel-admin textarea,
body.theme-dark #panel-admin option {
  color: #f8fafc !important;
}

body.theme-dark .admin-subtab,
body.theme-dark .mini-btn,
body.theme-dark .admin-mini-btn,
body.theme-dark .risk-queue-filter,
body.theme-dark .issues-lane-btn,
body.theme-dark #panel-admin select,
body.theme-dark #panel-admin input,
body.theme-dark #panel-admin textarea {
  background: rgba(15, 23, 42, 0.92) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}

body.theme-dark .admin-subtab:hover,
body.theme-dark .mini-btn:hover,
body.theme-dark .admin-mini-btn:hover,
body.theme-dark .risk-queue-filter:hover,
body.theme-dark .issues-lane-btn:hover {
  background: rgba(30, 41, 59, 0.96) !important;
  border-color: rgba(96, 165, 250, 0.42) !important;
}

body.theme-dark .admin-subtab.active,
body.theme-dark .risk-queue-filter.active,
body.theme-dark #adminView-issues .issues-queue-row.active {
  background: rgba(30, 64, 175, 0.28) !important;
  border-color: rgba(96, 165, 250, 0.62) !important;
  box-shadow: 0 0 0 1px rgba(96,165,250,0.12) inset;
}

body.theme-dark #adminView-issues .issues-queue-row {
  background: rgba(2, 6, 23, 0.62) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
}
body.theme-dark #adminView-issues .issues-queue-row:hover {
  background: rgba(15, 23, 42, 0.92) !important;
}

body.theme-dark .issues-title,
body.theme-dark .admin-metric,
body.theme-dark .audit-panel-title,
body.theme-dark .risk-queue-filter .big,
body.theme-dark .issues-lane-btn b,
body.theme-dark .admin-header-row,
body.theme-dark .admin-badge {
  color: #ffffff !important;
}

body.theme-dark .admin-note,
body.theme-dark .admin-subtext,
body.theme-dark .issues-meta,
body.theme-dark .issues-lane-btn span,
body.theme-dark .issues-kv b,
body.theme-dark .audit-entry-details,
body.theme-dark .risk-queue-filter .small,
body.theme-dark .issues-tl-top {
  color: #cbd5e1 !important;
  opacity: 1 !important;
}

body.theme-dark .issues-callout {
  background: rgba(8, 47, 73, 0.72) !important;
  border-left-color: rgba(56, 189, 248, 0.92) !important;
  color: #e0f2fe !important;
}

body.theme-dark .issues-alert {
  background: rgba(69, 10, 10, 0.58) !important;
  border-left-color: rgba(248, 113, 113, 0.96) !important;
  color: #fee2e2 !important;
}

body.theme-dark #panel-admin textarea::placeholder,
body.theme-dark #panel-admin input::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}

body.theme-dark #panel-admin select {
  appearance: auto;
}

body.theme-dark #panel-admin option {
  background: #0f172a !important;
  color: #f8fafc !important;
}

body.theme-dark .badge,
body.theme-dark .status-chip,
body.theme-dark .role-badge,
body.theme-dark .staff-role-badge {
  font-weight: 800 !important;
  color: #fff !important;
  text-shadow: none !important;
}

body.theme-dark .badge.status-ok,
body.theme-dark .status-chip.status-ok {
  background: rgba(22, 163, 74, 0.24) !important;
  border-color: rgba(74, 222, 128, 0.52) !important;
  color: #dcfce7 !important;
}
body.theme-dark .badge.status-pending,
body.theme-dark .status-chip.status-pending {
  background: rgba(180, 83, 9, 0.26) !important;
  border-color: rgba(251, 191, 36, 0.52) !important;
  color: #fef3c7 !important;
}
body.theme-dark .badge.status-bad,
body.theme-dark .status-chip.status-bad {
  background: rgba(127, 29, 29, 0.30) !important;
  border-color: rgba(248, 113, 113, 0.52) !important;
  color: #fee2e2 !important;
}

body.theme-dark #adminView-issues .issues-timeline,
body.theme-dark #adminView-issues .issues-actions-list,
body.theme-dark .audit-panel .audit-list {
  background: rgba(2, 6, 23, 0.46) !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
}

body.theme-dark #adminView-issues .issues-tl-row,
body.theme-dark #adminView-issues .issues-action-item,
body.theme-dark .audit-entry {
  background: rgba(15, 23, 42, 0.56) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
}

body.theme-dark #adminView-issues .issues-kv b,
body.theme-dark .admin-table th {
  color: #bfdbfe !important;
  opacity: 1 !important;
}

body.theme-dark .admin-table {
  background: rgba(8, 15, 35, 0.88) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}
body.theme-dark .admin-table th {
  background: rgba(30, 41, 59, 0.74) !important;
}
body.theme-dark .admin-table td {
  color: #f8fafc !important;
  border-bottom-color: rgba(148, 163, 184, 0.16) !important;
}

body.theme-dark .admin-badge {
  background: rgba(37, 99, 235, 0.20) !important;
  border-color: rgba(96, 165, 250, 0.44) !important;
}

@media (max-width: 980px) {
  body.theme-dark #adminView-issues .issues-card,
  body.theme-dark #adminView-issues .issues-queue-wrap {
    padding: 10px;
  }
}


/* ===== Step 9B: Full Staff Shell Isolation ===== */
body.is-staff-console #summarySection,
body.is-staff-console #dssBar,
body.is-staff-console #partnerDisclosureBar,
body.is-staff-console #panelNav,
body.is-staff-console #panelPrev,
body.is-staff-console #panelNext,
body.is-staff-console #buyerTools,
body.is-staff-console #sellerTools,
body.is-staff-console #kycSidebarBox,
body.is-staff-console #adminTools,
body.is-staff-console .tpAdminConsoleToggleWrap,
body.is-staff-console #tpAdminConsoleToggleBtn {
  display: none !important;
}

body.is-staff-console #panelShell,
body.is-staff-console #panelCarousel {
  height: calc(100vh - 170px);
}

body.is-staff-console #panelCarousel {
  display: block !important;
  transform: none !important;
}

body.is-staff-console #panel-transactions,
body.is-staff-console #panel-catalogue,
body.is-staff-console #panel-requests {
  display: none !important;
}

body.is-staff-console #panel-admin {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
}

body.is-staff-console #content {
  padding-top: 10px;
}

body.is-staff-console .admin-header-row {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 10px;
}

body.is-staff-console .staff-console-badge {
  margin: 12px 14px 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(90,160,255,0.30);
  background: linear-gradient(180deg, rgba(22,34,68,0.95), rgba(12,18,38,0.96));
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

body.is-staff-console .staff-console-badge b {
  display: block;
  color: #eef6ff;
  font-size: 14px;
  margin-bottom: 4px;
}

body.is-staff-console .staff-console-badge span {
  display: block;
  color: #b6c7e8;
  font-size: 12px;
  line-height: 1.35;
}

body.is-risk-console .admin-badge,
body.is-risk-console .staff-role-badge {
  background: rgba(213, 63, 140, 0.18) !important;
  border-color: rgba(236, 72, 153, 0.45) !important;
  color: #ffd5e8 !important;
}

body.is-admin-console .admin-badge,
body.is-admin-console .staff-role-badge {
  background: rgba(59, 130, 246, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  color: #dbeafe !important;
}

body.is-staff-console #adminSubnav {
  gap: 10px;
  flex-wrap: wrap;
}

body.is-staff-console #adminSubnav .admin-subtab {
  min-width: 132px;
  text-align: center;
}

body.is-staff-console #adminView-issues .issues-layout {
  grid-template-columns: 0.96fr 1.44fr !important;
}

body.is-staff-console #adminView-issues .issues-card,
body.is-staff-console #adminView-issues .issues-queue-wrap,
body.is-staff-console #adminView-issues .risk-queue-filter,
body.is-staff-console .admin-view {
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
}


/* ===== Stable role-based sidebar visibility ===== */
#buyerTools,
#sellerTools {
  display: none;
}
body.role-buyer #buyerTools {
  display: block !important;
}
body.role-seller #sellerTools {
  display: block !important;
}
body.role-admin #buyerTools,
body.role-admin #sellerTools {
  display: block !important;
}
body.role-staff #buyerTools,
body.role-staff #sellerTools,
body.is-staff-console #buyerTools,
body.is-staff-console #sellerTools {
  display: none !important;
}

/* ===== Admin / Risk console stabilizers ===== */
#panelNav {
  flex-wrap: wrap;
}
#panelNav .panel-tab {
  min-width: 0;
}

#adminView-issues .issues-layout {
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.35fr) !important;
  align-items: start;
  width: 100%;
  max-width: 100%;
}
#adminView-issues .issues-col,
#adminView-issues .issues-card,
#adminView-issues .issues-queue-wrap,
#adminView-issues .admin-toolbar,
#adminView-issues .issues-actions-list,
#adminView-issues .issues-timeline {
  min-width: 0;
  max-width: 100%;
}
#adminView-issues textarea,
#adminView-issues select,
#adminView-issues input {
  max-width: 100%;
}
#adminView-issues .issues-queue-row {
  width: 100%;
}

body.is-staff-console #panelShell {
  overflow-y: auto;
  overflow-x: hidden;
}
body.is-staff-console #panelCarousel {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  transform: none !important;
}
body.is-staff-console #panel-admin {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
body.is-staff-console #panel-admin .admin-scroll {
  max-height: none;
  height: auto;
}

@media (max-width: 980px) {
  #adminView-issues .issues-layout {
    grid-template-columns: 1fr !important;
  }
}
