/* Shared look of the aga_1 pages: login, dashboard, users, password, report.
   Plain CSS, no fonts or images. sw.js precaches this file and ui.js and serves
   them cache-first, so bump CACHE_NAME there after every edit. */
:root {
    --bg: #f4f5f8;
    --surface: #ffffff;
    --ink: #191d26;
    --ink-2: #4b5364;
    --ink-3: #666f80;
    --line: #dfe3ea;
    --line-2: #eef0f4;
    --accent: #33405a;
    --accent-dark: #1f2839;
    --accent-2: #5a6c90;
    --accent-soft: #e9edf5;
    --amber: #c27b12;
    --amber-soft: #fdf3e2;
    --back-1: #d9614b;   /* terracotta Back: same Back button in every app */
    --back-2: #b23f2c;
    --danger: #b23f2c;
    --danger-soft: #fbeae6;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(25, 29, 38, .05), 0 4px 16px rgba(25, 29, 38, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg); color: var(--ink); min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- header: Back left, page title, actions right ---------- */
.top {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: rgba(244, 245, 248, .88); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.back {
    width: 44px; height: 44px; border-radius: 12px; border: none; cursor: pointer; flex: none;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--back-1), var(--back-2));
    box-shadow: 0 4px 14px rgba(178, 63, 44, .28);
}
.title { min-width: 0; display: flex; flex-direction: column; }
.title .app { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.title .page { font-size: 18px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tbtn {
    height: 40px; min-width: 40px; padding: 0 10px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
    font-weight: 600; font-size: 13px; cursor: pointer;
}
.tbtn.on { color: var(--accent); border-color: #c0c9dc; background: var(--accent-soft); }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 24px 64px; }
.wrap.narrow { max-width: 760px; }
.h1 { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 24px 0 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }

/* ---------- controls ---------- */
.btn {
    height: 52px; padding: 0 22px; border-radius: 14px; border: 1px solid var(--line);
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--surface); color: var(--ink); font-weight: 650; font-size: 15px; cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(51, 64, 90, .25); }
.btn.big { height: 64px; font-size: 19px; font-weight: 750; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.field .unit { font-weight: 600; color: var(--ink-3); }
.field .hint { margin-left: auto; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.input {
    height: 56px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
    padding: 0 16px; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; width: 100%;
}
.input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(90, 108, 144, .15); }
.input::placeholder { color: #a9b0bd; font-weight: 500; }
.input.filled { border-color: #c0c9dc; background: #fafbfd; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chip b { color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2f9a63; box-shadow: 0 0 0 4px rgba(47, 154, 99, .15); }
.dot.offline { background: #a5650b; box-shadow: 0 0 0 4px rgba(194, 123, 18, .18); }
.pill { font-size: 12px; font-weight: 650; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: #e7f3ec; color: #1a6440; }
.pill.wait { background: var(--amber-soft); color: #8a5a0c; }
.pill.grey { background: #e9ebf0; color: var(--ink-2); }

.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.list-row + .list-row { border-top: 1px solid var(--line-2); }
.list-row .ri { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.list-row .t { font-size: 15px; font-weight: 650; }
.list-row .s { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.list-row .end { margin-left: auto; display: flex; align-items: center; gap: 8px; color: #a8b0bf; }

/* sticky bottom bar for the main Save / Confirm on phones */
.savebar { position: sticky; bottom: 0; padding: 14px 0 6px; background: linear-gradient(transparent, var(--bg) 30%); }

@media (max-width: 720px) {
    .top { padding: 10px 12px; }
    .title .page { font-size: 16px; }
    .tbtn .lbl { display: none; }
    .wrap { padding: 18px 16px 32px; }
    .h1 { font-size: 22px; }
    .hide-phone { display: none !important; }
}
@media (min-width: 721px) { .hide-desk { display: none !important; } }


/* ---------- apps: every app in its own colour ---------- */
.cucuReg { --c: #1f7a4d; --cs: #e6f3ec; }
.tomato { --c: #a82f3f; --cs: #fbe9eb; }
.irri { --c: #1d62a8; --cs: #e5eff9; }
.inventory { --c: #454a92; --cs: #ecedf8; }
.daily { --c: #6b2d5c; --cs: #f5eaf2; }
.photos { --c: #14566b; --cs: #e6f1f4; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 650; white-space: nowrap; background: var(--cs, #e9ebf0); color: var(--c, #4b5364); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.msg { padding: 12px 14px; border-radius: 12px; font-size: 14.5px; line-height: 1.45; font-weight: 600; background: var(--amber-soft); color: #74490a; }
.msg.bad { background: var(--danger-soft); color: #8f2f20; }
.msg.ok { background: #e7f3ec; color: #1a6440; }
.msg[hidden], [hidden] { display: none !important; }
/* password box with show / hide */
.pw { position: relative; display: block; }
.pw .input { padding-right: 62px; }
.pw button { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border: none; border-radius: 10px; background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; }
.pw button.on { color: var(--accent); background: var(--accent-soft); }
textarea.input { height: auto; min-height: 130px; padding: 14px 16px; line-height: 1.5; resize: vertical; }
.input.text, textarea.input { font-size: 16px; font-weight: 550; }
select.input { font-size: 16px; font-weight: 600; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23666f80' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 42px; }
.stack { display: grid; gap: 18px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: #e6e9ef; }
.seg button { height: 48px; border: none; border-radius: 11px; background: none; font-size: 15px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(25, 29, 38, .14); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.shots .rm { position: absolute; right: 5px; top: 5px; width: 32px; height: 32px; border: none; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.shots .rm svg.i { width: 16px; height: 16px; }
.shots .thumb { cursor: default; }
.add { aspect-ratio: 1; border: 2px dashed #b4bccb; border-radius: 12px; background: #fff; color: var(--accent); font-size: 13px; font-weight: 650; display: grid; place-content: center; justify-items: center; gap: 4px; cursor: pointer; }
.pop.wide { max-width: 460px; text-align: left; max-height: calc(100vh - 40px); overflow-y: auto; }
.pop.wide h2 { font-size: 22px; }
.pop p.txt { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.help { display: block; margin: 22px auto 0; padding: 12px 16px; border: none; background: none; color: var(--accent); font-size: 14px; font-weight: 650; cursor: pointer; }

.thumb { position: relative; display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--line); border: none; padding: 0; cursor: pointer; width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* popups: save result and delete question */
.veil { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(14, 17, 24, .55); }
.veil:not(.show) { display: none; }
.pop { width: 100%; max-width: 340px; padding: 28px 22px 22px; border-radius: 22px; background: #fff; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.pop .ic { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: #e7f3ec; color: #1f7a4d; }
.pop .ic svg.i { width: 36px; height: 36px; stroke-width: 2.2; }
.pop .ic.bad { background: var(--danger-soft); color: var(--danger); }
.pop .ic.busy { background: var(--accent-soft); color: var(--accent); }
.pop h2 { font-size: 24px; font-weight: 750; }
.pop .where { margin-top: 6px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.pop .note { margin-top: 14px; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; line-height: 1.4; background: var(--bg); color: var(--ink-2); }
.pop .foot { margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.pop .btn { width: 100%; margin-top: 10px; }
.pop .btn.first { margin-top: 18px; }
.btn.red { background: var(--danger); border-color: var(--danger); color: #fff; }
a.back, a.btn { text-decoration: none; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.btn:disabled, .tbtn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.pop { max-height: calc(100vh - 40px); overflow-y: auto; }
.msg { overflow-wrap: anywhere; }
.msg.info { background: var(--accent-soft); color: var(--accent-dark); }
/* radio buttons shown as one row of choices */
.seg label { height: 48px; border-radius: 11px; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 15px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.seg input, .add input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label:has(input:checked) { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(25, 29, 38, .14); }
.seg label:has(input:focus-visible), .add:has(input:focus-visible) { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.add { position: relative; text-align: center; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; display: inline-block; flex: none; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 60; left: 50%; top: 80px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--accent-dark); color: #fff; font-size: 15px; font-weight: 600; line-height: 1.4; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: none; }
.toast.show { display: block; }
.toast.success { background: #1f6b43; }
.toast.error { background: var(--danger); }
.toast.warning { background: #7c4d08; }
/* the login box from sessionGuard.js (that file is the same in every app), in this app's colours */
.sg-backdrop .sg-card { border-radius: 22px; padding: 26px 22px 22px; }
.sg-backdrop .sg-title { font-size: 22px; color: var(--ink); }
.sg-backdrop .sg-text { font-size: 15px; color: var(--ink-2); }
.sg-backdrop .sg-field input { height: 56px; border-radius: 12px; border: 1.5px solid var(--line); }
.sg-backdrop .sg-btn { min-height: 52px; border-radius: 14px; }
.sg-backdrop .sg-primary { background: var(--accent); }
.field label.add { display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--accent); }
