/* ═══════════════════════════════════════════════════════════════════════════
   FunSquare Cloud — Web App Styles
   Color system:
     Deep bg     : #0F1220
     Card bg     : #1A1D2E
     Surface     : #2C3050
     Accent      : #4FC3F7  (sky blue)
     Muted       : #7B80A0
     Page bg     : #F0F2F8
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --dark:    #1A1D2E;
  --darker:  #0F1220;
  --surface: #2C3050;
  --accent:  #4FC3F7;
  --muted:   #7B80A0;
  --page:    #F0F2F8;
  --white:   #FFFFFF;
  --divider: #EBEBF0;
}

body { font-family: system-ui, -apple-system, sans-serif; }

/* ── Auth pages ─────────────────────────────────────────────────────────── */

.auth-body {
  min-height: 100vh;
  background: var(--darker);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Decorative glow circles */
.glow-tr {
  position: absolute; top: -80px; right: -80px;
  width: 300px; height: 300px;
  background: var(--accent); border-radius: 50%;
  opacity: 0.08; pointer-events: none;
}
.glow-bl {
  position: absolute; bottom: -60px; left: -60px;
  width: 200px; height: 200px;
  background: var(--accent); border-radius: 50%;
  opacity: 0.06; pointer-events: none;
}

.auth-center {
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column;
  align-items: center; gap: 20px;
  position: relative; z-index: 1;
}

/* Brand block */
.brand-block {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
}
.brand-circle {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: var(--accent);
}
.brand-name  { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: 0.03em; }
.brand-sub   { font-size: 13px; color: var(--muted); }
.brand-line  { width: 36px; height: 2px; background: var(--accent); margin-top: 4px; }

/* Auth card */
.auth-card {
  width: 100%;
  background: var(--dark);
  border-radius: 20px;
  border: 1px solid var(--surface);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.card-header {
  background: var(--dark);
  border-bottom: 1px solid var(--surface);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 14px; font-weight: 600;
}
.card-accent-bar {
  width: 3px; height: 18px;
  background: var(--accent);
  border-radius: 0;
}

.card-body { padding: 24px 24px 28px; }

/* Form elements */
.field-label {
  display: block;
  font-size: 10px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.12em; margin-bottom: 6px;
}
.input-wrap {
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 6px;
  display: flex; align-items: center;
}
.input-wrap-pw { position: relative; }
.field-input {
  background: transparent; border: none; outline: none;
  width: 100%; padding: 13px 16px;
  font-size: 14px; color: #fff;
}
.field-input::placeholder { color: var(--muted); }
select.field-input {
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 8px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}
.pw-toggle {
  background: transparent; border: none;
  padding: 0 12px; color: var(--muted);
  cursor: pointer; display: flex; align-items: center;
}
.pw-toggle:hover { color: var(--accent); }

.checkbox-wrap {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px;
}
.checkbox-input {
  position: relative;
  width: 18px; height: 18px;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
}
.checkbox-input input[type="checkbox"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.checkbox-input input[type="checkbox"]:checked + .checkbox-checkmark {
  opacity: 1;
}
.checkbox-checkmark {
  position: absolute;
  top: 2px; left: 6px;
  width: 4px; height: 8px;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.checkbox-input:hover {
  border-color: #81d4fa;
  background: rgba(79, 195, 247, 0.1);
}
.checkbox-label {
  font-size: 14px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.checkbox-label:hover { color: #fff; }

.helper-text {
  font-size: 11px; color: #3D4165;
  line-height: 1.5; margin-bottom: 24px;
}

.alert-error {
  background: rgba(229,57,53,0.15);
  border: 1px solid rgba(229,57,53,0.4);
  border-radius: 8px;
  padding: 10px 14px;
  color: #ef9a9a; font-size: 13px;
  margin-bottom: 16px;
}

.btn-primary {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 50px; border: none; border-radius: 10px;
  background: var(--accent); color: var(--dark);
  font-size: 15px; font-weight: 700; letter-spacing: 0.06em;
  cursor: pointer; transition: background 0.15s; text-decoration: none;
}
.btn-primary:hover   { background: #81d4fa; }
.btn-primary:active  { background: #0288d1; }

.footer-text {
  font-size: 12px; color: #3D4165; text-align: center;
}

/* Center chip (top-right on login page) */
.center-chip {
  position: fixed; top: 16px; right: 16px;
  background: var(--dark);
  border: 1px solid var(--surface);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 8px;
  z-index: 10;
}
.center-chip-label { font-size: 9px; font-weight: 700; color: var(--accent); letter-spacing: 0.12em; }
.center-chip-name  { font-size: 13px; color: #fff; font-weight: 500; }
.center-chip-change { font-size: 11px; color: var(--accent); text-decoration: none; }
.center-chip-change:hover { text-decoration: underline; }

/* ── Dashboard layout ───────────────────────────────────────────────────── */

.dash-body {
  background: var(--page);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 260px; min-height: 100vh;
  background: var(--dark);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease, width 0.25s;
  transform: translateX(0);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar.collapsed { width: 0; overflow: hidden; }
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  background: #15182A;
  padding: 32px 20px 16px;
  display: flex; align-items: center; gap: 12px;
}
.sidebar-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
.sidebar-name   { font-size: 14px; font-weight: 700; color: #fff; }
.sidebar-domain { font-size: 11px; color: var(--muted); margin-top: 2px; }

.sidebar-divider { height: 1px; background: var(--surface); margin: 0 16px; }

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  color: var(--muted); font-size: 14px; text-decoration: none;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(79,195,247,0.06); color: #fff; }
.nav-item.active {
  background: rgba(79,195,247,0.12);
  border-left-color: var(--accent);
  color: var(--accent); font-weight: 600;
  padding-left: 15px;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-logout { color: #ef9a9a; }
.nav-logout:hover { color: #e53935; background: rgba(229,57,53,0.08); }

.sidebar-footer { padding: 12px 0; }
.sidebar-version {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  font-size: 11px; color: var(--muted);
}
.version-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

/* Main content */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; transition: margin-left 0.25s;
}
.main-content.sidebar-collapsed { margin-left: 0; }

/* Topbar */
.topbar {
  background: var(--dark);
  height: 56px;
  display: flex; align-items: center;
  padding: 0 16px; gap: 12px;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sidebar-toggle {
  background: transparent; border: none;
  color: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  transition: background 0.15s;
}
.sidebar-toggle:hover { background: rgba(79,195,247,0.1); }

.topbar-title {
  flex: 1; display: flex; flex-direction: column;
}
.topbar-title span { font-size: 16px; font-weight: 700; color: #fff; }
.topbar-accent { width: 32px; height: 2px; background: var(--accent); margin-top: 3px; }

.topbar-logout {
  color: var(--accent); display: flex; align-items: center;
  padding: 8px; border-radius: 50%;
  background: rgba(79,195,247,0.1);
  transition: background 0.15s;
}
.topbar-logout:hover { background: rgba(79,195,247,0.2); }

/* Page scroll */
.page-scroll {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ── Date section ───────────────────────────────────────────────────────── */
.date-section {
  background: var(--dark);
  border-radius: 16px;
  padding: 18px 16px 14px;
}
.date-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; color: var(--accent);
  letter-spacing: 0.14em; margin-bottom: 12px;
}
.date-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.date-row { display: flex; align-items: center; gap: 8px; }
.date-field {
  flex: 1; background: #0F1220;
  border: 1px solid var(--surface);
  border-radius: 10px; padding: 10px 12px;
}
.date-field-lbl { font-size: 9px; font-weight: 700; color: var(--accent); letter-spacing: 0.12em; margin-bottom: 3px; }
.date-input {
  background: transparent; border: none; outline: none;
  width: 100%; font-size: 13px; font-weight: 700; color: #fff;
  cursor: pointer;
}
.date-input::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
.date-arrow { flex-shrink: 0; }
.btn-search {
  width: 48px; height: 48px; border: none; border-radius: 10px;
  background: var(--accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s;
}
.btn-search:hover  { background: #81d4fa; }
.btn-search:active { background: #0288d1; }

.pill-row { display: flex; gap: 8px; margin-top: 12px; }
.pill {
  background: #0F1220; border: 1px solid var(--surface);
  border-radius: 20px; padding: 5px 14px;
  font-size: 11px; color: var(--muted);
  cursor: pointer; transition: all 0.15s;
}
.pill.active {
  background: #1F3A4A; border-color: var(--accent); color: var(--accent);
}
.pill:hover { border-color: var(--accent); color: var(--accent); }

/* ── Stat chips ─────────────────────────────────────────────────────────── */
.stat-row { display: flex; gap: 12px; }
.stat-card {
  flex: 1; background: #fff;
  border-radius: 12px;
  padding: 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-bar { width: 3px; height: 28px; border-radius: 0; }
.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 9px; font-weight: 700; color: var(--muted); letter-spacing: 0.1em; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--dark); }

/* ── Chart card ─────────────────────────────────────────────────────────── */
.chart-card {
  background: var(--dark);
  border-radius: 16px; overflow: hidden;
}
.chart-wrap { padding: 12px 16px 16px; height: 200px;width: 100% }

/* ── Report cards ───────────────────────────────────────────────────────── */
.report-card {
  background: #fff;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.section-hdr {
  background: var(--dark);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 13px; font-weight: 700;
}
.section-bar { width: 3px; height: 18px; border-radius: 0; }

.table-col-hdr {
  background: #F5F6FA;
  padding: 10px 16px;
  display: flex; align-items: center;
  border-bottom: 1px solid #EBEBF0;
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.05em;
}
.table-col-hdr span { display: block; }

.table-row {
  display: flex; align-items: center;
  padding: 10px 16px;
  font-size: 13px; color: var(--dark);
  border-bottom: 1px solid #F0F0F5;
}
.table-row.alt        { background: #FAFAFA; }
.table-row.total-row  {
  background: #E1F5FE;
  font-weight: 700; color: #0277BD;
  border-top: 1px solid #B3E5FC;
}
.table-row span { display: block; }
.table-empty {
  padding: 24px 16px;
  text-align: center; color: var(--muted); font-size: 13px;
}

/* ── Loading overlay ────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.loading-card {
  background: var(--dark);
  border-radius: 16px;
  padding: 32px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  border: 1px solid var(--surface);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--surface);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 200; height: 100vh;
    width: 260px;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.collapsed {
    width: 260px;
    transform: translateX(-100%);
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 150;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
  .stat-row { flex-direction: column; }
  .date-row { flex-wrap: wrap; }
}
