:root {
    --bg: #07111f;
    --panel: rgba(9, 20, 35, 0.92);
    --panel-soft: rgba(10, 23, 38, 0.78);
    --panel-strong: rgba(8, 18, 31, 0.94);
    --line: rgba(146, 199, 255, 0.16);
    --line-strong: rgba(146, 199, 255, 0.18);
    --text: #eef6ff;
    --text-soft: #ebf4ff;
    --muted: #90a6c5;
    --muted-soft: #91a6c4;
    --brand: #37c993;
    --brand-strong: #0b8f66;
    --accent: #f6c35b;
    --danger: #ff6b78;
    --glow: rgba(55, 201, 147, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    font-family: Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(55, 201, 147, 0.16), transparent 26%),
        radial-gradient(circle at top right, rgba(246, 195, 91, 0.10), transparent 22%),
        linear-gradient(160deg, #030813 0%, #07111f 45%, #0b1830 100%);
}

body.centered-layout {
    display: grid;
    place-items: center;
}

body.grid-overlay::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(circle at center, black 45%, transparent 90%);
}

code {
    font-family: "Courier New", monospace;
}

a {
    color: #c8ffeb;
}

.nav-link {
    text-decoration: none;
}

.dashboard-page {
    padding: 18px;
}

.workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    min-height: calc(100vh - 36px);
}

.sidebar,
.panel,
.card,
.status-panel {
    border: 1px solid var(--line-strong);
    background: rgba(6, 17, 30, 0.92);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.sidebar {
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    border-radius: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 10px 12px;
}

.brand-mark {
    width: 22px;
    height: 22px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    background: linear-gradient(180deg, #29df72, #0f8c4a);
    box-shadow: 0 0 24px rgba(41, 223, 114, 0.35);
}

.brand-text {
    font: 700 1.1rem/1 Arial, sans-serif;
    letter-spacing: -0.02em;
}

.brand-text span {
    color: #2de173;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    border-radius: 16px;
    color: var(--muted-soft);
    font: 600 0.95rem/1.2 Arial, sans-serif;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.04);
    color: #39e27b;
}

.nav-icon {
    width: 22px;
    text-align: center;
    color: inherit;
    font-size: 0.95rem;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 14px;
}

.status-panel {
    padding: 18px;
    border-radius: 20px;
}

.status-panel h3,
.actions h3,
.section-head h2,
.card h3,
.system-card h3 {
    margin: 0;
    font: 700 1rem/1.2 Arial, sans-serif;
}

.status-list,
.actions-list,
.risk-list,
.legend,
.mini-list {
    display: grid;
    gap: 12px;
}

.status-row,
.risk-row,
.legend-row,
.mini-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted-soft);
    font: 400 0.92rem/1.4 Arial, sans-serif;
}

.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    background: #2de173;
    box-shadow: 0 0 14px rgba(45, 225, 115, 0.32);
}

.main {
    display: grid;
    gap: 18px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 6px 2px 2px;
}

.topbar h1 {
    margin: 0 0 8px;
    font: 700 clamp(2rem, 4vw, 2.8rem)/1 Georgia, "Times New Roman", serif;
    letter-spacing: -0.05em;
}

.topbar p {
    margin: 0;
    color: var(--muted-soft);
    font: 400 1rem/1.5 Arial, sans-serif;
}

.topbar-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

.chip,
.soft-button,
.ghost-button {
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-soft);
    font: 700 0.84rem/1 Arial, sans-serif;
    letter-spacing: 0.04em;
}

.live-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #39e27b;
}

.grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.content-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.95fr);
    align-items: start;
}

.bottom-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 300px;
    align-items: start;
}

.panel {
    border-radius: 26px;
    padding: 18px;
}

.card {
    border-radius: 22px;
    padding: 18px 18px 16px;
}

.stat-card {
    display: grid;
    gap: 14px;
}

.eyebrow {
    color: #b3c5df;
    font: 600 0.92rem/1.2 Arial, sans-serif;
}

.big-number {
    color: #2de173;
    font: 700 clamp(1.9rem, 2.1vw, 2.4rem)/1 Arial, sans-serif;
    letter-spacing: -0.04em;
}

.big-number.light {
    color: var(--text);
}

.big-number.red {
    color: #ff626e;
}

.subnote {
    color: var(--muted-soft);
    font: 400 0.92rem/1.4 Arial, sans-serif;
}

.subnote .up {
    color: #39e27b;
    font-weight: 700;
}

.subnote .down {
    color: #ff626e;
    font-weight: 700;
}

.sparkline,
.sparkline.red,
.sparkline.purple {
    height: 44px;
    border-radius: 12px;
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.08), transparent 25%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    position: relative;
    overflow: hidden;
}

.sparkline::after,
.sparkline.red::after,
.sparkline.purple::after {
    content: "";
    position: absolute;
    inset: auto 0 4px 0;
    height: 26px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
}

