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

/* ─── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #f7f7f5;
  --surface:     #ffffff;
  --surface-2:   #f0efed;
  --text:        #0d0d0d;
  --muted:       #64748b;
  --primary:     #1a56db;
  --primary-rgb: 26, 86, 219;
  --japan-red:   #d4162a;
  --border:      rgba(0, 0, 0, 0.09);
  --border-md:   rgba(0, 0, 0, 0.15);
  --shadow:      0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg:   0 2px 6px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.09);
  --radius:      12px;
  --radius-sm:   8px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ─── Navigation ─────────────────────────────────────────────────────────── */
.dash-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-nav__inner {
  width: min(1200px, 94%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.dash-nav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.dash-nav__flag { font-size: 1.2rem; }

.dash-nav__title {
  font-size: 0.975rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(212, 22, 42, 0.08);
  border: 1px solid rgba(212, 22, 42, 0.2);
  color: var(--japan-red);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.dash-back {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-md);
  transition: color 0.15s ease, background 0.15s ease;
}
.dash-back:hover { color: var(--text); background: var(--surface-2); }

/* ─── Page hero ──────────────────────────────────────────────────────────── */
.dash-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
}

.dash-hero__inner {
  width: min(1200px, 94%);
  margin: 0 auto;
}

.dash-hero__label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--japan-red);
  margin-bottom: 0.4rem;
}

.dash-hero__title {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.dash-hero__sub {
  color: var(--muted);
  font-size: 0.925rem;
}

/* ─── Main layout ────────────────────────────────────────────────────────── */
.dash-main {
  width: min(1200px, 94%);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

/* ─── KPI row ────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card { /* base card */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-lg); }

.kpi-card { padding: 1.35rem 1.5rem; }

.kpi-card h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--primary);
}

/* ─── Charts grid ────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.25rem;
}

.chart-card { padding: 1.5rem; }

.chart-card h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

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

/* ─── Insight label ──────────────────────────────────────────────────────── */
.chart-insight {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--surface-2);
  padding: 0.65rem 0.9rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.1rem;
  border-left: 3px solid var(--japan-red);
  line-height: 1.5;
}
.chart-insight strong { color: var(--text); font-weight: 600; }

/* ─── Priority / alert cards ─────────────────────────────────────────────── */
.chart-card--priority {
  background: linear-gradient(135deg, rgba(22,160,133,0.04), rgba(52,152,219,0.04));
  border-left: 3px solid #16a085;
}
.chart-card--alert {
  background: linear-gradient(135deg, rgba(255,193,7,0.04), rgba(255,87,34,0.04));
  border-left: 3px solid #f39c12;
}

/* ─── Navigation back button (legacy classes) ────────────────────────────── */
.top-nav { display: none; } /* replaced by dash-nav */

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.dash-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2rem;
}

.dash-footer__inner {
  width: min(1200px, 94%);
  margin: 0 auto;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 99px; }
