html, body {
    font-family: 'Roboto', sans-serif;
}

/* Ensure MudSelect/MudAutocomplete popovers and date pickers always appear above MudDialog */
.mud-popover {
    z-index: 9999 !important;
}

/* Allow dropdowns and pickers to escape the dialog content clipping context */
.mud-dialog-content {
    overflow: visible !important;
}

.mud-dialog {
    overflow: visible !important;
}

.cursor-pointer {
    cursor: pointer;
}

.mud-nav-link.active {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.12);
    border-left: 4px solid var(--mud-palette-primary);
}

.mud-drawer-content {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 64px);
}

.mud-main-content {
    overflow-y: auto;
    height: calc(100vh - 64px);
    padding-bottom: 24px;
}

.mud-nav-menu {
    overflow-y: auto;
    overflow-x: hidden;
}

.action-icons-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 160px;
    align-items: center;
}

.action-icons-wrap .mud-icon-button {
    flex-shrink: 0;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    max-height: 30px;
    padding-top: 4px;
    padding-bottom: 4px;
}

input[type="number"] {
    text-align: right;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    background-color: var(--mud-palette-primary, #1976d2);
    color: var(--mud-palette-primary-text, #fff);
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.88;
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
    opacity: 0.88;
}

.btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: inherit;
    transition: background-color 0.2s ease;
}

.btn-icon:hover:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.08);
}

.btn-icon:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── MudBlazor outlined input label — white patch fix ───────────────────────
   The floating label on Variant.Outlined MudTextField/MudSelect needs a
   background colour to cover the fieldset border behind it. Without an
   explicit value the browser falls back to white, which shows as a bright
   patch on any non-white surface (dialogs, cards, coloured panels, etc.).
   Using --mud-palette-surface (= #fff in the default light theme) keeps the
   label invisible on white backgrounds and lets per-page overrides work via
   a single CSS variable.                                                     */
.mud-input-label-outlined {
    background-color: var(--mud-palette-surface, #fff);
    padding: 0 4px;
}

/* The <legend> element inside the outlined <fieldset> creates the notch gap
   in the border. It must stay transparent — it is never directly visible.   */
.mud-input-outlined-border legend {
    background: transparent !important;
}

/* Keyboard shortcut hint badge — shown inside action buttons to surface
   discoverable hotkeys (e.g. Alt+S, Alt+N, Alt+L).                          */
kbd.kb-hint {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.60rem;
    line-height: 1;
    padding: 2px 5px;
    border: none;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    opacity: 1;
    vertical-align: middle;
    margin-left: 6px;
    letter-spacing: 0.05em;
    font-weight: 700;
    white-space: nowrap;
}

/* =====================================================
   Suppress Blazor's built-in reconnect overlay entirely.
   We use our own #tb-reconnect-banner instead.
   ===================================================== */
#components-reconnect-modal {
    display: none !important;
}

/* =====================================================
   Truebooks custom reconnect banner - non-intrusive
   slim bar at the top, fully under our control.
   ===================================================== */
#tb-reconnect-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #1565c0;
    color: #fff;
    font-size: 13px;
    text-align: center;
    padding: 6px 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#tb-reconnect-banner.tb-reconnect-show {
    display: flex;
}
#tb-reconnect-banner.tb-reconnect-failed {
    display: flex;
    background: #b71c1c;
}

@keyframes tb-spin {
    to { transform: rotate(360deg); }
}
.tb-reconnect-spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tb-spin 0.8s linear infinite;
    flex-shrink: 0;
}
#tb-reconnect-banner.tb-reconnect-failed .tb-reconnect-spinner {
    display: none;
}

/* =====================================================
   Truebooks Standard Design System (Task #1024)
   Tokens — keep in sync with TbTheme.cs
   ===================================================== */
