:root {
    --workr-ink: #0F3D4A;
    --workr-accent: #F28C28;
    --workr-surface: #F6F4EF;
    --workr-bottom-nav-height: 64px;
}

@media (prefers-color-scheme: dark) {
    :root { --workr-surface: #10181B; }
}

html, body {
    margin: 0;
    background: var(--workr-surface);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* Boot screen while the WebAssembly runtime loads. */
.boot {
    position: fixed;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 24px;
    justify-items: center;
}

.boot-mark {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--workr-ink);
    color: var(--workr-accent);
    display: grid;
    place-items: center;
    font: 800 40px/1 system-ui, sans-serif;
}

.boot-bar {
    width: 140px;
    height: 4px;
    border-radius: 2px;
    background: rgba(15, 61, 74, 0.15);
    overflow: hidden;
}

.boot-bar span {
    display: block;
    height: 100%;
    width: var(--blazor-load-percentage, 0%);
    background: var(--workr-accent);
    transition: width 0.2s ease;
}

/* Bottom navigation: thumb-reachable, large targets, clear of the iPhone home indicator. */
.workr-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--workr-bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
}

.workr-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    color: var(--mud-palette-text-secondary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.workr-bottom-nav a.active {
    color: var(--mud-palette-primary);
}

.workr-bottom-nav a.active .mud-icon-root {
    background: var(--mud-palette-primary-hover);
    border-radius: 16px;
    padding: 2px 16px;
    box-sizing: content-box;
}

.workr-page {
    padding: 16px 16px calc(var(--workr-bottom-nav-height) + env(safe-area-inset-bottom) + 24px);
    max-width: 760px;
    margin: 0 auto;
}

.workr-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

.workr-recovery-codes {
    font-family: ui-monospace, monospace;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

.workr-qr {
    width: 220px;
    height: 220px;
    image-rendering: pixelated;
    background: #fff;
    padding: 8px;
    border-radius: 8px;
}

.workr-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.workr-thumbs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #FFF4E5;
    color: #5A3A00;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .dismiss { float: right; cursor: pointer; }
#blazor-error-ui .reload { margin-left: 8px; }
.lang-en { display: none; }
html[lang="en"] .lang-hu { display: none; }
html[lang="en"] .lang-en { display: inline; }

/* Running timer, pinned above the bottom navigation. */
.workr-timer-bar {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(var(--workr-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
    z-index: 1150;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 12px;
    border-radius: 14px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.workr-timer-bar .mud-icon-button { background: rgba(255, 255, 255, 0.85); }
.workr-timer-bar .mud-icon-root { color: inherit; }
.workr-timer-title { flex: 1; min-width: 0; color: inherit; text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workr-timer-clock { font-size: 14px; }

.workr-welcome { max-width: 440px; padding-top: 48px; }

/* Floating action button above the bottom navigation (and the timer bar). */
.workr-fab {
    position: fixed !important;
    right: 16px;
    bottom: calc(var(--workr-bottom-nav-height) + env(safe-area-inset-bottom) + 72px);
    z-index: 1100;
}

.workr-card-link { cursor: pointer; }
.workr-card-link:focus-visible { outline: 2px solid var(--mud-palette-secondary); outline-offset: 2px; }
.workr-card-link:active { transform: scale(0.995); }

.workr-section-title {
    margin: 24px 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.workr-time-col {
    min-width: 56px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.workr-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}

.workr-month .dow { font-size: 11px; color: var(--mud-palette-text-secondary); padding: 4px 0; }

.workr-month button {
    border: 0;
    background: transparent;
    color: var(--mud-palette-text-primary);
    border-radius: 10px;
    height: 44px;
    font: inherit;
    cursor: pointer;
    position: relative;
}

.workr-month button.other { color: var(--mud-palette-text-disabled); }
.workr-month button.today { font-weight: 800; color: var(--workr-accent-text); }
.workr-month button.selected { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.workr-month button .dots { position: absolute; left: 0; right: 0; bottom: 5px; display: flex; justify-content: center; gap: 2px; }
.workr-month button .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--mud-palette-secondary); }

.workr-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 6px;
}

.workr-photo-grid button {
    padding: 0;
    border: 0;
    background: none;
    position: relative;
    cursor: pointer;
}

.workr-photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.workr-photo-grid .kind { position: absolute; left: 6px; bottom: 6px; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; }

.workr-viewer img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px; }

/* Receipt photos on a cost line */
.workr-receipt-thumb { padding: 0; border: 0; background: none; cursor: pointer; width: 56px; height: 56px; }
.workr-receipt-thumb img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }

/* Map */
.workr-map { height: calc(100vh - 48px - var(--workr-bottom-nav-height) - env(safe-area-inset-bottom)); width: 100%; }
.workr-map-small { height: 240px; width: 100%; border-radius: 12px; overflow: hidden; }
.workr-pin span {
    display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
    border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.leaflet-container { font: inherit; }

.workr-update-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 16px;
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font-size: 14px;
}

/* Document lines (quote, report) */
.workr-lines { border-top: 1px solid var(--mud-palette-lines-default); }
.workr-line { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--mud-palette-lines-default); }
.workr-line .what { flex: 1; min-width: 0; }
.workr-line .what .mud-text-secondary { font-size: 13px; }
.workr-line .amount { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Documents (quotes, reports): printable as they are, via the browser's "Save as PDF". */
@media print {
    .mud-appbar, .workr-bottom-nav, .workr-timer-bar, .workr-fab, .workr-update-banner, .no-print { display: none !important; }
    .mud-main-content { padding-top: 0 !important; }
    body, .mud-paper { background: #fff !important; color: #000 !important; }
    .workr-document { padding: 0 !important; max-width: none; }
    .workr-document .mud-paper { border: 0 !important; }
}

.workr-signature { position: relative; border: 1px dashed var(--mud-palette-lines-inputs); border-radius: 12px; background: #fff; }
.workr-signature canvas { display: block; width: 100%; height: 180px; touch-action: none; }
.workr-signature .clear { position: absolute; top: 4px; right: 4px; }
.workr-signature .hint { position: absolute; left: 12px; bottom: 8px; font-size: 12px; color: #888; pointer-events: none; }
.workr-signature-image { max-width: 100%; height: 90px; background: #fff; border-radius: 8px; }

/* Sync indicator while a sync runs */
.workr-spin .mud-icon-root { animation: workr-spin 1.2s linear infinite; }
@keyframes workr-spin { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) { .workr-spin .mud-icon-root { animation: none; } }

/* Workspace switcher (personal / team) in the app bar */
.workr-switcher { text-transform: none !important; max-width: 52vw; }
.workr-switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workr-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.workr-color { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.workr-color.selected { border-color: var(--mud-palette-text-primary); }
.workr-crew { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; font-size: 12px; color: var(--mud-palette-text-secondary); }
.workr-crew-member { display: inline-flex; align-items: center; gap: 4px; }

/* Privacy notice and terms: plain reading text. */
.workr-legal h3 {
    margin: 20px 0 6px;
    font-size: 16px;
    font-weight: 700;
}

.workr-legal p,
.workr-legal li {
    font-size: 14px;
    line-height: 1.55;
}

.workr-legal ul {
    padding-left: 1.2rem;
    margin: 4px 0 8px;
}

.workr-legal p {
    margin: 0 0 8px;
}

/* Accessibility (WCAG AA): the brand orange is 2.5:1 on white, too light for text. On light surfaces, orange text and
   icons use a darker shade (4.9:1 on the page background); the app bar keeps the bright one (4.8:1 on its blue). */
:root { --workr-accent-text: #A85400; }
@media (prefers-color-scheme: dark) {
    :root { --workr-accent-text: #F5A04D; }
}
@media (prefers-color-scheme: light) {
    .mud-secondary-text:not(.mud-appbar *) { color: var(--workr-accent-text) !important; }
}
