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

:root {
  --bg:        #F7F6F2;
  --card:      #FFFFFF;
  --border:    #E7E0D8;
  --shadow:    0 1px 4px rgba(78,74,70,.07), 0 1px 2px rgba(78,74,70,.04);
  --shadow-md: 0 6px 18px rgba(78,74,70,.10);

  --tx1: #4E4A46;
  --tx2: #8A847C;
  --tx3: #B5AFA8;

  /* intern palette — くすみカラー */
  --c1: #AFC6CF;
  --c2: #B7AED3;
  --c3: #D8B08C;
  --c4: #AFC3A2;

  /* chart palette */
  --chart-started:   #A9BCD0;
  --chart-completed: #A8C9B8;
  --chart-hold:      #CFC7BE;
  --chart-web:       #9FB9C9;
  --chart-paper:     #D8B49A;

  --r: 10px;
  --gap: 18px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
               "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--tx1);
  font-size: 13px;
  line-height: 1.6;
}

/* ===== Header ===== */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx1);
  white-space: nowrap;
}
.badge-demo {
  padding: 2px 8px;
  background: #F0F5EE;
  color: #6A8F6A;
  border: 1px solid #C8DEC4;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.header-nav-link {
  font-size: 12px;
  color: #6b7280;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fafafa;
  transition: background .15s, color .15s;
  white-space: nowrap;
  text-decoration: none;
}
.header-nav-link:hover { background: var(--bg); color: var(--tx1); }

.header-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-label {
  font-size: 12px;
  color: var(--tx3);
  white-space: nowrap;
}
.sel {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--tx1);
  cursor: pointer;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.sel:focus {
  border-color: #AFC6CF;
  box-shadow: 0 0 0 3px rgba(175,198,207,.25);
}

/* ===== Main Layout ===== */
.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 60px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ===== KPI Cards ===== */
.kpi-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  border-top: 3px solid var(--border);
  transition: box-shadow .2s, transform .15s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--tx3);
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 38px;
  font-weight: 800;
  color: var(--tx1);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 12px;
  color: var(--tx3);
  margin-top: 5px;
}

/* ===== Section ===== */
.section-hd {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tx2);
}
.section-sub {
  font-size: 12px;
  color: var(--tx3);
}

/* ===== Card ===== */
.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--tx1);
  margin-bottom: 14px;
}
.card-sub {
  font-size: 11px;
  color: var(--tx3);
  margin-left: 6px;
}

/* ===== Grid helpers ===== */
.g4  { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--gap); }
.g2  { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.g3  { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--gap); }
.g21 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap); }

/* ===== Intern Cards ===== */
.intern-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  border-top: 3px solid var(--accent, #6366f1);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow .2s, transform .15s;
}
.intern-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.ic-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.ic-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx1);
}
.ic-badge {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.ic-badge--ok    { background: #F0F5EE; color: #5D8A6A; border: 1px solid #C8DEC4; }
.ic-badge--warn  { background: #FAF2E8; color: #9A6B3A; border: 1px solid #E8D0B4; }
.ic-badge--alert { background: #F9EEEE; color: #9A4A4A; border: 1px solid #E0C4C4; }

.ic-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.ic-stat-block { display: flex; flex-direction: column; gap: 2px; }
.ic-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tx3);
}
.ic-stat-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--tx2);
}
.ic-stat-row strong { font-size: 20px; font-weight: 700; color: var(--tx1); line-height: 1.1; }
.ic-num-label { font-size: 10px; color: var(--tx3); align-self: flex-end; margin-bottom: 1px; }

.ic-breakdown {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ic-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}
.ic-tag--active { background: #EBF3F7; color: #4A7A96; }
.ic-tag--hold   { background: #F7F0E8; color: #8A6A48; }
.ic-tag--none   { background: var(--bg); color: var(--tx3); }

.ic-spark { position: relative; height: 44px; margin-top: 2px; }
.ic-spark-label {
  font-size: 10px;
  color: var(--tx3);
  margin-bottom: 4px;
  font-weight: 500;
}

/* ===== Chart wrap ===== */
.cw { position: relative; }
.h160 { height: 160px; }
.h200 { height: 200px; }
.h220 { height: 220px; }
.h240 { height: 240px; }
.h260 { height: 260px; }
.h300 { height: 300px; }

/* ===== Ranking list ===== */
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rank-num {
  width: 18px;
  font-size: 11px;
  font-weight: 700;
  color: var(--tx3);
  text-align: right;
  flex-shrink: 0;
}
.rank-label { flex: 0 0 110px; font-size: 12px; color: var(--tx2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar-wrap { flex: 1; background: #EDE8E2; border-radius: 3px; height: 8px; overflow: hidden; }
.rank-bar { height: 100%; border-radius: 3px; transition: width .4s; }
.rank-count { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--tx1); width: 28px; text-align: right; }

.rank-web   { background: var(--chart-web); }
.rank-paper { background: var(--chart-paper); }

/* ===== Category badge on ranking ===== */
.cat-tag {
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.cat-web   { background: #E8F2F7; color: #4A7A96; }
.cat-paper { background: #F7EDE4; color: #8A6040; }

/* ===== Divider ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 4px 0 12px; }
