/* Unifil look for the prebuilt Mobile Dialoge bundle, phone first. Same language as the DF skin
   (branding/unifil.css): white and light grey surfaces, ink text, Unifil green (#68a83a) as the action
   colour, the logo's leaf green (#74bb41) as the accent, darker greens for green text, Barlow SemiBold
   for headings, Carlito (the Calibri fallback unifil.ch names) for text, one 6px radius, no caps.
   The app is a minified build, so everything overrides it from outside: CSS-module classes
   are matched on their stable prefix ([class*="_menuBtn_"]), antd on its public class names, and
   inline styles that the bundle sets need !important. Logo and primary colour (#68a83a) come from
   the DF app-config at runtime. */

@font-face {
  font-family: "Unifil Display";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("./Barlow-SemiBold-latin.woff2") format("woff2");
}

/* Carlito has the small Calibri proportions; scaled like in the DF skin. No 500 weight: 100-500 = Regular. */
@font-face {
  font-family: "Unifil Text";
  font-style: normal;
  font-weight: 100 500;
  font-display: swap;
  size-adjust: 108%;
  src: url("./Carlito-Regular-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Unifil Text";
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
  size-adjust: 108%;
  src: url("./Carlito-Bold-latin.woff2") format("woff2");
}

:root {
  --uni-ink: #191919;
  --uni-text-2: #555555;
  --uni-muted: #8a8a8a;
  --uni-line: #e5e5e5;
  --uni-field: #d4d4d4;
  --uni-tile: #f0f0f0;
  --uni-surface: #f5f6f4;
  --uni-mist: #eef5e8;
  --uni-mist-line: #d3e5c4;
  --uni-leaf: #74bb41;
  --uni-green: #68a83a;
  --uni-green-text: #3f6f22;
  --uni-radius: 6px;
  --uni-ring: 0 0 0 3px rgba(104, 168, 58, 0.2);
  --uni-display: "Unifil Display", "Unifil Text", Arial, sans-serif;
  --font-sans: "Unifil Text", Calibri, Carlito, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  /* codes and quantities: the text face with tabular digits instead of a monospace */
  --font-mono: "Unifil Text", Calibri, Carlito, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --primary-text-color: var(--uni-ink);
  --secondary-text-color: var(--uni-text-2);
  --label-font-color: var(--uni-text-2);
  --border-color: var(--uni-field);
  --app-background: var(--uni-surface);
  --login-bg: var(--uni-surface);
}

/* The bundle derives a light tint from the primary colour and writes it inline on <html>; the
   Unifil mist green replaces it. !important here takes precedence over that inline value. */
html {
  --primary-color-light: #eef5e8 !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  color: var(--uni-ink);
  background: var(--uni-surface);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* antd sets its font through low-specificity :where() rules; this outranks them */
html body [class*="ant-"]:not(.anticon) {
  font-family: var(--font-sans);
}

.mono,
.mono-tabular {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* No caps anywhere (demo style rule) */
#root *,
.ant-modal *,
.ant-select-dropdown * {
  text-transform: none !important;
}

button,
a,
input,
[role="button"],
.ant-select-selector {
  touch-action: manipulation;
}

/* ---------- Shell ---------- */

[class*="_shell_"] {
  background: var(--uni-surface);
  overflow-x: hidden;
}

[class*="_content_"] {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

[class*="_footer_"] {
  padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: #fff;
  border-top: 1px solid var(--uni-line);
}

/* ---------- App bar ---------- */

[class*="_appbar_"] {
  height: calc(64px + env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
  gap: 12px;
  background: #fff;
  box-shadow: none;
  border-bottom: 1px solid var(--uni-line);
}

[class*="_appbarLogoBtn_"] {
  flex: none;
  min-height: 44px;
  padding: 0;
}

[class*="_appbarLogoTenant_"] {
  height: 24px;
}

[class*="_appbarTitle_"] {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid var(--uni-mist-line);
  font-family: var(--uni-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--uni-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[class*="_appbarRight_"] {
  flex: none;
  gap: 2px;
}

/* Language toggle: one quiet square chip with the current language; 44px hit area */
[class*="_appbarLang_"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
  margin: 4px 2px;
  padding: 0 10px;
  border: 1px solid var(--uni-field);
  border-radius: var(--uni-radius);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--uni-ink);
}

[class*="_appbarLang_"]::after {
  content: "";
  position: absolute;
  inset: -5px -3px;
}

[class*="_appbarLang_"] span {
  display: none;
}

[class*="_appbarLang_"]:active {
  background: var(--uni-surface);
  border-color: var(--uni-green);
}

[class*="_appbarUser_"] {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--uni-text-2);
  gap: 0;
}

[class*="_appbarLogout_"] {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--uni-radius);
  font-size: 18px;
  color: var(--uni-ink);
}

[class*="_appbarLogout_"]:active {
  background: var(--uni-surface);
}

/* Phones: the user's name is the first thing to give way; logout keeps its accessible label */
@media (max-width: 479px) {
  [class*="_appbarUser_"] {
    font-size: 0;
  }
}

/* ---------- Section labels & lists ---------- */

[class*="_sectionLabel_"] {
  padding: 22px 20px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--uni-text-2);
}

[class*="_menuList_"] {
  gap: 8px;
  padding: 0 16px 8px;
}

[class*="_menuBtn_"] {
  gap: 14px;
  min-height: 68px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--uni-line);
  border-radius: var(--uni-radius);
  background: #fff;
  box-shadow: none;
  font-family: var(--font-sans);
  color: var(--uni-ink);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

[class*="_menuBtn_"]:not(:disabled):active {
  background: var(--uni-surface);
  border-color: var(--uni-green);
}

[class*="_menuBtn_"]:focus-visible {
  outline: none;
  border-color: var(--uni-green);
  box-shadow: var(--uni-ring);
}

[class*="_menuLabel_"] b {
  font-size: 16px;
  font-weight: 600;
  color: var(--uni-ink);
  line-height: 1.3;
}

[class*="_menuLabel_"] span {
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--uni-text-2);
}

[class*="_iconTile_"] {
  border-radius: var(--uni-radius);
  background: var(--uni-mist);
  color: var(--uni-green-text);
}

[class*="_chev_"] {
  color: var(--uni-green-text);
}

/* ---------- Start screen ("Was möchtest du tun?") ----------
   The two entry cards are the only menu buttons the bundle renders with min-height 96px. */

[class*="_sectionLabel_"]:has(+ [class*="_menuList_"] > [class*="_menuBtn_"][style*="min-height: 96px"]) {
  position: relative;
  padding: 34px 20px 30px;
  font-family: var(--uni-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.15;
  color: var(--uni-ink);
}

/* Eyebrow over the question, and a short leaf-green rule under it */
[class*="_sectionLabel_"]:has(+ [class*="_menuList_"] > [class*="_menuBtn_"][style*="min-height: 96px"])::before {
  content: "Unifil Niederlenz · Taschenfilterfertigung";
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--uni-green-text);
}

[class*="_sectionLabel_"]:has(+ [class*="_menuList_"] > [class*="_menuBtn_"][style*="min-height: 96px"])::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 16px;
  width: 40px;
  height: 2px;
  background: var(--uni-leaf);
}

[class*="_menuList_"]:has(> [class*="_menuBtn_"][style*="min-height: 96px"]) {
  gap: 12px;
  padding: 0 16px 24px;
}

[class*="_menuBtn_"][style*="min-height: 96px"] {
  position: relative;
  min-height: 128px !important;
  padding: 20px 16px 20px 18px;
  gap: 16px;
  border: 1px solid var(--uni-line);
  border-radius: var(--uni-radius);
  background: #fff;
  overflow: hidden;
}

/* A leaf-green edge on the left, the green of the Unifil logo */
[class*="_menuBtn_"][style*="min-height: 96px"]::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--uni-leaf);
}

