/* ==========================================================================
   PUBLIC MARKETS DASHBOARD v3.0
   Clean stylesheet — all classes use pm-* prefix
   ========================================================================== */

/* --------------------------------------------------------------------------
   RESET & BASE
   -------------------------------------------------------------------------- */
.pm-container *,
.pm-container *::before,
.pm-container *::after {
    box-sizing: border-box;
}

.pm-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 8px 40px;
    color: #e0e6ed;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.pm-container a {
    color: #ffffff;
    text-decoration: none;
}

.pm-container a:hover {
    color: #76BCAB;
}

/* --------------------------------------------------------------------------
   HEADER
   -------------------------------------------------------------------------- */
.pm-header {
    padding: 12px 0 8px;
}

.pm-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.pm-title {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.pm-subtitle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pm-subtitle {
    font-size: 15px;
    color: #a7b2c2;
    margin: 0;
    flex: 1;
    min-width: 260px;
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */
.pm-btn-outline {
    padding: 4px 12px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    background: transparent;
    transition: opacity 0.2s;
}

.pm-btn-outline:hover {
    opacity: 0.8;
}

.pm-btn-gold {
    border: 1px solid #f0b90b;
    color: #f0b90b;
}

.pm-btn-blue {
    border: 1px solid #4aa3ff;
    color: #4aa3ff;
}

.pm-btn-signup {
    color: #ffffff;
    background: #0f6d86;
    border: 1px solid #0f6d86;
    padding: 4px 10px;
    border-radius: 3px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.pm-btn-sm {
    padding: 6px 14px;
    background: #1c2a3a;
    color: #c8d7ef;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.pm-btn-sm:hover {
    background: #253548;
    border-color: rgba(255, 255, 255, 0.2);
}

/* --------------------------------------------------------------------------
   SHARE BUTTON & MENU
   -------------------------------------------------------------------------- */
.pm-share-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.pm-share-btn {
    padding: 4px 14px;
    background: #1c2a3a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    color: #c8d7ef;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.1;
    white-space: nowrap;
}

.pm-share-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: #1e2329;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    z-index: 20;
    white-space: nowrap;
}

.pm-share-wrap.is-open .pm-share-menu {
    display: inline-flex;
}

.pm-share-menu a {
    font-size: 11px;
    color: #c8d7ef;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 2px 6px;
    border-radius: 3px;
}

.pm-share-menu a:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

/* --------------------------------------------------------------------------
   TAB NAVIGATION
   -------------------------------------------------------------------------- */
.pm-tabs-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 10px 0 14px;
    padding-bottom: 4px;
    position: relative;
}

.pm-tabs-wrap::-webkit-scrollbar {
    display: none;
}

.pm-tabs {
    display: flex;
    gap: 6px;
    background: rgba(30, 35, 41, 0.8);
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
}

.pm-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #8a95a5;
    background: transparent;
    border: 1px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    text-decoration: none;
}

.pm-tab:hover {
    color: #76BCAB;
    background: #141b24;
    border-color: rgba(255, 255, 255, 0.06);
}

.pm-tab.active {
    color: #f0b90b;
    background: #1e2329;
    border-color: rgba(255, 255, 255, 0.08);
}

.pm-info-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 11px;
    color: #8a95a5;
    background: rgba(255, 255, 255, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   DIVIDER
   -------------------------------------------------------------------------- */
.pm-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 0 14px;
}

/* --------------------------------------------------------------------------
   GRID LAYOUTS
   -------------------------------------------------------------------------- */
.pm-grid-2col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   PANEL (card wrapper)
   -------------------------------------------------------------------------- */
.pm-panel {
    background: #131b27;
    border: 1px solid #1e2a3a;
    border-radius: 10px;
    padding: 16px;
}

.pm-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.pm-panel-title {
    font-size: 1.125em;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.pm-export-btn {
    background: #1c2a3a;
    color: #c8d7ef;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
}

.pm-export-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   TABLE — BASE
   -------------------------------------------------------------------------- */
.pm-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0;
}

.pm-table thead th {
    background: #182234;
    border-bottom: 1px solid #243042;
    padding: 9px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #8a95a5;
    text-align: left;
    white-space: nowrap;
}

