/* สไตล์เฉพาะแอพพอร์ตลงทุน (ต่อจากธีมเดียวกับแอพเงิน: style → theme → fresh → glass) */

:root {
  --up: #12804a;     /* กำไร: เขียว (ตามธรรมเนียมตลาดไทย) */
  --down: #c8362f;   /* ขาดทุน: แดง */
  --port-line: #4f9a2a;
  --fund: #d8ecf7;
  --fund-ink: #1f5f86;
  --stock: #fde4d1;
  --stock-ink: #9a4a14;
}

.up-ink {
  color: var(--up);
}
.down-ink {
  color: var(--down);
}
.flat-ink {
  color: var(--text-2);
}

/* ป้ายกำไร/ขาดทุน: ลูกศร + ตัวเลข (ไม่สื่อด้วยสีอย่างเดียว) */
.gain-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  background: #f1f2ee;
  color: var(--text-2);
}
.gain-pill b {
  font-size: 0.7rem;
}
.gain-pill.up {
  background: #e3f4e9;
  color: var(--up);
}
.gain-pill.down {
  background: #fbe6e4;
  color: var(--down);
}

/* ป้ายชื่อย่อสินทรัพย์ */
.hold-badge {
  flex: none;
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.hold-badge.fund {
  background: var(--fund);
  color: var(--fund-ink);
}
.hold-badge.stock {
  background: var(--stock);
  color: var(--stock-ink);
}
.cat-row .hold-badge {
  min-width: 34px;
  height: 30px;
  border-radius: 10px;
  font-size: 0.62rem;
}
.bar-fill.fund {
  background: #5aa9d6;
}
.bar-fill.stock {
  background: #ef9a5c;
}

/* การ์ดภาพรวมพอร์ต */
.port-hero .bc-status {
  margin-top: 2px;
}
.port-hero .bc-stats b.up {
  color: var(--up);
}
.port-hero .bc-stats b.down {
  color: var(--down);
}
.port-hero .gain-pill {
  background: rgba(255, 255, 255, 0.85);
}

.empty-hero {
  text-align: center;
  padding: 36px 22px;
}
.empty-hero h2 {
  margin: 6px 0;
}
.empty-hero p {
  max-width: 440px;
  margin: 0 auto 16px;
}

/* หน้าพอร์ต */
.hold-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.hold-grid .card {
  margin: 0;
}
.hold-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.hold-card:hover,
.hold-card:focus-visible {
  transform: translateY(-2px);
  outline: none;
}
.hold-card.sold {
  opacity: 0.7;
}
.hold-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hold-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.hold-title b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hold-title span {
  font-size: 0.8rem;
  color: var(--muted);
}
.hold-value {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  font-weight: 600;
}
.hold-value span {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
}
.hold-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.84rem;
  color: var(--text-2);
}
.hold-meta i {
  font-style: normal;
  color: var(--muted);
}
.hold-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

/* ไอคอนประเภทรายการ */
.cat-ico.kind-buy {
  background: #e7f4dc;
  color: var(--port-line);
  font-weight: 700;
}
.cat-ico.kind-sell {
  background: #fde8e0;
  color: #b4541f;
  font-weight: 700;
}
.cat-ico.kind-div {
  background: #fbf1cf;
}
.cat-ico.kind-price {
  background: #e6f0f8;
}

/* กราฟเส้น */
.chart .gridline {
  stroke: #eceee8;
  stroke-width: 1;
}
.chart .crosshair {
  stroke: #8b9099;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.legend i.dash {
  background: repeating-linear-gradient(90deg, #8b9099 0 5px, transparent 5px 9px);
  height: 3px;
  border-radius: 2px;
  width: 16px;
}
.chart-note {
  margin: 8px 0 0;
}

/* หน้าสรุป */
.section-head .sum-seg {
  width: 220px;
}
.year-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: -4px 0 14px;
  font-size: 1.15rem;
}
.year-nav .icon-btn.round:disabled {
  opacity: 0.35;
  cursor: default;
}
.sum-table td.num,
.sum-table th.num {
  font-variant-numeric: tabular-nums;
}
.sum-table tbody tr {
  cursor: default;
}

/* หน้าต่างบันทึกรายการ */
.seg {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}
.tx-total {
  background: #f3f8ea;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.92rem;
  line-height: 1.5;
}
.field input[type="number"],
.field input[type="date"] {
  font: inherit;
  width: 100%;
}

/* รายละเอียดสินทรัพย์ (ใช้โครงเดียวกับรายละเอียดเป้าหมายในแอพเงิน) */
.gd {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.gd-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gd-title h2 {
  font-size: 1.15rem;
}
.gd-amount {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.gd-amount > div > b {
  font-family: var(--font-hand);
  font-size: 1.8rem;
  font-weight: 600;
}
.gd-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.gd-h {
  font-size: 1rem;
  margin-top: 4px;
}
.gd-hist {
  max-height: 280px;
  overflow-y: auto;
}

.section-head.sub {
  margin: 20px 0 10px;
}

.tiles .tile-val {
  white-space: nowrap;
  font-size: 1.45rem;
}

@media (max-width: 720px) {
  .section-head .sum-seg {
    width: 100%;
  }
  .tiles .tile-val {
    font-size: 1.2rem;
  }
  /* มือถือ: ซ่อนคอลัมน์ ขาย/ถอน และ ปันผล ในตาราง (ยอดรวมอยู่ในการ์ดด้านบนแล้ว) */
  .sum-table th:nth-child(3),
  .sum-table td:nth-child(3),
  .sum-table th:nth-child(4),
  .sum-table td:nth-child(4) {
    display: none;
  }
  .sum-table th,
  .sum-table td {
    padding: 9px 5px;
  }
  .hold-grid {
    grid-template-columns: 1fr;
  }
  .sum-table {
    font-size: 0.82rem;
  }
}
