*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; line-height: 1.55; }
body {
  margin: 0;
  color: #1f2421;
  background: #f3f5f2;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: #2456a6; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
.app-shell {
  width: min(1280px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 72px;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 18px 20px;
  border: 1px solid #d9ddd4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(33, 47, 40, 0.06);
  margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 4px;
  color: #6b746d;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.brand {
  margin: 0 0 5px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
}
.subline, .muted {
  color: #697067;
  font-size: 12px;
}
.subline span + span::before {
  content: " / ";
  color: #adb4aa;
}
.actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #d8ddd3;
  border-radius: 999px;
  background: #f8faf7;
  color: #4f5a52;
  font-size: 12px;
  font-weight: 700;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid #c4cabf;
  border-radius: 7px;
  background: #fff;
  color: #20251f;
  font-weight: 560;
  cursor: pointer;
}
.button.primary {
  background: #213f36;
  color: #fff;
  border-color: #213f36;
}
.button.ghost {
  background: transparent;
}
.button:hover { text-decoration: none; background: #f8f9f6; }
.button.primary:hover { background: #19342c; }
.button.danger {
  background: #fff;
  color: #9c2f21;
  border-color: #d8aaa3;
}
.button.danger:hover {
  background: #fff5f3;
  text-decoration: none;
}
.layout-2 {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: 24px;
  align-items: start;
}
.panel {
  background: #fff;
  border: 1px solid #d9ddd4;
  border-radius: 8px;
}
.panel.pad { padding: 20px; }
.upload-panel { margin-bottom: 18px; }
.panel-title {
  margin: 0 0 7px;
  font-size: 16px;
  font-weight: 650;
}
.panel-copy {
  margin: 0;
  color: #5f675e;
  font-size: 13px;
}
.upload-workbench {
  display: grid;
  gap: 16px;
}
.upload-workbench.is-uploading {
  opacity: 0.72;
  pointer-events: none;
}
.upload-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.file-input-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.queue-box {
  min-height: 172px;
  border: 1px dashed #b4bbb0;
  border-radius: 8px;
  background: #fafbf8;
  padding: 12px;
}
.queue-empty {
  display: grid;
  place-items: center;
  min-height: 136px;
  color: #757d73;
  text-align: center;
}
.queue-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  background: #fff;
  border: 1px solid #e4e7e0;
  border-radius: 7px;
}
.queue-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 560;
}
.queue-meta {
  color: #7b8379;
  font-size: 11px;
}
.remove-file {
  border: 0;
  background: #eef0eb;
  color: #4d554c;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  cursor: pointer;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.feature {
  padding: 14px;
  border-top: 1px solid #dfe3da;
}
.feature strong {
  display: block;
  margin-bottom: 4px;
}
.recent-list {
  display: grid;
  gap: 10px;
}
.recent-item {
  display: block;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid #d9ddd4;
  border-radius: 8px;
}
.notice {
  padding: 12px 14px;
  border: 1px solid #b9d8c9;
  background: #f0faf5;
  color: #175c46;
  border-radius: 8px;
  margin-bottom: 16px;
}
.notice.warn {
  border-color: #ead69b;
  background: #fff9e8;
  color: #76590b;
}
.mode-panel {
  padding: 16px;
  margin-bottom: 18px;
}
.control-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(150px, 0.45fr) minmax(220px, 0.7fr) auto;
  gap: 12px;
  align-items: end;
}
.field label, .label {
  display: block;
  color: #60685f;
  font-size: 11px;
  margin-bottom: 7px;
}
.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  height: 36px;
  padding: 6px 9px;
  border: 1px solid #c9cec4;
  border-radius: 7px;
  background: #fff;
}
.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: #ebece7;
  border-radius: 8px;
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented label {
  text-align: center;
  padding: 8px 7px;
  color: #4e564d;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented input:checked + label {
  background: #fff;
  color: #171b18;
  box-shadow: 0 1px 2px rgba(20, 28, 18, 0.08);
}
.doc-filter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin-top: 13px;
}
.check-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  background: #fafbf8;
  border: 1px solid #e2e5dd;
  border-radius: 7px;
  color: #3d443c;
  font-size: 12px;
}
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid #d9ddd4;
  background: #fff;
  border-radius: 8px;
  overflow: visible;
  margin-bottom: 22px;
  position: relative;
  z-index: 4;
}
.kpi {
  min-height: 90px;
  padding: 15px 16px;
  border-right: 1px solid #e4e7e0;
  position: relative;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 3px;
  background: #2f6f62;
  opacity: 0.18;
}
.kpi:nth-child(2)::before { background: #315c98; }
.kpi:nth-child(3)::before { background: #a0652b; }
.kpi:nth-child(4)::before { background: #2f6f62; opacity: 0.32; }
.kpi:nth-child(5)::before { background: #315c98; opacity: 0.32; }
.kpi:last-child { border-right: none; }
.kpi-label {
  display: block;
  color: #6e766d;
  font-size: 11px;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 25px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kpi-note {
  display: block;
  margin-top: 7px;
  color: #7a8278;
  font-size: 11px;
}
.info-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border: 1px solid #aeb8ad;
  border-radius: 50%;
  color: #40534d;
  background: #f8faf7;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  vertical-align: text-top;
  cursor: help;
}
.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 9999;
  width: min(320px, 72vw);
  padding: 9px 10px;
  border: 1px solid #cdd3c8;
  border-radius: 7px;
  background: #1f2421;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  visibility: hidden;
  box-shadow: none;
  pointer-events: none;
}
.info-dot:hover .tooltip,
.info-dot:focus .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.section {
  margin: 28px 0;
}
.manager-panel {
  margin-bottom: 18px;
}
.document-manager {
  display: grid;
  gap: 14px;
}
.manager-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.delete-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
}
.delete-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "check main"
    "check file";
  gap: 2px 9px;
  align-items: center;
  padding: 9px 10px;
  background: #fafbf8;
  border: 1px solid #e2e5dd;
  border-radius: 7px;
  color: #3d443c;
  font-size: 12px;
}
.delete-row input { grid-area: check; }
.delete-main {
  grid-area: main;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.delete-file {
  grid-area: file;
  color: #7b8379;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}
.section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.section-sub {
  color: #747c72;
  font-size: 12px;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d9ddd4;
  border-radius: 8px;
  background: #fff;
}
.data-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}
.data-table th {
  position: sticky;
  top: 0;
  background: #fbfcf8;
  color: #697067;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #d9ddd4;
  white-space: nowrap;
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e9ece5;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  white-space: nowrap;
}
.company-cell {
  min-width: 230px;
  font-weight: 650;
}
.entity-line,
.rank-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}
.entity-code {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf4f1;
  color: #205d50;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.entity-name {
  min-width: 0;
  color: #20251f;
  overflow-wrap: anywhere;
}
.entity-year {
  color: #757d73;
  font-size: 11px;
  font-weight: 650;
}
.filename {
  margin-top: 2px;
  color: #777f75;
  font-size: 11px;
  font-weight: 400;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 26px;
  border-radius: 999px;
  background: #e9f5ef;
  color: #17684f;
  font-weight: 700;
}
.score.low { background: #fff0ed; color: #b43624; }
.score.mid { background: #fff6dc; color: #8a6200; }
.viz-grid,
.rank-grid,
.trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.viz-panel {
  padding: 16px;
  background: #fff;
  border: 1px solid #d9ddd4;
  border-radius: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(160px, 1fr) minmax(90px, auto);
  gap: 12px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid #e9ece5;
}
.bar-row:last-child { border-bottom: none; }
.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  height: 8px;
  background: #e8ebe4;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill { height: 100%; background: #2f6f62; }
.bar-fill.alt { background: #315c98; }
.rank-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.rank-panel,
.trend-card {
  padding: 16px;
  background: #fff;
  border: 1px solid #d9ddd4;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(33, 47, 40, 0.04);
}
.rank-panel h3,
.trend-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
}
.rank-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #e9ece5;
}
.rank-row:last-child { border-bottom: none; }
.rank-no {
  color: #6d756c;
  font-size: 11px;
  font-weight: 800;
}
.rank-value {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rank-track {
  height: 5px;
  margin: -2px 0 6px 34px;
  background: #e9ece5;
  border-radius: 999px;
  overflow: hidden;
}
.rank-track span {
  display: block;
  height: 100%;
  background: #2f6f62;
}
.rank-track span.alt { background: #315c98; }
.trend-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.trend-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  color: #737b72;
  font-size: 11px;
}
.trend-card-head h3 { color: #20251f; }
.trend-svg {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 4px;
  overflow: visible;
}
.trend-svg .axis {
  stroke: #aeb7ad;
  stroke-width: 1;
}
.trend-svg .grid-line {
  stroke: #e3e7df;
  stroke-width: 1;
}
.trend-svg text {
  fill: #737b72;
  font-size: 9px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.trend-point {
  outline: none;
  cursor: help;
  pointer-events: all;
}
.trend-point circle { pointer-events: all; }
.trend-point circle:first-child {
  transition: r 120ms ease, stroke-width 120ms ease;
}
.trend-point:hover circle:first-child,
.trend-point:focus circle:first-child {
  r: 5.6;
  stroke: #fff;
  stroke-width: 2;
}
.trend-svg .point-label {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease, visibility 120ms ease;
}
.trend-point:hover .point-label,
.trend-point:focus .point-label,
.trend-point.is-active .point-label {
  opacity: 1;
  visibility: visible;
}
.trend-svg .point-label rect {
  fill: #1f2421;
  stroke: #1f2421;
}
.trend-svg .point-label text {
  fill: #fff;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.trend-svg .point-label-year {
  font-size: 8px;
  font-weight: 700;
  opacity: 0.82;
}
.trend-svg .point-label-value {
  font-size: 10px;
  font-weight: 800;
}
.trend-floating-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid #1f2421;
  border-radius: 6px;
  background: #1f2421;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}
.manager-head .button {
  min-width: 168px;
  white-space: nowrap;
}
.legend {
  display: flex;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #596158;
  font-size: 11px;
  min-width: 0;
}
.legend-item i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.trend-table .company-cell { min-width: 250px; }
.doc-review {
  background: #fff;
  border: 1px solid #d9ddd4;
  border-radius: 8px;
  margin-bottom: 10px;
}
.doc-review summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
}
.doc-review-body {
  border-top: 1px solid #e4e7e0;
  padding: 16px;
}
.edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}
.metric-edit-grid { margin-top: 12px; }
.notes {
  margin-top: 14px;
  color: #626a60;
  font-size: 12px;
}
.notes ul { margin: 8px 0 0 18px; padding: 0; }
.report-doc { background: #fff; }
.report-doc .app-shell { width: min(980px, calc(100vw - 40px)); }
.report-doc .tooltip { display: none; }
.report-table,
.report-trends,
.report-rank { margin-top: 12px; }
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  width: min(100vw - 32px, 460px);
  margin: 0 auto;
  padding: 32px 0;
}
.login-panel {
  width: 100%;
  box-shadow: 0 16px 40px rgba(33, 47, 40, 0.08);
}
.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.login-form .field label {
  font-size: 12px;
}
.login-button {
  width: 100%;
  margin-top: 4px;
}
.login-error {
  margin: 16px 0 0;
}
@media (max-width: 960px) {
  .app-shell { width: min(100vw - 28px, 1280px); }
  .layout-2,
  .control-grid,
  .viz-grid,
  .rank-grid,
  .trend-grid,
  .edit-grid {
    grid-template-columns: 1fr;
  }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-bottom: 1px solid #e4e7e0; }
}
@media (max-width: 560px) {
  .page-head, .section-head { display: block; }
  .actions { margin-top: 12px; }
  .kpi-strip { grid-template-columns: 1fr; }
  .segmented { grid-template-columns: 1fr; }
}
@media print {
  body { background: #fff; }
  .app-shell { width: auto; padding: 20px; }
  .actions, .mode-panel, .doc-review, .upload-workbench, .document-manager, .button { display: none !important; }
  .panel, .table-wrap, .viz-panel { break-inside: avoid; }
}
