:root {
  color-scheme: light;
  --ink: #151714;
  --muted: #74786f;
  --paper: #f3f2ed;
  --card: #fff;
  --line: #dedfd8;
  --accent: #1d5b45;
  --accent-soft: #e2eee8;
  --danger: #a43a32;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.is-hidden {
  display: none !important;
}

.admin-login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(29, 91, 69, 0.08), transparent 42%),
    radial-gradient(circle at 80% 10%, #fff 0, transparent 32%),
    var(--paper);
}

.admin-login-card {
  width: min(420px, 100%);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 90px rgba(25, 30, 24, 0.1);
}

.admin-mark {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  overflow: hidden;
  border-radius: 20px;
  color: #fff;
  background: var(--ink);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  font-family: Georgia, serif;
  font-size: 28px;
}

.admin-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 19px;
}

.admin-mark.has-image {
  border: 1px solid var(--line);
  background-color: #fff;
  color: transparent;
}

.eyebrow {
  margin: 24px 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.admin-login h1,
.page-heading h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-weight: 500;
}

.admin-login h1 {
  font-size: clamp(26px, 6vw, 36px);
}

.intro {
  margin: 10px 0 28px;
  color: var(--muted);
  font-size: 14px;
}

label {
  display: grid;
  gap: 8px;
}

.admin-login label + label {
  margin-top: 16px;
}

label > span {
  color: #555a52;
  font-size: 12px;
  font-weight: 600;
}

input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: 0;
  background: #fbfbf8;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 91, 69, 0.1);
}

.primary-button {
  height: 50px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.admin-login .primary-button {
  width: 100%;
  margin-top: 22px;
}

.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 12px;
}

.form-message.error {
  color: var(--danger);
}

.back-link {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  text-decoration: none;
}

.admin-shell {
  min-height: 100dvh;
}

.admin-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(24px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(222, 223, 216, 0.9);
  background: rgba(243, 242, 237, 0.88);
  backdrop-filter: blur(18px);
}

.admin-identity,
.header-actions {
  display: flex;
  align-items: center;
}

.admin-identity {
  gap: 12px;
}

.admin-identity div:last-child {
  display: grid;
  gap: 2px;
}

.admin-identity p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.admin-identity strong {
  font-family: Georgia, serif;
}

.header-actions {
  gap: 8px;
}

.header-actions a,
.header-actions button {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  line-height: 36px;
  text-decoration: none;
  cursor: pointer;
}

.admin-content {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 58px 0 80px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-heading .eyebrow {
  margin-top: 0;
}

.page-heading h1 {
  font-size: clamp(34px, 5vw, 54px);
}

.page-heading > div > p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}

.monitor-card {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0, rgba(29, 91, 69, 0.08), transparent 32%),
    var(--card);
}

.monitor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.monitor-heading .eyebrow {
  margin: 0 0 8px;
}

.monitor-heading h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 26px;
  font-weight: 500;
}

.monitor-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-grid article {
  display: grid;
  gap: 8px;
  min-height: 92px;
  align-content: center;
  padding: 18px;
  border: 1px solid rgba(222, 223, 216, 0.8);
  border-radius: 18px;
  background: #fbfbf8;
}

.metric-grid span {
  color: var(--muted);
  font-size: 12px;
}

.metric-grid strong {
  font-family: Georgia, serif;
  font-size: 34px;
  line-height: 1;
}

.monitor-columns {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(360px, 1.4fr);
  gap: 16px;
}

.monitor-columns h3 {
  margin: 2px 0 10px;
  font-size: 13px;
}

.port-list,
.admin-task-list,
.history-list {
  display: grid;
  gap: 9px;
}

