* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f5f7fa;
  color: #333;
}

@media (min-width: 2560px) {
  body {
    font-size: 16px;
  }
}

@media (min-width: 3840px) {
  body {
    font-size: 18px;
  }
}

.app {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

@media (min-width: 1920px) {
  .app {
    max-width: 1840px;
    padding: 24px 48px;
  }
}

@media (min-width: 2560px) {
  .app {
    max-width: 2460px;
    padding: 32px 64px;
  }
}

@media (min-width: 3840px) {
  .app {
    max-width: 3720px;
    padding: 40px 80px;
  }
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.main-header > div:first-child {
  text-align: left;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  color: #1a202c;
}

header p {
  margin: 0;
  color: #718096;
  font-size: 14px;
}

@media (min-width: 2560px) {
  header h1 {
    font-size: 32px;
  }

  header p {
    font-size: 16px;
  }
}

@media (min-width: 3840px) {
  header h1 {
    font-size: 38px;
  }

  header p {
    font-size: 18px;
  }
}

.hint {
  margin: 0 0 16px;
  color: #718096;
  font-size: 13px;
}

@media (min-width: 2560px) {
  .hint {
    font-size: 15px;
  }
}

@media (min-width: 3840px) {
  .hint {
    font-size: 17px;
  }
}

.layout {
  display: flex;
  gap: 20px;
  min-height: calc(100vh - 160px);
}

.sidebar {
  width: 200px;
  flex-shrink: 0;
}

@media (min-width: 1600px) {
  .sidebar {
    width: 240px;
  }
}

@media (min-width: 2560px) {
  .sidebar {
    width: 280px;
  }
}

@media (min-width: 3840px) {
  .sidebar {
    width: 320px;
  }
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 20px;
}

.sidebar nav button {
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #4a5568;
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  transition: background 0.2s, color 0.2s;
}

.sidebar nav button:hover {
  background: #edf2f7;
}

.sidebar nav button.active {
  background: #3182ce;
  color: #fff;
  font-weight: 600;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

@media (min-width: 1400px) {
  .config-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1800px) {
  .config-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 2560px) {
  .config-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 3840px) {
  .config-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #4a5568;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="month"],
select,
textarea {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="month"]:focus,
select:focus,
textarea:focus {
  border-color: #3182ce;
}

textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
}

.tab-content {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (min-width: 2560px) {
  .tab-content {
    padding: 28px;
  }

  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="month"],
  select,
  textarea {
    padding: 10px 14px;
  }
}

@media (min-width: 3840px) {
  .tab-content {
    padding: 36px;
  }

  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="month"],
  select,
  textarea {
    padding: 12px 16px;
  }
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.tab-pane h2 {
  margin-top: 0;
  font-size: 18px;
}

@media (min-width: 2560px) {
  .tab-pane h2 {
    font-size: 22px;
  }
}

@media (min-width: 3840px) {
  .tab-pane h2 {
    font-size: 26px;
  }
}

.settings-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.settings-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: #2d3748;
}

@media (min-width: 2560px) {
  .settings-section {
    padding: 24px;
    margin-bottom: 24px;
  }

  .settings-section h3 {
    font-size: 18px;
  }

  .form-row {
    gap: 16px;
    margin-bottom: 16px;
  }
}

@media (min-width: 3840px) {
  .settings-section {
    padding: 32px;
    margin-bottom: 32px;
  }

  .settings-section h3 {
    font-size: 22px;
  }

  .form-row {
    gap: 20px;
    margin-bottom: 20px;
  }
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.form-row label {
  font-size: 13px;
  color: #4a5568;
  margin-right: -6px;
}

.form-row input[type="text"] {
  flex: 1;
  min-width: 160px;
}

.form-row input[type="number"] {
  width: 80px;
}

.db-path-row {
  align-items: flex-start;
}

.db-path-row .form-group {
  flex: 1;
  min-width: 240px;
}

.hint-inline {
  color: #718096;
  font-size: 13px;
  line-height: 1.5;
  max-width: 360px;
  margin: 20px 0 0 0;
}

.select-hint {
  color: #718096;
  font-size: 13px;
  line-height: 1.5;
  max-width: 320px;
  margin-left: 8px;
}

@media (min-width: 2560px) {
  .hint-inline,
  .select-hint {
    font-size: 15px;
    max-width: 420px;
  }
}

@media (min-width: 3840px) {
  .hint-inline,
  .select-hint {
    font-size: 17px;
    max-width: 520px;
  }
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #3182ce;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

@media (min-width: 2560px) {
  button {
    padding: 10px 20px;
    font-size: 16px;
  }
}

@media (min-width: 3840px) {
  button {
    padding: 12px 24px;
    font-size: 18px;
  }
}

button:hover:not(:disabled) {
  background: #2b6cb0;
}

button:disabled {
  background: #a0aec0;
  cursor: not-allowed;
}

.message {
  margin: 8px 0 0;
  font-size: 14px;
  min-height: 20px;
}

.message.success {
  color: #38a169;
}

.message.error {
  color: #e53e3e;
}

.schedule-panel {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.schedule-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: #2d3748;
}

.schedule-panel .form-row {
  flex-wrap: wrap;
}

.schedule-panel input[type="time"] {
  width: 100px;
}

.data-table td.success {
  color: #38a169;
}

.data-table td.error {
  color: #e53e3e;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #edf2f7;
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: #3182ce;
  width: 0%;
  transition: width 0.3s;
}

.progress-fill.indeterminate {
  background: linear-gradient(90deg, #3182ce 25%, #63b3ed 50%, #3182ce 75%);
  background-size: 200% 100%;
  animation: indeterminate-progress 1.5s linear infinite;
}

@keyframes indeterminate-progress {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

th {
  background: #f7fafc;
  font-weight: 600;
  color: #4a5568;
}

.empty {
  text-align: center;
  color: #a0aec0;
}

.success-row {
  color: #38a169;
}

.error-row {
  color: #e53e3e;
}

.table-wrapper {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable::after {
  content: " ⇅";
  color: #a0aec0;
  font-size: 12px;
}

th.sortable.sort-asc::after {
  content: " ▲";
  color: #3182ce;
}

th.sortable.sort-desc::after {
  content: " ▼";
  color: #3182ce;
}

.table-wrapper .data-table {
  margin-top: 0;
}

.daily-table {
  min-width: 1200px;
  margin-top: 0;
  font-size: 13px;
  white-space: nowrap;
}

.daily-table th,
.daily-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #edf2f7;
}

.daily-table th:first-child,
.daily-table td:first-child,
.daily-table th:nth-child(2),
.daily-table td:nth-child(2),
.daily-table th:nth-child(3),
.daily-table td:nth-child(3) {
  position: sticky;
  left: 0;
  background: #f7fafc;
  z-index: 1;
}

.daily-table th:nth-child(2),
.daily-table td:nth-child(2) {
  left: 44px;
}

.daily-table th:nth-child(3),
.daily-table td:nth-child(3) {
  left: 120px;
}

.daily-table tbody tr:hover td {
  background: #f7fafc;
}

.daily-table tbody tr:hover td:first-child,
.daily-table tbody tr:hover td:nth-child(2),
.daily-table tbody tr:hover td:nth-child(3) {
  background: #edf2f7;
}

@media (min-width: 2560px) {
  .daily-table {
    min-width: 1600px;
    font-size: 14px;
  }
}

@media (min-width: 3840px) {
  .daily-table {
    min-width: 2200px;
    font-size: 16px;
  }
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 6px 12px;
  font-size: 13px;
}

.pagination .page-info {
  font-size: 13px;
  color: #4a5568;
  padding: 0 8px;
}

.pagination .jump-input {
  width: 70px;
  padding: 6px 8px;
  font-size: 13px;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #4a5568;
}

.user-bar a {
  color: #3182ce;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid #3182ce;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.user-bar a:hover {
  background: #3182ce;
  color: #fff;
}

.beian {
  margin: 8px 0 0;
  font-size: 12px;
  color: #a0aec0;
  text-align: center;
}

.beian a {
  color: #718096;
  text-decoration: none;
}

.beian a:hover {
  color: #3182ce;
  text-decoration: underline;
}

.login-card .beian {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
  }

  .sidebar nav button {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }
}

footer {
  text-align: center;
  margin-top: 24px;
  color: #718096;
  font-size: 13px;
}
