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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f6fa;
  line-height: 1.6;
}

.app-header {
  background: #4472C4;
  color: #fff;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 500;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.app-header .sub {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px;
}

.section {
  background: #fff;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  padding: 12px 14px;
  color: #333;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title .tag {
  font-size: 11px;
  font-weight: 400;
  color: #4472C4;
  background: #E6F1FB;
  padding: 2px 8px;
  border-radius: 10px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 700px;
}

table.report-table th {
  background: #4472C4;
  color: #fff;
  font-weight: 500;
  font-size: 12px;
  padding: 8px 6px;
  border: 1px solid #3A62A8;
  text-align: left;
  white-space: nowrap;
}

table.report-table th .hint {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.8;
}

table.report-table td {
  padding: 8px 6px;
  border: 1px solid #ddd;
  font-size: 13px;
  vertical-align: top;
}

table.report-table td input,
table.report-table td textarea,
table.report-table td select {
  width: 100%;
  border: none;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  outline: none;
  resize: none;
}

table.report-table td input:focus,
table.report-table td textarea:focus {
  background: #F0F7FF;
}

table.report-table td.date-cell {
  background: #E6F1FB;
  cursor: pointer;
  min-width: 90px;
}

table.report-table td.date-cell input {
  color: #185FA5;
}

table.report-table td.wk-cell {
  background: #F8F9FB;
  color: #888;
  font-size: 12px;
  min-width: 70px;
}

table.report-table .del-btn {
  color: #e74c3c;
  cursor: pointer;
  text-align: center;
  font-size: 16px;
  width: 36px;
  min-width: 36px;
}

table.report-table .del-btn:hover {
  background: #FCEBEB;
}

.summary-row td {
  background: #FAEEDA !important;
}

.summary-row .summary-label {
  font-weight: 600;
  color: #854F0B;
  padding: 10px;
}

.summary-row textarea {
  min-height: 60px;
  font-weight: 500;
}

.plan-row td {
  background: #E1F5EE !important;
}

.plan-row .plan-label {
  font-weight: 600;
  color: #085041;
  padding: 10px;
}

.plan-row textarea {
  min-height: 60px;
  font-weight: 500;
}

.seq-table th {
  background: #4472C4;
  color: #fff;
}

.seq-table {
  min-width: auto;
}

.seq-table .seq-num {
  text-align: center;
  font-weight: 500;
  width: 40px;
}

.add-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.add-bar a {
  color: #4472C4;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  background: #E6F1FB;
}

.add-bar a:hover {
  background: #B5D4F4;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f0f0f0;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
}

.file-chip .remove {
  color: #e74c3c;
  cursor: pointer;
  margin-left: 4px;
}

.btn-group {
  display: flex;
  gap: 10px;
  padding: 14px;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #eee;
}

.btn {
  flex: 1;
  padding: 12px;
  font-size: 15px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: #4472C4;
  color: #fff;
}

.btn-primary:active {
  background: #3A62A8;
}

.btn-secondary {
  background: #f0f0f0;
  color: #666;
}

.type-switch {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #4472C4;
}

.type-switch button {
  flex: 1;
  padding: 10px;
  border: none;
  background: #fff;
  color: #4472C4;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

.type-switch button.active {
  background: #4472C4;
  color: #fff;
}

.date-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.date-picker-overlay.show {
  display: flex;
}

.date-picker-box {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
}

.date-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid #eee;
}

.date-picker-header .month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-picker-header .month-nav button {
  border: none;
  background: #f0f0f0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
}

.date-picker-header .month-label {
  font-size: 15px;
  font-weight: 500;
}

.date-picker-header .close-btn {
  border: none;
  background: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
}

.date-picker-body {
  padding: 10px;
}

.date-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-bottom: 6px;
}

.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-picker-days .day {
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.date-picker-days .day:hover {
  background: #E6F1FB;
}

.date-picker-days .day.selected {
  background: #4472C4;
  color: #fff;
}

.date-picker-days .day.in-range {
  background: #B5D4F4;
  color: #185FA5;
}

.date-picker-days .day.empty {
  cursor: default;
}

.date-picker-days .day.other-month {
  color: #ccc;
}

.date-picker-footer {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #eee;
}

.date-picker-footer button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

.date-picker-footer .confirm-btn {
  background: #4472C4;
  color: #fff;
}

.date-picker-footer .clear-btn {
  background: #f0f0f0;
  color: #666;
}

.selected-dates-preview {
  padding: 8px 14px;
  font-size: 12px;
  color: #4472C4;
  background: #E6F1FB;
  border-radius: 4px;
  margin: 6px 12px;
}

/* Picker cell & auto cell */
table.report-table td.picker-cell {
  background: #E6F1FB;
  cursor: pointer;
  min-width: 90px;
}

table.report-table td.picker-cell input {
  color: #185FA5;
}

table.report-table td.auto-cell {
  background: #F8F9FB;
  color: #888;
  font-size: 12px;
  min-width: 80px;
}

/* Week picker */
.wp-list { display: flex; flex-direction: column; gap: 6px; }
.wp-item { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #e0e0e0; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
.wp-item:hover { border-color: #4472C4; background: #E6F1FB; }
.wp-item.selected { border-color: #4472C4; background: #E6F1FB; }
.wp-item .wp-check { width: 20px; height: 20px; border: 2px solid #ccc; border-radius: 4px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wp-item.selected .wp-check { background: #4472C4; border-color: #4472C4; color: #fff; }
.wp-item.selected .wp-check::after { content: '\2713'; font-size: 14px; }
.wp-item .wp-label { font-weight: 500; font-size: 14px; }
.wp-item .wp-range { font-size: 12px; color: #888; margin-left: auto; }

/* Month picker */
.mp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mp-item { text-align: center; padding: 16px 0; font-size: 15px; cursor: pointer; border-radius: 8px; border: 2px solid #e0e0e0; transition: all 0.15s; }
.mp-item:hover { border-color: #4472C4; background: #E6F1FB; }
.mp-item.selected { background: #4472C4; color: #fff; border-color: #4472C4; }

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.8);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.loading-overlay.show {
  display: flex;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #E6F1FB;
  border-top: 3px solid #4472C4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .container {
    padding: 8px;
  }
  .app-header {
    font-size: 16px;
    padding: 12px;
  }
}
