/* Root desk. Colors come from tokens.css so light and dark follow data-theme. */

#home-desk {
    --hd-panel: var(--bg-elevated);
    --hd-sunk: var(--bg-primary);
    --hd-fg: var(--text-primary);
    --hd-muted: var(--text-muted);
    --hd-line: var(--border);
    --hd-accent: var(--accent-primary);
    --hd-accent-soft: rgba(0, 240, 255, 0.10);
    --hd-on: var(--gain);
    --hd-on-soft: rgba(77, 158, 110, 0.16);
    --hd-off: var(--loss);
    --hd-off-soft: rgba(176, 82, 82, 0.16);
    color: var(--hd-fg);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    gap: 18px;
}

html[data-theme="light"] #home-desk {
    --hd-panel: var(--bg-surface);
    --hd-sunk: var(--bg-sidebar);
    --hd-accent-soft: rgba(14, 116, 144, 0.20);
    --hd-on-soft: rgba(61, 139, 92, 0.28);
    --hd-off-soft: rgba(176, 82, 82, 0.10);
}

#home-desk[hidden] { display: none; }

#home-desk h1,
#home-desk h2,
#home-desk h3 {
    font-family: var(--font-sans);
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    margin: 0;
    color: var(--hd-fg);
}

#home-desk h1 { font-size: 24px; }
#home-desk h2 { font-size: 18px; }
#home-desk h3 { font-size: 15px; font-weight: 600; }

.hd-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
}

.hd-hello p { margin: 4px 0 0; color: var(--hd-muted); }

.hd-date { text-align: right; }
.hd-date span { display: block; }
.hd-date .hd-dow {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hd-muted);
}
.hd-date .hd-day { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hd-date .hd-day b { font-weight: 700; }

@media (max-width: 768px) {
    #home-desk { padding: 12px; }
}

@media (max-width: 640px) {
    .hd-head {
        flex-wrap: nowrap;
        align-items: flex-start;
        gap: 8px;
    }
    .hd-hello { flex: 1; min-width: 0; }
    .hd-date {
        flex: none;
        text-align: right;
        margin-top: 28px;
    }
    .hd-date .hd-day { font-size: 15px; }
    #home-desk h1 { font-size: 20px; }
}

.hd-panel {
    background: var(--hd-panel);
    border: 1px solid var(--hd-line);
    border-radius: var(--radius-md);
    padding: 16px;
    min-width: 0;
}

.hd-ph {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.hd-title { display: flex; align-items: center; gap: 10px; }

.hd-agent-go {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.hd-agent-go:hover h2 { color: var(--hd-accent); }

.hd-quiet {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    min-height: 160px;
    padding: 28px 8px 20px;
}

.hd-quiet p {
    margin: 0;
    max-width: 36em;
    font-size: 18px;
    line-height: 1.4;
}

.hd-quiet-go {
    appearance: none;
    border: 1px solid var(--hd-accent);
    border-radius: 999px;
    padding: 8px 16px;
    background: transparent;
    color: var(--hd-fg);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.hd-quiet-go:hover { background: var(--hd-accent-soft); }

.hd-quiet-line {
    margin: 18px 0 8px;
    color: var(--hd-muted);
}

.hd-mark {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--hd-line);
    background: var(--hd-accent-soft);
    color: var(--hd-accent);
    display: grid;
    place-items: center;
    flex: none;
}

.hd-mark svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hd-note {
    font-size: 12px;
    color: var(--hd-muted);
}

.hd-kpis, .hd-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-variant-numeric: tabular-nums;
}

.hd-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    border-block: 1px solid var(--hd-line);
    padding-block: 12px;
    margin-bottom: 16px;
    text-align: center;
}

.hd-kpi b, .hd-strip b {
    display: block;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.hd-kpi span, .hd-strip span, .hd-strip small {
    display: block;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hd-muted);
    font-weight: 500;
}

.hd-strip small { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 400; }
.hd-kpi.on b, .hd-on b { color: var(--hd-on); }
.hd-kpi.off b { color: var(--hd-off); }
.hd-acc-c b { color: var(--hd-accent); }

@media (max-width: 800px) {
    .hd-strip {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
    }
    .hd-strip b { font-size: 16px; }
    .hd-strip span { font-size: 9px; letter-spacing: 0.02em; }
    .hd-strip small { font-size: 10px; }
}

.hd-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

@media (min-width: 960px) {
    .hd-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}

.hd-sub {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hd-muted);
    margin-bottom: 8px;
}

.hd-sub > span:first-child { font-weight: 600; color: var(--hd-fg); }

