/* Majesty Grading — shell styling.
   MudBlazor carries the components; this file carries the identity: the login
   screen, the page furniture, and the few table cues a grader reads all day. */

:root {
    --mg-red: #9B1B24;
    --mg-ink: #2A2422;
    --mg-dim: #6B5F5A;
    --mg-line: #E7E1DC;
    --mg-bg: #F7F5F3;
}

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    color: var(--mg-ink);
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(155, 27, 36, .16), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(31, 111, 84, .14), transparent 55%),
        #14100E;
    display: grid;
    place-items: center;
}

.login-shell { width: 100%; max-width: 420px; padding: 24px; }

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
}

.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }

.login-mark, .mg-mark {
    display: grid; place-items: center;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--mg-red);
    color: #fff;
    font-weight: 700; letter-spacing: .5px;
}

.login-brand h1 { margin: 0; font-size: 1.15rem; font-weight: 650; }
.login-brand p { margin: 2px 0 0; font-size: .8rem; color: var(--mg-dim); }

.login-label { font-size: .78rem; font-weight: 600; color: var(--mg-dim); margin-bottom: 6px; }

.login-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 13px;
    margin-bottom: 18px;
    border: 1px solid var(--mg-line);
    border-radius: 9px;
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.login-input:focus {
    outline: none;
    border-color: var(--mg-red);
    box-shadow: 0 0 0 3px rgba(155, 27, 36, .12);
}

.login-remember {
    display: flex; align-items: center; gap: 8px;
    font-size: .84rem; color: var(--mg-dim); margin-bottom: 22px;
}

.login-button {
    padding: 12px;
    border: 0; border-radius: 9px;
    background: var(--mg-red); color: #fff;
    font-size: .95rem; font-weight: 650; font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .05s;
}

.login-button:hover { background: #841720; }
.login-button:active { transform: translateY(1px); }

.login-error {
    background: #FDECEC;
    border: 1px solid #F5C2C2;
    color: #8A1F1F;
    border-radius: 9px;
    padding: 10px 13px;
    font-size: .85rem;
    margin-bottom: 18px;
}

.login-foot {
    margin: 22px 0 0;
    text-align: center;
    font-size: .74rem;
    color: var(--mg-dim);
}

/* ── Shell ──────────────────────────────────────────────────────────────── */
.mg-brand { display: flex; align-items: center; gap: 10px; margin-left: 4px; }
.mg-mark { width: 32px; height: 32px; border-radius: 9px; font-size: .78rem; }
.mg-brand-text { font-size: 1rem; font-weight: 500; letter-spacing: -0.01em; }
.mg-brand-text strong { font-weight: 700; }

.mg-appbar { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.mg-lab-switch { margin-right: 8px; }
.mg-main { background: var(--mg-bg); min-height: 100vh; }
.mg-nav { padding-top: 8px; }

/* ── Page furniture ─────────────────────────────────────────────────────── */
.mg-page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}

.mg-title { margin: 0; font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; }
.mg-subtitle { margin: 4px 0 0; font-size: .875rem; color: var(--mg-dim); }

.mg-panel { border: 1px solid var(--mg-line); border-radius: 12px; overflow: hidden; background: #fff; }

.mg-toolbar {
    display: flex; gap: 12px; padding: 14px;
    border-bottom: 1px solid var(--mg-line); flex-wrap: wrap;
}

.mg-search { flex: 1 1 320px; }
.mg-date { flex: 0 0 170px; }

/* ── Stat cards double as the status filter ─────────────────────────────── */
.mg-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 20px;
}

.mg-stat {
    display: flex; flex-direction: column; gap: 4px;
    padding: 16px 18px; text-align: left;
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s, transform .05s;
}

.mg-stat:hover { border-color: #CFC6BF; box-shadow: 0 2px 10px rgba(0, 0, 0, .05); }
.mg-stat:active { transform: translateY(1px); }

.mg-stat.is-active {
    border-color: var(--mg-red);
    box-shadow: inset 0 0 0 1px var(--mg-red);
}

.mg-stat-value { font-size: 1.6rem; font-weight: 680; letter-spacing: -0.02em; line-height: 1; }
.mg-stat-label { font-size: .78rem; color: var(--mg-dim); font-weight: 500; }

/* ── Table ──────────────────────────────────────────────────────────────── */
.mg-table .mg-row { cursor: pointer; }
.mg-mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mg-dim { color: var(--mg-dim); }

/* An FM figure that disagrees with the loading point is the single most
   important thing on this screen — it is the only red in the table. */
.mg-fm-flag {
    color: var(--mg-red);
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(155, 27, 36, .08);
}

.mg-empty {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 64px 24px; color: var(--mg-dim);
}

.mg-empty p { margin: 0; font-size: .9rem; }

/* ── Blazor's built-in error strip ──────────────────────────────────────── */
#blazor-error-ui {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    background: #FDECEC; border-top: 1px solid #F5C2C2;
    color: #8A1F1F; padding: 12px 20px; font-size: .875rem;
}

#blazor-error-ui .dismiss { cursor: pointer; float: right; font-size: 1.2rem; line-height: 1; }
#blazor-error-ui .reload { color: #8A1F1F; text-decoration: underline; margin-left: 8px; }

/* ── Load detail ────────────────────────────────────────────────────────── */
.mg-back { font-size: .82rem; color: var(--mg-dim); text-decoration: none; }
.mg-back:hover { color: var(--mg-red); }
.mg-title-sep { color: var(--mg-line); margin: 0 8px; font-weight: 300; }
.mg-head-chips { display: flex; gap: 8px; align-items: center; }

.mg-panel-head {
    display: flex; align-items: baseline; gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--mg-line);
    font-size: .78rem; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--mg-dim);
}

