/* Maes Industries — Public Portal · components & shell (mature redesign)
   Faithful to maesindustries.be: white header + real logo, red accent rule,
   navy headings (Source Sans Pro), azure = cooling/F-gas accent, red = sharp accent. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--fs-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header (white, like the Maes site) ---------------------------------- */
.hdr { background: #fff; }
.hdr-in {
    max-width: var(--maxw); margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
    padding: 15px 22px;
}
.brandmark { display: inline-flex; }
.brandmark img { height: 30px; display: block; }
.hdr .spacer { flex: 1; }
.hdr-meta { text-align: right; line-height: 1.3; }
.hdr-meta .label {
    font-size: 11.5px; font-weight: 700; letter-spacing: .8px;
    text-transform: uppercase; color: var(--muted);
}
.hdr-meta .ver { font-size: 11px; color: var(--muted); opacity: .75; }

/* Language switch (segmented) + right cluster */
.hdr-right { display: flex; align-items: center; gap: 14px; }
.lang {
    display: inline-flex; border: 1px solid var(--line-strong);
    border-radius: 999px; overflow: hidden; background: #fff;
}
.lang-btn {
    appearance: none; border: 0; background: transparent; cursor: pointer;
    font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: .3px;
    color: var(--muted); padding: 5px 11px; line-height: 1;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn.active { background: var(--brand); color: #fff; }

/* The Maes red divider under the chrome. */
.accent-rule { height: 3px; background: var(--red); }

/* ---- Page container ------------------------------------------------------ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 22px 10px; }

.eyebrow {
    font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--azure-ink);
    display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px;
}
.eyebrow::before { content: ""; width: 16px; height: 2px; background: var(--red); border-radius: 2px; }

/* ---- Asset passport (hero) ----------------------------------------------- */
.passport {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: var(--shadow);
    padding: 24px 26px; margin: 0 0 18px;
}
.passport .top { display: flex; align-items: flex-start; gap: 18px; }
.passport .headings { flex: 1; min-width: 0; }
.passport h1 {
    margin: 2px 0 3px; font-size: 27px; font-weight: 700;
    color: var(--ink-strong); letter-spacing: -.3px; line-height: 1.15;
}
.passport .model { color: var(--muted); font-size: 15px; }

.status-chip {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 9px;
    padding: 9px 15px; border-radius: 11px; font-weight: 700; font-size: 13.5px;
    border: 1px solid transparent; white-space: nowrap;
}
.status-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status-chip.ok   { background: #e9f6ef; color: #16794a; border-color: #cdebd9; }
.status-chip.warn { background: #fff4e3; color: #96620a; border-color: #f2ddba; }
.status-chip.err  { background: #fdeceb; color: #b3281f; border-color: #f3cdca; }

.identity {
    margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; gap: 16px 36px;
}
.identity .k {
    font-size: 11px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--muted);
}
.identity .v { font-size: 15px; color: var(--ink-strong); margin-top: 2px; }
.identity .v.mono { font-variant-numeric: tabular-nums; letter-spacing: .3px; }

/* ---- Section cards ------------------------------------------------------- */
.section {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: 14px; box-shadow: var(--shadow);
    padding: 22px 26px; margin: 0 0 18px;
}
.section > h2 {
    margin: 0 0 18px; font-size: 16px; font-weight: 700; color: var(--ink-strong);
    display: flex; align-items: center; gap: 10px;
}
.section > h2 .ic { color: var(--azure-ink); display: inline-flex; flex: 0 0 auto; }

/* ---- Spec grid (refrigerant / F-gas) ------------------------------------- */
.specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 22px; }
.spec .k {
    font-size: 11px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--muted);
}
.spec .v { font-size: 18px; font-weight: 600; color: var(--ink-strong); margin-top: 3px; }
.spec.highlight {
    grid-column: span 1; background: var(--azure-tint);
    border: 1px solid #cdeaf7; border-radius: 10px; padding: 10px 12px; margin: -10px -12px;
}
.spec.highlight .k { color: var(--azure-ink); }
.spec.highlight .v { color: var(--azure-ink); }

/* ---- Maintenance timeline ------------------------------------------------ */
.timeline { margin: 2px 0 0; }
.tl-item { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--line); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item .node {
    position: absolute; left: -7px; top: 3px; width: 12px; height: 12px;
    border-radius: 50%; background: #fff; border: 2px solid var(--brand); box-shadow: 0 0 0 3px #fff;
}
.tl-item.install .node { border-color: var(--azure); }
.tl-item.leak .node    { border-color: var(--ok); }
.tl-item.repair .node  { border-color: var(--red); }
.tl-item.maint .node   { border-color: var(--warn); }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-date { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-type {
    font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
    padding: 2px 9px; border-radius: 999px; background: #eef2f5; color: var(--ink);
}
.tl-type.install { background: var(--azure-tint); color: var(--azure-ink); }
.tl-type.leak    { background: #e8f6ee; color: var(--ok); }
.tl-type.repair  { background: #fdeceb; color: #b3281f; }
.tl-type.maint   { background: #fff4e3; color: #96620a; }
.tl-note { margin-top: 4px; font-size: 14.5px; color: var(--ink); }

/* ---- Footer -------------------------------------------------------------- */
.foot { border-top: 1px solid var(--line); margin-top: 8px; background: #fff; }
.foot-in { max-width: var(--maxw); margin: 0 auto; padding: 22px 22px 34px; }
.foot-logo { height: 26px; display: block; opacity: .95; margin-bottom: 12px; }
.foot .legal { color: var(--muted); font-size: 12.5px; margin: 0 0 6px; line-height: 1.6; max-width: 62ch; }
.foot .contact { color: var(--muted); font-size: 12.5px; margin: 0; }

/* ---- States -------------------------------------------------------------- */
.state { text-align: center; color: var(--muted); padding: 56px 16px; }
.state .big { font-size: 18px; font-weight: 700; color: var(--ink-strong); margin-bottom: 6px; }

/* ---- Landing (no QR code in the link) ----------------------------------- */
.landing { text-align: center; max-width: 480px; margin: 20px auto; padding: 8px 16px; }
.landing .eyebrow { justify-content: center; }
.landing-title { font-size: 26px; line-height: 1.2; color: var(--ink-strong); margin: 2px 0 8px; }
.landing-intro { color: var(--muted); font-size: 15px; margin: 0 auto 22px; max-width: 420px; }
.qr-card {
    display: inline-block; margin: 0 auto; padding: 16px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.qr-card .qr-img { display: block; width: 260px; height: auto; max-width: 70vw; }
.qr-card figcaption { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.landing-actions { margin-top: 22px; }
.landing-cta { display: inline-flex; }

/* ---- Device QR (on the asset page) -------------------------------------- */
.device-qr {
    display: flex; align-items: center; gap: 16px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
}
.device-qr img { width: 130px; height: 130px; flex: 0 0 auto; border-radius: 8px; }
.device-qr-txt .t { font-weight: 700; color: var(--ink-strong); font-size: 15px; }
.device-qr-txt .s { color: var(--muted); font-size: 13px; margin-top: 4px; }
@media (max-width: 480px) {
    .device-qr { flex-direction: column; text-align: center; }
}

/* ---- Not found / invalid QR --------------------------------------------- */
.state.notfound {
    max-width: 440px; margin: 32px auto; padding: 40px 24px;
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.state.notfound .nf-icon {
    width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 16px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-tint); color: var(--brand);
}
.state.notfound .nf-icon svg { width: 30px; height: 30px; }
.state.notfound .nf-body { color: var(--ink); font-size: 15px; }
.state.notfound .hint { margin-top: 14px; font-size: 13px; color: var(--muted); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 640px) {
    .specs { grid-template-columns: repeat(2, 1fr); }
    .passport .top { flex-direction: column; }
    .passport h1 { font-size: 23px; }
}
@media (max-width: 400px) {
    .specs { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===== Rich content: tabs, stats, table, documents, actions, toast ===== */

/* Tab menu (navy text, red underline = Maes) */
.tabs {
    display: flex; gap: 2px; border-bottom: 1px solid var(--line);
    margin: 0 0 20px; overflow-x: auto;
}
.tab {
    appearance: none; border: 0; background: transparent; cursor: pointer; font-family: var(--font);
    font-size: 13.5px; font-weight: 700; color: var(--muted);
    padding: 11px 15px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--red); }

.panel { display: none; }
.panel.active { display: block; }

/* Overview stat cards */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 0 0 20px; }
.stat-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.stat-card .k { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.stat-card .v { font-size: 17px; font-weight: 700; color: var(--ink-strong); margin-top: 4px; }
.stat-card .v.small { font-size: 15px; font-weight: 600; }

.subhead {
    font-size: 11.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
    color: var(--muted); margin: 6px 0 10px;
}

/* Quick-actions row + actions grid */
.quick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.action {
    display: flex; align-items: center; gap: 12px; border: 1px solid var(--line-strong);
    border-radius: 12px; padding: 13px 15px; background: #fff; cursor: pointer;
    font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--ink);
    text-align: left; text-decoration: none; transition: border-color .12s, background .12s;
}
.action:hover { border-color: var(--brand); background: #f7f9fc; text-decoration: none; }
.action .ic {
    width: 34px; height: 34px; border-radius: 9px; background: var(--brand-tint); color: var(--brand);
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.action.primary { border-color: var(--brand); }
.action.primary .ic { background: var(--brand); color: #fff; }
.action .lbl .t { display: block; }
.action .lbl .s { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 1px; }

/* Events table */
.table-wrap { overflow-x: auto; }
table.events { width: 100%; border-collapse: collapse; font-size: 14px; }
.events th {
    text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    color: var(--muted); padding: 0 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.events td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.events tr:last-child td { border-bottom: 0; }
.events .date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.events .cert { white-space: nowrap; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.events .refr { white-space: nowrap; font-variant-numeric: tabular-nums; }
.res { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; }
.res .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.res.ok { color: var(--ok); }
.res.attention { color: #96620a; }

/* Documents */
.docs { display: flex; flex-direction: column; gap: 10px; }
.doc { display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; }
.doc .ic { width: 32px; height: 32px; border-radius: 8px; background: var(--azure-tint); color: var(--azure-ink);
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.doc .info { flex: 1; min-width: 0; }
.doc .name { font-weight: 600; color: var(--ink-strong); }
.doc .meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.doc .dl {
    appearance: none; border: 1px solid var(--line-strong); background: #fff; border-radius: 8px;
    font-family: var(--font); font-size: 12.5px; font-weight: 700; color: var(--brand);
    padding: 7px 12px; cursor: pointer; white-space: nowrap;
}
.doc .dl:hover { background: var(--brand-tint); }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
    background: var(--ink-strong); color: #fff; padding: 11px 16px; border-radius: 10px;
    font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
    .stats, .actions-grid { grid-template-columns: 1fr; }
}

/* ---- Report a fault (public case form) ---------------------------------- */
.report { max-width: 560px; }
.btn-back {
    display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px;
    color: var(--brand); background: none; border: none; cursor: pointer; padding: 4px 0; margin-bottom: 10px;
}
.btn-back:hover { text-decoration: underline; }
.report-title { font-size: 22px; color: var(--ink-strong); margin: 4px 0 8px; }
.report-intro { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.repform { display: flex; flex-direction: column; gap: 14px; }
.repgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.repgrid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.rep-reporter { font-size: 13px; font-weight: 700; color: var(--ink-strong); margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 13px; font-weight: 600; color: var(--ink-strong); }
.fld input, .fld textarea, .fld select {
    font-family: var(--font); font-size: 14px; color: var(--ink);
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-ctl);
    padding: 10px 12px; width: 100%; box-sizing: border-box;
}
.fld textarea { resize: vertical; min-height: 88px; }
.fld input:focus, .fld textarea:focus, .fld select:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint);
}
.rep-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 2px; }
.rep-actions .action { flex: 0 0 auto; }
.rep-msg { font-size: 13px; color: var(--muted); }
.rep-msg.err { color: var(--err); font-weight: 600; }
.rep-ok { text-align: center; padding: 26px 16px; max-width: 440px; margin: 0 auto; }
.rep-ok-ic {
    width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(31, 157, 85, .12); color: var(--ok);
}
.rep-ok h2 { font-size: 19px; color: var(--ink-strong); margin: 0 0 8px; font-weight: 700; }
.rep-ok-body { color: var(--ink); font-size: 14.5px; margin: 0 0 18px; }
.rep-ref { background: var(--brand-tint); border-radius: var(--radius); padding: 14px 18px; display: inline-block; margin: 0 auto 14px; }
.rep-ref-k { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.rep-ref-v { font-size: 22px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; margin-top: 2px; }
.rep-ok-keep { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

@media (max-width: 640px) {
    .repgrid, .repgrid2 { grid-template-columns: 1fr; }
}
