/* FORCE NEW HASH - v2026.03.29.04.32 */
/* ============================================================================
   GLOBAL STYLES & RESET
   ============================================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: #f5f5f5;
  color: #333;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  transition: all 0.2s ease;
}

input, select, textarea {
  font-family: inherit;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2196F3;
  box-shadow: 0 0 3px rgba(33, 150, 243, 0.3);
}

/* ============================================================================
   LAYOUT STRUCTURE
   ============================================================================ */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: white;
}

.app-header {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-height: 50px;
}

.app-header h1 {
  font-size: 18px;
  font-weight: 600;
}

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

.btn-notification, .btn-profile {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
}

.btn-notification:hover, .btn-profile:hover {
  background: rgba(255, 255, 255, 0.3);
}

.main-tabs {
  display: flex;
  background: #fafafa;
  border-bottom: 1px solid #e0e0e0;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.main-tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #666;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.main-tab.active {
  border-bottom-color: #2196F3;
  color: #2196F3;
  background: white;
}

.main-tab:hover {
  background: #f0f0f0;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.app-footer {
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
  padding: 8px 16px;
  text-align: center;
  font-size: 12px;
  color: #999;
}

/* ============================================================================
   TAB CONTENT & SUB-TABS
   ============================================================================ */
.tab-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.subtab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0;
  flex-wrap: wrap;
}

.subtab-btn {
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #666;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.subtab-btn.active {
  border-bottom-color: #FF6B6B;
  color: #FF6B6B;
}

.subtab-btn:hover {
  background: #f5f5f5;
}

.export-btn {
  margin-left: auto;
  background: #4CAF50;
  color: white;
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 12px;
}

.export-btn:hover {
  background: #45a049;
}

.subtab-content {
  flex: 1;
  overflow-y: auto;
}

/* ============================================================================
   COLUMN VISIBILITY TOGGLE
   ============================================================================ */
.column-toggle {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  padding: 8px;
  background: #f9f9f9;
  border-radius: 4px;
  flex-wrap: wrap;
  font-size: 12px;
}

.column-toggle label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.column-toggle input[type="checkbox"] {
  cursor: pointer;
  width: 14px;
  height: 14px;
}

/* ============================================================================
   TABLES - COMPACT & DENSE
   ============================================================================ */
.table-section {
  flex: 1;
  overflow: auto;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: white;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.4;
}

.compact-table thead {
  background: #f5f5f5;
  border-bottom: 2px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.compact-table th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: #333;
  user-select: none;
  cursor: pointer;
  border-right: 1px solid #f0f0f0;
}

.compact-table th:hover {
  background: #efefef;
}

.compact-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
  border-right: 1px solid #f0f0f0;
}

.compact-table tbody tr:hover {
  background: #fafafa;
}

.compact-table .bold {
  font-weight: 600;
}

.compact-table thead th:last-child,
.compact-table tbody td:last-child {
  border-right: none;
}

/* ============================================================================
   BADGES & STATUS INDICATORS
   ============================================================================ */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.completed {
  background: #E8F5E9;
  color: #2E7D32;
}

.badge.active {
  background: #E3F2FD;
  color: #1565C0;
}

.badge.pending {
  background: #FFF3E0;
  color: #E65100;
}

.badge.overdue {
  background: #FFEBEE;
  color: #C62828;
}

.badge.paid {
  background: #E8F5E9;
  color: #2E7D32;
}

.badge.green {
  background: #E8F5E9;
  color: #2E7D32;
}

.badge.red {
  background: #FFEBEE;
  color: #C62828;
}

.badge.yellow {
  background: #FFF3E0;
  color: #E65100;
}

.badge.blue {
  background: #E3F2FD;
  color: #1565C0;
}

.badge.available {
  background: #E8F5E9;
  color: #2E7D32;
}

/* ============================================================================
   MULTI-PANEL SUPPORT (Detail Panels)
   ============================================================================ */
.tab-content.with-detail-panel {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 12px;
}

.tab-content.with-detail-panel .subtab-nav,
.tab-content.with-detail-panel .column-toggle,
.tab-content.with-detail-panel .table-section,
.tab-content.with-detail-panel .pagination {
  grid-column: 1;
}

.detail-panel {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  grid-row: 2 / 5;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #e0e0e0;
  background: #f9f9f9;
}

.detail-header h3 {
  font-size: 14px;
  margin: 0;
}

.close-btn {
  background: transparent;
  color: #999;
  font-size: 16px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #333;
}

.detail-content {
  padding: 8px;
  flex: 1;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}

.detail-row .label {
  font-weight: 600;
  color: #666;
}

.detail-row .bold {
  font-weight: 600;
}

/* ============================================================================
   PAGINATION & "SHOW MORE"
   ============================================================================ */
.pagination {
  padding: 12px;
  text-align: center;
  grid-column: 1;
}

.pagination button {
  background: #2196F3;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
}

.pagination button:hover {
  background: #1976D2;
}

/* ============================================================================
   DASHBOARD GRID & KPI CARDS
   ============================================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kpi-title {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #2196F3;
  margin-bottom: 6px;
}

.kpi-subtitle {
  font-size: 11px;
  color: #999;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 12px;
}

.chart-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
  font-size: 13px;
  margin-bottom: 12px;
  color: #333;
}

/* ============================================================================
   SPARKLINES & CHARTS
   ============================================================================ */
svg {
  display: block;
}

/* ============================================================================
   ACTIVITY LIST
   ============================================================================ */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
  border-left: 3px solid #2196F3;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-desc {
  font-size: 12px;
  color: #333;
  font-weight: 500;
}

