/* ==========================================================
   ChirayuPulse - website theme (layout modelled on finmetpulse.com)
   ========================================================== */
:root {
    --gold: #c9a84c;
    --gold-dark: #8a6020;
    --gold-hover: #b8962e;
    --cream: #f5f0e8;
    --cream-2: #faf7f0;
    --cream-3: #fdf9f2;
    --line: #ede6d4;
    --line-2: #e8dfc8;
    --ink: #1a1a1a;
    --up: #2a7a2a;
    --down: #c0392b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: Arial, Helvetica, sans-serif; background: var(--cream); color: #333; }
a { color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
:focus-visible { outline: 2px solid var(--gold-dark); outline-offset: 2px; }

/* ===== SCROLLBARS (thin, gold theme) =====
   Chrome / Edge / Safari use the ::-webkit-scrollbar rules (no arrow buttons).
   Firefox has no ::-webkit-scrollbar, so it gets the standard properties instead
   (set only there, because in Chrome they would override the webkit styling). */
/* internal scroll areas (news list, tab bar, drawer...) - very light */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ece3cc; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #ddd0b0; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
/* main page scroll - a little darker */
html::-webkit-scrollbar-thumb { background: var(--gold); }
html::-webkit-scrollbar-thumb:hover { background: var(--gold-dark); }
@supports not selector(::-webkit-scrollbar) {
    * { scrollbar-width: thin; scrollbar-color: #ece3cc transparent; }
    html { scrollbar-color: var(--gold) transparent; }
}

/* ===== HEADER ===== */
.header { background: #fff; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--gold); position: relative; z-index: 50; }
.header-left { display: flex; align-items: center; gap: 14px; }
.header-left img { height: 56px; width: 220px; object-fit: contain; }
.header-right { display: flex; align-items: center; gap: 12px; }
.live-badge { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #4caf6e; letter-spacing: .1em; font-weight: 600; }
.live-badge.offline { color: var(--down); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.clock { font-size: 11px; color: #999; letter-spacing: .06em; }
.refresh-btn { background: var(--gold); border: none; color: #fff; padding: 8px 18px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-block; }
.refresh-btn:hover { background: var(--gold-hover); }
.refresh-btn.dark { background: var(--gold-dark); }

.menu-toggle { background: transparent; border: 1px solid var(--line); width: 38px; height: 34px; cursor: pointer; display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.menu-toggle span { display: block; width: 18px; height: 2px; background: var(--gold-dark); }

/* Navigation drawer */
.site-nav { position: fixed; top: 0; right: 0; height: 100%; width: 290px; max-width: 85vw; background: #fff; border-left: 3px solid var(--gold); transform: translateX(100%); transition: transform .3s ease; z-index: 1000; overflow-y: auto; }
.site-nav.open { transform: translateX(0); }
.site-nav-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--cream-2); }
.site-nav-head img { height: 40px; width: 170px; object-fit: contain; }
.site-nav-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--gold-dark); cursor: pointer; }
.site-nav ul { list-style: none; }
.site-nav li a { display: block; padding: 11px 18px; font-size: 13px; color: #3a2800; text-decoration: none; border-bottom: 1px solid #f5f0e5; letter-spacing: .03em; }
.site-nav li a:hover, .site-nav li a:focus { background: var(--cream-2); color: var(--gold-dark); }
.site-nav .nav-group { padding: 10px 18px 6px; font-size: 10px; color: var(--gold-dark); letter-spacing: .14em; text-transform: uppercase; font-weight: 600; background: var(--cream-2); border-bottom: 1px solid var(--line); }
.nav-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 999; display: none; }
.nav-backdrop.show { display: block; }

/* ===== ANIMATIONS ===== */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes flash { 0% { background: var(--gold); color: var(--ink); } 100% { background: transparent; color: inherit; } }
@keyframes flash-ticker { 0% { background: var(--gold); color: var(--ink); } 80% { background: rgba(201, 168, 76, .1); color: #fff; } 100% { background: transparent; color: #fff; } }
@keyframes flash-silver { 0% { background: #c0c0c0; color: var(--ink); } 100% { background: transparent; color: inherit; } }
@keyframes ticker-scroll { 0% { transform: translateX(100vw); } 100% { transform: translateX(-100%); } }
/*.flash { animation: flash 2.5s ease-out; }*/
/*.flash-ticker { animation: flash-ticker 2.5s ease-out; }*/
/*.flash-silver { animation: flash-silver 2.5s ease-out; }*/
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }

/* ===== TICKER STRIP ===== */
.ticker { background: #111; display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 2px solid var(--gold); }
.ticker-divider { grid-column: 1 / -1; border-top: 1px solid #333; }
.ticker-item { padding: 13px 16px; border-right: 1px solid #222; min-width: 0; }
.ticker-item:nth-child(5n) { border-right: none; }
.ticker-label { font-size: 9px; color: #ccc; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker-val { font-size: 17px; color: #fff; font-weight: 600; display: inline-block; padding: 0 2px; }
.ticker-sub { font-size: 9px; color: #aaa; margin-top: 3px; }
.ticker-sub b { font-weight: 600; }

/* News / message ticker */
.news-ticker-bar { background: #1a0a00; border-bottom: 2px solid var(--gold); padding: 8px 0; overflow: hidden; white-space: nowrap; position: relative; }
.news-ticker-track { display: inline-block; animation: ticker-scroll 60s linear infinite; }
.news-ticker-track:hover { animation-play-state: paused; }
.news-ticker-item { display: inline-block; padding: 0 40px; font-size: 12px; color: #f0e0b0; letter-spacing: .03em; }
.news-ticker-item a { color: #f0e0b0; text-decoration: none; }
.news-ticker-item a:hover { color: var(--gold); }
.news-ticker-item .ticker-impact { color: var(--gold); font-weight: 700; margin-right: 6px; }
.news-ticker-item .ticker-sep { color: #555; margin: 0 20px; }
@media (prefers-reduced-motion: reduce) {
    .news-ticker-track { animation: none; white-space: normal; }
    .live-dot { animation: none; }
}

/* ===== TABS ===== */
.tab-bar { display: flex; border-bottom: 2px solid var(--line); background: #fff; padding: 0 18px; overflow-x: auto; }
.tab-btn { padding: 10px 24px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; cursor: pointer; border: none; background: transparent; color: #aaa; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab-btn.active { border-bottom: 3px solid var(--gold); color: var(--gold); }
.tab-btn.tab-btn-silver.active { color: #9a9a9a; border-bottom-color: #c0c0c0; }
.tab-btn:hover { color: var(--gold-dark); }
.tab-btn .soon { font-size: 8px; color: var(--gold); margin-left: 2px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== MAIN BODY ===== */
.body-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: calc(100vh - 130px); align-items: stretch; }
.data-col { background: #fff; min-height: 100%; min-width: 0; }
.section-header { padding: 11px 18px 8px; font-size: 11px; letter-spacing: .14em; color: var(--gold-dark); text-transform: uppercase; border-bottom: 1px solid var(--line); background: var(--cream-2); font-weight: 600; }
.section-header.spaced { margin-top: 16px; border-top: 1px solid var(--line); }

.rates-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rates-table th { padding: 7px 14px; font-size: 11px; color: var(--gold-dark); letter-spacing: .08em; text-transform: uppercase; text-align: left; border-bottom: 1px solid var(--line); background: var(--cream-2); font-weight: 600; }
.rates-table td { padding: 8px 14px; font-size: 14px; color: #333; border-bottom: 1px solid #f5f0e5; }
.rates-table th.num, .rates-table td.num { text-align: right; }
.rates-table th:first-child { width: 30%; }
.rates-table tr:last-child td { border-bottom: none; }
.rates-table tr:nth-child(even) { background: var(--cream-3); }
.rates-table td.dealer { font-weight: 600; color: var(--ink); font-size: 13px; }
.rates-table td.price { color: #8a5c00; font-weight: 700; font-size: 15px; }
.rates-table td.price span { display: inline-block; padding: 1px 4px; }
.rates-table td.hl { color: #666; font-size: 12px; }
.rates-table td.ts { color: #555; font-size: 11px; }
.rates-table td.empty { text-align: center; color: #aaa; font-size: 12px; padding: 24px; }

/* Dealer tables: Dealer | Commodity | Price | City | Updated (reference layout) */
.dealer-table th:nth-child(1) { width: 18%; }
.dealer-table th:nth-child(2) { width: 34%; }
.dealer-table th:nth-child(3) { width: 16%; }
.dealer-table th:nth-child(4) { width: 14%; }
.dealer-table th:nth-child(5) { width: 18%; }
.dealer-table td.commodity { font-size: 13px; color: #333; }
.dealer-table td.city { font-size: 13px; color: #555; }
.dealer-table td.ts { white-space: nowrap; }
/* Platinum table: Dealer | Commodity | Price | Updated (no City, as on the reference site) */
.dealer-table.no-city th:nth-child(4), .dealer-table.no-city td:nth-child(4) { display: none; }
.dealer-table.no-city th:nth-child(1) { width: 26%; }
.dealer-table.no-city th:nth-child(2) { width: 38%; }
.section-meta { float: right; font-weight: 400; letter-spacing: .04em; text-transform: none; color: #a08040; }

.chart-box { padding: 16px 18px 12px; background: #fff; }

/* Live chart widget (Chart.html chart - d3 + techan, js/cp-chart.js) */
.cp-chart-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 10px; }
.cp-chart-live { display: flex; align-items: baseline; gap: 10px; padding: 6px 12px; border: 1px solid var(--line); background: var(--cream-2); transition: background .3s, color .3s; }
.cp-chart-live-name { font-size: 12px; font-weight: 600; color: var(--ink); letter-spacing: .04em; }
.cp-chart-live-price { font-size: 18px; font-weight: 700; color: #8a5c00; }
.cp-chart-live.up { background: #00AA00; border-color: #00AA00; }
.cp-chart-live.down { background: #FF0000; border-color: #FF0000; }
.cp-chart-live.up span, .cp-chart-live.down span { color: #fff; }
.cp-chart-hl { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-hl { font-size: 11px; font-weight: 600; color: #fff; padding: 5px 10px; border-radius: 3px; letter-spacing: .04em; }
.cp-hl b { font-size: 13px; margin-left: 4px; }
.cp-hl small { font-size: 10px; font-weight: 400; opacity: .9; margin-left: 4px; }
.cp-hl-high { background: green; }
.cp-hl-low { background: red; }
.cp-chart-controls { display: flex; gap: 8px; margin-left: auto; }
.cp-chart-controls select { font: inherit; font-size: 12px; padding: 5px 8px; border: 1px solid var(--line); background: #fff; color: #3a2800; cursor: pointer; }
.cp-chart-plot { width: 100%; min-height: 200px; }
.cp-chart-plot svg { display: block; overflow: hidden; }
.cp-chart-status { font-size: 10px; color: #aaa; margin-top: 6px; }

/* techan styles from Chart.html */
.cp-chart .axis text { font: 10px Arial, sans-serif; fill: #888; }
.cp-chart .axis path, .cp-chart .axis line { fill: none; stroke: #e6dfcc; shape-rendering: crispEdges; }
.cp-chart path.line { fill: none; stroke: #8a6020; stroke-width: 1.5; }
.cp-chart path.ohlc { stroke: #682E3E; stroke-width: 1; }
.cp-chart path.ohlc.up { stroke: #00AA00; }
.cp-chart path.ohlc.down { stroke: #FF0000; }
.cp-chart path.candle { stroke: #682E3E; }
.cp-chart path.candle.body { stroke-width: 0; }
.cp-chart path.candle.up { fill: #00AA00; stroke: #00AA00; }
.cp-chart path.candle.down { fill: #FF0000; stroke: #FF0000; }
.cp-chart .y.annotation.right path { fill: #FF0000; }
.cp-chart .y.annotation.right text { fill: #fff; font: 10px Arial, sans-serif; }

.coming-soon { text-align: center; padding: 60px 20px; color: var(--gold-dark); }
.coming-soon .icon { font-size: 32px; margin-bottom: 12px; }
.coming-soon .title { font-size: 16px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.coming-soon .sub { font-size: 12px; color: #aaa; margin-top: 8px; }

/* ===== RIGHT - NEWS SIDEBAR ===== */
.news-col { background: var(--cream-2); border-left: 1px solid var(--line-2); display: flex; flex-direction: column; min-width: 0; }
.news-col-header { padding: 10px 16px 7px; font-size: 9px; color: var(--gold-dark); letter-spacing: .14em; text-transform: uppercase; border-bottom: 1px solid var(--line-2); font-weight: 600; background: var(--cream-2); display: flex; justify-content: space-between; }
.news-col-header a { color: var(--gold-dark); text-decoration: none; }
#news-container { overflow-y: auto; flex: 1; max-height: 1100px; }
.news-item { padding: 9px 14px; border-bottom: .5px solid var(--line-2); display: flex; gap: 10px; align-items: flex-start; }
.news-item:last-child { border-bottom: none; }
.news-num { font-size: 18px; font-weight: 500; color: #ddd0b0; min-width: 20px; line-height: 1.3; flex-shrink: 0; }
.news-title { font-size: 12px; color: #3a2800; line-height: 1.5; text-decoration: none; display: block; margin-bottom: 3px; }
.news-title:hover { color: var(--gold); }
.news-meta { font-size: 10px; color: #a08040; }
.news-empty { padding: 20px 14px; font-size: 12px; color: #aaa; }

/* ===== ECONOMIC CALENDAR ===== */
.calendar-section { background: #fff; border-top: 1px solid var(--line); }
.calendar-header { padding: 11px 18px 8px; font-size: 11px; letter-spacing: .14em; color: var(--gold-dark); text-transform: uppercase; border-bottom: 1px solid var(--line); background: var(--cream-2); font-weight: 600; }
.calendar-frame-wrap { overflow-x: auto; }
.calendar-frame { width: 100%; min-height: 520px; border: 0; display: block; }

/* ===== PRODUCTS CAROUSEL ===== */
.products-title { padding: 14px 18px 8px; font-size: 16px; letter-spacing: .14em; color: var(--gold-dark); text-transform: uppercase; font-weight: 600; background: #fff; border-top: 1px solid var(--line); text-align: center; }
.carousel { position: relative; width: 100%; overflow: hidden; background: #fff; }
.carousel-track { display: flex; transition: transform .5s ease; }
.carousel-slide { min-width: 100%; display: flex; justify-content: center; align-items: center; padding: 16px 60px; }
.product-card { display: flex; align-items: center; gap: 20px; max-width: 640px; width: 100%; padding: 22px 26px; border: 1px solid var(--line); background: linear-gradient(135deg, #fff 0%, var(--cream-2) 100%); text-decoration: none; color: inherit; }
.product-card:hover { border-color: var(--gold); }
.product-icon { flex-shrink: 0; width: 72px; height: 72px; border-radius: 50%; border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; background: #fff; box-shadow: 0 2px 8px rgba(138, 96, 32, .12); }
.product-icon img { width: 44px; height: 44px; display: block; }
.product-name { display: block; font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.product-desc { display: block; font-size: 13px; color: #777; line-height: 1.5; }
.product-cta { font-size: 11px; color: var(--gold-dark); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; margin-top: 8px; display: inline-block; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); background: #fff; border: 1px solid var(--line); color: var(--gold-dark); font-size: 18px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; }
.carousel-btn:hover { background: var(--cream-2); }
.carousel-prev { left: 10px; }
.carousel-next { right: 10px; }
.carousel-dots { display: flex; justify-content: center; gap: 8px; padding: 8px 0 12px; background: #fff; border-bottom: 1px solid var(--line); }
.carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd4b8; cursor: pointer; border: none; }
.carousel-dot.active { background: var(--gold); }

/* ===== FOOTER ===== */
.footer { background: #fff; border-top: 1px solid var(--line); padding: 12px 18px; font-size: 11px; color: #999; letter-spacing: .04em; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-links a { color: #8a6020; text-decoration: none; margin-left: 14px; }
.footer-links a:first-child { margin-left: 0; }
.footer-links a:hover { text-decoration: underline; }
/* app version - very last line of the page */
.app-version { background: var(--cream-2); border-top: 1px solid var(--line); padding: 6px 18px; font-size: 10px; color: var(--gold-dark); letter-spacing: .08em; text-align: center; }

/* ===== FLOATING CONTACT ===== */
.fab-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 900; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.fab-btn { color: #fff; border-radius: 50px; padding: 12px 20px; display: flex; align-items: center; gap: 10px; text-decoration: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.fab-whatsapp { background: #25D366; }
.fab-call { background: var(--gold-dark); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .body-wrap { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 768px) {
    .header { padding: 8px 12px; gap: 8px; }
    .header-left img { height: 44px; width: 160px; }
    .header-right { gap: 8px; }
    .clock { display: none; }
    .refresh-btn { padding: 6px 12px; font-size: 10px; }
    .live-badge { font-size: 10px; }

    .ticker { grid-template-columns: 1fr 1fr; }
    .ticker-item { border-right: 1px solid #222; border-top: 1px solid #222; }
    .ticker-item:nth-child(2n) { border-right: none; }
    .ticker-item.span-2 { grid-column: span 2; border-right: none; }
    .ticker-divider { display: none; }
    .ticker-val { font-size: 14px; }
    .ticker-label, .ticker-sub { font-size: 8px; }

    .tab-bar { padding: 0 6px; }
    .tab-btn { padding: 9px 12px; font-size: 11px; letter-spacing: .04em; }

    .body-wrap { display: block; min-height: 0; }
    .news-col { border-left: none; border-top: 1px solid var(--line-2); }
    #news-container { max-height: 420px; }

    .section-header { font-size: 10px; padding: 8px 12px 6px; }
    .rates-table { table-layout: auto; }
    .rates-table th, .rates-table td { padding: 7px 8px; font-size: 12px; }
    .rates-table td.price { font-size: 13px; }
    .rates-table .hide-sm { display: none; }
    .chart-box { padding: 12px 10px 10px; }
    .cp-chart-controls { margin-left: 0; width: 100%; }
    .cp-chart-controls select { flex: 1; }
    .cp-chart-live-price { font-size: 16px; }

    .carousel-slide { padding: 12px 46px; }
    .product-card { padding: 14px; gap: 12px; }
    .product-icon { width: 54px; height: 54px; }
    .product-icon img { width: 34px; height: 34px; }
    .product-name { font-size: 15px; }
    .product-desc { font-size: 12px; }
    .carousel-btn { width: 28px; height: 28px; font-size: 14px; }

    .calendar-frame { min-height: 460px; }
    .footer { justify-content: center; text-align: center; }
    .fab-wrap { bottom: 14px; right: 14px; }
    .fab-btn { padding: 10px 14px; font-size: 12px; }
    .fab-btn .fab-text { display: none; }
}

@media (max-width: 768px) {
    .dealer-table { table-layout: fixed; }
    .dealer-table th:nth-child(1) { width: 20%; }
    .dealer-table th:nth-child(2) { width: 28%; }
    .dealer-table th:nth-child(3) { width: 21%; }
    .dealer-table th:nth-child(4) { width: 17%; }
    .dealer-table th:nth-child(5) { width: 14%; }
    .dealer-table th, .dealer-table td { padding-left: 4px; padding-right: 4px; }
    .dealer-table th { font-size: 9px; letter-spacing: 0; overflow-wrap: anywhere; }
    .dealer-table td.dealer, .dealer-table td.commodity { font-size: 11px; overflow-wrap: anywhere; }
    .dealer-table td.city { font-size: 10px; }
    .dealer-table td.ts { font-size: 9px; white-space: normal; }
}

@media (max-width: 480px) {
    .header-login { display: none; } /* Login stays available in the menu */
}

@media (max-width: 420px) {
    .header-left img { width: 130px; }
    .refresh-btn .btn-text { display: none; }
    .rates-table th, .rates-table td { padding: 6px 5px; font-size: 11px; }
    .rates-table td.price { font-size: 12px; }
}

/* ==========================================================
   Clickable dealer rows (home -> Buy / Sell)
   ========================================================== */
.rates-table tr.row-link { cursor: pointer; }
.rates-table tr.row-link:hover td, .rates-table tr.row-link:focus td { background: #f6eedb; }
.rates-table tr.row-link:focus { outline: 2px solid var(--gold-dark); outline-offset: -2px; }

/* Side menu extras */
.site-nav li a.current { background: var(--cream-2); color: var(--gold-dark); font-weight: 700; border-left: 3px solid var(--gold); }
.nav-user { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13px; color: #3a2800; }
.nav-user .nav-user-label { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-dark); margin-bottom: 2px; }
.nav-user b { display: block; }
.nav-user small { color: #999; }

/* ==========================================================
   Inner pages (Login, Buy/Sell, Trades, Orders, Modify, History, Margin)
   ========================================================== */
.page-bar { background: #111; border-bottom: 2px solid var(--gold); padding: 14px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.page-bar h1 { color: #fff; font-size: 16px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.page-bar .crumb { font-size: 11px; color: #c9b27a; letter-spacing: .06em; }
.page-bar .crumb a { color: #f0e0b0; text-decoration: none; }
.page-bar .crumb a:hover { color: var(--gold); }

.page-wrap { max-width: 1100px; margin: 0 auto; padding: 22px 18px 90px; min-height: calc(100vh - 220px); }
.page-wrap.narrow { max-width: 520px; }
.card { background: #fff; border: 1px solid var(--line); margin-bottom: 18px; }
.card-body { padding: 18px; }
.card .section-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.cp-form .field { margin-bottom: 14px; }
.cp-form label { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dark); font-weight: 600; margin-bottom: 6px; }
.cp-form input, .cp-form select, .cp-form textarea { width: 100%; font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid #e0d6bd; background: #fff; color: var(--ink); border-radius: 0; }
.cp-form input:focus, .cp-form select:focus, .cp-form textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.cp-form input[readonly] { background: var(--cream-2); color: #555; }
.cp-form .hint { font-size: 11px; color: #999; margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 12px 20px; text-decoration: none; transition: background .2s, opacity .2s; }
.btn:disabled, .btn.is-busy { opacity: .55; cursor: wait; }
.btn-block { width: 100%; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-hover); }
.btn-dark { background: var(--gold-dark); color: #fff; }
.btn-dark:hover { background: #6f4c17; }
.btn-outline { background: #fff; color: var(--gold-dark); border: 1px solid var(--gold); }
.btn-outline:hover { background: var(--cream-2); }
.btn-buy { background: #1f7a35; color: #fff; }
.btn-buy:hover { background: #17612a; }
.btn-sell { background: #c0392b; color: #fff; }
.btn-sell:hover { background: #9f2f23; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.cp-notice { padding: 10px 14px; font-size: 13px; margin-bottom: 14px; border-left: 4px solid; }
.cp-notice.info { background: #fbf6ea; border-color: var(--gold); color: #6b4a14; }
.cp-notice.success { background: #eaf6ec; border-color: #1f7a35; color: #1f5d2b; }
.cp-notice.error { background: #fbecea; border-color: #c0392b; color: #8e2a20; }

/* segmented control (Market / Limit) */
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--gold); margin-bottom: 16px; }
.segmented button { background: #fff; border: none; padding: 10px; font: inherit; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--gold-dark); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--gold); color: #fff; }

/* live quote boxes on Buy / Sell */
.quote-head { text-align: center; padding: 16px 18px 6px; }
.quote-name { font-size: 18px; font-weight: 700; color: var(--ink); }
.quote-sub { font-size: 11px; color: #999; letter-spacing: .08em; margin-top: 2px; }
.quote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 18px 18px; }
.quote-box { border: 1px solid var(--line); background: var(--cream-2); text-align: center; padding: 12px 8px; transition: background .3s, color .3s; }
.quote-box .lbl { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-dark); font-weight: 600; }
.quote-box .val { font-size: 24px; font-weight: 700; color: #8a5c00; margin-top: 4px; }
.quote-box.up { background: #1f7a35; border-color: #1f7a35; }
.quote-box.down { background: #c0392b; border-color: #c0392b; }
.quote-box.up .lbl, .quote-box.up .val, .quote-box.down .lbl, .quote-box.down .val { color: #fff; }

/* order / trade lists */
.list-table { width: 100%; border-collapse: collapse; }
.list-table th { padding: 8px 12px; font-size: 11px; color: var(--gold-dark); letter-spacing: .08em; text-transform: uppercase; text-align: left; border-bottom: 1px solid var(--line); background: var(--cream-2); font-weight: 600; }
.list-table td { padding: 10px 12px; font-size: 14px; color: #333; border-bottom: 1px solid #f5f0e5; vertical-align: top; }
.list-table th.num, .list-table td.num { text-align: right; }
.list-table tr:nth-child(even) td { background: var(--cream-3); }
.list-table td.empty { text-align: center; color: #aaa; font-size: 13px; padding: 28px; }
.list-table td .meta { display: block; font-size: 11px; color: #999; margin-top: 3px; }
.list-table tr.row-link { cursor: pointer; }
.list-table tr.row-link:hover td, .list-table tr.row-link:focus td { background: #f6eedb; }
.list-table tr.row-link:focus { outline: 2px solid var(--gold-dark); outline-offset: -2px; }
.bs { display: inline-block; min-width: 26px; text-align: center; font-size: 11px; font-weight: 700; padding: 3px 6px; color: #fff; }
.bs.b { background: #1f7a35; }
.bs.s { background: #c0392b; }
.list-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: #999; }
.list-tools .btn { padding: 7px 12px; font-size: 11px; }

/* margin key / value */
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table th, .kv-table td { padding: 12px 16px; border-bottom: 1px solid #f5f0e5; font-size: 14px; }
.kv-table th { text-align: left; color: #3a2800; font-weight: 600; width: 55%; }
.kv-table td { text-align: right; color: #8a5c00; font-weight: 700; font-size: 16px; }
.kv-table tr:nth-child(even) th, .kv-table tr:nth-child(even) td { background: var(--cream-3); }

.account-box { text-align: center; padding: 10px 0 4px; }
.account-box .avatar { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--gold); display: inline-flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: var(--gold-dark); background: var(--cream-2); margin-bottom: 10px; }
.account-box .who { font-size: 18px; font-weight: 700; color: var(--ink); }
.account-box .id { font-size: 12px; color: #999; margin: 4px 0 18px; }

@media (max-width: 768px) {
    .page-bar { padding: 12px 14px; }
    .page-bar h1 { font-size: 14px; }
    .page-wrap { padding: 16px 12px 90px; }
    .list-table th, .list-table td { padding: 8px 6px; font-size: 12px; }
    .list-table .hide-sm { display: none; }
    .quote-box .val { font-size: 20px; }
}