.hd-legend { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.hd-lg {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--hd-sunk);
    border: 1px solid var(--hd-line);
    margin-left: 6px;
}
.hd-lg.traded { background: var(--hd-on-soft); border-color: var(--hd-on); }
.hd-lg.alerted { background: var(--hd-accent-soft); border-color: var(--hd-accent); }

.hd-mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 6px;
    overflow: hidden;
}

.hd-tile {
    border: 1px solid var(--hd-line);
    background: var(--hd-sunk);
    border-radius: 7px;
    padding: 6px;
    display: grid;
    gap: 6px;
    min-width: 0;
}

.hd-tile.traded { background: var(--hd-on-soft); border-color: var(--hd-on); }
.hd-tile.alerted { background: var(--hd-accent-soft); border-color: var(--hd-accent); }

.hd-logo {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: grid;
    place-items: center;
    overflow: hidden;
}

html[data-theme="dark"] .hd-logo.dark { background: #1d2430; }

.hd-logo img { width: 62%; height: 62%; object-fit: contain; }
.hd-logo em {
    font-style: normal;
    font-weight: 700;
    font-size: 22px;
    color: #3a4250;
}

.hd-pill {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 10px;
    line-height: 1;
    padding: 3px 5px;
    border-radius: var(--radius-full);
    background: #141a23;
    color: #fff;
}

.hd-tile.traded .hd-pill { background: var(--hd-on); }
.hd-tile.alerted .hd-pill { background: var(--hd-accent); color: #041016; }

html[data-theme="light"] .hd-tile.alerted .hd-pill { color: #fff; }

.hd-tile > span {
    font-size: 11px;
    color: var(--hd-muted);
    line-height: 1.3;
    min-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.hd-more {
    margin-top: 8px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--hd-accent);
    background: var(--hd-accent-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    cursor: pointer;
}

.hd-tl {
    display: grid;
    align-content: start;
    gap: 10px;
    max-height: 520px;
    overflow: auto;
    padding: 2px 4px 16px 26px;
}

.hd-ev { position: relative; }
.hd-ev::before {
    content: "";
    position: absolute;
    left: -16px;
    top: -10px;
    bottom: -10px;
    width: 2px;
    background: var(--hd-line);
}
.hd-ev:first-child::before { top: 14px; }
.hd-ev:last-child::before { bottom: calc(100% - 18px); }

.hd-dot {
    position: absolute;
    left: -20px;
    top: 14px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--hd-accent);
    box-shadow: 0 0 0 3px var(--hd-panel);
}

.hd-ev.trade .hd-dot {
    left: -23px;
    top: 12px;
    width: 14px;
    height: 14px;
    background: var(--hd-panel);
    border: 2px solid var(--hd-on);
    box-shadow: inset 0 0 0 3px var(--hd-on);
}

.hd-evc {
    border: 1px solid var(--hd-line);
    border-radius: 8px;
    background: var(--hd-sunk);
    padding: 8px 12px;
}

.hd-ev.trade .hd-evc { background: var(--hd-on-soft); }

.hd-evh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hd-evh svg { width: 16px; height: 16px; fill: none; stroke: var(--hd-accent); stroke-width: 1.8; }
.hd-ev.trade .hd-evh svg { stroke: var(--hd-on); }
.hd-tag {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--hd-accent-soft);
    color: var(--hd-accent);
}
.hd-ev.trade .hd-tag { background: var(--hd-on-soft); color: var(--hd-on); }
.hd-tk { font-weight: 600; }
.hd-tn, .hd-ev p { color: var(--hd-muted); font-size: 12px; margin: 4px 0 0; }
.hd-qty { margin-left: auto; font-weight: 600; color: var(--hd-on); font-variant-numeric: tabular-nums; }

.hd-desks {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

@media (min-width: 960px) {
    .hd-desks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.hd-desk {
    border: 1px solid var(--hd-line);
    border-radius: 8px;
    background: var(--hd-sunk);
    padding: 12px;
    min-width: 0;
}

#home-desk .hd-skel {
    display: inline-block;
    width: 48px;
    height: 14px;
    vertical-align: -1px;
    border-radius: 4px;
}
#home-desk .hd-skel-lg { width: 72px; height: 18px; }
#home-desk .hd-strip b .hd-skel { width: 36px; height: 18px; vertical-align: 0; }
#home-desk .hd-skel-stack { display: grid; gap: 8px; margin-top: 8px; }
#home-desk .hd-skel-row { height: 52px; border-radius: 8px; }
html[data-theme="light"] #home-desk .hd-skel,
html[data-theme="light"] #home-desk .hd-skel-row {
    background: linear-gradient(90deg, #d5dbe3 25%, #f4f6f8 50%, #d5dbe3 75%);
    background-size: 200% 100%;
}

.hd-bigs { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 10px; }
.hd-big { font-size: 22px; font-weight: 600; color: var(--hd-accent); font-variant-numeric: tabular-nums; }
.hd-big small {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hd-muted);
    font-weight: 500;
    margin-left: 6px;
}

.hd-bot, .hd-bot-h {
    display: grid;
    grid-template-columns: 48px minmax(0, 1.2fr) minmax(4.5rem, 1fr) minmax(3.2rem, 0.7fr);
    gap: 8px 14px;
    align-items: center;
    padding: 6px;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.hd-bot { background: var(--hd-panel); border: 1px solid var(--hd-line); margin-top: 4px; }
.hd-bot-h { font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--hd-muted); }
.hd-bot .hd-v, .hd-bot-h span:nth-child(n+3) { text-align: left; }
.hd-nm { font-weight: 600; min-width: 0; }

.hd-botface {
    width: 48px;
    height: 48px;
    display: block;
}

.hd-botimg {
    width: 48px;
    height: 48px;
    display: block;
    object-fit: contain;
}

@media (max-width: 959px) {
    .hd-bot, .hd-bot-h {
        grid-template-columns: 72px minmax(0, 1.3fr) minmax(5rem, 1fr) minmax(3.5rem, 0.75fr);
        padding: 8px 10px;
    }
    .hd-botface, .hd-botimg { width: 72px; height: 72px; }
}

.hd-tools {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.hd-tool {
    border: 1px solid var(--hd-line);
    border-radius: 8px;
    background: var(--hd-sunk);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hd-tool .hd-th { display: flex; align-items: center; gap: 8px; }
.hd-ico {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--hd-accent-soft);
    color: var(--hd-accent);
    display: grid;
    place-items: center;
}
.hd-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hd-st { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-variant-numeric: tabular-nums; }
.hd-st b { display: block; font-size: 22px; font-weight: 600; line-height: 1.1; }
.hd-st span, .hd-ft { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--hd-muted); }
.hd-ft {
    margin-top: auto;
    box-sizing: border-box;
    min-height: calc(8px + 2 * 1.35em + 1px);
    line-height: 1.35;
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    border-top: 1px solid var(--hd-line);
    padding-top: 8px;
}

.hd-acc { display: grid; gap: 6px; }
@media (min-width: 960px) {
    .hd-acc { grid-template-columns: 1fr 1fr; }
    .hd-acc details[open] { grid-column: 1 / -1; }
}

.hd-acc-head, .hd-acc summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, 52px) 72px 22px;
    gap: 10px;
    align-items: center;
}

