:root {
    --buon-teal: #0F7A8C;
    --buon-teal-dark: #0D4F58;
    --buon-coral: #FF6F5E;
    --buon-bg: #F0F9F9;
    --buon-card: #FFFFFF;
    --buon-text: #0D3B40;
    --buon-muted: #5A8A90;
    --buon-border: #CFE8E8;
    --buon-purchase: #E85A4F;
    --buon-sale: #2E9E6B;
    --nav-height: 64px;
}

html, body {
    background: var(--buon-bg);
    color: var(--buon-text);
    color-scheme: light;
    -webkit-font-smoothing: antialiased;
}

/* ── Page header ── */
.page-header {
    text-align: center;
    padding: 1rem 0.5rem 1.25rem;
    margin: -8px -8px 1rem;
    background: linear-gradient(160deg, var(--buon-teal-dark) 0%, var(--buon-teal) 100%);
    border-radius: 0 0 20px 20px;
    color: #fff;
}

.page-header--compact {
    text-align: left;
    padding: 1rem;
    margin: -8px -8px 1rem;
    background: linear-gradient(160deg, var(--buon-teal-dark) 0%, var(--buon-teal) 100%);
    border-radius: 0 0 16px 16px;
    color: #fff;
}

.page-header__title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.page-header__date {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.92);
    margin-top: 0.25rem;
}

.page-header__subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.15rem;
}

.app-author {
    margin: 1.25rem 0 0.25rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--buon-muted);
    line-height: 1.4;
}

.backup-panel {
    margin: 1.5rem 0 1rem;
    padding: 1rem;
    border: 1px solid var(--buon-border);
    border-radius: 14px;
    background: var(--buon-card);
}

.backup-panel__title {
    margin-bottom: 0.35rem;
}

.backup-panel__hint {
    margin: 0 0 0.85rem;
    font-size: 0.78rem;
    line-height: 1.45;
}

.backup-panel__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.backup-panel__btn {
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--buon-border);
    background: var(--buon-bg);
    color: var(--buon-text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    touch-action: manipulation;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.backup-panel__btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.backup-panel__btn--export {
    border-color: var(--buon-teal);
    color: var(--buon-teal);
}

.backup-panel__btn--restore {
    border-color: #c77700;
    color: #c77700;
}

.backup-panel__status {
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.backup-panel__status--success {
    background: rgba(46, 125, 50, 0.12);
    color: #2e7d32;
}

.backup-panel__status--error {
    background: rgba(198, 40, 40, 0.1);
    color: #c62828;
}

.backup-panel__status--info {
    background: rgba(15, 122, 140, 0.1);
    color: var(--buon-teal-dark);
}

#backup-status[hidden] {
    display: none !important;
}

/* ── Stat cards (Home) ── */
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--buon-card);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    box-shadow: 0 2px 8px rgba(13, 79, 88, 0.08);
    border: 1px solid var(--buon-border);
}

.stat-card--wide {
    grid-column: 1 / -1;
}

.stat-card__label {
    font-size: 0.88rem;
    color: var(--buon-muted);
    font-weight: 500;
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.stat-card__value {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-card__value--purchase { color: var(--buon-purchase); }
.stat-card__value--sale { color: var(--buon-sale); }

.stat-card--compact {
    padding: 0.75rem 0.85rem;
}

.stat-card__value--sm {
    font-size: 1.15rem !important;
}

.stat-grid--period .stat-card__label {
    font-size: 0.92rem;
}

.stat-grid--period .stat-card__value--sm {
    font-size: 1.25rem !important;
}

.stat-grid--period {
    margin-bottom: 0.75rem;
}

/* ── Inventory by type (Home) ── */
.inventory-card {
    background: var(--buon-card);
    border: 1px solid var(--buon-border);
    border-radius: 14px;
    padding: 0.85rem 0.75rem 0.75rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(13, 79, 88, 0.07);
}

.inventory-card__hint {
    font-size: 0.88rem;
    margin: 0 0 0.65rem 0.15rem;
}

.inventory-table__head,
.inventory-table__row {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 0.85fr));
    gap: 0.35rem;
    align-items: center;
}

.inventory-table__head {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--buon-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0 0.15rem 0.45rem;
    border-bottom: 1px solid var(--buon-border);
}

.inventory-table__head span:not(:first-child),
.inventory-table__qty {
    text-align: right;
}

.inventory-table__row {
    padding: 0.55rem 0.15rem;
    border-bottom: 1px dashed var(--buon-border);
    font-size: 0.95rem;
}

.inventory-table__row:last-child {
    border-bottom: none;
    padding-bottom: 0.15rem;
}

.inventory-table__type {
    font-weight: 700;
    color: var(--buon-text);
    line-height: 1.25;
    word-break: break-word;
}

.inventory-table__qty {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.inventory-table__qty--purchase {
    color: var(--buon-purchase);
}

.inventory-table__qty--sale {
    color: var(--buon-sale);
}

.inventory-table__qty--remain {
    color: var(--buon-teal-dark);
}

.inventory-table__qty--deficit {
    color: var(--buon-purchase);
}

.inventory-table__qty--zero {
    color: var(--buon-muted);
}

/* ── Period stats & chart ── */
.period-toggle {
    margin-bottom: 0.75rem;
}

.period-toggle__group {
    width: 100%;
    display: flex;
}

.period-toggle__btn {
    flex: 1;
    text-transform: none !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    min-height: 44px;
}

.period-toggle__range {
    font-size: 0.92rem;
    margin: 0.45rem 0.25rem 0;
}

.chart-card {
    background: var(--buon-card);
    border: 1px solid var(--buon-border);
    border-radius: 14px;
    padding: 0.75rem 0.5rem 0.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(13, 79, 88, 0.07);
}

.chart-card__hint {
    font-size: 0.88rem;
    text-align: center;
    margin: 0 0 0.55rem;
}

.css-chart__legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.65rem;
    font-size: 0.88rem;
    font-weight: 600;
}

