:root {
  --mint-25: #f4f8fb;
  --mint-50: #eef6f8;
  --mint-100: #dcecef;
  --mint-200: #b8d9df;
  --mint-500: #0abab5;
  --teal: #078f8b;
  --deep: #0b2438;
  --navy: #14284b;
  --gold: #c99a36;
  --sky: #2c8fc8;
  --rose: #db6b74;
  --ink: #12283a;
  --muted: #627887;
  --line: #bfd3df;
  --card: rgba(255, 255, 255, .92);
  --shadow: 0 20px 48px rgba(7, 28, 48, .22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
  line-height: 1.55;
  background:
    radial-gradient(circle at 12% 10%, rgba(10, 186, 181, .22), transparent 26rem),
    radial-gradient(circle at 88% 2%, rgba(201, 154, 54, .18), transparent 20rem),
    linear-gradient(135deg, #06172a 0%, #0b2438 44%, #123d5a 100%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.page {
  min-height: calc(100vh - 56px);
  border: 1px solid rgba(191, 211, 223, .8);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 280px;
}

.brand img {
  width: 124px;
  height: 62px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.brand h1 {
  margin: 0;
  color: var(--deep);
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  min-width: 76px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--mint-50);
  font-size: 13px;
  font-weight: 800;
}

.tabs a.active {
  color: #fff;
  border-color: var(--mint-500);
  background: var(--mint-500);
}

.content {
  padding: 28px 26px 34px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two { grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(7, 28, 48, .08);
  padding: 18px;
}

.card.soft { background: var(--mint-50); }

.preview-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mint-50);
  padding: 16px;
}

.preview-chart {
  min-height: 300px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.title {
  margin: 0;
  color: var(--deep);
  font-size: clamp(28px, 5vw, 54px);
  line-height: 1.06;
}

.lead {
  margin: 12px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
}

.metric {
  display: grid;
  gap: 4px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  color: var(--deep);
  font-size: 28px;
  line-height: 1.15;
}

.metric strong.teal { color: var(--teal); }
.metric strong.gold { color: var(--gold); }
.metric strong.rose { color: var(--rose); }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.asset-total-summary {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 220px;
  text-align: right;
  align-self: start;
}

.asset-total-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.asset-total-summary strong {
  color: var(--teal);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

.section-head h2,
.card h2,
.card h3 {
  margin: 0;
  color: var(--deep);
  letter-spacing: 0;
}

.value-principles h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}

.hkj-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  color: #fff;
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(7, 28, 48, .14);
}

.hkj-letter.h { background: var(--mint-500); }
.hkj-letter.k { background: var(--navy); }
.hkj-letter.j { background: var(--gold); }

.value-principles h3 span:last-child {
  font-size: 18px;
  line-height: 1.25;
}

.section-head p,
.card p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  color: var(--deep);
  background: #fff;
  font-weight: 900;
}

.btn.primary {
  color: #fff;
  border-color: var(--mint-500);
  background: var(--mint-500);
}

.btn.gold {
  color: #fff;
  border-color: var(--gold);
  background: var(--gold);
}

.btn.danger {
  color: #fff;
  border-color: var(--rose);
  background: var(--rose);
}

.btn.small {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field input[readonly] {
  background: var(--mint-50);
  color: var(--deep);
  font-weight: 900;
}

.password-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.password-toggle input {
  width: auto;
  margin: 0;
}

.voice-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--deep);
  font-weight: 900;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--mint-500);
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--mint-50);
}

.segmented button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--deep);
  background: transparent;
  font-weight: 900;
}

.segmented button.active {
  color: #fff;
  background: var(--mint-500);
}

.chart {
  width: 100%;
  height: 340px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mint-25);
}

.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  color: var(--ink);
  font-size: 14px;
}

.table th {
  color: var(--muted);
  background: var(--mint-50);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--deep);
  background: var(--mint-100);
  font-size: 12px;
  font-weight: 800;
}

.allocation-list {
  display: grid;
  gap: 12px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--mint-100);
  overflow: hidden;
  margin-top: 6px;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.message-list {
  display: grid;
  gap: 12px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mint-25);
  padding: 14px;
}

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

.message-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 180px;
}

.message strong {
  color: var(--deep);
}

.message time {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.source-preview {
  display: grid;
  gap: 12px;
}

.source-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mint-50);
  padding: 12px 14px;
}

.source-preview-meta strong {
  color: var(--deep);
}

.source-preview-meta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.source-preview img,
.source-preview iframe,
.source-preview pre {
  width: 100%;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.source-preview img {
  display: block;
  object-fit: contain;
}

.source-preview iframe {
  min-height: 520px;
}

.source-preview pre {
  overflow: auto;
  margin: 0;
  padding: 14px;
  color: var(--ink);
  white-space: pre-wrap;
}

.notice {
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  background: #fffaf0;
  border-radius: 10px;
  color: var(--ink);
}

.sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mint-50);
  padding: 14px;
}

.sync-panel h3,
.sync-panel p {
  margin: 0;
}

.sync-panel p + h3 {
  margin-top: 4px;
}

.sync-panel h3 + p {
  margin-top: 6px;
}

.sync-status {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--mint-25);
  padding: 12px 14px;
}

.sync-status span {
  color: var(--deep);
  font-weight: 900;
}

.sync-status p {
  margin: 0;
}

.sync-status.ok {
  border-style: solid;
  border-color: rgba(10, 186, 181, .45);
  background: #eefdfb;
}

.sync-status.warn {
  border-style: solid;
  border-color: rgba(201, 154, 54, .5);
  background: #fffaf0;
}

.empty {
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--mint-25);
}

@media (max-width: 980px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .tabs { justify-content: flex-start; }
  .sync-panel { align-items: flex-start; flex-direction: column; }
  .grid.two,
  .grid.three,
  .grid.four { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 18px, 460px); padding-top: 12px; }
  .brand { min-width: 0; flex-direction: column; align-items: flex-start; }
  .message-head { flex-direction: column; }
  .message-actions { justify-content: flex-start; min-width: 0; }
  .content,
  .topbar { padding-left: 14px; padding-right: 14px; }
  .tabs a { min-width: 0; padding: 8px 11px; }
}
