/*
 * Supplier PO Portal stylesheet.
 *
 * Colours and type follow our Metropolitan presentation template:
 * espresso and near-black for structure and text, bronze gold for the
 * primary actions and highlights, muted teal as the secondary band colour,
 * with content on white. One local file, no frameworks and nothing pulled
 * from a CDN, which keeps the CSP strict and the page easy to audit.
 */

:root {
    --ink: #231F20;         /* near-black used for body text in the deck */
    --espresso: #332E20;    /* dark band colour */
    --gold: #AF7A38;        /* bronze band / primary accent */
    --gold-dark: #8F6229;   /* hover state for gold actions */
    --teal: #4E868F;        /* footer band / secondary accent */
    --teal-dark: #3E6C74;
    --muted: #6E6759;
    --line: #D9D4CA;
    --paper: #F7F5F1;       /* warm off-white page background */
    --card: #FFFFFF;
    --ok-bg: #EEF4EF;
    --ok-ink: #2C5F2D;
    --err-bg: #FBEFEA;
    --err-ink: #8C3A22;
    --warn-bg: #F8F1E4;
    --warn-ink: #7A5518;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    /* Acumin Pro is the brand face; the rest of the stack covers machines
       that do not have it installed. */
    font-family: "Acumin Pro", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
}

/* --- masthead: white band, logo top-left ------------------------------ */

.masthead {
    background: #FFFFFF;
    border-bottom: 1px solid var(--line);
}
.masthead-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.logo-link { display: inline-flex; align-items: center; }
.logo { display: block; height: 23px; width: auto; }
.app-title {
    color: var(--muted);
    font-size: 14px;
    letter-spacing: .12em;
    text-transform: uppercase;
    border-left: 1px solid var(--line);
    padding-left: 18px;
}
.userbox { margin-left: auto; display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 14px; }
.userbox a { color: var(--gold-dark); text-decoration: none; font-weight: 600; }
.userbox a:hover { color: var(--gold); }

/* --- navigation: espresso band, as in the deck's header --------------- */

.navband { background: var(--espresso); }
.navband-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 26px;
}
.navband a {
    color: #E9E4DA;
    text-decoration: none;
    padding: 11px 2px 9px;
    border-bottom: 2px solid transparent;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .02em;
}
.navband a:hover { color: #FFFFFF; border-bottom-color: var(--gold); }

/* --- layout ----------------------------------------------------------- */

.container { max-width: 1240px; margin: 24px auto 60px; padding: 0 20px; }

.footer { background: var(--teal); margin-top: 40px; }
.footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 12px 20px;
    color: #F2F6F6;
    font-size: 13px;
}
.footer p { margin: 0; }

h1 { font-size: 22px; margin: 0 0 4px; color: var(--ink); }
h2 { font-size: 17px; margin: 26px 0 8px; }
.subtitle { color: var(--muted); margin: 0 0 18px; }

/* --- flash banners ------------------------------------------------------ */

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 18px; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); color: var(--ok-ink); border-color: #BDD5BE; }
.flash-error   { background: var(--err-bg); color: var(--err-ink); border-color: #E8C4B4; }
.flash-warning { background: var(--warn-bg); color: var(--warn-ink); border-color: #E3CFA4; }

/* --- toolbar (sort switch etc.) --------------------------------------- */

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }
.sortswitch a {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
}
.sortswitch a:first-child { border-radius: 6px 0 0 6px; }
.sortswitch a:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.sortswitch a.active { background: var(--espresso); border-color: var(--espresso); color: #fff; }

/* --- mill/PO cards ------------------------------------------------------ */

.millhead {
    margin: 30px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--gold);
    font-size: 18px;
    font-weight: 700;
    color: var(--espresso);
}
.po-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 18px;
    overflow: hidden;
}
.po-card-head {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: #F1EDE6;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.po-card-head .po-no { font-weight: 700; font-size: 15px; color: var(--espresso); }
.po-card-head span { color: var(--muted); }
.po-card-head strong { color: var(--ink); font-weight: 600; }

/* --- tables ---------------------------------------------------------- */

table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { padding: 8px 9px; text-align: left; border-bottom: 1px solid #EBE7DF; }
th {
    background: var(--espresso);
    color: #E9E4DA;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }

.status-pill {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #EFE5D5;
    color: var(--gold-dark);
    font-size: 12px;
    font-weight: 700;
}

/* --- forms ---------------------------------------------------------- */

input[type=text], input[type=password], input[type=date], input[type=email], select {
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.btn {
    display: inline-block;
    padding: 9px 18px;
    background: var(--gold);
    color: #fff;
    border: none;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--gold-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: #F1EDE6; }

.submitbar {
    position: sticky;
    bottom: 0;
    background: var(--card);
    border-top: 2px solid var(--gold);
    padding: 12px 16px;
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 24px;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 12px rgba(35, 31, 32, .08);
}
.submitbar .hint { color: var(--muted); font-size: 13px; }

/* --- auth card ---------------------------------------------------------- */

.auth-card {
    max-width: 400px;
    margin: 70px auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 4px solid var(--gold);
    border-radius: 10px;
    padding: 30px;
}
.auth-card h1 { margin-bottom: 18px; }
.auth-card label { display: block; margin: 14px 0 5px; font-weight: 600; font-size: 14px; }
.auth-card input { width: 100%; }
.auth-card .btn { width: 100%; margin-top: 20px; }

/* --- result rows on the confirmation screen --------------------------- */

.result-ok  { color: var(--ok-ink); font-weight: 600; }
.result-err { color: var(--err-ink); font-weight: 600; }
.date-changed { background: var(--warn-bg); }

/* --- mill filter + last-changed-by column ----------------------------- */

.millfilter { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.millfilter label { font-weight: 600; font-size: 14px; color: var(--muted); }

.lastchange { white-space: nowrap; }
.lastchange .when { display: block; color: var(--muted); font-size: 12px; }

/* --- portal-only tracking fields on the PO list ------------------------ */

.cell-booked select { max-width: 112px; }

.cell-status select { max-width: 132px; }
.cell-note { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.cell-update { min-width: 196px; }
.cell-update input[type=date], .cell-update select, .cell-update input[type=text] {
    display: block;
    width: 100%;
    margin-bottom: 5px;
}
.cell-update input[type=text] { font-size: 13px; }

/* A reason dropdown that still needs a value once a date is entered. */
select.needs-value { border-color: #B1483F; outline: 2px solid #E8C4B4; }

.cell-product { min-width: 170px; }
.cell-product .item-main { display: block; font-weight: 600; }
