/* =========================================================
   RDC Gateway — application styles
   Accent: #566DB5 (rgb 86,109,181). Dark bg #1e1e1e, light bg #fff.
   ========================================================= */

:root {
    --rdc-accent: #566DB5;
    --rdc-accent-soft: rgba(86, 109, 181, 0.16);
    --rdc-goldenrod: #DAA520;
    --rdc-green: #3DBA6F;
    --rdc-red: #E05555;
    --rdc-radius: 10px;
}

html, body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    height: 100%;
}

h1:focus { outline: none; }

/* ---------- Layout ---------- */
.rdc-appbar {
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.rdc-search {
    max-width: 360px;
    width: 100%;
    margin-left: 8px;
}
.rdc-search .mud-input-outlined-border { border-radius: 999px; }
.rdc-search .mud-input { font-size: 0.9rem; }

.rdc-company {
    display: flex;
    align-items: center;
    max-width: 260px;
    margin: 0 12px 0 8px;
    overflow: hidden;
}
.rdc-company-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rdc-company-logo {
    max-height: 36px;
    max-width: 220px;
    object-fit: contain;
}

.rdc-avatar { cursor: pointer; font-weight: 600; }
.rdc-user-menu-head { padding: 10px 16px 8px; min-width: 220px; }

.rdc-drawer {
    border-right: 1px solid var(--mud-palette-lines-default);
}

.rdc-nav { display: flex; flex-direction: column; height: 100%; }
.rdc-nav-brand {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 8px;
}
.rdc-nav-logo { height: 30px; }
.rdc-nav-mark { height: 30px; width: 30px; margin: 0 auto; }
.rdc-nav--collapsed .rdc-nav-brand { padding: 0; justify-content: center; }
.rdc-nav-menu { padding: 0 8px; flex: 1; }
.rdc-nav-foot { padding: 12px 16px; }

/* Mini drawer: icons only */
.rdc-nav--collapsed .mud-nav-link-text,
.rdc-nav--collapsed .mud-nav-group .mud-nav-link-text,
.rdc-nav--collapsed .mud-nav-group > .mud-nav-link .mud-nav-link-expand-icon { display: none; }
.rdc-nav--collapsed .mud-nav-link { justify-content: center; padding-left: 12px; padding-right: 12px; }
.rdc-nav--collapsed .mud-nav-link-icon { margin-right: 0; }
.rdc-nav--collapsed .mud-nav-group .mud-collapse-container .mud-nav-link { padding-left: 12px; }
.rdc-nav-menu .mud-nav-link.active { background: var(--rdc-accent-soft); }

.rdc-main { min-height: 100vh; }
.rdc-page { padding: 20px 24px 40px; width: 100%; }
@media (max-width: 960px) { .rdc-page { padding: 16px; } }

.rdc-authorizing {
    display: flex; align-items: center; justify-content: center;
    height: 100vh; color: #999; background: #1e1e1e;
}

/* ---------- Page header ---------- */
.rdc-page-title { font-weight: 700; margin-bottom: 4px; }
.rdc-page-sub { color: var(--mud-palette-text-secondary); margin-bottom: 20px; }

/* ---------- Stat cards (Today / Month / YTD / Limits / Accounts) ---------- */
.rdc-card {
    border-radius: var(--rdc-radius);
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    padding: 12px 14px 10px;
    position: relative;
    min-height: 130px;
    max-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color .15s ease, transform .15s ease;
}

.rdc-card-chart {
    border-radius: var(--rdc-radius);
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    background-size: cover;
    padding: 12px 14px 10px;
    position: relative;
    min-height: 130px;
    max-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color .15s ease, transform .15s ease;
}

.rdc-card-ytd {
    border-radius: var(--rdc-radius);
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    background-size: cover;
    padding: 12px 14px 10px;
    position: relative;
    min-height: 130px;
    max-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color .15s ease, transform .15s ease;
}

.rdc-card--clickable { cursor: pointer; }
.rdc-card--clickable:hover { border-color: var(--rdc-accent); transform: translateY(-1px); }

.rdc-card-icon {
    position: absolute;
    top: 10px; right: 10px;
    width: 30px; height: 30px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(127,127,127,0.12);
    color: var(--mud-palette-text-primary);
}
.rdc-card-icon .mud-icon-root { font-size: 1.1rem; }
.rdc-card-big {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.rdc-card-label {
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 2px;
}
.rdc-card-row { display: flex; gap: 20px; margin-top: 6px; align-items: flex-end; }
.rdc-card-stat .rdc-card-value { font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rdc-card-stat .rdc-card-label { margin-top: 0; }
.rdc-card-title {
    position: absolute;
    bottom: 10px; right: 14px;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.4px;
}
.rdc-card-sub { font-size: 0.72rem; color: var(--mud-palette-text-secondary); }
.rdc-card-sub b { color: var(--mud-palette-text-primary); font-weight: 500; }

/* Limit colour bands (spec): green 0–25% used, default 25–50%, goldenrod 50–75%, red 75–100% */
.band-green  { color: var(--rdc-green) !important; }
.band-white  { color: var(--mud-palette-text-primary) !important; }
.band-gold   { color: var(--rdc-goldenrod) !important; }
.band-red    { color: var(--rdc-red) !important; }

/* Volume (area chart) card */
.rdc-volume-card { justify-content: flex-start; }
.rdc-volume-head { padding-right: 36px; }
.rdc-volume-svg { width: 100%; height: 48px; margin-top: 4px; display: block; }
.rdc-volume-axis { display: flex; justify-content: space-between; font-size: .66rem; color: var(--mud-palette-text-secondary); margin-top: 2px; }

/* Gauge cards */
:root { --rdc-gauge-track: rgba(127,127,127,0.18); }
.rdc-gauge-card { flex-direction: row; align-items: center; gap: 10px; justify-content: flex-start; }
.rdc-gauge { width: 112px; flex: 0 0 112px; color: var(--mud-palette-text-primary); }
.rdc-gauge-meta { min-width: 0; }
.rdc-gauge-meta .rdc-card-label { font-weight: 600; color: var(--mud-palette-text-primary); margin-bottom: 2px; }
/* Limits card: 2x2 */
.rdc-limits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 18px;
    padding-right: 44px;
}

/* ---------- Status dots (KYC / OFAC / AML / Fraud) ---------- */
.rdc-dot {
    display: inline-block;
    width: 11px; height: 11px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(127,127,127,0.15);
}
.rdc-dot--on  { background: var(--rdc-green); }
.rdc-dot--off { background: var(--rdc-red); }

/* ---------- Tables ---------- */
.rdc-table { width: 100%; }
.rdc-table .mud-table-container { width: 100%; }
.rdc-table .mud-table-cell { white-space: nowrap; }
.rdc-table .mud-table-head .mud-table-cell { font-weight: 600; font-size: 0.75rem; letter-spacing: 0.4px; text-transform: uppercase; }
.rdc-money { font-variant-numeric: tabular-nums; text-align: right; }
.rdc-muted { color: var(--mud-palette-text-secondary); }

/* ---------- Detail drawer / key-value ---------- */
.rdc-kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; font-size: 0.9rem; }
.rdc-kv dt { color: var(--mud-palette-text-secondary); }
.rdc-kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ---------- Distribution designer ---------- */
.rdc-flow {
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    gap: 0;
    height: calc(100vh - 230px);
    min-height: 560px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--rdc-radius);
    overflow: hidden;
    background: var(--mud-palette-background-gray, var(--mud-palette-background));
}
.rdc-flow-side {
    background: var(--mud-palette-drawer-background);
    padding: 14px;
    overflow-y: auto;
    border-right: 1px solid var(--mud-palette-lines-default);
}
.rdc-flow-side--right { border-right: 0; border-left: 1px solid var(--mud-palette-lines-default); }
.rdc-flow-side h4 {
    margin: 6px 0 12px;
    font-size: 0.75rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}