.hd-acc-head {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hd-muted);
    padding: 0 10px 4px;
}

#home-desk details {
    border: 1px solid var(--hd-line);
    border-radius: 8px;
    background: var(--hd-sunk);
}

#home-desk summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 10px;
    font-variant-numeric: tabular-nums;
}

#home-desk summary::-webkit-details-marker { display: none; }
.hd-acc .n { text-align: right; }
.hd-acc .n.on { color: var(--hd-on); }
.hd-acc .n.off { color: var(--hd-off); }

.hd-chev {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--hd-accent-soft);
    justify-self: end;
    position: relative;
}
.hd-chev::before, .hd-chev::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 2px;
    background: var(--hd-accent);
    transform: translate(-50%, -50%);
}
.hd-chev::after { transform: translate(-50%, -50%) rotate(90deg); }
#home-desk details[open] .hd-chev::after { transform: translate(-50%, -50%) rotate(0deg); }

.hd-bar { display: block; height: 6px; border-radius: 3px; background: var(--hd-off-soft); overflow: hidden; }
.hd-bar i { display: block; height: 100%; background: var(--hd-on); }

.hd-tbl { overflow-x: auto; border-top: 1px solid var(--hd-line); }
#home-desk table { border-collapse: collapse; width: 100%; min-width: 460px; background: var(--hd-panel); }
#home-desk th, #home-desk td {
    text-align: left;
    padding: 7px 12px;
    border-bottom: 1px solid var(--hd-line);
    font-size: 13px;
}
#home-desk th {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hd-muted);
    font-weight: 600;
}

.hd-lamp {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.hd-lamp.on { background: var(--hd-on); box-shadow: 0 0 0 3px var(--hd-on-soft); }
.hd-lamp.off { background: var(--hd-off); box-shadow: 0 0 0 3px var(--hd-off-soft); }

@media (max-width: 640px) {
    .hd-acc-head, #home-desk summary { grid-template-columns: minmax(0, 1fr) 36px 36px 36px 18px; }
    .hd-barc, .hd-acc-head span:nth-child(5) { display: none; }
}