.css-chart__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.css-chart__legend-item::before {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 2px;
}

.css-chart__legend-item--purchase {
    color: var(--buon-purchase);
}

.css-chart__legend-item--purchase::before {
    background: var(--buon-purchase);
}

.css-chart__legend-item--sale {
    color: var(--buon-sale);
}

.css-chart__legend-item--sale::before {
    background: var(--buon-sale);
}

.css-chart__plot {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 220px;
    padding: 1.1rem 0.15rem 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.css-chart__plot--compact {
    gap: 3px;
}

.css-chart__plot--compact .css-chart__col {
    min-width: 22px;
}

.css-chart__plot--compact .css-chart__label {
    font-size: 0.78rem;
}

.css-chart__col {
    flex: 1;
    min-width: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.css-chart__pair {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    min-height: 0;
    height: 100%;
}

.css-chart__bar-slot {
    flex: 1;
    max-width: 26px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
}

.css-chart__bar-slot--empty {
    visibility: hidden;
    max-width: 26px;
    flex: 1;
}

.css-chart__value {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2px;
    white-space: nowrap;
}

.css-chart__value--purchase {
    color: var(--buon-purchase);
}

.css-chart__value--sale {
    color: var(--buon-sale);
}

.css-chart__bar {
    width: 100%;
    flex: 1;
    min-height: 4px;
    border-radius: 3px 3px 1px 1px;
}

.css-chart__bar--purchase {
    background: var(--buon-purchase);
}

.css-chart__bar--sale {
    background: var(--buon-sale);
}

.css-chart__plot--compact .css-chart__bar-slot,
.css-chart__plot--compact .css-chart__bar-slot--empty {
    max-width: 20px;
}

.css-chart__plot--compact .css-chart__value {
    font-size: 0.7rem;
    margin-bottom: 1px;
}

.css-chart__label {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--buon-muted);
    text-align: center;
    line-height: 1.1;
    white-space: nowrap;
}

.empty-state--compact {
    padding: 1.25rem 0.75rem;
    font-size: 0.85rem;
}

/* ── Section title ── */
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--buon-teal-dark);
    margin: 0 0 0.75rem 0.25rem;
}

/* ── Order / transaction cards ── */
.order-card {
    background: var(--buon-card);
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 8px rgba(13, 79, 88, 0.07);
    border: 1px solid var(--buon-border);
}

.order-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.order-card__name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--buon-text);
    line-height: 1.2;
}

.order-card__time {
    font-size: 1rem;
    color: var(--buon-muted);
    margin-top: 0.2rem;
}

.order-card__datetime {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    font-size: 1rem;
    color: var(--buon-muted);
}

.order-card__date-part {
    font-weight: 500;
}

.order-card__time-part::before {
    content: "·";
    margin-right: 0.4rem;
    opacity: 0.6;
}

.order-card__actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.5rem;
}

.order-card__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.65rem;
    margin-top: 0.5rem;
    border-top: 1px dashed var(--buon-border);
    font-size: 1.35rem;
    font-weight: 700;
}

.order-card__total-label {
    color: var(--buon-muted);
    font-size: 1.05rem;
}

.order-card__total .amount-purchase,
.order-card__total .amount-sale {
    font-size: 1.4rem;
    font-weight: 800;
}

/* ── Item rows (replaces table on mobile) ── */
.order-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.order-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    background: var(--buon-bg);
    border-radius: 10px;
}

.order-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.order-item-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--buon-text);
}

.order-item-meta {
    font-size: 1rem;
    color: var(--buon-muted);
}

.order-item-amount {
    font-size: 1.3rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.amount-purchase { color: var(--buon-purchase); }
.amount-sale { color: var(--buon-sale); }

/* ── Recent transaction (Home) ── */
.tx-card {
    background: var(--buon-card);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.65rem;
    border: 1px solid var(--buon-border);
    box-shadow: 0 1px 4px rgba(13, 79, 88, 0.06);
}

.tx-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.tx-card__summary {
    font-size: 0.78rem;
    color: var(--buon-muted);
    margin-top: 0.25rem;
}

.tx-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tx-badge--buy {
    background: #FDECEA;
    color: var(--buon-purchase);
}

.tx-badge--sell {
    background: #E8F5EE;
    color: var(--buon-sale);
}

.tx-card__amount {
    font-size: 1rem;
    font-weight: 700;
}

/* ── Add button ── */
.btn-add-order {
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 1.05rem !important;
    letter-spacing: 0.01em;
    text-transform: none !important;
    box-shadow: 0 4px 12px rgba(46, 158, 107, 0.35) !important;
    margin-bottom: 1rem !important;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--buon-muted);
    font-size: 0.9rem;
}

/* ── Bottom nav ── */
.main-content {
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 12px);
    padding-top: 0;
    min-height: 100dvh;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--buon-card) !important;
    border-top: 1px solid var(--buon-border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -4px 16px rgba(13, 79, 88, 0.1) !important;
}

.bottom-nav .mud-nav-link {
    padding: 0.55rem 0.25rem !important;
    min-height: var(--nav-height);
    border-radius: 0 !important;
    flex-direction: column;
    gap: 0.15rem;
    color: var(--buon-muted) !important;
    font-size: 0.72rem !important;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.bottom-nav .mud-nav-link.mud-nav-link-active {
    background: rgba(15, 122, 140, 0.1) !important;
    color: var(--buon-teal) !important;
    font-weight: 700;
}

.bottom-nav .nav-emoji {
    font-size: 1.35rem;
    line-height: 1;
}

.bottom-nav .nav-divider {
    width: 1px;
    background: var(--buon-border);
    align-self: stretch;
    margin: 0.5rem 0;
}

.mud-container {
    padding-left: 12px !important;
    padding-right: 12px !important;
}

.label-muted {
    color: var(--buon-muted) !important;
}

/* ── Blazor defaults ── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    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;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--buon-teal);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

.loading-progress-text--error {
    inset: calc(20vh + 3.25rem) 1rem auto;
    font-size: 0.9rem;
    font-weight: 600;
    color: #b32121;
}

.loading-progress-text--error:after {
    content: attr(data-msg);
    white-space: pre-wrap;
}

.inapp-hint {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1.5rem;
    z-index: 20;
    background: #fff;
    border: 1px solid #cfe8e8;
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 8px 24px rgba(13, 79, 88, 0.18);
    color: #0d3b40;
    text-align: center;
}

.inapp-hint p {
    margin: 0.25rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ── Dialog item rows (mobile-friendly) ── */
.dialog-item-row {
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--buon-border);
}