.sparkline::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 24' preserveAspectRatio='none'%3E%3Cpath d='M0 20 L10 18 L18 19 L30 12 L40 14 L50 5 L60 11 L72 8 L84 1 L92 4 L100 0' fill='none' stroke='%232de173' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sparkline.red::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 24' preserveAspectRatio='none'%3E%3Cpath d='M0 4 L10 8 L20 7 L30 14 L40 10 L50 16 L60 11 L70 18 L80 15 L90 22 L100 20' fill='none' stroke='%23ff626e' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sparkline.purple::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 24' preserveAspectRatio='none'%3E%3Cpath d='M0 18 L10 16 L20 17 L30 11 L40 14 L50 7 L60 10 L70 4 L80 8 L90 2 L100 0' fill='none' stroke='%23bc52ff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.ring {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: conic-gradient(#2de173 0 62%, rgba(255, 255, 255, 0.08) 62% 100%);
    position: relative;
}

.ring::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: rgba(6, 17, 30, 0.98);
}

.stat-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.section-head h2 {
    font-size: 1.35rem;
}

.section-copy {
    color: var(--muted-soft);
    font: 400 0.9rem/1.4 Arial, sans-serif;
}

.range-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tab {
    padding: 8px 11px;
    border-radius: 10px;
    color: var(--muted-soft);
    font: 700 0.78rem/1 Arial, sans-serif;
    text-decoration: none;
}

.tab.active {
    background: rgba(45, 225, 115, 0.14);
    color: #2de173;
}

.chart {
    height: 280px;
    border-radius: 22px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(180deg, rgba(8, 23, 39, 0.92), rgba(6, 19, 31, 0.94));
    background-size: 100% 56px, 76px 100%, 100% 100%;
}

.chart::after {
    content: "";
    position: absolute;
    left: 4%;
    right: 3%;
    bottom: 18%;
    top: 10%;
    background: linear-gradient(180deg, rgba(45, 225, 115, 0.24), rgba(45, 225, 115, 0.03));
    clip-path: polygon(0% 86%, 6% 76%, 12% 79%, 18% 71%, 25% 61%, 31% 59%, 38% 66%, 46% 49%, 53% 54%, 60% 42%, 66% 38%, 72% 35%, 78% 29%, 84% 18%, 90% 23%, 96% 11%, 100% 7%, 100% 100%, 0% 100%);
    border-bottom: 2px solid #2de173;
}

.chart::before {
    content: "";
    position: absolute;
    left: 4%;
    right: 3%;
    bottom: 18%;
    top: 10%;
    background: none;
    border-bottom: 2px solid transparent;
    clip-path: polygon(0% 86%, 6% 76%, 12% 79%, 18% 71%, 25% 61%, 31% 59%, 38% 66%, 46% 49%, 53% 54%, 60% 42%, 66% 38%, 72% 35%, 78% 29%, 84% 18%, 90% 23%, 96% 11%, 100% 7%);
    box-shadow: inset 0 -2px 0 #2de173;
}

.chart-label {
    position: absolute;
    right: 14px;
    top: 18px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #2de173;
    color: #072010;
    font: 700 0.8rem/1 Arial, sans-serif;
}

.donut-wrap {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
}

.donut {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    background: conic-gradient(
        #2cc35b 0 41%,
        #3175ff 41% 65%,
        #882fee 65% 81%,
        #ffbd24 81% 94%,
        #20b7bf 94% 100%
    );
    display: grid;
    place-items: center;
}

.donut::after {
    content: "₹12.78M\A Total P&L";
    white-space: pre;
    width: 102px;
    height: 102px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    text-align: center;
    background: rgba(6, 17, 30, 0.98);
    color: var(--text-soft);
    font: 700 1rem/1.4 Arial, sans-serif;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 0;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font: 400 0.92rem/1.3 Arial, sans-serif;
}

th {
    color: var(--muted-soft);
    font-weight: 600;
}

td:last-child,
th:last-child {
    text-align: right;
}

.value-up {
    color: #2de173;
    font-weight: 700;
}

.value-down {
    color: #ff626e;
    font-weight: 700;
}

.strategy-tag {
    font-weight: 700;
}

.strategy-tag.scalper {
    color: #ffbd24;
}

.strategy-tag.mean {
    color: #4ea0ff;
}

.strategy-tag.momentum {
    color: #2de173;
}

.strategy-tag.breakout {
    color: #c257ff;
}

.side-buy {
    color: #2de173;
    font-weight: 700;
}

.side-sell {
    color: #ff7a68;
    font-weight: 700;
}

.system-card {
    display: grid;
    gap: 16px;
}

.actions {
    display: grid;
    gap: 12px;
}

.actions form {
    margin: 0;
}

