: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: #f5f7fa;
}

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: #ffffff;
}

.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;
}

.personal-tasks {
  margin-top: 0;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #161616;
}

.personal-tasks-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  min-width: 0;
  padding: 18px 20px;
}

.personal-tasks-heading h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
}

.personal-tasks-heading p {
  margin-top: 4px;
  color: #525252;
  font-size: 14px;
  line-height: 1.5;
}

.personal-tasks-count {
  color: #0f62fe;
  font-variant-numeric: tabular-nums;
}

.personal-tasks-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.personal-tasks-actions button,
.personal-tasks-connect {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #0f62fe;
  border-radius: 0;
  background: #fff;
  color: #0f62fe;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.personal-tasks-actions button:disabled {
  color: #8d8d8d;
  border-color: #c6c6c6;
  cursor: wait;
}

.personal-tasks-connect[hidden],
.personal-tasks-logout[hidden] { display: none; }

.personal-tasks-actions button:focus-visible,
.personal-tasks-connect:focus-visible,
.personal-task-link:focus-visible {
  outline: 2px solid #0f62fe;
  outline-offset: 2px;
}

.personal-tasks-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-width: 0;
  margin: 0 20px 16px;
  padding: 12px 14px;
  border: 1px solid #f1c21b;
  border-left-width: 4px;
  background: #fcf4d6;
  color: #161616;
  font-size: 14px;
  line-height: 1.6;
}

.personal-tasks-alert[hidden] { display: none; }

.personal-tasks-alert p {
  flex: 1 1 260px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.personal-tasks-retry { flex: 0 0 auto; }

.personal-tasks-progress {
  display: block;
  width: 100%;
  height: 4px;
  border: 0;
  accent-color: #0f62fe;
}

.personal-tasks-progress[hidden] { display: none; }

.personal-tasks-sources {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin: 0 20px 16px;
  padding: 10px 14px 10px 32px;
  border-left: 4px solid #f1c21b;
  background: #fcf4d6;
  color: #161616;
  font-size: 14px;
  line-height: 1.6;
}

.personal-tasks-sources[hidden] { display: none; }

.personal-tasks-sources li {
  min-width: 0;
  overflow-wrap: anywhere;
}

.personal-tasks-list { min-width: 0; }

.personal-task-group {
  min-width: 0;
  border-top: 1px solid #e0e0e0;
}

.personal-task-group-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
  margin: 0;
  padding: 12px 20px 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.personal-task-group-count {
  color: #0f62fe;
  font-variant-numeric: tabular-nums;
}

.personal-task-row {
  display: grid;
  grid-template-columns: minmax(72px, 112px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid #e0e0e0;
  font-size: 14px;
  line-height: 1.5;
}

.personal-task-group-title + .personal-task-row {
  border-top: 0;
  padding-top: 6px;
}

.personal-task-stage {
  min-width: 0;
  color: #525252;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.personal-task-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.personal-task-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: #0f62fe;
  overflow-wrap: anywhere;
}

@media (max-width: 540px) {
  .personal-tasks-heading { padding: 16px; }
  .personal-tasks-alert,
  .personal-tasks-sources { margin: 0 16px 16px; }
  .personal-task-group-title { padding: 12px 16px 0; }
  .personal-task-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 16px;
  }
  .personal-task-stage { grid-column: 1 / -1; }
}

.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: auto;
}

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