.dialog-item-row:last-of-type {
    border-bottom: none;
    margin-bottom: 0.5rem;
}

.dialog-item-card {
    border: 1px solid var(--buon-border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem 0.85rem;
    margin-bottom: 0.85rem;
    background: #fff;
}

.dialog-item-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.dialog-item-badge {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--buon-muted);
}

.dialog-item-field--full {
    margin-bottom: 0.85rem;
}

.dialog-item-field {
    min-width: 0;
}

.dialog-item-grid,
.dialog-item-numeric-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.85rem;
    row-gap: 1.15rem;
    align-items: end;
}

.dialog-item-grid + .dialog-item-grid {
    margin-top: 1.15rem;
}

.dialog-item-delete-btn {
    margin-top: 0.75rem !important;
    font-size: 1.05rem !important;
}

.numeric-right input {
    text-align: right;
}

.dialog-item-calc {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--buon-teal-dark);
    line-height: 1.3;
    white-space: nowrap;
}

.dialog-item-calc-box {
    margin: 0.9rem 0 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--buon-border);
    border-radius: 10px;
    background: var(--buon-bg);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--buon-teal-dark);
    text-align: center;
    line-height: 1.3;
}

.dialog-item-calc-box + .dialog-item-grid {
    margin-top: 0.9rem;
}

.order-item-meta--calc {
    color: var(--buon-teal-dark);
    font-weight: 600;
    font-size: 1rem;
}

.section-label {
    color: var(--buon-teal-dark) !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
}

.field-caption {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--buon-muted);
    margin-bottom: 0.35rem;
    line-height: 1.2;
}

.shrimp-type-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.species-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.species-toggle__btn {
    border: 1px solid var(--buon-border);
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    background: #fff;
    color: var(--buon-muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.species-toggle__btn--active {
    background: var(--buon-teal);
    border-color: var(--buon-teal);
    color: #fff;
}

.shrimp-type-chip {
    border: 1px solid var(--buon-border);
    border-radius: 999px;
    padding: 0.5rem 0.85rem;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.2;
    background: #fff;
    color: var(--buon-text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.shrimp-type-chip--selected {
    background: var(--buon-teal);
    border-color: var(--buon-teal);
    color: #fff;
}

.shrimp-type-other {
    width: 100%;
}

.shrimp-type-other input {
    font-size: 20px !important;
}

.total-box {
    background: var(--buon-bg) !important;
    border-color: var(--buon-border) !important;
}

.total-box .label-muted {
    font-size: 1.05rem !important;
    font-weight: 600 !important;
}

.total-box .mud-typography-h5,
.total-box .mud-typography-h5 strong {
    font-size: 1.85rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}

/* Ô số: không dùng label nổi — tránh lỗi iOS Safari */
.numeric-plain.mud-input-root {
    margin-top: 0 !important;
}

.numeric-plain .mud-input-label {
    display: none !important;
}

.numeric-plain .mud-input-control {
    min-height: 58px;
    margin-top: 0 !important;
}

.numeric-plain .mud-input-control-input-container {
    align-items: center !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.numeric-plain .mud-input-root-outlined .mud-input-root-outlined-border {
    min-height: 58px;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.numeric-plain input {
    font-size: 24px !important;
    font-weight: 700;
    line-height: 1.3 !important;
    padding: 12px 10px !important;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}

.numeric-plain input::placeholder {
    color: #9BB8BC;
    opacity: 1;
}

/* Autocomplete trong dialog */
.field-ios.mud-input-root {
    margin-top: 0 !important;
}

.field-ios input {
    font-size: 20px !important;
}

.field-ios .mud-input-label {
    font-size: 1.05rem !important;
}

.mud-dialog .mud-dialog-content {
    padding-top: 0.25rem !important;
    padding-bottom: 0.5rem;
    font-size: 1.05rem;
}

.dialog-seller-field.mud-input-root {
    margin-top: 0 !important;
}

.mud-dialog .mud-dialog-title {
    font-weight: 700 !important;
    font-size: 1.35rem !important;
    color: var(--buon-teal-dark) !important;
    background: #fff !important;
}

/* Dialog luôn nền sáng — tránh iOS Dark Mode làm mất ô nhập */
.mud-dialog-container .mud-dialog-surface,
.mud-dialog-container .mud-dialog {
    background: #fff !important;
    color: var(--buon-text) !important;
}

.mud-dialog .mud-dialog-content,
.mud-dialog .mud-dialog-actions {
    background: #fff !important;
    color: var(--buon-text) !important;
}

.dialog-item-card .numeric-plain .mud-input-root-outlined .mud-input-root-outlined-border,
.dialog-item-card .mud-input-root-outlined .mud-input-root-outlined-border,
.field-ios.mud-input-root-outlined .mud-input-root-outlined-border {
    border-color: var(--buon-border) !important;
}

.dialog-item-card .numeric-plain input,
.dialog-item-card .mud-input-root input,
.mud-dialog .field-ios input {
    color: var(--buon-text) !important;
    background-color: #fff !important;
    -webkit-text-fill-color: var(--buon-text);
}

.dialog-form-alert {
    font-size: 1.05rem !important;
}

.lazy-route-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--buon-muted);
    font-size: 0.9rem;
}

.lazy-route-loading--overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(240, 249, 249, 0.92);
}

.app-shell {
    position: relative;
    min-height: 100%;
}

/* ── Share receipt (image for Zalo) ── */
.share-hint {
    font-size: 0.82rem;
    color: var(--buon-muted);
    margin: 0 0 0.75rem;
    line-height: 1.4;
}

.share-receipt-wrap {
    display: flex;
    justify-content: center;
    padding: 0 0.25rem;
}

.share-receipt {
    width: 340px;
    max-width: 100%;
    margin: 0;
    padding: 1.25rem 1.2rem 1.15rem;
    background: #fffef8;
    border: 2px solid var(--buon-border);
    border-radius: 12px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--buon-text);
    box-sizing: border-box;
    overflow: hidden;
}

.share-receipt__brand {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--buon-teal-dark);
    margin-bottom: 0.35rem;
}

.share-receipt__type {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.85rem;
}

.share-receipt__type--purchase {
    background: rgba(46, 158, 107, 0.12);
    color: #1a7a4f;
}

.share-receipt__type--sale {
    background: rgba(15, 122, 140, 0.12);
    color: var(--buon-teal);
}

.share-receipt__meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
}

