/* ==========================================================================
   TEXFLOW ERP — Dashboard & shop-floor specific blocks
   ========================================================================== */

.greeting {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.greeting h1 { font-size: 22px; }
.greeting .g-date { font-size: 13px; color: var(--muted); margin-top: 3px; }
.greeting .g-live {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
    padding: 5px 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
}
.greeting .g-live i {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .18);
}

/* ---- Production hero panel ---- */

.prod-hero {
    background: var(--navy);
    border-radius: var(--r-md);
    color: #fff;
    padding: 18px 20px;
    background-image: radial-gradient(700px 300px at 88% -20%, rgba(37, 99, 235, .38), transparent 60%);
}
.prod-hero .ph-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.prod-hero .ph-label {
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #93A8C4;
}
.prod-hero .ph-value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -.025em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.prod-hero .ph-unit { font-size: 13px; font-weight: 500; color: #94A3B8; margin-left: 4px; }
.prod-hero .ph-sub { font-size: 12px; color: #94A3B8; margin-top: 3px; }
.prod-hero .ph-bar {
    height: 14px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .12);
    overflow: hidden;
    margin-top: 16px;
}
.prod-hero .ph-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #22C55E, #4ADE80);
    border-radius: var(--r-pill);
}
.prod-hero .ph-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #94A3B8;
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}
.prod-hero-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 14px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

/* department efficiency tiles */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 10px;
}
.dept-tile {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 11px 12px;
    background: var(--surface);
    color: inherit;
    display: block;
}
.dept-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); color: inherit; }
.dept-tile .d-name {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.dept-tile .d-val {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin: 5px 0 7px;
    letter-spacing: -.02em;
}
.dept-tile .d-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
}

/* material-outside highlight card */
.mo-card {
    border: 1px solid #FDE68A;
    background: linear-gradient(180deg, #FFFBEB, #FFFFFF 62%);
    border-radius: var(--r-md);
    padding: 16px;
}
.mo-figs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0;
    padding: 12px 0;
    border-top: 1px solid #FDE68A;
    border-bottom: 1px solid #FDE68A;
}
.mo-figs .mf-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mo-figs .mf-k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: #92400E; }

/* order risk rows */
.risk-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 84px 132px 72px;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: inherit;
}
.risk-row:last-child { border-bottom: 0; }
.risk-row:hover { background: var(--surface-alt); color: inherit; }
.risk-row .r-id { font-weight: 700; font-size: 13px; }
.risk-row .r-buyer { font-size: 13px; }
.risk-row .r-style { font-size: 11px; color: var(--muted); }
.risk-row .r-due { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.risk-row .r-pct { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }

/* quick action tiles */
.qa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
}
.qa {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
}
.qa:hover { border-color: var(--blue); background: var(--blue-light); color: var(--blue-dark); }
.qa .qa-ico {
    width: 30px; height: 30px;
    border-radius: var(--r);
    background: var(--surface-sunken);
    display: grid;
    place-items: center;
    color: var(--muted);
}
.qa:hover .qa-ico { background: #fff; color: var(--blue); }
.qa .qa-ico svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* live line monitor (MES) */
.line-card {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    overflow: hidden;
}
.line-card .lc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--navy);
    color: #fff;
}
.line-card .lc-head .l-name { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.line-card .lc-body { padding: 12px 14px; }
.line-card .lc-figs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
    margin-bottom: 10px;
}
.line-card .lc-figs .v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.line-card .lc-figs .k { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* funnel / stage cards used in CRM + purchase pipelines */
.stage-flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
    gap: 8px;
}
.stage {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 11px 12px;
    background: var(--surface);
    position: relative;
    color: inherit;
}
.stage:hover { border-color: var(--border-strong); color: inherit; }
.stage .s-n { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stage .s-k { font-size: 11px; color: var(--muted); margin-top: 1px; }
.stage .s-bar { height: 3px; border-radius: 3px; background: var(--blue); margin-top: 9px; }

/* KPI donut row */
.donut-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* aging buckets */
.aging {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}
.aging .ag {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 11px 12px;
    background: var(--surface);
    border-bottom: 3px solid var(--border-strong);
}
.aging .ag.b1 { border-bottom-color: var(--green); }
.aging .ag.b2 { border-bottom-color: #65A30D; }
.aging .ag.b3 { border-bottom-color: var(--amber); }
.aging .ag.b4 { border-bottom-color: #EA580C; }
.aging .ag.b5 { border-bottom-color: var(--red); }
.aging .ag-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.aging .ag-k { font-size: 11px; color: var(--muted); }

/* cost breakdown waterfall-ish rows */
.cost-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 60px;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
}
.cost-row:last-child { border-bottom: 0; }
.cost-row .c-name { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.cost-row .c-name i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.cost-row .c-amt { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.cost-row .c-pct { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cost-row.total {
    border-top: 2px solid var(--navy);
    border-bottom: 0;
    margin-top: 5px;
    padding-top: 11px;
    font-weight: 700;
}
.cost-row.total .c-amt { font-size: 15px; }

/* variance callout */
.variance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--r-md);
    background: var(--surface-sunken);
}
.variance .v-k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.variance .v-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 3px; }

/* reconciliation comparison blocks */
.recon {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 10px;
}
.recon .rc {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px;
    text-align: center;
    background: var(--surface);
}
.recon .rc.bad { border-color: #FECACA; background: var(--red-light); }
.recon .rc.ok  { border-color: #BBF7D0; background: var(--green-light); }
.recon .rc-v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.recon .rc-k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 2px; }

/* scorecard */
.score {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.score-badge {
    width: 76px; height: 76px;
    border-radius: var(--r-lg);
    background: var(--navy);
    color: #fff;
    display: grid;
    place-items: center;
    text-align: center;
    flex: none;
}
.score-badge .sb-v { font-size: 23px; font-weight: 700; line-height: 1; }
.score-badge .sb-k { font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: #94A3B8; margin-top: 3px; }
