/* JMT Engineer — mobile-first styles in JMT branding (yellow, charcoal, white).
   No inline styles anywhere (strict Content-Security-Policy).
   Contrast rule: yellow is always a background with charcoal text on it, never yellow text on white. */
:root {
    --brand: #ffc20e;          /* JMT yellow */
    --brand-dark: #e0a800;     /* pressed / borders on yellow */
    --brand-soft: #fff4cc;     /* pale yellow highlights */
    --ink: #1c1c1c;            /* charcoal: text on yellow, dark surfaces */
    --bg: #f4f4f4;
    --card: #ffffff;
    --text: #1c1c1c;
    --muted: #5f5f5f;
    --line: #e2e2e2;
    --error: #b42318;
    --ok-bg: #fff4cc;
    --ok: #1c1c1c;
    --radius: 14px;
    --tap: 48px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --card: #1e1e1e;
        --text: #f2f2f2;
        --muted: #a8a8a8;
        --line: #333333;
        --brand-soft: #3a3110;
        --ok-bg: #3a3110;
        --ok: #ffe08a;
        --error: #ff8a80;
        color-scheme: dark;
    }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--text); text-decoration-color: var(--brand-dark); text-decoration-thickness: 2px; }
h1 { font-size: 1.6rem; margin: .2rem 0 .3rem; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); margin-top: 0; }
.page { max-width: 640px; margin: 0 auto; padding: 16px; }

/* top bar: yellow with charcoal text */
.topbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; justify-content: space-between; align-items: center;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--brand); color: var(--ink);
    border-bottom: 1px solid var(--brand-dark);
}
.brand { color: var(--ink); text-decoration: none; font-weight: 900; font-size: 1.2rem; letter-spacing: .03em; }
.brand span { font-weight: 600; }
.who { font-size: .95rem; font-weight: 600; }

/* bottom tab bar: selected tab has a yellow bar and charcoal text */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    display: grid; grid-template-columns: repeat(3, 1fr);
    background: var(--card); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 60px; font-size: .8rem; color: var(--muted); text-decoration: none; font-weight: 600;
    border-top: 4px solid transparent;
}
.tabbar a.on { color: var(--text); border-top-color: var(--brand); font-weight: 800; }
.tabbar .ico { font-size: 1.4rem; line-height: 1.1; }

/* buttons and forms */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: var(--tap); padding: 0 18px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--card); color: var(--text);
    font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--brand); border-color: var(--brand-dark); color: var(--ink); }
.btn.primary:active { background: var(--brand-dark); }
.btn.big { width: 100%; min-height: 56px; font-size: 1.05rem; margin-top: 8px; }
.btn.link { border: 0; background: none; color: var(--muted); text-decoration: underline; }
.stack { display: grid; gap: 14px; margin-top: 14px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
label.check input { width: 22px; height: 22px; accent-color: var(--brand); }
input, select, textarea {
    width: 100%; min-height: var(--tap); padding: 10px 12px;
    font: inherit; font-weight: 400; color: var(--text);
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand); outline-offset: 1px; border-color: var(--brand-dark); }
.btn:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.error { color: var(--error); margin: 0; font-weight: 600; }
.error-box { border: 1px solid var(--error); color: var(--error); border-radius: 10px; padding: 8px 12px; margin: 12px 0; }
.error-box p { margin: 4px 0; }
.notice { background: var(--ok-bg); color: var(--ok); border-left: 5px solid var(--brand); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-weight: 700; }
.back { display: inline-block; margin: 4px 0 8px; text-decoration: none; font-weight: 700; }

/* login: yellow band, white card, charcoal text */
.login-body { padding-bottom: 0; background: linear-gradient(170deg, var(--brand) 0%, var(--brand) 52%, var(--bg) 52%); min-height: 100vh; }
.login-card { background: var(--card); border-radius: 18px; padding: 24px 20px; margin: 8vh auto 0; max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.login-card h1 { margin-top: 8px; }
.login-logo { display: block; border-radius: 16px; }
.fineprint { color: var(--muted); font-size: .85rem; margin-bottom: 0; }

/* home */
.greeting { margin-top: 6px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile {
    display: flex; flex-direction: column; justify-content: center; gap: 4px;
    min-height: 96px; padding: 14px; border-radius: var(--radius);
    background: var(--card); border: 1px solid var(--line);
    color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.05rem;
}
.tile.primary { grid-column: 1 / -1; background: var(--brand); border-color: var(--brand-dark); color: var(--ink); min-height: 84px; }
.tile-ico { font-size: 1.6rem; line-height: 1; }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px; }
.signout { margin-top: 28px; text-align: center; }
.day-label { margin: 10px 0 4px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.day-head { margin-top: 1.4rem; }

/* job cards: white with a yellow edge */
.job-card {
    display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start;
    background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--brand);
    border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
    color: var(--text); text-decoration: none;
}
.job-time strong { display: block; font-size: 1.15rem; }
.job-time span { color: var(--muted); font-size: .9rem; }
.job-customer { font-weight: 800; }
.job-type, .job-addr { color: var(--muted); font-size: .95rem; }
.job-card.past { border-left-color: var(--line); }   /* past jobs: grey edge, still fully readable */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 6px; }

/* search and customers */
.searchbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 12px 0 16px; position: sticky; top: 56px; }
.customer-card {
    display: flex; gap: 12px; align-items: center; justify-content: space-between;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px; margin-bottom: 10px;
}
.customer-card.compact { margin: 8px 0 4px; border-left: 6px solid var(--brand); }
.customer-name { font-weight: 800; }
.customer-addr { color: var(--muted); font-size: .95rem; }
.customer-phones { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-weight: 700; }
.customer-phones a { text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 3px; }

/* job detail */
.details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 14px; margin: 14px 0; }
.details dt { color: var(--muted); font-size: .85rem; font-weight: 700; margin-top: 10px; text-transform: uppercase; letter-spacing: .04em; }
.details dd { margin: 2px 0 10px; }
.details .pre { white-space: pre-wrap; }

/* status badges: appointment status until started, then progress. Yellow only as a background. */
.badge {
    display: inline-block; vertical-align: middle; margin-left: 6px;
    padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line);
    font-size: .78rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
    background: var(--card); color: var(--text);
}
.badge-rescheduled { border-color: var(--brand-dark); }
.badge-in-progress { background: var(--brand); border-color: var(--brand-dark); color: var(--ink); }
.badge-completed { background: var(--text); border-color: var(--text); color: var(--bg); }
.badge-cancelled, .badge-not-booked { border-color: var(--error); color: var(--error); }
.job-head .badge { margin-left: 4px; font-size: .85rem; }
.progress-action { margin: 12px 0 4px; }
.history { margin: 0; padding-left: 1.2rem; display: grid; gap: 6px; }
.history time { color: var(--muted); }

/* engineer notes: append-only history, newest first */
.notes { margin-top: 8px; }
.note-form { margin-top: 0; }
.note-form .btn { justify-self: start; }
.note-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.note { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: var(--radius); padding: 10px 14px; }
.note-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: .9rem; }
.note-meta time { color: var(--muted); }
.note-body { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (min-width: 560px) {
    .actions { grid-template-columns: repeat(3, 1fr); }
    .tile.primary { grid-column: auto; min-height: 96px; }
}
