/* ═══════════════════════════════════════════════════════════════
   MOBILE LITE ESTIMATOR
   Full-screen sub-page: notes + photos + line items → pipeline doc
   ═══════════════════════════════════════════════════════════════ */

/* ── Page shell ─────────────────────────────────────────────── */
.me-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--color-bg-base, #0f172a);
}

/* ── Header bar ──────────────────────────────────────────────── */
.me-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--color-bg-surface, #1a1a2e);
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
    flex-shrink: 0;
}
.me-back-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary, #94a3b8);
    padding: 6px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 22px;
    border-radius: 8px;
}
.me-back-btn:active { background: var(--color-bg-hover, rgba(255,255,255,0.06)); }
.me-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
    text-align: center;
}
.me-save-icon-btn {
    background: none;
    border: none;
    color: var(--color-accent, #3b82f6);
    padding: 6px 4px;
    cursor: pointer;
    font-size: 22px;
    border-radius: 8px;
}
.me-save-icon-btn:active { background: var(--color-bg-hover, rgba(255,255,255,0.06)); }

/* ── Context card ────────────────────────────────────────────── */
.me-context {
    padding: 10px 16px;
    background: var(--color-bg-card, #1e293b);
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
    flex-shrink: 0;
}
.me-context-client {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.me-context-sub {
    font-size: 11px;
    color: var(--color-text-muted, #64748b);
    margin-top: 2px;
}

/* ── Scroll body ─────────────────────────────────────────────── */
.me-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Generic section card ────────────────────────────────────── */
.me-section {
    background: var(--color-bg-card, #1e293b);
    border: 1px solid var(--color-border, rgba(255,255,255,0.08));
    border-radius: 12px;
    overflow: hidden;
}
.me-sec-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
}
.me-sec-hdr i {
    font-size: 15px;
    color: var(--color-accent, #3b82f6);
}
.me-sec-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.me-sec-body {
    padding: 12px 14px;
}

/* ── Notes section ───────────────────────────────────────────── */
.me-note-input {
    width: 100%;
    min-height: 76px;
    resize: vertical;
    background: var(--color-bg-surface, #1a1a2e);
    border: 1px solid var(--color-border, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--color-text-primary, #f1f5f9);
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    line-height: 1.45;
}
.me-note-input::placeholder { color: var(--color-text-muted, #64748b); }
.me-note-input:focus {
    outline: none;
    border-color: var(--color-accent, #3b82f6);
}
.me-note-add-btn {
    margin-top: 8px;
    width: 100%;
    padding: 9px;
    background: var(--color-accent, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.me-note-add-btn:active { opacity: 0.85; }

.me-note-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.me-note-item {
    padding: 8px 10px;
    background: var(--color-bg-surface, #1a1a2e);
    border-radius: 8px;
    border-left: 3px solid var(--color-accent, #3b82f6);
}
.me-note-body {
    font-size: 13px;
    color: var(--color-text-primary, #f1f5f9);
    line-height: 1.4;
    word-break: break-word;
}
.me-note-meta {
    font-size: 11px;
    color: var(--color-text-muted, #64748b);
    margin-top: 3px;
}

/* ── Photos section ──────────────────────────────────────────── */
.me-add-photo-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: var(--color-bg-surface, #1a1a2e);
    border: 1px dashed var(--color-border, rgba(255,255,255,0.18));
    border-radius: 8px;
    color: var(--color-text-secondary, #94a3b8);
    font-size: 13px;
    cursor: pointer;
    box-sizing: border-box;
}
.me-add-photo-btn i { font-size: 20px; }
.me-add-photo-btn:active { background: var(--color-bg-hover, rgba(255,255,255,0.06)); }

.me-upload-progress {
    font-size: 12px;
    color: var(--color-text-muted, #64748b);
    margin-top: 8px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.me-photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}
.me-photo-thumb {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    object-fit: cover;
    width: 100%;
    cursor: pointer;
    background: var(--color-bg-surface, #1a1a2e);
}
.me-photo-thumb:active { opacity: 0.8; }

/* ── Line items section ──────────────────────────────────────── */
.me-li-head {
    display: grid;
    grid-template-columns: 1fr 54px 74px 64px 28px;
    gap: 5px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,0.08));
    margin-bottom: 8px;
}
.me-li-head span {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: right;
}
.me-li-head span:first-child { text-align: left; }

.me-li-row {
    display: grid;
    grid-template-columns: 1fr 54px 74px 64px 28px;
    gap: 5px;
    align-items: center;
    margin-bottom: 6px;
}
.me-li-input {
    background: var(--color-bg-surface, #1a1a2e);
    border: 1px solid var(--color-border, rgba(255,255,255,0.1));
    border-radius: 6px;
    padding: 6px 7px;
    color: var(--color-text-primary, #f1f5f9);
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
    text-align: right;
    font-family: inherit;
}
.me-li-input:focus {
    outline: none;
    border-color: var(--color-accent, #3b82f6);
}
.me-li-input.desc { text-align: left; }

/* hide spinners on number inputs — too cramped on mobile */
.me-li-input[type="number"]::-webkit-inner-spin-button,
.me-li-input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.me-li-input[type="number"] { -moz-appearance: textfield; }

.me-li-total {
    font-size: 12px;
    color: var(--color-text-primary, #f1f5f9);
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.me-li-del {
    background: none;
    border: none;
    color: var(--color-danger, #ef4444);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.me-add-li-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 10px;
    background: none;
    border: 1px dashed var(--color-border, rgba(255,255,255,0.14));
    border-radius: 8px;
    color: var(--color-text-secondary, #94a3b8);
    font-size: 13px;
    width: 100%;
    cursor: pointer;
    margin-top: 6px;
    font-family: inherit;
}
.me-add-li-btn:active { background: var(--color-bg-hover, rgba(255,255,255,0.05)); }
.me-add-li-btn i { font-size: 15px; }

.me-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    margin-top: 8px;
    border-top: 1px solid var(--color-border, rgba(255,255,255,0.1));
}
.me-total-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.me-total-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary, #f1f5f9);
}

/* ── Footer action bar ───────────────────────────────────────── */
.me-footer {
    padding: 11px 14px 20px;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    background: var(--color-bg-surface, #1a1a2e);
    border-top: 1px solid var(--color-border, rgba(255,255,255,0.08));
}
.me-footer-btn {
    flex: 1;
    padding: 13px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
}
.me-footer-btn:active { opacity: 0.8; }
.me-footer-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.me-footer-btn.draft {
    background: var(--color-bg-card, #1e293b);
    color: var(--color-text-primary, #f1f5f9);
    border: 1px solid var(--color-border, rgba(255,255,255,0.12));
}
.me-footer-btn.quote {
    background: var(--color-accent, #3b82f6);
    color: #fff;
}

/* ── Toast notification ──────────────────────────────────────── */
.me-toast {
    position: fixed;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--color-bg-card, #1e293b);
    color: var(--color-text-primary, #f1f5f9);
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    border: 1px solid var(--color-border, rgba(255,255,255,0.08));
}
.me-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.me-toast.error {
    background: #ef4444;
    border-color: transparent;
    color: #fff;
}

/* ── Spinner animation (reuse if not already global) ─────────── */
@keyframes me-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.me-spin { animation: me-spin 0.8s linear infinite; }
