/* ============================================================
   WorxOrder — design system
   Calm SaaS look. Inter font, soft shadows, generous whitespace.
   Scoped under .mwm-preview to keep MudBlazor styles separate.
   ============================================================ */

/* Inter, self-hosted. Previously loaded from Google Fonts, which meant that on a locked-down
   or offline network — the normal state of affairs for a housing association — the app
   silently rendered in a fallback face and the cv02/cv03/cv04/cv11 tuning below did nothing.

   One variable file per subset covers weights 400–800, so this is two requests, not five.
   Latin and Latin Extended only; the app is English-language. font-display: swap keeps text
   visible while the face loads. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                   U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                   U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                   U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                   U+2212, U+2215, U+FEFF, U+FFFD;
}

.mwm-preview, .mwm-preview * { box-sizing: border-box; }

.mwm-preview {
    --bg:           #F8FAFC;
    --card:         #FFFFFF;
    --text:         #0F172A;
    --text-2:       #475569;
    --text-3:       #94A3B8;
    --border:       #E2E8F0;
    --border-soft:  #F1F5F9;
    --hover:        #F8FAFC;

    --accent:       #1F4E79;
    --accent-soft:  #EFF6FF;
    --accent-text:  #FFFFFF;

    --radius-xl: 20px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm:  8px;

    --shadow-sm:  0 1px 2px rgba(15,23,42,.04);
    --shadow-md:  0 4px 12px rgba(15,23,42,.06);
    --shadow-lg:  0 24px 48px -16px rgba(15,23,42,.18), 0 4px 8px rgba(15,23,42,.04);

    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ============= Login ============= */

.mwm-auth-page {
    min-height: 100vh;
    width: 100%;
    background:
        radial-gradient(ellipse at top right, rgba(30, 58, 95, 0.55) 0%, transparent 55%),
        radial-gradient(ellipse at bottom left, rgba(15, 23, 42, 0.85) 0%, transparent 60%),
        linear-gradient(135deg, #0B1220 0%, #0F1E36 100%);
    position: relative;
}

.mwm-auth-center {
    display: flex; align-items: center; justify-content: center;
    padding: 48px 24px;
    min-height: 100vh;
}

.mwm-card {
    width: 100%; max-width: 480px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 60px -20px rgba(0,0,0,.45), 0 8px 16px rgba(0,0,0,.18);
    padding: 44px 48px 36px;
}

.mwm-tenant-block {
    display: flex; flex-direction: column; align-items: center;
    margin-bottom: 28px;
}
.mwm-tenant-logo {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--accent);
    color: var(--accent-text);
    display: grid; place-items: center;
    font-weight: 800; font-size: 22px; letter-spacing: -0.02em;
    box-shadow: 0 8px 16px -8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.mwm-tenant-name {
    margin-top: 14px;
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-3);
}

.mwm-h1 {
    font-size: 26px; font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    margin: 0 0 6px;
}
.mwm-sub {
    font-size: 14px; color: var(--text-2);
    text-align: center;
    margin: 0 0 28px;
}

/* ============= Forms (login + general) ============= */

.mwm-field { margin-bottom: 14px; }
.mwm-label {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 13px; font-weight: 500; color: var(--text-2);
    margin-bottom: 6px;
}
.mwm-label a {
    font-size: 12px; font-weight: 500;
    color: var(--accent); text-decoration: none;
}
.mwm-label a:hover { text-decoration: underline; }

.mwm-input,
.mwm-select,
.mwm-textarea {
    width: 100%;
    padding: 11px 14px;
    font-family: inherit; font-size: 14px;
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.mwm-input::placeholder { color: var(--text-3); }
.mwm-input:focus,
.mwm-select:focus,
.mwm-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}
.mwm-textarea { resize: vertical; min-height: 80px; font-family: inherit; }