:root {
    --tb-color-create:        #007BFF;
    --tb-color-save:          #28A745;
    --tb-color-update:        #90EE90;
    --tb-color-cancel:        #000000;
    --tb-color-void:          #FFC0CB;
    --tb-color-delete:        #DC3545;
    --tb-color-on-action:     #FFFFFF;

    --tb-border:              #E2E8F0;
    --tb-border-input:        #CBD5E1;
    --tb-shadow-sm:           0 1px 2px rgba(15,23,42,0.06);
    --tb-shadow-md:           0 2px 8px rgba(15,23,42,0.08);
    --tb-hover:               #F1F5F9;

    --tb-btn-h:               36px;
    --tb-btn-px:              18px;
    --tb-btn-radius:          6px;
    --tb-btn-font:            14px;
    --tb-btn-icon-gap:        8px;

    --tb-grid-btn-h:          30px;
    --tb-grid-btn-font:       13px;
}

/* StandardActionButton */
.tb-std-btn .mud-button-root,
.tb-std-btn {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 500;
}
.tb-std-btn .mud-button-icon-start { margin-right: var(--tb-btn-icon-gap); }
.tb-std-btn:hover { filter: brightness(0.94); }
.tb-std-btn:disabled, .tb-std-btn.mud-disabled { opacity: 0.55; }

/* GridActionButton */
.tb-grid-btn { color: inherit; }

/* StandardPageHeader */
.tb-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0 16px 0;
    border-bottom: 1px solid var(--tb-border);
    margin-bottom: 16px;
}
.tb-page-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.tb-page-title {
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
    margin: 0;
}
.tb-page-subtitle {
    color: #64748b;
    margin: 0;
}
.tb-page-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.tb-page-search {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--tb-border-input);
    border-radius: var(--tb-btn-radius);
    padding: 0 10px;
    height: var(--tb-btn-h);
    min-width: 220px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.tb-page-search:focus-within {
    border-color: var(--tb-color-create);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.15);
}
.tb-page-search-icon { color: #94a3b8; margin-right: 6px; }
.tb-page-search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: var(--tb-btn-font);
    flex: 1;
    min-width: 100px;
    height: 100%;
    color: #1f2937;
}
.tb-page-search-input::placeholder { color: #94a3b8; }
.tb-page-filter-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Journal Vouchers single-row filter bar ─────────────────────────────── */
.jv-filter-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}

/* Search box: fixed height so it bottom-aligns with the MudBlazor inputs */
.jv-filter-search {
    min-width: 200px;
    height: 40px;          /* matches MudBlazor Dense+Outlined input height   */
    align-self: flex-end;
    margin-bottom: 1px;    /* visual nudge to sit flush with input underlines  */
}

/* Status autocomplete: constrain width */
.jv-filter-select {
    min-width: 140px;
    max-width: 180px;
}

/* Date pickers: consistent width */
.jv-filter-date {
    min-width: 148px;
    max-width: 168px;
}

/* Apply + Clear buttons sit side-by-side, bottom-aligned */
.jv-filter-actions {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-self: flex-end;
    margin-bottom: 1px;
}

/* Include Voided checkbox — nudge down to align with button midpoints */
.jv-filter-checkbox-wrap {
    align-self: flex-end;
    margin-bottom: 2px;
}
.jv-filter-checkbox-wrap .mud-checkbox {
    margin: 0;
    padding: 0;
}
.jv-filter-checkbox-wrap .mud-form-control {
    margin: 0;
}
.tb-page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* IconFilter */
.tb-icon-filter {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--tb-btn-h);
    width: var(--tb-btn-h);
    border: 1px solid var(--tb-border-input);
    border-radius: var(--tb-btn-radius);
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.tb-icon-filter:hover { background: var(--tb-hover); border-color: #94a3b8; }
.tb-icon-filter-icon { color: #475569; }
.tb-icon-filter-content {
    position: absolute;
    inset: 0;
    opacity: 0;
}
.tb-icon-filter-content > * {
    width: 100%;
    height: 100%;
    cursor: pointer;
}
.tb-icon-filter-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tb-color-create);
}
