/* =====================================================================
   ACR Invoice Tool — app shell (Prompt 2), mobile-first submit experience.
   Layers on top of style.css (shared :root brand tokens live there).
   ===================================================================== */

body.app {
    padding: 0;
    background: linear-gradient(180deg, #f6f8fc 0%, #eef2f9 100%);
    min-height: 100vh;
}

/* --- top bar ------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .8rem 1rem;
    padding-top: calc(.8rem + env(safe-area-inset-top));
    background: linear-gradient(135deg, var(--navy), var(--blue));
    color: #fff;
    box-shadow: 0 2px 14px rgba(14, 42, 92, .18);
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.mark {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: var(--orange);
    color: #fff;
    font-weight: 800; font-size: 1.25rem;
    border-radius: 10px;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .4px; }
.brand-text span { font-size: .72rem; opacity: .85; }
.who { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.who-name {
    font-size: .82rem; font-weight: 600; opacity: .95;
    max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logout {
    font-size: .8rem; color: #fff; text-decoration: none;
    border: 1px solid rgba(255, 255, 255, .5);
    padding: .3rem .6rem; border-radius: 999px;
    white-space: nowrap;
}
.logout:hover { background: rgba(255, 255, 255, .12); }

/* --- page + cards -------------------------------------------------- */
.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom));
}
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(14, 42, 92, .07);
    padding: 1.4rem 1.2rem;
    margin-top: 1rem;
}
.card h1 { margin: 0 0 .3rem; font-size: 1.3rem; color: var(--navy); }
.lead { margin: 0 0 1.1rem; color: var(--muted); font-size: .92rem; }

/* --- login --------------------------------------------------------- */
.login-card { text-align: center; }
.login-card .g_id_signin { display: inline-block; margin: .4rem auto 0; }
.login-card #g_id_onload { margin: 0 auto; }