.mwm-select {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.mwm-input-sm,
.mwm-select-sm {
    padding: 7px 12px;
    font-size: 13px;
    border-radius: 8px;
}
.mwm-select-sm { padding-right: 32px; background-position: right 10px center; }

/* ============= Buttons ============= */

.mwm-btn {
    padding: 10px 16px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform .05s, background .15s, box-shadow .15s, border-color .15s;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    line-height: 1;
}
.mwm-btn:active { transform: translateY(1px); }
.mwm-btn:disabled { opacity: .55; cursor: not-allowed; }
.mwm-btn-block { width: 100%; }
.mwm-btn-sm { padding: 7px 12px; font-size: 13px; }

.mwm-btn-primary {
    background: var(--accent); color: var(--accent-text);
    box-shadow: 0 1px 2px rgba(15,23,42,.08), inset 0 1px 0 rgba(255,255,255,.15);
}
.mwm-btn-primary:hover {
    background: color-mix(in srgb, var(--accent) 88%, black);
}

.mwm-btn-ghost {
    background: white; color: var(--text);
    border-color: var(--border);
}
.mwm-btn-ghost:hover { background: var(--hover); }

.mwm-btn-text {
    background: transparent; color: var(--accent); border: none;
    padding: 6px 8px; font-weight: 500;
}
.mwm-btn-text:hover { background: var(--accent-soft); }

/* ============= Auth-only helpers ============= */

.mwm-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 22px 0;
    font-size: 12px; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.08em;
}
.mwm-divider::before, .mwm-divider::after {
    content: ""; flex: 1; height: 1px; background: var(--border-soft);
}

.mwm-footnote {
    margin-top: 28px;
    text-align: center;
    font-size: 12px; color: var(--text-3);
}
.mwm-footnote b { color: var(--text-2); font-weight: 600; }

.mwm-helper {
    margin-top: 24px; padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--text-2); font-size: 12px; line-height: 1.5;
}
.mwm-helper b { color: var(--text); }
.mwm-helper code {
    background: white; padding: 1px 6px;
    border: 1px solid var(--border); border-radius: 6px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 11px; color: var(--accent);
}

/* ============= App shell ============= */

.mwm-app-page {
    min-height: 100vh;
    background: var(--bg);
    display: grid;
    grid-template-columns: 240px 1fr;
}

.mwm-sidebar {
    background:
        radial-gradient(ellipse at top right, rgba(30, 58, 95, 0.55) 0%, transparent 55%),
        radial-gradient(ellipse at bottom left, rgba(15, 23, 42, 0.85) 0%, transparent 60%),
        linear-gradient(180deg, #0B1220 0%, #0F1E36 100%);
    color: #CBD5E1;
    padding: 18px 12px 12px;
    display: flex; flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.mwm-sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px 24px;
    text-decoration: none;
    color: inherit;
}
.mwm-brand-mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--accent);
    color: white;
    display: grid; place-items: center;
    font-weight: 800; font-size: 15px; letter-spacing: -0.02em;
    flex-shrink: 0;
    box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}
.mwm-sidebar-brand-name {
    font-weight: 700; font-size: 14px; color: #F8FAFC;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.mwm-sidebar-brand-tenant {
    font-size: 11.5px; color: #64748B;
    margin-top: 2px;
    line-height: 1.2;
}

.mwm-nav-section { margin-bottom: 16px; }
.mwm-nav-label {
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #475569;
    padding: 6px 12px 4px;
}

