/* ==========================================================================
   BARELOGIC PARTNER PORTAL — INTERNATIONAL FINTECH UI (100% SELF-CONTAINED)
   ========================================================================== */
:root {
  --bg-canvas: #050811;
  --bg-sidebar: #090e1c;
  --bg-surface: #0d1424;
  --bg-surface-2: #121b30;
  --bg-input: #070b15;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text-main: #f8fafc;
  --text-soft: #cbd5e1;
  --text-muted: #7e8da6;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.28);
  --emerald: #10b981;
  --amber: #f59e0b;
  --sky: #38bdf8;
  --danger: #ef4444;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.35); }

/* ==========================================================================
   1. AUTH / LOGIN VAULT SCREEN
   ========================================================================== */
.auth-screen {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(600px circle at 20% 15%, rgba(59, 130, 246, 0.14), transparent 60%),
    radial-gradient(500px circle at 85% 85%, rgba(16, 185, 129, 0.1), transparent 60%),
    var(--bg-canvas);
  overflow-y: auto;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, rgba(17, 25, 44, 0.92), rgba(10, 15, 29, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 34px 32px 28px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
  flex-shrink: 0;
}

.brand-mark.sm {
  width: 34px;
  height: 34px;
  font-size: 1rem;
  border-radius: 9px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  color: var(--text-main);
}

.partner-brand-tag {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #60a5fa;
  margin-top: 2px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-card > p {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.auth-footer-note {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* ==========================================================================
   2. FORM INPUTS & BUTTONS
   ========================================================================== */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.field input,
.field select,
.search-input,
.month-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field input:focus,
.field select:focus,
.search-input:focus,
.month-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.mono-input {
  font-family: var(--font-mono) !important;
  letter-spacing: 0.03em;
}

#ptUidInput[readonly] {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
  cursor: not-allowed;
}

.uid-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: #34d399;
  margin-top: 7px;
  font-weight: 500;
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.error-msg {
  color: #fca5a5;
  font-size: 0.82rem;
  margin-top: 12px;
  min-height: 18px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.16s ease;
  text-decoration: none;
}

.btn-full { width: 100%; }

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #4f8ff7, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(148, 163, 184, 0.45);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.55);
  color: #ffffff;
}

/* ==========================================================================
   3. DASHBOARD SHELL (FIXED SIDEBAR + FIXED TOPBAR)
   ========================================================================== */
#ptDashView:not(.hidden) {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--bg-canvas);
}

.sidebar {
  width: 260px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar .brand h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.sidebar .brand span {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #60a5fa;
  margin-top: 2px;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 18px 10px 8px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.nav-btn {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-btn.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.05));
  border-color: rgba(59, 130, 246, 0.35);
  color: #ffffff;
  font-weight: 600;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #3b82f6;
  box-shadow: 0 0 10px #3b82f6;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.status-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Main Area & Topbar */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(800px circle at 90% 0%, rgba(59, 130, 246, 0.06), transparent 55%),
    var(--bg-canvas);
}

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(9, 14, 28, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 99px;
}

.workspace {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 28px 40px;
  max-width: 1320px;
  width: 100%;
}

/* ==========================================================================
   4. KPI CARDS, PANELS & TABLES
   ========================================================================== */
.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search-input { max-width: 380px; }
.month-select { width: auto; min-width: 200px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-surface-2), var(--bg-surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kpi-val {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-bottom: 8px;
}

.kpi-sub {
  font-size: 0.77rem;
  color: var(--text-muted);
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.panel-card h3 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.order-detail-box {
  background: rgba(5, 8, 17, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.order-detail-box p {
  margin: 0 0 8px;
  font-size: 0.86rem;
  color: var(--text-soft);
}

.order-detail-box p:last-child { margin-bottom: 0; }
.order-detail-box strong { color: var(--text-main); }

.pt-readonly-note {
  font-size: 0.83rem;
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.09);
  border: 1px solid rgba(59, 130, 246, 0.26);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

thead {
  background: rgba(255, 255, 255, 0.03);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 5px;
  color: #93c5fd;
}

/* Badges */
.badge-ok, .badge-info, .badge-warn, .badge-slug, .badge-amber {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-ok { background: rgba(16, 185, 129, 0.14); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.32); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-warn { background: rgba(239, 68, 68, 0.14); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.32); }
.badge-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-slug {
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Dialog Modal */
.admin-modal {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75);
}

.admin-modal::backdrop {
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ==========================================================================
   5. MOBILE RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  html, body, #ptDashView:not(.hidden), .sidebar, .main-area {
    height: auto;
    overflow: visible;
  }
  #ptDashView:not(.hidden) { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .topbar { padding: 14px 18px; flex-wrap: wrap; }
  .workspace { padding: 18px; }
  .auth-card { padding: 26px 22px; }
}