.mg-panel-note { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .75; }

/* Label/value pairs — one per row, so a long customer name never collides
   with the next field the way a two-column grid does. */
.mg-fact { display: flex; gap: 16px; padding: 9px 16px; border-bottom: 1px solid #F3EFEC; }
.mg-fact:last-child { border-bottom: 0; }
.mg-fact-label { flex: 0 0 140px; font-size: .8rem; color: var(--mg-dim); }
.mg-fact-value { flex: 1; font-size: .875rem; }
.mg-fact-value em { color: var(--mg-dim); font-style: normal; font-size: .8rem; }

/* ── Mass strip ─────────────────────────────────────────────────────────── */
.mg-mass { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.mg-mass-cell {
    display: flex; flex-direction: column; gap: 5px;
    padding: 16px; border-right: 1px solid var(--mg-line);
}

.mg-mass-cell:last-child { border-right: 0; }
.mg-mass-cell-final { background: #FBF8F6; }
.mg-mass-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mg-dim); }

.mg-mass-value {
    font-size: 1.28rem; font-weight: 650;
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}

.mg-mass-value em { font-size: .72rem; font-style: normal; color: var(--mg-dim); margin-left: 3px; }
.mg-mass-delta { font-size: .72rem; color: var(--mg-red); }

/* ── Capture ────────────────────────────────────────────────────────────── */
.mg-effective {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 8px 0; border-top: 1px solid #F3EFEC;
    font-size: .84rem; color: var(--mg-dim);
}

.mg-effective strong { color: var(--mg-ink); font-size: .95rem; font-variant-numeric: tabular-nums; }

/* ── Lab table ──────────────────────────────────────────────────────────── */
.mg-lab { width: 100%; border-collapse: collapse; font-size: .85rem; }
.mg-lab th {
    text-align: left; padding: 9px 16px;
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--mg-dim); font-weight: 600;
    border-bottom: 1px solid var(--mg-line);
}
.mg-lab td { padding: 9px 16px; border-bottom: 1px solid #F3EFEC; }
.mg-lab tr:last-child td { border-bottom: 0; }

.mg-pill {
    display: inline-block; padding: 2px 8px; border-radius: 20px;
    font-size: .72rem; font-weight: 600; white-space: nowrap;
}

.mg-pill-ok   { background: rgba(31, 111, 84, .1);  color: #1F6F54; }
.mg-pill-bad  { background: rgba(155, 27, 36, .1);  color: var(--mg-red); }
.mg-pill-none { background: #F3EFEC;                color: var(--mg-dim); }

.mg-lab-foot { padding: 10px 16px; font-size: .78rem; color: var(--mg-dim); background: #FBF8F6; }

/* ── History ────────────────────────────────────────────────────────────── */
.mg-history { list-style: none; margin: 0; padding: 0; }
.mg-history li {
    display: flex; flex-direction: column; gap: 2px;
    padding: 11px 16px; border-bottom: 1px solid #F3EFEC;
}
.mg-history li:last-child { border-bottom: 0; }
.mg-history-when { font-size: .72rem; color: var(--mg-dim); font-variant-numeric: tabular-nums; }
.mg-history-what { font-size: .85rem; }
.mg-history-who  { font-size: .75rem; color: var(--mg-dim); }

.mg-empty-sm { padding: 28px 16px; }

.mg-tiny { font-size: .72rem; }

/* ── People (admin) ─────────────────────────────────────────────────────── */
.mg-user-name { font-weight: 600; display: flex; align-items: center; gap: 7px; }

/* Marks the signed-in administrator in their own list, so the disabled
   "deactivate" button reads as deliberate rather than broken. */
.mg-you {
    font-size: .64rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    padding: 1px 6px; border-radius: 20px;
    background: rgba(155, 27, 36, .1); color: var(--mg-red);
}

.mg-role { padding: 2px 0 8px; }

.mg-role-help {
    font-size: .76rem; color: var(--mg-dim);
    margin: -6px 0 0 34px; line-height: 1.35;
}

/* ── Grading sheet ──────────────────────────────────────────────────────── */
.mg-grade td { vertical-align: middle; }
.mg-grade td:first-child { max-width: 420px; line-height: 1.35; }

/* A breached tolerance is the whole point of the sheet, so it is the only
   colour on it — the same red the queue uses for a disputed FM figure. */
.mg-over { background: rgba(155, 27, 36, .05); }
.mg-over td:first-child { font-weight: 600; }

.mg-num { max-width: 110px; }
.mg-num .mud-input-slot { text-align: right; font-variant-numeric: tabular-nums; }

.mg-seed-group { border-top: 1px solid var(--mg-line); }

.mg-seed-head {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 11px 16px 4px;
    font-size: .78rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: var(--mg-dim);
}

.mg-seed-head span:last-child { text-transform: none; letter-spacing: 0; font-weight: 500; }

.mg-seed-foot {
    display: flex; gap: 14px; align-items: center;
    padding: 9px 16px; background: #FBF8F6;
    font-size: .8rem; color: var(--mg-dim);
    font-variant-numeric: tabular-nums;
}

.mg-limit-note { flex: 0 0 auto; font-size: .8rem; color: var(--mg-dim); white-space: nowrap; }

/* The findings panel follows the grader down a long sheet — the conclusion is
   what they are working towards, so it should never scroll out of sight. */
.mg-sticky { position: sticky; top: 88px; }

/* Email preview — the notice is rendered with its own inline styles, so this
   only needs to give it a page to sit on. */
.mg-email-preview {
    background: #fff;
    border: 1px solid var(--mg-line);
    border-radius: 8px;
    padding: 20px;
    max-height: 60vh;
    overflow: auto;
}

/* ── Submit confirmation ────────────────────────────────────────────────── */
.mg-submit-list { margin: 0; padding-left: 20px; font-size: .875rem; line-height: 1.6; }

.mg-submit-findings {
    margin-top: 8px; padding: 10px 12px;
    background: #FBF8F6; border: 1px solid var(--mg-line); border-radius: 8px;
    font-size: .82rem; line-height: 1.55; font-variant-numeric: tabular-nums;
}
