
:root {
    --background: #090b10;
    --surface: #11151e;
    --surface-light: #171d29;
    --surface-hover: #1d2533;
    --border: #252d3b;
    --text: #f0f3f8;
    --muted: #8993a5;
    --primary: #8b75ff;
    --primary-hover: #a08eff;
    --green: #39d69a;
    --orange: #f0a64b;
    --blue: #5da8ff;
    --red: #ff6b78;
    --radius: 15px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: "DM Sans", sans-serif;
    min-height: 100vh;
}

button, input, select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
    width: 255px;
    background: #0d1017;
    border-right: 1px solid var(--border);
    padding: 28px 18px 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    margin-bottom: 48px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #9a84ff, #6148dc);
    display: grid;
    place-items: center;
    color: white;
    font-family: "Space Grotesk", sans-serif;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 6px 25px #7557ff35;
}

.brand h1 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 14px;
    letter-spacing: 1.4px;
}

.brand span {
    display: block;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 2.5px;
    margin-top: 4px;
}

.sidebar-label {
    color: #687387;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 0 10px;
    margin-bottom: 13px;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.nav-item {
    border: 0;
    color: #9aa4b5;
    background: transparent;
    border-radius: 10px;
    padding: 13px 12px;
    display: flex;
    align-items: center;
    gap: 13px;
    text-align: left;
    font-size: 13px;
    transition: .2s;
}

.nav-item:hover {
    background: var(--surface-light);
    color: white;
}

.nav-item.active {
    color: white;
    background: #8b75ff20;
    box-shadow: inset 3px 0 var(--primary);
}

.nav-icon {
    width: 21px;
    font-size: 19px;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;
}

.connection-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #141a23;
    border: 1px solid var(--border);
    padding: 13px 11px;
    border-radius: 11px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    box-shadow: 0 0 10px #39d69a80;
    flex-shrink: 0;
}

.connection-indicator strong {
    display: block;
    font-size: 11px;
}

.connection-indicator small {
    color: var(--muted);
    display: block;
    font-size: 10px;
    margin-top: 3px;
}

.sidebar-version {
    color: #5e6878;
    font-size: 9px;
    text-align: center;
    letter-spacing: 1px;
    margin-top: 18px;
}

/* MAIN */

.main-content {
    margin-left: 255px;
    width: calc(100% - 255px);
    min-width: 0;
}

.topbar {
    height: 88px;
    padding: 0 38px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0c0f16;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.breadcrumb {
    color: #6f7b8e;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.4px;
    margin-bottom: 5px;
}

.breadcrumb span {
    color: var(--primary);
}

.topbar h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 20px;
}

.live-indicator {
    color: #aab4c4;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: #24203b;
    border: 1px solid #53438d;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
    color: #b9aaff;
}

.mobile-menu {
    display: none;
    color: white;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    padding: 8px 10px;
}

/* PAGE */

.page-container {
    padding: 35px 38px 55px;
    max-width: 1600px;
    margin: auto;
}

.page {
    display: none;
    animation: appear .25s ease;
}

.page.active {
    display: block;
}

@keyframes appear {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.eyebrow {
    color: var(--primary);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.8px;
    margin-bottom: 9px;
}

.welcome-row h3,
.section-intro h3 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 25px;
    margin-bottom: 7px;
}

