:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #1d6fd8;
  --accent-weak: #e8f1ff;
  --ok: #16835b;
  --ok-weak: #e7f6ef;
  --warn: #a15c00;
  --warn-weak: #fff4dc;
  --danger: #c43d4b;
  --danger-weak: #fff0f2;
  --shadow: 0 12px 28px rgba(17, 31, 55, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #172033;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.actions,
.filters,
.status-strip,
.trust-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

select,
input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.primary,
.secondary,
.ghost {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  white-space: nowrap;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: var(--accent-weak);
  color: #1657a8;
}

.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.file-input {
  width: 260px;
  max-width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 4px;
}

.file-input::file-selector-button {
  min-height: 28px;
  margin-right: 8px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.layout {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px 20px;
  align-items: start;
  padding: 20px;
}

.status-panel h1 {
  margin: 4px 0 6px;
  font-size: 26px;
  line-height: 1.25;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.message {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfd;
  color: var(--muted);
  font-size: 13px;
}

.trust-strip {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trust-strip span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef1f5;
  padding: 3px 8px;
}

.message.error {
  border-color: #ffd0d7;
  background: var(--danger-weak);
  color: var(--danger);
}

.message.ok {
  border-color: #b8e7d0;
  background: var(--ok-weak);
  color: var(--ok);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--accent-weak);
  color: #1657a8;
  font-size: 12px;
  font-weight: 800;
}

.badge.neutral {
  background: #eef1f5;
  color: #516071;
}

.badge.ok {
  background: var(--ok-weak);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-weak);
  color: var(--warn);
}

.badge.danger {
  background: var(--danger-weak);
  color: var(--danger);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.metric {
  padding: 16px;
  min-height: 120px;
}

.metric span,
.metric small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 30px;
  line-height: 1;
}

.chart-panel {
  margin-top: 14px;
  position: relative;
  padding: 0;
  overflow: hidden;
  background: #f7f7f8;
  border-color: #eceef2;
}

.chart-title-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 28px 4px;
}

.chart-title-row h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.35;
  color: #101214;
}

.chart-subtitle {
  margin: 12px 0 0;
  color: #606368;
  font-size: 17px;
  line-height: 1.55;
}

.chart-menu {
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eeeeef;
  color: #686a70;
  font-size: 24px;
  letter-spacing: 2px;
  font-weight: 800;
}

.chart-box {
  min-height: 330px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f7f7f8;
}

.chart-box.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  border-style: dashed;
  font-size: 13px;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-note {
  margin: 0;
  padding: 0 28px 26px;
  color: #8b8d92;
  font-size: 16px;
  line-height: 1.5;
}

.chart-grid {
  stroke: #d8dadd;
  stroke-width: 1.2;
  stroke-dasharray: 5 7;
}

.chart-actual,
.chart-ideal,
.chart-needed {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-actual {
  stroke: #4f95f5;
}

.chart-ideal {
  stroke: #62bd75;
}

.chart-needed {
  stroke: #ee8552;
}

.chart-current-dot {
  fill: #ee8552;
  stroke: #fff;
  stroke-width: 5;
}

.chart-label,
.chart-y-label,
.chart-legend {
  fill: #5f6267;
  font-size: 20px;
  font-weight: 600;
}

.chart-y-label {
  font-size: 18px;
}

.legend-actual {
  fill: #4f95f5;
}

.legend-ideal {
  fill: #62bd75;
}

.legend-needed {
  fill: #ee8552;
}

progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #edf1f5;
}

progress::-webkit-progress-bar {
  background: #edf1f5;
}

progress::-webkit-progress-value {
  background: var(--accent);
}

progress::-moz-progress-bar {
  background: var(--accent);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
  margin-top: 14px;
}

.stack {
  display: grid;
  align-content: start;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.list {
  display: grid;
  gap: 8px;
}

.list.empty,
.requirements.empty {
  min-height: 56px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 13px;
}

.list-row,
.requirement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.list-row strong,
.requirement strong {
  display: block;
  font-size: 14px;
  line-height: 1.35;
}

.list-row small,
.requirement small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 3px;
}

.requirements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.requirement progress {
  margin-top: 8px;
}

.plan-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 90px minmax(160px, 0.8fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.filters {
  margin-bottom: 12px;
}

.filters input {
  min-width: 240px;
}

.filters select {
  min-width: 150px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #536174;
  font-size: 12px;
}

tbody tr:hover td {
  background: #fbfcfe;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

.course-name {
  font-weight: 800;
}

.remote {
  margin-left: 6px;
}

.danger-text {
  color: var(--danger);
}

.warn-text {
  color: var(--warn);
}

.ok-text {
  color: var(--ok);
}

@media (max-width: 1000px) {
  .topbar,
  .status-panel {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }

  .actions {
    justify-content: flex-start;
  }

  .metrics,
  .columns,
  .requirements {
    grid-template-columns: 1fr;
  }

  .plan-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .layout {
    padding: 12px;
  }

  .topbar {
    padding: 12px;
  }

  .brand {
    min-width: 0;
  }

  .actions select,
  .actions button,
  .actions .file-input {
    width: 100%;
    max-width: none;
  }

  .status-panel h1 {
    font-size: 22px;
  }

  .chart-title-row {
    padding: 20px 16px 4px;
  }

  .chart-title-row h2 {
    font-size: 20px;
  }

  .chart-subtitle {
    font-size: 14px;
  }

  .chart-menu {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .chart-note {
    padding: 0 16px 20px;
    font-size: 13px;
  }
}
