/* ==========================================================================
   Scan Manager — app styles on top of hcsm-ui.css (v1.2).
   1. Self-hosted Titillium Web (OFL, files from @fontsource/titillium-web 5.3.0).
   2. Mockup additions copied verbatim from docs/ui/mockup.html (mk-* classes,
      kept under that prefix so mockup markup can be reused 1:1).
   3. App additions (environment banner). Built only from --hc-* tokens.
   ========================================================================== */

/* ---- 1. Fonts ----------------------------------------------------------- */
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/titillium-web-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/titillium-web-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/titillium-web-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/titillium-web-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/titillium-web-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/titillium-web-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---- 2. Mockup additions ---------------------------------------------- */
.mk-demo { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 14px; padding: 6px 16px; background: var(--hc-blue-tint); color: var(--hc-navy-900); font-size: var(--hc-fs-small); text-align: center; }
.mk-demo .hc-link { display: inline-flex; align-items: center; gap: 4px; }
.mk-demo svg { width: 14px; height: 14px; }
.mk-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--hc-radius-sm); background: var(--hc-danger-bg); color: var(--hc-danger-text); font-size: 12px; font-weight: var(--hc-fw-bold); line-height: 20px; text-align: center; }
.mk-count[hidden] { display: none; }
.mk-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--hc-space-5); }
.mk-stat { display: flex; flex-direction: column; gap: 2px; padding: var(--hc-space-4) var(--hc-space-6); }
.mk-stat { min-width: 0; }
.mk-stat__label { font-size: var(--hc-fs-small); color: var(--hc-text-muted); }
.mk-stat__label .hc-status { white-space: normal; align-items: baseline; }
.mk-stat__label .hc-status::before { flex: 0 0 auto; transform: translateY(-1px); }
.mk-stat__value { color: var(--hc-text-strong); font-size: var(--hc-fs-page); font-weight: var(--hc-fw-semibold); line-height: 1.2; font-variant-numeric: tabular-nums; }
.mk-mono { font-family: var(--hc-font-mono); font-size: var(--hc-fs-small); }
.mk-muted { color: var(--hc-text-muted); }
.mk-small { font-size: var(--hc-fs-small); }
.mk-body { padding: 0 var(--hc-space-6) var(--hc-space-6); }
.mk-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--hc-space-2); }
.mk-filters .hc-input { width: 300px; max-width: 100%; }
.mk-filters .hc-select { width: auto; min-width: 160px; }
.mk-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 10px; vertical-align: middle; }
.mk-title-badge { margin-left: 12px; vertical-align: 4px; }
.hc-table tbody tr[data-href] { cursor: pointer; }
.hc-table td .hc-badge { margin-left: 6px; }
.mk-empty { padding: var(--hc-space-8) var(--hc-space-6); text-align: center; color: var(--hc-text-muted); }

.mk-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--hc-border); }
.mk-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--hc-space-2) var(--hc-space-4); padding: var(--hc-space-3) var(--hc-space-6); border-bottom: 1px solid var(--hc-border-subtle); }
.mk-list li:last-child { border-bottom: 0; }
.mk-list__main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; }
.mk-list__icon { flex: 0 0 auto; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--hc-radius-md); }
.mk-list__icon svg { width: 17px; height: 17px; }
.mk-list__icon--danger { background: var(--hc-danger-bg); color: var(--hc-danger-text); }
.mk-list__icon--warning { background: var(--hc-warning-bg); color: var(--hc-warning-text); }
.mk-list__icon--success { background: var(--hc-success-bg); color: var(--hc-success-text); }

.mk-alert { display: flex; gap: var(--hc-space-3); align-items: flex-start; padding: var(--hc-space-4) var(--hc-space-6); border: 1px solid var(--hc-border); border-left: 3px solid var(--hc-danger); border-radius: var(--hc-radius-lg); background: var(--hc-danger-bg); color: var(--hc-danger-text); }
.mk-alert svg { width: 18px; height: 18px; margin-top: 2px; }
.mk-alert--warning { border-left-color: var(--hc-warning); background: var(--hc-warning-bg); color: var(--hc-warning-text); }
.mk-alert--info { border-left-color: var(--hc-info); background: var(--hc-info-bg); color: var(--hc-info-text); }
.mk-alert__title { font-weight: var(--hc-fw-semibold); }
.mk-alert__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mk-alert .hc-link { color: inherit; text-decoration: underline; }

