* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif; background: #f5f6f8; color: #333; font-size: 13px; }

/* Header */
.header { background: #2d9e96; color: #fff; padding: 12px 24px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 200; }
.header h1 { font-size: 16px; font-weight: 600; }
.header .updated { font-size: 11px; color: rgba(255,255,255,.75); margin-left: auto; }

/* Hamburger Nav */
.nav-toggle { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; padding: 2px 6px; line-height: 1; }
.nav-toggle:hover { opacity: 0.8; }
.nav-menu { display: none; position: absolute; top: 44px; left: 16px; background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.15); z-index: 100; min-width: 180px; overflow: hidden; }
.nav-menu.open { display: block; }
.nav-menu a { display: block; padding: 10px 16px; color: #333; text-decoration: none; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.nav-menu a:last-child { border-bottom: none; }
.nav-menu a:hover { background: #e8f5f3; color: #2d9e96; }
.nav-menu a.active { color: #2d9e96; font-weight: 600; background: #f0faf9; }

/* KPI Cards */
.kpi-bar { display: flex; gap: 10px; padding: 14px 24px; flex-wrap: wrap; }
.kpi-card { background: #fff; border-radius: 8px; padding: 10px 14px; min-width: 90px; box-shadow: 0 1px 3px rgba(0,0,0,.06); flex: 1; max-width: 150px; border: 1px solid #e8eaed; }
.kpi-card .label { font-size: 11px; color: #888; margin-bottom: 2px; }
.kpi-card .value { font-size: 20px; font-weight: 700; color: #444; }
.kpi-card.danger .value { color: #e25c5c; }
.kpi-card.warning .value { color: #e6930a; }
.kpi-card.normal .value { color: #2bb578; }
.kpi-card.ended .value { color: #999; }

/* Filters */
.filter-bar { display: flex; gap: 8px; padding: 0 24px 10px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select {
  padding: 6px 8px; border: 1px solid #d4d8dc; border-radius: 6px;
  font-size: 12px; background: #fff; outline: none; color: #444;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: #3cbcb4; box-shadow: 0 0 0 2px rgba(60,188,180,.15); }
.filter-bar input { width: 150px; }
.filter-bar select { min-width: 100px; }
.filter-bar .filter-label { font-size: 11px; color: #888; margin-right: -4px; }
.filter-bar .count-label { font-size: 12px; color: #888; margin-left: auto; }
.filter-bar .datalist-input { width: 120px; }

/* Table Container - horizontal scroll only, page handles vertical scroll */
.table-wrap {
  margin: 0 24px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: separate; border-spacing: 0; }

/* Table header */
thead th {
  background: #46998f; color: #fff; padding: 8px 8px;
  text-align: left; font-size: 11px; font-weight: 600;
  cursor: pointer; user-select: none; white-space: nowrap;
  position: relative; z-index: 20;
}
/* JS applies this class when header should be fixed */
thead.is-sticky th {
  /* transform is set by JS */
}
thead th:hover { background: #3a8580; }
thead th .sort-icon { margin-left: 3px; font-size: 9px; opacity: 0.5; }
thead th.sorted .sort-icon { opacity: 1; }

/* Sticky first column (社名) */
.sticky-col {
  position: sticky !important;
  left: 0 !important;
  min-width: 120px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
thead th.sticky-col {
  z-index: 30 !important;
  background: #46998f !important;
}
thead th.sticky-col:hover { background: #3a8580 !important; }
tbody td.sticky-col {
  z-index: 10 !important;
  font-weight: 500;
}

/* ALL cell backgrounds explicit & opaque */
tbody tr:nth-child(odd) td { background: #fff; }
tbody tr:nth-child(odd) td.sticky-col { background: #fff; }
tbody tr:nth-child(even) td { background: #f8fafa; }
tbody tr:nth-child(even) td.sticky-col { background: #f8fafa; }
tbody tr:hover td { background: #eef7f6 !important; }
tbody tr:hover td.sticky-col { background: #eef7f6 !important; }

tbody tr { border-bottom: 1px solid #eef0f2; }
tbody td { padding: 7px 8px; white-space: nowrap; }

/* Supporter/Manager smaller text */
.cell-staff { font-size: 11px; color: #555; }

/* Status dot */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.status-dot.danger { background: #e25c5c; }
.status-dot.warning { background: #e6930a; }
.status-dot.normal { background: #2bb578; }
.status-dot.ended { background: #999; }

/* Progress bar */
.progress-bar { display: flex; align-items: center; gap: 4px; min-width: 100px; }
.progress-track { flex: 1; height: 7px; background: #e5e8eb; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.progress-fill.blue { background: #4db8b0; }
.progress-fill.green { background: #2bb578; }
.progress-fill.orange { background: #e6930a; }
.progress-fill.red { background: #e25c5c; }
.progress-fill.gray { background: #bbb; }
.progress-pct { font-size: 11px; min-width: 34px; text-align: right; font-weight: 600; color: #555; }

/* Deviation */
.deviation-pos { color: #2bb578; font-weight: 600; }
.deviation-neg { color: #e25c5c; font-weight: 600; }
.deviation-warn { color: #e6930a; font-weight: 600; }
.deviation-zero { color: #999; }

/* Amount */
.amount { text-align: right; font-variant-numeric: tabular-nums; }

/* Tags */
.cell-tags { white-space: normal; max-width: 200px; }
.tag { display: inline-block; font-size: 10px; background: #e8f5f3; color: #2d9e96; padding: 1px 6px; border-radius: 3px; margin: 1px 2px; }

/* Company name link */
.company-link { color: #2d9e96; text-decoration: none; font-weight: 500; }
.company-link:hover { text-decoration: underline; color: #237a74; }

/* Summary column */
.cell-summary { font-size: 11px; color: #555; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* MEMBER-S link column */
.cell-members { text-align: center; width: 32px; }
.members-link { font-size: 14px; color: #999; text-decoration: none; }
.members-link:hover { color: #2d9e96; }

/* ===== Detail Page ===== */
.detail-back { display: inline-block; margin: 16px 24px 0; font-size: 13px; color: #2d9e96; text-decoration: none; }
.detail-back:hover { text-decoration: underline; }

.detail-title { padding: 12px 24px 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.detail-title h2 { font-size: 18px; font-weight: 700; color: #333; }
.detail-title .order-num { font-size: 12px; color: #888; }
.detail-title .service-badge { font-size: 11px; background: #e8f5f3; color: #2d9e96; padding: 2px 8px; border-radius: 4px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 24px; }
@media (max-width: 768px) { .detail-grid { grid-template-columns: 1fr; } }

.detail-card { background: #fff; border-radius: 8px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border: 1px solid #e8eaed; }
.detail-card.full { grid-column: 1 / -1; }
.detail-card h3 { font-size: 13px; font-weight: 600; color: #2d9e96; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid #e8eaed; }

.detail-table { width: 100%; }
.detail-table th { text-align: left; font-size: 11px; color: #888; font-weight: 500; padding: 4px 8px 4px 0; width: 110px; vertical-align: top; }
.detail-table td { font-size: 13px; color: #333; padding: 4px 0; }

.detail-report-table { width: 100%; border-collapse: collapse; }
.detail-report-table thead th { background: #e8f5f3; color: #2d9e96; font-size: 11px; font-weight: 600; padding: 6px 8px; text-align: left; cursor: default; }
.detail-report-table thead th:hover { background: #e8f5f3; }
.detail-report-table td { font-size: 13px; color: #333; padding: 6px 8px; border-bottom: 1px solid #eef0f2; }

.detail-memo { white-space: pre-wrap; font-size: 13px; color: #444; line-height: 1.6; min-height: 60px; }
.detail-memo.empty { color: #bbb; font-style: italic; }

.detail-actions { padding: 0 24px 24px; display: flex; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border-radius: 6px; font-size: 12px; font-weight: 500; border: none; cursor: pointer; text-decoration: none; }
.btn-primary { background: #2d9e96; color: #fff; }
.btn-primary:hover { background: #237a74; }
.btn-secondary { background: #fff; color: #555; border: 1px solid #d4d8dc; }
.btn-secondary:hover { background: #f5f6f8; }

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 10px 12px; flex-wrap: wrap; gap: 4px; }
  .header h1 { font-size: 14px; }
  .kpi-bar { padding: 10px 12px; gap: 6px; }
  .kpi-card { min-width: 70px; padding: 8px 10px; }
  .kpi-card .value { font-size: 17px; }
  .filter-bar { padding: 0 12px 8px; gap: 6px; }
  .filter-bar input { width: 100%; }
  .filter-bar select { min-width: 0; flex: 1; }
  .filter-bar .filter-label { width: 100%; margin-top: 4px; }
  .filter-bar .count-label { width: 100%; text-align: right; }
  .table-wrap { margin: 0 8px 12px; }
  .sticky-col { min-width: 100px; max-width: 140px; font-size: 12px; }
  thead th { padding: 7px 6px; font-size: 10px; }
  tbody td { padding: 6px 6px; font-size: 12px; }
  .progress-bar { min-width: 80px; }
}

@media (max-width: 480px) {
  .kpi-card { min-width: 60px; }
  .kpi-card .value { font-size: 16px; }
  .sticky-col { min-width: 80px; max-width: 110px; }
}
