/* Loading splash shown while Blazor WASM downloads/initializes */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem 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: #1565c0;
    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");
}

/* Unhandled-error banner */
#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;
}

/* Login page background */
.login-bg {
    background: linear-gradient(135deg, #1565c0 0%, #1e88e5 100%);
}

/* Status chips (app-wide) — darken MudBlazor's text-variant Success/Warning/Error chips to the
   contrast-tuned inks from DESIGN.md. The default palette text colors (~#4caf50 success etc.) fail
   WCAG AA on white for these small status labels; this fixes every list's status column at once. */
.mud-chip.mud-chip-text.mud-chip-color-success { color: #2e7d32 !important; }
.mud-chip.mud-chip-text.mud-chip-color-warning { color: #8c5a00 !important; }
.mud-chip.mud-chip-text.mud-chip-color-error   { color: #b71c1c !important; }

/* Task deadline past project deadline — paint the input background red so it's loud. */
.task-deadline-past .mud-input-control .mud-input,
.task-deadline-past .mud-input-control input {
    background-color: rgba(244, 67, 54, 0.18);
}
.task-deadline-past .mud-input-outlined .mud-input-slot {
    background-color: rgba(244, 67, 54, 0.18);
}

/* Markdown rendering inside comments */
.markdown-body { font-size: 0.9rem; line-height: 1.4; }
.markdown-body p { margin: 0 0 0.4rem 0; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body ul, .markdown-body ol { margin: 0.2rem 0 0.4rem 1.25rem; padding: 0; }

/* Markdown inside message bubbles: tighten margins and keep links legible on colored bubbles. */
.msg-bubble .markdown-body > :first-child { margin-top: 0; }
.msg-bubble .markdown-body > :last-child { margin-bottom: 0; }
.msg-bubble .markdown-body a { color: inherit; text-decoration: underline; }

/* ── Messages: split-pane on desktop, single-pane on phones ─────────────── */
/* Height lives here (not inline) so the phone media query can override it; dvh tracks the real
   visible height on mobile browsers where vh includes the collapsed URL bar. */
.msg-shell { height: 70vh; height: 70dvh; }

@media (max-width: 599.98px) {
    /* One pane at a time: conversation list, or (thread-open) the open thread. */
    .msg-list { width: 100% !important; min-width: 0 !important; border-right: none !important; }
    .msg-list.thread-open { display: none !important; }
    .msg-thread:not(.thread-open) { display: none !important; }

    /* Use the height the phone actually has instead of a fraction of it. */
    .msg-shell { height: calc(100dvh - 205px); min-height: 320px; }

    .msg-bubble { max-width: 88% !important; }
}

/* ── Phone-sized screens (below MudBlazor's sm breakpoint) ──────────────── */
@media (max-width: 599.98px) {
    /* The page container's default pa-4 wastes 32px of a ~375px screen. */
    .mud-main-content > .mud-container { padding: 12px 10px !important; }

    /* DBA selector in the app bar: icon only — hide the company-name label and dropdown arrow.
       (The text is a bare text node, so shrink it away; the icons set their own font-size.) */
    .dba-selector .mud-button-label { font-size: 0; }
    .dba-selector .mud-button-label .mud-icon-button-end,
    .dba-selector svg + span { display: none; }
}
.summary-field {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
}
.summary-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mud-palette-text-secondary);
}
.summary-value {
    font-size: 0.9rem;
}

/* Kanban drop zones — give a subtle dashed outline when an item is hovered over them. */
.kanban-zone { transition: background-color 0.15s ease; }
.kanban-zone.mud-drop-zone-can-drop { background-color: rgba(33, 150, 243, 0.08); border-style: dashed; }
.kanban-zone.mud-drop-zone-no-drop  { opacity: 0.6; }
.kanban-card { user-select: none; }

/* ── In-app user manual (Help) ───────────────────────────────────────────── */
.help-markdown {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--mud-palette-text-primary);
    word-wrap: break-word;
}
.help-markdown > :first-child { margin-top: 0; }
.help-markdown > :last-child { margin-bottom: 0; }

/* The italic one-line purpose statement most pages open with. */
.help-markdown > p:first-child em {
    font-size: 1.05rem;
    color: var(--mud-palette-text-secondary);
    font-style: italic;
}

.help-markdown h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 1.8rem 0 0.75rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.help-markdown h3 { font-size: 1.15rem; font-weight: 600; margin: 1.4rem 0 0.5rem; }
.help-markdown h4 { font-size: 1.0rem;  font-weight: 600; margin: 1.1rem 0 0.4rem; }
.help-markdown p { margin: 0 0 0.85rem; }
.help-markdown ul, .help-markdown ol { margin: 0 0 0.95rem 1.5rem; padding: 0; }
.help-markdown li { margin: 0.2rem 0; }
.help-markdown li > ul, .help-markdown li > ol { margin-bottom: 0.2rem; }
.help-markdown a { color: var(--mud-palette-primary); text-decoration: none; }
.help-markdown a:hover { text-decoration: underline; }
.help-markdown strong { font-weight: 600; }
.help-markdown hr { border: none; border-top: 1px solid var(--mud-palette-lines-default); margin: 1.5rem 0; }
.help-markdown img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--mud-palette-lines-default); }