.pm-table tbody td {
    padding: 10px 8px;
    font-size: 14px;
    border-bottom: 1px solid #1a2435;
    vertical-align: middle;
    color: #e0e6ed;
}

.pm-table tbody tr {
    transition: background 0.15s;
}

.pm-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

.pm-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Clickable rows */
.pm-row-clickable {
    cursor: pointer;
}

/* Sortable headers */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    background: #1f3048;
}

th.sortable .sort-icon {
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.4;
}

th.sortable.sort-asc .sort-icon,
th.sortable.sort-desc .sort-icon {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   TABLE — OVERVIEW COLUMN WIDTHS
   -------------------------------------------------------------------------- */
.pm-table--overview th:nth-child(1),
.pm-table--overview td:nth-child(1) { width: 22%; }

.pm-table--overview th:nth-child(2),
.pm-table--overview td:nth-child(2) { width: 12%; }

.pm-table--overview th:nth-child(3),
.pm-table--overview td:nth-child(3) { width: 14%; }

.pm-table--overview th:nth-child(4),
.pm-table--overview td:nth-child(4) { width: 10%; }

.pm-table--overview th:nth-child(5),
.pm-table--overview td:nth-child(5),
.pm-table--overview th:nth-child(6),
.pm-table--overview td:nth-child(6),
.pm-table--overview th:nth-child(7),
.pm-table--overview td:nth-child(7) { width: 5%; }

.pm-table--overview th:nth-child(8),
.pm-table--overview td:nth-child(8) { width: 27%; }

/* Signal columns — centered */
.pm-col-signal {
    width: 43px;
    min-width: 43px;
    max-width: 43px;
    padding-left: 6px !important;
    padding-right: 6px !important;
    text-align: center;
}

/* --------------------------------------------------------------------------
   TABLE — RISK COLUMN WIDTHS
   -------------------------------------------------------------------------- */
.pm-table--risk th:nth-child(1),
.pm-table--risk td:nth-child(1) { width: 30%; }

.pm-table--risk th:nth-child(2),
.pm-table--risk td:nth-child(2) { width: 22%; }

.pm-table--risk th:nth-child(3),
.pm-table--risk td:nth-child(3) { width: 18%; }

.pm-table--risk th:nth-child(4),
.pm-table--risk td:nth-child(4) { width: 30%; }

/* --------------------------------------------------------------------------
   TABLE — NEWS COLUMN WIDTHS
   -------------------------------------------------------------------------- */
.pm-table--news {
    table-layout: fixed;
}

.pm-table--news th:nth-child(1),
.pm-table--news td:nth-child(1) {
    width: 60px;
    max-width: 60px;
    min-width: 50px;
}

.pm-table--news th:nth-child(2),
.pm-table--news td:nth-child(2) {
    width: auto;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.pm-table--news td:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sticky news header */
#pm-news-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

#pm-news-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* --------------------------------------------------------------------------
   TABLE — CALENDAR COLUMN WIDTHS
   -------------------------------------------------------------------------- */
.pm-table--cal th:nth-child(1),
.pm-table--cal td:nth-child(1) {
    width: 60px;
    max-width: 60px;
}

.pm-table--cal th:nth-child(2),
.pm-table--cal td:nth-child(2) {
    width: auto;
}

.pm-table--cal th:nth-child(3),
.pm-table--cal td:nth-child(3),
.pm-table--cal th:nth-child(4),
.pm-table--cal td:nth-child(4) {
    width: 80px;
    max-width: 80px;
    text-align: right;
}

/* Sticky calendar header */
#pm-calendar-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

#pm-calendar-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* --------------------------------------------------------------------------
   VALUE COLORING
   -------------------------------------------------------------------------- */
.val-pos { color: #3cff8f !important; }
.val-neg { color: #ff5252 !important; }
.val-neutral { color: #8a95a5 !important; }

/* Price flash on tick */
.pr-value {
    transition: color 0.3s ease;
}

.price-up {
    color: #3cff8f !important;
}

.price-down {
    color: #ff5252 !important;
}

/* --------------------------------------------------------------------------
   SIGNAL SQUARES
   -------------------------------------------------------------------------- */
.sq-green      { color: #39ff88; font-size: 11px; }
.sq-semi-green { color: #80ffb5; font-size: 11px; }
.sq-red        { color: #ff4c61; font-size: 11px; }
.sq-semi-red   { color: #ff8b97; font-size: 11px; }
.sq-grey       { color: #cccccc; font-size: 11px; }

/* --------------------------------------------------------------------------
   MARKET CELL (star + name)
   -------------------------------------------------------------------------- */
.pm-market-cell {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pm-signup-star {
    color: #8ea0c2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 70%;
    line-height: 1;
    transition: color 0.15s;
}

.pm-signup-star:hover,
.pm-signup-star:focus {
    color: #ffffff;
    outline: none;
}

.pm-follow-star {
    color: #8ea0c2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 70%;
    line-height: 1;
    transition: color 0.15s;
}

.pm-follow-star:hover,
.pm-follow-star:focus {
    color: #f5c842;
    outline: none;
}

.pm-follow-star.is-followed {
    color: #f5c842;
}

/* --------------------------------------------------------------------------
   LAST 24H SPARKLINE
   -------------------------------------------------------------------------- */
.pm-last24h-cell {
    min-width: 160px;
}

.pm-last24h-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.pm-last24h-chart {
    width: 96px;
    height: 28px;
    display: inline-flex;
    align-items: center;
}

.pm-last24h-chart svg {
    width: 96px;
    height: 28px;
    display: block;
}

.pm-last24h-empty {
    color: #7e8794;
    font-size: 12px;
}

/* --------------------------------------------------------------------------
   SCROLL PANELS (News & Calendar)
   -------------------------------------------------------------------------- */
.pm-scroll-panel {
    height: 500px;
    display: flex;
    flex-direction: column;
}

.pm-scroll-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #76BCAB #1a2435;
}

.pm-scroll-body::-webkit-scrollbar {
    width: 10px;
}

.pm-scroll-body::-webkit-scrollbar-track {
    background: #1a2435;
    border-radius: 5px;
}

.pm-scroll-body::-webkit-scrollbar-thumb {
    background: #76BCAB;
    border-radius: 5px;
    border: 2px solid #1a2435;
}

.pm-scroll-body::-webkit-scrollbar-thumb:hover {
    background: #5fa896;
}

/* --------------------------------------------------------------------------
   NEWS — NEW ITEM HIGHLIGHT + RESUME BUTTON
   -------------------------------------------------------------------------- */
.pm-news-new td {
    animation: pm-news-flash 2s ease-out;
}

@keyframes pm-news-flash {
    0%   { background: rgba(118, 188, 171, 0.2); }
    100% { background: transparent; }
}

.pm-news-resume {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    text-align: center;
    background: rgba(118, 188, 171, 0.12);
    border-color: rgba(118, 188, 171, 0.3);
    color: #76BCAB;
}

.pm-news-resume:hover {
    background: rgba(118, 188, 171, 0.2);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   NEWS BOOKMARKS
   -------------------------------------------------------------------------- */
.pm-bookmark {
    float: right;
    cursor: pointer;
    color: #76BCAB;
    padding: 8px;
    margin: -8px;
    transition: color 0.15s;
}

.pm-bookmark:hover {
    color: #5fa896;
}

.bookmarked-row {
    background: #2a3d4a !important;
}

.bookmarked-row:hover {
    background: #324856 !important;
}

/* --------------------------------------------------------------------------
   ASSET SECTIONS
   -------------------------------------------------------------------------- */
.pm-section {
    margin-bottom: 20px;
}

.pm-section-blurb {
    font-size: 12px;
    color: #8a95a5;
    margin: -6px 0 10px;
    line-height: 1.45;
}

.pm-section-footer {
    margin-top: 10px;
    text-align: right;
}

.pm-section-loading {
    padding: 10px 12px;
    color: #9aa3ad;
    font-size: 12px;
}

/* Hide extra rows; show when expanded */
.pm-section .pm-row-extra {
    display: none;
}

.pm-section.pm-expanded .pm-row-extra {
    display: table-row;
}

/* --------------------------------------------------------------------------
   SNAPSHOT CARDS (mobile only)
   -------------------------------------------------------------------------- */
.pm-snapshot-grid {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.pm-snapshot-card {
    background: #131b27;
    border: 1px solid #1e2a3a;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: background 0.2s;
}

.pm-snapshot-card:hover {
    background: #1a2636;
}

.pm-snapshot-card .label {
    font-size: 12px;
    color: #8a95a5;
}

.pm-snapshot-card .price {
    font-size: 18px;
    font-weight: 600;
    margin-top: 4px;
}

.pm-snapshot-card .change {
    font-size: 13px;
    font-weight: 600;
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   MACRO LOGIC OVERLAY & PANEL
   -------------------------------------------------------------------------- */
.pm-logic-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 999;
}

.pm-logic-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.pm-logic-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: min(92vw, 420px);
    height: 100%;
    background: #161a1e;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.2s, visibility 0.2s;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.pm-logic-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.pm-logic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pm-logic-header h2 {
    margin: 0;
    font-size: 14px;
    color: #f0b90b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.pm-logic-close {
    background: none;
    border: none;
    color: #9aa3ad;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.pm-logic-close:hover {
    color: #ffffff;
}

.pm-logic-content {
    padding: 16px 18px 20px;
    overflow-y: auto;
    color: #e0e6ed;
    font-size: 14px;
    line-height: 1.55;
}

.pm-no-scroll {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   TRENDS VIEW — compact multi-column grid
   -------------------------------------------------------------------------- */
.pm-trends-view {
    margin-top: 8px;
}

.pm-trends-back {
    margin: 0 0 12px 0;
    width: 100%;
    justify-content: center;
    text-align: center;
}

.pm-trends-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
}

.pm-trends-col {
    min-width: 0;
    background: rgba(30, 35, 41, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 6px;
    padding: 8px;
}

.pm-trends-col h3 {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 700;
    color: #d8e3f5;
    line-height: 1.25;
    letter-spacing: 0.2px;
}

.pm-trends-subsection + .pm-trends-subsection {
    margin-top: 12px;
}

/* Compact table inside trends columns */
.pm-table--trends {
    table-layout: auto;
}

.pm-table--trends th,
.pm-table--trends td {
    font-size: 11px;
    padding: 3px 4px;
    line-height: 1.2;
}

.pm-table--trends th:nth-child(1),
.pm-table--trends td:nth-child(1) {
    width: 52%;
}

.pm-table--trends th:nth-child(2),
.pm-table--trends td:nth-child(2),
.pm-table--trends th:nth-child(3),
.pm-table--trends td:nth-child(3) {
    width: 24%;
    text-align: right;
    white-space: nowrap;
}

/* Responsive: 3 columns on medium screens */
@media (max-width: 1300px) {
    .pm-trends-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pm-table--trends th,
    .pm-table--trends td {
        font-size: 10px;
        padding: 3px;
    }
}

/* Responsive: single column on mobile */
@media (max-width: 767px) {
    .pm-trends-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pm-trends-col h3 {
        font-size: 13px;
    }

    .pm-table--trends th,
    .pm-table--trends td {
        font-size: 12px;
        padding: 4px 5px;
    }
}

/* --------------------------------------------------------------------------
   GO TO TOP
   -------------------------------------------------------------------------- */
.pm-go-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 42px;
    height: 42px;
    background: rgba(42, 60, 72, 0.9);
    border: 1px solid #3d4f63;
    color: #ffffff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 900;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.pm-go-top:hover {
    background: rgba(118, 188, 171, 0.9);
    border-color: #76BCAB;
    transform: translateY(-3px);
}

.pm-go-top i {
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   PAGE STATS FOOTER
   -------------------------------------------------------------------------- */
.pm-page-stats {
    margin-top: 24px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    font-size: 12px;
    color: #6b7a8d;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pm-page-stats strong {
    color: #a7b2c2;
    font-weight: 600;
}

.pm-stat-sep {
    color: #3d4f63;
}

/* --------------------------------------------------------------------------
   TOUCH & INTERACTION
   -------------------------------------------------------------------------- */
.sortable,
.pm-btn-outline,
.pm-btn-sm,
.pm-share-btn,
.pm-export-btn,
.pm-info-dot,
.pm-bookmark,
.pm-signup-star,
.pm-follow-star,
.pm-row-clickable {
    -webkit-tap-highlight-color: rgba(118, 188, 171, 0.2);
    -webkit-touch-callout: none;
    user-select: none;
}

/* Touch targets — minimum 44px */
.pm-btn-outline,
.pm-btn-sm,
.pm-share-btn,
.pm-go-top,
.pm-logic-close {
    min-height: 44px;
    min-width: 44px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE — TABLET (≤1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .pm-grid-2col {
        grid-template-columns: 1fr;
    }

    .pm-scroll-panel {
        height: 450px;
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVE — MOBILE (≤768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .pm-title {
        font-size: 18px;
    }

    .pm-subtitle {
        font-size: 13px;
        min-width: unset;
    }

    .pm-tabs {
        width: max-content;
        min-width: unset;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 8px;
        padding: 8px 10px;
    }

    .pm-tabs-wrap::after {
        content: '\203A';
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 28px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        color: #8ea0c2;
        background: linear-gradient(90deg, rgba(30, 35, 41, 0) 0%, rgba(30, 35, 41, 0.9) 70%);
        border-radius: 10px;
    }

    /* Snapshot grid visible */
    .pm-snapshot-grid {
        display: grid;
    }

    .pm-snapshot-card {
        min-height: 99px;
        max-height: 99px;
        padding: 10px;
    }

    .pm-snapshot-card .label {
        font-size: 11px;
    }

    .pm-snapshot-card .price {
        font-size: 16px;
        line-height: 1.1;
    }

    .pm-snapshot-card .change {
        font-size: 12px;
    }

    /* Panel adjustments */
    .pm-panel {
        padding: 12px;
    }

    .pm-scroll-panel {
        height: 400px;
    }

    /* Table adjustments */
    .pm-table thead th,
    .pm-table tbody td {
        font-size: 12px;
        padding: 7px 5px;
    }

    .pm-panel-title {
        font-size: 15px;
    }

    /* Market tables horizontal scroll */
    .pm-table--overview {
        min-width: 600px;
    }

    .pm-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pm-section::-webkit-scrollbar {
        height: 8px;
    }

    .pm-section::-webkit-scrollbar-track {
        background: #1a2435;
    }

    .pm-section::-webkit-scrollbar-thumb {
        background: #76BCAB;
        border-radius: 4px;
    }

    /* Logic panel — bottom sheet on mobile */
    .pm-logic-panel {
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 80vh;
        border-radius: 16px 16px 0 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        transform: translateY(100%);
    }

    .pm-logic-panel.is-open {
        transform: translateY(0);
    }

    /* News table mobile */
    #pm-news-table th:nth-child(1),
    #pm-news-table td:nth-child(1) {
        width: 50px;
        max-width: 50px;
        min-width: 45px;
        font-size: 11px;
    }

    #pm-news-table th:nth-child(2),
    #pm-news-table td:nth-child(2) {
        font-size: 12px;
        line-height: 1.4;
    }

    /* Bookmark touch target */
    .pm-bookmark {
        padding: 10px;
        margin: -10px;
        font-size: 14px;
    }

    /* Scrollbar mobile */
    .pm-scroll-body::-webkit-scrollbar {
        width: 8px;
    }

    /* Page stats stack */
    .pm-page-stats {
        font-size: 11px;
    }
}

/* --------------------------------------------------------------------------
   RESPONSIVE — SMALL MOBILE (≤480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .pm-container {
        padding: 0 6px 30px;
        font-size: 13px;
    }

    .pm-snapshot-grid {
        gap: 8px;
    }

    .pm-snapshot-card {
        min-height: 88px;
        max-height: 88px;
        padding: 8px;
    }

    .pm-snapshot-card .price {
        font-size: 15px;
    }

    .pm-snapshot-card .change {
        font-size: 11px;
    }

    .pm-panel {
        padding: 10px;
    }

    .pm-table thead th,
    .pm-table tbody td {
        font-size: 11px;
        padding: 5px 3px;
    }

    .pm-table--overview {
        min-width: 500px;
    }

    .pm-go-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .pm-scroll-panel {
        height: 360px;
    }

    /* News table small mobile */
    #pm-news-table th:nth-child(1),
    #pm-news-table td:nth-child(1) {
        width: 45px;
        max-width: 45px;
        min-width: 40px;
        font-size: 10px;
    }

    #pm-news-table th:nth-child(2),
    #pm-news-table td:nth-child(2) {
        font-size: 11px;
        line-height: 1.3;
    }
}