.rdc-palette-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px dashed var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    cursor: grab;
    user-select: none;
    font-size: 0.85rem;
}
.rdc-palette-item:active { cursor: grabbing; }
.rdc-palette-item .mud-icon-root { color: var(--rdc-accent); }
.rdc-palette-item small { display: block; color: var(--mud-palette-text-secondary); font-size: 0.72rem; }

.rdc-flow-canvas {
    position: relative;
    overflow: hidden;
    background-image: radial-gradient(rgba(127,127,127,0.18) 1px, transparent 1px);
    background-size: 22px 22px;
}
.rdc-flow-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.rdc-flow-canvas svg path { pointer-events: stroke; cursor: pointer; }
.rdc-flow-canvas--readonly .rdc-node { cursor: default; }
.rdc-flow-canvas--readonly .rdc-port, .rdc-flow-canvas--readonly .rdc-node-del { display: none !important; }
.rdc-palette-item[draggable="false"] { cursor: not-allowed; opacity: .55; }

.rdc-node {
    position: absolute;
    min-width: 170px;
    max-width: 220px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 10px;
    padding: 10px 12px 10px 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    cursor: move;
    user-select: none;
    font-size: 0.82rem;
}
.rdc-node.selected { border-color: var(--rdc-accent); box-shadow: 0 0 0 2px var(--rdc-accent-soft), 0 6px 18px rgba(0,0,0,0.18); }
.rdc-node .rdc-node-kind { font-size: 0.68rem; letter-spacing: 0.8px; text-transform: uppercase; color: var(--rdc-accent); font-weight: 600; }
.rdc-node .rdc-node-title { font-weight: 600; margin-top: 2px; }
.rdc-node .rdc-node-sub { color: var(--mud-palette-text-secondary); font-size: 0.74rem; margin-top: 2px; }
.rdc-node .rdc-node-del {
    position: absolute; top: 4px; right: 6px;
    font-size: 14px; line-height: 1; color: var(--mud-palette-text-secondary); cursor: pointer;
}
.rdc-node .rdc-node-del:hover { color: var(--rdc-red); }
.rdc-port {
    position: absolute;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--rdc-accent);
    border: 2px solid var(--mud-palette-surface);
    cursor: crosshair;
    transition: transform .1s ease;
}
.rdc-port:hover { transform: scale(1.35); }
.rdc-port--left   { left: -8px;  top: 50%;  margin-top: -7px; }
.rdc-port--right  { right: -8px; top: 50%;  margin-top: -7px; }
.rdc-port--top    { top: -8px;   left: 50%; margin-left: -7px; }
.rdc-port--bottom { bottom: -8px; left: 50%; margin-left: -7px; }
.rdc-port--in { background: var(--mud-palette-surface); border: 2px solid var(--rdc-accent); }  /* hollow = inbound */
.rdc-node--source .rdc-port--in { display: none; }
.rdc-node--end .rdc-port--out { display: none; }

