/* MedArhiva design system — shared by the MAUI Android app and the WASM PWA.
   Loaded after Bootstrap; skins Bootstrap components and adds app-specific ones. */

:root {
    --ma-primary: #0d9488;
    --ma-primary-dark: #0f766e;
    --ma-primary-deep: #115e59;
    --ma-primary-tint: #ccfbf1;
    --ma-primary-soft: #e6f7f4;
    --ma-bg: #f4f7f6;
    --ma-surface: #ffffff;
    --ma-text: #1a2b2a;
    --ma-text-muted: #5c6f6d;
    --ma-border: #e2eae8;
    --ma-danger: #dc3545;
    --ma-warning-bg: #fff7e0;
    --ma-warning-border: #f2d47e;
    --ma-radius-lg: 16px;
    --ma-radius: 12px;
    --ma-shadow: 0 1px 3px rgba(16, 42, 40, 0.08), 0 1px 2px rgba(16, 42, 40, 0.05);
    --ma-shadow-lg: 0 4px 16px rgba(16, 42, 40, 0.12);
    --ma-tab-height: 4rem;
}

html, body {
    background-color: var(--ma-bg);
    color: var(--ma-text);
    font-family: system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .h4, .h5 {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ma-text);
}

a {
    color: var(--ma-primary-dark);
}

.text-muted {
    color: var(--ma-text-muted) !important;
}

/* ---------- Page header ---------- */

.page-head {
    margin: 0.25rem 0 1.25rem;
}

    .page-head h1 {
        font-size: 1.45rem;
        margin-bottom: 0.15rem;
    }

    .page-head .lead-text {
        color: var(--ma-text-muted);
        font-size: 0.95rem;
        margin: 0;
    }

/* ---------- Buttons ---------- */

.btn {
    border-radius: 999px;
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

    .btn:active {
        transform: scale(0.98);
    }

.btn-sm {
    padding: 0.3rem 0.85rem;
}

.btn-primary, .btn-success {
    background-color: var(--ma-primary);
    border-color: var(--ma-primary);
    color: #fff;
    box-shadow: var(--ma-shadow);
}

    .btn-primary:hover, .btn-primary:focus, .btn-primary:active,
    .btn-success:hover, .btn-success:focus, .btn-success:active {
        background-color: var(--ma-primary-dark) !important;
        border-color: var(--ma-primary-dark) !important;
        color: #fff;
    }

    .btn-primary:disabled, .btn-success:disabled {
        background-color: var(--ma-primary);
        border-color: var(--ma-primary);
        opacity: 0.55;
    }

.btn-outline-primary, .btn-outline-secondary {
    color: var(--ma-primary-dark);
    border-color: var(--ma-border);
    background-color: var(--ma-surface);
}

    .btn-outline-primary:hover, .btn-outline-primary:active,
    .btn-outline-secondary:hover, .btn-outline-secondary:active {
        background-color: var(--ma-primary-soft) !important;
        border-color: var(--ma-primary) !important;
        color: var(--ma-primary-deep) !important;
    }

.btn-outline-danger {
    border-color: var(--ma-border);
}

.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}

/* ---------- Forms ---------- */

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ma-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.form-control, .form-select {
    border-radius: var(--ma-radius);
    border-color: var(--ma-border);
    background-color: var(--ma-surface);
    padding: 0.55rem 0.85rem;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--ma-primary);
    }

.form-control-sm, .form-select-sm {
    border-radius: 8px;
    padding: 0.3rem 0.5rem;
}

/* ---------- Cards & surfaces ---------- */

.card {
    border: none;
    border-radius: var(--ma-radius-lg);
    box-shadow: var(--ma-shadow);
    background-color: var(--ma-surface);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--ma-border);
    border-radius: var(--ma-radius-lg) var(--ma-radius-lg) 0 0 !important;
    padding: 0.85rem 1rem;
}

.section-card {
    background-color: var(--ma-surface);
    border-radius: var(--ma-radius-lg);
    box-shadow: var(--ma-shadow);
    padding: 1rem;
    margin-bottom: 1rem;
}

    .section-card > h2 {
        font-size: 1.05rem;
        margin-bottom: 0.85rem;
    }

/* ---------- Alerts ---------- */

.alert {
    border: none;
    border-radius: var(--ma-radius);
    box-shadow: var(--ma-shadow);
}

.alert-warning {
    background-color: var(--ma-warning-bg);
    border-left: 4px solid var(--ma-warning-border);
    color: #6b5518;
}

