html, body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fb;
    color: #14213d;
}

/* ---------- App shell ---------- */
:root {
    --brand: #1d6ff2;
    --card-border: #e6e9f0;
    --muted: #6b7280;
    --tab-height: 64px;
}

.app-shell { min-height: 100vh; }

.app-main {
    padding: 1rem 1rem calc(var(--tab-height) + 1.5rem + env(safe-area-inset-bottom));
    max-width: 1200px;
}

.app-user {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.link-btn {
    background: none;
    border: none;
    color: var(--brand);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
}

.icon { flex-shrink: 0; vertical-align: middle; }

/* Phone: bottom tab bar */
.side-nav { display: none; }

.tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    height: calc(var(--tab-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fff;
    border-top: 1px solid var(--card-border);
}

.tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.7rem;
    color: var(--muted);
    text-decoration: none;
}

.tab-link.active { color: var(--brand); font-weight: 600; }

/* Desktop: sidebar */
@media (min-width: 900px) {
    .app-shell { display: flex; }

    .tab-bar { display: none; }

    .side-nav {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        width: 230px;
        flex-shrink: 0;
        height: 100vh;
        position: sticky;
        top: 0;
        padding: 1.25rem 0.75rem;
        background: #fff;
        border-right: 1px solid var(--card-border);
    }

    .brand {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--brand);
        padding: 0 0.75rem 1rem;
    }

    .side-link {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.65rem 0.75rem;
        border-radius: 0.6rem;
        color: #374151;
        text-decoration: none;
    }

    .side-link:hover { background: #f1f4fa; }
    .side-link.active { background: #e8f0fe; color: var(--brand); font-weight: 600; }

    .app-main { flex: 1; padding: 1.5rem 2rem 2rem; }
}

/* ---------- Page pieces ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
}

.page-header h1, .detail-header h1 {
    font-size: 1.9rem;
    font-weight: 700;
    margin: 0;
}

.subtle { color: var(--muted); }

.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--brand);
    color: #fff;
    border-radius: 0.65rem;
    padding: 0.55rem 1rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.btn-new:hover { color: #fff; filter: brightness(0.95); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

/* Colored circles: avatars and icons */
.icon-circle, .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.icon-circle { width: 56px; height: 56px; }
.icon-circle.sm { width: 40px; height: 40px; }
.avatar { width: 52px; height: 52px; font-weight: 600; font-size: 1.1rem; }
.avatar.lg { width: 68px; height: 68px; font-size: 1.5rem; }

.blue { background: #e8f0fe; color: #1d6ff2; }
.green { background: #e6f6ec; color: #16a34a; }
.orange { background: #fff1e6; color: #ea7a0c; }
.purple { background: #f1ebfd; color: #7c3aed; }
.teal { background: #e3f6f4; color: #0f8f80; }

/* Dashboard stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.2rem;
    padding: 1rem 0.4rem;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
    color: inherit;
    text-decoration: none;
}

.stat-label { font-weight: 600; font-size: 0.85rem; margin-top: 0.4rem; }
.stat-value { font-size: 1.6rem; font-weight: 700; background: none; line-height: 1.2; }
.small { font-size: 0.75rem; }

.dash-columns { display: grid; gap: 1.5rem; }

@media (min-width: 900px) {
    .stat-grid { gap: 1rem; }
    .stat-card { padding: 1.5rem 1rem; }
    .stat-value { font-size: 2rem; }
    .dash-columns { grid-template-columns: 1fr 1fr; }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.section-header a { text-decoration: none; font-size: 0.9rem; }

/* Grouped list (dashboard, details) */
.list-card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    overflow: hidden;
}

.list-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1rem;
    color: inherit;
    text-decoration: none;
}

.list-row + .list-row { border-top: 1px solid var(--card-border); }
a.list-row:hover { background: #f8fafc; }

.list-text, .item-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.list-title, .item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-title.wrap { white-space: pre-wrap; font-weight: 400; }

.list-sub {
    color: var(--muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-meta { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.list-empty { padding: 1rem; color: var(--muted); }

/* Search */
.search-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    color: var(--muted);
}

.search-box input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    background: transparent;
}

/* Customer cards */
.card-grid { display: grid; gap: 0.75rem; }

@media (min-width: 900px) {
    .card-grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}

.item-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
    color: inherit;
    text-decoration: none;
}

.item-card:hover { border-color: #c9d6f5; }

.item-title { font-size: 1.05rem; margin-bottom: 0.2rem; }

.item-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.empty-state { text-align: center; padding: 2rem 0; color: var(--muted); }

/* Customer detail */
.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.button-grid.actions { margin-bottom: 1rem; }

@media (min-width: 900px) {
    .button-grid.actions { grid-template-columns: repeat(4, 1fr); max-width: 640px; }
    .button-grid:not(.actions) { max-width: 420px; }
}

.action-btn, .btn-primary-lg, .btn-secondary-lg, .btn-danger-lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 46px;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

.action-btn { background: #fff; border-color: var(--card-border); color: var(--brand); }
.btn-primary-lg { background: var(--brand); color: #fff; }
.btn-secondary-lg { background: #fff; border-color: var(--card-border); color: #374151; }
.btn-danger-lg { background: #fff; border-color: #f5c2c2; color: #dc2626; }
.btn-primary-lg:disabled { opacity: 0.6; }

/* Forms */
.form-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1rem;
    max-width: 720px;
}

.field { display: flex; flex-direction: column; gap: 0.3rem; margin: 0; }
.field > span { font-size: 0.85rem; font-weight: 600; color: #374151; }
.field .form-control { font-size: 1rem; min-height: 44px; border-radius: 0.6rem; }
.field-row { display: grid; gap: 0.85rem; }

@media (min-width: 600px) {
    .field-row { grid-template-columns: 1fr 1fr; }
    .field-row.three { grid-template-columns: 2fr 1fr 1fr; }
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.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+PC9kZ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ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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: #1b6ec2;
            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");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* Admin and users pages */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.list-cards { display: flex; flex-direction: column; gap: .5rem; }
.list-cards .list-card { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: inherit; }

