/* Shared screen styling. Deliberately small: the point is that the screens read like
   TaluCrypt, not that the web app grows its own design system. */

body {
    background: #1e1f26;
    color: #e6e6ea;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

h1 {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0 0 1rem;
}

h2 {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9aa0b4;
    margin: 0 0 0.75rem;
}

.muted {
    color: #9aa0b4;
}

.panel {
    background: #262832;
    border: 1px solid #33364a;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.radio {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

input[type="date"],
select {
    background: #1e1f26;
    color: #e6e6ea;
    border: 1px solid #3d4157;
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
}

input[type="date"]:disabled {
    opacity: 0.45;
}

/* Wide tables scroll inside their own box rather than pushing the page sideways. */
.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    text-align: left;
    font-weight: 600;
    color: #9aa0b4;
    border-bottom: 1px solid #33364a;
    padding: 0.4rem 0.6rem;
    white-space: nowrap;
}

tbody td {
    border-bottom: 1px solid #2c2f3d;
    padding: 0.35rem 0.6rem;
}

tbody tr:hover {
    background: #2c2f3d;
    cursor: pointer;
}

tbody tr.selected {
    background: #343850;
}

.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.nav-icon {
    display: inline-block;
    width: 1.4rem;
}

/* Sign-in */
.signin {
    max-width: 22rem;
    margin: 6rem auto;
    padding: 1.5rem;
    background: #262832;
    border: 1px solid #33364a;
    border-radius: 6px;
}

.signin h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.signin form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.signin label {
    font-size: 0.8rem;
    color: #9aa0b4;
    margin-top: 0.5rem;
}

.signin input {
    background: #1e1f26;
    color: #e6e6ea;
    border: 1px solid #3d4157;
    border-radius: 4px;
    padding: 0.45rem 0.6rem;
}

.signin button[type="submit"] {
    margin-top: 1.25rem;
    padding: 0.5rem;
    background: #4d5bd6;
    color: #fff;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.signin button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: default;
}

.signin .switch {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: #9aa0b4;
}

.signin .switch a {
    color: #8f9bff;
    margin-left: 0.35rem;
}

.error {
    color: #ff8a8a;
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
}

.top-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.5rem;
}

.link-button {
    background: none;
    border: 0;
    color: #8f9bff;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

/* News */
.news-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 1rem;
}

.news-card {
    display: flex;
    gap: 0.75rem;
    background: #262832;
    border: 1px solid #33364a;
    border-radius: 6px;
    padding: 0.75rem;
    color: inherit;
    text-decoration: none;
}

.news-card:hover {
    border-color: #4d5bd6;
}

.news-card img {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: 4px;
    flex: 0 0 auto;
}

.news-body {
    min-width: 0;
}

.news-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.news-meta {
    font-size: 0.75rem;
    color: #9aa0b4;
    margin: 0 0 0.35rem;
}

.news-excerpt {
    font-size: 0.82rem;
    color: #c2c6d6;
    margin: 0;
}

.button {
    background: #4d5bd6;
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 0.35rem 0.8rem;
    cursor: pointer;
}

.button:disabled {
    opacity: 0.6;
    cursor: default;
}

input[type="text"] {
    background: #1e1f26;
    color: #e6e6ea;
    border: 1px solid #3d4157;
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    min-width: 12rem;
}

