/* 迪高售後服務 — mobile-first */
:root {
  --bg: #faf7f2;
  --text: #3a241e;
  --secondary: #b96f36;
  --gold: #edbf75;
  --cta: #e53935;
  --accent: #009196;
  --white: #ffffff;
  --muted: rgba(58, 36, 30, 0.62);
  --border: rgba(58, 36, 30, 0.12);
  --card-shadow: 0 8px 28px rgba(58, 36, 30, 0.06);
  --radius: 16px;
  --radius-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --header-h: 56px;
  --nav-h: 64px;
  --font-serif: "Noto Serif TC", "Songti TC", serif;
  --font-sans: "Noto Sans TC", "Noto Sans HK", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--secondary);
  text-decoration: none;
}

a:hover {
  color: var(--cta);
}

button,
input {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
.serif {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.app-header .logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.app-header .title {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .btn-ghost {
  border: none;
  background: transparent;
  color: var(--secondary);
  padding: 8px 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.main {
  flex: 1;
  padding: 20px 16px calc(var(--nav-h) + var(--safe-b) + 20px);
}

.main.auth-only {
  padding-bottom: 32px;
  display: flex;
  align-items: center;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 0 8px var(--safe-b);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 30;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 8px 2px;
  text-align: center;
  line-height: 1.2;
}

.bottom-nav a.active {
  color: var(--text);
}

.bottom-nav a svg {
  width: 22px;
  height: 22px;
}

.bottom-nav a.active svg {
  stroke: var(--cta);
}

.hidden {
  display: none !important;
}

/* Welcome / Login */
.welcome {
  width: 100%;
  text-align: center;
  padding: 12px 4px 24px;
}

.welcome-logo,
.logo-welcome {
  width: 252px; /* ~70% larger than prior 148px (Kelvin 10/10) */
  max-width: 72vw;
  margin: 0 auto 20px;
  height: auto;
}

.welcome-tag {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 0 0 8px;
  color: var(--text);
}

.welcome-sub {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0 0 28px;
}

.gold-line {
  width: 48px;
  height: 2px;
  background: var(--gold);
  margin: 0 auto 28px;
  border-radius: 2px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  text-align: left;
}

.card + .card {
  margin-top: 14px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 8px 0 0;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
}

.input-row:focus-within {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(185, 111, 54, 0.15);
}

.input-prefix {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.input-row input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 12px 0;
  letter-spacing: 0.06em;
}

.otp-input {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 0.35em;
  font-weight: 600;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 14px;
  outline: none;
}

.otp-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(185, 111, 54, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-cta {
  background: var(--cta);
  color: var(--white);
}

.btn-cta:hover {
  background: #d32f2f;
  color: var(--white);
}

.btn-secondary {
  background: var(--text);
  color: var(--bg);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.btn-wa {
  background: #25d366;
  color: #fff;
}

.btn-tel {
  background: var(--text);
  color: var(--bg);
}

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

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  padding: 10px;
  font-size: 0.9rem;
}

.error-msg {
  color: var(--cta);
  font-size: 0.85rem;
  margin: 10px 0 0;
  min-height: 1.2em;
}

.demo-banner {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(0, 145, 150, 0.08);
  border: 1px dashed rgba(0, 145, 150, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text);
  text-align: left;
}

.demo-banner strong {
  color: var(--accent);
}

/* Section headers */
.section-head {
  margin-bottom: 16px;
}

.section-head h1 {
  font-size: 1.45rem;
  margin: 0 0 6px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  margin: 0 0 6px;
}

/* Project list */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--card-shadow);
  color: inherit;
  transition: border-color 0.15s ease;
}

.project-card:hover {
  border-color: var(--gold);
  color: inherit;
}

.project-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(237, 191, 117, 0.28);
  color: var(--text);
}

.badge-done {
  background: rgba(0, 145, 150, 0.12);
  color: var(--accent);
}

.badge-warn {
  background: rgba(229, 57, 53, 0.1);
  color: var(--cta);
}

.project-card h2 {
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.project-card .addr,
.project-card .date {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.chevron {
  color: var(--gold);
  font-size: 1.1rem;
}

/* Project detail */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--secondary);
  font-size: 0.9rem;
  margin-bottom: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.detail-hero {
  margin-bottom: 18px;
}

.detail-hero h1 {
  font-size: 1.35rem;
  margin: 8px 0 10px;
}

.info-grid {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  border-bottom: none;
}

.info-row dt {
  color: var(--muted);
  margin: 0;
}

.info-row dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 12px;
}

.block-title h2 {
  font-size: 1.1rem;
  margin: 0;
}

.block-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.block-title .dot.warn {
  background: var(--cta);
}

.scope-list,
.supplier-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scope-item,
.supplier-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.scope-item h3,
.supplier-card h3 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.scope-item .period {
  font-size: 0.82rem;
  color: var(--secondary);
  margin: 0 0 6px;
}

.scope-item .note,
.supplier-card .note {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.supplier-card {
  cursor: pointer;
  text-align: left;
  width: 100%;
}

.supplier-card:hover {
  border-color: var(--gold);
}

.supplier-card .brand-line {
  font-size: 0.88rem;
  margin: 0 0 8px;
  color: var(--text);
}

.label-non {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(229, 57, 53, 0.08);
  color: var(--cta);
  border: 1px solid rgba(229, 57, 53, 0.2);
}

/* Supplier detail */
.contact-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.contact-lines a,
.contact-lines span {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.92rem;
}

.contact-lines a:hover {
  background: rgba(185, 111, 54, 0.1);
  color: var(--secondary);
}

.placeholder-note {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(237, 191, 117, 0.2);
  border: 1px solid rgba(237, 191, 117, 0.55);
  font-size: 0.8rem;
  color: var(--text);
}

/* About */
.about-card {
  text-align: center;
  padding: 28px 20px;
}

.about-card .logo-about {
  width: 240px; /* ~double prior About 120px (Kelvin 10/10) */
  max-width: 70vw;
  margin: 0 auto 18px;
  height: auto;
}

.about-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

@media (min-width: 640px) {
  .app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-height: 100vh;
  }
}

.about-headline {
  font-size: 1.25rem;
  margin: 0 0 14px;
  color: var(--text);
}

.about-body {
  text-align: left;
  margin-bottom: 18px;
}

.about-body p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.about-body p:last-child {
  margin-bottom: 0;
}

/* Tappable warranty scope */
.scope-item-tap {
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease;
}

.scope-item-tap:hover {
  border-color: var(--gold);
}

.scope-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.scope-item-head h3 {
  margin: 0 0 6px;
}

.scope-item-head .chevron {
  color: var(--gold);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.warranty-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.detail-list {
  margin: 0;
  padding-left: 1.15em;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.6;
}

.detail-list li + li {
  margin-top: 8px;
}

.warranty-detail-card .period {
  font-size: 0.85rem;
  color: var(--secondary);
}

/* Problem report form (Kelvin 11/10) */
.card-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.field-select,
.field-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  margin-bottom: 14px;
  outline: none;
  box-sizing: border-box;
}

.field-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
}

.field-select:focus,
.field-textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(185, 111, 54, 0.15);
}