.muted {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.button {
    border: 0;
    border-radius: 9px;
    padding: 11px 16px;
    font-size: 12px;
    font-weight: 700;
    transition: .2s;
}

.button-primary {
    color: white;
    background: linear-gradient(135deg, #927cff, #7058e8);
    box-shadow: 0 5px 18px #7557ff22;
}

.button-primary:hover {
    background: linear-gradient(135deg, #a18eff, #8069f3);
    transform: translateY(-1px);
}

.button-secondary {
    color: #c2c9d5;
    background: var(--surface-light);
    border: 1px solid var(--border);
}

.button-secondary:hover {
    background: var(--surface-hover);
    color: white;
}

.full-button {
    width: 100%;
    margin-top: 18px;
}

/* STATS */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    min-width: 0;
}

.highlight-card {
    border-color: #795b383d;
    background: linear-gradient(145deg, #17171a, #17140f);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 19px;
}

.stat-label {
    color: #909bad;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 16px;
}

.stat-icon.purple {
    color: #ac9cff;
    background: #8b75ff20;
}

.stat-icon.blue {
    color: var(--blue);
    background: #5da8ff20;
}

.stat-icon.green {
    color: var(--green);
    background: #39d69a20;
}

.stat-icon.orange {
    color: var(--orange);
    background: #f0a64b20;
}

.stat-value {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(19px, 2vw, 27px);
    font-weight: 700;
    overflow-wrap: anywhere;
    margin-bottom: 8px;
}

.stat-description {
    color: var(--muted);
    font-size: 10px;
}

/* DASHBOARD PANELS */

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
    gap: 18px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    min-width: 0;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}

.panel-heading h3,
.history-toolbar h3 {
    font-size: 14px;
    margin-bottom: 5px;
}

.panel-heading p,
.history-toolbar p {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.text-button {
    border: 0;
    background: transparent;
    color: #a997ff;
    font-size: 10px;
    white-space: nowrap;
}

.recent-list {
    display: flex;
    flex-direction: column;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-top: 1px solid #252d3b;
}

.recent-symbol {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
}

.recent-symbol.purchase {
    color: var(--blue);
    background: #5da8ff17;
}

.recent-symbol.sale {
    color: var(--orange);
    background: #f0a64b17;
}

.recent-symbol.payment {
    color: var(--green);
    background: #39d69a17;
}

.recent-description {
    min-width: 0;
    flex: 1;
}

.recent-description strong {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
}

.recent-description small {
    color: var(--muted);
    font-size: 9px;
}

.recent-amount {
    font-size: 11px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.product-panel {
    text-align: center;
}

.product-tag {
    color: var(--green);
    background: #39d69a16;
    border: 1px solid #39d69a30;
    padding: 5px 8px;
    border-radius: 20px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1px;
}

.product-symbol {
    width: 66px;
    height: 66px;
    border-radius: 18px;
    background: #8b75ff1b;
    border: 1px solid #8b75ff35;
    color: #ad9eff;
    display: grid;
    place-items: center;
    font-size: 30px;
    margin: 8px auto 15px;
}

.product-panel h4 {
    font-size: 15px;
    margin-bottom: 5px;
}

.product-detail {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    text-align: left;
}

.product-detail span {
    color: var(--muted);
}

.product-detail strong {
    text-align: right;
}

.product-panel .full-button {
    margin-top: 17px;
}

/* OPERATIONS */

.section-intro {
    margin-bottom: 25px;
}

.operation-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}

.operation-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 23px;
    min-width: 0;
}

.operation-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.operation-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
}

.purchase-icon {
    color: var(--blue);
    background: #5da8ff1b;
}

.sale-icon {
    color: var(--orange);
    background: #f0a64b1b;
}

.payment-icon {
    color: var(--green);
    background: #39d69a1b;
    font-size: 13px;
}

.operation-heading h3 {
    font-size: 13px;
    margin-bottom: 5px;
}

.operation-heading p {
    color: var(--muted);
    font-size: 10px;
}

label {
    display: block;
    color: #c4ccda;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 9px;
}

input,
.filter-select {
    width: 100%;
    border: 1px solid #30394a;
    background: #0c1018;
    color: white;
    border-radius: 9px;
    outline: none;
    padding: 13px;
    font-size: 12px;
    transition: .2s;
}

input:focus,
.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px #8b75ff18;
}

input::placeholder {
    color: #586477;
}

input:disabled {
    color: #7f8999;
    cursor: not-allowed;
}

.form-info,
.form-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 17px;
    font-size: 10px;
}

.form-info {
    color: var(--muted);
}

.form-info strong {
    color: #dce2ec;
}

.form-total {
    padding: 14px;
    background: #8b75ff12;
    border: 1px solid #8b75ff27;
    border-radius: 9px;
    color: #c6baff;
}