.mwm-nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #94A3B8;
    font-size: 13.5px; font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.mwm-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #F8FAFC;
}
.mwm-nav-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
    font-weight: 600;
}
.mwm-nav-item.active svg { color: #FFFFFF; }
.mwm-nav-item.disabled {
    color: #475569; cursor: not-allowed;
}
.mwm-nav-item.disabled:hover { background: transparent; color: #475569; }
.mwm-nav-item svg {
    width: 18px; height: 18px;
    color: #64748B;
    flex-shrink: 0;
}
.mwm-nav-item:hover svg { color: #CBD5E1; }
.mwm-nav-item.disabled svg { color: #334155; }

.mwm-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 10px;
}
.mwm-user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 8px;
    border-radius: 8px;
    cursor: pointer;
}
.mwm-user-card:hover { background: rgba(255, 255, 255, 0.05); }
.mwm-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent);
    color: white;
    display: grid; place-items: center;
    font-weight: 600; font-size: 13px;
    flex-shrink: 0;
}
.mwm-user-name {
    font-size: 13px; font-weight: 600; color: #F8FAFC;
    line-height: 1.2;
}
.mwm-user-role {
    font-size: 11px; color: #64748B;
    line-height: 1.3;
}
.mwm-user-card svg { color: #475569; }
.mwm-user-card:hover svg { color: #CBD5E1; }

.mwm-content { overflow-x: hidden; }

.mwm-topbar-app {
    height: 56px;
    background: white;
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky; top: 0; z-index: 10;
}
.mwm-search {
    position: relative;
    flex: 1;
    max-width: 360px;
}
.mwm-search input {
    width: 100%;
    padding: 7px 12px 7px 34px;
    background: var(--border-soft);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    outline: none;
    font-family: inherit;
}
.mwm-search input::placeholder { color: var(--text-3); }
.mwm-search input:focus {
    background: white;
    border-color: var(--border);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.mwm-search svg {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--text-3);
}

.mwm-topbar-actions {
    display: flex; align-items: center; gap: 4px;
    margin-left: auto;
}
.mwm-icon-btn {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 8px;
    color: var(--text-2);
    background: transparent;
    border: none;
    cursor: pointer;
}
.mwm-icon-btn:hover { background: var(--border-soft); color: var(--text); }
.mwm-icon-btn svg { width: 18px; height: 18px; }

.mwm-page {
    padding: 28px 32px;
    width: 100%;
}

.mwm-page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.mwm-page-title {
    font-size: 26px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0;
}
.mwm-page-subtitle {
    font-size: 14px; color: var(--text-2);
    margin-top: 4px;
}

.mwm-grid { display: grid; gap: 16px; }
.mwm-grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1024px) { .mwm-grid-2 { grid-template-columns: 1fr; } }

/* ============= Stat cards ============= */

.mwm-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.mwm-stat-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    transition: transform .12s, box-shadow .12s;
    cursor: default;
}
.mwm-stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.mwm-stat-label {
    font-size: 11.5px; font-weight: 600;
    color: #475569;   /* slate-600 — AA on the white card */
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 8px;
}
.mwm-stat-value {
    font-size: 28px; font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.1;
}
.mwm-stat-trend {
    margin-top: 6px;
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 500;
}
.mwm-stat-trend.up { color: #16A34A; }
.mwm-stat-trend.down { color: #DC2626; }
.mwm-stat-trend.flat { color: var(--text-3); }

/* ============= Section card ============= */

.mwm-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.mwm-section + .mwm-section { margin-top: 16px; }
.mwm-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    gap: 8px;
}
.mwm-section-header.no-border { border-bottom: none; padding-bottom: 0; }
.mwm-section-title {
    font-size: 15px; font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    margin: 0;
}
.mwm-section-body { padding: 20px; }
.mwm-section-body.flush { padding: 0; }

/* ============= Pills ============= */

.mwm-pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    font-size: 11.5px; font-weight: 600;
    border-radius: 999px;
    background: #F1F5F9; color: var(--text-2);
    line-height: 1.4;
    white-space: nowrap;
}
.mwm-pill-blue   { background: #DBEAFE; color: #1E40AF; }
.mwm-pill-cyan   { background: #CFFAFE; color: #155E75; }
.mwm-pill-amber  { background: #FEF3C7; color: #92400E; }
.mwm-pill-green  { background: #DCFCE7; color: #166534; }
.mwm-pill-red    { background: #FEE2E2; color: #991B1B; }
.mwm-pill-purple { background: #EDE9FE; color: #5B21B6; }
.mwm-pill-slate  { background: #F1F5F9; color: #334155; }
.mwm-pill-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
}

/* ============= Table ============= */

.mwm-table-wrap {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.mwm-filter-bar {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.mwm-filter-bar .mwm-search {
    max-width: 280px;
    flex: 1 1 220px;
}

.mwm-table {
    width: 100%; border-collapse: collapse;
    font-size: 13.5px;
}
.mwm-table th {
    text-align: left;
    font-weight: 600; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: #475569;   /* slate-600 — AA on the #FAFBFD header */
    padding: 11px 16px;
    background: #FAFBFD;
    border-bottom: 1px solid var(--border-soft);
}
.mwm-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
    vertical-align: middle;
}
.mwm-table tbody tr:last-child td { border-bottom: none; }
.mwm-table tbody tr:hover td { background: #FAFBFD; }
.mwm-table tr.clickable { cursor: pointer; }
.mwm-table .text-right { text-align: right; }
.mwm-table .text-muted { color: var(--text-2); }
.mwm-table .nowrap { white-space: nowrap; }
.mwm-table .truncate {
    max-width: 280px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mwm-table-pager {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px; color: var(--text-2);
}
.mwm-table-pager .mwm-page-controls { display: flex; align-items: center; gap: 4px; }
.mwm-table-empty {
    padding: 48px 16px; text-align: center;
    color: var(--text-3); font-size: 14px;
}

/* ============= Charts ============= */

.mwm-bar-chart {
    display: flex; align-items: stretch; gap: 14px;
    height: 240px;
}
.mwm-bar-col {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center;
}
.mwm-bar-value { font-size: 11px; font-weight: 600; color: var(--text-2); height: 18px; }
.mwm-bar-track {
    flex: 1 1 auto;
    width: 100%;
    display: flex; align-items: flex-end; justify-content: center;
    min-height: 0;
}
.mwm-bar {
    width: 100%; max-width: 40px;
    background: linear-gradient(180deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 55%, white) 100%);
    border-radius: 6px 6px 2px 2px;
    min-height: 3px;
    transition: height .25s ease;
}
.mwm-bar-col:hover .mwm-bar { filter: brightness(1.08); }
.mwm-bar-label { font-size: 11px; color: var(--text-3); height: 20px; display: flex; align-items: center; }

/* ============= Trade breakdown progress rows ============= */

.mwm-progress-row { margin-bottom: 14px; }
.mwm-progress-row:last-child { margin-bottom: 0; }
.mwm-progress-row-head {
    display: flex; justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px; color: var(--text-2);
}
.mwm-progress-row-head b { color: var(--text); font-weight: 600; }
.mwm-progress-track {
    height: 6px; background: var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}
.mwm-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width .25s ease-out;
}

/* ============= Detail page ============= */

.mwm-back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-2);
    text-decoration: none;
    margin-bottom: 12px;
    background: transparent; border: none; cursor: pointer;
    padding: 4px 0;
    font-family: inherit;
}
.mwm-back-link:hover { color: var(--text); }
.mwm-back-link svg { width: 14px; height: 14px; }

.mwm-detail-header {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px 24px 20px;
    margin-bottom: 16px;
}
.mwm-detail-h-row {
    display: flex; align-items: flex-start; gap: 16px;
    margin-bottom: 16px;
}
.mwm-detail-title {
    font-size: 22px; font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin: 0;
}
.mwm-detail-meta {
    color: var(--text-3); font-size: 13px;
    margin-top: 4px;
}
.mwm-detail-status-stack {
    display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
    flex-shrink: 0;
}

.mwm-detail-fields {
    display: grid; gap: 14px 24px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}
.mwm-field-label {
    font-size: 11px; font-weight: 500;
    color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.mwm-field-value {
    font-size: 14px; font-weight: 500; color: var(--text);
    line-height: 1.4;
}
.mwm-field-value.muted { color: var(--text-3); font-weight: 400; }

.mwm-description {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}
.mwm-description .mwm-field-label { margin-bottom: 6px; }
.mwm-description p {
    margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.55;
}

/* ============= Tabs ============= */

.mwm-tabs {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.mwm-tab-headers {
    display: flex;
    border-bottom: 1px solid var(--border-soft);
    padding: 0 8px;
    overflow-x: auto;
}
.mwm-tab-header {
    padding: 14px 16px;
    font-size: 13px; font-weight: 500;
    color: var(--text-2);
    border: none; background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    font-family: inherit;
    transition: color .12s, border-color .12s;
    display: inline-flex; align-items: center; gap: 8px;
    white-space: nowrap;
}
.mwm-tab-header:hover { color: var(--text); }
.mwm-tab-header.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.mwm-tab-header .mwm-pill { font-size: 10.5px; padding: 1px 7px; }
.mwm-tab-body {
    padding: 22px 24px;
}

.mwm-empty {
    color: var(--text-3); font-size: 13.5px;
    text-align: center; padding: 24px 0;
}

/* ============= Appointment cards ============= */

.mwm-appt-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 14px;
}
.mwm-appt-card svg { width: 20px; height: 20px; color: var(--text-3); flex-shrink: 0; }
.mwm-appt-when { font-weight: 600; color: var(--text); font-size: 14px; }
.mwm-appt-meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.mwm-appt-outcome { font-size: 13px; color: var(--text-2); margin-top: 4px; font-style: italic; }

/* ============= Notes timeline ============= */

.mwm-timeline { position: relative; padding-left: 24px; }
.mwm-timeline::before {
    content: ""; position: absolute;
    left: 7px; top: 6px; bottom: 6px;
    width: 2px; background: var(--border-soft);
}
.mwm-timeline-item { margin-bottom: 16px; position: relative; }
.mwm-timeline-item:last-child { margin-bottom: 0; }
.mwm-timeline-item::before {
    content: ""; position: absolute;
    left: -22px; top: 4px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--accent);
}
.mwm-timeline-meta { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.mwm-timeline-meta b { color: var(--text); font-weight: 600; }
.mwm-timeline-text { font-size: 13.5px; color: var(--text); line-height: 1.5; }

/* ============= Document list ============= */

.mwm-doc-list { list-style: none; padding: 0; margin: 0; }
.mwm-doc-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-soft);
}
.mwm-doc-row:last-child { border-bottom: none; }
.mwm-doc-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--border-soft);
    display: grid; place-items: center;
    color: var(--text-2);
    flex-shrink: 0;
}
.mwm-doc-icon svg { width: 18px; height: 18px; }
.mwm-doc-name { font-size: 14px; font-weight: 600; color: var(--text); }
.mwm-doc-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ============= Forms (multi-section) ============= */

.mwm-form-section { padding: 22px 24px; }
.mwm-form-grid {
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.mwm-form-grid-full { grid-column: 1 / -1; }
.mwm-form-grid-2 { grid-column: span 2; }
@media (max-width: 700px) { .mwm-form-grid-2 { grid-column: 1 / -1; } }

.mwm-checkbox-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13.5px; color: var(--text);
    cursor: pointer;
    padding: 6px 0;
}
.mwm-checkbox-row input { accent-color: var(--accent); width: 16px; height: 16px; }
.mwm-radio-group { display: flex; flex-direction: column; gap: 8px; }
.mwm-radio-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--text);
    cursor: pointer;
}
.mwm-radio-row input { accent-color: var(--accent); width: 16px; height: 16px; }

