/*
 * GridQ Dashboard Portal — Styling System
 * 
 * Path: dashboard-portal/style.css
 * Description: Standalone CSS system incorporating responsive layouts, custom components, 
 * glassmorphism, animations, and portal layouts.
 */

:root {
  /* Backgrounds */
  --bg-primary: #08090c;
  --bg-card: rgba(16, 18, 27, 0.65);
  --bg-card-solid: #10121b;
  --bg-hover: rgba(30, 41, 59, 0.5);
  --bg-dark: #0a0e1a;
  --bg-input: #0d1017;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.12);
  --border-active: rgba(99, 102, 241, 0.4);

  /* Text */
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Accent */
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.15);

  /* Semantic colors */
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.1);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.1);
  --orange: #f97316;
  --orange-bg: rgba(249, 115, 22, 0.1);
  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.1);

  /* Layout */
  --sidebar-width: 220px;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ── Reset & Base ── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ── Dual Scrollbar Styling ── */
/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-primary);
}

/* ── Application Layout ── */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f1629, #0a0e1a);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  flex-shrink: 0;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 39, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.view-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem 2rem;
}

/* ── Navigation Components ── */
.logo {
  padding: 0 1.25rem 0.75rem;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-icon {
  -webkit-text-fill-color: #6366f1;
}

.nav-section {
  padding: 0.75rem 1.25rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  border-right: 2px solid transparent;
}

.nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-btn.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-right-color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portal-back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.15s;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.portal-back-link:hover {
  color: var(--accent);
}

/* ── Badges & Status Indicators ── */
.tenant-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--border-active);
}

.tier-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-block;
}

.tier-production {
  background: var(--green-bg);
  color: var(--green);
}

.tier-canary {
  background: var(--amber-bg);
  color: var(--amber);
}

.tier-staging {
  background: var(--blue-bg);
  color: var(--blue);
}

.env-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.env-badge.live {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.env-badge.paper {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.role-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.role-badge.admin {
  background: var(--purple-bg);
  color: var(--purple);
}

.role-badge.viewer {
  background: var(--blue-bg);
  color: var(--blue);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.status-dot.offline {
  background: var(--text-dim);
}

.status-dot.pending {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

.conn-status {
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.conn-status.online {
  color: var(--green);
}

.conn-status.offline {
  color: var(--text-dim);
}

.conn-status.loading {
  color: var(--amber);
}

.data-age {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  padding: 0.2rem 0.5rem;
  background: var(--bg-hover);
  border-radius: 4px;
}

.clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ── Buttons ── */
.btn {
  padding: 0.5rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #4f46e5;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-card-solid);
  border-color: var(--text-dim);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Cards & Grid Layouts ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.accent-green::before { background: var(--green); }
.accent-blue::before { background: var(--blue); }
.accent-purple::before { background: var(--purple); }
.accent-amber::before { background: var(--amber); }

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 26, 0.4);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-hover);
}

.pnl-pos { color: var(--green); font-weight: 600; }
.pnl-neg { color: var(--red); font-weight: 600; }

.side-buy { color: var(--green); font-weight: 600; }
.side-sell { color: var(--red); font-weight: 600; }

.grid-status-filled { color: var(--green); font-weight: 500; }
.grid-status-open { color: var(--amber); font-weight: 500; }
.grid-status-skipped { color: var(--text-dim); }

.row-filled { background: rgba(16, 185, 129, 0.03); }
.row-open { background: rgba(245, 158, 11, 0.03); }

/* ── Log Streams ── */
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.log-header h3 {
  margin-bottom: 0;
}

.log-filters {
  display: flex;
  gap: 0.35rem;
}

.filter-btn {
  padding: 0.3rem 0.6rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent);
}

.log-stream {
  height: calc(100vh - 220px);
  height: calc(100dvh - 220px);
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
}

.log-stream.mini {
  max-height: 320px;
}

.log-entry {
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  word-break: break-all;
  overflow-wrap: break-word;
  white-space: normal;
}

.log-entry:hover {
  background: var(--bg-hover);
}

.log-entry .ts {
  color: var(--text-dim);
}

.log-entry .lvl {
  font-weight: 600;
}

.log-entry .lvl-INFO { color: var(--blue); }
.log-entry .lvl-WARN { color: var(--amber); }
.log-entry .lvl-ERROR, .log-entry .lvl-FATAL { color: var(--red); }
.log-entry .lvl-DEBUG { color: var(--text-dim); }
.log-entry.dim { color: var(--text-dim); font-style: italic; }

/* ── Access Control Tab ── */
.access-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.access-form-card {
  margin-top: 1.5rem;
}

.access-form {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.access-form label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  min-width: 240px;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

select.input {
  min-width: 140px;
  cursor: pointer;
}

.input.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ── Trades View Date Filters ── */
.trades-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.trades-header h3 {
  margin-bottom: 0;
}

.date-filters {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.custom-date-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  animation: fadeIn 0.2s ease-out;
}

.custom-date-row label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.custom-date-row .input {
  min-width: 150px;
}

.stat-card.mini {
  padding: 0.75rem 1rem;
}

.stat-card.mini .stat-value {
  font-size: 1.15rem;
}

/* ── Pagination Load More ── */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ── Badge count ── */
.badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-hover);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
}

/* ── Portal Landing Hub Layout ── */
.portal-container {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 2rem;
  overflow-y: auto;
}

.portal-header {
  text-align: center;
  margin-bottom: 3rem;
}

.portal-logo {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.portal-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  width: 100%;
  animation: fadeIn 0.3s ease-out;
}

.portal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.12);
}