[class*="_menuBtn_"][style*="min-height: 96px"] > [class*="_iconTile_"] {
  width: 56px !important;
  height: 56px !important;
  font-size: 23px !important;
  border-radius: var(--uni-radius);
  color: #fff;
  background: var(--uni-green);
}

[class*="_menuBtn_"][style*="min-height: 96px"] [class*="_menuLabel_"] b {
  font-family: var(--uni-display);
  font-size: 21px !important;
  font-weight: 700;
  line-height: 1.15;
  color: var(--uni-ink);
}

[class*="_menuBtn_"][style*="min-height: 96px"] [class*="_menuLabel_"] span {
  margin-top: 6px;
  font-size: 14.5px;
  line-height: 1.45;
}

[class*="_menuBtn_"][style*="min-height: 96px"] > [class*="_chev_"] {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid var(--uni-mist-line);
  border-radius: var(--uni-radius);
  font-size: 13px;
  color: var(--uni-ink);
  background: #fff;
}

[class*="_menuBtn_"][style*="min-height: 96px"]:not(:disabled):active > [class*="_chev_"] {
  background: var(--uni-green);
  border-color: var(--uni-green);
  color: #fff;
}

/* ---------- Dialog header ---------- */

[class*="_dialogHeader_"] {
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--uni-line);
}