.notice {
    text-align: left;
    padding: .7rem .85rem; border-radius: 10px;
    font-size: .86rem; margin: .5rem 0;
}
.notice.warn { background: var(--warnbg); color: #b45309; border: 1px solid var(--warnline); }
.notice.err { background: var(--badbg); color: var(--bad); border: 1px solid #fecaca; }
.notice code { background: rgba(0, 0, 0, .05); padding: .05rem .3rem; border-radius: 4px; }

/* --- form ---------------------------------------------------------- */
.field { display: block; margin-bottom: 1rem; }
.field.readonly { opacity: .9; }
.lbl { display: block; font-size: .84rem; font-weight: 600; color: #334155; margin-bottom: .35rem; }
.lbl i { color: var(--bad); font-style: normal; }
.lbl small { font-weight: 400; color: var(--muted); }

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: .65rem .8rem;
    font-size: 1rem;
    color: var(--ink);
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 10px;
    -webkit-appearance: none;
    appearance: none;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(31, 79, 163, .14);
}
.field input[readonly] { background: #eef2f7; color: #475569; }
.input-err, .field input.input-err { border-color: var(--bad) !important; }
.err-msg { display: block; margin-top: .35rem; color: var(--bad); font-size: .8rem; }

/* --- submitted-by (Google autofill OR manual) --------------------- */
.submitted-by {
    background: #f6f9ff;
    border: 1px solid #dbe6fb;
    border-radius: 12px;
    padding: .9rem 1rem;
}
.submitted-by > .row { margin-bottom: 0; }
.submitted-by > .row .field:last-child { margin-bottom: 0; }
.gauth {
    display: flex; align-items: center; gap: .8rem;
    flex-wrap: wrap; margin-bottom: .8rem;
}
.gauth-or { font-size: .8rem; color: var(--muted); position: relative; }
.who-box {
    display: flex; align-items: center; justify-content: space-between;
    gap: .8rem; flex-wrap: wrap;
    background: #fff; border: 1px solid var(--line);
    border-radius: 10px; padding: .6rem .85rem;
}
.who-info { display: flex; flex-direction: column; line-height: 1.25; }
.who-info b { color: var(--navy); font-size: .95rem; }
.who-info span { color: var(--muted); font-size: .82rem; }
.who-clear { font-size: .8rem; color: var(--blue); text-decoration: none; font-weight: 600; white-space: nowrap; }
.who-clear:hover { text-decoration: underline; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
.row .field { margin-bottom: 1rem; }

/* --- CC chips ------------------------------------------------------ */
.cc-add { display: flex; gap: .5rem; }
.cc-add input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    background: #eef2fb; color: var(--navy);
    border: 1px solid #d6e0f5;
    padding: .28rem .3rem .28rem .6rem;
    border-radius: 999px; font-size: .82rem;
}
.chip-x {
    border: 0; background: #d6e0f5; color: var(--navy);
    width: 20px; height: 20px; border-radius: 50%;
    font-size: 1rem; line-height: 1; cursor: pointer;
    display: grid; place-items: center;
}
.chip-x:hover { background: var(--blue); color: #fff; }

/* --- dropzone + files --------------------------------------------- */
.dropzone {
    display: block; cursor: pointer;
    border: 1.5px dashed #b9c6de;
    border-radius: 12px;
    background: #f6f9ff;
    padding: 1.1rem; text-align: center;
    transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--blue); background: #eef4ff; }
.dropzone input[type="file"] { display: none; }
.dz-text b { display: block; color: var(--navy); font-size: .95rem; }
.dz-text small { display: block; color: var(--muted); font-size: .78rem; margin-top: .25rem; }

.file-list { margin-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.file-row {
    display: flex; align-items: center; gap: .6rem;
    background: #f8fafc; border: 1px solid var(--line);
    border-radius: 9px; padding: .5rem .6rem;
}
.file-name { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: .78rem; color: var(--muted); flex: 0 0 auto; }
.file-name.bad, .file-size.bad { color: var(--bad); }
.file-rm {
    flex: 0 0 auto; border: 0; background: #eef2f7; color: #475569;
    width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
    font-size: 1.05rem; line-height: 1; display: grid; place-items: center;
}
.file-rm:hover { background: var(--bad); color: #fff; }

/* --- buttons ------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: .7rem 1.2rem;
    font-size: .95rem; font-weight: 700;
    border-radius: 10px; border: 1px solid transparent;
    cursor: pointer; text-decoration: none;
    transition: transform .05s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 6px 16px rgba(242, 140, 40, .32); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .7; cursor: default; box-shadow: none; }
.btn-ghost { background: #eef2fb; color: var(--navy); border-color: #d6e0f5; }
.btn-ghost:hover { background: #e2e9f8; }
.btn-block { width: 100%; }

.submit-bar {
    position: sticky;
    bottom: 0;
    margin: 1.2rem -1.2rem -1.4rem;
    padding: .9rem 1.2rem calc(.9rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 30%);
    border-top: 1px solid var(--line);
    border-radius: 0 0 16px 16px;
}

/* --- success ------------------------------------------------------- */
.success-card { text-align: center; }
.tick {
    width: 66px; height: 66px; margin: .3rem auto 1rem;
    background: var(--okbg); color: var(--ok);
    border: 2px solid #a7f3d0; border-radius: 50%;
    display: grid; place-items: center; font-size: 2rem; font-weight: 800;
}
.success-card .ref { font-size: 1rem; color: var(--ink); margin: 0 0 1rem; }
.success-card .ref strong { color: var(--blue); letter-spacing: .3px; }
.summary { list-style: none; margin: 0 0 1.1rem; padding: 0; text-align: left; }
.summary li {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .55rem .2rem; border-bottom: 1px solid var(--line); font-size: .9rem;
}
.summary li:last-child { border-bottom: 0; }
.summary li span { color: var(--muted); }
.summary li b { color: var(--ink); text-align: right; }
.muted { color: var(--muted); }

/* --- responsive ---------------------------------------------------- */
@media (max-width: 460px) {
    .row-3 { grid-template-columns: 1fr; }
}
@media (min-width: 720px) {
    .page { padding-top: 1.5rem; }
    .card { padding: 1.8rem 1.7rem; }
    .submit-bar { position: static; margin: 1.4rem 0 0; padding: 0; border-top: 0; background: none; }
}