.share-receipt__row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.share-receipt__row span {
    color: var(--buon-muted);
    flex-shrink: 0;
}

.share-receipt__row strong {
    text-align: right;
    word-break: break-word;
    min-width: 0;
    padding-left: 0.5rem;
}

.share-receipt__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 0.1rem 0.65rem;
    padding: 0.5rem 0.55rem;
    background: var(--buon-bg);
    border-radius: 8px;
}

.share-receipt__item-name {
    grid-column: 1;
    font-weight: 600;
    font-size: 0.88rem;
}

.share-receipt__item-detail {
    grid-column: 1;
    font-size: 0.76rem;
    color: var(--buon-muted);
}

.share-receipt__item-total {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    padding-right: 0.05rem;
}

.share-receipt__divider {
    height: 1px;
    background: var(--buon-border);
    margin: 0.75rem 0;
}

.share-receipt__items {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.share-receipt__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    padding-top: 0.15rem;
}

.share-receipt__total strong {
    font-size: 1.05rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Thermal 58mm — high contrast B&W for Xprinter / receipt printers */
.share-receipt--thermal {
    width: 384px;
    max-width: 384px;
    padding: 12px 14px 14px;
    background: #fff;
    border: none;
    border-radius: 0;
    color: #000;
    box-shadow: none;
    line-height: 1.35;
    box-sizing: border-box;
    overflow: visible;
}

.share-receipt--thermal .share-receipt__brand {
    color: #000;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    margin-bottom: 10px;
    line-height: 1.15;
}

.share-receipt--thermal .share-receipt__type {
    background: transparent;
    color: #000;
    border: 2px solid #000;
    border-radius: 0;
    margin-bottom: 14px;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 8px 6px;
    text-align: center;
}

.share-receipt--thermal .share-receipt__type--purchase,
.share-receipt--thermal .share-receipt__type--sale {
    background: transparent;
    color: #000;
}

.share-receipt--thermal .share-receipt__meta {
    font-size: 26px;
    gap: 8px;
}

.share-receipt--thermal .share-receipt__row span {
    color: #222;
    font-weight: 700;
    font-size: 26px;
    white-space: nowrap;
}

.share-receipt--thermal .share-receipt__row strong {
    color: #000;
    font-weight: 800;
    font-size: 30px;
    white-space: nowrap;
}

.share-receipt--thermal .share-receipt__item {
    display: block;
    background: transparent;
    border-radius: 0;
    border-bottom: 1px dashed #000;
    padding: 10px 0;
    grid-template-columns: unset;
    grid-template-rows: unset;
}

.share-receipt--thermal .share-receipt__items .share-receipt__item:last-child {
    border-bottom: none;
}

.share-receipt--thermal .share-receipt__items {
    gap: 6px;
}

.share-receipt--thermal .share-receipt__item-name {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 4px;
}

.share-receipt--thermal .share-receipt__item-total {
    color: #000;
    font-weight: 800;
    font-size: 32px;
    text-align: right;
    margin-top: 6px;
    margin-bottom: 0;
    white-space: nowrap;
}

.share-receipt--thermal .share-receipt__item-detail-line {
    color: #111;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.35;
}

.share-receipt--thermal .share-receipt__item-perkg {
    color: #111;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
}

.share-receipt--thermal .share-receipt__divider {
    background: #000;
    height: 2px;
    margin: 12px 0;
}

.share-receipt--thermal .share-receipt__total {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 32px;
    font-weight: 800;
    text-align: center;
}

.share-receipt--thermal .share-receipt__total span {
    white-space: nowrap;
    letter-spacing: 0.04em;
}

.share-receipt--thermal .share-receipt__total strong {
    color: #000;
    font-size: 46px;
    font-weight: 900;
    white-space: nowrap;
    line-height: 1.1;
}

.share-receipt--thermal .amount-purchase,
.share-receipt--thermal .amount-sale {
    color: #000;
}

.access-gate {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: linear-gradient(165deg, var(--buon-teal-dark) 0%, var(--buon-teal) 55%, var(--buon-bg) 55%);
}

.access-gate__card {
    width: 100%;
    max-width: 22rem;
    background: var(--buon-card);
    border: 1px solid var(--buon-border);
    border-radius: 18px;
    padding: 1.35rem 1.15rem 1.1rem;
    box-shadow: 0 10px 28px rgba(13, 79, 88, 0.18);
}

.access-gate__header {
    text-align: center;
    margin-bottom: 1rem;
}

.access-gate__emoji {
    font-size: 2rem;
    margin: 0 0 0.35rem;
}

.access-gate__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--buon-text);
}

.access-gate__subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
    color: var(--buon-muted);
}

.access-gate__form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.access-gate__field {
    width: 100%;
}

