/* Craftzing Tooling Dashboard - Unified Style (matches root index) */

:root {
  color-scheme: light;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #f0f2f6;
  --bg-card: #ffffff;
  --text-dark: #172B4D;
  --text-mid: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.09);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

.container {
  max-width: 1472px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  margin-bottom: 24px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.subtitle {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
  margin-top: 2px;
}

/* Navigation/Breadcrumb */
.breadcrumb {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a,
.breadcrumb span {
  padding: 6px 12px;
  border-radius: 6px;
  background: white;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-mid);
  font-weight: 500;
  font-size: 12px;
  transition: all .15s;
  cursor: pointer;
}

.breadcrumb a:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #f9fafb;
}

.breadcrumb .active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Main content area */
main {
  background: white;
  padding: 24px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* Section headings */
main h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  transition: box-shadow .15s, transform .1s;
}

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

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-detail {
  font-size: 11px;
  color: var(--text-mid);
  margin-top: 4px;
}

/* Sections */
.section {
  margin-bottom: 28px;
}

.section:last-child {
  margin-bottom: 0;
}

/* Tables */
.cost-table,
.renewals-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-mid);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fafcff;
}

/* Status Grid (Integration cards) */
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.status-card {
  padding: 18px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  text-align: center;
  transition: box-shadow .15s, transform .1s;
  background: white;
}

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

.status-card.deployed {
  border-left: 3px solid #10b981;
}

.status-card.opportunity {
  border-left: 3px solid #f59e0b;
}

.status-card.native {
  border-left: 3px solid #3b82f6;
}

.status-card.webhook {
  border-left: 3px solid #8b5cf6;
}

.status-card .count {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.status-card .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
}

.status-card .description {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Navigation Cards */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.nav-card {
  display: block;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-dark);
  transition: all .15s;
  background: white;
}

.nav-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.nav-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.nav-card p {
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.nav-card .arrow {
  color: var(--primary);
  font-weight: 600;
  transition: transform .15s;
}

.nav-card:hover .arrow {
  transform: translateX(2px);
}

/* Insights section */
.insights {
  background: #fef3c7;
  padding: 16px;
  border-radius: 10px;
  border-left: 3px solid #f59e0b;
  margin-bottom: 0;
}

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

.insight {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.insight .icon {
  font-size: 16px;
  flex-shrink: 0;
}

.insight strong {
  color: var(--text-dark);
  font-weight: 600;
}

/* Footer */
.dashboard-footer {
  text-align: center;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
  font-size: 11px;
  margin-top: 24px;
}

.dashboard-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.dashboard-footer a:hover {
  text-decoration: underline;
}

/* Chart.js overrides */
canvas {
  max-height: 220px;
}

/* Badge styles */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}

.badge.RENEW_SOON {
  background: #fee2e2;
  color: #dc2626;
}

.badge.upcoming {
  background: #fef3c7;
  color: #d97706;
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .status-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 12px;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  main {
    padding: 16px;
  }

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

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

  .nav-cards {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 11px;
  }

  th, td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 16px;
  }

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

  .status-grid,
  .nav-cards {
    grid-template-columns: 1fr;
  }

  .breadcrumb {
    flex-direction: column;
  }

  .breadcrumb a,
  .breadcrumb span {
    width: 100%;
    text-align: center;
  }
}