/* Market */
.coin-name {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.coin-name img {
    width: 1.2rem;
    height: 1.2rem;
}

.up { color: #6bcf8e; }
.down { color: #ff8a8a; }

.chip {
    background: #33364a;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.78rem;
}

/* AI */
.ai-review {
    width: 100%;
    min-height: 32rem;
    border: 1px solid #33364a;
    border-radius: 6px;
    background: #fff;
}

/* Wallets */
.split {
    display: grid;
    grid-template-columns: minmax(14rem, 20rem) 1fr;
    gap: 1rem;
    align-items: start;
}

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

.group {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa0b4;
    margin: 0.9rem 0 0.35rem;
}

.source {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: inherit;
    font: inherit;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
}

.source:hover { background: #2c2f3d; }
.source.selected { background: #343850; border-color: #4d5bd6; }

/* Margin */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9aa0b4;
}

.stat-value {
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}

.bar {
    display: flex;
    height: 0.65rem;
    border-radius: 999px;
    overflow: hidden;
    background: #1e1f26;
    margin-bottom: 0.6rem;
}

.bar-part { display: block; }

.swatch {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 2px;
    margin-right: 0.3rem;
}

/* Charts */
.chart { margin: 0; }

.chart figcaption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.8rem;
    color: #9aa0b4;
    margin-bottom: 0.5rem;
}

.chart-last {
    color: #e6e6ea;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

.chart svg { width: 100%; height: 10rem; display: block; }

.chart-grid { stroke: #33364a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke: #4d5bd6; stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-area { fill: rgba(77, 91, 214, 0.18); stroke: none; }

.chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #9aa0b4;
    margin-top: 0.35rem;
}

.chart-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}

/* Wraps rather than squeezing the legend to nothing when the panel is narrow. */
.donut-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.donut { width: 8rem; height: 8rem; flex: 0 0 auto; transform: rotate(-90deg); }
.donut-slice { transition: stroke-width 0.15s; }
.donut-slice:hover { stroke-width: 7; }

.donut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    flex: 1 1 9rem;
    min-width: 9rem;
}

.donut-legend li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0;
}

.donut-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

ul.plain { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
ul.plain li { padding: 0.15rem 0; }

/* Dialogs */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 16, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal {
    background: #262832;
    border: 1px solid #33364a;
    border-radius: 8px;
    padding: 1.25rem;
    width: min(34rem, 100%);
    max-height: 85vh;
    overflow-y: auto;
}

.modal h2 { margin-bottom: 1rem; }

.modal-body { display: flex; flex-direction: column; gap: 0.3rem; }

.modal-body label {
    font-size: 0.78rem;
    color: #9aa0b4;
    margin-top: 0.6rem;
}

.modal-body input[type="text"],
.modal-body select {
    width: 100%;
    background: #1e1f26;
    color: #e6e6ea;
    border: 1px solid #3d4157;
    border-radius: 4px;
    padding: 0.4rem 0.55rem;
}

.modal-scan {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.asset-picker {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    max-height: 14rem;
    overflow-y: auto;
    border: 1px solid #33364a;
    border-radius: 4px;
}

.asset-picker li { border-bottom: 1px solid #2c2f3d; }
.asset-picker li:last-child { border-bottom: 0; }

.asset-picker label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    margin: 0;
    font-size: 0.85rem;
    color: inherit;
    cursor: pointer;
}

.asset-picker label span:nth-child(2) { flex: 1 1 auto; }

/* Source rows with inline edit / delete */
.source-row { display: flex; align-items: center; gap: 0.15rem; }
.source-row .source { flex: 1 1 auto; }

.icon-button {
    background: none;
    border: 0;
    color: #9aa0b4;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0.35rem;
    border-radius: 4px;
    opacity: 0;
}

.source-row:hover .icon-button { opacity: 1; }
.icon-button:hover { background: #33364a; color: #e6e6ea; }

/* Keeps the buttons reachable without a mouse. */
.icon-button:focus-visible { opacity: 1; outline: 2px solid #4d5bd6; }

.picked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: #1e1f26;
    border: 1px solid #3d4157;
    border-radius: 4px;
    padding: 0.4rem 0.55rem;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
}

.category-row input[type="text"] { flex: 1 1 auto; }
.asset-picker li.selected { background: #343850; }

.hint {
    font-size: 0.78rem;
    color: #9aa0b4;
    margin: 0.5rem 0 0;
}

/* Google sign-in */
.google-row { margin-top: 1.25rem; }
.google-row.hidden { display: none; }

.separator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #9aa0b4;
    font-size: 0.78rem;
    margin-bottom: 0.9rem;
}

.separator::before,
.separator::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: #33364a;
}

#google-button { display: flex; justify-content: center; }