.activity-time {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

/* ============================================================================
   QUICK ACTIONS
   ============================================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.action-btn {
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.action-btn.primary {
  background: #2196F3;
  color: white;
}

.action-btn.primary:hover {
  background: #1976D2;
}

.action-btn.secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #e0e0e0;
}

.action-btn.secondary:hover {
  background: #efefef;
}

/* ============================================================================
   DATE RANGE PICKER
   ============================================================================ */
.date-range-picker {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.date-range-picker label {
  font-size: 12px;
  font-weight: 600;
}

.date-range-picker input {
  font-size: 12px;
}

/* ============================================================================
   PERFORMANCE GRID & ANALYTICS
   ============================================================================ */
.performance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.perf-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 12px;
  text-align: center;
}

.perf-card h4 {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}

.metric-display {
  text-align: center;
}

.metric-large {
  font-size: 28px;
  font-weight: 700;
  color: #2196F3;
}

.metric-small {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.progress-bar {
  height: 4px;
  background: #4CAF50;
  border-radius: 2px;
  display: block;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.analytics-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 12px;
}

.analytics-card h4 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.aging-table, .ltv-table {
  width: 100%;
  font-size: 12px;
}

.aging-table tbody tr, .ltv-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
}

.aging-table td, .ltv-table td {
  padding: 4px;
}

.aging-table .value, .ltv-table .value {
  text-align: right;
  font-weight: 600;
  color: #2196F3;
}

/* ============================================================================
   TEAM METRICS & GRID
   ============================================================================ */
.team-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.team-metric-card {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 12px;
}

.team-metric-card h4 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}

.metric-row span:first-child {
  color: #666;
}

.metric-row .bold {
  font-weight: 600;
  color: #333;
}

/* ============================================================================
   SETTINGS FORM
   ============================================================================ */
.settings-form {
  max-width: 600px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}

.form-group input,
.form-group select {
  width: 100%;
  font-size: 12px;
}

.btn-save {
  background: #4CAF50;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.btn-save:hover {
  background: #45a049;
}

.btn-primary {
  background: #2196F3;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.btn-primary:hover {
  background: #1976D2;
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #e0e0e0;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.btn-secondary:hover {
  background: #efefef;
}

.link-btn {
  background: transparent;
  color: #2196F3;
  text-decoration: underline;
  font-size: 12px;
  padding: 0;
}

.link-btn:hover {
  color: #1976D2;
}

/* ============================================================================
   INTEGRATION ITEMS
   ============================================================================ */
.integration-item {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
}

.integration-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.integration-item button {
  background: #2196F3;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-size: 14px;
  color: #666;
}

/* ============================================================================
   SCROLLBAR STYLING (WebKit)
   ============================================================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
  .app-header, .main-tabs, .app-footer, .subtab-nav, .export-btn, .detail-panel {
    display: none !important;
  }

  .main-content {
    padding: 0;
  }

  .compact-table {
    page-break-inside: avoid;
  }

  .chart-card {
    page-break-inside: avoid;
  }
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */
@media (max-width: 1200px) {
  .tab-content.with-detail-panel {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    grid-row: auto;
    max-height: 400px;
    margin-top: 12px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 8px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .main-tabs {
    overflow-x: auto;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .performance-grid {
    grid-template-columns: 1fr;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .team-metrics-grid {
    grid-template-columns: 1fr;
  }

  .compact-table {
    font-size: 11px;
  }

  .compact-table th, .compact-table td {
    padding: 4px;
  }
}

/* ============================================================================
   ANIMATIONS & TRANSITIONS
   ============================================================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detail-panel {
  animation: fadeIn 0.2s ease;
}

.chart-card {
  animation: fadeIn 0.3s ease;
}

.activity-item {
  animation: fadeIn 0.3s ease;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.flex-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-bold {
  font-weight: 600;
}

.text-muted {
  color: #999;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.p-8 {
  padding: 8px;
}

.p-12 {
  padding: 12px;
}

.p-16 {
  padding: 16px;
}

.rounded {
  border-radius: 4px;
}

.border {
  border: 1px solid #e0e0e0;
}

.shadow-sm {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shadow-md {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   KEYBOARD SHORTCUTS & ACCESSIBILITY
   ============================================================================ */
button:focus {
  outline: 2px solid #2196F3;
  outline-offset: 2px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid #2196F3;
  outline-offset: 2px;
}

table th {
  text-align: left;
}

/* ============================================================================
   DARK MODE SUPPORT (Optional)
   ============================================================================ */
@media (prefers-color-scheme: dark) {
  html, body {
    background: #1e1e1e;
    color: #e0e0e0;
  }

  .app-container {
    background: #2a2a2a;
  }

  .main-tabs {
    background: #333;
    border-bottom-color: #444;
  }

  .main-content {
    background: #2a2a2a;
  }

  .compact-table {
    background: #2a2a2a;
  }

  .compact-table thead {
    background: #333;
    border-bottom-color: #444;
  }

  .compact-table th {
    color: #e0e0e0;
    border-right-color: #444;
  }

  .compact-table td {
    border-bottom-color: #333;
    border-right-color: #333;
  }

  .kpi-card, .chart-card, .detail-panel {
    background: #333;
    border-color: #444;
    color: #e0e0e0;
  }

  input, select, textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }

  .subtab-btn {
    color: #999;
  }

  .subtab-btn.active {
    color: #FF6B6B;
  }
}
