/* ==========================================================================
   BLIKVITT / SKULDFRIKASSA - SCANDINAVIAN DARK FINTECH DESIGN SYSTEM
   Modern, rymlig dashboard med tydlig grid-layout, annonsreserveringar & typografi
   ========================================================================== */

:root {
  /* Färgpalett - Dark Slate / Emerald / Cyan */
  --bg-app: #090d16;
  --bg-card: rgba(15, 23, 42, 0.85);
  --bg-card-hover: rgba(22, 32, 56, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-strong: rgba(255, 255, 255, 0.06);

  /* Border Tokens */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.28);

  /* Accent Färger */
  --emerald-300: #6ee7b7;
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;

  --cyan-300: #67e8f9;
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;

  --indigo-300: #a5b4fc;
  --indigo-400: #818cf8;
  --indigo-500: #6366f1;

  --amber-300: #fde68a;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;

  --rose-400: #fb7185;
  --rose-500: #f43f5e;

  /* Typografi & Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Radie */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Skuggor */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow-emerald: 0 0 25px rgba(16, 185, 129, 0.2);

  /* Övergångar */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & BAS
   ========================================================================== */

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

html {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: 
    radial-gradient(circle at 15% 10%, rgba(16, 185, 129, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(6, 182, 212, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
    var(--bg-app);
  background-attachment: fixed;
}

.container {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}
.font-bold {
  font-weight: 700;
}
.emerald-text {
  color: var(--emerald-400);
}
.amber-text {
  color: var(--amber-400);
}
.cyan-text {
  color: var(--cyan-400);
}
.subdued {
  color: var(--text-secondary);
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */

.app-header {
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--emerald-500) 0%, var(--cyan-500) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #041210;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.preset-selector-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-md);
}

.preset-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.preset-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}
.preset-select option {
  background: #0f172a;
  color: var(--text-primary);
}

/* ==========================================================================
   GOOGLE ADS PLACEHOLDER SLOTS
   ========================================================================== */

.ad-slot-wrapper {
  margin: 1rem auto 0.5rem auto;
}

.ad-banner {
  background: rgba(15, 23, 42, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ad-banner.top-leaderboard {
  min-height: 90px;
  width: 100%;
}

.ad-banner.bottom-leaderboard {
  min-height: 90px;
  width: 100%;
}

.sidebar-ad-slot {
  height: 100%;
  min-height: 380px;
  width: 100%;
}

.ad-label {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.ad-placeholder-content {
  font-size: 0.75rem;
  color: #475569;
  text-align: center;
  padding: 1rem;
  font-weight: 500;
}

.ad-placeholder-content.vertical {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* ==========================================================================
   JURIDISK DISCLAIMER NOTICE BAR
   ========================================================================== */

.legal-notice-bar {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  margin: 0.75rem 0 1.25rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.legal-notice-bar svg {
  color: var(--amber-400);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* ==========================================================================
   DASHBOARD LAYOUT (2/3 + 1/3 DESKTOP GRID)
   ========================================================================== */

.app-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .app-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-left-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-right-column {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   CARDS & PANELS
   ========================================================================== */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald-400);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-icon-badge.cyan {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan-400);
}
.card-icon-badge.indigo {
  background: rgba(99, 102, 241, 0.12);
  color: var(--indigo-400);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   KNAPPAR (BUTTONS)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  user-select: none;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}
.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald-500) 0%, var(--emerald-600) 100%);
  color: #041210;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--emerald-400) 0%, var(--emerald-500) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: var(--bg-glass-strong);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-medium);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan-500) 0%, #0891b2 100%);
  color: #041210;
}
.btn-cyan:hover {
  background: linear-gradient(135deg, var(--cyan-400) 0%, var(--cyan-500) 100%);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding: 0.3rem 0.45rem;
}
.btn-danger-ghost:hover {
  color: var(--rose-400);
  background: rgba(244, 63, 94, 0.12);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  margin-top: 3.5rem;
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 0;
  background: rgba(10, 14, 23, 0.7);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.footer-badge {
  font-weight: 700;
  color: var(--emerald-400);
  font-size: 0.9rem;
}

.footer-disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 860px;
  line-height: 1.5;
}

.footer-copyright {
  font-size: 0.7rem;
  color: #475569;
}

.print-report-container {
  display: none;
}

/* ==========================================================================
   DEDIKERAD UTSKRIFTS- & PDF-RAPPORT (@media print)
   Döljer allt webbgränssnitt och skriver endast ut den rena beräkningsrapporten
   ========================================================================== */

@media print {
  /* Dölj hela webbapplikationen */
  body > *:not(#print-report-container) {
    display: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Visa endast den dedikerade rapporten */
  #print-report-container {
    display: block !important;
    width: 100% !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .print-doc {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10mm 12mm !important;
    box-sizing: border-box !important;
  }

  /* Rapporthuvud */
  .print-doc-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    border-bottom: 2px solid #0f172a !important;
    padding-bottom: 12px !important;
    margin-bottom: 18px !important;
  }

  .print-doc-title {
    font-size: 20pt !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 0 2px 0 !important;
    line-height: 1.1 !important;
  }

  .print-doc-subtitle {
    font-size: 9.5pt !important;
    color: #475569 !important;
    font-weight: 600 !important;
  }

  .print-doc-meta {
    text-align: right !important;
    font-size: 8.5pt !important;
    color: #334155 !important;
    line-height: 1.35 !important;
  }

  /* Sektioner */
  .print-section {
    margin-bottom: 18px !important;
    page-break-inside: auto !important;
  }

  .print-section-title {
    font-size: 12pt !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    border-bottom: 1px solid #cbd5e1 !important;
    padding-bottom: 4px !important;
    margin: 0 0 8px 0 !important;
  }

  /* Tabeller */
  .print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
    margin-bottom: 8px !important;
  }

  .print-table th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    padding: 5px 6px !important;
    border: 1px solid #cbd5e1 !important;
    text-align: left !important;
  }

  .print-table td {
    padding: 4px 6px !important;
    border: 1px solid #e2e8f0 !important;
    color: #1e293b !important;
  }

  .print-table tbody tr:nth-child(even) {
    background: #f8fafc !important;
  }

  .print-total-row td {
    background: #f1f5f9 !important;
    border-top: 2px solid #94a3b8 !important;
    font-weight: 700 !important;
    color: #0f172a !important;
  }

  .print-budget-summary-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    padding: 6px 10px !important;
    font-size: 8.5pt !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-top: 6px !important;
    color: #0f172a !important;
  }

  /* Nyckeltalsrutor */
  .print-metrics-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .print-metric-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 3px solid #059669 !important;
    padding: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
  }

  .print-metric-card .p-label {
    font-size: 7pt !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
  }

  .print-metric-card .p-val {
    font-size: 13pt !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    font-family: monospace !important;
    line-height: 1.1 !important;
  }

  .print-metric-card .p-sub {
    font-size: 7pt !important;
    color: #475569 !important;
  }

  /* Etappvis Handlingsplan */
  .print-timeline-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .print-timeline-item {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-left: 3px solid #0284c7 !important;
    padding: 8px 10px !important;
    page-break-inside: avoid !important;
  }

  .print-stage-header {
    font-size: 9.5pt !important;
    color: #0f172a !important;
    margin-bottom: 3px !important;
  }

  .print-stage-desc {
    font-size: 8pt !important;
    color: #334155 !important;
    margin-bottom: 5px !important;
  }

  .print-stage-allocations {
    margin: 0 !important;
    padding-left: 18px !important;
    font-size: 8.5pt !important;
    color: #0f172a !important;
  }

  .print-stage-allocations li {
    margin-bottom: 2px !important;
  }

  .print-milestone-box {
    margin-top: 5px !important;
    background: #ecfdf5 !important;
    border: 1px solid #a7f3d0 !important;
    padding: 3px 8px !important;
    font-size: 8pt !important;
    color: #047857 !important;
    font-weight: 600 !important;
  }

  /* Månadstabell */
  .print-schedule-table {
    font-size: 7.5pt !important;
    page-break-inside: auto !important;
  }

  .print-schedule-table tr {
    page-break-inside: avoid !important;
  }

  .print-milestone-row {
    background: #ecfdf5 !important;
    font-weight: 600 !important;
  }

  /* Rapportfooter */
  .print-doc-footer {
    margin-top: 20px !important;
    border-top: 1px solid #cbd5e1 !important;
    padding-top: 8px !important;
    font-size: 7pt !important;
    color: #64748b !important;
    line-height: 1.4 !important;
    page-break-inside: avoid !important;
  }
}


