/* DefenSafe base layer — injected into every KoBo/Enketo page by nginx.
   Colours are var(--ds-*) only; their values come from /brand/theme.css (editable).
   Palette rule: red, black, white, neutral grey. No blue, no green, no amber. */

/* ---- Fonts: self-hosted, no CDN (field devices are often offline) ---- */
@font-face{font-family:Cairo;font-style:normal;font-weight:400;font-display:swap;src:url(/brand/static/fonts/cairo-arabic-400-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:Cairo;font-style:normal;font-weight:600;font-display:swap;src:url(/brand/static/fonts/cairo-arabic-600-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:Cairo;font-style:normal;font-weight:700;font-display:swap;src:url(/brand/static/fonts/cairo-arabic-700-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:Cairo;font-style:normal;font-weight:400;font-display:swap;src:url(/brand/static/fonts/cairo-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+2000-206F,U+20AC,U+2122,U+2212,U+2215}
@font-face{font-family:Cairo;font-style:normal;font-weight:700;font-display:swap;src:url(/brand/static/fonts/cairo-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+2000-206F,U+20AC,U+2122,U+2212,U+2215}
@font-face{font-family:Inter;font-style:normal;font-weight:400;font-display:swap;src:url(/brand/static/fonts/inter-latin-400-normal.woff2) format('woff2')}
@font-face{font-family:Inter;font-style:normal;font-weight:600;font-display:swap;src:url(/brand/static/fonts/inter-latin-600-normal.woff2) format('woff2')}
@font-face{font-family:Inter;font-style:normal;font-weight:700;font-display:swap;src:url(/brand/static/fonts/inter-latin-700-normal.woff2) format('woff2')}

/* KPI names Roboto everywhere; nginx answers its Latin Roboto files with Inter (see
   nginx/defensafe.conf), so no @font-face aliasing is needed here. */

/* Latin text in Inter, Arabic falls through to Cairo (unicode-range keeps them apart). */
html:root{
  --mantine-font-family:Inter,Cairo,system-ui,sans-serif;
  --mantine-font-family-headings:Cairo,Inter,system-ui,sans-serif;
}
body,button,input,select,textarea{font-family:Inter,Cairo,system-ui,sans-serif}
html[lang|=ar] body,html[lang|=ar] button,html[lang|=ar] input,
html[lang|=ar] select,html[lang|=ar] textarea{font-family:Cairo,Inter,system-ui,sans-serif}

/* ---- Dark chrome: header, drawer, sign-in ground ---- */
.mdl-layout__header,.main-header{background-color:var(--ds-black)!important;color:#fff}
.mdl-layout__header .header__link,.main-header a{color:#fff}
/* Sidebar: one charcoal panel (--ds-sidebar, editable at /brand/admin), softer than the
   header; the icon rail is a shade darker so the two columns read as one unit. */
.k-drawer,.k-drawer__sidebar{background-color:var(--ds-sidebar)!important}
html body .k-drawer .k-drawer__primary-icons{background-color:var(--ds-sidebar-rail)!important;border-inline-end:1px solid rgba(255,255,255,.06)}
/* Rail icons: KoBo marks the active one with its own 3px edge — colour that edge instead of
   adding a second marker (two markers + rounded corners read as a bracket). */
html body .k-drawer__primary-icons .k-drawer__link{color:var(--ds-grey-400)!important;border-radius:0!important;box-shadow:none!important;border-color:transparent!important}
html body .k-drawer__primary-icons .k-drawer__link:hover{color:#fff!important;background-color:rgba(255,255,255,.06)}
html body .k-drawer__primary-icons .k-drawer__link.active{color:#fff!important;background-color:rgba(255,255,255,.08);border-color:var(--ds-red-accent)!important}
.k-drawer__sidebar{border-inline-end:1px solid rgba(0,0,0,.25)}
/* Help bubble and the GitHub "source" icon are removed from the sidebar (owner's request: no
   source-code link anywhere). */
.help-bubble--support,.k-drawer__secondary-icons{display:none!important}
/* Count pills: quiet translucent chips instead of KoBo's white circles. */
html body .k-drawer__sidebar .form-sidebar__label-count[class],
html body .k-drawer__sidebar [class*="badge-module__root"][class]{background-color:rgba(255,255,255,.12)!important;color:#fff!important;border:0!important}
/* Sidebar entries are buttons (skipped by the generic text rule above): light grey, white when
   hovered or current. */
html body .k-drawer__sidebar button:not([data-variant=filled]):not(.k-button--type-primary),
html body .k-drawer__sidebar button:not([data-variant=filled]):not(.k-button--type-primary) :not([class*="badge"]){color:var(--ds-grey-300)!important}
html body .k-drawer__sidebar button:not([data-variant=filled]):is(:hover,[data-active],[aria-current],.active),
html body .k-drawer__sidebar button:not([data-variant=filled]):is(:hover,[data-active],[aria-current],.active) :not([class*="badge"]){color:#fff!important}
.k-drawer__sidebar .form-sidebar__label{border-radius:6px;margin:2px 8px;transition:background-color .15s}
.k-drawer__sidebar .form-sidebar__label:hover{background-color:rgba(255,255,255,.05)}
.k-drawer__link{color:var(--ds-grey-300)!important}
/* Text inside the dark sidebar (projects, library and account-settings menus were designed
   for KoBo's light sidebar): light grey, white when active or hovered. Filled buttons keep
   their own white-on-red. */
.k-drawer__sidebar :is(a,span,h1,h2,h3,h4,p,label,li,div):not([class*="mantine-Button"]):not(button *):not([class*="badge"]){color:var(--ds-grey-300)!important}
.k-drawer__sidebar :is(a,button,[role=tab],[class*="NavLink"]):is(.active,[data-active],[aria-current],[aria-selected=true]),
.k-drawer__sidebar :is(a,button,[role=tab],[class*="NavLink"]):is(.active,[data-active],[aria-current],[aria-selected=true]) *{color:#fff!important}
.k-drawer__sidebar a:hover,.k-drawer__sidebar a:hover *{color:#fff!important}
/* Selected sidebar entry (KoBo uses a light chip, built for its light sidebar). */
.k-drawer__sidebar .form-sidebar__label--selected{background-color:rgba(255,255,255,.08)!important;box-shadow:inset 3px 0 0 var(--ds-red-accent)}
html[dir=rtl] .k-drawer__sidebar .form-sidebar__label--selected{box-shadow:inset -3px 0 0 var(--ds-red-accent)}
.k-drawer__sidebar .form-sidebar__label--selected,.k-drawer__sidebar .form-sidebar__label--selected *{color:#fff!important}
/* The open project in the sidebar's project list: KoBo marks it with an inline light-grey
   background (var(--mantine-color-gray-7), near-white), unreadable under the light text the
   dark sidebar needs. Same chip as the selected sidebar entry above. */
html body .k-drawer__sidebar [style*="background: var(--mantine-color-gray"]{background:rgba(255,255,255,.1)!important;border-radius:6px;box-shadow:inset 3px 0 0 var(--ds-red-accent)}
html[dir=rtl] body .k-drawer__sidebar [style*="background: var(--mantine-color-gray"]{box-shadow:inset -3px 0 0 var(--ds-red-accent)}
html body .k-drawer__sidebar [style*="background: var(--mantine-color-gray"] *{color:#fff!important}
/* Filled (red) KoBo buttons in the sidebar keep white labels (e.g. the Library's "New"). */
html body .k-drawer__sidebar button.k-button--type-primary,
html body .k-drawer__sidebar button.k-button--type-primary *{color:#fff!important}
.k-drawer__sidebar svg{color:inherit}
/* Secondary text on the light page ground: KoBo's mid-grey reaches only 4.35:1 there. */
html body :is([class*="tableHeaderCell"],[class*="loadingMessage"],.assets-table-pagination,.assets-table__footer){color:var(--ds-ink-muted)!important}
/* Avatar initials: a fixed dark neutral keeps white letters readable (KoBo picks per-user hues). */
html body [class*="avatar-module__initials"]{background-color:var(--ds-ink-muted)!important;color:#fff!important}


/* Sign-in: the stock photo is replaced by the dark ground; the card is a raised surface.
   The photo credit goes with the photo. */
.registration__bg{background:var(--ds-black)!important}
.registration__bg form.registration,.registration__bg section.registration{background:var(--ds-surface)!important;border:1px solid #2A2A2A}
.registration__footer{display:none!important}
.registration input[type=text],.registration input[type=password],.registration input[type=email]{background:#fff!important;color:var(--ds-ink)!important}
.registration--logo img{max-height:64px;width:auto}
.registration__bg a{color:var(--ds-red-accent)}

/* ---- Actions: solid fills use --ds-red (#C12A33, 5.8:1); never #F5333F under white text ---- */
.kobo-button--blue,.kobo-button--red{background-color:var(--ds-red)!important;border-color:var(--ds-red)!important;color:#fff!important}
.mantine-Button-root[data-variant=filled]{background-color:var(--ds-red);color:#fff}
.mantine-Button-root[data-variant=filled]:hover{background-color:var(--ds-blue-5)}
a{color:var(--ds-red)}
.mdl-layout__header a,.k-drawer a{color:inherit}

/* Focus: visible on both grounds. */
:focus-visible{outline:2px solid var(--ds-red-accent)!important;outline-offset:2px}

/* Form builder: KoBo's icon-font logo cell becomes the emblem on the dark ground. */
[class*="header__cell--logo"]{background:var(--ds-black) var(--ds-emblem-on-dark) center/30px no-repeat!important}
[class*="header__cell--logo"] .k-icon-kobo{visibility:hidden}

/* ---- Enketo (field forms) ---- */
.form-header{background-color:var(--ds-black)!important;color:#fff}
.form-header .form-language-selector,.form-header a,.form-header button{color:#fff}
.enketo-power{display:none!important}
.form-header__branding{position:absolute;left:50%;transform:translateX(-50%);padding:0!important;margin:0!important;order:0}
.form-header__branding img{max-height:36px;max-width:160px}
/* Enketo's print icon is a dark SVG (its colour variable never resolves): white on the dark bar. */
.form-header__button--print{filter:invert(1) brightness(2);margin-inline:20px 16px!important}
/* Narrow screens: Enketo stacks the header, so the logo goes back into the flow, centred. */
@media screen and (max-width:820px){.form-header{justify-content:center}.form-header__branding{position:static;transform:none;margin:0 auto!important;flex:0 0 100%;display:flex;justify-content:center}}
.or #form-title,.or .form-title{color:var(--ds-ink)!important}
.or .required{color:var(--ds-red)!important}
.btn-primary,#submit-form{background-color:var(--ds-red)!important;border-color:var(--ds-red)!important;color:#fff!important}
.btn-default,#save-draft{background-color:#fff!important;border:1px solid var(--ds-grey-300)!important;color:var(--ds-ink)!important}
html[dir=rtl] .or,html[lang|=ar] .or{font-family:Cairo,Inter,system-ui,sans-serif}

/* Contact footer rendered by brand.js from /brand/admin company info. */
.ds-contact{font:13px/1.6 Cairo,Inter,system-ui,sans-serif;color:var(--ds-grey-400);text-align:center;padding:16px 12px}
.ds-contact a{color:var(--ds-grey-300)!important;text-decoration:none}
.ds-contact a:hover{color:#fff!important;text-decoration:underline}
form.or ~ .ds-contact,body > .ds-contact{color:var(--ds-ink-muted)}
body > .ds-contact a{color:var(--ds-ink-muted)!important}
.paper > .ds-contact,.paper > .ds-contact a{color:var(--ds-ink-muted)!important}

/* Account menu (KPI's dark popover under the avatar): readable on the dark surface. KoBo
   designed its "Account settings" as a light chip with dark text; recoloured, both turned red. */
.mantine-Menu-dropdown:has(.account-box__menu){background-color:var(--ds-surface)!important;border:1px solid #2C2C2C}
.mantine-Menu-dropdown:has(.account-box__menu) [class*="avatar-module__fullName"]{color:#fff!important}
.mantine-Menu-dropdown:has(.account-box__menu) [class*="avatar-module__email"]{color:var(--ds-grey-400)!important}
.mantine-Menu-dropdown:has(.account-box__menu) a[class*="mantine"]{--button-bg:var(--ds-red)!important;--button-hover:var(--ds-blue-5)!important;--button-color:#fff!important;background-color:var(--ds-red)!important;color:#fff!important}
.mantine-Menu-dropdown:has(.account-box__menu) a[class*="mantine"]:hover{background-color:var(--ds-blue-5)!important}
.account-box__menu button{--button-color:var(--ds-grey-300)!important;color:var(--ds-grey-300)!important}
.account-box__menu button:hover{--button-color:#fff!important;color:#fff!important;background-color:rgba(255,255,255,.06)!important}