.mk-steps { margin: 0; padding: var(--hc-space-1) var(--hc-space-6) var(--hc-space-5); list-style: none; }
.mk-step { position: relative; display: flex; gap: var(--hc-space-3); padding-bottom: var(--hc-space-4); }
.mk-step::before { content: ""; position: absolute; left: 7px; top: 22px; bottom: 2px; border-left: 1px dotted var(--hc-tree-line); }
.mk-step:last-child { padding-bottom: 0; }
.mk-step:last-child::before { display: none; }
.mk-step__dot { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 3px; border-radius: var(--hc-radius-round); border: 1.5px solid var(--hc-tree-line); background: var(--hc-surface); }
.mk-step--done .mk-step__dot { border-color: var(--hc-success); background: var(--hc-success); }
.mk-step--running .mk-step__dot { border: 5px solid var(--hc-info); }
.mk-step--failed .mk-step__dot { border-color: var(--hc-danger); background: var(--hc-danger); }
.mk-step--warn .mk-step__dot { border-color: var(--hc-warning); background: var(--hc-warning); }
.mk-step__title { color: var(--hc-text-strong); font-weight: var(--hc-fw-semibold); }
.mk-step__meta { font-size: var(--hc-fs-small); color: var(--hc-text-muted); }

.mk-grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--hc-space-5); align-items: start; }
.mk-stack { display: flex; flex-direction: column; gap: var(--hc-space-5); min-width: 0; }
.mk-kv { margin: 0; }
.mk-kv div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px var(--hc-space-6); border-top: 1px solid var(--hc-border-subtle); }
.mk-kv dt { color: var(--hc-text-muted); }
.mk-kv dd { margin: 0; color: var(--hc-text-strong); text-align: right; }

.mk-pre { margin: 0; padding: 14px 16px; overflow: auto; border: 1px solid var(--hc-border); border-radius: var(--hc-radius-md); background: var(--hc-surface-subtle); color: var(--hc-text-strong); font: 13px/1.55 var(--hc-font-mono); white-space: pre; }

.mk-fields { border-top: 1px solid var(--hc-border); }
.mk-field { display: grid; grid-template-columns: minmax(150px, 1.1fr) 140px minmax(180px, 1.6fr) auto auto; gap: var(--hc-space-2) var(--hc-space-3); align-items: start; padding: var(--hc-space-3) var(--hc-space-6); border-bottom: 1px solid var(--hc-border-subtle); }
.mk-field__col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mk-field__key { font-family: var(--hc-font-mono); font-size: 12px; color: var(--hc-text-muted); overflow-wrap: anywhere; }
.mk-field__req { display: inline-flex; align-items: center; gap: 6px; height: var(--hc-control-h); white-space: nowrap; cursor: pointer; }
.mk-field__head { padding: 10px var(--hc-space-6); background: var(--hc-surface-subtle); color: var(--hc-text-muted); font-size: var(--hc-fs-th); font-weight: var(--hc-fw-bold); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--hc-border); }
.mk-field__head span:nth-child(n+4) { text-align: left; }
input[type="checkbox"]:not(.hc-switch) { width: 16px; height: 16px; margin: 0; accent-color: var(--hc-blue); }
.mk-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--hc-control-h); height: var(--hc-control-h); padding: 0; border: 1px solid var(--hc-border-control); border-radius: var(--hc-radius-md); background: var(--hc-surface); color: var(--hc-text-muted); cursor: pointer; transition: var(--hc-transition); }
.mk-icon-btn:hover { background: var(--hc-btn-secondary-hover); border-color: var(--hc-border-control-hover); color: var(--hc-danger-text); }
.mk-icon-btn svg { width: 16px; height: 16px; }
.mk-control-col { flex-direction: column; align-items: stretch; }
.mk-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--hc-space-2) var(--hc-space-3); }
.hc-select { appearance: auto; }
.mk-num { width: 110px !important; }

.mk-toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--hc-radius-md); background: var(--hc-navy-900); color: #fff; font-weight: var(--hc-fw-semibold); box-shadow: 0 12px 32px rgba(12, 39, 64, .18); opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s; }
.mk-toast.is-shown { opacity: 1; visibility: visible; transform: none; transition: opacity .15s ease, transform .15s ease, visibility 0s; }
.mk-toast svg { width: 18px; height: 18px; color: var(--hc-blue-light); }

