/**
 * NAC ERP - Enterprise Resource Planning Styles
 * ISA-95 Level 4 - Business Planning
 * ISA-101 Neutral Color Scheme
 */

:root {
  --bg-dark: #1a1a1a;
  --bg-medium: #242424;
  --bg-light: #2e2e2e;
  --border: #3a3a3a;
  --text-primary: #e5e5e5;
  --text-secondary: #a3a3a3;
  --text-muted: #737373;
  --accent: #525252;
  --status-good: #4ade80;
  --status-warn: #fbbf24;
  --status-bad: #f87171;
  --status-info: #60a5fa;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-medium);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  background: var(--bg-light);
  border: 1px solid var(--border);
}

.back-link:hover {
  background: var(--accent);
  color: var(--text-primary);
}

.header h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.header h1 .subtitle {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
  margin-left: 8px;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 20px;
}

.fiscal-year {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fiscal-year .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fiscal-year select {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

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

.header-right .time {
  font-size: 18px;
  font-weight: 600;
  font-family: 'SF Mono', Monaco, monospace;
  color: var(--text-primary);
}

.header-right .date {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Container */
.main-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* KPI Bar */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-item {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
}

.kpi-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kpi-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-change {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
}

.kpi-change.up {
  background: rgba(74, 222, 128, 0.15);
  color: var(--status-good);
}

.kpi-change.down {
  background: rgba(248, 113, 113, 0.15);
  color: var(--status-bad);
}

/* ERP Grid */
.erp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* ERP Card */
.erp-card {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.erp-card.budget { border-left: 3px solid var(--text-muted); }
.erp-card.workforce { border-left: 3px solid var(--status-info); }
.erp-card.procurement { border-left: 3px solid var(--status-warn); }
.erp-card.strategic { border-left: 3px solid var(--status-good); }

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.card-header h2 {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
}

.card-link:hover {
  color: var(--text-secondary);
}

.card-body {
  padding: 16px;
}

/* Budget Chart */
.budget-bar {
  margin-bottom: 14px;
}

.budget-bar:last-child {
  margin-bottom: 0;
}

.bar-label {
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.bar-track {
  height: 6px;
  background: var(--bg-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.bar-fill {
  height: 100%;
  background: var(--text-muted);
  border-radius: 3px;
  transition: width 0.3s;
}

.bar-fill.warning {
  background: var(--status-warn);
}

.bar-values {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

/* Workforce Stats */
.workforce-stats {
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

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

.stat-label {
  color: var(--text-muted);
}

.stat-value { color: var(--text-secondary); }
.stat-value.good { color: var(--status-good); }
.stat-value.warning { color: var(--status-warn); }

.dept-breakdown h4 {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.dept-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* Procurement */
.procurement-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.proc-stat {
  text-align: center;
  padding: 10px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.proc-stat .value {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.proc-stat .label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.contract-list h4 {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.contract-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: 11px;
  align-items: center;
}

.contract-item.warning {
  border-left: 3px solid var(--status-warn);
}

.contract-item .vendor {
  font-weight: 500;
  color: var(--text-secondary);
}

.contract-item .expires {
  color: var(--text-muted);
}

.contract-item .value {
  color: var(--text-muted);
}

/* Strategic Initiatives */
.initiative {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

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

.init-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.init-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.init-status {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.init-status.on-track {
  background: rgba(74, 222, 128, 0.15);
  color: var(--status-good);
}

.init-status.at-risk {
  background: rgba(251, 191, 36, 0.15);
  color: var(--status-warn);
}

.init-status.complete {
  background: rgba(96, 165, 250, 0.15);
  color: var(--status-info);
}

.init-progress {
  height: 4px;
  background: var(--bg-light);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar {
  height: 100%;
  background: var(--status-good);
  border-radius: 2px;
}

.progress-bar.warning {
  background: var(--status-warn);
}

.progress-bar.complete {
  background: var(--status-info);
}

.init-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* Forecast Section */
.forecast-section {
  background: var(--bg-medium);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.forecast-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.forecast-table {
  overflow-x: auto;
}

.forecast-header,
.forecast-row {
  display: grid;
  grid-template-columns: 160px repeat(5, 1fr);
  gap: 10px;
  padding: 10px 12px;
  font-size: 12px;
}

.forecast-header {
  background: var(--bg-light);
  border-radius: 4px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
}

.forecast-row {
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

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

.forecast-row.highlight {
  background: var(--bg-light);
  border-radius: 4px;
  font-weight: 500;
  margin-top: 8px;
}

.forecast-row .positive { color: var(--status-good); }
.forecast-row .negative { color: var(--status-bad); }
.forecast-row .neutral { color: var(--text-muted); }

/* Responsive */
@media (max-width: 1024px) {
  .erp-grid {
    grid-template-columns: 1fr;
  }
  .kpi-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .kpi-bar {
    grid-template-columns: 1fr;
  }
  .header-center {
    display: none;
  }
  .forecast-header,
  .forecast-row {
    grid-template-columns: 100px repeat(5, 70px);
    font-size: 10px;
  }
}
