/* ASF Dashboard — stylesheet extracted from mockup */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-primary: #185FA5;
  --color-accent:  #EF9F27;
  --color-green:   #1D9E75;
  --color-red:     #D85A30;
  --color-soft-blue: #378ADD;
  --color-text-primary:   #1a1a1a;
  --color-text-secondary: #6b7280;
  --color-background-primary:   #ffffff;
  --color-background-secondary: #f4f5f7;
  --color-border-tertiary: #e5e7eb;
  --border-radius-md: 8px;
  --border-radius-lg: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body { font-family: var(--font-sans); background: #f9fafb; color: var(--color-text-primary); }

.db { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 1.5rem 2rem; }

/* Header */
.hdr { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0 0.75rem; border-bottom: 0.5px solid var(--color-border-tertiary); margin-bottom: 1rem; flex-wrap: wrap; gap: 8px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 36px; height: 36px; background: var(--color-primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.logo-mark svg { width: 20px; height: 20px; fill: white; }
.logo-name { font-size: 16px; font-weight: 500; letter-spacing: -.2px; }
.logo-tag { font-size: 10px; color: var(--color-text-secondary); margin-top: 2px; letter-spacing: .4px; text-transform: uppercase; }

/* Period controls */
.period-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pbtn { font-size: 12px; padding: 5px 12px; border: 0.5px solid var(--color-border-tertiary); border-radius: 6px; background: transparent; color: var(--color-text-secondary); cursor: pointer; transition: all .15s; }
.pbtn.active { background: var(--color-primary); border-color: var(--color-primary); color: white; }
.pbtn:hover:not(.active) { background: var(--color-background-secondary); }
.date-range { display: flex; align-items: center; gap: 4px; }
.date-range input { font-size: 11px; padding: 4px 8px; border: 0.5px solid var(--color-border-tertiary); border-radius: 6px; background: var(--color-background-secondary); color: var(--color-text-primary); width: 105px; }
.plbl { font-size: 11px; color: var(--color-text-secondary); margin-left: 2px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 0.5px solid var(--color-border-tertiary); margin-bottom: 1.25rem; overflow-x: auto; }
.tab { font-size: 13px; padding: 8px 18px; border: none; background: transparent; color: var(--color-text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -0.5px; transition: all .15s; white-space: nowrap; flex-shrink: 0; }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 500; }
.tab:hover:not(.active) { color: var(--color-text-primary); }

/* Grids */
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 1.25rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 1.25rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 10px; }

/* KPI cards */
.kcard { background: var(--color-background-secondary); border-radius: var(--border-radius-md); padding: 14px 16px; position: relative; }
.kcard .lbl { font-size: 11px; color: var(--color-text-secondary); margin-bottom: 6px; letter-spacing: .3px; }
.kcard .val { font-size: 22px; font-weight: 500; line-height: 1; }
.kcard .chg { font-size: 11px; margin-top: 5px; }
.chg.up { color: #0F6E56; } .chg.dn { color: #993C1D; } .chg.nt { color: var(--color-text-secondary); }

/* Skeleton loader */
.skeleton { background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-line { height: 14px; margin-bottom: 6px; }
.sk-val  { height: 28px; width: 60%; }

/* Cards */
.card { background: var(--color-background-primary); border: 0.5px solid var(--color-border-tertiary); border-radius: var(--border-radius-lg); padding: 1rem 1.25rem; margin-bottom: 10px; }
.card-title { font-size: 12px; font-weight: 500; color: var(--color-text-secondary); margin-bottom: 12px; letter-spacing: .4px; text-transform: uppercase; }
.chart-wrap { position: relative; width: 100%; }

/* Badges */
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.badge-green  { background: #E1F5EE; color: #0F6E56; }
.badge-amber  { background: #FAEEDA; color: #854F0B; }
.badge-red    { background: #FCEBEB; color: #A32D2D; }
.badge-blue   { background: #E6F1FB; color: #185FA5; }
.badge-gray   { background: var(--color-background-secondary); color: var(--color-text-secondary); }

/* Table */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; color: var(--color-text-secondary); font-weight: 500; padding: 6px 8px; border-bottom: 0.5px solid var(--color-border-tertiary); font-size: 11px; letter-spacing: .3px; }
.tbl td { padding: 7px 8px; border-bottom: 0.5px solid var(--color-border-tertiary); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--color-background-secondary); }

/* Progress bars */
.prog-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.prog-label { font-size: 12px; width: 110px; flex-shrink: 0; }
.prog-bar-wrap { flex: 1; background: var(--color-background-secondary); border-radius: 4px; height: 7px; overflow: hidden; }
.prog-bar { height: 7px; border-radius: 4px; transition: width .4s ease; }
.prog-val { font-size: 12px; color: var(--color-text-secondary); width: 36px; text-align: right; flex-shrink: 0; }

/* Inline KPI list */
.inline-kpi { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 0.5px solid var(--color-border-tertiary); }
.inline-kpi:last-child { border-bottom: none; }
.inline-kpi .ik-l { font-size: 12px; color: var(--color-text-secondary); }
.inline-kpi .ik-v { font-size: 13px; font-weight: 500; }

/* AR aging grid */
.ar-aging { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 1rem; }
.ar-box { background: var(--color-background-secondary); border-radius: 8px; padding: 10px; text-align: center; }
.ar-box .av { font-size: 18px; font-weight: 500; }
.ar-box .al { font-size: 10px; color: var(--color-text-secondary); margin-top: 3px; }

/* Doc status grid */
.doc-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.doc-box { background: var(--color-background-secondary); border-radius: 8px; padding: 12px; text-align: center; }
.doc-box .dv { font-size: 22px; font-weight: 500; }
.doc-box .dl { font-size: 10px; color: var(--color-text-secondary); margin-top: 4px; }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; font-size: 12px; color: var(--color-text-secondary); }
.legend span { display: flex; align-items: center; gap: 5px; }
.ld { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.divider { border: none; border-top: 0.5px solid var(--color-border-tertiary); margin: 10px 0; }
.tag { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 3px; background: var(--color-background-secondary); color: var(--color-text-secondary); }

/* Content panels */
.content-panel { display: none; }
.content-panel.active { display: block; }

/* Toast */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { font-size: 13px; padding: 10px 16px; border-radius: 8px; background: #1a1a1a; color: white; box-shadow: 0 4px 12px rgba(0,0,0,.15); animation: slideIn .2s ease; }
.toast.error { background: #A32D2D; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Last updated badge */
.refresh-info { font-size: 10px; color: var(--color-text-secondary); text-align: right; margin-bottom: 4px; }

/* Responsive */
@media (max-width: 768px) {
  .grid4 { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .ar-aging { grid-template-columns: repeat(2, 1fr); }
  .doc-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid4, .grid3 { grid-template-columns: 1fr; }
  .ar-aging { grid-template-columns: repeat(2, 1fr); }
}
