:root {
    /* = the logo's own background colour, so the logo melts into the header
       (MILL app header standard, H1). Never change one without the other. */
    --brand: #083030;
    --brand-soft: #19524b;
    --accent: #c9a96e;
    --bg: #f6f7f6;
    --surface: #ffffff;
    --border: #d8ddd9;
    --text: #1c2421;
    --muted: #5b6661;
    --danger: #c0392b;
    --ok: #2e7d4f;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
    --max-w: 720px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    padding-bottom: 72px;
}

/* ---- Header: MILL app header standard (Field Control Panel/standards/
   app-header, owner 2026-10-01). Identical in every MILL app. ---- */
.app-header {
    background: var(--brand);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-logo { height: 48px; width: auto; display: block; }   /* height only, never width */
.brand-sub  { font-weight: 700; letter-spacing: .15em; font-size: 14px; opacity: .95; text-transform: uppercase; }
.header-right { display: flex; align-items: center; gap: 8px; }
.hi-name { color: #fff; font-size: 13px; opacity: .85; margin-right: 8px; }
#back-nav a {
    color: #fff;
    background: rgba(255,255,255,.12);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
}
#lang-toggle {
    font: inherit;   /* buttons don't take the page font on their own */
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,.35);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    cursor: pointer;
}
/* Phones (screens up to 560 px wide). */
@media (max-width: 560px) {
    .app-header { padding: 10px 12px; }
    .brand { gap: 8px; }
    .brand-logo { height: 34px; }
    .brand-sub { font-size: 11px; letter-spacing: .1em; line-height: 1.2; }
    .hi-name { display: none; }
}

/* ---- Main ---- */
main {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 16px;
}

h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

/* ---- Home tiles ---- */
.tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 14px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-height: 110px;
    justify-content: center;
}
.tile:active { transform: scale(0.98); }
.tile .icon { font-size: 28px; line-height: 0; }
/* Inline SVG icons render on every machine even when emoji fonts are missing. */
.tile .icon svg { width: 32px; height: 32px; display: block; }
.tile .label { font-weight: 600; }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.tile.primary .sub { color: rgba(255,255,255,.75); }

/* ---- Forms ---- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea, button {
    font: inherit;
    color: inherit;
}
input[type=text], input[type=number], input[type=password], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 12px;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

button, .btn {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    border: 0;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
}
button.secondary, .btn.secondary {
    background: #fff;
    color: var(--brand);
    border: 1px solid var(--brand);
}
button.danger { background: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* ---- Register grid ---- */
.grid-table { width: 100%; }
.grid-table th { font-size: 11px; }
.grid-table input, .grid-table select {
    margin: 0;
    padding: 6px 8px;
    border-radius: 6px;
}
.grid-table td { padding: 4px; vertical-align: top; }
.grid-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Tags / pills ---- */
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: #e9efed;
    color: var(--brand);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tag.leftover { background: #f8efd8; color: #8a6d1c; }

/* ---- Footer nav ---- */
.app-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 4px env(safe-area-inset-bottom);
    z-index: 10;
}
.app-footer a {
    text-decoration: none;
    color: var(--muted);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
}
.app-footer a.active { color: var(--brand); font-weight: 700; }

/* ---- Misc ---- */
.muted { color: var(--muted); font-size: 13px; }
.bar-id { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.toast {
    position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
    background: var(--brand); color: #fff; padding: 10px 16px;
    border-radius: 999px; box-shadow: var(--shadow); z-index: 20;
    font-size: 14px;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

.warning-banner {
    background: var(--danger);
    color: #fff;
    padding: 14px 16px;
    border-radius: var(--radius);
    margin: 12px 0;
    box-shadow: var(--shadow);
}
.warning-banner .warning-title {
    display: block;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.warning-banner .warning-body { font-size: 14px; line-height: 1.4; }

#qr-reader { width: 100%; max-width: 480px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }

/* ---- Auth pages (login + first-run setup) ---- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-soft) 100%);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
}
.auth-brand {
    text-align: center;
    margin-bottom: 20px;
}
.auth-brand-logo {
    display: block;
    width: 70%;
    max-width: 220px;
    margin: 0 auto 10px;
    border-radius: 8px;
}
.auth-brand-mark {
    font-weight: 800;
    letter-spacing: .15em;
    font-size: 28px;
    color: var(--brand);
}
.auth-brand-sub {
    font-weight: 300;
    letter-spacing: .2em;
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    margin-top: 2px;
}
.auth-card input {
    margin-bottom: 18px;
}
.auth-card label {
    margin-top: 8px;
}
.auth-card button {
    margin-top: 28px;
}

.scanner-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .9);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

/* Laporan Barang Jadi (owner, 2026-10-12; RULES G1-G5): the waiting count
   on its tile, and its table of types. */
.tile { position: relative; }
.tile-count { position: absolute; top: 8px; right: 10px; min-width: 22px; padding: 1px 7px; border-radius: 99px;
              background: #c0392b; color: #fff; font-size: 13px; font-weight: 700; text-align: center; }
table.lbj-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lbj-table th, table.lbj-table td { border-bottom: 1px solid #e3e7e5; padding: 6px 8px; text-align: left; vertical-align: top; }
table.lbj-table th { background: #f1f4f2; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
/* Live updates (owner, 2026-10-13): shown instead of redrawing over someone's work. */
.live-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 78px; z-index: 60; margin: 0;
            padding: 10px 18px; border-radius: 99px; border: 0; background: #083030; color: #fff; font-weight: 700;
            box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; font-size: 14px; }

/* The 🔔 of master gudang and the Director (owner, 2026-10-20) */
#back-nav a.bell { position: relative; padding: 4px 10px; margin-right: 8px; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 0 5px; border-radius: 99px;
    background: #c62828; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
/* An add-on from the Production Control Panel, in a list */
.pcp-addon-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0;
    border-top: 1px solid #eee; color: inherit; text-decoration: none; }