.access-gate__error {
    margin: 0;
    color: #c0392b;
    font-size: 0.88rem;
}

.access-gate__submit {
    margin-top: 0.15rem;
    min-height: 46px;
    font-size: 1rem;
    font-weight: 700;
}

.access-gate__hint {
    margin: 0.95rem 0 0;
    text-align: center;
    font-size: 0.78rem;
    line-height: 1.45;
}


/* ── Debts ── */
.order-card__debt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
    background: #FFF4E5;
    color: #B25E00;
    font-size: 1.1rem;
}

.order-card__debt strong {
    font-size: 1.25rem;
    font-weight: 800;
}

.debt-amount {
    font-size: 1.35rem;
    font-weight: 800;
}

.stat-card--link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.backup-panel__last {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--buon-teal-dark);
}

.backup-panel__last--stale {
    color: #B25E00;
}

.order-search {
    margin-bottom: 0.75rem !important;
}

.stat-card__note {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    line-height: 1.3;
}

.report-btn {
    text-transform: none !important;
    font-weight: 600 !important;
    min-height: 44px;
}

/* ── Report ── */
.report-periods {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

.share-receipt--thermal .share-receipt__section {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin: 4px 0 8px;
    text-align: left;
}

.share-receipt--thermal .share-receipt__total--profit {
    margin-top: 12px;
}

.share-receipt--thermal .share-receipt__note {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 6px;
    color: #111;
}

.share-receipt--thermal .share-receipt__note--center {
    text-align: center;
}

/* Kiểm kho */
.stock-count__hint { margin: 0 0 12px; }
.stock-count__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.stock-count__name { display: flex; flex-direction: column; min-width: 0; }
.stock-count__field { max-width: 130px; }

/* Khóa 6 số */
.pin-pad { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.pin-pad__dots { display: flex; gap: 0.7rem; }
.pin-pad__dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--buon-teal); }
.pin-pad__dot--filled { background: var(--buon-teal); }
.pin-pad__keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; width: 100%; max-width: 15rem; }
.pin-pad__key { min-height: 52px; font-size: 1.35rem; font-weight: 600; border: 1px solid var(--buon-border); border-radius: 12px; background: var(--buon-card); color: var(--buon-text); touch-action: manipulation; }
.pin-pad__key:active { background: var(--buon-bg); }
.pin-pad__key--erase { font-size: 1.1rem; }
.pin-pad__error { text-align: center; margin-top: 0.75rem; }
.pin-pad__forgot { display: block; margin: 0.9rem auto 0; background: none; border: 0; color: var(--buon-teal-dark); text-decoration: underline; font-size: 0.9rem; }

