/*
 * IR-port Pro mock — common base stylesheet
 * Single source of truth for design tokens, sidebar, page chrome, buttons, utilities.
 * Page-specific styles stay inline in each HTML file.
 * Typography baseline per UI_POLICY.md §226,240: Body = 14px / 1.75 / weight 400.
 */

:root {
  /* Primary: Navy */
  --navy-900: #1f3350;
  --navy-800: #243e62;
  --navy-700: #2e4f7c;
  --navy-500: #5b7ab4;
  --navy-400: #7a93c4;
  --navy-300: #a6b6d0;
  /* Lavender */
  --lavender-50: #f3f4f8;
  --lavender-100: #e8ecf5;
  --lavender-200: #d6deec;
  /* Neutral */
  --bg: #ffffff;
  --paper: #ffffff;
  --sidebar-bg: #f8f8fb;
  --ink: #0f172a;
  --body: #334155;
  --muted: #667a8a;
  --line: #e5e8ef;
  --line-strong: #cbd5e1;
  /* Coral */
  --coral-500: #ea7171;
  --coral-100: #fde7e2;
  --coral-700: #c7505a;
  /* Semantic */
  --accent: #1f3350;
  --accent-soft: #e8ecf5;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  /* Shape */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  /* Shadow */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, .04);
  --shadow-sm: 0 2px 4px 0 rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 16px 0 rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px 0 rgba(15, 23, 42, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--body); }
body {
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', Meiryo, 'Hiragino Sans', 'Yu Gothic', sans-serif;
  font-feature-settings: "palt";
  font-size: 14px;
  line-height: 1.75;
  letter-spacing: .01em;
}
.plex { font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans', 'Yu Gothic', sans-serif; font-feature-settings: "lnum"; }
.ink { color: var(--ink); }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.eyebrow {
  font-size: .6875rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans', 'Yu Gothic', sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.fade { animation: fadeInUp 400ms ease-out both; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Unified Sidebar === */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  border-right: 1px solid var(--line);
}
.sidebar-logo {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  min-height: 72px;
}
.sidebar-logo img { height: 32px; width: auto; display: block; }
.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--body);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  position: relative;
  transition: background .15s, color .15s;
  cursor: pointer;
  border-radius: var(--radius-md);
}
.sidebar .nav-item:hover { background: var(--lavender-50); color: var(--ink); }
.sidebar .nav-item.active {
  background: var(--lavender-100);
  color: var(--navy-700);
  font-weight: 500;
}
.sidebar .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--navy-500);
  border-radius: 0 2px 2px 0;
}
.sidebar .nav-item svg {
  width: 18px; height: 18px;
  stroke-width: 1.5;
  flex-shrink: 0;
  color: var(--muted);
}
.sidebar .nav-item.active svg { color: var(--navy-500); }
.sidebar .nav-badge {
  margin-left: auto;
  background: var(--coral-500);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 999px;
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans', 'Yu Gothic', sans-serif;
  letter-spacing: .02em;
}
.sidebar .nav-divider { height: 1px; background: var(--line); margin: 12px 14px; }
.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--coral-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  font-weight: 500;
  flex-shrink: 0;
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans', 'Yu Gothic', sans-serif;
}
.sidebar-user-name { color: var(--ink); font-weight: 500; font-size: 12.5px; line-height: 1.3; }
.sidebar-user-dept { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* === Main / Page chrome === */
.main {
  margin-left: 240px;
  padding: 28px 32px 48px;
  max-width: calc(1400px + 240px);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 20px;
  flex-wrap: wrap;
}
.crumbs {
  font-size: 11px;
  letter-spacing: .15em;
  color: var(--muted);
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans', 'Yu Gothic', sans-serif;
  margin-bottom: 8px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
  line-height: 1.3;
}
.page-sub { color: var(--muted); font-size: 13px; margin-top: 6px; max-width: 640px; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans', 'Yu Gothic', sans-serif;
  font-weight: 500;
  letter-spacing: .04em;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 150ms;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--navy-800); }
.btn-ghost { background: var(--paper); color: var(--accent); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--lavender-50); }

/* === Segment Control (used by 01/01b) === */
.segment-control {
  display: inline-flex;
  background: var(--lavender-50);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 24px;
}
.segment-control a {
  padding: 7px 20px;
  font-family: 'IBM Plex Sans', 'Helvetica Neue', Helvetica, Arial, 'Hiragino Sans', 'Yu Gothic', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 150ms;
  letter-spacing: .02em;
}
.segment-control a:hover { color: var(--navy-700); }
.segment-control a.active { background: var(--paper); color: var(--navy-900); box-shadow: var(--shadow-xs); }

/*
 * === Utility helpers ===
 * Minimal subset that replaces previously-loaded Tailwind CDN utility classes
 * actually used across 02_dashboard.html ～ 07_monthly_report.html.
 * (Inventory verified 2026-04-18: flex, grid, inline-flex, items-center/baseline,
 *  justify-between/center, gap-2/3/5/6, mb-1/2/5/10, mt-1/2/3/4/5, p-7, w-3, h-3,
 *  text-xs, font-bold, leading-relaxed, border)
 */
.flex        { display: flex; }
.inline-flex { display: inline-flex; }
.grid        { display: grid; }
.items-center   { align-items: center; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-10 { margin-bottom: 40px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.p-7  { padding: 28px; }
.w-3  { width: 12px; }
.h-3  { height: 12px; }
.text-xs         { font-size: 12px; line-height: 1.25; }
.font-bold       { font-weight: 700; }
.leading-relaxed { line-height: 1.625; }
.border { border-width: 1px; border-style: solid; border-color: var(--line); }
