*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #fe2c55;
  --red-light: #fff0f2;
  --red-mid: #ffd6dc;
  --gray: #666;
  --border: #e0e0e0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #f7f7f7;
  color: #222;
  font-size: 15px;
  min-height: 100vh;
}

/* ── Layout ── */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

/* ── Header ── */
.header {
  background: var(--red);
  color: #fff;
  text-align: center;
  padding: 18px 16px 14px;
  margin-bottom: 16px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.header h1 { font-size: 20px; font-weight: 700; }
.header p  { font-size: 13px; opacity: .85; margin-top: 4px; }

/* ── Section title ── */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  border-left: 3px solid var(--red);
  padding-left: 8px;
  margin-bottom: 14px;
}

/* ── Form fields ── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 5px;
}
.field label .required { color: var(--red); margin-left: 2px; }

.field select,
.field input[type="number"],
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  background: #fff;
}
.field select:focus,
.field input[type="number"]:focus,
.field textarea:focus {
  border-color: var(--red);
}
.field textarea { resize: vertical; min-height: 80px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }

.btn-primary { background: var(--red); color: #fff; width: 100%; }
.btn-secondary {
  background: #fff;
  color: var(--red);
  border: 1.5px solid var(--red);
}
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ── Alert ── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-warn {
  background: #fff8e1;
  border-left: 4px solid #f59e0b;
  color: #92400e;
}
.alert-success {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
  color: #166534;
}

/* ── Success page ── */
.success-icon { font-size: 52px; text-align: center; margin-bottom: 8px; }
.success-title { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.success-sub { text-align: center; color: var(--gray); font-size: 13px; margin-bottom: 20px; }

.report-box {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "PingFang SC", "Helvetica Neue", monospace;
  margin-bottom: 14px;
}

.copy-btn { width: 100%; margin-bottom: 10px; }
.copy-btn.copied { background: #22c55e; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px;
}
.login-logo { text-align: center; font-size: 32px; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 24px; }

/* ── History ── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.filter-row .field { margin-bottom: 0; flex: 1; min-width: 130px; }
.filter-row .field label { font-size: 12px; }
.filter-row input[type="date"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
}
.filter-row input[type="date"]:focus { border-color: var(--red); }

.history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history-table th {
  background: var(--red-light);
  color: var(--red);
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
}
.history-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.history-table tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-green { background: #dcfce7; color: #16a34a; }

details summary {
  cursor: pointer;
  color: var(--red);
  font-size: 13px;
  margin-top: 6px;
  user-select: none;
}
details[open] summary { margin-bottom: 8px; }
details .report-box { margin-top: 0; font-size: 13px; }

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.top-bar h2 { font-size: 16px; font-weight: 700; }

.link { color: var(--red); text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; }

.empty { text-align: center; color: var(--gray); padding: 32px 0; font-size: 14px; }

@media (max-width: 400px) {
  .field-row { grid-template-columns: 1fr; }
}