.alert-success {
    background-color: var(--ma-primary-soft);
    color: var(--ma-primary-deep);
}

.alert-info {
    background-color: #e8f1fb;
    color: #1c4b74;
}

/* ---------- Badges & chips ---------- */

.badge {
    border-radius: 999px;
    font-weight: 600;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--ma-primary-soft);
    color: var(--ma-primary-deep);
    white-space: nowrap;
}

.chip-warning {
    background-color: var(--ma-warning-bg);
    color: #8a6d1d;
}

.chip-danger {
    background-color: #fdecee;
    color: #a12734;
}

/* ---------- Document list cards ---------- */

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.doc-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background-color: var(--ma-surface);
    border-radius: var(--ma-radius-lg);
    box-shadow: var(--ma-shadow);
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: var(--ma-text);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

    .doc-card:hover {
        box-shadow: var(--ma-shadow-lg);
        color: var(--ma-text);
    }

    .doc-card:active {
        transform: scale(0.99);
    }

.doc-card-icon {
    flex-shrink: 0;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 12px;
    background-color: var(--ma-primary-soft);
    color: var(--ma-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

    .doc-card-icon svg {
        width: 1.35rem;
        height: 1.35rem;
    }

.doc-card-body {
    flex: 1;
    min-width: 0;
}

.doc-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.doc-card-meta {
    font-size: 0.78rem;
    color: var(--ma-text-muted);
    margin-top: 0.1rem;
}

.doc-card-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* ---------- Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--ma-text-muted);
}

    .empty-state svg {
        width: 3rem;
        height: 3rem;
        color: var(--ma-primary);
        opacity: 0.5;
        margin-bottom: 0.75rem;
    }

    .empty-state p {
        margin: 0;
    }

/* ---------- Home hero & quick actions ---------- */

.hero {
    background: linear-gradient(135deg, var(--ma-primary) 0%, var(--ma-primary-deep) 100%);
    border-radius: var(--ma-radius-lg);
    color: #fff;
    padding: 1.5rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--ma-shadow-lg);
}

    .hero h1 {
        color: #fff;
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .hero p {
        margin: 0;
        opacity: 0.85;
        font-size: 0.95rem;
    }

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.quick-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background-color: var(--ma-surface);
    border-radius: var(--ma-radius-lg);
    box-shadow: var(--ma-shadow);
    padding: 1rem;
    text-decoration: none;
    color: var(--ma-text);
    transition: box-shadow 0.15s ease, transform 0.1s ease;
}

    .quick-card:hover {
        box-shadow: var(--ma-shadow-lg);
        color: var(--ma-text);
    }

    .quick-card:active {
        transform: scale(0.98);
    }

.quick-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    background-color: var(--ma-primary-soft);
    color: var(--ma-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .quick-card-icon svg {
        width: 1.3rem;
        height: 1.3rem;
    }

.quick-card-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.quick-card-badge {
    position: absolute;
    top: -0.35rem;
    right: -0.35rem;
    background-color: #f59e0b;
    color: #fff;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    min-width: 1.15rem;
    height: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
}

/* ---------- Upload page ---------- */

.capture-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.capture-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--ma-surface);
    border: 2px dashed var(--ma-border);
    border-radius: var(--ma-radius-lg);
    padding: 1.35rem 0.75rem;
    color: var(--ma-primary-dark);
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    margin-bottom: 0;
}

    .capture-tile:hover, .capture-tile:active {
        border-color: var(--ma-primary);
        background-color: var(--ma-primary-soft);
    }

    .capture-tile svg {
        width: 1.75rem;
        height: 1.75rem;
    }

.page-item-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--ma-surface);
    border-radius: var(--ma-radius);
    box-shadow: var(--ma-shadow);
    padding: 0.65rem 0.85rem;
}

