* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #0f1420;
    color: #e0e0e0;
}

/* ---------- Layout Wrapper ---------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar (Desktop Default) ---------- */
.sidebar {
    width: 220px;
    background: #141a2b;
    padding: 20px 0;
    flex-shrink: 0;
    border-right: 1px solid #232b40;
}
.sidebar h1 {
    font-size: 16px;
    color: #fff;
    padding: 0 20px 20px;
    border-bottom: 1px solid #232b40;
    margin-bottom: 15px;
}
.sidebar a {
    display: block;
    padding: 12px 20px;
    color: #9aa5c0;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar a:hover { background: #1c2338; color: #fff; }
.sidebar a.active {
    background: #1c2338;
    color: #fff;
    border-left: 3px solid #4f8cff;
    font-weight: 600;
}

/* ---------- Mobile Topbar (hidden on desktop) ---------- */
.mobile-topbar {
    display: none;
}

/* ---------- Main Content ---------- */
.main {
    flex-grow: 1;
    padding: 25px 35px;
    min-width: 0;
    max-width: 100%;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}
.topbar h2 { font-size: 20px; color: #fff; }
.topbar .meta { font-size: 12px; color: #7a869e; }

/* ---------- Cards ---------- */
.cards { display: flex; gap: 15px; margin-bottom: 25px; flex-wrap: wrap; }
.card {
    background: #171d2e;
    border: 1px solid #232b40;
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 160px;
    flex: 1 1 160px;
}
.card .label { font-size: 12px; color: #7a869e; margin-bottom: 6px; }
.card .value { font-size: 22px; font-weight: 700; color: #fff; }

/* ---------- Table ---------- */
.table-wrap {
    background: #171d2e;
    border: 1px solid #232b40;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th {
    background: #1c2338;
    color: #9aa5c0;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
}
td {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #232b40;
    white-space: nowrap;
}
tr:hover td { background: #1c2338; }
td.symbol { font-weight: 700; color: #fff; text-align: left; padding-left: 15px; }

/* ---------- Badges ---------- */
.badge { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; display: inline-block; }
.badge-exceptional { background: #0f9d58; color: #fff; }
.badge-strong { background: #f4b400; color: #1a1a1a; }
.badge-good { background: #4f8cff; color: #fff; }
.badge-weak { background: #3a4258; color: #c0c8dc; }
.flag-yes { background: #16351f; color: #4ade80; padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.flag-no  { background: #3a1a1f; color: #f87171; padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.pct-pos { color: #4ade80; font-weight: 700; }
.pct-neg { color: #f87171; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: #4f8cff;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    margin: 5px 5px 5px 0;
}
.btn:hover { background: #3a72e0; }
.btn-secondary { background: #232b40; }
.btn-secondary:hover { background: #2c3550; }

/* ---------- Panels / Forms ---------- */
.panel {
    background: #171d2e;
    border: 1px solid #232b40;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}
.panel h3 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.panel p.hint { font-size: 12px; color: #7a869e; margin-top: 8px; }
input[type=date], input[type=password] {
    background: #0f1420;
    border: 1px solid #2c3550;
    color: #fff;
    padding: 8px 10px;
    border-radius: 6px;
    margin: 5px 10px 5px 0;
}
label { font-size: 13px; color: #c0c8dc; }
.output-box {
    background: #0f1420;
    border: 1px solid #232b40;
    border-radius: 6px;
    padding: 15px;
    font-family: monospace;
    font-size: 12px;
    color: #9aa5c0;
    max-height: 500px;
    overflow: auto;
    white-space: pre-wrap;
}

/* ---------- Filter/Sort ---------- */
.filter-row input {
    width: 90%;
    padding: 5px 6px;
    font-size: 11px;
    background: #0f1420;
    border: 1px solid #2c3550;
    color: #e0e0e0;
    border-radius: 4px;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #232b40; }
th.sortable .arrow { font-size: 10px; margin-left: 4px; color: #7a869e; }

/* ============================================================
   MOBILE (screens <= 768px) — everything below only applies
   when screen width is small. Desktop above is untouched.
   ============================================================ */
@media (max-width: 768px) {

    .app-wrapper { flex-direction: column; }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #141a2b;
        border-bottom: 1px solid #232b40;
        padding: 14px 15px;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .mobile-topbar h1 { font-size: 15px; color: #fff; }
    .hamburger {
        background: #232b40;
        border: none;
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        padding: 6px 12px;
        border-radius: 6px;
    }

    .sidebar {
        display: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #232b40;
    }
    .sidebar.mobile-open { display: block; }
    .sidebar h1 { display: none; }

    .main { padding: 15px; }

    .topbar { flex-direction: column; align-items: flex-start; }
    .topbar h2 { font-size: 16px; }

    .cards { flex-direction: column; }
    .card { min-width: 100%; }

    table { font-size: 12px; }
    th, td { padding: 8px 6px; }

    .panel { padding: 15px; }
    input[type=date] { display: block; width: 100%; margin: 6px 0; }
    label { display: block; margin-bottom: 4px; margin-top: 10px; }
    .btn { width: 100%; text-align: center; margin: 6px 0; }
}
