/* Rollo Refurb — tablet-first UI: large fonts, large touch targets. */
* { box-sizing: border-box; }
:root {
    --ink: #1c2430;
    --muted: #5b6675;
    --bg: #f2f4f7;
    --card: #ffffff;
    --line: #d7dce3;
    --primary: #6C13F9;
    --green: #157a3c;
    --red: #c02418;
    --amber: #a05a00;
}
html { font-size: 18px; }
[hidden] { display: none !important; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout */
.topbar {
    display: flex; flex-wrap: wrap; gap: .5rem 1rem;
    align-items: center; justify-content: space-between;
    background: var(--ink); color: #fff; padding: .5rem 1rem;
}
.nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.nav a { color: #cfd8e3; text-decoration: none; padding: .5rem .25rem; font-size: 1rem; }
.nav a:hover { color: #fff; }
.nav .brand { color: #fff; font-weight: 700; font-size: 1.1rem; margin-right: .5rem; }
.topbar-right { display: flex; gap: .75rem; align-items: center; }
.whoami { font-size: .95rem; color: #cfd8e3; }
.page { max-width: 68rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; width: 100%; flex: 1; }
.footer {
    width: 100%; margin: 0 auto; padding: .7rem 1rem;
    display: flex; justify-content: center; align-items: center;
    text-align: center; color: var(--muted); font-size: .75rem;
    border-top: 1px solid var(--line);
}
h1 { font-size: 1.7rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 .5rem; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    border: 2px solid var(--ink); border-radius: .6rem;
    background: #fff; color: var(--ink);
    font-size: 1.05rem; font-weight: 600;
    padding: .7rem 1.1rem; min-height: 3rem;
    cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-outline { background: transparent; }
.topbar .btn-outline { color: #fff; border-color: #8a97a8; }
.btn-big { font-size: 1.3rem; padding: 1rem 1.6rem; min-height: 3.6rem; }
.btn-huge { font-size: 1.7rem; padding: 1.4rem 2.2rem; min-height: 5.5rem; min-width: 14rem; }
.btn-small { font-size: .9rem; min-height: 2.2rem; padding: .35rem .7rem; }
.key-hint { font-weight: 400; opacity: .8; font-size: .85em; }
.action-row { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; }

/* Forms */
label { display: block; margin: .8rem 0; font-weight: 600; }
input[type=text], input[type=password], input[type=number], input[type=date],
textarea, select {
    display: block; width: 100%; max-width: 30rem;
    font-size: 1.3rem; padding: .7rem .8rem; margin-top: .3rem;
    border: 2px solid var(--line); border-radius: .5rem; background: #fff;
    font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 3px solid #cdb0fc; border-color: var(--primary); }
.input-small { width: 8rem !important; display: inline-block !important; }
.check-label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
.check-label input { width: 1.4rem; height: 1.4rem; }
.filter-form { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; }
.filter-form label { margin: .2rem 0; font-size: .9rem; }
.filter-form input, .filter-form select { max-width: 12rem; font-size: 1rem; }

/* Cards, alerts, badges */
.card { background: var(--card); border: 1px solid var(--line); border-radius: .8rem;
        padding: 1rem 1.25rem; margin: 1rem 0; }
.card-narrow { max-width: 30rem; margin: 2rem auto; }
.alert { padding: .8rem 1rem; border-radius: .6rem; font-weight: 600; }
.alert-error { background: #fbe3e1; color: var(--red); border: 1px solid var(--red); }
.alert-ok { background: #e2f3e8; color: var(--green); border: 1px solid var(--green); }
.hint { color: var(--muted); font-size: .95rem; }
.badge {
    display: inline-block; padding: .1rem .55rem; border-radius: 1rem;
    font-size: .8rem; font-weight: 700; text-transform: uppercase;
    background: #e2e7ee; color: var(--ink);
}
.badge-big { font-size: 1rem; padding: .25rem .9rem; }
.badge-pass, .badge-done { background: #d9efe1; color: var(--green); }
.badge-fail { background: #fbdfdc; color: var(--red); }
.badge-incomplete { background: #f6e8d4; color: var(--amber); }
.badge-na { background: #e2e7ee; color: var(--muted); }

/* Tables & lists */
.table { width: 100%; border-collapse: collapse; background: var(--card);
         border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; }
.table th, .table td { text-align: left; padding: .55rem .7rem;
                       border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #e8ecf1; font-size: .85rem; text-transform: uppercase;
            letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }
.list { display: flex; flex-direction: column; gap: .5rem; }
.list-row { display: block; background: var(--card); border: 2px solid var(--line);
            border-radius: .6rem; padding: .9rem 1rem; text-decoration: none;
            color: var(--ink); font-size: 1.05rem; }
.list-row:hover { border-color: var(--primary); }
.defect-cell { margin-bottom: .3rem; }
.defect-cell em { display: block; color: var(--muted); }
.actions-cell { white-space: nowrap; }
.export-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Big worker-facing inputs: easy to read from arm's length on a tablet */
input.serial-input {
    font-size: 2.4rem; font-weight: 700; letter-spacing: .08em;
    padding: 1rem 1.1rem; max-width: 36rem; text-transform: uppercase;
}
.serial-form .btn { margin-top: .8rem; }

/* Checklist runner */
.run-head { display: flex; justify-content: space-between; align-items: center;
            margin-bottom: .5rem; }
.run-serial { font-weight: 700; font-size: 1.1rem; color: var(--muted); }
.progress { color: var(--muted); font-weight: 700; text-transform: uppercase;
            font-size: .9rem; letter-spacing: .05em; margin: 0; }
.step-title { font-size: 2.4rem; margin: .3rem 0 .6rem; }
.fail-title { color: var(--red); }
.instruction { font-size: 1.7rem; line-height: 1.5; max-width: 50rem; }
.ref-photo { max-width: 100%; max-height: 20rem; border-radius: .6rem;
             border: 1px solid var(--line); margin: .5rem 0; }
.value-form .value-input {
    font-size: 3rem; font-weight: 700; max-width: 22rem;
    text-align: right; padding: 1rem 1.1rem;
}
.result-line { font-size: 1.15rem; }

/* Defect picker */
.defect-list { display: flex; flex-direction: column; gap: .4rem; margin: 1rem 0; }
.defect-item { display: flex; align-items: center; gap: .7rem;
               background: var(--card); border: 2px solid var(--line);
               border-radius: .6rem; padding: .6rem .8rem; margin: 0;
               font-weight: 500; cursor: pointer; }
.defect-item:has(input:checked) { border-color: var(--primary); background: #f2eafe; }
.defect-item input { width: 1.4rem; height: 1.4rem; margin: 0; flex: none; }
.defect-num { flex: none; width: 2.2rem; height: 2.2rem; border-radius: .45rem;
              background: var(--ink); color: #fff; font-weight: 700;
              display: inline-flex; align-items: center; justify-content: center; }
.defect-label { flex: 1; }

/* Login */
.login-wrap { max-width: 34rem; margin: 2.5rem auto; text-align: center; }
.login-title { font-size: 2rem; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
             gap: .7rem; margin: 1.5rem 0; }
.user-btn { min-height: 4rem; font-size: 1.3rem; }
.user-btn:focus { outline: 4px solid #cdb0fc; }
.pin-panel { margin: 1rem 0; }
.pin-for { font-size: 1.1rem; }
input.pin-input { text-align: center; font-size: 2.4rem; letter-spacing: .5rem;
                  max-width: 16rem; margin: .5rem auto 1rem; padding: .8rem; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 5.5rem);
           gap: .6rem; justify-content: center; }
.pad-btn { font-size: 1.6rem; min-height: 4rem; }

/* Webcam / photo capture widget */
.photo-capture {
    border: 2px dashed var(--line); border-radius: .8rem;
    padding: .8rem 1rem; margin: 1rem 0; max-width: 36rem;
    background: var(--card);
}
.pc-label { display: block; font-weight: 700; margin-bottom: .5rem; }
.pc-controls { display: flex; flex-wrap: wrap; gap: .6rem; margin: .3rem 0; }
.pc-file { cursor: pointer; }
.cam-video { display: block; width: 100%; max-width: 26rem;
             border-radius: .6rem; margin: .6rem 0; background: #000; }
.cam-thumb { display: block; max-width: 16rem; max-height: 12rem;
             border-radius: .6rem; border: 2px solid var(--green); margin: .6rem 0; }

/* Keypad buffer indicator */
.key-buffer {
    position: fixed; right: 1rem; bottom: 1rem;
    background: var(--ink); color: #fff;
    font-size: 1.6rem; font-weight: 700;
    padding: .4rem 1rem; border-radius: .6rem;
    min-width: 3rem; text-align: center;
}

/* Checklist editor */
.step-edit legend { font-weight: 700; padding: 0 .4rem; }
.step-edit { border: 1px solid var(--line); }

@media (max-width: 700px) {
    html { font-size: 16px; }
    .btn-huge { min-width: 100%; }
    .action-row { flex-direction: column; }
    .table { display: block; overflow-x: auto; }
}