.page-item-no {
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    background-color: var(--ma-primary-tint);
    color: var(--ma-primary-deep);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-item-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-item-size {
    font-size: 0.78rem;
    color: var(--ma-text-muted);
    flex-shrink: 0;
}

/* ---------- Page thumbnails (upload) ---------- */

.page-item-thumb {
    flex-shrink: 0;
    width: 3rem;
    height: 3.6rem;
    border-radius: 8px;
    object-fit: cover;
    background-color: var(--ma-primary-soft);
    border: 1px solid var(--ma-border);
}

.page-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid var(--ma-border);
    background-color: var(--ma-surface);
    color: var(--ma-text-muted);
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .icon-btn:hover:not(:disabled) {
        background-color: var(--ma-primary-soft);
        color: var(--ma-primary-deep);
    }

    .icon-btn:disabled {
        opacity: 0.35;
    }

    .icon-btn svg {
        width: 1rem;
        height: 1rem;
    }

    .icon-btn.icon-btn-danger:hover:not(:disabled) {
        background-color: #fdecee;
        color: var(--ma-danger);
    }

/* ---------- Upload progress overlay ---------- */

.upload-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(244, 247, 246, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
}

.upload-overlay-title {
    font-weight: 700;
    font-size: 1.1rem;
}

.upload-overlay-sub {
    color: var(--ma-text-muted);
    font-size: 0.9rem;
    margin: 0;
}

.spinner-ring {
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    border: 4px solid var(--ma-primary-tint);
    border-top-color: var(--ma-primary);
    animation: ma-spin 0.9s linear infinite;
}

@keyframes ma-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Skeleton loading ---------- */

.skeleton {
    border-radius: var(--ma-radius-lg);
    background: linear-gradient(90deg, #e9efee 25%, #f4f8f7 50%, #e9efee 75%);
    background-size: 200% 100%;
    animation: ma-shimmer 1.3s ease-in-out infinite;
}

.skeleton-card {
    height: 4.4rem;
    margin-bottom: 0.6rem;
}

@keyframes ma-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Sticky bottom action bar (review screen) ---------- */

.action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--ma-tab-height) + env(safe-area-inset-bottom));
    z-index: 25;
    background-color: var(--ma-surface);
    box-shadow: 0 -1px 8px rgba(16, 42, 40, 0.12);
    padding: 0.6rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-bar-buttons {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
}

    .action-bar-buttons .btn {
        flex: 1;
        max-width: 16rem;
    }

.action-bar-error {
    background-color: #fdecee;
    color: #a12734;
    border-left: 4px solid var(--ma-danger);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    max-height: 7rem;
    overflow-y: auto;
    cursor: pointer;
}

.has-action-bar {
    padding-bottom: calc(var(--ma-tab-height) + env(safe-area-inset-bottom) + 4.5rem);
}

@media (min-width: 768px) {
    .action-bar {
        bottom: 0;
        left: 250px;
    }
}

/* ---------- Lab result editor: table on desktop, cards on mobile ---------- */

.lab-grid-head {
    display: none;
}

.lab-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--ma-border);
}

    .lab-row:last-of-type {
        border-bottom: none;
    }

.lab-field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

    .lab-field > span {
        font-size: 0.68rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--ma-text-muted);
    }

.lab-field-wide {
    grid-column: 1 / -1;
}

.lab-row-remove {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

@media (min-width: 768px) {
    .lab-grid-head {
        display: grid;
        grid-template-columns: 2fr 2fr 1fr 0.9fr 0.8fr 0.8fr 1fr 2.4rem;
        gap: 0.4rem;
        padding-bottom: 0.35rem;
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--ma-text-muted);
    }

    .lab-row {
        grid-template-columns: 2fr 2fr 1fr 0.9fr 0.8fr 0.8fr 1fr 2.4rem;
        align-items: center;
        padding: 0.3rem 0;
        border-bottom: none;
    }

    .lab-field > span {
        display: none;
    }

    .lab-field-wide {
        grid-column: auto;
    }

    .lab-row-remove {
        grid-column: auto;
        justify-content: center;
    }
}

/* ---------- Value flag coloring ---------- */

.value-flag-h {
    border-color: #f1aeb5 !important;
    background-color: #fdf2f3;
}

.value-flag-l {
    border-color: #9ec5fe !important;
    background-color: #f1f7ff;
}

/* ---------- Image lightbox ---------- */

.doc-img-wrap {
    margin-top: 0.6rem;
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(10, 25, 24, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 0.5rem;
}

    .lightbox img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

/* ---------- Analyte autocomplete (trends) ---------- */

.autocomplete {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 40;
    background-color: var(--ma-surface);
    border-radius: var(--ma-radius);
    box-shadow: var(--ma-shadow-lg);
    overflow: hidden;
}

.autocomplete-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    color: var(--ma-text);
    border-bottom: 1px solid var(--ma-border);
}

    .autocomplete-item:last-child {
        border-bottom: none;
    }

    .autocomplete-item:hover, .autocomplete-item:focus {
        background-color: var(--ma-primary-soft);
        color: var(--ma-primary-deep);
    }

