:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --surface-warm: #fff4cf;
  --text: #172027;
  --muted: #69747d;
  --line: #dfe4e1;
  --accent: #0e7c66;
  --accent-dark: #075c4c;
  --yellow: #ffd91f;
  --ink: #1c252d;
  --blue: #2f6f9f;
  --shadow: 0 20px 50px rgba(18, 32, 41, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

img {
  display: block;
  max-width: 100%;
}

button,
a {
  font: inherit;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px clamp(18px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  letter-spacing: 0;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

nav a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
}

nav a:hover {
  background: var(--surface-soft);
  color: var(--accent-dark);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.75fr);
  align-items: center;
  gap: clamp(28px, 6vw, 76px);
  min-height: calc(100vh - 72px);
  padding: clamp(42px, 7vw, 86px) clamp(18px, 5vw, 64px);
  background:
    linear-gradient(90deg, rgba(255, 217, 31, 0.86) 0 42%, rgba(246, 247, 244, 0) 42%),
    var(--bg);
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12em;
  margin-bottom: 18px;
  color: var(--ink);
  font-size: clamp(40px, 6.8vw, 78px);
  line-height: 1.03;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin-bottom: 30px;
  color: #31404b;
  font-size: 18px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.secondary-action,
.credential-card button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 7px;
  cursor: pointer;
}

.primary-action {
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

.primary-action:hover,
.credential-card button:hover {
  background: var(--accent-dark);
}

.secondary-action {
  padding: 0 20px;
  border: 1px solid #b7c3bd;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-weight: 700;
}

.phone-preview {
  justify-self: center;
  width: min(100%, 390px);
  margin: 0;
}

.phone-preview img {
  width: 100%;
  filter: drop-shadow(var(--shadow));
}

.section {
  padding: clamp(48px, 7vw, 86px) clamp(18px, 5vw, 64px);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.14;
  letter-spacing: 0;
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.account-band {
  background: var(--surface);
}

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

.credential-card {
  display: grid;
  gap: 14px;
  min-height: 170px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

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

.credential-card strong {
  align-self: center;
  overflow-wrap: anywhere;
  font-size: 20px;
  letter-spacing: 0;
}

.credential-card button {
  align-self: end;
  width: 100%;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

.workflow-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 360px);
  align-items: start;
  gap: clamp(24px, 5vw, 54px);
}

.steps {
  display: grid;
  gap: 14px;
}

.step-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.step-item > span,
.stage-grid span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
}

.step-item h3,
.stage-grid h3 {
  margin-bottom: 8px;
  font-size: 19px;
  letter-spacing: 0;
}

.step-item p,
.stage-grid p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.screen-frame {
  margin: 0;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.screen-frame img {
  width: 100%;
}

.guide-band {
  background: var(--surface-soft);
}

.wide-shot,
.permission-shot {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.wide-shot img {
  width: 100%;
}

.split {
  display: grid;
  grid-template-columns: minmax(270px, 0.42fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(22px, 5vw, 54px);
}

.compact {
  margin-bottom: 0;
}

.permission-shot img {
  width: 100%;
}

.stages-band {
  background: var(--ink);
  color: #fff;
}

.stages-band .eyebrow {
  color: var(--yellow);
}

.stages-band .section-heading p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.72);
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.stage-grid article {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 244px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.stage-grid p {
  color: rgba(255, 255, 255, 0.72);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(340px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1060px) {
  .credential-grid,
  .stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-grid article {
    min-height: 190px;
  }
}

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

  nav {
    justify-content: flex-start;
  }

  .hero,
  .workflow-layout,
  .split {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    background:
      linear-gradient(180deg, rgba(255, 217, 31, 0.9) 0 42%, rgba(246, 247, 244, 0) 42%),
      var(--bg);
  }

  h1 {
    font-size: clamp(36px, 12vw, 54px);
  }

  .phone-preview {
    width: min(100%, 330px);
  }
}

@media (max-width: 560px) {
  .credential-grid,
  .stage-grid {
    grid-template-columns: 1fr;
  }

  .step-item {
    grid-template-columns: 1fr;
  }

  .section,
  .hero {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.project-home {
  min-height: 100vh;
  background: var(--bg);
}

.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
  min-height: 100vh;
  padding: clamp(32px, 7vw, 84px) clamp(18px, 5vw, 72px);
  background:
    linear-gradient(90deg, rgba(255, 217, 31, 0.9) 0 38%, transparent 38%),
    var(--bg);
}

.project-summary {
  display: grid;
  gap: 12px;
}

.project-summary div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(18, 32, 41, 0.08);
}

.project-summary span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.project-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.project-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  background: #f4f6f5;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  overflow-y: auto;
  background: var(--ink);
  color: #fff;
}

.admin-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.admin-logo small,
.admin-nav h2 {
  color: rgba(255, 255, 255, 0.62);
}

.admin-logo strong,
.admin-logo small {
  display: block;
}

.admin-nav {
  display: grid;
  gap: 18px;
}

.admin-nav section {
  display: grid;
  gap: 6px;
}

.admin-nav h2 {
  margin: 0 0 4px;
  padding: 0 8px;
  font-size: 12px;
  letter-spacing: 0;
}

.admin-nav button {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  text-align: left;
}

.admin-nav button:hover,
.admin-nav button.is-active {
  background: rgba(255, 217, 31, 0.14);
  color: #fff;
}

.admin-main {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 22px;
}

.admin-header,
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-header h1,
.panel-toolbar h2 {
  margin-bottom: 0;
  letter-spacing: 0;
}

.admin-header h1 {
  font-size: 32px;
}

.admin-header-actions,
.toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.admin-header .primary-action,
.admin-header .secondary-action {
  min-height: 40px;
  border: 0;
}

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

.admin-metrics article,
.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(18, 32, 41, 0.06);
}

.admin-metrics article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.admin-metrics span,
.panel-toolbar p {
  color: var(--muted);
}

.admin-metrics strong {
  font-size: 30px;
  line-height: 1;
}

.admin-panel {
  min-width: 0;
  padding: 18px;
}

.panel-toolbar {
  margin-bottom: 16px;
}

.panel-toolbar p {
  margin: 6px 0 0;
}

.toolbar-controls input {
  width: min(280px, 100%);
  height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
}

.toolbar-controls button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.row-actions button:hover {
  border-color: #8ca08e;
  background: #f5f8f5;
}

.row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.cell-input {
  width: 100%;
  min-width: 120px;
  height: 32px;
  padding: 6px 8px;
  border: 1px solid #b7c5b7;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.table-wrap {
  min-width: 0;
  overflow-x: auto;
}

#data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

#data-table th,
#data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

#data-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

#data-table td {
  font-size: 14px;
}

#data-table tr:hover td {
  background: #f9fbfa;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
}

.admin-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 18px;
}