body.home-page .page-shell {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: max-content max-content max-content;
  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(var(--service-rows, 1), minmax(min-content, 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(var(--service-rows, 1), minmax(min-content, 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;
  }
}

/* Aceternity UI layer */
:root {
  --ac-bg: #f6f8fb;
  --ac-surface: rgba(255, 255, 255, 0.9);
  --ac-soft: #f1f6f7;
  --ac-line: #dbe5e7;
  --ac-line-strong: #b9cdd0;
  --ac-ink: #16202e;
  --ac-muted: #60717d;
  --ac-accent: #0f766e;
  --ac-accent-strong: #0a5c56;
  --ac-shadow: 0 18px 45px rgba(14, 33, 45, 0.08);
}

body {
  background: var(--ac-bg);
  color: var(--ac-ink);
}

.topbar,
.service-card,
.admin-panel,
.login-card,
.settings-card,
.form-message {
  border-color: var(--ac-line);
  border-radius: 8px;
  background: var(--ac-surface);
  box-shadow: var(--ac-shadow);
}

.service-card,
.admin-panel,
.login-card,
.settings-card {
  position: relative;
  overflow: hidden;
}

.service-card::before,
.admin-panel::before,
.login-card::before,
.settings-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: rgba(15, 118, 110, 0.48);
}

.service-card {
  border-left-color: var(--ac-accent);
}

.service-mark,
.summary-pill {
  border-color: rgba(15, 118, 110, 0.24);
  background: #e4f7f3;
  color: var(--ac-accent);
}

.service-button,
.login-form button {
  border-radius: 8px;
  background: var(--ac-accent-strong);
  box-shadow: 0 12px 22px rgba(15, 118, 110, 0.16);
}

.admin-link,
.ghost-button {
  border-color: var(--ac-line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ac-ink);
}

.admin-link:hover,
.ghost-button:hover {
  border-color: var(--ac-accent);
  background: #e4f7f3;
  color: var(--ac-accent-strong);
}

input,
select {
  border-color: var(--ac-line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

input:focus,
select:focus {
  border-color: var(--ac-accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
  outline: none;
}

/* Tech industry Aceternity layer */
:root {
  --ac-bg: #f5f8fb;
  --ac-surface: rgba(255, 255, 255, 0.93);
  --ac-soft: #f0f6f8;
  --ac-line: #cfdae5;
  --ac-line-strong: #9fb4c7;
  --ac-ink: #111c2d;
  --ac-muted: #607083;
  --ac-accent: #00a6b2;
  --ac-accent-strong: #007d8c;
  --ac-blue: #2f6fed;
  --ac-amber: #d99012;
  --ac-shadow: 0 18px 46px rgba(7, 18, 33, 0.12);
  font-variant-numeric: tabular-nums;
}

body {
  background: #eef4f8;
}

.topbar {
  background: #0b2436;
  color: #eef9fb;
  border-color: rgba(159, 180, 199, 0.34);
  box-shadow: 0 18px 50px rgba(6, 18, 33, 0.18);
}

.topbar .brand-title,
.topbar .brand-subtitle {
  color: #eef9fb;
}

.service-card,
.admin-panel,
.login-card,
.settings-card,
.form-message {
  background: #f7fbfc;
  border-color: rgba(159, 180, 199, 0.5);
}

.service-card::before,
.admin-panel::before,
.login-card::before,
.settings-card::before {
  height: 2px;
  background: var(--ac-accent);
}

.service-button,
.login-form button {
  background: var(--ac-accent-strong);
  box-shadow: 0 12px 24px rgba(0, 166, 178, 0.2);
}

.admin-link,
.ghost-button {
  border-color: var(--ac-line-strong);
}

.admin-link:hover,
.ghost-button:hover {
  background: #e8fbfd;
  color: #006f7b;
}

/* Aceternity command deck skin */
:root {
  color-scheme: dark;
  --lh-bg: #050914;
  --lh-bg-2: #071322;
  --lh-panel: rgba(8, 17, 31, 0.78);
  --lh-panel-strong: rgba(10, 24, 42, 0.92);
  --lh-card: rgba(12, 27, 47, 0.82);
  --lh-text: #edf7ff;
  --lh-muted: #91a7bd;
  --lh-line: rgba(111, 229, 255, 0.2);
  --lh-line-strong: rgba(111, 229, 255, 0.38);
  --lh-accent: #19e6d2;
  --lh-blue: #4f8cff;
  --lh-amber: #f3b44b;
  --lh-danger: #ff6b6b;
  --lh-shadow: 0 24px 70px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --ac-bg: var(--lh-bg);
  --ac-surface: var(--lh-panel);
  --ac-card: var(--lh-card);
  --ac-ink: var(--lh-text);
  --ac-muted: var(--lh-muted);
  --ac-line: var(--lh-line);
  --ac-line-strong: var(--lh-line-strong);
  --ac-accent: var(--lh-accent);
  --ac-blue: var(--lh-blue);
  --ac-amber: var(--lh-amber);
}

html,
body {
  background: var(--lh-bg) !important;
  color: var(--lh-text) !important;
}

body {
  position: relative;
  background: var(--lh-bg) !important;
}

.topbar,
.page-shell,
.admin-shell,
.home-shell,
.modal-shell {
  position: relative;
  z-index: 1;
}

:is(.topbar, .admin-topbar, .masthead:not(.home-masthead)) {
  background: #081627 !important;
  border-color: var(--lh-line) !important;
  color: var(--lh-text) !important;
  box-shadow: none !important;
}

:is(.service-card, .admin-panel, .login-card, .settings-card, .form-message, .panel, .workspace, .status-card, .surface-card, .table-card) {
  background: #0d1c30 !important;
  border-color: var(--lh-line) !important;
  color: var(--lh-text) !important;
  box-shadow: none !important;
}

:is(.service-card, .admin-panel, .login-card, .settings-card, .panel, .workspace, .surface-card, .table-card)::before {
  background: var(--lh-accent) !important;
  box-shadow: none;
}

:is(h1, h2, h3, .brand-title, .service-copy h2, strong, label) {
  color: var(--lh-text) !important;
}

:is(p, .brand-subtitle, .section-heading p, .service-copy p, .muted, small) {
  color: var(--lh-muted) !important;
}

:is(input, select, textarea) {
  background: rgba(4, 12, 24, 0.78) !important;
  border-color: var(--lh-line) !important;
  color: var(--lh-text) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

:is(input, select, textarea):focus {
  border-color: var(--lh-accent) !important;
  box-shadow: 0 0 0 3px rgba(25, 230, 210, 0.14) !important;
  outline: none;
}

::placeholder {
  color: rgba(145, 167, 189, 0.76);
}

select option {
  background: #08111f;
  color: var(--lh-text);
}

:is(.service-button, .login-form button, .primary, .button.primary, button[type="submit"]) {
  border-color: rgba(25, 230, 210, 0.5) !important;
  background: #19e6d2 !important;
  color: #031018 !important;
  box-shadow: 0 16px 34px rgba(25, 230, 210, 0.22) !important;
}

:is(.admin-link, .ghost-button, .secondary, .button:not(.primary), .tab:not(.active), .icon-button) {
  background: rgba(10, 24, 42, 0.64) !important;
  border-color: var(--lh-line) !important;
  color: var(--lh-text) !important;
}

:is(.admin-link, .ghost-button, .secondary, .button:not(.primary), .tab:not(.active), .icon-button):hover {
  background: rgba(25, 230, 210, 0.12) !important;
  border-color: var(--lh-line-strong) !important;
  color: #ffffff !important;
}

:is(.summary-pill, .badge, .chip, .status) {
  background: rgba(25, 230, 210, 0.12) !important;
  border-color: rgba(25, 230, 210, 0.28) !important;
  color: #bffdf5 !important;
}

:is(table th, .data-table th, .responsive-lines th) {
  background: rgba(25, 230, 210, 0.1) !important;
  color: #c8f8ff !important;
  border-color: var(--lh-line) !important;
}

:is(table td, table tr) {
  border-color: var(--lh-line) !important;
}

@media (max-width: 760px) {
  :is(.topbar, .admin-topbar, .masthead, .intro-section, .section-heading) {
    grid-template-columns: 1fr !important;
    flex-direction: column;
    align-items: stretch !important;
    height: auto !important;
    min-height: 0 !important;
  }

  :is(.page-shell, .main, .main-container, .app-shell, .workspace) {
    width: 100% !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  :is(.service-grid, .service-card, .public-grid, .dashboard-grid, .page-grid, .admin-grid, .form-grid, .field-row, .reminder-time-grid) {
    grid-template-columns: 1fr !important;
  }

  .lead-control {
    grid-template-columns: minmax(0, 1fr) minmax(86px, 112px) !important;
  }
}

/* LIHONG_RESPONSIVE_GUARD_20260810 */
:where(.topbar, .page-shell, .intro-section, .section-heading, .service-grid, .service-card, .service-copy, .admin-panel, .admin-list, .admin-row, .admin-service-main, .login-form, .name-form) > * {
  min-width: 0;
}

:where(.brand-title, .brand-subtitle, .service-copy h2, .service-copy p, .admin-row strong, .admin-row span, .form-message) {
  overflow-wrap: anywhere;
}

:where(img, svg, iframe) {
  max-width: 100%;
}

:where(.admin-row, .section-heading, .intro-section) {
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  :where(.admin-link, .ghost-button, .service-button, .login-form button, .name-form button) {
    width: 100%;
    white-space: normal;
  }

  .admin-row :where(form, .name-form, .switch) {
    max-width: 100%;
  }
}

/* Service cards scroll as a page when the viewport cannot hold every service. */
body.home-page {
  overflow: auto;
}

body.home-page .service-button {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
  min-height: 44px;
}

@media (max-width: 520px), (max-height: 430px) and (max-width: 932px) {
  body.home-page {
    height: auto;
    min-height: 100dvh;
  }

  body.home-page .page-shell {
    flex: 0 0 auto;
    grid-template-rows: max-content max-content max-content;
  }

  body.home-page .service-grid {
    align-content: start;
    height: auto;
    grid-template-rows: none !important;
  }

  body.home-page .service-card {
    height: auto;
    min-height: 124px;
  }

  body.home-page .service-copy h2 {
    display: block;
    overflow: visible;
    overflow-wrap: anywhere;
    -webkit-line-clamp: unset;
  }
}

.operation-progress {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 6px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 24px);
  padding: 16px 18px;
  border: 1px solid rgba(25, 230, 210, 0.55);
  border-radius: 8px;
  background: #0d1c30;
  color: #edf7ff;
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.operation-progress[hidden] {
  display: none;
}

.operation-progress [data-operation-verify] {
  pointer-events: auto;
  min-height: 44px;
  white-space: normal;
}

.operation-progress [data-operation-verify][hidden] {
  display: none;
}

.operation-progress strong {
  color: #bffdf5 !important;
  font-size: 15px;
}

.operation-progress span {
  color: #edf7ff;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.operation-progress [data-operation-message] {
  min-height: 0;
  max-height: min(180px, calc(100dvh - 156px));
  overflow-y: auto;
  pointer-events: auto;
}

@media (max-height: 430px) {
  .operation-progress {
    gap: 4px;
    padding: 8px 12px;
  }

  .operation-progress [data-operation-message] {
    max-height: 48px;
  }
}

.operation-progress-bar {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.28);
}

.operation-progress-bar .operation-progress-fill {
  display: block;
  width: 35%;
  height: 100%;
  background: #19e6d2;
  animation: index-operation-progress 1.5s ease-in-out infinite;
}

@keyframes index-operation-progress {
  from { transform: translateX(-100%); }
  to { transform: translateX(300%); }
}

.operation-progress[data-phase="error"] .operation-progress-bar,
.operation-progress[data-phase="unconfirmed"] .operation-progress-bar,
.operation-progress[data-phase="refresh-error"] .operation-progress-bar,
.operation-progress[data-phase="success"] .operation-progress-bar {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .operation-progress-bar .operation-progress-fill { animation: none; width: 100%; }
}

.operation-progress[data-phase="error"],
.operation-progress[data-phase="unconfirmed"],
.operation-progress[data-phase="refresh-error"] {
  border-color: rgba(255, 107, 107, 0.78);
}

.operation-progress[data-phase="error"] strong,
.operation-progress[data-phase="unconfirmed"] strong,
.operation-progress[data-phase="refresh-error"] strong {
  color: #ffd1d1 !important;
}

@media (max-width: 600px) {
  .operation-progress {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (max-height: 430px) and (max-width: 932px) {
  body.home-page {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  body.home-page .service-grid {
    grid-template-rows: none;
  }
}

/* Contrast hardening for the service index and MIS service controls. */
:root {
  --lh-readable-muted: #bccdde;
  --lh-readable-disabled: #c1d0de;
}

:is(.service-card, .status-card, .settings-card, .table-card, .form-message) {
  color: var(--lh-text) !important;
}

:is(.brand-subtitle, .section-heading p, .service-copy p, .muted, small, .form-message p) {
  color: var(--lh-readable-muted) !important;
}

table tbody tr {
  background: rgba(5, 15, 29, 0.86) !important;
}

table tbody tr:nth-child(even) {
  background: rgba(10, 25, 43, 0.9) !important;
}

table td {
  color: var(--lh-text) !important;
}

button:disabled,
.service-button:disabled,
.ghost-button:disabled,
.icon-button:disabled {
  opacity: 1 !important;
  background: rgba(30, 43, 59, 0.92) !important;
  border-color: rgba(148, 163, 184, 0.36) !important;
  color: var(--lh-readable-disabled) !important;
}

/* LIHONG_UI_FOUNDATION: a full-page internal service launcher. */
:root {
  --index-surface: #0d1c30;
  --index-surface-raised: #10243d;
  --index-control: #061323;
  --index-border: #31536f;
  --index-muted: #b8cadb;
  /* 2026-11-17 contrast (WCAG 2.2 AA): control outlines need >= 3:1 against the panel
     (#31536f / translucent --lh-line were 1.6-2.2:1), secondary admin text >= 4.5:1
     (#667583 was 3.72:1 on #0b192c). Same steel-blue / slate hues, lightened. */
  --index-control-border: #6187a6;
  --index-subtle: #8193a5;
}

body[data-index-workbench] {
  background: #050914;
}

body[data-index-workbench] .topbar {
  background: #081627 !important;
  border-color: var(--index-border) !important;
  box-shadow: none !important;
}

body[data-index-workbench] .page-shell {
  background: #050914;
}

body[data-index-workbench] .personal-tasks {
  background: #0d1c30;
  border-color: #31536f;
  color: #f3f8fc;
}

body[data-index-workbench] .personal-tasks-heading p,
body[data-index-workbench] .personal-task-stage {
  color: #b8cadb !important;
}

body[data-index-workbench] .personal-tasks-count,
body[data-index-workbench] .personal-task-group-count,
body[data-index-workbench] .personal-task-link {
  color: #78a9ff;
}

body[data-index-workbench] .personal-task-row,
body[data-index-workbench] .personal-task-group { border-color: #31536f; }

body[data-index-workbench] .personal-tasks-sources {
  background: #2a2310;
  border-color: #f1c21b;
  color: #fdf6dd;
}

body[data-index-workbench] .personal-tasks-alert {
  background: #2a2310;
  border-color: #f1c21b;
  color: #fdf6dd;
}

body[data-index-workbench] .personal-tasks .personal-tasks-alert p { color: #fdf6dd !important; }

body[data-index-workbench] .personal-tasks-actions button,
body[data-index-workbench] .personal-tasks-connect {
  background: #10243d;
  color: #d0e2ff;
  border-color: #78a9ff;
}

.service-grid[data-service-launcher-grid] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-grid[data-service-launcher-grid] .service-card,
.admin-panel[data-admin-control-workbench] {
  background: var(--index-surface) !important;
  border-color: var(--index-border) !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.service-grid[data-service-launcher-grid] .service-card:hover {
  background: var(--index-surface-raised) !important;
  border-color: var(--accent, #19e6d2) !important;
}

.service-grid[data-service-launcher-grid] .service-mark {
  background: #10243d !important;
}

.admin-panel[data-admin-control-workbench] .admin-row,
.admin-panel[data-admin-control-workbench] .admin-list {
  background: #0b192c;
  border-color: var(--index-border);
}

body[data-index-workbench] :is(input, select, textarea) {
  background: var(--index-control) !important;
  border-color: var(--index-control-border) !important;
}

body[data-index-workbench] :is(.admin-link, .ghost-button) {
  border-color: var(--index-control-border) !important;
}

body[data-index-workbench] :is(.admin-link, .ghost-button):hover {
  border-color: var(--index-muted) !important;
}

.admin-panel[data-admin-control-workbench] .admin-row span:not(.slider) {
  color: var(--index-subtle);
}

.admin-panel[data-admin-control-workbench] .admin-row label > span {
  color: var(--index-muted);
}

body[data-index-workbench] :is(p, .brand-subtitle, .section-heading p, .service-copy p, .muted, small) {
  color: var(--index-muted) !important;
}

body[data-index-workbench] :is(h1, h2, h3, .brand-title, .service-copy h2, strong, label) {
  color: #f3f8fc !important;
}

body[data-index-workbench] :is(button, a, input, select, textarea):focus-visible {
  outline: 3px solid #f3b44b;
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .service-grid[data-service-launcher-grid] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.home-page .admin-link {
    align-self: center;
    flex: 0 0 auto;
    width: auto;
  }

}

@media (max-width: 760px) {
  body.home-page .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(var(--service-rows, 1), minmax(0, 1fr));
  }

  body.home-page .service-card {
    gap: 4px;
    padding: 7px;
  }

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

  body.home-page .service-mark {
    height: 22px;
    width: 28px;
  }

  .service-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }

  :is(button, .admin-link, .login-form button, .name-form button, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
    min-height: 44px;
    max-width: 100%;
  }
}

/* Final low-height override follows the visual foundation layer. */
@media (max-width: 520px), (max-height: 430px) and (max-width: 932px) {
  body.home-page .service-grid {
    align-content: start;
    height: auto;
    grid-template-rows: none !important;
  }
}