.field-file {
  width: 100%;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.req {
  color: var(--cta);
  font-weight: 700;
}

.media-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.media-preview-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
}

.media-preview-item img,
.media-preview-item video {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #000;
}

.media-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px 8px;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
}

.media-preview-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.media-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.report-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.35);
}

.report-result-title {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--text);
}

.report-result p {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
}

.report-card .field-label {
  margin-top: 4px;
}

/* Repairs pricing (保養以外) */
.price-callout {
  background: rgba(0, 145, 150, 0.08);
  border-color: rgba(0, 145, 150, 0.28);
}

.price-callout-compact p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
}

.price-callout-title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

.price-callout p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
}

.price-min-charge {
  text-align: center;
  border-color: rgba(229, 57, 53, 0.25);
  background: linear-gradient(180deg, rgba(229, 57, 53, 0.06), var(--white));
}

.price-min-label {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--secondary);
  text-transform: uppercase;
}

.price-min-amount {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--cta);
  font-family: var(--font-serif);
}

.price-min-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.price-notices {
  padding-left: 1.2em;
}

.price-section + .price-section {
  /* cards already spaced via .card + .card */
}

.price-section-note {
  margin: -6px 0 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.price-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.price-row {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.price-row:first-child {
  border-top: none;
  padding-top: 0;
}

.price-row:last-child {
  padding-bottom: 0;
}

.price-row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.price-item {
  font-weight: 600;
  font-size: 0.92rem;
  flex: 1;
  min-width: 0;
}

.price-amount {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--secondary);
  font-size: 0.95rem;
  white-space: nowrap;
  text-align: right;
}

.price-row-meta {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.price-extra {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.price-extra-label {
  font-weight: 600;
  color: rgba(58, 36, 30, 0.45);
  font-size: 0.72rem;
}

.price-cta-card .btn-cta {
  width: 100%;
  text-align: center;
}

.about-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.about-links .btn {
  width: 100%;
  text-align: center;
}

/* Optional wider table fallback for larger screens */
@media (min-width: 480px) {
  .price-extra {
    flex-direction: row;
    gap: 6px;
  }
  .price-extra-label::after {
    content: "：";
  }
}

/* PWA 新版本提示 */
.sw-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 6px 20px rgba(58, 36, 30, 0.18);
  font-size: 0.92rem;
  font-weight: 600;
}

.sw-update-text {
  flex: 1;
  min-width: 0;
}

.sw-update-btn {
  width: auto;
  flex-shrink: 0;
  padding: 8px 18px;
  font-size: 0.9rem;
}
