html, body {
    margin: 0;
    font-family: 'Roboto', Helvetica, Arial, sans-serif;
}

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: #666;
}

/* Money columns read better right aligned and in a fixed-width font */
.amount-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* MudSimpleTable sets its own "text-align: start" on every cell with a stronger selector,
   so .amount-cell alone is not enough inside it (Item Invoice totals, GST Invoice Entry, Closing Stock). */
.mud-simple-table td.amount-cell,
.mud-simple-table th.amount-cell {
    text-align: right;
}

/* Amount inputs (Debit / Credit / values): the text itself must be right aligned,
   so the rule has to reach the <input> inside the MudBlazor field. */
.amount-field input {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* The year button in the dark app bar must use the app bar's own text colour */
.mud-appbar .year-picker {
    color: inherit;
}

#blazor-error-ui {
    background: #ffd7d7;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Group rows in the report trees */
.report-group-row {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Two-sided statements (Profit & Loss, Balance Sheet) */
.statement-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.statement-table th,
.statement-table td {
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 4px 8px;
    vertical-align: top;
}

.statement-table thead th {
    background-color: rgba(0, 0, 0, 0.04);
    font-weight: 600;
    text-align: left;
}

/* The line between the two sides */
.statement-table th:nth-child(4),
.statement-table td:nth-child(4) {
    border-left-width: 2px;
}

.statement-strong {
    font-weight: 600;
}

.statement-total-row td {
    font-weight: 700;
    background-color: rgba(0, 0, 0, 0.04);
}

.statement-toggle {
    cursor: pointer;
    user-select: none;
    color: var(--mud-palette-text-secondary);
}

.statement-link {
    cursor: pointer;
    color: var(--mud-palette-primary);
    text-decoration: none;
}

.statement-link:hover {
    text-decoration: underline;
}

@media print {
    .statement-link { color: inherit; text-decoration: none; }
    .statement-toggle { display: none; }
}

@media print {
    .mud-appbar, .mud-drawer, .no-print { display: none !important; }
    .mud-main-content { padding: 0 !important; }
    .mud-paper { box-shadow: none !important; }
    .mud-container { max-width: 100% !important; padding: 0 !important; }

    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; page-break-after: auto; }
    thead { display: table-header-group; }   /* repeat headers on every page */
}

/* ---------------------------------------------------------------- Store (simple shop) screens */

.store-nav { opacity: 0.85; white-space: nowrap; }
.store-nav.mud-button-root { padding-left: 8px; padding-right: 8px; min-width: 0; }
.store-shop-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.store-nav-active { opacity: 1; background: rgba(255, 255, 255, 0.18) !important; }

/* Product picture: a square with the picture fitted inside, or the first letters */
.product-img {
    display: block;
    object-fit: contain;
    border-radius: 8px;
    background: #fafafa;
}
.product-img-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #455a64;
    font-weight: 600;
    user-select: none;
}

/* Billing screen: product tiles */
.store-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    padding: 2px;
}
.store-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 6px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: box-shadow 0.12s, border-color 0.12s;
}
.store-tile:hover { border-color: #43a047; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.store-tile:active { transform: scale(0.98); }
.store-tile-name {
    font-size: 13px;
    line-height: 1.2;
    height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.store-tile-price { font-weight: 700; color: #2e7d32; font-size: 14px; }

/* Billing screen: the cart */
.store-cart-lines { max-height: calc(100vh - 470px); min-height: 120px; overflow-y: auto; }
.store-cart-line { border-bottom: 1px dashed #e0e0e0; padding: 6px 0; }
.store-total { font-size: 2.4rem; font-weight: 800; text-align: right; line-height: 1.1; }
.store-pay-btn { height: 64px; font-size: 1.25rem !important; font-weight: 700 !important; }

/* Products page: cards */
.store-product-card { cursor: pointer; height: 100%; }
.store-product-card:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15); }

/* Home page: big buttons */
.store-big-btn { height: 96px; font-size: 1.1rem !important; }

.store-tile-stock { font-size: 11px; color: #607d8b; }
.store-tile-stock-none { color: #c62828; font-weight: 600; }
