/* Defining the AAF colour pallete */
:root {
    --LogoGold: #B28D35;
    --LightGold: #D1BB8B;
    --LogoGreen: #12433E;
    --DarkGreen: #475749;
    --LogoGrey: #859D9A;
    --LogoSand: #E0D5A8;
    --LogoLightGrey: #E9F0EF;
    --AAFRoyalBlue: #242A41;
    --TextColour: #F6F6F6;
    --PageBackground: #F9F9F6;
    /* Text sizes: use only these six (no px/rem values in components). Minimum is 12px. */
    --SmallFont: 0.75rem;       /* 12px: captions, footnotes, chart labels */
    --SmallMediumFont: 0.875rem; /* 14px: body text in cards, list rows */
    --BodyFont: 1rem;           /* 16px: inputs, buttons, main body text */
    --MediumFont: 1.1rem;
    --LargeFont: 1.3rem;
    --ExtraLargeFont: 1.7rem;
    --XxlFont: 2.0rem;

    /* Typography */
    --font-family-base: 'Manrope', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Semantic colour roles (refinement layer over the brand palette above -
       prefer these for new/updated work so usage stays consistent) */
    --text-primary: var(--AAFRoyalBlue);
    --text-secondary: var(--DarkGreen);
    --text-muted: var(--LogoGrey);
    --text-accent: var(--LogoGold);
    --border-default: var(--LogoLightGrey);
    --surface: #FFFFFF;

    /* Standard content-card treatment: thin border + subtle drop shadow,
       used on any div that separates a block of content from the page background */
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);

    /* Corners: small (inputs, chips, row buttons), medium (cards, main buttons), pill (status badges) */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-pill: 999px;

    /* Spacing: page edge, inside cards, between cards. Tighter on phones (below). */
    --page-gutter: 24px;
    --card-padding: 20px;
    --stack-gap: 16px;
    --button-height: 44px;
    /* Gap between the floating bottom nav and the screen edge (as in the app) */
    --BottomNavOffset: max(16px, env(safe-area-inset-bottom));

    /* Card titles ("Recent news", "Dividend history", "Order book", ...) */
    --card-title-size: var(--LargeFont);

    --success-color: var(--LogoGreen);
    --success-bg: rgba(18, 67, 62, 0.08);
    --success-border: rgba(18, 67, 62, 0.3);
    --warning-color: var(--LogoGold);
    --warning-bg: rgba(178, 141, 53, 0.08);
    --warning-border: rgba(178, 141, 53, 0.4);
    --danger-color: #A32D2D;
    --danger-bg: rgba(163, 45, 45, 0.08);
    --danger-border: rgba(163, 45, 45, 0.3);
    --danger-bg-strong: rgba(163, 45, 45, 0.14);
    --danger-bg-hover: rgba(163, 45, 45, 0.22);
    --danger-bg-active: rgba(163, 45, 45, 0.3);
    --danger-border-hover: rgba(163, 45, 45, 0.5);
}

/* Breakpoints used across the site:
     1400px  sidebar becomes the top header and bottom navigation (MainLayout)
     1000px  content goes to one column ("phone and tablet")
      600px  small-phone tweaks */
@media (max-width: 1000px) {
    :root {
        --page-gutter: 12px;
        --card-padding: 16px;
        --stack-gap: 12px;
        --card-title-size: 1.15rem;
    }
}

/* ============================================================
   CARDS
   .aaf-card is the standard white card; .card-title / .card-subtitle
   are the one heading style used at the top of every card.
   ------------------------------------------------------------ */
.aaf-card {
    background-color: var(--surface);
    border: 1px solid var(--LogoLightGrey);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    padding: var(--card-padding);
    box-sizing: border-box;
}

.card-title {
    font-family: var(--font-family-base);
    font-size: var(--card-title-size);
    font-weight: 700;
    line-height: 1.25;
    color: var(--LogoGreen);
    margin: 0 0 4px;
}

.card-subtitle {
    font-size: var(--SmallMediumFont);
    line-height: 1.4;
    color: var(--LogoGrey);
    margin: 0 0 12px;
}

    html, body {
        font-family: var(--font-family-base);
        margin: 0;
    }

