:root {
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --panel: #f9fafb;
    --accent: #1f3864;
    --accent-ink: #ffffff;
    --good: #166534;
    --good-bg: #dcfce7;
    --warn: #92400e;
    --warn-bg: #fef3c7;
    --bad: #991b1b;
    --bad-bg: #fee2e2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: #ffffff;
}

h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
h3 { font-size: 1rem; margin: 16px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; font-weight: normal; }
code { font-family: Consolas, monospace; font-size: 0.9em; }
code.secret { overflow-wrap: anywhere; user-select: all; }

.centred { display: flex; justify-content: center; padding: 64px 16px; }

.shell { display: flex; min-height: 100vh; }
.side {
    width: 220px;
    flex-shrink: 0;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.side .brand { font-size: 1.3rem; font-weight: 700; padding: 0 8px; }
.side .customer { opacity: 0.8; padding: 0 8px 16px; }
.side a { color: var(--accent-ink); text-decoration: none; padding: 8px; border-radius: 6px; }
.side a.active, .side a:hover { background: rgba(255, 255, 255, 0.15); }
.side .who { margin-top: auto; padding: 8px; }
.side .who .muted { color: rgba(255, 255, 255, 0.7); }
.side button.link { color: var(--accent-ink); padding: 4px 0; }
.side .tour-button { color: var(--accent-ink); margin: 8px 8px 0; align-self: flex-start; }
.content { flex: 1; padding: 24px 32px; min-width: 0; }

.card { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; background: #fff; }
.card.narrow { width: 100%; max-width: 380px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }

label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 0.9rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 4px; }
label.sample { flex-direction: row; align-items: center; gap: 8px; }
/* A fixed column, wide enough for the longest field name, so the boxes line up. */
label.sample code { flex: 0 0 250px; }
input, select, textarea {
    font: inherit;
    padding: 7px 9px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}
input.search { min-width: 280px; }
textarea.code, input.code { font-family: Consolas, monospace; font-size: 0.85rem; width: 100%; }
fieldset { border: none; padding: 0; margin: 0; }

button {
    font: inherit;
    padding: 7px 14px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { background: var(--bad-bg); color: var(--bad); border-color: #fca5a5; }
button.link { background: none; border: none; padding: 0; color: var(--accent); text-decoration: underline; }

table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--panel); }

.problem { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.notice { background: var(--good-bg); color: var(--good); padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }

.state { font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: var(--panel); color: var(--muted); white-space: nowrap; }
.state.draft { background: var(--warn-bg); color: var(--warn); }
.state.approved { background: var(--good-bg); color: var(--good); }
.state.rejected { background: var(--bad-bg); color: var(--bad); }
.state.scheduled { background: var(--panel); color: var(--accent); border: 1px solid var(--line); }
.when { margin: 0.75rem 0; }
.when legend { font-weight: 600; margin-bottom: 0.25rem; }

.versions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.version.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.preview { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 12px; text-align: center; }
.preview img { max-width: 100%; image-rendering: pixelated; border: 1px solid #d1d5db; background: #fff; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 16px; color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile .number { font-size: 2rem; font-weight: 700; color: var(--accent); }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
dt { color: var(--muted); }
dd { margin: 0; }
.roles { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 12px; }
.shops-picker { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 12px; }
.shops-picker legend { font-weight: 600; margin-bottom: 4px; }
tr.editing td { background: #f8fafc; }

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 24px;
    background: var(--warn-bg);
}

/* The label designer */
.designer { margin-bottom: 24px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.toolbar .gap { flex: 1; }
.toolbar .gs1-buttons { display: inline-flex; flex-wrap: wrap; gap: 6px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
.designer-body { display: grid; grid-template-columns: minmax(0, auto) minmax(300px, 380px); gap: 24px; align-items: start; }
@media (max-width: 1100px) { .designer-body { grid-template-columns: 1fr; } }
.canvas-wrap { display: inline-block; padding: 16px; background: #eef1f5; border-radius: 8px; outline: none; overflow: auto; max-width: 100%; }
.canvas-wrap:focus { box-shadow: 0 0 0 2px var(--accent); }
.canvas { display: block; font-family: "Liberation Sans", Arial, sans-serif; touch-action: none; user-select: none; }
.canvas .paper { fill: #fff; stroke: #9ca3af; stroke-width: 0.2; }
.canvas .element { cursor: move; }
.canvas .block { fill: rgba(31, 56, 100, 0.04); stroke: rgba(31, 56, 100, 0.25); stroke-width: 0.1; stroke-dasharray: 0.6 0.4; }
.canvas .selection { fill: none; stroke: #2563eb; stroke-width: 0.25; stroke-dasharray: 0.8 0.5; pointer-events: none; }
.canvas .handle { fill: #2563eb; cursor: nwse-resize; }
.properties { border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.properties h3 { margin-top: 0; }
.grid4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.grid4 input, .grid4 select { width: 100%; }
.field-insert { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.field-insert select { flex: 1; min-width: 120px; }
.checks { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: 6px; margin: 12px 0; }
.checks ul { margin: 6px 0 0; padding-left: 20px; }
details.advanced { margin: 12px 0 24px; }
details.advanced summary { cursor: pointer; color: var(--muted); }

a.button {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}
details.card > summary { cursor: pointer; }
.bad { color: var(--bad); }

table.overrides input, table.overrides select { width: 100%; min-width: 70px; padding: 5px 6px; }
table.overrides input[type="checkbox"] { width: auto; min-width: 0; }
table.overrides select { min-width: 140px; }

.field { display: inline-block; margin-right: 16px; }
details > summary { cursor: pointer; margin: 8px 0; }

.agent { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 8px; }
.agent-problems { margin: -4px 0 12px 22px; }
.agent-problems table { border-collapse: collapse; margin-top: 6px; }
.agent-problems td { padding: 3px 10px 3px 0; vertical-align: top; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; margin-right: 4px; }
.dot.green { background: #16a34a; }
.dot.amber { background: #f59e0b; }
.dot.red { background: #dc2626; }

/* Tablets and phones (HeadOfficeWidthTests): nothing scrolls the page sideways. A table wider than the space scrolls in
   its own box, and below tablet width the menu runs across the top instead of down the side. */
@media (max-width: 1200px) {
    table { display: block; overflow-x: auto; max-width: 100%; }
}
@media (max-width: 800px) {
    .shell { flex-direction: column; }
    .side { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 10px 12px; }
    .side .brand, .side .customer { padding: 0 8px; }
    .side .who { margin: 0 0 0 auto; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
    .side .tour-button { margin: 0; align-self: center; }
    .content { padding: 16px; }
    input.search { min-width: 0; width: 100%; }
    label.sample { flex-wrap: wrap; }
    label.sample code { flex-basis: auto; overflow-wrap: anywhere; }
    label.sample input { min-width: 0; flex: 1 1 140px; }
    .card.narrow { max-width: none; }
}

/* Settings: what a company adds to what each label type must show. */
.also-shows { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.also-shows fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.also-shows legend { font-weight: 600; padding: 0; margin-bottom: 4px; }

/* Why a form is missing: the role it needs. */
.role-hint { margin: 0 0 16px; padding: 10px 14px; border-left: 4px solid #1f3864; background: #eef2f8; border-radius: 4px; }

/* Activity: the values a change made, and going back to a moment. */
.value-change { margin-top: 6px; padding-left: 10px; border-left: 3px solid #d1d5db; }
.value-change .before { text-decoration: line-through; color: #4b5563; }
.outcomes { margin: 12px 0 0; padding-left: 20px; }
.outcomes li.bad { color: #991b1b; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
table.restore { position: relative; }
.bar-cell { width: 30%; }
.bar { display: inline-block; height: 10px; background: var(--accent); border-radius: 2px; }

