/* MSS Expenses — phone-first app shell. Shares the mss-admin palette so the
   suite feels like one product; bigger touch targets, single column. */

:root {
    --exp-bg: #0f1420;
    --exp-surface: #ffffff;
    --exp-ink: #1a2231;
    --exp-muted: #6b7688;
    --exp-line: #e3e7ee;
    --exp-accent: #1f6feb;
    --exp-ok: #1a7f4b;
    --exp-warn: #b45309;
    --exp-radius: 10px;
    font-synthesis: none;
}

* { box-sizing: border-box; }

/* The busy veil (and anything else) sets its own display, which would
   otherwise defeat the hidden attribute the wizard toggles. */
[hidden] { display: none !important; }

body.mss-exp {
    margin: 0;
    background: #f4f6fa;
    color: var(--exp-ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------- topbar */
.exp-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--exp-bg); color: #c7d0e0;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.exp-topbar__brand { font-weight: 800; letter-spacing: .05em; color: #fff; }
.exp-topbar__brand span { color: #7f8ca6; font-weight: 600; }
.exp-topbar__user { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.exp-topbar__user .exp-link { color: #9db2d8; }

.exp-tabs {
    display: flex; background: var(--exp-bg);
    padding: 0 12px 10px;
    gap: 8px;
}
.exp-tabs__tab {
    flex: 1; text-align: center; padding: 9px 10px;
    color: #c7d0e0; text-decoration: none; font-size: 14.5px; font-weight: 600;
    border-radius: 8px; background: rgba(255,255,255,.07);
}
.exp-tabs__tab.is-active { background: var(--exp-accent); color: #fff; }

.exp-content { max-width: 640px; margin: 0 auto; padding: 20px 16px calc(32px + env(safe-area-inset-bottom)); }

.exp-h1 { font-size: 21px; font-weight: 700; margin: 0 0 6px; }
.exp-h2 { font-size: 16px; font-weight: 700; margin: 22px 0 8px; color: var(--exp-muted); }
.exp-showline { margin: 14px 0 0; font-size: 14px; }
.exp-cards--dealt { opacity: .75; }
.exp-muted { color: var(--exp-muted); margin: 0 0 16px; }
.exp-link { color: var(--exp-accent); text-decoration: none; }
.exp-link:hover { text-decoration: underline; }
.exp-note { color: var(--exp-muted); font-size: 13.5px; margin: 10px 0 0; }
.exp-note--error { color: #b42318; }

/* --------------------------------------------------------------- buttons */
.exp-bigbtn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; margin: 0 0 12px; padding: 22px 16px;
    background: var(--exp-surface); border: 1px solid var(--exp-line);
    border-radius: var(--exp-radius); font-size: 17px; font-weight: 650;
    cursor: pointer; user-select: none;
}
.exp-bigbtn--primary { background: var(--exp-accent); border-color: var(--exp-accent); color: #fff; }
.exp-bigbtn:active { transform: scale(.99); }

.exp-btnrow { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.exp-btnrow--stack { flex-direction: column; }
.exp-btnrow--tight { margin: 6px 0 14px; }

/* -------------------------------------------------------------- dropzone */
.exp-dropzone {
    border: 2px dashed var(--exp-line);
    border-radius: var(--exp-radius);
    padding: 14px 14px 4px;
    background: #fbfcfe;
    transition: border-color .15s, background .15s;
}
.exp-dropzone.is-drag { border-color: var(--exp-accent); background: #f0f6ff; }
.exp-dropzone__hint { text-align: center; color: var(--exp-muted); font-size: 13px; margin: 4px 0 10px; }

/* ------------------------------------------------------------ page strip */
.exp-pages { display: flex; gap: 10px; flex-wrap: wrap; }
.exp-page { position: relative; }
.exp-page img {
    display: block; width: 84px; height: 112px; object-fit: cover;
    border: 1px solid var(--exp-line); border-radius: 8px; background: #fff;
}
.exp-page__pdf {
    display: flex; align-items: center; justify-content: center;
    width: 84px; height: 112px; border: 1px solid var(--exp-line);
    border-radius: 8px; background: #fff; color: #b42318;
    font-weight: 800; letter-spacing: .05em; text-decoration: none;
}
.exp-page__del {
    position: absolute; top: -8px; right: -8px; width: 26px; height: 26px;
    border-radius: 50%; border: 1px solid var(--exp-line);
    background: #fff; color: #b42318; font-size: 13px; line-height: 1;
    cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.exp-btn {
    flex: 1; min-width: 120px; padding: 12px 14px; text-align: center;
    background: var(--exp-surface); border: 1px solid var(--exp-line);
    border-radius: 8px; font-size: 15px; font-weight: 600; color: var(--exp-ink);
    cursor: pointer; text-decoration: none;
}
.exp-btn--primary { background: var(--exp-accent); border-color: var(--exp-accent); color: #fff; }
.exp-btn:disabled { opacity: .5; cursor: default; }

/* ----------------------------------------------------------- crop editor */
.exp-crop-stage {
    position: relative; margin: 0 auto; max-width: 100%;
    touch-action: none; /* corner drags, not page scrolls */
    border-radius: var(--exp-radius); overflow: hidden; background: #000;
}
.exp-crop-stage img { display: block; width: 100%; height: auto; }
#exp-crop-svg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    pointer-events: none;
}
#exp-crop-poly {
    fill: rgba(31,111,235,.14); stroke: #4b8bfd; stroke-width: 4;
    vector-effect: non-scaling-stroke;
}
.exp-handle {
    position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px;
    border-radius: 50%; background: rgba(255,255,255,.92);
    border: 3px solid var(--exp-accent);
    box-shadow: 0 1px 5px rgba(0,0,0,.35);
    cursor: grab;
}
.exp-handle:active { cursor: grabbing; background: #dbe7ff; }

.exp-preview-frame {
    border-radius: var(--exp-radius); overflow: hidden;
    border: 1px solid var(--exp-line); background: #fff;
}
.exp-preview-frame img { display: block; width: 100%; height: auto; }

/* ------------------------------------------------------------------ form */
.exp-scanline {
    background: #eef4ff; border: 1px solid #d4e2fb; color: #274b8f;
    border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px;
}
.exp-field { display: block; margin: 0 0 14px; border: 0; padding: 0; }
.exp-field > span, .exp-field legend {
    display: block; font-size: 13px; font-weight: 650; color: #46536b;
    margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em;
}
.exp-field em { font-style: normal; font-weight: 400; text-transform: none; color: var(--exp-muted); }
.exp-field input[type="text"], .exp-field input[type="date"], .exp-field textarea {
    width: 100%; padding: 12px; font-size: 16px; /* 16px stops iOS zoom */
    border: 1px solid var(--exp-line); border-radius: 8px; background: #fff;
    color: var(--exp-ink); font-family: inherit;
}
.exp-field input:focus, .exp-field textarea:focus { outline: 2px solid #bcd3fa; border-color: var(--exp-accent); }
.exp-field--amount, .exp-field--unit { display: flex; gap: 10px; }
.exp-field--amount label:first-child { flex: 2; }
.exp-field--amount label:last-child { flex: 1; }
.exp-field--unit label:first-child { flex: 1; }
.exp-field--unit label:last-child { flex: 2; }
.exp-field--amount span, .exp-field--unit span { display: block; font-size: 13px; font-weight: 650; color: #46536b; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.exp-field select {
    width: 100%; padding: 12px; font-size: 16px;
    border: 1px solid var(--exp-line); border-radius: 8px; background: #fff;
    color: var(--exp-ink); font-family: inherit;
}
.exp-field select:disabled { background: #f2f4f8; color: var(--exp-muted); }
.exp-radio {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px;
    border: 1px solid var(--exp-line); border-radius: 8px; background: #fff;
    margin-bottom: 8px; font-size: 15px; cursor: pointer;
}
.exp-radio em { font-style: normal; color: var(--exp-muted); font-size: 13.5px; }
.exp-radio:has(input:checked) { border-color: var(--exp-accent); background: #f2f7ff; }
.exp-radio input { width: 18px; height: 18px; accent-color: var(--exp-accent); }

/* ------------------------------------------------------------------ done */
.exp-done { text-align: center; padding: 28px 0; }
.exp-done__tick {
    width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
    background: var(--exp-ok); color: #fff; font-size: 34px; line-height: 64px;
}

/* ----------------------------------------------------------- login card */
.exp-login-body { background: var(--exp-bg); }
.exp-login {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 22px; padding: 20px;
}
.exp-login__brand { font-weight: 800; letter-spacing: .05em; color: #fff; font-size: 22px; }
.exp-login__brand span { color: #7f8ca6; font-weight: 600; }
.exp-login__card {
    background: var(--exp-surface); border-radius: 14px;
    padding: 22px 20px; width: 100%; max-width: 380px;
    box-shadow: 0 10px 40px rgba(0,0,0,.45);
}
.exp-login__remember { margin: 2px 0 14px; }
.exp-login__submit { width: 100%; }

/* ------------------------------------------------------------- busy veil */
.exp-busy {
    position: fixed; inset: 0; background: rgba(15,20,32,.55);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; z-index: 50;
}
.exp-busy__spinner {
    width: 44px; height: 44px; border-radius: 50%;
    border: 4px solid rgba(255,255,255,.25); border-top-color: #fff;
    animation: exp-spin .8s linear infinite;
}
.exp-busy__label { color: #fff; font-size: 15px; font-weight: 600; }
@keyframes exp-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------- receipts list */
.exp-cards { list-style: none; margin: 0; padding: 0; }
.exp-card {
    background: var(--exp-surface); border: 1px solid var(--exp-line);
    border-radius: var(--exp-radius); padding: 13px 14px; margin-bottom: 10px;
}
.exp-card__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.exp-card__merchant { font-weight: 700; }
.exp-card__mid { display: flex; justify-content: space-between; margin-top: 3px; }
.exp-card__amount { font-variant-numeric: tabular-nums; font-weight: 650; }
.exp-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.exp-card__note { margin-top: 8px; color: var(--exp-muted); font-size: 14px; }
.exp-tag {
    background: #eef2f9; color: #46536b; border-radius: 999px;
    padding: 2px 10px; font-size: 12.5px;
}
.exp-chip { border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 700; }
.exp-chip--new { background: #fff3e0; color: #9a5b00; }
.exp-chip--mid { background: #e7effc; color: #274b8f; }
.exp-chip--ok  { background: #e2f4e8; color: #135c37; }

@media (min-width: 700px) {
    .exp-tabs { padding: 0 0 10px; max-width: 640px; margin: 0 auto; }
    .exp-topbar { padding-left: max(16px, calc(50vw - 320px)); padding-right: max(16px, calc(50vw - 320px)); }
}