.form-total strong {
    font-size: 13px;
    color: #c7baff;
}

.neutral-total {
    background: #171d29;
    border-color: #293346;
    color: var(--muted);
}

.neutral-total strong {
    color: white;
}

/* HISTORY */

.history-panel {
    padding: 0;
    overflow: hidden;
}

.history-toolbar {
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.filter-select {
    width: auto;
    min-width: 170px;
    padding: 10px 12px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 550px;
}

thead {
    background: #171d29;
}

th {
    text-align: left;
    color: #8994a7;
    font-size: 9px;
    letter-spacing: 1px;
    padding: 14px 20px;
    font-weight: 700;
}

td {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: #c7cfdd;
}

.operation-pill {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
}

.operation-pill.purchase {
    color: var(--blue);
    background: #5da8ff18;
}

.operation-pill.sale {
    color: var(--orange);
    background: #f0a64b18;
}

.operation-pill.payment {
    color: var(--green);
    background: #39d69a18;
}

.empty-cell,
.loading-state {
    color: var(--muted);
    text-align: center;
    padding: 30px 15px;
    font-size: 11px;
}

/* SETTINGS */

.settings-panel {
    max-width: 700px;
}

.settings-icon {
    color: #ad9eff;
    font-size: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field-group small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
    margin-top: 8px;
}

.settings-form .button {
    align-self: flex-start;
    min-width: 190px;
}

.warning-note {
    max-width: 700px;
    background: #f0a64b0d;
    border: 1px solid #f0a64b35;
    border-radius: 11px;
    padding: 16px;
    margin-top: 18px;
}

.warning-note strong {
    color: var(--orange);
    font-size: 11px;
}

.warning-note p {
    color: #a9a294;
    font-size: 10px;
    line-height: 1.6;
    margin-top: 6px;
}

/* TOAST */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(340px, calc(100% - 40px));
}

.toast {
    background: #171f2b;
    border: 1px solid #354258;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 12px 35px #0008;
    font-size: 12px;
    animation: appear .2s ease;
}

.toast.success {
    border-left: 3px solid var(--green);
}

.toast.error {
    border-left: 3px solid var(--red);
}

/* MODAL */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    background: #000a;
    padding: 20px;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    width: min(390px, 100%);
    background: #151b26;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 20px 70px #0009;
}

.modal-icon {
    width: 45px;
    height: 45px;
    display: grid;
    place-items: center;
    margin: 0 auto 15px;
    background: #8b75ff20;
    color: #b7aaff;
    border-radius: 13px;
    font-size: 20px;
}

.modal h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.modal p {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.modal-actions button {
    flex: 1;
}

/* RESPONSIVE */

@media (max-width: 1150px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .operation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 15px 0 40px #0007;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .mobile-menu {
        display: block;
    }

    .topbar {
        padding: 0 22px;
    }

    .page-container {
        padding: 28px 22px 45px;
    }
}

@media (max-width: 650px) {
    .topbar {
        height: 75px;
        padding: 0 15px;
    }

    .topbar h2 {
        font-size: 17px;
    }

    .breadcrumb {
        font-size: 8px;
    }

    .live-indicator {
        font-size: 0;
        gap: 0;
    }

    .live-indicator .status-dot {
        width: 9px;
        height: 9px;
    }

    .page-container {
        padding: 24px 14px 40px;
    }

    .welcome-row {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 20px;
    }

    .welcome-row h3,
    .section-intro h3 {
        font-size: 22px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-label {
        font-size: 8px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-description {
        font-size: 9px;
    }

    .stat-top {
        margin-bottom: 14px;
    }

    .stat-icon {
        width: 27px;
        height: 27px;
    }

    .dashboard-grid,
    .operation-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 17px;
    }

    .history-panel {
        padding: 0;
    }

    .history-toolbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 17px;
    }

    .filter-select {
        width: 100%;
    }

    .operation-card {
        padding: 19px;
    }

    .settings-form .button {
        width: 100%;
    }
}

@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 24px;
    }
}
