:root {
  --bg: #edf3ef;
  --panel: #ffffff;
  --ink: #17342d;
  --muted: #5d756c;
  --accent: #0d8c6d;
  --accent-dark: #08614c;
  --line: #d8e4de;
  --warn: #ffe8d2;
  --table-head-top: #57d2a7;
  --table-head-bottom: #12a06f;
  --table-grid: #b7d6bc;
  --table-row-a: #f5fbef;
  --table-row-b: #e9f6df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #d6efe0, transparent 28%),
    linear-gradient(180deg, #f4faf6, #e9f1ec 55%, #e4ece7);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.panel,
.summary-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 50px rgba(31, 67, 55, 0.09);
  backdrop-filter: blur(10px);
}

.login-card {
  width: min(460px, 100%);
  border-radius: 20px;
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 10px;
  font-size: 30px;
}

.login-form,
.filters {
  display: grid;
  gap: 14px;
}

.login-form label,
.filters {
  width: 100%;
}

.login-form span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

input,
select,
button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  cursor: pointer;
}

button.secondary {
  background: #e4ece7;
  color: var(--ink);
}

button.small {
  padding: 8px 12px;
}

button.danger,
button.secondary.danger {
  background: #b94d3d;
  color: #fff;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 28px 24px 10px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.topbar-actions form {
  min-width: 110px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  margin: 4px 0 10px;
  padding: 0;
}

.page-actions-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.page-actions-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.page-actions form {
  width: auto;
  min-width: 0;
}

.action-button {
  width: auto;
  min-width: 132px;
  max-width: 260px;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(13, 140, 109, 0.14);
  line-height: 1.25;
  white-space: normal;
}

.secondary-action {
  background: #eef6f2;
  color: var(--accent-dark);
  border: 1px solid #b9d9cc;
  box-shadow: none;
}

.official-action {
  background: #254d7a;
  box-shadow: 0 8px 20px rgba(37, 77, 122, 0.16);
}

.full-sync-action {
  background: #0d6f72;
  min-width: 220px;
  box-shadow: 0 8px 20px rgba(13, 111, 114, 0.18);
}

.sync-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.full-sync-meta {
  margin-top: -4px;
}

.sync-meta-item {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(185, 217, 204, 0.9);
  border-radius: 14px;
  padding: 12px 14px;
}

.sync-meta-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.sync-meta-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-all;
}

.sync-meta-wide {
  grid-column: span 2;
}

.mode-switch {
  display: flex;
  gap: 10px;
}

.mode-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  text-decoration: none;
}

.mode-link.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page {
  padding: 0 24px 24px;
}

@media (max-width: 900px) {
  .page-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .page-actions-buttons {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .sync-meta {
    grid-template-columns: 1fr;
  }

  .sync-meta-wide {
    grid-column: span 1;
  }
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-card {
  border-radius: 18px;
  padding: 18px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.panel {
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
}

.batch-panel {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.fwhr-batch-panel {
  grid-template-columns: minmax(150px, 1fr) 160px;
  align-items: center;
}

.batch-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.batch-actions-row button {
  width: auto;
  min-width: 136px;
}

.compact-danger {
  min-width: 112px;
  padding: 10px 12px;
}

.external-select-toolbar {
  margin: -4px 0 12px;
}

.select-all-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}

.filters {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  align-items: center;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1500px;
  font-size: 14px;
}

th,
td {
  border: 1px solid var(--table-grid);
  padding: 8px 10px;
  vertical-align: middle;
  text-align: center;
}

thead th {
  background: linear-gradient(180deg, var(--table-head-top), var(--table-head-bottom));
  color: #fff;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody form {
  display: contents;
}

tbody tr:nth-child(odd) td {
  background: var(--table-row-a);
}

tbody tr:nth-child(even) td {
  background: var(--table-row-b);
}

.center {
  text-align: center;
}

.alert {
  margin-bottom: 14px;
  border-radius: 14px;
  padding: 12px 14px;
}

.alert.success {
  background: #ddf4e8;
  color: var(--accent-dark);
}

.alert.error {
  background: var(--warn);
  color: #8a4c15;
}

.row-deleted {
  opacity: 0.6;
  background: #f9ecec;
}

small {
  color: var(--muted);
}

.row-deleted td {
  background: #f3e5e5 !important;
}

.office-cell {
  min-width: 260px;
  max-width: 360px;
  white-space: normal;
  line-height: 1.45;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.page-summary {
  color: var(--muted);
  font-size: 14px;
}

.page-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-links a,
.page-links span {
  min-width: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--table-grid);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  text-align: center;
}

.page-links .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.page-links .disabled {
  color: #98aaa3;
  background: #f1f5f3;
}

td input[type="text"] {
  min-width: 120px;
  border-radius: 6px;
  padding: 7px 9px;
}

td input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
    flex-direction: column;
  }
}
