:root {
  --bg: #f6f8f7;
  --ink: #17262d;
  --brand: #0a6a5c;
  --line: #d6dfdb;
  --card: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "Noto Sans SC", sans-serif;
  background: radial-gradient(circle at 0% 0%, #d8eee5 0%, transparent 35%), var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 248, 247, .95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 20px;
}

h1 { margin: 0; font-size: 22px; }
h2 { margin: 0 0 12px; font-size: 18px; }
h3 { margin: 16px 0 8px; font-size: 16px; }

.menu { display: flex; gap: 8px; }
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
}
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

main {
  max-width: 1280px;
  margin: 14px auto;
  padding: 0 14px 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
#expMetrics {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}
.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #fff, #f9fbfa);
}
.stat b { display: block; font-size: 22px; margin-top: 4px; }

.group-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.badge {
  background: #edf5f2;
  border: 1px solid #cddbd5;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
select, input, button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
}
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
button { cursor: pointer; background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn-danger {
  background: #b63b3b;
  border-color: #b63b3b;
  color: #fff;
}
.exp-name-link {
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.meta { font-size: 13px; color: #50626a; }
.status-ok { color: #0a6a5c; font-weight: 600; }
.status-miss { color: #c12424; font-weight: 700; }
.daily-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}
.daily-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 8px;
  background: linear-gradient(180deg, #ffffff, #f9fbfa);
  text-align: center;
}
.daily-name {
  font-size: 13px;
  color: #1a2a31;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.daily-status {
  font-size: 13px;
  font-weight: 600;
}
.exp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.exp-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #fff, #f9fbfa);
}
.exp-submenu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.exp-subtab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 7px 12px;
}
.exp-subtab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.exp-subpanel { display: none; }
.exp-subpanel.active { display: block; }
.exp-query-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.exp-query-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f9fbfa);
  padding: 10px;
}
.exp-query-time {
  grid-column: span 1;
}
.exp-query-search {
  grid-column: span 1;
}
.exp-query-filter {
  grid-column: span 1;
}
.exp-query-title {
  font-size: 13px;
  color: #35535c;
  font-weight: 700;
  margin-bottom: 8px;
}
.exp-query-group .toolbar {
  margin-bottom: 0;
  gap: 8px;
}

@media (min-width: 901px) {
  .exp-query-layout {
    grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.7fr) minmax(220px, 0.8fr);
  }
}
.exp-detail-stats {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}
.exp-detail-reports-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.report-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.report-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f9fbfa);
  padding: 10px 12px;
}
.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  color: #496068;
  margin-bottom: 8px;
}
.report-index {
  display: inline-block;
  border: 1px solid #c7d6d1;
  background: #edf5f2;
  border-radius: 999px;
  padding: 2px 8px;
  color: #1f4349;
}
.report-content {
  line-height: 1.6;
  color: #1c2d33;
  white-space: normal;
  word-break: break-word;
}
.report-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.report-actions button {
  padding: 4px 10px;
  font-size: 12px;
}
.group-divider td {
  background: #eef6f3;
  color: #1f5252;
  font-weight: 700;
  border-top: 2px solid #c8ddd6;
}
.role-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}
.role-member {
  color: #35515a;
  background: #eef3f5;
  border: 1px solid #cfdce1;
}
.role-leader {
  color: #8a2d00;
  background: #fff1e7;
  border: 1px solid #ffc89f;
}
.status-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #cfd9dd;
  background: #f5f8f9;
  color: #36505a;
}
.status-green {
  background: #ebf9ef;
  border-color: #bfe6c8;
  color: #187a34;
}
.status-yellow {
  background: #fff7e8;
  border-color: #ffd89a;
  color: #8a5b00;
}
.status-red {
  background: #ffecec;
  border-color: #ffb0b0;
  color: #a61f1f;
}
.group-exp-person {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.group-exp-person h3 {
  margin: 0 0 8px;
}
.participant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.participant-item {
  border: 1px solid #cfe0da;
  background: #f3faf7;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: #24444a;
}
.report-form {
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfefd;
  padding: 10px;
}
.delay-bad {
  color: #b52222;
  font-weight: 700;
}

.edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbf9;
}
.edit-title {
  font-size: 14px;
  color: #244047;
  font-weight: 600;
}
.edit-picker {
  display: flex;
  align-items: end;
  gap: 10px;
}
.edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px 12px;
}
.edit-grid label {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.edit-grid .edit-wide {
  grid-column: span 2;
}
.edit-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: flex-end;
}

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 9px 6px;
  font-size: 13px;
  vertical-align: top;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#expListTable .exp-col-id {
  width: 4ch;
}
#expListTable .exp-col-title {
  width: 18em;
}
#expListTable .exp-col-mini {
  width: 4.5em;
  text-align: center;
}
#expListTable .exp-col-tight {
  width: 6em;
  text-align: center;
}
#expListTable .exp-cell-title .exp-name-link {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
#logs td:last-child { white-space: pre-wrap; }
.weekly-report-content {
  white-space: pre-wrap;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  background: #0c1f23;
  color: #fff;
  border-radius: 9px;
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(8px);
  transition: .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(12, 22, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.login-title { margin: 0 0 8px; }
.login-tip { font-size: 13px; color: #55666d; margin-bottom: 12px; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .exp-detail-stats { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .daily-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .exp-grid { grid-template-columns: 1fr; }
  .exp-query-layout { grid-template-columns: 1fr; }
  .edit-head { flex-direction: column; align-items: stretch; }
  .edit-picker { width: 100%; }
  .edit-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .edit-grid .edit-wide { grid-column: span 2; }
}
@media (max-width: 640px) {
  .daily-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exp-detail-stats { grid-template-columns: 1fr; }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-grid .edit-wide { grid-column: span 1; }
}
