/* CSS Design System - Shopify Polaris Inspired */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --p-color-bg: #f6f6f7;
  --p-color-surface: #ffffff;
  --p-color-border: #e1e3e5;
  --p-color-border-hover: #b5b7b9;
  
  --p-color-primary: #008060;
  --p-color-primary-hover: #006e52;
  --p-color-primary-light: #e6f4ea;
  
  --p-color-text: #202223;
  --p-color-text-subdued: #6d7175;
  --p-color-text-on-primary: #ffffff;
  
  --p-color-success: #007b5c;
  --p-color-success-bg: #e6f4ea;
  --p-color-success-text: #006e52;
  
  --p-color-critical: #d82c0d;
  --p-color-critical-bg: #fbeae5;
  --p-color-critical-text: #8a1c09;
  
  --p-color-warning: #b98900;
  --p-color-warning-bg: #fff5ea;
  --p-color-warning-text: #8a6500;

  --p-color-info: #005ea2;
  --p-color-info-bg: #e8f4fd;
  
  --p-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --p-font-family-display: 'Outfit', sans-serif;
  
  --sidebar-width: 240px;
  --border-radius-sm: 4px;
  --border-radius: 8px;
  --border-radius-lg: 12px;
  
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --p-color-bg: #0f111a;
  --p-color-surface: #171923;
  --p-color-border: #2d3142;
  --p-color-border-hover: #454b66;
  
  --p-color-primary: #10b981;
  --p-color-primary-hover: #059669;
  --p-color-primary-light: #132d24;
  
  --p-color-text: #e2e8f0;
  --p-color-text-subdued: #94a3b8;
  --p-color-text-on-primary: #0f172a;
  
  --p-color-success: #10b981;
  --p-color-success-bg: #064e3b;
  --p-color-success-text: #34d399;
  
  --p-color-critical: #ef4444;
  --p-color-critical-bg: #7f1d1d;
  --p-color-critical-text: #fca5a5;
  
  --p-color-warning: #f59e0b;
  --p-color-warning-bg: #78350f;
  --p-color-warning-text: #fcd34d;

  --p-color-info: #3b82f6;
  --p-color-info-bg: #1e3a8a;
  
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: var(--p-font-family);
  background-color: var(--p-color-bg);
  color: var(--p-color-text);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--p-color-surface);
  border-right: 1px solid var(--p-color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--p-color-border);
}

.sidebar-logo svg {
  color: var(--p-color-primary);
  width: 32px;
  height: 32px;
}

.sidebar-logo h1 {
  font-family: var(--p-font-family-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--p-color-text);
  letter-spacing: -0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--p-color-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

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

.nav-item.active {
  background-color: var(--p-color-primary-light);
  color: var(--p-color-primary);
  font-weight: 600;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--p-color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--p-color-text-subdued);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.theme-toggle:hover {
  background-color: var(--p-color-bg);
  color: var(--p-color-text);
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-width: 0; /* Prevents flexbox items from bursting out */
}

/* Header styling */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header-title-area h2 {
  font-family: var(--p-font-family-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--p-color-text);
  letter-spacing: -0.5px;
}

.header-title-area p {
  color: var(--p-color-text-subdued);
  font-size: 14px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--border-radius);
  border: 1px solid var(--p-color-border);
  background-color: var(--p-color-surface);
  color: var(--p-color-text);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.btn:hover {
  border-color: var(--p-color-border-hover);
  background-color: var(--p-color-bg);
}

.btn-primary {
  background-color: var(--p-color-primary);
  border-color: var(--p-color-primary);
  color: var(--p-color-text-on-primary);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: var(--p-color-primary-hover);
  border-color: var(--p-color-primary-hover);
}

.btn-danger {
  color: var(--p-color-critical-text);
  border-color: var(--p-color-critical);
  background-color: var(--p-color-critical-bg);
}

.btn-danger:hover {
  background-color: var(--p-color-critical);
  color: white;
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* KPI Cards Section */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.kpi-card {
  background-color: var(--p-color-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--p-color-border);
}

.kpi-card.success::before {
  background-color: var(--p-color-success);
}

.kpi-card.warning::before {
  background-color: var(--p-color-warning);
}

.kpi-card.critical::before {
  background-color: var(--p-color-critical);
}

.kpi-card.info::before {
  background-color: var(--p-color-info);
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--p-color-text-subdued);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-family: var(--p-font-family-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--p-color-text);
  margin-bottom: 4px;
}

.kpi-subtitle {
  font-size: 12px;
  color: var(--p-color-text-subdued);
}

/* Card layout wrapper */
.card {
  background-color: var(--p-color-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--p-color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-family: var(--p-font-family-display);
  font-size: 18px;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

/* View Layout Switching */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* Directory view styles */
.search-filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-wrapper svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--p-color-text-subdued);
  width: 18px;
  height: 18px;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border-radius: var(--border-radius);
  border: 1px solid var(--p-color-border);
  background-color: var(--p-color-surface);
  color: var(--p-color-text);
  font-size: 14px;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--p-color-primary);
  box-shadow: 0 0 0 2px var(--p-color-primary-light);
}