.mwm-form-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 8px;
}

/* Collapsible client group header on the properties list. The whole header is the control, so the
   hit target is the row rather than a 14px chevron. */
.mwm-group-toggle {
    all: unset;
    display: flex; align-items: center; gap: 8px;
    width: 100%; cursor: pointer;
    font: inherit; color: inherit;
}
.mwm-group-toggle:focus-visible { outline: 2px solid var(--accent, #1F4E79); outline-offset: 2px; border-radius: 4px; }
.mwm-group-chevron { display: inline-flex; transition: transform .15s; }
.mwm-group-chevron.collapsed { transform: rotate(-90deg); }

/* A quiet footnote under a form — "you might have wanted the other screen".
   Deliberately smaller and lighter than a field hint: it is an aside, not an instruction, and it
   sits below the buttons where a full-weight line of text competes with them. Right-aligned to
   the actions it follows rather than starting a new column of text on the left. */
.mwm-form-aside {
    margin: 10px 0 0;
    text-align: right;
    font-size: 12px;
    color: var(--text-3, #94A3B8);
}
.mwm-form-aside .mwm-link { font-size: 12px; }

.mwm-appliance-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    background: #FCFDFE;
}
.mwm-appliance-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.mwm-appliance-head h4 { margin: 0; font-size: 14px; font-weight: 600; }

/* ============= Misc ============= */

.mwm-text-muted { color: var(--text-3); }
.mwm-row { display: flex; align-items: center; gap: 8px; }
.mwm-row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mwm-spacer { flex: 1; }

a.mwm-link { color: var(--accent); text-decoration: none; font-weight: 500; }
a.mwm-link:hover { text-decoration: underline; }

/* ============= Engineer cards ============= */

.mwm-engineer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}
.mwm-engineer-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    transition: transform .12s, box-shadow .12s;
}
.mwm-engineer-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.mwm-engineer-head {
    display: flex; align-items: flex-start; gap: 14px;
    margin-bottom: 14px;
}
.mwm-engineer-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    display: grid; place-items: center;
    color: white;
    font-weight: 700; font-size: 17px; letter-spacing: -0.02em;
    flex-shrink: 0;
}
.mwm-engineer-name {
    font-size: 15px; font-weight: 600; color: var(--text);
    line-height: 1.2;
}
.mwm-engineer-trade {
    font-size: 12px; color: var(--text-3);
    margin-top: 3px;
}
.mwm-engineer-meta {
    border-top: 1px solid var(--border-soft);
    padding-top: 12px;
    margin-top: 4px;
    display: grid; gap: 8px;
}
.mwm-engineer-meta-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-2);
}
.mwm-engineer-meta-row svg { color: var(--text-3); flex-shrink: 0; }
.mwm-engineer-meta-row .label {
    font-size: 11px; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.04em;
    width: 60px; flex-shrink: 0;
}
.mwm-engineer-stats {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
}
.mwm-engineer-stat {
    background: var(--border-soft);
    border-radius: 8px;
    padding: 8px 12px;
    text-align: center;
}
.mwm-engineer-stat-value {
    font-size: 18px; font-weight: 700; color: var(--text);
    line-height: 1;
}
.mwm-engineer-stat-label {
    font-size: 11px; color: var(--text-3); margin-top: 4px;
}
.mwm-engineer-next {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--accent-soft);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--text-2);
}
.mwm-engineer-next-label {
    font-size: 10.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 2px;
}

