:root {
  /* ink + ground (cool neutral, not the banned cream) */
  --navy: #0f2a4a;
  --navy-deep: #0a1d36;
  --text: #16233a;
  --muted: #5f6672;
  --faint: #8890a0;
  --ground: #f6f7fb;
  --surface: #ffffff;
  --raised: #eef1f6;
  --border: #e4e7ef;
  --rule: #edeff4;
  --control: #d6dae3;

  /* one accent hue (rocket flame orange), full strength on small marks only;
     pale tints carry area work (active tab, badges, tracks) per the dealt
     accent-ladder style. Primary buttons use near-navy ink instead of the
     full hue so button labels clear 4.5:1 contrast. */
  --accent: #ff6b2c;
  --accent-dark: #c1501b;
  --accent-soft: #fff1e8;
  --accent-track: #ffe0c7;
  --accent-ink: #8a3f12;

  --primary: var(--navy);
  --primary-active: var(--navy-deep);

  --positive: #1f7a46;
  --positive-bg: #e3f6ea;
  --positive-ink: #14532d;
  --negative: #c23b34;
  --negative-bg: #fdeceb;
  --negative-ink: #831c1e;
  --neutral-bg: #eef0f4;
  --neutral-ink: #4b5565;
  --info-bg: #eaf1fb;
  --info-ink: #27436f;

  --radius-card: 16px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --tabbar-h: 64px;

  --font: "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-num: "DM Sans", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

.num, .money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  background: var(--ground);
  position: relative;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}

/* top bar */
.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rocket-logo {
  display: inline-flex;
  color: var(--accent);
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.1px;
}

.mock-badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
}

/* main view */
.view {
  padding: 20px 16px 12px;
}

.greeting {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
}

.page-title {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.page-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 20px;
}

/* cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
}

.case-card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.case-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.case-card-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--navy);
  line-height: 1.35;
}

.case-card-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.case-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: inherit;
}
.icon svg { display: block; }
.meta-item .icon { color: var(--faint); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--raised);
  color: var(--text);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge-price {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.badge-fixed {
  background: var(--neutral-bg);
  color: var(--neutral-ink);
}

.badge-applied {
  background: var(--positive-bg);
  color: var(--positive-ink);
}

.status-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex: none;
}
.status-applying { background: var(--info-bg); color: var(--info-ink); }
.status-accepted { background: var(--positive-bg); color: var(--positive-ink); }
.status-rejected { background: var(--neutral-bg); color: var(--neutral-ink); }
.status-cancelled { background: var(--negative-bg); color: var(--negative-ink); }
.status-pending-review { background: var(--accent-soft); color: var(--accent-ink); }

.card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--muted);
}

.card-footer-row strong {
  color: var(--text);
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
  font-size: 14px;
}

.empty-state .empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: var(--radius-pill);
  background: var(--raised);
  color: var(--faint);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-control);
  border: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active { background: var(--primary-active); }

.btn-primary:disabled,
.btn[disabled] {
  background: var(--control);
  color: #fff;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--border);
}
.btn-secondary:active { background: var(--raised); }

.btn-link {
  background: transparent;
  color: var(--accent-dark);
  text-decoration: none;
  min-height: 40px;
  padding: 0 4px;
  font-weight: 600;
  width: auto;
}

/* detail page */
.detail-section {
  margin-bottom: 14px;
}

.detail-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.detail-text {
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-text a {
  color: var(--accent-dark);
  text-decoration: underline;
  word-break: break-all;
}

.notice-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border-radius: var(--radius-card);
  padding: 13px 14px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 16px;
}

.notice-box .notice-icon {
  flex: none;
  margin-top: 1px;
  color: var(--accent-dark);
}

/* bottom sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 29, 54, 0.5);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 22px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 0.18s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-title {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 14px;
  color: var(--navy);
}

.sheet-row {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}

input[type="text"],
input[type="tel"],
input[type="url"],
input[type="number"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  padding: 0 13px;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.sheet-actions .btn {
  flex: 1;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.field-error {
  font-size: 12px;
  color: var(--negative-ink);
  margin-top: 6px;
  font-weight: 600;
}

/* profile page */
.profile-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.profile-row:last-child { border-bottom: none; padding-bottom: 2px; }
.profile-row.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.profile-row .k { color: var(--muted); font-size: 12.5px; flex-shrink: 0; }
.profile-row .v { font-weight: 600; word-break: break-word; }
.profile-row.inline .v { text-align: right; }

.lock-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 12px;
}
.lock-note svg { flex: none; color: var(--faint); }

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 4px;
  border-radius: var(--radius-control);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
}
.action-row:active { background: var(--raised); }
.action-row .chevron { color: var(--faint); flex: none; }
.profile-actions .action-row:not(:last-child) { border-bottom: 1px solid var(--rule); }

/* timeline */
.timeline {
  display: flex;
  align-items: center;
  margin-top: 14px;
  gap: 4px;
}

.timeline-step {
  flex: 1;
  text-align: center;
}

.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  margin: 0 auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-num);
}

.timeline-step.done .timeline-dot { background: var(--positive); }
.timeline-step.current .timeline-dot { background: var(--accent); }
.timeline-label {
  font-size: 11px;
  color: var(--muted);
}
.timeline-step.done .timeline-label,
.timeline-step.current .timeline-label { color: var(--text); font-weight: 700; }

.timeline-bar {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin-top: -20px;
}

/* faq */
.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.faq-item:last-child { border-bottom: none; padding-bottom: 2px; }
.faq-q {
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
  font-size: 14.5px;
}
.faq-a {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* footer */
.app-footer {
  text-align: center;
  padding: 20px 20px 4px;
  font-size: 11.5px;
  color: var(--faint);
  line-height: 1.6;
}

/* tabbar */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 30;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  min-height: 44px;
}

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 26px;
  border-radius: 10px;
}

.tab.active {
  color: var(--accent-ink);
  font-weight: 700;
}

.tab.active .tab-icon {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* toast */
.toast-host {
  position: fixed;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
}

.toast {
  background: var(--navy-deep);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-control);
  font-size: 13px;
  text-align: center;
  animation: toast-in 0.15s ease-out;
}

.toast.error {
  background: var(--negative);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* loading / skeleton */
.loading-state {
  text-align: center;
  color: var(--muted);
  padding: 64px 0;
  font-size: 13px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 10px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* bind page */
.bind-hero {
  text-align: center;
  padding: 28px 8px 10px;
}

.bind-hero .rocket-big {
  color: var(--accent);
  margin-bottom: 14px;
}

.bind-hero h1 {
  font-size: 19px;
  color: var(--navy);
  margin: 0 0 8px;
  font-weight: 700;
}

.bind-hero p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 22px;
  line-height: 1.6;
}

/* submit page */
.submit-current {
  background: var(--raised);
  border-radius: var(--radius-control);
  padding: 11px 13px;
  font-size: 13px;
  margin: 12px 0 16px;
  word-break: break-all;
}

.readonly-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}