/* ---------- Trend chart ---------- */

.chart-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--ma-text-muted);
}

    .chart-legend > span {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }

.legend-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 999px;
    display: inline-block;
}

.legend-band {
    width: 1.1rem;
    height: 0.7rem;
    border-radius: 3px;
    background-color: #ccfbf1;
    border: 1px dashed #f59e0b;
    display: inline-block;
}

/* ---------- Stat chips row (home) ---------- */

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background-color: var(--ma-surface);
    border-radius: var(--ma-radius-lg);
    box-shadow: var(--ma-shadow);
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ma-primary-deep);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--ma-text-muted);
    font-weight: 600;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.25rem 0 0.6rem;
}

    .section-title h2 {
        font-size: 1.05rem;
        margin: 0;
    }

    .section-title a {
        font-size: 0.82rem;
        font-weight: 600;
        text-decoration: none;
    }

/* ---------- Tables ---------- */

.table {
    color: var(--ma-text);
}

    .table thead th {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--ma-text-muted);
        border-bottom-color: var(--ma-border);
    }

/* ---------- App bar (mobile top) ---------- */

.app-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: var(--ma-surface);
    box-shadow: var(--ma-shadow);
    padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.app-bar-logo {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--ma-primary) 0%, var(--ma-primary-deep) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .app-bar-logo svg {
        width: 1.1rem;
        height: 1.1rem;
    }

.app-bar-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ma-text);
    text-decoration: none;
}

    .app-bar-title:hover {
        color: var(--ma-text);
    }

/* ---------- Bottom tab bar (mobile) ---------- */

.tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    background-color: var(--ma-surface);
    box-shadow: 0 -1px 8px rgba(16, 42, 40, 0.1);
    display: flex;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--ma-tab-height) + env(safe-area-inset-bottom));
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--ma-text-muted);
    font-size: 0.66rem;
    font-weight: 600;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

    .tab-item svg {
        width: 1.45rem;
        height: 1.45rem;
    }

    .tab-item.active {
        color: var(--ma-primary-dark);
    }

        .tab-item.active::before {
            content: "";
            position: absolute;
            top: 0.3rem;
            width: 2.1rem;
            height: 1.8rem;
            border-radius: 999px;
            background-color: var(--ma-primary-tint);
            z-index: -1;
        }

.tab-badge {
    position: absolute;
    top: 0.25rem;
    right: calc(50% - 1.55rem);
    background-color: #f59e0b;
    color: #fff;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    min-width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.2rem;
}

/* ---------- Desktop sidebar ---------- */

.side-nav {
    display: none;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 1rem 1rem;
    text-decoration: none;
}

    .side-brand .app-bar-logo {
        width: 2.2rem;
        height: 2.2rem;
    }

    .side-brand span {
        font-weight: 700;
        font-size: 1.15rem;
        color: var(--ma-text);
    }

.side-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.15rem 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--ma-radius);
    text-decoration: none;
    color: var(--ma-text-muted);
    font-weight: 600;
    font-size: 0.92rem;
}

    .side-link svg {
        width: 1.25rem;
        height: 1.25rem;
        flex-shrink: 0;
    }

    .side-link:hover {
        background-color: var(--ma-primary-soft);
        color: var(--ma-primary-deep);
    }

    .side-link.active {
        background-color: var(--ma-primary);
        color: #fff;
        box-shadow: var(--ma-shadow);
    }

.side-badge {
    margin-left: auto;
    background-color: #f59e0b;
    color: #fff;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 1.2rem;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.3rem;
}

.side-spacer {
    flex: 1;
}

.app-version {
    text-align: center;
    font-size: 0.72rem;
    color: var(--ma-text-muted);
    padding: 0.5rem 0 0.85rem;
}

.hero-version {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.35rem !important;
}

/* ---------- Layout shell ---------- */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    padding: 1rem 1rem calc(var(--ma-tab-height) + env(safe-area-inset-bottom) + 1.25rem);
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .app-shell {
        flex-direction: row;
    }

    .app-bar, .tab-bar {
        display: none;
    }

    .side-nav {
        display: flex;
        flex-direction: column;
        width: 250px;
        flex-shrink: 0;
        background-color: var(--ma-surface);
        box-shadow: var(--ma-shadow);
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }

    .app-content {
        padding: 1.75rem 2rem 2rem;
    }
}