.portal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.portal-card-title h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.portal-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.portal-card-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.portal-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  margin: 0.25rem 0;
}

.portal-metric-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.portal-metric-value {
  font-size: 0.95rem;
  font-weight: 600;
}

.portal-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ── Access Denied Page ── */
.access-denied-container {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.access-denied-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  max-width: 440px;
  width: 100%;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.3s ease-out;
}

.access-denied-icon {
  font-size: 4rem;
  margin-bottom: 1.25rem;
  line-height: 1;
}

.access-denied-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.access-denied-email {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  margin: 0.5rem 0 1.75rem;
  word-break: break-all;
}

.access-denied-message {
  color: var(--text);
  font-size: 1.05rem;
  margin-bottom: 0.75rem;
}

.access-denied-hint {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ── Custom Modal Overlay ── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  max-width: 460px;
  width: 90%;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}

.modal-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.modal-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ── Loading Overlay ── */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8, 9, 12, 0.9);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.25rem;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Animations ── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-container > * {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Mobile Responsive (H-12) ── */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    align-items: center;
  }

  .logo {
    padding: 0 0.75rem 0 0.5rem;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
  }

  .nav-section {
    display: none;
  }

  .nav-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    white-space: nowrap;
    width: auto;
    border-right: none;
    border-bottom: 2px solid transparent;
  }

  .nav-btn.active {
    border-bottom-color: var(--accent);
    background: transparent;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .topbar-left {
    justify-content: space-between;
    width: 100%;
  }

  .topbar-actions {
    justify-content: flex-end;
    width: 100%;
    gap: 0.5rem;
  }

  .topbar h1 {
    font-size: 1.05rem;
  }

  .view-container {
    padding: 1rem;
  }

  .grid-4 {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .grid-3 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .access-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .access-form .input {
    width: 100%;
    min-width: 0;
  }

  .modal-card {
    padding: 1.5rem;
    width: 95%;
  }
  
  .portal-grid {
    grid-template-columns: 1fr;
  }
  
  .portal-container {
    padding: 2rem 1rem;
  }
  
  .portal-logo {
    font-size: 1.75rem;
  }
}

/* ── Skeleton Loading (L-2) ── */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 75%);
  background-size: 200% 100%;
  animation: loading-skeleton 1.5s infinite linear;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
}

.skeleton * {
  visibility: hidden;
}

@keyframes loading-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Calendar Styles */
.calendar-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: calc(100vh - 160px);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
}

.calendar-month-year {
  text-align: center;
}

.calendar-month-year h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.calendar-month-pnl {
  font-size: 1.1rem;
  font-weight: 700;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr) 130px;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.calendar-day-header {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.week-total-header {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent);
}

.calendar-cell {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 85px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.calendar-cell:hover:not(.other-month):not(.week-total-cell) {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  transform: translateY(-2px);
}

.calendar-cell.other-month {
  opacity: 0.25;
  cursor: default;
}

.calendar-cell.today {
  border-color: var(--accent);
  background: linear-gradient(185deg, var(--bg-dark), var(--accent-glow));
}

.cell-day-num {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.calendar-cell.today .cell-day-num {
  color: var(--accent);
}

.cell-pnl {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
  margin-top: auto;
}

.cell-counts {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.week-total-cell {
  background: var(--accent-glow);
  border: 1px dashed var(--accent);
  color: var(--text);
  cursor: default;
}

.week-total-val {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
  margin-top: auto;
}

.calendar-details-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  animation: fadeIn 0.3s ease-in-out;
}

.calendar-details-panel h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

