/* MTL People — MTL brand theme, the same tokens as WhereAreYou. */
:root {
    --cargo-tank-black: #262626;
    --water-ballast-white: #EBEBEB;
    --marine-blue: #128FA5;
    --marine-blue-hover: #0F7F93;
    --hull-red: #932F3E;
    --north-sea-blue: #7BA1A6;
    --oxidized-orange: #EF8354;

    --page-bg: var(--water-ballast-white);
    --surface: #FFFFFF;
    --text: var(--cargo-tank-black);
    --text-muted: #5F6B6D;
    --border: #D6D6D6;

    --radius: 12px;
    --shadow: 0 1px 3px rgba(38, 38, 38, .12), 0 1px 2px rgba(38, 38, 38, .08);
    --font-head: "Montserrat", "Segoe UI", Arial, sans-serif;
    --font-body: "Source Sans 3", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--page-bg);
    color: var(--text);
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0 0 .6rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; margin-top: .2rem; }
a { color: var(--marine-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }

/* Shell */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.app-header {
    display: flex; align-items: center; gap: .7rem;
    padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.app-header img { height: 30px; width: 30px; }
.app-header .title { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; }
.app-nav { display: flex; gap: .2rem; margin-left: 1rem; }
.app-nav a { padding: .35rem .7rem; border-radius: 999px; color: var(--text-muted); }
.app-nav a.active { background: var(--marine-blue); color: #fff; text-decoration: none; }
.app-content { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

.app-loading, .loading-panel { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 3rem 1rem; }
.spinner { color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-block; font-family: var(--font-body); font-weight: 600; font-size: 1rem;
    border: none; border-radius: var(--radius); padding: .65rem 1rem; cursor: pointer;
    background: var(--marine-blue); color: #fff; transition: background .12s ease;
}
.btn:hover { background: var(--marine-blue-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--marine-blue); border: 1px solid var(--marine-blue); }
.btn.small { font-size: .85rem; padding: .45rem .8rem; }
.btn.danger { background: var(--hull-red); }
.revision-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.revision-actions .error-state { flex-basis: 100%; margin: .3rem 0 0; }
.btn-row label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.btn-row select { font: inherit; font-weight: 400; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 8px; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .8rem 0; }

/* Panels, lists and tables */
.panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); }
.list li { padding: .6rem .9rem; border-bottom: 1px solid var(--border); display: flex; gap: .6rem; align-items: baseline; }
.list li:last-child { border-bottom: none; }
.search { width: 100%; max-width: 420px; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: .8rem; font-size: 1rem; }

.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-family: var(--font-head); font-weight: 600; font-size: .85rem; color: var(--text-muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: var(--water-ballast-white); }
.status-3, .status-4 { background: #e3f3f6; color: var(--marine-blue-hover); }

/* The builder's form */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1.1rem; }
.builder label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
.builder label.check { flex-direction: row; align-items: center; font-weight: 400; }
.builder label.wide { margin-top: 1rem; }
.builder input:not([type=checkbox]), .builder select {
    font: inherit; font-weight: 400; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.builder .hint { font-weight: 400; font-size: .8rem; color: var(--text-muted); }
.kinds { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.rates { margin-bottom: 1rem; }
.unpriced { margin-top: 1rem; }
.unpriced summary { cursor: pointer; font-weight: 600; margin-bottom: .6rem; }

/* Findings from the framework check, shown against their fields */
.findings { list-style: none; margin: .3rem 0 0; padding: 0; font-weight: 400; }
.finding { font-size: .85rem; padding: .3rem .5rem; border-radius: 6px; margin-top: .25rem; border-left: 3px solid; }
.finding.block { background: #fdf5f6; border-color: var(--hull-red); }
.finding.flag { background: #fff8f0; border-color: var(--oxidized-orange); }
.finding-code { font-family: Consolas, monospace; font-size: .75rem; color: var(--text-muted); margin-right: .3rem; }
.field-problem { color: var(--hull-red); font-weight: 400; font-size: .85rem; }
.summary .blocked { color: var(--hull-red); font-weight: 600; }
.summary .clear { color: var(--marine-blue-hover); font-weight: 600; }

.notice { background: #fff8f0; border: 1px solid var(--oxidized-orange); border-radius: var(--radius); padding: .7rem .9rem; margin: 1rem auto 0; max-width: 1000px; width: calc(100% - 2rem); }

/* Failed API calls (ErrorState.razor): a panel that replaces a screen, or an inline strip. */
.error-state {
    display: flex; gap: .7rem; align-items: flex-start;
    border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem;
    background: var(--surface); border: 1px solid var(--border);
}
.error-state.problem { background: #fdf5f6; border-color: var(--hull-red); }
.error-state.panel { padding: 1.5rem 1.2rem; }
.error-state.inline { padding: .6rem .75rem; font-size: .9rem; }
.error-mark { font-size: 1.15rem; line-height: 1.4; flex: none; }
.error-title { font-family: var(--font-head); font-weight: 600; margin: 0; }
.error-detail { color: var(--text-muted); margin: .2rem 0 0; }
.error-state .btn.small { margin-top: .7rem; }

#blazor-error-ui {
    background: var(--hull-red); color: #fff; bottom: 0; display: none; left: 0; right: 0;
    padding: .8rem 1rem; position: fixed; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .8rem; }
#blazor-error-ui a { color: #fff; text-decoration: underline; }

.who { margin-left: auto; }
.add-candidate summary { cursor: pointer; font-weight: 600; }
.add-candidate input, .candidate input { font: inherit; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 8px; }
.candidate .status { margin-right: .4rem; }

/* Pay context (builder): who HR compares with when choosing a band. */
.pay-context-table { font-size: .9rem; }
.pay-context-table tr.proposed td { background: #e3f3f6; }
.pay-context-table tr.self td { font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; padding: .05rem .45rem; margin: 0 .2rem .2rem 0;
       border-radius: 999px; background: var(--water-ballast-white); white-space: nowrap; }
.panel.pay-context { overflow-x: auto; }

/* A revision as a person reads it (RevisionView): terms, then rates; changes marked. */
.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem 1.2rem; margin: 0 0 1rem; }
.terms > div { display: flex; flex-direction: column; }
.terms dt { font-size: .8rem; color: var(--text-muted); }
.terms dd { margin: 0; }
.terms .changed dd, tr.changed td:nth-child(2) { font-weight: 600; }
.was { display: block; font-size: .8rem; font-weight: 400; color: var(--text-muted); }
.panel.pending { border-color: var(--oxidized-orange); }

/* Local development: who the dev headers sign in as. */
.persona { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.persona select { font-size: .85rem; padding: .2rem .3rem; }

/* HR Admin's fixes (D-43): deliberately set apart. */
.panel.admin-fixes { border: 1px dashed var(--hull-red); }
.panel.admin-fixes summary { color: var(--hull-red); font-weight: 600; cursor: pointer; }

/* The builder beside its summary (RevisionSummary); the page widens for it. */
.app-content:has(.builder-layout) { max-width: 1320px; }
.builder-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.builder-summary { position: sticky; top: 4.5rem; }   /* below the sticky .app-header */
.builder-summary h2 { margin-top: 0; }
.summary { margin: .5rem 0; }
.summary > div { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.summary dt { font-size: .8rem; color: var(--text-muted); }
.summary dd { margin: .1rem 0 0; }
.summary .changed .after { font-weight: 600; }
.summary .before { display: block; font-size: .8rem; color: var(--text-muted); }
.summary .headline { font-size: 1.2rem; }
@media (max-width: 900px) {
    .builder-layout { grid-template-columns: 1fr; }
    .builder-summary { position: static; }
}

/* Pay context as grade columns, like the framework view. */
.pay-context-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.grade-columns { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; }
.grade-column { flex: 1 0 150px; background: var(--water-ballast-white); border-radius: var(--radius); padding: .6rem; display: flex; flex-direction: column; gap: .5rem; }
.grade-column.chosen { outline: 2px solid var(--marine-blue); }
.grade-head { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; min-height: 3.6rem; }
.grade-badge { background: var(--marine-blue); color: #fff; font-weight: 600; border-radius: 6px; padding: .15rem .6rem; }
.grade-label { font-size: .8rem; line-height: 1.2; }
.band { margin: 0; background: var(--surface); border-radius: 6px; padding: .35rem .5rem; font-size: .85rem; cursor: help; }
.band > div { display: flex; justify-content: space-between; gap: .4rem; }
.band dt { color: var(--text-muted); }
.band dd { margin: 0; font-variant-numeric: tabular-nums; }
.people { display: flex; flex-direction: column; gap: .3rem; }
.chip { border: 1px solid var(--marine-blue); background: var(--surface); color: var(--marine-blue); border-radius: 999px;
        padding: .25rem .6rem; font-size: .85rem; cursor: pointer; text-align: left; }
.chip.same-dept { background: var(--marine-blue); color: #fff; }
.chip.self { border-style: dashed; }
.chip.sample { cursor: default; font-size: .75rem; padding: .05rem .5rem; }
.chip .variation { font-size: .75rem; opacity: .85; margin-left: .25rem; }
.this-revision { border: 2px solid var(--oxidized-orange); background: #fff8f0; border-radius: 8px; padding: .3rem .5rem;
                 font-size: .85rem; display: flex; flex-direction: column; }
.legend .chip { margin-left: .3rem; }

/* A small dialog for details kept off the page. */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.2rem; width: min(520px, calc(100% - 2rem)); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal-head h3 { margin: 0; }

/* The written statement's terms (028). */
.job-description h3, .pay-review h3 { font-size: .95rem; margin: .6rem 0 .3rem; }
.job-description ul { margin: .2rem 0 .8rem 1.2rem; padding: 0; }
.objectives { white-space: pre-line; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .9rem; margin: .9rem 0 0; }
fieldset legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
textarea { width: 100%; font: inherit; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 8px; }