/* Start / End terminals: pill-shaped, accent-filled, visually distinct from processing nodes */
.rdc-node--terminal {
    min-width: 120px;
    border-radius: 999px;
    background: var(--rdc-accent);
    border-color: var(--rdc-accent);
    color: #fff;
    text-align: center;
    padding: 12px 22px;
}
.rdc-node--terminal .rdc-node-kind { color: rgba(255,255,255,0.75); }
.rdc-node--terminal .rdc-node-sub { color: rgba(255,255,255,0.8); }
.rdc-node--terminal .rdc-node-del { color: rgba(255,255,255,0.7); }
.rdc-node--terminal .rdc-port--out { background: #fff; border-color: var(--rdc-accent); }
.rdc-node--terminal .rdc-port--in { background: var(--rdc-accent); border-color: #fff; }
.rdc-node--end { background: #2b2f3a; border-color: #2b2f3a; }
.rdc-node--end .rdc-port { border-color: #2b2f3a; }
.rdc-palette-item--terminal { border-style: solid; border-color: var(--rdc-accent); }

.rdc-edge { stroke: var(--rdc-red); stroke-width: 2; fill: none; marker-end: url(#rdc-arrow); }
.rdc-edge.selected { stroke: var(--rdc-accent); stroke-width: 3; }
.rdc-edge-draft { stroke: var(--rdc-accent); stroke-width: 2; stroke-dasharray: 6 4; fill: none; }

.rdc-flow-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.rdc-flow-hint { font-size: 0.78rem; color: var(--mud-palette-text-secondary); }

/* ---------- Dialogs ---------- */
.mud-dialog { border-radius: 12px; }
.mud-dialog .mud-dialog-title { padding: 18px 24px 10px; border-bottom: 1px solid var(--mud-palette-lines-default); }
.mud-dialog .mud-dialog-content { padding: 20px 24px 24px; }
.mud-dialog .mud-dialog-actions { padding: 14px 24px; border-top: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-background-gray, var(--mud-palette-background)); }
.rdc-scroll { max-height: 340px; overflow-y: auto; padding-right: 6px; }

/* ---------- Inputs: calmer label / text contrast (bright white on dark was hard to read) ---------- */
.mud-input-label, .mud-input-label-outlined { color: var(--mud-palette-text-secondary) !important; }
.mud-input-label.mud-input-label-inputcontrol.mud-shrink { opacity: .9; }
.mud-input > input, .mud-input > textarea, .mud-input-slot, .mud-select-input { color: var(--rdc-input-text) !important; }
.mud-input-helper-text { color: var(--mud-palette-text-secondary) !important; opacity: .85; }
:root { --rdc-input-text: #2a2f3a; }   /* overridden per theme by MainLayout */

/* ---------- Identity (static SSR) pages ---------- */
.auth-shell {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #1e1e1e;
    color: #f2f2f2;
    padding: 24px 16px;
}
.auth-panel {
    width: 100%; max-width: 440px;
    background: #262626;
    border: 1px solid #333;
    border-radius: 14px;
    padding: 32px 32px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.auth-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-logo { height: 40px; }
.auth-title { font-size: 1.45rem; font-weight: 700; margin: 0 0 6px; }
.auth-sub { color: #a8acb8; margin: 0 0 20px; font-size: 0.92rem; line-height: 1.45; }
.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 0.8rem; color: #a8acb8; margin-bottom: 6px; }
.auth-input {
    width: 100%; box-sizing: border-box;
    background: #1e1e1e; color: #f2f2f2;
    border: 1px solid #3a3a3a; border-radius: 8px;
    padding: 11px 12px; font-size: 0.95rem; font-family: inherit;
}
.auth-input:focus { outline: none; border-color: var(--rdc-accent); box-shadow: 0 0 0 3px var(--rdc-accent-soft); }
.auth-code { letter-spacing: 4px; font-size: 1.2rem; text-align: center; }
.auth-check label { display: flex; align-items: center; gap: 8px; color: #c8ccd6; font-size: 0.88rem; }
.auth-btn {
    display: inline-block; width: 100%; box-sizing: border-box; text-align: center; text-decoration: none;
    background: var(--rdc-accent); color: #fff; border: 0; border-radius: 8px;
    padding: 12px; font-weight: 600; font-size: 0.95rem; cursor: pointer; font-family: inherit;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-links { margin-top: 18px; font-size: 0.85rem; color: #a8acb8; text-align: center; }
.auth-links a { color: #8a9bd6; }
.auth-alert { padding: 10px 12px; border-radius: 8px; font-size: 0.88rem; margin-bottom: 14px; }
.auth-alert-error { background: rgba(224,85,85,0.14); color: #ff9c9c; border: 1px solid rgba(224,85,85,0.35); }
.auth-alert-ok { background: rgba(61,186,111,0.14); color: #8fe3b1; border: 1px solid rgba(61,186,111,0.35); }
.auth-validation { color: #ff9c9c; font-size: 0.8rem; margin-top: 4px; list-style: none; padding: 0; }
.auth-steps { padding-left: 20px; color: #d8dbe2; font-size: 0.9rem; line-height: 1.5; }
.auth-steps li { margin-bottom: 16px; }
.auth-key { background: #1e1e1e; border: 1px solid #3a3a3a; padding: 3px 6px; border-radius: 6px; font-size: 0.85rem; }
.auth-qr { background: #fff; display: inline-block; padding: 10px; border-radius: 10px; margin-top: 10px; }
.auth-recovery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 20px; }
.auth-recovery code { background: #1e1e1e; border: 1px solid #3a3a3a; padding: 8px; border-radius: 6px; text-align: center; font-size: 0.95rem; }
.auth-foot { margin-top: 18px; color: #6f7480; font-size: 0.8rem; }

/* Blazor error UI */
#blazor-error-ui {
    background: #2b2b2b; color: #f2f2f2; bottom: 0; box-shadow: 0 -1px 4px rgba(0,0,0,.4);
    display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.rdc-payment-row td { font-size:.8rem; background: color-mix(in srgb, var(--mud-palette-surface) 85%, var(--rdc-green) 15%); }
