/* ============================================================
   Mobile app shell — phone-first UI for the Nurvo TWA.
   All rules are scoped under .m-shell so they never affect the
   desktop site. Brand tokens (--color-accent, etc.) come from
   app.css :root.
   ============================================================ */

.m-shell {
    --m-bar-h: 54px;
    --m-nav-h: 62px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--color-bg-body, #F4F5F7);
    color: var(--font-color, #111827);
    -webkit-tap-highlight-color: transparent;
}

/* ── Top app bar ─────────────────────────────────────────── */
.m-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--m-bar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: #fff;
    border-bottom: 1px solid var(--color-border, #E5E7EB);
}
.m-topbar .m-logo { display: flex; align-items: center; }
.m-topbar .m-logo img { height: 26px; object-fit: contain; }
.m-topbar .m-title { font-size: 16px; font-weight: 600; }
.m-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.m-iconbtn {
    position: relative;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--font-color-secondary, #6B7280);
    text-decoration: none;
}
.m-iconbtn:active { background: var(--color-bg-body, #F4F5F7); }
.m-badge {
    position: absolute; top: 5px; right: 5px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: #E24B4A; color: #fff;
    font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
    border-radius: 8px;
}
.m-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--color-accent, #4F9CF9); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600; flex-shrink: 0;
}

/* ── Scrollable content ──────────────────────────────────── */
.m-content {
    flex: 1;
    padding: 14px 14px calc(var(--m-nav-h) + 18px);
    overflow-x: hidden;
}

/* ── Bottom tab navigation ───────────────────────────────── */
.m-bottomnav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 60;
    height: var(--m-nav-h);
    display: flex;
    background: #fff;
    border-top: 1px solid var(--color-border, #E5E7EB);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.m-tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--font-color-muted, #9CA3AF);
    font-size: 11px; font-weight: 500;
}
.m-tab .rz-icon, .m-tab .material-icons { font-size: 23px; }
.m-tab.active { color: var(--color-accent, #4F9CF9); }
.m-tab:active { background: var(--color-bg-body, #F4F5F7); }

/* ── Reusable mobile pieces ──────────────────────────────── */
.m-page-title { font-size: 20px; font-weight: 700; margin: 2px 0 2px; }
.m-page-sub { font-size: 13px; color: var(--font-color-secondary, #6B7280); margin: 0 0 14px; }

.m-card {
    background: #fff;
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
}

/* Big action tile for the home hub */
.m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-action {
    display: flex; flex-direction: column; gap: 10px;
    background: #fff;
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 16px;
    padding: 16px;
    text-decoration: none;
    color: var(--font-color, #111827);
    min-height: 104px;
}
.m-action:active { transform: scale(0.98); }
.m-action-ico {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(79,156,249,0.12); color: var(--color-accent, #4F9CF9);
}
.m-action-ico .rz-icon, .m-action-ico .material-icons { font-size: 24px; }
.m-action-title { font-size: 15px; font-weight: 600; }
.m-action-sub { font-size: 12px; color: var(--font-color-secondary, #6B7280); margin-top: -4px; }
.m-action.full { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; }
.m-action.full .m-action-ico { flex-shrink: 0; }

/* Branch / context banner */
.m-context {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
}
.m-context .rz-icon, .m-context .material-icons { color: var(--color-accent, #4F9CF9); }
.m-context-label { font-size: 11px; color: var(--font-color-muted, #9CA3AF); text-transform: uppercase; letter-spacing: .04em; }
.m-context-value { font-size: 14px; font-weight: 600; }

/* List rows */
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-row {
    display: flex; align-items: center; gap: 12px;
    background: #fff; border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 12px; padding: 12px 14px;
    text-decoration: none; color: var(--font-color, #111827);
}
.m-row:active { background: var(--color-bg-body, #F4F5F7); }
.m-row-main { flex: 1; min-width: 0; }
.m-row-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row-sub { font-size: 12px; color: var(--font-color-secondary, #6B7280); margin-top: 2px; }
.m-row-end { font-size: 13px; font-weight: 600; flex-shrink: 0; text-align: right; }

/* Buttons */
.m-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 48px;
    border: none; border-radius: 12px;
    background: var(--color-accent, #4F9CF9); color: #fff;
    font-size: 15px; font-weight: 600; cursor: pointer;
}
.m-btn:active { filter: brightness(0.95); }
.m-btn[disabled] { opacity: .5; }
.m-btn-secondary { background: #fff; color: var(--font-color, #111827); border: 1px solid var(--color-border, #E5E7EB); }

/* Status pills */
.m-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.m-pill-ok { background: #E1F5EE; color: #0F6E56; }
.m-pill-warn { background: #FAEEDA; color: #854F0B; }
.m-pill-err { background: #FCEBEB; color: #A32D2D; }
.m-pill-muted { background: var(--color-bg-body, #F1EFE8); color: var(--font-color-secondary, #5F5E5A); }

/* Section titles on the hub */
.m-section-title {
    font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--font-color-muted, #9CA3AF); margin: 18px 2px 10px;
}
.m-section-title:first-of-type { margin-top: 2px; }

/* Search box */
.m-search {
    width: 100%; height: 44px; padding: 0 14px; margin-bottom: 12px;
    border: 1px solid var(--color-border, #E5E7EB); border-radius: 12px;
    background: #fff; font-size: 15px; outline: none;
}
.m-search:focus { border-color: var(--color-accent, #4F9CF9); }

/* Detail header (customer/supplier) */
.m-detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.m-detail-avatar {
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
    background: rgba(79,156,249,0.12); color: var(--color-accent, #4F9CF9);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700;
}
.m-kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--color-bg-body, #F1EFE8); font-size: 14px; }
.m-kv:last-child { border-bottom: none; }
.m-kv-k { color: var(--font-color-secondary, #6B7280); }
.m-kv-v { font-weight: 600; text-align: right; }

/* Statement rows + totals */
.m-stmt-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--color-bg-body, #F1EFE8); }
.m-stmt-row:last-child { border-bottom: none; }
.m-stmt-doc { font-size: 14px; font-weight: 600; }
.m-stmt-date { font-size: 12px; color: var(--font-color-secondary, #6B7280); margin-top: 2px; }
.m-stmt-amt { font-size: 14px; font-weight: 600; text-align: right; }
.m-stmt-bal { font-size: 12px; color: var(--font-color-secondary, #6B7280); text-align: right; margin-top: 2px; }
.m-total-card {
    display: flex; justify-content: space-between; align-items: center;
    background: #1A2340; color: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px;
}
.m-total-label { font-size: 13px; opacity: .85; }
.m-total-value { font-size: 22px; font-weight: 700; }

/* Empty + loading states */
.m-empty { text-align: center; padding: 40px 16px; color: var(--font-color-secondary, #6B7280); }
.m-empty .rz-icon, .m-empty .material-icons { font-size: 44px; color: var(--font-color-muted, #9CA3AF); }
.m-empty-title { font-size: 16px; font-weight: 600; color: var(--font-color, #111827); margin: 10px 0 4px; }