/* ============================================================
   BUTTONS
   One main style and one secondary style everywhere, plus a compact
   size for buttons that sit inside a row (View, Switch account).
     .e-btn-primary          main action: dark green, fixed width on desktop, full width on phones
     .e-btn-primary-autowidth main action sized to its label
     .e-btn-secondary(-autowidth) the same shapes, green outline
     .e-btn-tertiary(-autowidth)  compact outline button for rows and lists
     .e-btn-danger           small destructive action (close, cancel order)
   Works on Syncfusion SfButtons (CssClass) and on plain <a>/<button>.
   ------------------------------------------------------------ */
.e-btn-primary, .e-btn-primary:focus,
.e-btn-primary-autowidth, .e-btn-primary-autowidth:focus,
.e-btn-secondary, .e-btn-secondary:focus,
.e-btn-secondary-autowidth, .e-btn-secondary-autowidth:focus {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--button-height);
    height: auto;
    padding: 8px 20px;
    margin: 0;
    border-radius: var(--radius-md);
    font-family: var(--font-family-base);
    font-size: var(--BodyFont);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-transform: none;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.e-btn-primary, .e-btn-primary:focus,
.e-btn-secondary, .e-btn-secondary:focus {
    min-width: 120px;
}

.e-btn-primary, .e-btn-primary:focus,
.e-btn-primary-autowidth, .e-btn-primary-autowidth:focus {
    background-color: var(--LogoGreen);
    border: 1.5px solid var(--LogoGreen);
    color: var(--TextColour);
}

    .e-btn-primary:hover, .e-btn-primary-autowidth:hover {
        background-color: #0c312d;
        border-color: #0c312d;
        color: var(--TextColour);
    }

.e-btn-secondary, .e-btn-secondary:focus,
.e-btn-secondary-autowidth, .e-btn-secondary-autowidth:focus {
    background-color: white;
    border: 1.5px solid var(--LogoGreen);
    color: var(--LogoGreen);
}

    .e-btn-secondary:hover, .e-btn-secondary-autowidth:hover {
        background-color: var(--success-bg);
        color: var(--LogoGreen);
    }

.e-btn-primary:active, .e-btn-primary-autowidth:active,
.e-btn-secondary:active, .e-btn-secondary-autowidth:active,
.e-btn-tertiary:active, .e-btn-tertiary-autowidth:active {
    transform: scale(0.98);
}

