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

body {
    /* Native system fonts for each platform:
       iOS: SF Pro Text/Display (Regular, Medium, Bold)
       Android: Roboto (Regular, Medium, Bold)
       Windows: Segoe UI (Regular, Semibold)
       macOS: SF Pro (Regular, Bold)
    */
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 400; /* Regular by default */
    background: #fff;
    color: #333;
}

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 50px;
    background: #2c3e50;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}

.sidebar-icon {
    width: 30px;
    height: 30px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
    cursor: pointer;
    font-size: 18px;
}

.sidebar-icon:hover {
    color: #2563eb;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.header-btn {
    padding: 5px 15px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}

.header-btn:hover {
    background: #f0f0f0;
}

.header-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.new-order-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 3px;
    cursor: pointer;
    margin-left: auto;
}

/* Trading Area */
.trading-area {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Chart Section */
.chart-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.chart-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eceff3;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    margin-bottom: 8px;
}

/* Hidden by default, shown on mobile */
.mobile-pairs-btn {
    display: none;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* Generic icon button (used for hamburger) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
}

.icon-btn:active { opacity: 0.8; }

/* Simple glyph inside icon button */
.icon-glyph {
    font-size: 18px;
    color: #4b5563;
    line-height: 1;
}

.hamburger {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 2px;
    background: #4b5563; /* slate-600 */
    border-radius: 2px;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: #4b5563;
    border-radius: 2px;
}

.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

.chart-container {
    flex: 1;
    padding: 20px;
    background: #fff;
    position: relative;
    min-height: 400px;
}

.chart-pair-label {
    font-weight: 700;
    font-size: 16px;
    margin: 8px 12px 12px;
    color: #1f2937;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-edit-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.chart-placeholder {
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
}

