/* === การเงินกุ้งๆ — shared dark theme (Direction D) ===
   Source of truth for finance tool/page styling. Edit here, all pages inherit. */
        :root {
            --bg: #030712;
            --bg-card: rgba(255,255,255,0.04);
            --border: rgba(255,255,255,0.08);
            --ink: #eceaf2;
            --gold: #F7C548;
            --gold-light: #ffd76b;
            --gold-glow: rgba(247, 197, 72, 0.5);
            --gold-dim: rgba(247, 197, 72, 0.1);
            --shrimp: #ff6a4d;
            --orange: #FF8C42;
            --purple: #b98cff;
            --bg-card-hover: rgba(255,255,255,0.07);
            --surface-raised: rgba(255,255,255,0.055);
            --surface-overlay: rgba(7,13,36,0.96);
            --green-dim: rgba(77,210,160,0.1);
            --orange-dim: rgba(255,140,66,0.1);
            --orange-glow: rgba(255,140,66,0.5);
            --orange-light: #FFB07C;
            --red-dim: rgba(240,133,122,0.1);
            --shrimp-dim: rgba(255, 106, 77, 0.12);
            --blue: #6aa9e8;
            --green: #4DD2A0;
            --red: #f0857a;
            --status-info: var(--blue);
            --status-success: var(--green);
            --status-warning: var(--gold);
            --status-danger: var(--red);
            --text: #f0f0f5;
            --text-muted: #a3a3b8;
            --radius-card: 14px;
            --radius-control: 9px;
            --radius-pill: 999px;
            --shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
            --font-display: 'Mitr', sans-serif;
            --font-head: 'Mitr', sans-serif;
            --font-body: 'Sarabun', sans-serif;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        /* Native dropdowns: the popup list is drawn by the OS, not by our CSS, so a
           <select> styled with only a light `color` renders near-white text on the
           browser's default WHITE popup — unreadable. `color-scheme: dark` is what
           actually makes the popup dark; the explicit option colours are the fallback
           for browsers that ignore it. Applies to every page that loads this file. */
        :root { color-scheme: dark; }
        select { color-scheme: dark; background-color: #111827; color: var(--text); }
        select option,
        select optgroup { background-color: #111827; color: var(--text); }
        select option:checked { background-color: var(--orange-dim); color: var(--orange-light); }

        body {
            background: var(--bg);
            color: var(--text);
            font-family: var(--font-body);
            font-size: 16px;
            line-height: 1.7;
            min-height: 100vh;
            overflow-x: hidden;
        }

        .shrimp-wm { position: fixed; right: -34px; bottom: -46px; font-size: 260px; opacity: 0.06; transform: rotate(-14deg); pointer-events: none; z-index: 0; user-select: none; }

        main { max-width: 760px; margin: 0 auto; padding: 110px 5% 90px; position: relative; z-index: 1; }
        .hd { text-align: center; margin-bottom: 2.4rem; }
        .hd-split { display: flex; align-items: center; gap: 2rem; text-align: left; }
        .hd-split .hd-sub { margin: 0; max-width: 560px; }
        .hd-text { flex: 1; min-width: 0; }
        .hd-photo { flex-shrink: 0; }
        .hero-portrait { display: block; width: 240px; height: 240px; object-fit: cover; object-position: center 20%; border-radius: 16px; border: 2.5px solid var(--gold); box-shadow: 6px 6px 0 rgba(255,106,77,0.3); }
        .hd-eyebrow { display: inline-block; font-family: var(--font-head); font-size: 0.76rem; font-weight: 600; color: var(--shrimp); letter-spacing: 2px; padding: 0.35rem 0.9rem; border: 1.5px solid var(--shrimp); border-radius: 999px; margin-bottom: 1rem; }
        .hd-title { font-family: var(--font-display); font-size: clamp(1.85rem, 5.8vw, 2.65rem); font-weight: 700; line-height: 1.32; margin-bottom: 0.9rem; color: var(--text); letter-spacing: 0.2px; }
        .hd-sub { font-size: 0.98rem; color: var(--text-muted); max-width: 540px; margin: 0 auto; line-height: 1.85; }

        .card { background: var(--bg-card); border: 1.5px solid var(--border); border-radius: 10px; padding: 1.8rem 1.6rem; margin-bottom: 1.6rem; box-shadow: var(--shadow); }
        .hero { position: relative; border-color: var(--gold); box-shadow: 5px 5px 0 rgba(255,106,77,0.28); overflow: hidden; }
        .hero::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--shrimp), var(--gold)); }

        .ctl { margin-bottom: 1.6rem; }
        .ctl:last-child { margin-bottom: 0; }
        .ctl-label { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-head); font-size: 0.98rem; font-weight: 600; margin-bottom: 0.6rem; }
        .ctl-value { font-family: var(--font-display); font-weight: 700; color: var(--gold-light); font-size: 1.2rem; }

        input[type="range"] { width: 100%; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; background: rgba(239,228,207,0.14); outline: none; cursor: pointer; }
        input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--bg), 0 0 12px var(--gold-glow); cursor: pointer; border: 2px solid #1a1109; }
        input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); cursor: pointer; border: 2px solid #1a1109; }

        .presets { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.2rem; }
        .preset { font-family: var(--font-head); font-size: 0.82rem; font-weight: 600; color: var(--text-muted); background: transparent; border: 1.5px solid var(--border); border-radius: 8px; padding: 0.4rem 0.8rem; cursor: pointer; transition: all 0.15s; }
        .preset:hover { color: var(--text); border-color: var(--gold); }
        .preset.active { color: #1a1109; background: var(--gold); border-color: var(--gold); box-shadow: 2px 2px 0 rgba(0,0,0,0.4); }

        /* winner banner */
        .win { text-align: center; margin-bottom: 1.6rem; }
        .win-label { font-family: var(--font-head); font-size: 0.8rem; color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 0.5rem; }
        .win-name { font-family: var(--font-display); font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 700; line-height: 1.28; color: var(--gold-light); }
        .win-gap { font-size: 0.95rem; color: var(--text-muted); margin-top: 0.6rem; line-height: 1.9; }
        .win-gap b { color: var(--text); background: rgba(247,197,72,0.32); padding: 2px 6px; border-radius: 4px; font-weight: 700; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

        /* 2-bar compare */
        .cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; height: 240px; margin: 0.5rem 0 1.1rem; }
        .cmp-col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
        .cmp-bar { border: 1.5px solid rgba(0,0,0,0.35); border-bottom: none; border-radius: 4px 4px 0 0; position: relative; transition: height 0.35s ease; display: flex; flex-direction: column-reverse; overflow: hidden; }
        .seg-contrib { background: var(--blue); }
        .seg-growth { background: var(--green); }
        .seg-refund { background: var(--gold); }
        .seg-tax { background: repeating-linear-gradient(45deg, rgba(240,133,122,0.5), rgba(240,133,122,0.5) 6px, transparent 6px, transparent 12px); border-top: 1px dashed var(--red); }
        .cmp-top { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.35rem,4.5vw,1.9rem); margin-bottom: 0.5rem; }
        .cmp-thai .cmp-top { color: var(--gold-light); }
        .cmp-voo .cmp-top { color: var(--blue); }
        .cmp-name { font-family: var(--font-head); font-weight: 600; font-size: 0.9rem; margin-top: 0.6rem; }
        .cmp-thai .cmp-name { color: var(--shrimp); }
        .cmp-voo .cmp-name { color: var(--blue); }
        .cmp-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

        .legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; font-size: 0.82rem; color: var(--text-muted); justify-content: center; }
        .legend span { display: flex; align-items: center; gap: 0.4rem; }
        .lg-dot { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.3); }

        /* advanced */
        details.adv { margin-top: 1.2rem; border-top: 1.5px solid var(--border); padding-top: 1rem; }
        details.adv summary { font-family: var(--font-head); font-size: 0.9rem; font-weight: 600; color: var(--text-muted); cursor: pointer; list-style: none; }
        details.adv summary::-webkit-details-marker { display: none; }
        details.adv summary::before { content: '⚙️ '; }
        details.adv[open] summary { color: var(--gold-light); margin-bottom: 1.2rem; }
        .toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; font-size: 0.9rem; }
        .toggle-row small { display: block; color: var(--text-muted); font-size: 0.76rem; line-height: 1.5; }
        .toggle-row input { width: 20px; height: 20px; accent-color: var(--shrimp); cursor: pointer; flex-shrink: 0; }

        .insight { background: var(--gold-dim); border: 1.5px solid rgba(247,197,72,0.32); border-radius: 8px; padding: 1.2rem 1.3rem; font-size: 0.93rem; color: var(--text-muted); line-height: 1.85; }
        .insight b { color: var(--gold-light); }
        .caveat { background: var(--shrimp-dim); border: 1.5px solid rgba(255,106,77,0.3); border-radius: 8px; padding: 1rem 1.2rem; font-size: 0.88rem; color: var(--text-muted); line-height: 1.75; margin-top: 1rem; }
        .caveat b { color: var(--shrimp); }

        .sum-head { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; margin-bottom: 1.2rem; padding-left: 0.8rem; border-left: 4px solid var(--shrimp); line-height: 1.35; }
        .sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
        .sum-col { border: 1.5px solid var(--border); border-radius: 8px; padding: 1rem 1.1rem; background: rgba(0,0,0,0.15); }
        .sum-voo { border-top: 4px solid var(--blue); }
        .sum-thai { border-top: 4px solid var(--shrimp); }
        .sum-title { font-family: var(--font-head); font-weight: 700; font-size: 1.12rem; margin-bottom: 0.7rem; }
        .sum-voo .sum-title { color: var(--blue); }
        .sum-thai .sum-title { color: var(--shrimp); }
        .sum-list { list-style: none; padding: 0; margin: 0; }
        .sum-list li { font-size: 0.86rem; color: var(--text-muted); line-height: 1.6; padding-left: 1.1rem; position: relative; margin-bottom: 0.55rem; }
        .sum-list li:last-child { margin-bottom: 0; }
        .sum-list li:before { content: '✓'; position: absolute; left: 0; color: var(--green); font-size: 0.8rem; }
        .sum-list b { color: var(--text); }
        @media (max-width: 600px) { .sum-grid { grid-template-columns: 1fr; } }

        .pc-list { list-style: none; padding: 0; margin: 0; }
        .pc-list li { font-size: 0.84rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 0.4rem; }
        .pc-list li:last-child { margin-bottom: 0; }
        .pc-list b { color: var(--text); }

        .trick { background: var(--gold-dim); border: 1.5px solid rgba(247,197,72,0.38); border-radius: 8px; padding: 1.2rem 1.3rem; font-size: 0.9rem; color: var(--text-muted); line-height: 1.8; }
        .trick b { color: var(--gold-light); }
        .trick .warn { display: block; margin-top: 0.8rem; padding-top: 0.7rem; border-top: 1.5px solid var(--border); font-size: 0.82rem; }

        .reads-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; margin: 0 0 1.1rem; padding-left: 0.8rem; border-left: 4px solid var(--shrimp); line-height: 1.35; }
        .read-card { display: block; background: rgba(0,0,0,0.15); border: 1.5px solid var(--border); border-radius: 8px; padding: 0.95rem 1.15rem; text-decoration: none; margin-bottom: 0.7rem; transition: all 0.18s; }
        .read-card:hover { background: var(--gold-dim); border-color: var(--gold); transform: translate(-1px,-1px); box-shadow: 3px 3px 0 rgba(0,0,0,0.35); }
        .read-card .rc-cat { font-family: var(--font-head); font-size: 0.72rem; color: var(--shrimp); margin-bottom: 0.2rem; }
        .read-card .rc-title { font-family: var(--font-head); font-size: 0.95rem; font-weight: 600; color: var(--text); line-height: 1.4; }

        .disclaimer { padding: 1rem 1.2rem; background: rgba(0,0,0,0.18); border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.82rem; color: var(--text-muted); line-height: 1.7; }

        @media (max-width: 600px) {
            main { padding: 95px 5% 60px; }
            .card { padding: 1.4rem 1.1rem; }
            .cmp { height: 200px; }
            .shrimp-wm { font-size: 170px; }
            .hd-split { flex-direction: column; text-align: center; gap: 1.4rem; }
            .hero-portrait { width: 190px; height: 190px; }
        }