.port-item,
.admin-task-item,
.history-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.port-item {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.port-main,
.task-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.port-main strong,
.task-main strong {
  font-size: 13px;
}

.port-item p,
.task-meta,
.task-input,
.task-detail li {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.is-online,
.status-dot.is-running,
.status-dot.is-completed {
  color: var(--accent);
}

.status-dot.is-online::before,
.status-dot.is-running::before,
.status-dot.is-completed::before {
  background: var(--accent);
}

.status-dot.is-failed {
  color: var(--danger);
}

.status-dot.is-failed::before {
  background: var(--danger);
}

.admin-task-item > button {
  width: 100%;
  padding: 14px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.history-card {
  margin-bottom: 18px;
}

.history-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.history-summary {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto minmax(180px, auto);
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.history-thumb {
  display: grid;
  width: 82px;
  height: 52px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(222, 223, 216, 0.8);
  border-radius: 12px;
  color: var(--accent);
  background:
    linear-gradient(135deg, rgba(29, 91, 69, 0.08), transparent),
    #fbfbf8;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  font-family: Georgia, serif;
  font-weight: 700;
}

.history-thumb.has-image {
  color: transparent;
}

.history-copy {
  min-width: 0;
}

.history-copy strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.history-detail {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid rgba(222, 223, 216, 0.7);
}

.history-item.is-open .history-detail {
  display: block;
}

.history-detail ul {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.history-detail li {
  padding: 8px 10px;
  border-radius: 11px;
  color: var(--muted);
  background: #f8f8f4;
  font-size: 11px;
  line-height: 1.6;
}

.history-detail li.is-error {
  color: var(--danger);
  background: #fff3f1;
}

.history-detail li.is-success {
  color: var(--accent);
  background: var(--accent-soft);
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.task-actions.is-inline {
  min-width: 180px;
  justify-content: flex-end;
  margin-top: 0;
}

.task-action {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.task-action.is-primary {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.task-progress {
  height: 5px;
  overflow: hidden;
  margin-top: 10px;
  border-radius: 999px;
  background: #ecece7;
}

.task-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.task-detail {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid rgba(222, 223, 216, 0.7);
}

.admin-task-item.is-open .task-detail {
  display: block;
}

.task-detail ul {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.task-detail li {
  padding: 8px 10px;
  border-radius: 11px;
  background: #f8f8f4;
}

.task-detail li.is-error {
  color: var(--danger);
  background: #fff3f1;
}

.task-detail li.is-success {
  color: var(--accent);
  background: var(--accent-soft);
}

.task-detail li.is-warn {
  color: #8b6715;
  background: #fff8e5;
}

.empty-monitor {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #fbfbf8;
  font-size: 12px;
}

#settingsForm {
  display: grid;
  gap: 14px;
}

.settings-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.35fr);
  gap: 50px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}

.card-copy {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.section-number {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: Georgia, serif;
  font-size: 12px;
}

.card-copy h2 {
  margin: 4px 0 8px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 21px;
  font-weight: 500;
}

.card-copy p,
.logo-editor p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.card-fields {
  display: grid;
  gap: 20px;
}

.two-column {
  grid-template-columns: 1fr 1fr;
}

.logo-editor {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px dashed #cfd1c8;
  border-radius: 16px;
  background: #fafaf7;
}

.logo-preview {
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  color: white;
  background: var(--ink);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  font-family: Georgia, serif;
  font-size: 38px;
}

.logo-preview.has-image {
  border: 1px solid var(--line);
  background-color: white;
  color: transparent;
}

.logo-editor strong {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
}

.logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.upload-button,
.text-button {
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
  cursor: pointer;
}

.text-button {
  color: var(--muted);
}

.save-bar {
  position: sticky;
  z-index: 5;
  bottom: 14px;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(25, 30, 24, 0.1);
  backdrop-filter: blur(18px);
}

.save-bar .form-message {
  margin: 0;
}

.save-button {
  min-width: 170px;
  padding: 0 22px;
  background: var(--accent);
}

@media (max-width: 760px) {
  .admin-login-card {
    padding: 30px 24px;
  }

  .admin-header {
    padding-right: 14px;
    padding-left: 14px;
  }

  .header-actions a {
    display: none;
  }

  .admin-content {
    width: min(100% - 24px, 680px);
    padding-top: 32px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .status-pill {
    margin-top: 4px;
  }

  .settings-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 18px;
  }

  .monitor-card {
    padding: 20px 16px;
  }

  .monitor-heading {
    display: grid;
  }

  .metric-grid,
  .monitor-columns {
    grid-template-columns: 1fr;
  }

  .history-summary {
    grid-template-columns: 74px 1fr;
  }

  .history-summary .status-dot {
    grid-column: 2;
    justify-self: start;
  }

  .task-actions.is-inline {
    grid-column: 2;
    justify-content: flex-start;
  }

  .history-thumb {
    width: 74px;
    height: 48px;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .logo-editor {
    grid-template-columns: 72px 1fr;
    padding: 14px;
  }

  .logo-preview {
    width: 72px;
    height: 72px;
    border-radius: 20px;
  }

  .save-bar {
    justify-content: space-between;
  }

  .save-button {
    min-width: 150px;
  }
}

@media (max-width: 430px) {
  .page-heading .status-pill {
    display: none;
  }

  .logo-editor {
    grid-template-columns: 1fr;
  }

  .save-bar {
    display: grid;
  }

  .save-button {
    width: 100%;
  }
}