/* ============= Schedule grid ============= */

.mwm-schedule-toolbar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.mwm-week-nav {
    display: flex; align-items: center; gap: 4px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2px;
    box-shadow: var(--shadow-sm);
}
.mwm-week-nav button {
    background: transparent; border: none;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--text-2);
    cursor: pointer;
    font-family: inherit;
    display: grid; place-items: center;
}
.mwm-week-nav button:hover { background: var(--border-soft); color: var(--text); }
.mwm-week-label {
    font-size: 13.5px; font-weight: 600;
    color: var(--text);
    padding: 0 14px;
    min-width: 220px;
    text-align: center;
}
.mwm-week-today {
    padding: 7px 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px; font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.mwm-week-today:hover { background: var(--border-soft); color: var(--text); }

.mwm-schedule {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.mwm-schedule-grid {
    display: grid;
    grid-template-columns: 200px repeat(7, minmax(150px, 1fr));
    border-bottom: 1px solid var(--border-soft);
}
.mwm-schedule-grid.no-bottom { border-bottom: none; }
.mwm-schedule-cell {
    padding: 10px 12px;
    border-right: 1px solid var(--border-soft);
    min-height: 44px;
}
.mwm-schedule-cell:last-child { border-right: none; }
.mwm-schedule-cell.head {
    background: #FAFBFD;
    font-size: 12px; font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase; letter-spacing: 0.04em;
    text-align: center;
    padding: 12px 8px;
}
.mwm-schedule-cell.head .day-num {
    display: block; font-size: 18px; font-weight: 700;
    color: var(--text); letter-spacing: -0.02em;
    text-transform: none;
    margin-top: 2px;
}
.mwm-schedule-cell.head.today {
    background: var(--accent-soft);
    color: var(--accent);
}
.mwm-schedule-cell.head.today .day-num { color: var(--accent); }
.mwm-schedule-cell.engineer {
    background: #FAFBFD;
    font-weight: 600; color: var(--text); font-size: 13.5px;
    border-right: 1px solid var(--border);
}
.mwm-schedule-cell.engineer .meta {
    display: block; font-size: 11.5px; color: var(--text-3);
    font-weight: 400; margin-top: 2px;
}
.mwm-schedule-cell.day {
    padding: 6px;
    display: flex; flex-direction: column; gap: 4px;
    background: white;
    max-height: 260px;
    overflow-y: auto;
}
.mwm-schedule-cell.day.today { background: #F8FAFC; }

.mwm-appt {
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11.5px;
    color: var(--text);
    background: #F1F5F9;
    border-left: 3px solid #94A3B8;
    cursor: pointer;
    transition: transform .08s, box-shadow .12s;
    line-height: 1.3;
}
.mwm-appt:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    background: white;
}
.mwm-appt-time { font-weight: 700; color: var(--text); }
.mwm-appt-title {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.mwm-appt-addr {
    margin-top: 3px;
    font-size: 10.5px;
    color: var(--text-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mwm-appt.st-blue   { background: #DBEAFE; border-left-color: #2563EB; }
.mwm-appt.st-blue .mwm-appt-time  { color: #1E40AF; }
.mwm-appt.st-blue .mwm-appt-title { color: #1E3A8A; }
.mwm-appt.st-blue .mwm-appt-addr  { color: #2563EB; }

.mwm-appt.st-amber  { background: #FEF3C7; border-left-color: #D97706; }
.mwm-appt.st-amber .mwm-appt-time  { color: #92400E; }
.mwm-appt.st-amber .mwm-appt-title { color: #78350F; }
.mwm-appt.st-amber .mwm-appt-addr  { color: #B45309; }

.mwm-appt.st-green  { background: #DCFCE7; border-left-color: #16A34A; }
.mwm-appt.st-green .mwm-appt-time  { color: #166534; }
.mwm-appt.st-green .mwm-appt-title { color: #14532D; }
.mwm-appt.st-green .mwm-appt-addr  { color: #16A34A; }

.mwm-appt.st-red    { background: #FEE2E2; border-left-color: #DC2626; }
.mwm-appt.st-red .mwm-appt-time  { color: #991B1B; }
.mwm-appt.st-red .mwm-appt-title { color: #7F1D1D; }
.mwm-appt.st-red .mwm-appt-addr  { color: #DC2626; }

.mwm-trade-legend {
    display: flex; align-items: center; gap: 14px;
    flex-wrap: wrap;
    font-size: 12px; color: var(--text-2);
}
.mwm-trade-legend .swatch {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ============= AI assist card ============= */

.mwm-ai-btn {
    background: linear-gradient(135deg, #6D28D9 0%, #4338CA 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 0 0 1px rgba(124, 58, 237, .15);
}
.mwm-ai-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5B21B6 0%, #3730A3 100%);
}

.mwm-ai-card {
    border: 1px solid #E0E7FF;
    background: linear-gradient(140deg, #F5F3FF 0%, #EFF6FF 100%);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    margin-bottom: 18px;
    box-shadow: 0 2px 6px rgba(99, 102, 241, .08);
}
.mwm-ai-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: #5B21B6;
    margin-bottom: 8px;
}
.mwm-ai-head svg { color: #7C3AED; }
.mwm-ai-headline {
    font-size: 14px;
    color: var(--text);
    line-height: 1.55;
    margin-bottom: 10px;
}
.mwm-ai-bullets {
    margin: 0; padding-left: 20px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.55;
}
.mwm-ai-bullets li { margin-bottom: 5px; }
.mwm-ai-bullets li::marker { color: #7C3AED; }
.mwm-ai-next {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(124, 58, 237, 0.18);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
    display: flex; flex-direction: column; gap: 2px;
}
.mwm-ai-next-label {
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #5B21B6;
}
.mwm-ai-foot {
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--text-3);
}

/* ============= Modal ============= */

.mwm-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 50;
    animation: mwm-fade-in .12s ease-out;
}
.mwm-modal {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 100%; max-width: 460px;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 60px -16px rgba(15,23,42,.35);
    z-index: 51;
    overflow: hidden;
    animation: mwm-scale-in .14s ease-out;
}
.mwm-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
}
@keyframes mwm-fade-in  { from { opacity: 0;   } to { opacity: 1;   } }
@keyframes mwm-scale-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.95); }
                          to   { opacity: 1; transform: translate(-50%, -50%) scale(1);   } }

/* ============= Documents — category rail ============= */

.mwm-cat-row {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%;
    background: transparent; border: none;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-2);
    font-family: inherit; font-size: 13.5px;
    cursor: pointer;
    text-align: left;
    margin-bottom: 2px;
}
.mwm-cat-row:hover { background: var(--border-soft); color: var(--text); }
.mwm-cat-row.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.mwm-cat-row .count {
    font-size: 11.5px;
    color: var(--text-3);
    font-weight: 500;
}
.mwm-cat-row.active .count { color: var(--accent); }

/* ============= Reports ============= */

.mwm-range-tabs {
    display: inline-flex;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    box-shadow: var(--shadow-sm);
}
.mwm-range-tab {
    background: transparent; border: none;
    font-family: inherit; font-size: 12.5px; font-weight: 500;
    color: var(--text-2);
    padding: 6px 14px;
    border-radius: 7px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.mwm-range-tab:hover { color: var(--text); }
.mwm-range-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.mwm-donut-wrap {
    display: flex; align-items: center; gap: 24px;
    flex-wrap: wrap;
}
.mwm-donut-svg {
    width: 200px; height: 200px;
    flex-shrink: 0;
}
.mwm-donut-num {
    text-anchor: middle;
    font-size: 28px; font-weight: 700;
    fill: var(--text); letter-spacing: -0.02em;
}
.mwm-donut-lbl {
    text-anchor: middle;
    font-size: 10px; font-weight: 600;
    fill: var(--text-3);
    letter-spacing: 0.1em;
}
.mwm-donut-legend {
    flex: 1; min-width: 160px;
    display: grid; gap: 8px;
}
.mwm-donut-legend-row {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px;
}
.mwm-donut-legend-row .swatch {
    width: 10px; height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.mwm-donut-legend-row .lbl { flex: 1; color: var(--text-2); }
.mwm-donut-legend-row .val { font-weight: 600; color: var(--text); }

.mwm-trade-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.mwm-compliance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}
.mwm-compliance-tile {
    text-align: center;
    padding: 8px;
}
.mwm-compliance-ring {
    width: 110px; height: 110px;
}
.mwm-compliance-pct {
    font-size: 22px; font-weight: 700;
    fill: var(--text); letter-spacing: -0.02em;
}
.mwm-compliance-label {
    margin-top: 8px;
    font-size: 12.5px; font-weight: 500;
    color: var(--text-2);
}

/* ============= Invoice detail ============= */

.mwm-invoice-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
@media (max-width: 700px) { .mwm-invoice-top { grid-template-columns: 1fr; } }
.mwm-invoice-block { margin-top: 4px; }

.mwm-invoice-totals {
    margin-top: 18px;
    margin-left: auto;
    width: 320px;
    max-width: 100%;
    border-top: 1px solid var(--border-soft);
    padding-top: 12px;
}
.mwm-invoice-totals-row {
    display: flex; justify-content: space-between;
    font-size: 13.5px;
    padding: 4px 0;
    color: var(--text-2);
}
.mwm-invoice-totals-row.total {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.mwm-invoice-footer {
    margin-top: 24px;
    padding: 14px 16px;
    background: var(--accent-soft);
    border-radius: var(--radius-md);
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.5;
}

/* ============= MudBlazor blend ============= */
/* Make MudBlazor controls use Inter so they fit alongside our custom design */
.mwm-preview .mud-input-control,
.mwm-preview .mud-input-control-input-container,
.mwm-preview .mud-input,
.mwm-preview .mud-input-label,
.mwm-preview .mud-select,
.mwm-preview .mud-button-root,
.mwm-preview .mud-typography,
.mwm-preview .mud-checkbox,
.mwm-preview .mud-radio,
.mwm-preview .mud-list-item-text {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* ============ Focus visibility ============
   This file defines the shell — nav, buttons, cards, forms, tables — and had no focus styles at
   all, so a keyboard user could tab through the whole app without ever seeing where they were.

   :focus-visible rather than :focus, so the ring appears for keyboard navigation but not on
   mouse clicks. The offset keeps it clear of the element's own border. */
.mwm-preview :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Rows are focusable via mwm-a11y.js. An outline on a table row is clipped by the cells, so
   tint the row and mark it with an inset bar instead. */
.mwm-preview tr.clickable:focus-visible {
    outline: none;
    background: var(--accent-soft);
    box-shadow: inset 3px 0 0 0 var(--accent);
}

/* Keep the ring visible against the dark sign-in background and the sidebar. */
.mwm-auth-page :is(a, button, input):focus-visible,
.mwm-sidebar :is(a, button):focus-visible {
    outline-color: #FFFFFF;
}

@media (prefers-reduced-motion: reduce) {
    .mwm-preview *, .mwm-preview *::before, .mwm-preview *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
