:root {
  color-scheme: light;
  --ink: #17221e;
  --muted: #6d7772;
  --paper: #f3f3ee;
  --card: #fffefa;
  --line: #dcded7;
  --forest: #102e27;
  --forest-2: #1f5c49;
  --lime: #cce982;
  --orange: #e58a55;
  --red: #bd4b42;
  --blue: #557a91;
  --shadow: 0 20px 55px rgba(16, 46, 39, .07);
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "IBM Plex Sans Thai", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.eyebrow { margin: 0 0 8px; color: var(--forest-2); font: 700 10px/1.2 Manrope, sans-serif; letter-spacing: .18em; }
.eyebrow.light { color: var(--lime); }
.brand, .auth-brand { display: flex; align-items: center; gap: 11px; font: 700 15px/1.05 Manrope, sans-serif; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50% 44% 48% 52%; color: var(--forest); background: var(--lime); transform: rotate(-6deg); }
.positive { color: var(--forest-2) !important; }
.negative { color: var(--red) !important; }
.right { text-align: right; }
.amount { font-family: Manrope, sans-serif; font-weight: 600; }

.auth-view { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(420px, .75fr); color: white; background: var(--forest); }
.auth-brand { position: fixed; top: 42px; left: clamp(36px, 6vw, 90px); z-index: 2; }
.auth-copy { min-height: 100vh; padding: 150px clamp(36px, 6vw, 90px) 80px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-copy::before { content: ""; position: absolute; width: 650px; height: 650px; right: -320px; top: -290px; border: 1px solid rgba(204,233,130,.28); border-radius: 50%; }
.auth-copy h1 { margin: 12px 0 28px; max-width: 800px; font-size: clamp(64px, 8.5vw, 122px); font-weight: 500; line-height: .94; letter-spacing: -.075em; }
.auth-copy > p:last-child { max-width: 620px; color: #bfcbc6; font-size: 18px; line-height: 1.8; }
.auth-panel { margin: auto; width: min(430px, calc(100% - 44px)); padding: 48px; color: var(--ink); border-radius: 28px; background: var(--card); box-shadow: var(--shadow); }
.auth-panel h2 { margin: 0; font-size: 36px; letter-spacing: -.04em; }
.auth-panel > p:not(.eyebrow):not(.error-text) { margin: 12px 0 32px; color: var(--muted); }
.google-button { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; font-weight: 600; }
.google-button:hover { border-color: var(--forest-2); }
.google-button span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: white; background: #4285f4; font: 700 13px Manrope, sans-serif; }
.error-text { min-height: 20px; color: var(--red); font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px 22px; display: flex; flex-direction: column; color: white; background: var(--forest); }
.sidebar nav { display: grid; gap: 7px; margin-top: 64px; }
.nav-item { padding: 13px 12px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 9px; color: #b7c5bf; background: transparent; text-align: left; }
.nav-item span { color: #789087; font: 600 10px Manrope, sans-serif; }
.nav-item:hover, .nav-item.is-active { color: white; background: rgba(255,255,255,.09); }
.nav-item.is-active span { color: var(--lime); }
.sidebar-foot { margin-top: auto; }
.sync-state { padding: 14px 10px; display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255,255,255,.12); border-bottom: 1px solid rgba(255,255,255,.12); }
.sync-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(204,233,130,.1); }
.sync-state div { display: grid; }
.sync-state strong { font-size: 12px; }
.sync-state small { color: #8fa49b; }
.logout-button { margin: 12px 10px 0; padding: 8px 0; border: 0; color: #9db0a8; background: transparent; text-align: left; }

.workspace { min-width: 0; padding: 0 clamp(22px, 4vw, 62px) 70px; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.date-picker { padding: 8px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.date-picker span { color: var(--muted); font-size: 11px; }
.date-picker input { min-height: 26px; border: 0; outline: none; color: var(--ink); background: transparent; }
.user-chip { width: 42px; height: 42px; border: 0; border-radius: 50%; color: white; background: var(--orange); font: 700 12px Manrope, sans-serif; }
.notice { margin-top: 18px; padding: 13px 16px; border: 1px solid #e7c992; border-radius: 10px; background: #fff9e7; }
.page { display: none; padding-top: 30px; }
.page.is-active { display: block; }

.overview-hero { min-height: 260px; padding: 36px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; overflow: hidden; position: relative; border-radius: 20px; color: white; background: var(--forest); }
.overview-hero::after { content: ""; position: absolute; width: 360px; height: 360px; right: -100px; top: -210px; border: 1px solid rgba(204,233,130,.32); border-radius: 50%; }
.overview-hero h1 { margin: 0; font-size: clamp(42px, 6vw, 74px); font-weight: 500; line-height: 1.03; letter-spacing: -.065em; }
.overview-hero h1 span { color: var(--lime); }
.hero-status { min-width: 190px; padding: 22px; display: grid; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: rgba(255,255,255,.06); backdrop-filter: blur(8px); }
.hero-status > span { font: 600 48px/1 Manrope, sans-serif; }
.hero-status small { color: #aebfb8; }
.hero-status p { margin: 20px 0 0; color: #d1dcd7; font-size: 12px; }
.metric-grid { margin: 18px 0 36px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-card { min-width: 0; padding: 21px; display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 9px 28px rgba(16,46,39,.03); }
.metric-card.primary { border-color: #d1dfb4; background: #f8fce9; }
.metric-card.cash { border-color: #c9ddd4; background: #f1f8f5; }
.metric-card > span { color: var(--muted); font-size: 12px; }
.metric-card strong { overflow: hidden; text-overflow: ellipsis; font: 600 clamp(20px, 2.3vw, 29px) Manrope, sans-serif; letter-spacing: -.04em; }
.metric-card small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statement-controls { margin: 0 0 36px; display: grid; gap: 14px; }
.statement-card { overflow: hidden; border: 1px solid #cbd9c7; border-radius: 16px; background: #f8fce9; box-shadow: 0 9px 28px rgba(16,46,39,.04); }
.statement-card > header { padding: 22px 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; color: white; background: var(--forest); }
.statement-card > header p { margin: 0 0 3px; color: #b8c9c2; font-size: 11px; }
.statement-card > header h3 { margin: 0; color: var(--lime); font: 600 28px Manrope, sans-serif; letter-spacing: -.04em; }
.statement-card > header > span { color: #b8c9c2; font-size: 11px; }
.statement-summary { padding: 20px 24px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; border-bottom: 1px solid #dce5d6; }
.statement-summary div { display: grid; gap: 3px; }
.statement-summary span, .statement-components > span { color: var(--muted); font-size: 11px; }
.statement-summary strong { font: 600 22px Manrope, sans-serif; }
.statement-components { padding: 14px 24px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.statement-components > span { display: grid; gap: 3px; }
.statement-components strong { color: var(--ink); font: 600 13px Manrope, sans-serif; }

.section-heading { margin: 0 0 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; }
.section-heading.secondary { margin-top: 34px; }
.section-heading h2 { margin: 0; font-size: 30px; letter-spacing: -.045em; }
.section-heading > p, .section-heading > span { color: var(--muted); font-size: 12px; }
.account-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.account-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--card); text-align: left; box-shadow: 0 9px 28px rgba(16,46,39,.03); transition: transform .2s, box-shadow .2s; }
.account-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.account-top { display: flex; align-items: center; gap: 10px; }
.owner-badge { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--forest-2); font-weight: 600; }
.account-top div { min-width: 0; display: grid; }
.account-top small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.asset-pill { margin-left: auto; padding: 5px 8px; border-radius: 99px; color: var(--forest-2); background: #edf3e1; font-size: 10px; }
.account-value { margin: 28px 0 22px; display: grid; gap: 4px; }
.account-value span { color: var(--muted); font-size: 11px; }
.account-value strong { overflow: hidden; text-overflow: ellipsis; font: 600 25px Manrope, sans-serif; letter-spacing: -.04em; }
.account-foot { padding-top: 13px; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.account-sections { display: grid; gap: 20px; }
.portfolio-card, .table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 9px 32px rgba(16,46,39,.035); }
.portfolio-card > header { padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.account-identity { display: flex; align-items: center; gap: 12px; }
.account-identity p { margin: 0; color: var(--muted); font-size: 11px; }
.account-identity h3 { margin: 3px 0 0; font: 600 19px Manrope, sans-serif; }
.account-summary { display: grid; text-align: right; }
.account-summary small { color: var(--muted); }
.account-summary strong { font: 600 21px Manrope, sans-serif; }
.account-summary span { font-size: 11px; }
.control-strip { padding: 10px 24px; display: flex; flex-wrap: wrap; gap: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); background: #f7f7f2; font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 14px; color: var(--muted); border-bottom: 1px solid var(--line); background: #fafaf6; text-align: left; font-weight: 500; white-space: nowrap; }
td { padding: 14px; border-bottom: 1px solid #eceee9; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td small.cell-sub { display: block; color: var(--muted); }
.data-tag { padding: 4px 7px; border-radius: 6px; color: var(--forest-2); background: #edf4e8; font-size: 9px; }
.data-tag.warning { color: #986126; background: #fff1d8; }
.side-pill { padding: 4px 8px; border-radius: 99px; font-size: 10px; text-transform: uppercase; }
.side-pill.long { color: #27664f; background: #e0f2e8; }
.side-pill.short { color: #a6453d; background: #f9e5e3; }
.quality-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quality-panel article { padding: 22px; display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.quality-panel span, .quality-panel small { color: var(--muted); }
.quality-panel strong { font: 600 34px Manrope, sans-serif; }
.empty-state { min-height: 170px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; text-align: center; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .account-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 850px) {
  .auth-view { grid-template-columns: 1fr; }
  .auth-copy { min-height: 55vh; padding-top: 120px; }
  .auth-panel { margin: 28px auto; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding-bottom: 16px; }
  .sidebar nav { margin-top: 24px; grid-template-columns: repeat(4, minmax(130px, 1fr)); overflow-x: auto; }
  .sidebar-foot { display: none; }
  .statement-components { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .workspace { padding: 0 15px 42px; }
  .topbar { align-items: flex-start; padding: 18px 0; }
  .topbar h2 { font-size: 23px; }
  .date-picker { display: grid; gap: 0; }
  .date-picker input { width: 125px; }
  .overview-hero { min-height: 340px; align-items: flex-start; flex-direction: column; }
  .overview-hero h1 { font-size: 48px; }
  .hero-status { width: 100%; }
  .metric-grid, .account-grid, .quality-panel { grid-template-columns: 1fr; }
  .metric-card strong { font-size: 27px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .portfolio-card > header { align-items: flex-start; flex-direction: column; }
  .account-summary { width: 100%; padding-top: 15px; border-top: 1px solid var(--line); text-align: left; }
  .auth-copy h1 { font-size: 59px; }
  .auth-panel { padding: 34px 24px; }
  .statement-card > header { flex-direction: column; }
  .statement-summary, .statement-components { grid-template-columns: 1fr; }
}
