:root {
  color-scheme: light;
  font-family:
    "Noto Sans TC",
    "Microsoft JhengHei",
    "PingFang TC",
    "Segoe UI",
    sans-serif;
  background: #f5f7fa;
  color: #17212b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f7fa 42%, #edf3f2 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid #dbe5e8;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: min(280px, 38vw);
  height: 54px;
  border-radius: 0;
  object-fit: contain;
  object-position: left center;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-title {
  color: #10212c;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-subtitle {
  color: #5d6b78;
  font-size: 13px;
  line-height: 1.3;
}

.admin-link,
.ghost-button {
  border: 1px solid #bdd1d0;
  border-radius: 8px;
  background: #ffffff;
  color: #0f766e;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 38px 0 56px;
}

.intro-section,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

h1,
h2,
p {
  margin: 0;
}

.intro-section h1 {
  color: #0f1f2a;
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 900;
  line-height: 1.06;
}

.intro-section p,
.section-heading p {
  margin-top: 10px;
  color: #5d6b78;
  font-size: 17px;
  line-height: 1.6;
}

.summary-pill {
  flex: 0 0 auto;
  border: 1px solid #b8d8d3;
  border-radius: 999px;
  background: #e9f7f4;
  color: #0f766e;
  font-size: 15px;
  font-weight: 800;
  padding: 10px 15px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.service-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 124px;
  padding: 20px;
  border: 1px solid #dce5e8;
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(15, 31, 42, 0.06);
}

.service-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 14%, #ffffff);
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

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

.service-copy h2 {
  color: #122331;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.25;
}

.service-copy p {
  margin-top: 8px;
  color: #5b6874;
  font-size: 15px;
  line-height: 1.5;
}

.service-button,
.login-form button {
  border: 0;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  padding: 12px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.service-button:hover,
.login-form button:hover {
  background: #0d625c;
}

.admin-panel {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid #d8e3e5;
  border-radius: 8px;
  background: #ffffff;
}

.section-heading {
  align-items: center;
}

.section-heading h2 {
  color: #122331;
  font-size: 26px;
  font-weight: 900;
}

.login-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 14px;
  margin-top: 22px;
}

.form-title {
  grid-column: 1 / -1;
  margin: 0;
  color: #122331;
  font-size: 20px;
  font-weight: 900;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: #435260;
  font-size: 14px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  border: 1px solid #c9d5da;
  border-radius: 8px;
  color: #17212b;
  font-size: 17px;
  padding: 12px;
}

.form-message {
  grid-column: 1 / -1;
  min-height: 20px;
  color: #b91c1c;
  font-size: 15px;
}

.admin-list {
  display: grid;
  margin-top: 20px;
  border: 1px solid #dce5e8;
  border-radius: 8px;
  overflow: hidden;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid #e8eef0;
}

.admin-row:last-child {
  border-bottom: 0;
}

.admin-row strong,
.admin-row span {
  display: block;
}

.admin-service-main {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-row strong {
  color: #132330;
  font-size: 17px;
}

.admin-row span {
  margin-top: 5px;
  color: #667583;
  font-size: 13px;
  word-break: break-all;
}

.name-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 10px;
  max-width: 560px;
}

.name-form label {
  display: grid;
  gap: 6px;
  color: #435260;
  font-size: 13px;
  font-weight: 800;
}

.name-form input {
  width: 100%;
  border: 1px solid #cbd7dc;
  border-radius: 8px;
  color: #132330;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 11px;
}

.name-form button {
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: #ffffff;
  color: #0f766e;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

.service-url,
.service-base-name {
  max-width: 620px;
}

.service-base-name {
  color: #7a8895;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #17212b;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slider {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5dc;
  transition: background 160ms ease;
}

.slider::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + .slider {
  background: #0f766e;
}

.switch input:checked + .slider::after {
  transform: translateX(20px);
}

.admin-note {
  margin-top: 14px;
  color: #687786;
  font-size: 14px;
}

@media (max-width: 860px) {
  .topbar,
  .intro-section,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-link {
    align-self: stretch;
    text-align: center;
  }

  .service-grid,
  .login-form {
    grid-template-columns: 1fr;
  }

  .service-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .service-button {
    text-align: center;
  }

  .admin-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .name-form {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .brand-title {
    font-size: 19px;
  }

  .brand-logo {
    width: min(210px, 58vw);
    height: 42px;
  }

  .admin-panel,
  .service-card {
    padding: 16px;
  }
}

body.home-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

body.home-page .topbar {
  position: relative;
  flex: 0 0 auto;
}

body.home-page .page-shell {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(12px, 2vh, 22px);
  min-height: 0;
  padding: clamp(14px, 3vh, 32px) 0 clamp(12px, 2.5vh, 28px);
  width: min(1240px, calc(100% - 36px));
}

body.home-page .intro-section {
  min-height: 0;
}

body.home-page .intro-section h1 {
  font-size: clamp(28px, 3.6vw, 48px);
}

body.home-page .service-grid {
  grid-template-rows: repeat(4, minmax(0, 1fr));
  height: 100%;
  margin-top: 0;
  min-height: 0;
}

body.home-page .service-card {
  height: 100%;
  min-height: 0;
  padding: clamp(12px, 2vh, 20px);
}

@media (max-width: 860px) {
  body.home-page .topbar {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    min-height: 64px;
    padding: 8px 12px;
  }

  body.home-page .brand {
    flex: 1 1 auto;
    gap: 8px;
  }

  body.home-page .brand-logo {
    height: 34px;
    width: min(150px, 40vw);
  }

  body.home-page .brand-copy {
    display: none;
  }

  body.home-page .admin-link {
    align-self: auto;
    flex: 0 0 auto;
    font-size: 13px;
    padding: 8px 10px;
  }

  body.home-page .page-shell {
    gap: 8px;
    padding: 10px 0;
    width: min(100% - 18px, 1180px);
  }

  body.home-page .intro-section {
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }

  body.home-page .intro-section h1 {
    font-size: 22px;
    line-height: 1.1;
  }

  body.home-page .intro-section p {
    display: none;
  }

  body.home-page .summary-pill {
    font-size: 12px;
    padding: 6px 8px;
  }

  body.home-page .service-grid {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

  body.home-page .service-card {
    align-items: start;
    gap: 6px;
    grid-template-columns: 1fr;
    padding: 9px;
  }

  body.home-page .service-mark {
    font-size: 11px;
    height: 28px;
    width: 32px;
  }

  body.home-page .service-copy h2 {
    display: -webkit-box;
    font-size: 15px;
    line-height: 1.2;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body.home-page .service-copy p {
    display: -webkit-box;
    font-size: 11px;
    line-height: 1.25;
    margin-top: 4px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body.home-page .service-button {
    align-self: end;
    font-size: 12px;
    padding: 7px 8px;
    text-align: center;
    width: 100%;
  }
}

@media (max-width: 380px) {
  body.home-page .service-copy p {
    -webkit-line-clamp: 1;
  }

  body.home-page .service-copy h2 {
    font-size: 14px;
  }
}