/* Tables (field references) render as real GFM tables. */
.help-markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0 1.1rem;
    font-size: 0.9rem;
}
.help-markdown th, .help-markdown td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: 0.45rem 0.7rem;
    text-align: left;
    vertical-align: top;
}
.help-markdown thead th {
    background-color: var(--mud-palette-background-grey);
    font-weight: 600;
}
.help-markdown tbody tr:nth-child(even) { background-color: rgba(0, 0, 0, 0.02); }

/* Blockquote callouts — used for Notes, Tips, Warnings and Screenshot placeholders. */
.help-markdown blockquote {
    margin: 0.75rem 0;
    padding: 0.6rem 0.9rem;
    border-left: 4px solid var(--mud-palette-primary);
    background-color: rgba(21, 101, 192, 0.06);
    border-radius: 0 6px 6px 0;
}
.help-markdown blockquote p { margin: 0; }
.help-markdown blockquote + blockquote { margin-top: 0.4rem; }

.help-markdown code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85em;
    background-color: var(--mud-palette-background-grey);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}
.help-markdown pre {
    background-color: var(--mud-palette-background-grey);
    padding: 0.8rem 1rem;
    border-radius: 6px;
    overflow-x: auto;
}
.help-markdown pre code { background: none; padding: 0; }

/* Sidebar table of contents sits a touch tighter than the main nav. */
.help-toc .mud-nav-link { font-size: 0.85rem; }

/* Compact main navigation (left menu) — tighter rows and slightly smaller text than the
   MudBlazor default (≈48px rows), so more fits without scrolling. Covers links and group headers. */
.nav-compact .mud-nav-link {
    min-height: 30px;
    padding-top: 2px;
    padding-bottom: 2px;
    font-size: 0.82rem;
}
.nav-compact .mud-nav-link .mud-nav-link-icon {
    margin-right: 10px;
}
/* Compact tooling-quote editor — shrink the dense inputs and tighten rows/cells so the long form
   fits without scrolling. Scoped to .tq-compact so it doesn't affect other pages. The input element
   itself carries .mud-input-slot, so target that (and .mud-input input) directly for the padding. */
.tq-compact .mud-input-control.mud-input-control-margin-dense {
    margin-top: 1px;
    margin-bottom: 1px;
}
.tq-compact .mud-input input,
.tq-compact .mud-input-slot {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    min-height: 0 !important;
    font-size: 0.82rem;
}
/* Multi-line fields (Description, Notes): more top room so the floating label doesn't clip line 1. */
.tq-compact textarea.mud-input-slot {
    padding-top: 14px !important;
}
.tq-compact .mud-select-input,
.tq-compact .mud-input-label {
    font-size: 0.82rem;
}
/* Vertically center the resting floating label in every dense input. MudBlazor pins the resting
   label at a fixed translateY(12px) calibrated for the default dense height, but our shrunk inputs —
   and the taller numeric/spinner boxes — differ, so the label sat off-center. Center it by the box's
   own height instead; the shrink/focus state is re-asserted so a filled/focused label still snaps to
   the top border. */
.tq-compact .mud-input-control-input-container > .mud-input-label-outlined.mud-input-label-margin-dense {
    top: 50%;
    transform: translate(14px, -50%) scale(1);
}
.tq-compact .mud-shrink ~ label.mud-input-label-outlined.mud-input-label-margin-dense,
.tq-compact .mud-input:focus-within ~ label.mud-input-label-outlined.mud-input-label-margin-dense {
    top: 0;
    transform: translate(14px, -6px) scale(0.75);
}
.tq-compact td,
.tq-compact th {
    padding: 1px 6px;
}
