/* Figma reference: XvxUOxJNMa7KyNYb5tZA8y / 3:93 and 3:95.
   Local licensed typeface. Screen-only presentation; printed reports use styles.css. */
@font-face {
  font-family: "DM Sans";
  src: url("fonts/dm-sans-variable.ttf") format("truetype");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

@media screen {
  :root {
    --ink: #202731;
    --muted: #596473;
    --line: #d4dae1;
    --primary: #2855a6;
    --primary-dark: #204581;
    --nav: #fff;
    --bg: #f4f5f7;
    --subtle: #eef1f4;
    --red: #be123c;
    --red-soft: #fff1f2;
    --amber: #b45309;
    --amber-soft: #fff4d6;
    --green: #15803d;
    --green-soft: #ecfdf3;
    --blue: #2855a6;
    --blue-soft: #eaf0fb;
    --review: #1d4ed8;
    --review-soft: #eff6ff;
    --review-line: #93c5fd;
    --radius: 6px;
    font: 14px/1.4 "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
  }

  body { background: var(--bg); }
  button, input, select, textarea { border-radius: var(--radius); }
  button { min-height: 40px; padding: 9px 12px; line-height: 1.4; border-color: var(--line); font-weight: 600; }
  button:hover { background: var(--subtle); border-color: #9da9b8; }
  button:disabled { opacity: .55; }
  button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
  button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
  button.link { min-height: 0; padding: 0; color: var(--primary); border-radius: 2px; line-height: 1.4; }
  button.link:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
  button.danger { color: var(--red); border-color: #d9a4b2; }
  input, select, textarea { min-height: 40px; padding: 9px 12px; border-color: #8793a3; line-height: 1.4; }
  input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
  input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 18px; padding: 0; accent-color: var(--primary); flex: 0 0 auto; }
  input[type="file"] { max-width: 100%; }
  textarea { min-height: 88px; }
  :where(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid #4f46e5; outline-offset: 3px; }
  h1 { font-size: 26px; line-height: 1.4; letter-spacing: -.35px; font-weight: 700; }
  h2 { font-size: 16px; line-height: 1.4; letter-spacing: 0; font-weight: 600; }
  h3 { font-size: 14px; line-height: 1.4; }
  .sub { margin-top: 4px; font-size: 12px; line-height: 1.4; color: var(--muted); }

  .shell { grid-template-columns: 216px minmax(0, 1fr); }
  .sidebar { width: 216px; padding: 20px 12px 16px; background: var(--nav); color: var(--ink); border-right: 1px solid var(--line); }
  .brand { width: auto; padding: 0 12px 20px; margin: 0 0 12px; background: transparent; border-radius: 0; text-align: left; }
  .cmms-title { color: var(--ink); font-size: 22px; line-height: 1.4; letter-spacing: .4px; }
  .brand small { color: var(--primary); font-size: 10px; text-align: left; letter-spacing: 1.4px; margin-top: 4px; }
  .brand-lockup { display: flex; align-items: center; gap: 10px; text-align: left; }
  .consinova-mark { display: block; width: 34px; height: 24px; color: var(--primary); flex: 0 0 34px; }
  .brand-type { min-width: 0; }
  .brand-name { display: block; color: var(--ink); font-size: 18px; line-height: 1.2; font-weight: 700; letter-spacing: -.4px; }
  .brand-system { display: block; color: var(--primary); font-size: 10px; line-height: 1.4; letter-spacing: .6px; font-weight: 600; margin-top: 4px; white-space: nowrap; }
  .navgroup { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1px; margin: 20px 12px 8px; }
  .nav { color: #46515f; padding: 10px 12px; min-height: 40px; margin: 2px 0; border-radius: var(--radius); gap: 10px; font-size: 13px; }
  .nav:hover { color: var(--ink); background: var(--subtle); }
  .nav.active { color: var(--primary-dark); background: var(--blue-soft); font-weight: 700; box-shadow: none; }
  .nav .icon { flex: 0 0 18px; }
  .nav .count { color: var(--primary-dark); background: #dae5f7; font-size: 12px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
  .sidebar-foot { color: var(--muted); border-color: var(--line); padding: 16px 12px 0; margin-top: auto; font-size: 12px; }
  .topbar { min-height: 64px; height: auto; padding: 12px 24px; gap: 16px; border-color: var(--line); }
  .topbar .search { flex: 0 1 390px; width: min(390px, 35vw); min-width: 180px; }
  .topbar input { background: #fff; border-color: #8793a3; padding-left: 36px; }
  .topbar .search svg { left: 12px; top: 13px; }
  .account { gap: 8px; justify-content: flex-end; font-size: 12px; min-width: 0; }
  .account > div { margin-right: 4px; }
  .account small { display: block; }
  .account button { min-height: 36px; padding: 8px 10px; }
  .avatar { width: 32px; height: 32px; background: var(--blue-soft); color: var(--primary); flex: 0 0 auto; }
  .content { padding: 24px; }
  .pagehead { gap: 16px; margin-bottom: 16px; }
  .pagehead > div:first-child { min-width: 0; }
  .pagehead .sub { font-size: 14px; }
  .actions, .filters { gap: 8px; }
  .actions { min-width: 0; }
  .toolbar { gap: 12px; margin: 16px 0; }
  .filters { align-items: start; min-width: 0; }
  .filters > input { width: min(100%, 340px); }
  .filters > select { max-width: 100%; }
  .segmented { padding: 3px; border-radius: var(--radius); gap: 2px; max-width: 100%; }
  .segmented button { min-height: 34px; padding: 7px 10px; font-size: 12px; border-radius: 4px; }
  .segmented button.active { background: var(--blue-soft); color: var(--primary-dark); box-shadow: none; }
  .scope-toolbar { align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
  .scope-toolbar > .segmented { margin-top: 23px; }
  .scope-toolbar > .filters { display: grid; grid-template-columns: minmax(120px, .65fr) repeat(2, minmax(0, 1fr)); flex: 1 1 540px; gap: 12px; }
  .scope-toolbar .filter-classification, .filters .remote-field { width: auto; max-width: 100%; min-width: 0; font-size: 12px; }
  .scope-toolbar .field > span:first-child { line-height: 17px; }
  .scope-toolbar .field input, .scope-toolbar .field select { width: 100%; max-width: 100%; min-width: 0; font-size: 13px; }
  /* Explicit zero-minimum grid tracks stop intrinsic control widths escaping labels. */
  .remote-field { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 6px; }
  .remote-field input, .remote-field select { min-width: 0; width: 100%; max-width: 100%; }
  .filters .remote-field .remote-status { max-width: none; }
  .remote-field .remote-status { font-size: 11px; line-height: 1.4; }
  .remote-field [data-remote-more] { min-height: 32px; padding: 6px 10px; }

  .kpis { gap: 12px; margin: 16px 0; }
  .kpi { min-height: 108px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: none; }
  .kpi::before { display: none; }
  .kpi.red { border: 1px solid var(--red); background: var(--red-soft); }
  .kpi.amber { border-color: var(--amber); background: var(--amber-soft); }
  .kpi.green { border-color: var(--green); background: var(--green-soft); }
  .kpi label { font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--ink); }
  .kpi strong { font-size: 30px; font-weight: 700; line-height: 1.4; letter-spacing: -.5px; margin: 4px 0; font-variant-numeric: tabular-nums; }
  .kpi.red label, .kpi.red strong { color: var(--red); }
  .kpi.amber label, .kpi.amber strong { color: var(--amber); }
  .kpi.green label, .kpi.green strong { color: var(--green); }
  .kpi span { font-size: 12px; }
  .grid2, .split { gap: 16px; margin: 16px 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { min-width: 0; border-color: var(--line); border-radius: var(--radius); box-shadow: none; }
  .panelhead { min-height: 56px; padding: 16px; border-top: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 12px; }
  .panelbody { padding: 16px; }
  .legend { font-size: 12px; gap: 12px; flex-wrap: wrap; }
  .dot { width: 8px; height: 8px; margin-right: 5px; }
  .barrow { grid-template-columns: minmax(100px, 145px) minmax(0, 1fr) 28px; margin: 16px 0; gap: 12px; font-size: 12px; }
  .bartrack button { min-height: 0; }
  .trend polyline { stroke: var(--primary); }
  .trend circle { fill: var(--primary); }
  .chartnote, .emptysmall { font-size: 12px; }
  .statstrip { gap: 8px 20px; font-size: 12px; margin: 12px 0 16px; }
  .statstrip b, .barrow strong { font-variant-numeric: tabular-nums; }
  .dashboard-statstrip { align-items: center; }
  .equipment-summary { position: relative; isolation: isolate; display: grid; flex: 0 1 208px; min-width: 170px; min-height: 80px; padding: 12px 16px; overflow: hidden; border: 1px solid #cbdaf4; border-radius: var(--radius); background: var(--blue-soft); color: var(--primary); }
  .equipment-summary > b { position: relative; z-index: 1; color: var(--primary); font-size: 28px; line-height: 1.2; letter-spacing: -.4px; }
  .equipment-summary > span { position: relative; z-index: 1; font-size: 12px; line-height: 1.4; }
  .summary-arcs { position: absolute; z-index: 0; width: 180px; height: 180px; right: -40px; top: 50%; transform: translateY(-50%); stroke: var(--primary); stroke-width: 1.5; opacity: .18; pointer-events: none; }

  .tablewrap { overscroll-behavior-inline: contain; max-width: 100%; }
  table { font-size: 13px; line-height: 1.4; font-variant-numeric: tabular-nums; }
  th { background: var(--subtle); color: var(--muted); padding: 11px 16px; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
  td { padding: 12px 16px; border-bottom-color: var(--line); }
  tbody tr:nth-child(even) { background: #f8f9fb; }
  tbody tr:hover { background: #edf2fa; }
  td strong { font-size: 13px; }
  td .sub { font-size: 12px; margin-top: 4px; }
  td button { min-height: 36px; padding: 8px 12px; font-size: 12px; }
  td button.link { min-height: 0; padding: 0; font-size: 13px; }
  td > button + button { margin-left: 4px; }
  .ref { color: var(--primary); font-size: 12px; line-height: 1.4; }
  .badge { min-height: 28px; justify-content: center; background: var(--subtle); color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; border-radius: var(--radius); font-size: 12px; font-weight: 600; line-height: 1.4; }
  .badge.red { background: var(--red); color: #fff; border-color: var(--red); }
  .badge.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
  .badge.green { background: var(--green); color: #fff; border-color: var(--green); }
  .badge.blue { background: var(--blue-soft); color: var(--primary); border-color: #a7bde4; }
  .badge.review { background: var(--review-soft); color: var(--review); border-color: var(--review-line); }
  .badges { gap: 4px; }
  .flag { color: #fff; background: var(--red); border: 0; font-size: 12px; min-height: 28px; padding: 4px 8px; }
  button.flag:hover { background: #971033; color: #fff; border-color: #971033; }
  .redtext { color: var(--red); font-weight: 600; }
  .tablefoot { padding: 12px 16px; gap: 12px; flex-wrap: wrap; font-size: 12px; }
  .tablefoot select { min-height: 32px; padding: 5px 8px; }
  .tabs { gap: 20px; margin: 20px 0; border-bottom-color: var(--line); padding: 0 2px; }
  .tabs button { font-size: 13px; min-height: 40px; padding: 10px 2px; border-radius: 0; }
  .tabs button.active { color: var(--primary); border-bottom: 3px solid var(--primary); }
  .detailgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .detailgrid label { text-transform: none; letter-spacing: 0; margin-bottom: 6px; font-size: 12px; }
  .detailgrid p { font-size: 13px; overflow-wrap: anywhere; }
  .notice { padding: 12px 16px; border: 1px solid #d6a067; border-left: 4px solid var(--amber); background: var(--amber-soft); border-radius: var(--radius); margin: 16px 0; font-size: 12px; }
  .safety-restriction { border-color: var(--red); border-left-color: var(--red); background: var(--red-soft); }
  .safety-restriction .sub { color: #862027; }
  .empty { padding: 32px 24px; }

  .formgrid { gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field { gap: 6px; min-width: 0; font-size: 12px; font-weight: 600; }
  .field input, .field select, .field textarea { min-width: 0; max-width: 100%; font-size: 14px; font-weight: 400; }
  .field small { font-size: 12px; }
  .checklabel { gap: 8px; }
  .checks { gap: 12px 20px; margin: 8px 0; }
  .formsection { margin-top: 4px; padding-top: 16px; }
  dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border-radius: var(--radius); border-color: var(--line); box-shadow: 0 20px 64px #20273133; }
  dialog::backdrop { background: #20273166; backdrop-filter: blur(2px); }
  .dialoghead { padding: 20px 24px; gap: 16px; }
  .dialoghead > button { flex: 0 0 36px; padding: 6px; }
  .dialogbody { padding: 24px; }
  .dialogfoot { padding: 16px 24px; gap: 8px; background: #f8f9fb; flex-wrap: wrap; }
  .formerror { font-size: 12px; color: var(--red); padding: 0 24px 12px; }
  .formerror:empty { padding-bottom: 0; }
  .hazard-editor-row { padding: 16px; margin-bottom: 12px; border-radius: var(--radius); }
  .hazard-editor-row textarea { min-height: 72px; }
  .compact-details { margin-top: 16px; }
  .compact-details summary { padding: 12px 16px; }
  .stack { gap: 16px; }
  .settingrow { padding: 12px 0; gap: 16px; }
  .dropzone { padding: 32px 24px; border-color: #7d96bf; border-radius: var(--radius); background: #f5f8fd; gap: 12px; }
  .importsummary { gap: 16px; margin: 20px 0; flex-wrap: wrap; }
  .importsummary > div { padding: 16px 20px; border-radius: var(--radius); background: #fff; }
  .helptext { font-size: 14px; line-height: 1.6; }
  .helptext p { margin: 12px 0; }
  .historyrow { padding: 16px 0; }
  #toast { padding: 12px 20px; border-radius: var(--radius); background: var(--ink); }
  .login { width: calc(100% - 32px); max-width: 440px; margin: 9vh auto; padding: 32px; border-color: var(--line); border-radius: var(--radius); box-shadow: none; }
  .login .cmms-title { margin-bottom: 20px; }
  .login .brand-lockup { margin-bottom: 24px; }
  .login h1 { font-size: 26px; }
  .login p { margin-top: 12px; }
  .login label { margin: 20px 0; font-size: 12px; }
  .login input { margin-top: 6px; font-size: 14px; }
  .login input[type="checkbox"] { display: inline-block; width: 18px; margin: 0 8px 0 0; vertical-align: middle; }
  .login button { margin-top: 8px; }
  .login .formerror { padding: 0; }
  .login pre { max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
  #mfa-time { color: var(--muted); font-size: 12px; }
}

@media screen and (max-width: 1200px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar .search { flex: 1 1 220px; width: auto; }
  .account { flex: 1 1 380px; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .scope-toolbar > .segmented { margin-top: 0; }
}
@media screen and (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pagehead { align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .detailgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px 16px 8px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { padding: 0 4px 8px; margin: 0; }
  .brand small, .sidebar-foot, .navgroup, .nav .count { display: none; }
  .sidebar nav { display: flex; gap: 4px; padding: 4px 0; overflow-x: auto; }
  .nav { min-height: 44px; padding: 10px 12px; font-size: 14px; flex-shrink: 0; }
  .topbar { padding: 12px 16px; gap: 12px; }
  .topbar .search { min-width: 0; flex-basis: 100%; }
  .topbar .search svg { top: 15px; }
  .account { flex: 1 1 100%; justify-content: flex-start; gap: 8px; }
  .account > div { flex: 1 0 100%; }
  .account .avatar, .account small { display: none; }
  .account button { flex: 1 1 auto; min-height: 44px; padding: 10px; }
  .content { padding: 24px 16px 32px; }
  .pagehead .actions { justify-content: flex-start; }
  button, input, select { min-height: 44px; }
  input, select, textarea, .field input, .field select, .field textarea, .scope-toolbar .field input, .scope-toolbar .field select, .login input { font-size: 16px; }
  button.link { min-height: 0; }
  .toolbar { align-items: stretch; gap: 12px; }
  .filters { width: 100%; gap: 12px; }
  .filters > input, .filters > select, .filters .remote-field { width: 100%; max-width: 100%; }
  .scope-toolbar > .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); flex-basis: 100%; }
  .scope-toolbar .filter-classification { grid-column: 1 / -1; }
  .scope-toolbar .remote-status { font-size: 11px; }
  .segmented { overflow-x: auto; }
  .segmented button { min-height: 44px; padding: 9px 8px; }
  .kpis { gap: 12px; }
  .kpi { min-height: 108px; padding: 16px; }
  .kpi strong { font-size: 30px; }
  .grid2, .split { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .barrow { grid-template-columns: 106px minmax(0, 1fr) 24px; gap: 8px; }
  .statstrip { gap: 8px 16px; }
  th, td { padding: 10px 12px; }
  .tablewrap > table:not(.work-table) { min-width: 720px; }
  td button, .tablefoot button, .tablefoot select, .remote-field [data-remote-more] { min-height: 44px; }
  td > button + button { margin-left: 0; margin-top: 4px; }
  td button.link { min-height: 44px; }
  .tablefoot { padding: 12px; }
  .tablefoot .actions { width: 100%; }
  .tabs { gap: 16px; }
  .tabs button { min-height: 44px; }
  .work-table, .work-table tbody { display: block; width: 100%; }
  .work-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .work-table tbody { display: grid; gap: 12px; padding: 12px; }
  .work-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
  .work-table td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .work-table .work-equipment { grid-area: 1 / 1; }
  .work-table .work-equipment button { min-height: 0; }
  .work-table .work-position { grid-area: 1 / 2; }
  .work-table .work-position .badges { align-items: flex-end; flex-direction: column; }
  .work-table .work-task { grid-area: 2 / 1 / 3 / -1; font-size: 14px; }
  .work-table .work-owner { grid-area: 3 / 1 / 4 / -1; color: var(--muted); }
  .work-table .work-due { grid-area: 4 / 1 / 5 / -1; }
  .work-table .work-due::before { content: 'Due '; color: var(--muted); font-weight: 400; }
  .work-table .work-action { grid-area: 5 / 1 / 6 / -1; }
  .work-table .work-action button { width: 100%; }
  .formgrid { grid-template-columns: minmax(0, 1fr); }
  .formgrid .full { grid-column: 1; }
  .dialoghead { padding: 16px; }
  .dialoghead > button { flex-basis: 44px; }
  .dialogbody { padding: 20px 16px; }
  .dialogfoot { padding: 16px; }
  .formerror { padding-inline: 16px; }
  .login { padding: 24px; margin: 32px auto; }
}

/* Consinova: distinct CN tones and an inset menu rail; no layout-width change. */
@media screen {
  :root { --cn-mark-secondary: #6F91CE; }
  .sidebar {
    background-image: linear-gradient(var(--primary), var(--primary));
    background-size: 5px 100%;
    background-position: left top;
    background-repeat: no-repeat;
  }
}
