/* Field Scanner website shell (plan 33). The scanner's own look comes from
   addin/css/fieldscanner.css; this file is only the sign-in card, the camera
   overlay, and the host-specific frame around #controlAddIn. */

html, body {
    height: 100%;
    margin: 0;
    background: #f6f7f6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

/* The add-in expects to own a viewport-sized scroll container (the BC page
   gives it one). Fixed inset beats 100vh on iOS toolbars. */
#controlAddIn {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* No Dynamics-app back bar on the web: the bottom buffer is just the safe area. */
.field-scanner.fs-web {
    --fs-app-bar-buffer: 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

body.fs-camera-open #controlAddIn {
    overflow: hidden;
}

/* ---- Sign-in / loading card ---- */
.fs-web-gate {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f6f7f6;
}

.fs-web-gate[hidden] {
    display: none;
}

.fs-web-card {
    width: 100%;
    max-width: 380px;
    padding: 28px 22px 22px;
    background: #fff;
    border: 1px solid #e2e6e3;
    border-radius: 18px;
    box-shadow: 0 8px 30px rgba(16, 24, 40, 0.08);
    text-align: center;
}

.fs-web-logo {
    width: 88px;
    height: 88px;
    margin: 0 auto 14px;
    border-radius: 21px;
    background: #1f6b3a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fs-web-logo svg {
    width: 70px;
    height: 70px;
}

.fs-web-card h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.fs-web-sub {
    margin: 0 0 18px;
    font-size: 13px;
    color: #6b7280;
}

.fs-web-env {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #fff4e5;
    color: #9a5b00;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.fs-web-env:empty {
    display: none;
}

.fs-web-status {
    min-height: 20px;
    margin: 0 0 16px;
    font-size: 14px;
    color: #374151;
}

.fs-web-status.is-error {
    color: #b42318;
}

.fs-web-btn {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background: #1f6b3a;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.fs-web-btn[hidden] {
    display: none;
}

.fs-web-btn:active {
    background: #185530;
}

.fs-web-link {
    display: inline-block;
    margin-top: 12px;
    border: 0;
    background: none;
    color: #6b7280;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}

.fs-web-link[hidden] {
    display: none;
}

.fs-web-hint {
    margin: 14px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #9ca3af;
}

/* ---- Camera overlay ---- */
.fs-web-camera {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    background: #000;
}

.fs-web-camera[hidden] {
    display: none;
}

.fs-web-camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fs-web-camera-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(70vw, 320px);
    height: min(70vw, 320px);
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
}

.fs-web-camera-bar {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
}

.fs-web-camera-hint {
    color: #fff;
    font-size: 14px;
    text-align: center;
    flex: 1;
}

.fs-web-camera-btn {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.fs-web-camera-btn[hidden] {
    display: none;
}

/* Account panel + sign-out (plan 36.7.4). The BYLANDS / user chips are drawn by
   the shared add-in and are inert in Business Central; on the website they open
   this panel, so the header carries a security control without growing a
   button. Cue them enough to be discoverable without turning the header into a
   toolbar. */
.fs-web .fs-web-acct-chip {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 120ms ease, box-shadow 120ms ease;
}

.fs-web .fs-web-acct-chip:hover,
.fs-web .fs-web-acct-chip:focus-visible {
    opacity: 0.8;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
    outline: none;
}

.fs-web .fs-web-acct {
    position: fixed;
    top: calc(52px + env(safe-area-inset-top, 0px));
    right: 12px;
    z-index: 300;
    width: min(260px, calc(100vw - 24px));
    padding: 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e2e6e3;
    box-shadow: 0 10px 34px rgba(16, 24, 40, 0.18);
    font-size: 14px;
    color: #111827;
}

.fs-web .fs-web-acct[hidden] {
    display: none;
}

.fs-web .fs-web-acct-name {
    font-weight: 700;
    font-size: 15px;
}

.fs-web .fs-web-acct-upn {
    margin-top: 2px;
    color: #6b7280;
    font-size: 12px;
    word-break: break-all;
}

.fs-web .fs-web-acct-rows {
    margin: 12px 0;
    padding: 10px 0;
    border-top: 1px solid #eef1ef;
    border-bottom: 1px solid #eef1ef;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fs-web .fs-web-acct-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.fs-web .fs-web-acct-label {
    color: #6b7280;
    font-size: 12px;
}

.fs-web .fs-web-acct-value {
    font-weight: 600;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.fs-web .fs-web-acct-signout {
    width: 100%;
    min-height: 44px;
    border: 1px solid #e2e6e3;
    border-radius: 10px;
    background: #fff;
    color: #b42318;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.fs-web .fs-web-acct-signout:active {
    background: #fef3f2;
}