[class*="_backBtn_"] {
  width: 44px;
  height: 44px;
  border-color: var(--uni-field);
  border-radius: var(--uni-radius);
  font-size: 16px;
  color: var(--uni-ink);
}

[class*="_backBtn_"]:active {
  background: var(--uni-surface);
  border-color: var(--uni-green);
}

[class*="_dialogTitle_"] {
  font-family: var(--uni-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--uni-ink);
}

[class*="_dialogSub_"] {
  margin-top: 2px;
  font-size: 13px;
  color: var(--uni-text-2);
}

/* ---------- Buttons ---------- */

[class*="_primaryBtn_"] {
  height: 54px;
  border-radius: var(--uni-radius);
  background: var(--uni-green);
  font-family: var(--font-sans);
  font-size: 16.5px;
  font-weight: 600;
  box-shadow: none;
}

[class*="_primaryBtn_"]:not(:disabled):active {
  background: var(--uni-green-text);
}

[class*="_outlineBtn_"] {
  min-height: 52px;
  height: auto;
  border-color: var(--uni-field);
  border-radius: var(--uni-radius);
  background: #fff;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--uni-ink);
}

[class*="_outlineBtn_"]:active {
  background: var(--uni-surface);
  border-color: var(--uni-green);
}

/* ---------- Scan screen ---------- */

[class*="_scanWrap_"] {
  justify-content: flex-start;
  padding: 32px max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left));
}

[class*="_scanWrap_"] > [class*="_iconTileLg_"] {
  width: 84px;
  height: 84px;
  font-size: 36px;
  border-radius: var(--uni-radius);
  margin-bottom: 20px !important;
  background: var(--uni-green);
  color: #fff;
}

[class*="_scanWrap_"] > h3 {
  font-family: var(--uni-display);
  font-size: 25px !important;
  font-weight: 700 !important;
  color: var(--uni-ink);
}

[class*="_scanHint_"] {
  max-width: 34ch;
  font-size: 15px;
  color: var(--uni-text-2);
  margin-bottom: 24px;
}

/* The scan field is an unclassed div holding the barcode icon and the input */
[class*="_scanWrap_"] > div:has(> input) {
  height: 56px !important;
  border-radius: var(--uni-radius) !important;
  border-color: var(--uni-field) !important;
  background: #fff !important;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

[class*="_scanWrap_"] > div:has(> input:focus) {
  border-color: var(--uni-green) !important;
  box-shadow: var(--uni-ring);
}

[class*="_scanWrap_"] > div > input {
  min-width: 0;
  height: 100%;
  font-size: 18px !important;
}

/* "Beispiele aus dem Lager" chips */
[class*="_scanWrap_"] button[style*="border-radius: var(--radius-full)"] {
  min-height: 44px;
  padding: 0 14px !important;
  border-radius: var(--uni-radius) !important;
  border-color: var(--uni-field) !important;
  background: #fff !important;
  color: var(--uni-ink) !important;
}

[class*="_scanWrap_"] button[style*="border-radius: var(--radius-full)"]:active {
  border-color: var(--uni-green) !important;
  color: var(--uni-green-text) !important;
}

/* ---------- Info blocks, notes ---------- */

[class*="_infoBlock_"] {
  border-color: var(--uni-line);
  border-radius: var(--uni-radius);
  box-shadow: none;
}

[class*="_infoKey_"] {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--uni-text-2);
}