.e-btn-primary:disabled, .e-btn-primary-autowidth:disabled,
.e-btn-secondary:disabled, .e-btn-secondary-autowidth:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Compact outline button for rows and lists */
.e-btn-tertiary, .e-btn-tertiary:focus,
.e-btn-tertiary-autowidth, .e-btn-tertiary-autowidth:focus {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    height: auto;
    padding: 6px 14px;
    margin: 0;
    background-color: white;
    border: 1px solid var(--LogoGreen);
    border-radius: var(--radius-sm);
    color: var(--LogoGreen);
    font-family: var(--font-family-base);
    font-size: var(--SmallMediumFont);
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-transform: none;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.e-btn-tertiary, .e-btn-tertiary:focus {
    min-width: 100px;
}

    .e-btn-tertiary:hover, .e-btn-tertiary-autowidth:hover {
        background-color: var(--success-bg);
        color: var(--LogoGreen);
    }

.e-btn-danger,
.e-btn-danger:focus {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    width: auto;
    height: auto;
    padding: 4px 12px;
    margin: 0;
    background-color: var(--danger-bg-strong);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    color: var(--danger-color);
    font-family: var(--font-family-base);
    font-size: var(--SmallMediumFont);
    font-weight: 600;
    line-height: 1;
    text-transform: none;
    box-shadow: none;
    transition: all 0.15s ease;
}

    .e-btn-danger:hover {
        background-color: var(--danger-bg-hover);
        border-color: var(--danger-border-hover);
        color: var(--danger-color);
        cursor: pointer;
    }

    .e-btn-danger:active {
        background-color: var(--danger-bg-active);
        transform: scale(0.96);
    }

/* On phones the main buttons fill their row; side-by-side pairs (Cancel / Confirm) share it. */
@media (max-width: 1000px) {
    .e-btn-primary, .e-btn-secondary {
        width: 100%;
    }
}

/* Trade/order status badges - shared across OrderBook and ShareHistoryGrid */
.status-traded, .status-failed, .status-awaiting-contracts {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
}

.status-traded {
    background-color: var(--success-bg);
    color: var(--success-color);
    border: 1px solid var(--success-border);
}

.status-failed {
    background-color: var(--danger-bg);
    color: var(--danger-color);
    border: 1px solid var(--danger-border);
}

.status-awaiting-contracts {
    background-color: var(--warning-bg);
    color: var(--warning-color);
    border: 1px solid var(--warning-border);
}

.status-traded::before, .status-failed::before, .status-awaiting-contracts::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 6px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.status-traded::before {
    background-image: url("../img/circle-check.svg");
}

.status-failed::before {
    background-image: url("../img/circle-cross.svg");
}

.status-awaiting-contracts::before {
    background-image: url("../img/clock.svg");
}

/* ============================================================
   SUMMARY CARDS
   Icon + label, a big figure and a supporting line. Used for the
   top cards on Home (InfoCards) and My Investment (InvestmentPerformance).
   ------------------------------------------------------------ */
.summary-card {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
    background-color: white;
    border: 1px solid var(--LogoLightGrey);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    padding: var(--card-padding);
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

    /* Thin brand accent along the top edge */
    .summary-card::before {
        content: "";
        position: absolute;
        inset: 0 0 auto 0;
        height: 3px;
        background: var(--LogoGreen);
    }

    .summary-card:hover {
        box-shadow: var(--card-shadow-hover);
        transform: translateY(-1px);
    }

    .summary-card.is-clickable {
        cursor: pointer;
    }

.summary-link {
    font-size: var(--SmallFont);
    font-weight: 600;
    color: var(--LogoGreen);
    margin: auto 0 0;
}

.summary-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.summary-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .summary-icon.is-green {
        background: rgba(18, 67, 62, 0.08);
        color: var(--LogoGreen);
    }

    .summary-icon.is-gold {
        background: rgba(178, 141, 53, 0.12);
        color: #8A6A22;
    }

    .summary-icon.is-navy {
        background: rgba(36, 42, 65, 0.07);
        color: var(--AAFRoyalBlue);
    }

.summary-label {
    font-size: var(--SmallMediumFont);
    font-weight: 500;
    color: var(--LogoGrey);
    margin: 0;
    line-height: 1.3;
}

.summary-value {
    font-size: var(--LargeFont);
    font-weight: 700;
    color: var(--AAFRoyalBlue);
    margin: 0;
    letter-spacing: -0.01em;
}

.summary-unit {
    font-size: var(--SmallMediumFont);
    font-weight: 500;
    color: var(--LogoGold);
}

.summary-sub {
    font-size: var(--SmallFont);
    color: var(--LogoGrey);
    margin: 0;
}

.summary-change {
    align-self: flex-start;
    font-size: var(--SmallFont);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
}

    .summary-change.positive {
        background: #E6F4EA;
        color: #1E6B3A;
    }

    .summary-change.negative {
        background: #FCE8E8;
        color: #A32D2D;
    }

/* ============================================================
   HISTORY CARD LISTS
   Transfer and dividend history on phones: one card per row instead of a
   table that scrolls sideways (ShareHistoryGrid, DividendHistoryTable).
   ------------------------------------------------------------ */
.history-cards {
    display: none;
}

@media (max-width: 600px) {
    .history-cards {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* Only the table that has a card list right before it (other grids still show) */
    .history-cards + .grid-mobile-wrapper {
        display: none;
    }
}

.history-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--LogoLightGrey);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.history-card-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.history-card-title {
    font-size: var(--SmallMediumFont);
    font-weight: 700;
    color: var(--AAFRoyalBlue);
}

.history-card-amount {
    font-size: var(--SmallMediumFont);
    font-weight: 700;
    color: var(--LogoGreen);
    white-space: nowrap;
}

.history-card-meta {
    font-size: var(--SmallFont);
    color: var(--LogoGrey);
}

.history-card-status {
    align-self: flex-start;
    margin-top: 4px;
    font-size: var(--SmallFont);
}

    .history-card-status.status-traded::before,
    .history-card-status.status-failed::before,
    .history-card-status.status-awaiting-contracts::before {
        width: 14px;
        height: 14px;
        margin-right: 4px;
    }

/* Label / value pairs inside a card (financial history) */
.history-card-figures {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
    margin: 4px 0 0;
    font-size: var(--SmallFont);
}

    .history-card-figures dt {
        color: var(--LogoGrey);
    }

    .history-card-figures dd {
        margin: 0;
        text-align: right;
        font-weight: 600;
        color: var(--AAFRoyalBlue);
    }

.history-cards-empty {
    font-size: var(--SmallMediumFont);
    color: var(--LogoGrey);
    margin: 8px 0;
}

.history-more {
    margin-top: 4px;
}