/* Symbol List */
.symbol-list {
    width: 320px;
    background: #fff;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.symbol-search {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.symbol-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

.symbol-list-items {
    flex: 1;
    overflow-y: auto;
}

.symbol-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.symbol-item:hover {
    background: #f8f9fa;
}

.symbol-name {
    font-weight: 600;
    font-size: 14px;
}

.symbol-prices {
    display: flex;
    gap: 15px;
    font-size: 13px;
}

.price-bid {
    color: #e74c3c;
}

.price-ask {
    color: #27ae60;
}

.symbol-change {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 3px;
}

.symbol-change.up {
    background: #d4edda;
    color: #27ae60;
}

.symbol-change.down {
    background: #f8d7da;
    color: #e74c3c;
}

/* Bottom Panel */
.bottom-panel {
    height: 200px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.panel-tabs {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.panel-tab {
    padding: 5px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #7f8c8d;
}

.panel-tab.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

.panel-content {
    flex: 1;
    padding: 15px 20px;
    overflow-y: auto;
}

.account-info {
    display: flex;
    gap: 30px;
    font-size: 13px;
    margin-bottom: 15px;
}

.info-item {
    display: flex;
    gap: 10px;
}

.info-label {
    color: #7f8c8d;
}

.info-value {
    font-weight: 600;
}

.positions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    
}

.positions-table th {
    text-align: left;
    padding: 8px;
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.positions-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.trades-history{
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    display: none;
}

.trades-history th{
    text-align: left;
    padding: 8px;
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.trades-history td{
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.deals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.deals-table th {
    text-align: left;
    padding: 8px;
    background: #fff;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
}

.deals-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.no-positions {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.create-order-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 400px;
    border-radius: 5px;
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-weight: 600;
    font-size: 16px;
}

.modal-close {
    cursor: pointer;
    font-size: 20px;
    color: #7f8c8d;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow: hidden; /* inner list will scroll */
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

.price-display {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.price-btn {
    flex: 1;
    padding: 40px 20px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-radius: 3px;
}

.sell-btn {
    background: #e74c3c;
    color: #fff;
}

.buy-btn {
    background: #2563eb;
    color: #fff;
}

.price-value {
    font-size: 12px;
    margin-top: 5px;
}

/* Mobile View */
.mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .container {
        flex-direction: column;
        padding-bottom: 70px;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        width: 100%;
    }

    /* Hide header on mobile for full chart view */
    .header {
        display: none;
    }

    /* Trading area stacks vertically */
    .trading-area {
        flex-direction: column;
        overflow-y: auto;
        flex: 1;
    }

    /* Chart takes full available space on mobile */
    .chart-section {
        width: 100%;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .chart-header {
        padding: 10px 15px;
        font-size: 13px;
    }

    /* Show the Pairs button in header on mobile */
    .mobile-pairs-btn {
        display: inline-flex;
    }

    .chart-container {
        flex: 1;
        padding: 0;
        min-height: 100%;
        height: 100%;
    }

    .chart-pair-label {
        font-size: 18px;
        margin: 12px 16px 16px;
    }

    .chart-edit-btn {
        width: 28px;
        height: 28px;
        font-size: 15px;
    }

    /* Hide symbol list on mobile */
    .symbol-list {
        display: none;
    }

    /* Hide bottom panel on mobile */
    .bottom-panel {
        display: none;
    }

    /* Modal adjustments for mobile */
    .modal-content {
        width: 90%;
        max-width: 350px;
        margin: 0 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .price-display {
        flex-direction: column;
        gap: 8px;
    }

    .price-btn {
        padding: 30px 15px;
        font-size: 14px;
    }

    /* Mobile navigation */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        padding: 8px 0 10px;
        justify-content: space-around;
        align-items: flex-start;
        z-index: 999;
        box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.08);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        font-size: 11px;
        color: #9ca3af;
        cursor: pointer;
        text-decoration: none;
        padding: 4px 8px;
        transition: all 0.15s ease;
        flex: 1;
        max-width: 80px;
        font-weight: 500;
    }

    .mobile-nav-item .nav-icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #9ca3af;
        transition: color 0.15s ease;
    }

    .mobile-nav-item .nav-icon svg {
        width: 100%;
        height: 100%;
        stroke: currentColor;
        fill: none;
        stroke-width: 2;
    }

    .mobile-nav-item .nav-icon img {
        width: 100%;
        height: 100%;
        filter: invert(61%) sepia(13%) saturate(445%) hue-rotate(201deg) brightness(95%) contrast(87%);
        transition: filter 0.15s ease;
    }

    .mobile-nav-item.active .nav-icon img {
        filter: invert(32%) sepia(72%) saturate(1570%) hue-rotate(195deg) brightness(95%) contrast(95%);
    }

    .mobile-nav-item.active {
        color: #2563eb;
    }

    .mobile-nav-item.active .nav-icon {
        color: #2563eb;
    }

    .mobile-nav-item:active {
        opacity: 0.6;
    }
}

@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .mobile-nav {
        background: #0f141a;
        border-top-color: #1f2a37;
        box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.4);
    }

    .mobile-nav-item {
        color: #9aa4b2;
    }

    .mobile-nav-item .nav-icon {
        color: #9aa4b2;
    }

    .mobile-nav-item .nav-icon img {
        filter: invert(74%) sepia(9%) saturate(380%) hue-rotate(176deg) brightness(95%) contrast(90%);
    }

    .mobile-nav-item.active {
        color: #4da3ff;
    }

    .mobile-nav-item.active .nav-icon {
        color: #4da3ff;
    }

    .mobile-nav-item.active .nav-icon img {
        filter: invert(63%) sepia(71%) saturate(1248%) hue-rotate(189deg) brightness(100%) contrast(96%);
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .symbol-list {
        width: 280px;
    }

    .chart-container {
        padding: 15px;
    }

    .account-info {
        gap: 20px;
        font-size: 12px;
        flex-wrap: wrap;
    }

    .bottom-panel {
        height: 180px;
    }
}

/* Large screens */
@media (min-width: 1400px) {
    .symbol-list {
        width: 360px;
    }

    .chart-container {
        padding: 30px;
    }
}

/* Fancy Pairs Scroll List */
.pairs-actions {
    position: sticky;
    top: 0;
    background: #fff;
    padding-bottom: 10px;
    margin-bottom: 10px;
    z-index: 1;
}

.pairs-actions .actions-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pairs-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.pairs-action-btn {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}

.pairs-action-btn.primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.pairs-scroll {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 6px;
}

.pairs-scroll::-webkit-scrollbar {
    width: 8px;
}

.pairs-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 8px;
}

.pairs-scroll::-webkit-scrollbar-track {
    background: #fff;
}

.pair-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid #eef0f3;
    border-radius: 10px;
    background: #fff;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 8px;
}

.pair-row:hover {
    background: #fff;
}

.pair-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pair-code {
    font-weight: 600;
    font-size: 14px;
}

.pair-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}