/* ===========================
   FORD ENVIRONMENTAL
   STAFF AREA
   Same palette as the main site
=========================== */

:root {
    --bg: #050505;
    --panel: #111312;
    --panel-2: #1a1d1b;
    --line: rgba(255, 255, 255, 0.09);
    --text: #ffffff;
    --text-soft: #c7c7c7;
    --text-muted: #8a8f8b;
    --green: #5f8f5b;
    --green-light: #78a873;
    --red: #e07a6f;

    --display: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
    --body: 'Barlow', Arial, Helvetica, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* ===== BRAND ===== */

.brand { display: flex; flex-direction: column; line-height: 1.1; }

.brand-name {
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: 0.04em;
}

.brand-name span { color: var(--green-light); }

.brand-sub {
    font-size: 0.72rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.brand-lg .brand-name { font-size: 2rem; }
.brand-lg .brand-sub { font-size: 0.8rem; margin-top: 4px; }

/* ===== BUTTONS ===== */

.btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 11px 18px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn:focus-visible { outline: 2px solid var(--green-light); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: wait; }

.btn-green { background: var(--green); color: #fff; }
.btn-green:hover:not(:disabled) { background: var(--green-light); }

.btn-ghost { background: transparent; color: var(--text-soft); border-color: rgba(255, 255, 255, 0.18); }
.btn-ghost:hover { border-color: var(--green-light); color: #fff; }

.btn-small { min-height: 40px; padding: 8px 14px; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn-big { padding: 14px 24px; font-size: 1.05rem; }

/* ===== FIELDS ===== */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field > span {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.field em {
    font-style: normal;
    color: var(--green-light);
    letter-spacing: 0.04em;
    text-transform: none;
    font-weight: 500;
    margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text);
    font-size: 16px; /* stops phones zooming in */
    padding: 11px 12px;
    min-height: 46px;
}

textarea { resize: vertical; line-height: 1.45; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-light);
    box-shadow: 0 0 0 3px rgba(120, 168, 115, 0.2);
}

.is-invalid { border-color: var(--red) !important; }

.form-error {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--red);
    border-radius: 8px;
    background: rgba(224, 122, 111, 0.1);
    color: #ffd9d4;
    font-size: 0.92rem;
}

.hint { margin: 10px 0 0; color: var(--text-muted); font-size: 0.88rem; }
.hint b { color: var(--text-soft); }

/* ===== LOGIN ===== */

.login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 4px solid var(--green);
    border-radius: 12px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#login-form { display: flex; flex-direction: column; gap: 16px; }

.login-note { margin: 0; color: var(--text-muted); font-size: 0.85rem; text-align: center; }

.back-link { color: var(--text-muted); font-size: 0.9rem; text-decoration: none; }
.back-link:hover { color: var(--green-light); }

/* ===== GENERATOR ===== */

.loading {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

body.is-loading .loading { display: flex; }
body.is-loading .bar,
body.is-loading .wrap { display: none; }

.bar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(5, 5, 5, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}

.bar-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.bar-user { display: flex; align-items: center; gap: 12px; min-width: 0; }

.user-email {
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: 28px 16px 56px;
}

.page-head { margin-bottom: 20px; }

.page-head h1 {
    margin: 0 0 6px;
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(2rem, 6vw, 2.8rem);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1;
}

.page-head p { margin: 0; color: var(--text-soft); max-width: 60ch; }

#ms-form { display: flex; flex-direction: column; gap: 16px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
}

.card-title {
    margin: 0 0 16px;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field.wide { grid-column: 1 / -1; }

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.status { margin: 0; color: var(--green-light); font-weight: 600; text-align: right; min-height: 1.5em; }

/* ===== MODAL ===== */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 4px solid var(--green);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
}

.modal-box h3 {
    margin: 0 0 8px;
    font-family: var(--display);
    font-size: 1.4rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.modal-box p { margin: 0 0 20px; color: var(--text-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ===== PHONE ===== */

@media (max-width: 620px) {
    .grid, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .card { padding: 16px; }
    .actions { flex-direction: column-reverse; }
    .actions .btn { width: 100%; }
    .status { text-align: center; }
    .user-email { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ===== JOB NUMBER ===== */

.job-no {
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid rgba(120, 168, 115, 0.45);
    background: rgba(95, 143, 91, 0.12);
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: 0.08em;
    color: var(--green-light);
}

.job-no.is-pending {
    font-family: var(--body);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0;
    color: var(--text-muted);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.18);
    background: transparent;
}

/* ===== SAVED METHOD STATEMENTS ===== */

.saved { margin-top: 32px; }

.saved-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.saved-head .card-title { margin: 0; }
.saved-head input { max-width: 320px; }

input[type="search"] {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text);
    font-size: 16px;
    padding: 11px 12px;
    min-height: 46px;
}

.saved-list { display: flex; flex-direction: column; }

.saved-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.saved-row:first-child { border-top: 0; }

.saved-row.is-current {
    background: rgba(95, 143, 91, 0.1);
    margin-inline: -12px;
    padding-inline: 12px;
    border-radius: 8px;
}

.saved-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.saved-code {
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.08em;
    color: var(--green-light);
}

.saved-addr { font-weight: 600; overflow-wrap: anywhere; }
.saved-meta { color: var(--text-muted); font-size: 0.85rem; }

.saved-btns { display: flex; gap: 8px; flex-shrink: 0; }
.saved-btns .btn:disabled { cursor: default; }

.saved-empty { margin: 0; padding: 8px 0; color: var(--text-muted); }

@media (max-width: 620px) {
    .saved-head input { max-width: none; }
    .saved-row { flex-direction: column; align-items: stretch; }
    .saved-btns .btn { flex: 1; }
}