.filter-select {
  padding: 10px 16px;
  border-radius: var(--border-radius);
  border: 1px solid var(--p-color-border);
  background-color: var(--p-color-surface);
  color: var(--p-color-text);
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--p-color-primary);
}

/* Table Design */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.table th {
  padding: 16px 20px;
  border-bottom: 2px solid var(--p-color-border);
  color: var(--p-color-text-subdued);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--p-color-border);
  color: var(--p-color-text);
  vertical-align: middle;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background-color: var(--p-color-bg);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  line-height: 1;
}

.badge-success {
  background-color: var(--p-color-success-bg);
  color: var(--p-color-success-text);
}

.badge-critical {
  background-color: var(--p-color-critical-bg);
  color: var(--p-color-critical-text);
}

.badge-warning {
  background-color: var(--p-color-warning-bg);
  color: var(--p-color-warning-text);
}

.badge-info {
  background-color: var(--p-color-info-bg);
  color: var(--p-color-info);
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--p-color-text);
  display: flex;
  justify-content: space-between;
}

.form-input {
  padding: 10px 12px;
  border-radius: var(--border-radius);
  border: 1px solid var(--p-color-border);
  background-color: var(--p-color-surface);
  color: var(--p-color-text);
  font-size: 14px;
  transition: var(--transition);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--p-color-primary);
  box-shadow: 0 0 0 2px var(--p-color-primary-light);
}

/* Remove default number input spinner buttons */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

.form-input[type="range"] {
  padding: 0;
  height: 6px;
  -webkit-appearance: none;
  background: var(--p-color-border);
  outline: none;
  border: none;
  border-radius: 3px;
  margin: 12px 0;
}

.form-input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--p-color-primary);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--p-color-primary);
  cursor: pointer;
}

/* Calculator grid splits */
.calculator-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .calculator-container {
    grid-template-columns: 1fr;
  }
}

/* Real-time Result card */
.result-card {
  background-color: var(--p-color-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--border-radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 24px;
}

.result-profit-header {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--p-color-border);
  margin-bottom: 24px;
}

.result-profit-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--p-color-text-subdued);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.result-profit-value {
  font-family: var(--p-font-family-display);
  font-size: 40px;
  font-weight: 700;
  color: var(--p-color-text);
  line-height: 1.1;
  transition: color 0.2s ease;
}

.result-profit-value.positive {
  color: var(--p-color-success);
}

.result-profit-value.negative {
  color: var(--p-color-critical);
}

.result-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.result-meta-item {
  border-radius: var(--border-radius);
  background-color: var(--p-color-bg);
  padding: 12px;
  text-align: center;
}

.result-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--p-color-text-subdued);
  font-weight: 600;
  margin-bottom: 4px;
}

.result-meta-value {
  font-family: var(--p-font-family-display);
  font-size: 18px;
  font-weight: 700;
}

/* Stacked horizontal bar representing cost/revenue layout */
.visual-bar-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.visual-progress-bar {
  display: flex;
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--p-color-border);
  margin-bottom: 24px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.progress-segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  font-weight: 700;
  transition: width 0.3s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segment-ad {
  background-color: #f97316; /* Orange */
}

.segment-product {
  background-color: #3b82f6; /* Blue */
}

.segment-rto {
  background-color: #64748b; /* Slate Gray */
}

.segment-profit {
  background-color: #10b981; /* Green */
}

/* Legend list */
.legend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.legend-dot-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-val {
  font-weight: 600;
}

/* Comparison desk style */
.compare-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.compare-card {
  background-color: var(--p-color-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.compare-card-title {
  font-family: var(--p-font-family-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.compare-card-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--p-color-text-subdued);
  margin-bottom: 24px;
}

.compare-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--p-color-border);
  padding-bottom: 8px;
}

.compare-row:last-child {
  border-bottom: none;
}

.compare-label {
  font-size: 13px;
  color: var(--p-color-text-subdued);
}

.compare-value {
  font-weight: 600;
  font-size: 14px;
}

.compare-value.best {
  color: var(--p-color-success);
  font-weight: 700;
}

.compare-card-remove {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--p-color-text-subdued);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
}

.compare-card-remove:hover {
  background-color: var(--p-color-bg);
  color: var(--p-color-critical-text);
}