.mk-signin { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: var(--hc-page); }
.mk-signin[hidden] { display: none; }
.mk-signin__card { width: min(420px, 100%); padding: 32px; display: flex; flex-direction: column; gap: var(--hc-space-4); text-align: center; }
.mk-signin__logo { height: 26px; width: auto; margin: 0 auto 4px; }
.mk-signin .hc-btn { width: 100%; }

@media (max-width: 1100px) { .mk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mk-grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  .mk-field { grid-template-columns: 1fr; padding-left: var(--hc-space-4); padding-right: var(--hc-space-4); }
  .mk-field__head { display: none; }
  .mk-list li, .mk-kv div, .mk-stat { padding-left: var(--hc-space-4); padding-right: var(--hc-space-4); }
  .mk-body, .mk-steps { padding-left: var(--hc-space-4); padding-right: var(--hc-space-4); }
  .mk-filters, .mk-filters .hc-input, .mk-filters .hc-select { width: 100%; }
  .mk-toast { left: 16px; right: 16px; bottom: 16px; }
}
@media (max-width: 480px) { .mk-stats { grid-template-columns: 1fr 1fr; gap: var(--hc-space-3); } .mk-stat__value { font-size: 22px; } }

/* ---- 3. App additions --------------------------------------------------- */
/* Environment banner above the top bar (sandbox only). Warning colours, text, no colour-only signal. */
.sm-env-banner { padding: 6px 16px; text-align: center; font-size: var(--hc-fs-small); font-weight: var(--hc-fw-bold); letter-spacing: .06em; text-transform: uppercase; background: var(--hc-warning-bg); color: var(--hc-warning-text); border-bottom: 1px solid var(--hc-border); }
/* Language switch buttons are submit buttons inside a POST form. */
.hc-lang form { display: contents; }
.sm-footer { padding: var(--hc-space-6) 0 0; font-size: var(--hc-fs-small); color: var(--hc-text-muted); }
.sm-footer .hc-code { margin-left: 4px; }
/* Sign-in page and bare pages: centred card on the page background. */
.sm-login { min-height: 100dvh; display: grid; place-items: center; padding: var(--hc-space-6) var(--hc-space-4); background: var(--hc-page); }
.sm-login__stack { width: min(420px, 100%); display: flex; flex-direction: column; gap: var(--hc-space-5); }
.sm-login__stack--wide { width: min(640px, 100%); }
.sm-login .hc-lang--light { width: 100%; }
.sm-login .mk-alert { text-align: left; }
.mk-signin__card .hc-btn { width: 100%; }
/* Admin screens */
.sm-toast--error svg { color: var(--hc-danger-bg); }
.sm-wrap { overflow-wrap: anywhere; }
.sm-nowrap { white-space: nowrap; }
.hc-select { appearance: auto; }
#f-number, #f-digits { width: 120px; }
.hc-setting__control .hc-field { width: 100%; }
.mk-inline .hc-field { width: auto; }
.hc-table td form { margin: 0; }
/* Inline confirmation for destructive actions (style guide §9) without a modal. */
.sm-confirm { display: inline-block; }
.sm-confirm > summary { list-style: none; }
.sm-confirm > summary::-webkit-details-marker { display: none; }
.sm-confirm__body { margin-top: var(--hc-space-3); padding: var(--hc-space-4); border: 1px solid var(--hc-border); border-radius: var(--hc-radius-md); background: var(--hc-surface-subtle); display: flex; flex-direction: column; gap: var(--hc-space-3); max-width: 420px; }
/* Schema builder / models */
.sm-textarea { min-height: 80px; height: auto; padding-top: 8px; padding-bottom: 8px; resize: vertical; font: inherit; line-height: 1.5; }
.sm-border-top { border-top: 1px solid var(--hc-border); }
.sm-pad-top { padding-top: var(--hc-space-4); }
.sm-mt { margin-top: var(--hc-space-3); }
.sm-date { width: 160px; }
.mk-field.hc-field--error .hc-input { border-color: var(--hc-danger); }
.sm-page { align-self: center; }
