:root {
  --bg: #f7f2eb;
  --paper: #fffdf9;
  --panel: #ffffff;
  --ink: #27231f;
  --muted: #70665d;
  --line: #ded3c7;
  --accent: #356b60;
  --accent-strong: #255349;
  --warm: #c87d4f;
  --good: #e7f5ef;
  --shadow: 0 18px 45px rgba(65, 52, 39, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 22px 16px 54px;
}

.topbar,
.hero,
.panel,
.drawer-panel,
.service-card,
.lead-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--warm);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: clamp(30px, 7vw, 52px);
}

h2 {
  font-size: clamp(24px, 4vw, 36px);
}

h3 {
  font-size: 18px;
}

p {
  color: var(--muted);
  line-height: 1.72;
}

.tagline {
  margin: 8px 0 0;
}

.icon-button {
  min-width: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(53, 107, 96, 0.09), rgba(200, 125, 79, 0.08)),
    var(--paper);
}

.hero p {
  margin-bottom: 0;
}

.hero-actions {
  display: grid;
  gap: 10px;
  min-width: 190px;
}

.line-link,
.primary,
.secondary,
.ghost {
  border: 0;
  border-radius: 6px;
  padding: 12px 15px;
  font-weight: 900;
  text-decoration: none;
  text-align: center;
}

.line-link,
.primary {
  background: var(--accent);
  color: #fff;
}

.line-link:hover,
.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: var(--warm);
  color: #fff;
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.tabs.compact {
  margin-top: 18px;
}

.tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

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

.view,
.admin-view {
  display: none;
}

.view.is-active,
.admin-view.is-active {
  display: block;
}

.panel {
  padding: 18px;
}

.field {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 7px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 107, 96, 0.12);
}

textarea {
  min-height: 104px;
  resize: vertical;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
}

.check input {
  width: auto;
  margin-top: 6px;
}

.success {
  margin-top: 14px;
  background: var(--good);
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  margin: 12px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.faq-item strong {
  display: block;
  margin-bottom: 6px;
}

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

.service-card {
  padding: 16px;
  min-height: 168px;
}

.service-card strong {
  display: block;
  color: var(--accent);
  font-size: 18px;
  margin-bottom: 8px;
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(30, 25, 20, 0.48);
  padding: 12px;
  z-index: 30;
  overflow: auto;
}

.drawer.is-open {
  display: block;
}

.drawer-panel {
  width: min(980px, 100%);
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin-left: auto;
  padding: 18px;
  box-shadow: var(--shadow);
}

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

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-note {
  margin-bottom: 12px;
}

.admin-note p {
  margin: 6px 0 0;
}

.admin-actions select {
  max-width: 180px;
}

.lead-list {
  display: grid;
  gap: 10px;
}

.lead-card {
  padding: 14px;
  background: #fff;
}

.lead-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

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

.meta-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--paper);
}

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

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

.lead-actions button,
.lead-actions select {
  width: auto;
  min-height: 38px;
  padding: 8px 10px;
}

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

.muted {
  background: #fbf8f4;
}

.script-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.script-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px 10px 40px;
  }

  .topbar,
  .hero,
  .drawer-head {
    display: block;
  }

  .topbar .icon-button,
  .line-link,
  .hero-actions {
    margin-top: 12px;
    width: 100%;
  }

  .line-link,
  .hero-actions .secondary {
    display: block;
    width: 100%;
  }

  .split,
  .service-grid,
  .lead-meta {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: 1fr;
  }
}