/* Nhắc sao lưu */
.backup-reminder { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid #e0b34a; background: #fff6dc; color: #6b4a00; text-decoration: none; font-size: 0.88rem; }

/* Mã khôi phục */
.cloud-code { margin: 8px 0; padding: 12px; text-align: center; font-size: 1.25rem; font-weight: 700; letter-spacing: 0.08em; font-family: ui-monospace, Menlo, Consolas, monospace; border: 2px dashed var(--buon-teal); border-radius: 12px; background: var(--buon-card); user-select: all; }

/* Lịch lãi lỗ */
.pnl-cal { background: var(--buon-card); border: 1px solid var(--buon-border); border-radius: 16px; padding: 12px; margin-bottom: 16px; }
.pnl-cal__nav { display: flex; align-items: center; justify-content: space-between; }
.pnl-cal__month { font-weight: 700; color: var(--buon-text); }
.pnl-cal__arrow { width: 40px; height: 36px; font-size: 1.5rem; line-height: 1; border: 1px solid var(--buon-border); border-radius: 10px; background: var(--buon-bg); color: var(--buon-text); touch-action: manipulation; }
.pnl-cal__arrow:disabled { opacity: 0.35; }
.pnl-cal__total { display: flex; flex-direction: column; align-items: center; margin: 10px 0 12px; color: var(--buon-text); }
.pnl-cal__total strong { font-size: 1.5rem; }
.pnl-cal__total-label { font-size: 0.8rem; color: var(--buon-muted); }
.pnl-up, .pnl-cal__total.pnl-up strong { color: #1e9e5a; }
.pnl-down, .pnl-cal__total.pnl-down strong { color: #d9443b; }
.pnl-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pnl-cal__weekday { text-align: center; font-size: 0.72rem; color: var(--buon-muted); padding-bottom: 2px; }
.pnl-cal__cell { min-height: 52px; padding: 3px 2px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; border: 1px solid transparent; border-radius: 8px; background: var(--buon-bg); color: var(--buon-text); font: inherit; touch-action: manipulation; }
.pnl-cal__cell--blank { background: transparent; }
.pnl-cal__cell:disabled { opacity: 0.4; }
.pnl-cal__day { font-size: 0.72rem; color: var(--buon-muted); align-self: flex-start; padding-left: 3px; }
.pnl-cal__amount { font-size: 0.72rem; font-weight: 700; white-space: nowrap; padding-bottom: 3px; }
.pnl-cal__cell--up { background: rgba(30, 158, 90, 0.16); }
.pnl-cal__cell--up .pnl-cal__amount { color: #1e9e5a; }
.pnl-cal__cell--down { background: rgba(217, 68, 59, 0.16); }
.pnl-cal__cell--down .pnl-cal__amount { color: #d9443b; }
.pnl-cal__cell--today { border-color: var(--buon-teal); }
.pnl-cal__cell--selected { box-shadow: 0 0 0 2px var(--buon-teal-dark); }
.pnl-cal__detail { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--buon-bg); }
.pnl-cal__detail-title { font-weight: 700; margin-bottom: 4px; }
.pnl-cal__detail-row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92rem; padding: 2px 0; }
.pnl-cal__detail-row--total { border-top: 1px dashed var(--buon-border); margin-top: 4px; padding-top: 6px; }
.pnl-cal__hint { margin: 10px 0 0; font-size: 0.78rem; }

/* Thanh báo mất mạng */
#offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 2000; padding: 6px 12px; text-align: center; font-size: 0.8rem; background: #5a3d00; color: #fff3cf; }

/* Xóa dữ liệu */
.danger-btn { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid #d9443b; background: #fff; color: #d9443b; font-weight: 700; font: inherit; touch-action: manipulation; }
.danger-btn:disabled { opacity: 0.5; }
.privacy-link { text-align: center; margin-top: 12px; }

/* Chợ */
.market-tabs { margin: 12px 0 8px; }
.market-card { background: var(--buon-card); border: 1px solid var(--buon-border); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.market-card--hidden { opacity: 0.6; border-style: dashed; }
.market-card__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 0.82rem; }
.market-card__title { font-size: 1.15rem; font-weight: 700; color: var(--buon-text); }
.market-card__line { font-size: 0.95rem; margin-top: 2px; }
.market-card__note { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--buon-bg); font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.market-card__status { margin-top: 6px; font-size: 0.82rem; }
.market-card__actions { display: flex; gap: 8px; margin-top: 10px; }
.market-card__more { display: flex; justify-content: space-between; margin-top: 8px; }
.market-btn { flex: 1; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 12px; border: 1px solid var(--buon-border); background: var(--buon-bg); color: var(--buon-text); font: inherit; font-weight: 600; text-decoration: none; touch-action: manipulation; }
.market-btn--call { background: var(--buon-teal); border-color: var(--buon-teal); color: #fff; flex: 2; white-space: nowrap; }
.market-btn--zalo { background: #0068ff; border-color: #0068ff; color: #fff; }
.market-btn--danger { color: #d9443b; border-color: #d9443b; background: #fff; }
.market-link { background: none; border: 0; padding: 4px 0; color: var(--buon-muted); font: inherit; font-size: 0.82rem; text-decoration: underline; }
.market-disclaimer { margin: 16px 4px 24px; font-size: 0.78rem; text-align: center; }
.listing-dialog__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.listing-dialog__rules { font-size: 0.8rem; margin: 6px 0; }

/* Thanh dưới 5 mục: emoji trên, chữ dưới, chia đều, không tràn ở 360-375px */
.bottom-nav .mud-nav-link { flex: 1 1 0; min-width: 0; align-items: center !important; justify-content: center; }
.bottom-nav .mud-nav-link-text { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; width: 100%; white-space: nowrap; }
.bottom-nav .mud-nav-link-text span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 0.7rem; }

/* Đăng nhập chợ */
.market-account { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 2px 0; font-size: 0.85rem; }
.listing-dialog__verified { margin: 4px 0 10px; padding: 8px 10px; border-radius: 10px; background: var(--buon-bg); font-size: 0.9rem; }
.auth-resend { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.auth-resend .pin-pad__forgot { margin: 0; }

/* End-of-day summary and longest debtors on the home page */
.day-end { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 4px 14px 10px; margin-bottom: 12px; }
.day-end .section-title { margin: 10px 0 6px; }
.day-end__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f1f3f5; font-size: 0.95rem; }
.day-end__row strong { white-space: nowrap; font-size: 1.05rem; }
.day-end__row--total { border-bottom: 0; font-weight: 600; }
.day-end__note { margin: 4px 0 0; font-size: 0.8rem; }
.debtor-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; text-decoration: none; color: inherit; }
.debtor-row__name { display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.debtor-row__name small { font-weight: 400; color: #c2410c; }
.debtor-row strong { white-space: nowrap; }

/* Order dialog hints: price of the same size last time, and soft warnings */
.size-hint { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 10px 12px; border: 1px dashed #2e7d32; border-radius: 10px; background: #f1f8f2; color: #1b5e20; font: inherit; font-size: 0.9rem; cursor: pointer; }
.item-warning { margin: 6px 0; padding: 8px 12px; border-radius: 10px; background: #fff4e5; color: #8a4b00; font-size: 0.9rem; }

/* Debt due dates and running expenses */
.debt-due { font-size: 0.85rem; color: #6b7280; margin-top: 2px; }
.debt-due--now { color: #b91c1c; font-weight: 600; }
.expense-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.expense-card__sums { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 0.9rem; flex-wrap: wrap; }
.expense-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid #f1f3f5; }
.expense-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.expense-row__name { overflow-wrap: anywhere; }
.expense-row strong { white-space: nowrap; }

/* Big text mode (everything is rem based, so scaling the root is enough) */
html.big-text { font-size: 125%; }
html.big-text .bottom-nav .mud-nav-link-text span:last-child { font-size: 11.2px; }

/* First-run guide and sample data */
.intro { text-align: center; padding: 8px 4px 0; }
.intro__emoji { font-size: 3rem; line-height: 1.2; }
.intro__title { font-size: 1.3rem; margin: 6px 0 10px; }
.intro__text { font-size: 1.05rem; line-height: 1.5; margin: 0 0 14px; }
.intro__dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 6px; }
.intro__dot { width: 9px; height: 9px; border-radius: 50%; background: #d1d5db; }
.intro__dot--on { background: #2e7d32; }
.sample-banner { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; background: #fff8e1; border: 1px solid #f5d98b; color: #6b4e00; }
.sample-banner button { align-self: flex-start; padding: 8px 14px; border-radius: 8px; border: 1px solid #b7791f; background: #fff; color: #6b4e00; font: inherit; font-weight: 600; }
.help-panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 4px 14px 12px; margin-bottom: 12px; }
.help-panel__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.help-panel__row + .help-panel__row { border-top: 1px solid #f1f3f5; }

/* Credit limit line on the debts page */
.debt-limit { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 0.85rem; color: #6b7280; flex-wrap: wrap; }
.debt-limit--over { color: #b91c1c; font-weight: 600; }
.debt-limit button { border: 0; background: none; color: #1565c0; font: inherit; text-decoration: underline; padding: 4px 0; cursor: pointer; }

/* People page, price comparison, rankings */
.species-toggle--three .species-toggle__btn { padding-left: 6px; padding-right: 6px; font-size: 0.9rem; }
.person-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; font: inherit; color: inherit; cursor: pointer; }
.person-card__main { display: flex; flex-direction: column; min-width: 0; }
.person-card__name { font-weight: 600; overflow-wrap: anywhere; }
.person-card__nums { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.person-card__debt { color: #b91c1c; }
.compare-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; margin-top: 6px; border-radius: 10px; background: #f8fafc; }
.compare-row--best { background: #e8f5e9; }
.compare-row__main { display: flex; flex-direction: column; min-width: 0; }
.compare-row__name { font-weight: 600; overflow-wrap: anywhere; }
.compare-row strong { white-space: nowrap; }
.link-card { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; margin-bottom: 12px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; text-decoration: none; color: inherit; font-weight: 600; }
.link-card small { font-weight: 400; color: #6b7280; }
.rank-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 4px 14px; margin-bottom: 12px; }
.rank-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f3f5; }
.rank-row:last-child { border-bottom: 0; }
.rank-row strong { white-space: nowrap; }
.person-detail { font-size: 0.95rem; }
.detail-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f1f3f5; }
.detail-row--stack { flex-direction: column; align-items: flex-start; gap: 2px; }
.detail-title { font-size: 1rem; margin: 16px 0 4px; }
.link-btn { border: 0; background: none; color: #1565c0; font: inherit; text-decoration: underline; cursor: pointer; padding: 4px 0; }

/* Market matches banner on the home page */
.market-banner { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; background: #e3f2fd; border: 1px solid #90caf9; color: #0d47a1; text-decoration: none; }

/* Daily profit bars in the report image: green up for profit, red down for loss, baseline in the middle */
.rbars { display: flex; align-items: stretch; gap: 1px; height: 84px; margin: 6px 0 2px; }
.rbars__col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.rbars__half { flex: 1 1 0; display: flex; }
.rbars__half--up { align-items: flex-end; border-bottom: 1px solid #9ca3af; }
.rbars__half--down { align-items: flex-start; }
.rbars__bar { width: 100%; min-height: 2px; }
.rbars__bar--up { background: #2e7d32; }
.rbars__bar--down { background: #c62828; }
.rbars__axis { display: flex; justify-content: space-between; font-size: 0.7rem; color: #6b7280; }

/* Simple home page: two big buttons and a few plain numbers */
.simple-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.simple-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 104px; padding: 14px; border-radius: 16px; text-decoration: none; color: #fff; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.simple-btn--buy { background: #e65100; }
.simple-btn--sale { background: #2e7d32; }
.simple-btn__icon { font-size: 2rem; line-height: 1; }
.simple-btn__title { font-size: 1.6rem; font-weight: 700; }
.simple-btn small { font-size: 0.95rem; opacity: .95; }
.simple-card { display: block; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; color: inherit; text-decoration: none; }
.simple-card__label { color: #6b7280; font-size: 1rem; }
.simple-card__big { font-size: 2.2rem; font-weight: 700; line-height: 1.2; margin: 2px 0 8px; }
.simple-card__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; font-size: 1.05rem; }
.simple-card__row strong { white-space: nowrap; }
.simple-more { display: block; width: 100%; margin: 6px 0 18px; padding: 12px; border: 1px dashed #9ca3af; border-radius: 12px; background: none; color: #4b5563; font: inherit; cursor: pointer; }

/* ═══════════════ Design refresh: one look for every card, button and bar ═══════════════ */
:root {
    --buon-radius: 16px;
    --buon-shadow: 0 1px 2px rgba(13, 59, 64, 0.06), 0 6px 18px rgba(13, 79, 88, 0.08);
    --buon-shadow-lift: 0 2px 4px rgba(13, 59, 64, 0.08), 0 10px 24px rgba(13, 79, 88, 0.12);
    --buon-sale-strong: #1F7F55;
    --buon-purchase-strong: #C8443A;
    --buon-line-soft: rgba(207, 232, 232, 0.65);
}

body { font-variant-numeric: tabular-nums; }

/* Money reads best in the darker shades (enough contrast on white for tired eyes in bright sun) */
.amount-sale { color: var(--buon-sale-strong); }
.amount-purchase { color: var(--buon-purchase-strong); }
.stat-card__value--sale { color: var(--buon-sale-strong); }
.stat-card__value--purchase { color: var(--buon-purchase-strong); }

/* Cards */
.stat-card, .order-card, .tx-card, .inventory-card, .chart-card, .backup-panel,
.day-end, .expense-card, .help-panel, .rank-card, .simple-card, .person-card,
.debtor-row, .link-card {
    background: var(--buon-card);
    border: 1px solid var(--buon-border);
    border-radius: var(--buon-radius);
    box-shadow: var(--buon-shadow);
    color: var(--buon-text);
}
.day-end__row, .detail-row, .rank-row, .expense-row, .help-panel__row + .help-panel__row { border-color: var(--buon-line-soft); }
.debtor-row__name small, .person-card__debt, .debt-due--now, .debt-limit--over { color: var(--buon-purchase-strong); }
.debtor-row, .person-card, .link-card, .simple-card--link, .stat-card--link { text-decoration: none; }

/* Section titles get a small accent bar so the page reads as clear chapters */
.section-title { display: flex; align-items: center; gap: 0.55rem; margin: 1.1rem 0 0.7rem 0.1rem; }
.section-title::before { content: ""; flex: 0 0 4px; align-self: stretch; min-height: 1.1em; border-radius: 3px; background: linear-gradient(180deg, var(--buon-teal), var(--buon-sale)); }
.day-end .section-title, .help-panel .section-title, .backup-panel__title { margin-top: 0.8rem; }

/* Header: softer, with a light highlight */
.page-header, .page-header--compact {
    background:
        radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.16) 0, rgba(255, 255, 255, 0) 42%),
        linear-gradient(160deg, var(--buon-teal-dark) 0%, var(--buon-teal) 100%);
    border-radius: 0 0 26px 26px;
    box-shadow: 0 6px 18px rgba(13, 79, 88, 0.22);
}
.page-header { padding: 1.15rem 0.75rem 1.4rem; }
.page-header__title { font-size: 1.45rem; }

/* Floating bottom bar: the current page is a solid pill, easy to see at a glance */
.main-content { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 28px); }
.bottom-nav {
    left: 10px;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    padding-bottom: 0;
    border: 1px solid var(--buon-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 8px 26px rgba(13, 79, 88, 0.22) !important;
}
.bottom-nav .nav-divider { display: none; }
.bottom-nav .mud-nav-link { margin: 6px 3px; min-height: calc(var(--nav-height) - 12px); border-radius: 18px !important; }
.bottom-nav .mud-nav-link.mud-nav-link-active {
    background: linear-gradient(135deg, var(--buon-teal) 0%, var(--buon-teal-dark) 100%) !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(13, 79, 88, 0.35);
}
.bottom-nav .mud-nav-link.mud-nav-link-active .mud-nav-link-text,
.bottom-nav .mud-nav-link.mud-nav-link-active span { color: #fff !important; }

/* Buttons */
.mud-button-root { text-transform: none; letter-spacing: 0; font-weight: 600; border-radius: 12px; }
.mud-button-root.mud-button-filled { min-height: 44px; }
.btn-add-order {
    min-height: 56px;
    border-radius: 16px !important;
    background: linear-gradient(135deg, #34A873 0%, var(--buon-sale-strong) 100%) !important;
    box-shadow: 0 6px 16px rgba(31, 127, 85, 0.35) !important;
}
.report-btn { min-height: 48px; border-radius: 14px !important; }

/* Simple home page in the same palette */
.simple-btn { border-radius: 22px; min-height: 112px; box-shadow: var(--buon-shadow-lift); }
.simple-btn--buy { background: linear-gradient(135deg, #F07A6B 0%, #D9483D 100%); }
.simple-btn--sale { background: linear-gradient(135deg, #34A873 0%, #1F7F55 100%); }
.simple-card__label { color: var(--buon-muted); }
.simple-more { border: 1px dashed var(--buon-border); background: rgba(255, 255, 255, 0.6); color: var(--buon-muted); border-radius: var(--buon-radius); }
.compare-row { background: var(--buon-bg); }
.compare-row--best { background: #E3F5EC; }

/* Notices: same corners as cards */
.backup-reminder, .sample-banner, .market-banner, .item-warning { border-radius: 14px; }
.sample-banner button { border-color: #B7791F; border-radius: 10px; }
.link-btn, .debt-limit button { color: var(--buon-teal); }

/* Empty states are friendly, not blank */
.empty-state {
    background: rgba(255, 255, 255, 0.75);
    border: 1px dashed var(--buon-border);
    border-radius: var(--buon-radius);
    padding: 1.9rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
}

/* Dialogs and inputs */
.mud-dialog { border-radius: 24px !important; box-shadow: 0 20px 50px rgba(13, 59, 64, 0.35) !important; }
.mud-dialog .mud-dialog-actions { padding: 12px 16px 16px; gap: 8px; border-top: 1px solid var(--buon-line-soft); }
.mud-dialog .mud-dialog-actions .mud-button-root { min-height: 46px; }
.mud-input-outlined .mud-input-outlined-border { border-radius: 12px; }

/* Chips */
.shrimp-type-chip { transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s; }
.shrimp-type-chip--selected { box-shadow: 0 2px 8px rgba(15, 122, 140, 0.3); }

/* Touch feedback and keyboard focus */
a.simple-btn, a.simple-card, a.debtor-row, a.link-card, a.stat-card, a.market-banner, a.backup-reminder,
button.person-card, button.simple-more, .shrimp-type-chip, .bottom-nav .mud-nav-link, .mud-button-root {
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
a.simple-btn:active, a.simple-card:active, a.debtor-row:active, a.link-card:active, a.stat-card:active,
button.person-card:active, button.simple-more:active, .shrimp-type-chip:active { transform: scale(0.97); }
:focus-visible { outline: 3px solid rgba(15, 122, 140, 0.45); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* MudBlazor 9 marks the current nav item with ".active" (older versions used ".mud-nav-link-active") */
.bottom-nav .mud-nav-link.active {
    background: linear-gradient(135deg, var(--buon-teal) 0%, var(--buon-teal-dark) 100%) !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(13, 79, 88, 0.35);
}
.bottom-nav .mud-nav-link.active .mud-nav-link-text,
.bottom-nav .mud-nav-link.active span { color: #fff !important; }

/* Buttons keep their natural casing (Vietnamese in capitals is hard to read) */
.mud-button-root, .mud-button-root .mud-button-label { text-transform: none !important; }

/* A debt amount never breaks into two lines */
.debt-amount, .order-card__total span, .tx-card__amount { white-space: nowrap; }
.debt-amount { font-size: 1.3rem; }

/* The header used to be 16px wider than the screen (negative side margins inside a padding-less container), which made pages scroll sideways */
.page-header, .page-header--compact { margin-left: 0; margin-right: 0; }

/* Content gets a comfortable 12px margin; only the coloured header runs edge to edge */
.main-content .mud-container.px-0 { padding-left: 12px !important; padding-right: 12px !important; }
.page-header, .page-header--compact { margin-left: -12px; margin-right: -12px; }

/* Room under the labels so Vietnamese marks below the line (ợ, ạ) are not clipped */
.bottom-nav .mud-nav-link { padding-bottom: 0.4rem !important; }
.bottom-nav .mud-nav-link-text span:last-child { line-height: 1.35; padding-bottom: 2px; }