[class*="_infoVal_"] {
  min-width: 0;
  overflow-wrap: anywhere;
}

[class*="_note_"] {
  border-radius: var(--uni-radius);
  font-size: 14.5px;
}

[class*="_noteInfo_"] {
  background: #fff !important;
  border-color: var(--uni-mist-line) !important;
}

/* ---------- Text and quantity fields ---------- */

div:has(> input[inputmode="decimal"]) {
  border-radius: var(--uni-radius) !important;
  background: #fff;
}

div:has(> input[inputmode="decimal"]:focus) {
  border-color: var(--uni-green) !important;
  box-shadow: var(--uni-ring);
}

input[inputmode="decimal"] {
  min-width: 0;
  height: 100%;
}

html body .ant-input-affix-wrapper,
html body .ant-input {
  border-radius: var(--uni-radius);
}

html body .ant-input-affix-wrapper-lg {
  min-height: 52px;
  font-size: 16px;
}

html body .ant-input-affix-wrapper:focus-within,
html body .ant-input:focus {
  border-color: var(--uni-green);
  box-shadow: var(--uni-ring);
}

/* ---------- Komponentenzugabe ---------- */

/* Workcenter picker: 56px trigger, 52px rows, 16px text. antd 5 puts the height on the root. */
html body .ant-select-lg.ant-select-single {
  height: 56px;
  font-size: 16px;
}

/* antd's own rules here are (0,4,0) :where() chains, so the sizes need !important */
html body .ant-select-lg.ant-select-single .ant-select-selector {
  height: 56px;
  padding: 0 16px !important;
  border-color: var(--uni-field) !important;
  border-radius: var(--uni-radius) !important;
  background: #fff !important;
  font-size: 16px;
}

html body .ant-select-lg.ant-select-single.ant-select-focused .ant-select-selector,
html body .ant-select-lg.ant-select-single.ant-select-open .ant-select-selector {
  border-color: var(--uni-green) !important;
  box-shadow: var(--uni-ring) !important;
}

html body .ant-select-lg.ant-select-single .ant-select-selection-search-input,
html body .ant-select-lg.ant-select-single .ant-select-selection-item,
html body .ant-select-lg.ant-select-single .ant-select-selection-placeholder {
  height: 54px !important;
  line-height: 54px !important;
  font-size: 16px !important;
}

html body .ant-select-lg.ant-select-single .ant-select-selection-item {
  font-weight: 600;
  color: var(--uni-ink);
}

html body .ant-select-lg.ant-select-single .ant-select-selection-placeholder {
  color: var(--uni-muted);
}

html body .ant-select-lg .ant-select-arrow {
  inset-inline-end: 16px;
  font-size: 14px;
  color: var(--uni-ink);
}

html body .ant-select-dropdown {
  padding: 6px;
  border: 1px solid var(--uni-line);
  border-radius: var(--uni-radius);
  box-shadow: 0 14px 34px rgba(23, 23, 23, 0.14), 0 2px 6px rgba(23, 23, 23, 0.06);
}

html body .ant-select-dropdown .ant-select-item {
  min-height: 52px;
  padding: 14px 14px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 24px;
  color: var(--uni-ink);
}

html body .ant-select-dropdown .ant-select-item + .ant-select-item {
  margin-top: 2px;
}

html body .ant-select-dropdown .ant-select-item-option-content {
  white-space: normal;
}

html body .ant-select-dropdown .ant-select-item-option-active:not(.ant-select-item-option-disabled) {
  background: var(--uni-tile);
}

html body .ant-select-dropdown .ant-select-item-option-selected:not(.ant-select-item-option-disabled) {
  font-weight: 600;
  color: var(--uni-green-text);
  background: var(--uni-mist);
}

/* Intro and hint lines are set inline at 12-13px; lift them to phone-readable sizes */
[class*="_content_"] p[style*="font-size: 13px"] {
  font-size: 15px !important;
  color: var(--uni-text-2) !important;
}

[class*="_content_"] p[style*="font-size: 12px"] {
  font-size: 14px !important;
}

/* Component rows: the bundle renders their icon tile at 30px */
[class*="_menuBtn_"] > [class*="_iconTile_"][style*="width: 30px"] {
  width: 40px !important;
  height: 40px !important;
  font-size: 15px !important;
}