/* Settings tab imports */
.settings-section {
  border-bottom: 1px solid var(--p-color-border);
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h4 {
  font-family: var(--p-font-family-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.settings-section p {
  font-size: 13px;
  color: var(--p-color-text-subdued);
  margin-bottom: 16px;
  max-width: 600px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal {
  background-color: var(--p-color-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--border-radius-lg);
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--p-color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--p-font-family-display);
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--p-color-text-subdued);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.modal-close:hover {
  color: var(--p-color-text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--p-color-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--p-color-bg);
}

/* Custom Grid Utility */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Helper styles for comparing list checkbox action */
.compare-checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* File Input Wrapper */
.file-upload-wrapper {
  position: relative;
  display: inline-block;
}

.file-upload-input {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 180px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 50%;
  margin-left: -90px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* Dashboard Top and Trend panels */
.dashboard-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

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

.top-products-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top-product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--p-color-border);
  border-radius: var(--border-radius);
  transition: var(--transition);
}

.top-product-item:hover {
  background-color: var(--p-color-bg);
}

.top-product-info h4 {
  font-size: 14px;
  font-weight: 600;
}

.top-product-info span {
  font-size: 12px;
  color: var(--p-color-text-subdued);
}

.top-product-val {
  text-align: right;
}

.top-product-profit {
  font-family: var(--p-font-family-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--p-color-success);
}

.top-product-mult {
  font-size: 12px;
  color: var(--p-color-text-subdued);
}

/* Toast Notification styling */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background-color: #333;
  color: white;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlide 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlide {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Daily Journal - Calendar Grid CSS */
.calendar-day {
  background-color: var(--p-color-surface);
  border: 1px solid var(--p-color-border);
  border-radius: var(--border-radius);
  padding: 10px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.calendar-day:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--p-color-border-hover);
}

.calendar-day.empty {
  background: transparent;
  border: none;
  cursor: default;
  pointer-events: none;
}

.calendar-day.empty:hover {
  transform: none;
  box-shadow: none;
}

.calendar-day.today {
  border: 2px solid var(--p-color-primary);
  background-color: var(--p-color-primary-light);
}

.calendar-day-num {
  font-weight: 700;
  font-size: 13px;
  color: var(--p-color-text);
  align-self: flex-end;
}

.calendar-day-today-label {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 9px;
  font-weight: 700;
  color: var(--p-color-primary);
  text-transform: uppercase;
}

.calendar-day-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.calendar-mini-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.2;
  white-space: nowrap;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-mini-badge.ads {
  background-color: var(--p-color-warning-bg);
  color: var(--p-color-warning-text);
}

.calendar-mini-badge.profit {
  background-color: var(--p-color-success-bg);
  color: var(--p-color-success-text);
}

.calendar-mini-badge.loss {
  background-color: var(--p-color-critical-bg);
  color: var(--p-color-critical-text);
}

.calendar-day-products-summary {
  font-size: 9px;
  color: var(--p-color-text-subdued);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* subtab active buttons inside Daily Journal */
#tab-journal button.active {
  background-color: var(--p-color-surface) !important;
  box-shadow: var(--shadow) !important;
  color: var(--p-color-text) !important;
}

/* Formal P&L Statement styling */
.pl-statement-table {
  width: 100%;
  border-collapse: collapse;
}

.pl-statement-table tr.pl-header-row {
  border-bottom: 2px solid var(--p-color-text);
}

.pl-statement-table tr.pl-header-row td {
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  color: var(--p-color-text);
  padding: 12px 16px;
}

.pl-statement-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--p-color-border);
}

.pl-statement-table tr.indent-1 td:first-child {
  padding-left: 32px;
}

.pl-statement-table tr.indent-2 td:first-child {
  padding-left: 48px;
}

.pl-statement-table tr.total-row {
  font-weight: 700;
  background-color: var(--p-color-bg);
  border-top: 1px solid var(--p-color-text);
  border-bottom: 2px double var(--p-color-text);
}

.pl-statement-table tr.total-row td {
  color: var(--p-color-text);
}

.pl-statement-table tr.section-title td {
  font-weight: 700;
  background-color: var(--p-color-bg);
  color: var(--p-color-text);
  padding: 8px 16px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.pl-value-col {
  text-align: right;
  font-family: var(--p-font-family-display);
  font-weight: 600;
}

/* Link Visibility & Hover styling */
.table a {
  color: var(--p-color-text) !important;
  text-decoration: none;
  transition: var(--transition);
}

.table a:hover {
  color: var(--p-color-primary) !important;
  text-decoration: underline;
}

/* Responsive Split-Equal Dashboard Layout */
.dashboard-row.split-equal {
  grid-template-columns: 1.2fr 1fr;
}

@media (max-width: 900px) {
  .dashboard-row.split-equal {
    grid-template-columns: 1fr;
  }
}

/* Sidebar & Header Mobile Responsiveness overrides */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--p-color-border);
  }
  .sidebar-logo {
    padding: 16px 20px;
  }
  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 16px;
    gap: 8px;
  }
  .sidebar-nav .nav-item {
    white-space: nowrap;
    padding: 8px 12px;
    margin: 0;
  }
  .sidebar-footer {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin-icon {
  animation: spin 1s linear infinite;
  display: inline-block;
}