.soft-button,
.ghost-button {
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.soft-button {
    background: linear-gradient(135deg, rgba(45, 225, 115, 0.18), rgba(42, 164, 214, 0.16));
}

.ghost-button {
    background: rgba(255, 255, 255, 0.03);
}

.notice {
    padding: 14px 16px;
    border-radius: 16px;
    font: 400 0.95rem/1.5 Arial, sans-serif;
    margin-bottom: 6px;
}

.notice.success {
    border: 1px solid rgba(45, 225, 115, 0.28);
    background: rgba(45, 225, 115, 0.08);
    color: #cfffde;
}

.notice.error {
    border: 1px solid rgba(255, 98, 110, 0.24);
    background: rgba(255, 98, 110, 0.08);
    color: #ffd2d7;
}

.tiny {
    color: var(--muted-soft);
    font: 400 0.84rem/1.45 Arial, sans-serif;
}

.link-row {
    margin-top: 10px;
    color: #54b1ff;
    font: 700 0.9rem/1.2 Arial, sans-serif;
}

.orders-panel {
    padding-bottom: 14px;
}

.orders-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.orders-search-row {
    margin-bottom: 16px;
}

.orders-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-shell {
    width: min(340px, 100%);
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted-soft);
    font: 400 0.95rem/1.2 Arial, sans-serif;
}

.filter-select {
    min-width: 160px;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-soft);
    font: 400 0.95rem/1.2 Arial, sans-serif;
}

.filter-submit {
    cursor: pointer;
}

.orders-table-wrap {
    overflow-x: auto;
}

.orders-table {
    min-width: 1180px;
}

.positions-table {
    min-width: 1320px;
}

.holdings-table {
    min-width: 1480px;
}

.holding-name {
    color: var(--text-soft);
    font: 700 0.92rem/1.3 Arial, sans-serif;
}

.order-link {
    color: #37a7ff;
    font-weight: 700;
}

.market-pill,
.tag-badge,
.status-badge,
.page-btn,
.page-size {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font: 700 0.78rem/1 Arial, sans-serif;
    letter-spacing: 0.02em;
}

.market-pill {
    margin-left: 8px;
    color: #a9bed8;
    background: rgba(255, 255, 255, 0.03);
}

.status-badge.executed {
    color: #1ff06d;
    background: rgba(24, 123, 57, 0.22);
    border-color: rgba(31, 240, 109, 0.24);
}

.status-badge.pending {
    color: #ffbf3f;
    background: rgba(145, 96, 0, 0.24);
    border-color: rgba(255, 191, 63, 0.22);
}

.status-badge.cancelled {
    color: #c8d1dc;
    background: rgba(121, 134, 151, 0.18);
    border-color: rgba(200, 209, 220, 0.16);
}

.status-badge.rejected {
    color: #ff665f;
    background: rgba(138, 22, 18, 0.24);
    border-color: rgba(255, 102, 95, 0.22);
}

.tag-badge.entry {
    color: #44a8ff;
    background: rgba(20, 84, 154, 0.25);
    border-color: rgba(68, 168, 255, 0.16);
}

.tag-badge.exit {
    color: #ba72ff;
    background: rgba(94, 37, 138, 0.26);
    border-color: rgba(186, 114, 255, 0.18);
}

.tag-badge.risk {
    color: #ffac48;
    background: rgba(133, 74, 0, 0.24);
    border-color: rgba(255, 172, 72, 0.18);
}

.more-cell {
    color: #c9d4df;
    font-weight: 700;
    letter-spacing: 0.2em;
}

.orders-empty {
    padding: 26px 0;
    text-align: center !important;
    color: var(--muted-soft);
}

.orders-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.page-btn,
.page-size {
    color: #c8d3df;
    background: rgba(255, 255, 255, 0.03);
}

.page-btn.active {
    color: #2de173;
    border-color: rgba(45, 225, 115, 0.5);
    background: rgba(45, 225, 115, 0.08);
}

.metric-icon {
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    font: 700 1.25rem/1 Arial, sans-serif;
    color: #fff;
}

.metric-icon.blue {
    background: linear-gradient(135deg, #1b77df, #184a90);
}

.metric-icon.green {
    background: linear-gradient(135deg, #2edc73, #138648);
}

.metric-icon.orange {
    background: linear-gradient(135deg, #f4a321, #aa5e05);
}

.metric-icon.violet {
    background: linear-gradient(135deg, #9554ff, #5c22b7);
}

.metric-icon.teal {
    background: linear-gradient(135deg, #24c2c5, #117579);
}

.orders-stat-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.order-history-panel {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.history-timeline {
    display: grid;
    gap: 12px;
}

.history-item {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.history-grid strong {
    display: block;
    margin-bottom: 6px;
    color: var(--muted-soft);
    font: 700 0.76rem/1.2 Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.history-grid span {
    color: var(--text-soft);
    font: 400 0.92rem/1.3 Arial, sans-serif;
}

.history-reason {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 98, 110, 0.08);
    color: #ffd2d7;
    font: 400 0.9rem/1.5 Arial, sans-serif;
}

@media (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .content-grid,
    .bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .sidebar {
        gap: 16px;
    }

    .nav {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 760px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-tools {
        justify-content: flex-start;
    }

    .donut-wrap {
        grid-template-columns: 1fr;
    }

    .orders-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body {
        padding: 14px;
    }
}

@media (max-width: 560px) {
    .dashboard-page {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chart {
        height: 220px;
    }

    .history-grid {
        grid-template-columns: 1fr;
    }
}