[class*="_menuBtn_"] .ant-tag {
  flex: none;
}

/* ---------- Tags ---------- */

html body .ant-tag {
  border-radius: 4px;
  font-weight: 600;
}

/* ---------- Booking confirmation (antd modal.confirm) ---------- */

html body .ant-modal-root .ant-modal {
  max-width: calc(100vw - 32px);
}

html body .ant-modal .ant-modal-content {
  padding: 24px 20px 20px;
  border-radius: var(--uni-radius);
}

html body .ant-modal-confirm .ant-modal-confirm-title {
  font-family: var(--uni-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--uni-ink);
}

html body .ant-modal-confirm .ant-modal-confirm-content {
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

html body .ant-modal-confirm .ant-modal-confirm-btns {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

html body .ant-modal-confirm .ant-modal-confirm-btns .ant-btn {
  flex: 1 1 0;
  height: 52px;
  margin: 0;
  border-radius: var(--uni-radius);
  box-shadow: none;
  font-size: 16px;
  font-weight: 600;
}

html body .ant-modal-confirm .ant-modal-confirm-btns .ant-btn-default {
  border-color: var(--uni-field);
  color: var(--uni-ink);
}

html body .ant-btn-primary:not(:disabled):not(.ant-btn-dangerous) {
  background: var(--uni-green);
  border-color: var(--uni-green);
}

/* ---------- Toasts clear the notch ---------- */

html body .ant-message {
  top: calc(8px + env(safe-area-inset-top)) !important;
}

html body .ant-message .ant-message-notice-content {
  border-radius: var(--uni-radius);
  font-size: 15px;
}

/* Narrow phones (360px class) */
@media (max-width: 374px) {
  [class*="_appbar_"] {
    gap: 8px;
  }
  [class*="_appbarLogoTenant_"] {
    height: 20px;
  }
  [class*="_appbarTitle_"] {
    padding-left: 8px;
    font-size: 14.5px;
  }
  [class*="_sectionLabel_"]:has(+ [class*="_menuList_"] > [class*="_menuBtn_"][style*="min-height: 96px"]) {
    font-size: 27px;
  }
  [class*="_menuBtn_"] > [class*="_iconTile_"][style*="width: 30px"] {
    width: 34px !important;
    height: 34px !important;
  }
}

/* ---------- Login card (inline-styled by the bundle) ---------- */

[style*="background: var(--login-bg)"] > div[style*="max-width: 360px"] {
  border: 1px solid var(--uni-line);
  border-radius: var(--uni-radius) !important;
  box-shadow: 0 18px 40px rgba(25, 25, 25, 0.08) !important;
}

[style*="background: var(--login-bg)"] h4.ant-typography {
  margin-top: 4px !important;
  font-family: var(--uni-display) !important;
  font-size: 25px !important;
  font-weight: 700 !important;
  color: var(--uni-ink);
}

/* The logo button carries the app-bar background; on the white card it needs none */
[style*="background: var(--login-bg)"] button[style*="background: var(--appbar-bg)"] {
  background: transparent !important;
}

html body .ant-btn {
  border-radius: var(--uni-radius) !important;
  box-shadow: none !important;
}

html body .ant-btn-lg {
  height: 52px;
  font-size: 16px;
  font-weight: 600;
}

/* Status tags in the unifil.ch palette: running = its info blue instead of antd blue, booked = the
   Unifil green on mist */
html body .ant-tag.ant-tag-processing,
html body .ant-tag.ant-tag-blue {
  color: #1f6fa8 !important;
  background: #e2f0fa !important;
  border-color: #bcdcf2 !important;
}

html body .ant-tag.ant-tag-success,
html body .ant-tag.ant-tag-green {
  color: var(--uni-green-text) !important;
  background: var(--uni-mist) !important;
  border-color: var(--uni-mist-line) !important;
}

/* The booked check tile next to a component */
[class*="_menuBtn_"] > [class*="_iconTile_"][style*="success"] {
  color: var(--uni-green-text) !important;
  background: var(--uni-mist) !important;
}

html body .ant-modal-confirm-confirm .ant-modal-confirm-body > .anticon {
  color: var(--uni-green);
}
