:root {
  --primary: #102a43;
  --accent: #2563eb;
  --bg: #eef3f8;
  --card: #fff;
  --text: #263442;
  --muted: #718096;
  --border: #dbe5ef;
  --warn: #d97706;
  --danger: #dc2626;
  --ok: #16a34a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Yu Gothic", "YuGothic", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  background:
    radial-gradient(circle at 24% 8%, rgba(37,99,235,.12), transparent 28%),
    linear-gradient(135deg, #f7fbff 0%, #edf3f8 52%, #f8fafc 100%);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
.topnote {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: #0f1f33;
  color: #fff;
  padding: 8px 14px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.topnote a { color: #93c5fd; }
body { padding-top: 34px; }
.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: linear-gradient(180deg, #0f2438, #153956);
  color: #e8f0f8;
  padding: 16px 12px;
  min-height: calc(100vh - 34px);
}
.sidebar .brand {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 6px 8px 14px;
}
.sidebar .user {
  background: rgba(255,255,255,.09);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 12px;
}
.sidebar .user small { display: block; opacity: .75; margin-top: 3px; }
.sidebar nav a {
  display: block;
  color: inherit;
  text-decoration: none;
  padding: 9px 11px;
  border-radius: 999px;
  font-size: 13px;
  margin: 2px 0;
}
.sidebar nav a.active { background: rgba(37,99,235,.38); }
.main-content { flex: 1; min-width: 0; overflow-y: auto; }
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 22px 28px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.page-header h1 {
  margin: 0 0 2px;
  color: var(--primary);
  font-size: 1.45rem;
  letter-spacing: .02em;
}
.page-header .eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 6px;
}
.page-header p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .88rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 8px 11px;
  font-weight: 800;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-size: .86rem;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.dashboard-board { display: grid; gap: 14px; }
.kpi-hero-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(112px,132px);
  gap: 10px;
  align-items: stretch;
}
.kpi-hero-row.no-org { grid-template-columns: 1fr; }
.card, .kpi-card, .mini-card, .org-stack-card {
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(14px);
  border-radius: 18px;
  box-shadow: 0 14px 34px rgba(15,23,42,.075);
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.82);
}
.strip-hero { padding: 22px 24px; display: grid; gap: 18px; }
.strip-top { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.hero-ring {
  position: relative;
  width: 160px;
  height: 160px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.hero-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: #dbeafe; stroke-width: 15; }
.ring-progress {
  fill: none;
  stroke: url(#operatingGradient);
  stroke-width: 15;
  stroke-linecap: round;
  stroke-dasharray: 439.823;
  stroke-dashoffset: 21.991;
}
.hero-ring-inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--primary);
}
.hero-ring-inner strong { display: block; font-size: 2rem; line-height: 1; }
.hero-ring-inner span { display: block; color: var(--muted); font-size: .78rem; margin-top: 4px; font-weight: 800; }
.strip-head { flex: 1; min-width: 200px; }
.strip-head h2 { margin: 0 0 6px; color: var(--primary); font-size: 1.2rem; }
.strip-head .meta { color: var(--muted); font-weight: 800; font-size: .92rem; }
.strip-head .rate-line { margin-top: 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.strip-head .rate-line .num { font-size: 2.2rem; font-weight: 900; color: var(--ok); line-height: 1; }
.strip-head .rate-line span { color: var(--muted); font-weight: 800; font-size: .88rem; }
.card-action { color: var(--accent); font-size: .74rem; font-weight: 900; text-decoration: none; }
.status-strip { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; }
.strip-item {
  display: grid;
  grid-template-columns: 5px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.strip-item .bar { align-self: stretch; border-radius: 4px; }
.strip-item .label strong { display: block; font-size: .82rem; color: var(--muted); }
.strip-item .label small { font-size: .72rem; color: var(--muted); font-weight: 700; }
.strip-item .value { font-size: 1.65rem; font-weight: 900; line-height: 1; }
.strip-item.is-ok .value { color: var(--ok); }
.strip-item.is-in-use .value { color: #2563eb; }
.strip-item.is-warn .value { color: #D69E2E; }
.strip-item.is-calibration .value { color: #718096; }
.strip-item.is-repair .value { color: #ea580c; }
.strip-item.is-danger { border-color: #fca5a5; background: linear-gradient(180deg, #fff, #fef2f2); }
.strip-item.is-danger .value { color: var(--danger); }
.org-stack { display: grid; grid-template-rows: 1fr 1fr; gap: 8px; }
.org-stack-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 8px;
  text-decoration: none;
  color: inherit;
}
.org-stack-card > strong { display: block; font-size: .72rem; color: var(--muted); font-weight: 800; margin-bottom: 6px; }
.org-stack-card > span { font-size: 1.45rem; font-weight: 900; color: var(--primary); line-height: 1; }
.org-stack-card > small { display: block; margin-top: 4px; font-size: .66rem; color: var(--muted); font-weight: 700; }
.content-grid {
  display: grid;
  grid-template-columns: .95fr 1.35fr .9fr;
  gap: 12px;
  align-items: stretch;
}
.content-grid.staff-2col { grid-template-columns: 1.15fr 1fr; }
.upcoming-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.upcoming-chips .chip {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 6px 4px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.upcoming-chips .chip b {
  display: block;
  font-size: 15px;
  color: var(--primary);
  margin-top: 2px;
}
.upcoming-table-wrap {
  overflow: auto;
  max-height: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.upcoming-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  min-width: 360px;
}
.upcoming-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.upcoming-table th,
.upcoming-table td {
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  white-space: nowrap;
}
.upcoming-table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
  font-size: 10px;
}
.upcoming-table tr:last-child td { border-bottom: 0; }
.upcoming-table .type {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 800;
}
.upcoming-table .type.insp { background: #FFFFF0; color: #D69E2E; }
.upcoming-table .type.cal { background: #F7FAFC; color: #718096; }
.upcoming-table .type.rep { background: #FFFAF0; color: #C05621; }
.upcoming-table .type.use { background: #FAF5FF; color: #6B46C1; }
.cost-mid-list { display: grid; gap: 8px; }
.cost-mid-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  text-decoration: none;
  color: inherit;
}
.cost-mid-item strong { display: block; font-size: .82rem; color: var(--primary); }
.cost-mid-item small { display: block; margin-top: 3px; font-size: .72rem; color: var(--muted); font-weight: 700; }
.cost-mid-item .amt { font-size: 1.05rem; font-weight: 900; color: var(--primary); white-space: nowrap; }
.cost-mid-item .amt.muted-amt { font-size: .95rem; color: var(--muted); }
.model-links { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.model-links a { color: #93c5fd; }
.view-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(255,255,255,.82);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.view-toggle-bar .label-text {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
}
.view-toggle-bar .hint {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  position: relative;
}
.toggle-switch.compact .side {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}
.toggle-switch .side.is-on { color: var(--accent); }
.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 0;
  cursor: pointer;
  padding: 0;
  transition: background .2s ease;
}
.toggle-track.is-schedule { background: #2563eb; }
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15,23,42,.2);
  transition: transform .2s ease;
}
.toggle-track.is-schedule .toggle-thumb { transform: translateX(20px); }
.toggle-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #0f2438;
  color: #e8f0f8;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  box-shadow: 0 10px 24px rgba(15,23,42,.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
  z-index: 20;
}
.toggle-tip::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 28px;
  width: 10px;
  height: 10px;
  background: #0f2438;
  transform: rotate(45deg);
}
.toggle-switch:hover .toggle-tip,
.toggle-switch:focus-within .toggle-tip {
  opacity: 1;
  transform: translateY(0);
}
.panel-hidden { display: none !important; }
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.section-title-row h2 { margin: 0; color: var(--primary); font-size: 1rem; }
.section-title-main small { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.section-title-row a, .notice-feed-more {
  color: var(--accent);
  font-size: .8rem;
  font-weight: 900;
  text-decoration: none;
}
.notice-unread-badge, .attention-notice-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--accent);
  border: 1px solid #bfdbfe;
  font-size: .8rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}
.notice-feed, .attention-list { display: grid; gap: 8px; }
.notice-feed-item, .attention-item {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, #f8fafc);
  text-decoration: none;
  color: inherit;
}
.notice-feed-item strong, .attention-item strong { display: block; font-size: .88rem; color: var(--primary); }
.notice-feed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.notice-feed-cat {
  display: inline-flex;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .7rem;
  font-weight: 800;
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.notice-feed-meta small, .attention-item small {
  display: block;
  font-size: .78rem;
  color: var(--muted);
}
.attention-item small span { font-weight: 800; }
.schedule-grid { display: grid; gap: 9px; }
.schedule-grid .mini-card {
  min-height: 52px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 10px;
  text-decoration: none;
  color: inherit;
}
.schedule-grid .mini-card strong { display: block; color: var(--muted); font-size: .76rem; margin: 0; }
.schedule-grid .mini-card span { font-size: 1.25rem; font-weight: 900; color: var(--primary); }
.management-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 8px;
}
.management-card {
  min-height: 82px;
  padding: 9px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.94));
  text-decoration: none;
  color: inherit;
}
.management-card strong { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 3px; }
.management-card span { display: block; color: var(--primary); font-weight: 900; font-size: 1.03rem; }
.management-card small { display: block; color: var(--muted); font-weight: 700; margin-top: 2px; font-size: .72rem; }
.management-card .card-action { display: block; margin-top: 3px; }

/* 下段：週次スケジュール */
.week-card { padding: 14px 16px; }
.week-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.week-head h2 { margin: 0; color: var(--primary); font-size: 1rem; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.week-range { font-size: 12px; color: var(--muted); font-weight: 700; padding: 0 4px; }
.week-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.week-stats .s {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdff;
  padding: 7px 6px;
}
.day .d { font-weight: 800; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.ev {
  display: block;
  border-radius: 5px;
  padding: 4px 5px;
  color: #fff;
  font-size: 10px;
  line-height: 1.25;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ev.insp { background: #D69E2E; }
.ev.cal { background: #718096; }
.ev.rep { background: #DD6B20; }
.ev.use { background: #6B46C1; }
.ev.err { background: #C53030; }
.labot {
  position: fixed;
  right: 18px;
  bottom: 16px;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(37,99,235,.42);
}
@media (max-width: 1100px) {
  .sidebar { display: none; }
  .kpi-hero-row { grid-template-columns: 1fr; }
  .content-grid, .content-grid.staff-2col { grid-template-columns: 1fr; }
  .status-strip { grid-template-columns: repeat(3, 1fr); }
  .management-summary { grid-template-columns: repeat(2, 1fr); }
  .week { grid-template-columns: repeat(4, 1fr); }
  .org-stack { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
}
@media (max-width: 700px) {
  .week-stats { grid-template-columns: repeat(2, 1fr); }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .management-summary { grid-template-columns: 1fr; }
}