.admin-detail p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.admin-detail pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  border-radius: 8px;
  background: #111820;
  color: #e7f5ef;
}

.mobile-body {
  min-height: 100vh;
  background: #e8ece9;
}

.phone-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 14px 86px;
  background: #f7f8f6;
  box-shadow: 0 0 45px rgba(18, 32, 41, 0.16);
}

.tablet-shell {
  width: min(100%, 980px);
}

.mobile-hero {
  margin: 0 -14px;
  padding: 18px 18px 30px;
  background: var(--yellow);
}

.mobile-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.mobile-topline a {
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
}

.mobile-hero h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.1;
}

.mobile-hero p {
  max-width: 320px;
  margin: 0;
  color: #3e3f35;
  line-height: 1.55;
}

.mobile-card,
.mobile-list-item,
.mobile-menu a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quote-card {
  display: grid;
  gap: 16px;
  margin-top: -16px;
  padding: 18px;
  box-shadow: 0 12px 28px rgba(18, 32, 41, 0.1);
}

.quote-card span {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.quote-card h2,
.mobile-section h2 {
  margin: 6px 0 8px;
  font-size: 22px;
  letter-spacing: 0;
}

.quote-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.quote-card button {
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.mobile-section {
  margin-top: 22px;
}

.mobile-entry-shell {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.mobile-module-panel,
.mobile-entry-form,
.mobile-recent-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.mobile-module-panel label,
.mobile-field span,
.mobile-entry-form > div:first-child span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mobile-module-panel select {
  width: 100%;
  height: 42px;
  margin-top: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--ink);
  font-weight: 750;
}

.mobile-module-list {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.mobile-module-list button {
  min-width: max-content;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-weight: 750;
}

.mobile-module-list button.is-active {
  border-color: var(--accent);
  background: #edf7ee;
  color: var(--accent-dark);
}

.mobile-entry-form h2,
.mobile-panel-title h2 {
  margin: 5px 0 6px;
  font-size: 22px;
  letter-spacing: 0;
}

.mobile-entry-form p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.mobile-form-fields {
  display: grid;
  gap: 10px;
}

.mobile-field {
  display: grid;
  gap: 6px;
}

.mobile-field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 15px;
}

.mobile-field input:focus,
.mobile-module-panel select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(64, 145, 88, 0.18);
}

.mobile-form-actions {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  margin-top: 14px;
}

.mobile-form-actions button,
.mobile-panel-title button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  font-weight: 800;
}

.mobile-form-actions button:first-child {
  background: var(--accent);
  color: #fff;
}

.mobile-form-actions button:last-child,
.mobile-panel-title button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.mobile-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mobile-recent-list {
  display: grid;
  gap: 9px;
}

.mobile-recent-item {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
}

.mobile-recent-item strong {
  font-size: 14px;
}

.mobile-recent-item span,
.mobile-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mobile-list,
.mobile-menu {
  display: grid;
  gap: 10px;
}

.mobile-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
}

.mobile-list-item strong,
.mobile-list-item span {
  display: block;
}

.mobile-list-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mobile-list-item em {
  min-width: max-content;
  color: var(--accent-dark);
  font-style: normal;
  font-weight: 800;
}

.mobile-menu a {
  padding: 14px;
  font-weight: 750;
}

.mobile-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 430px);
  margin: 0 auto;
  border-top: 1px solid var(--line);
  background: #fff;
}

@media (min-width: 760px) {
  .tablet-shell {
    padding-right: 20px;
    padding-left: 20px;
  }

  .tablet-shell .mobile-hero {
    margin-right: -20px;
    margin-left: -20px;
    padding-right: 28px;
    padding-left: 28px;
  }

  .tablet-shell .mobile-hero p {
    max-width: 640px;
  }

  .mobile-entry-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: start;
  }

  .mobile-entry-form {
    grid-row: span 2;
  }

  .mobile-module-list {
    display: grid;
    max-height: 360px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .mobile-module-list button {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .mobile-form-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-tabs {
    width: min(100%, 980px);
  }
}

.mobile-tabs a {
  padding: 13px 6px 15px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.mobile-tabs a:first-child {
  color: var(--accent-dark);
}

@media (max-width: 980px) {
  .project-hero,
  .admin-detail {
    grid-template-columns: 1fr;
  }

  .admin-body {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .admin-header,
  .panel-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-header-actions,
  .toolbar-controls {
    justify-content: flex-start;
    width: 100%;
  }

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

  .admin-nav {
    grid-template-columns: 1fr;
  }
}
