/* Facilities Management - styles. Logical properties keep Arabic (RTL) and English (LTR) in sync. */

:root {
  /* Calm palette: soft, low-saturation blue-greens and warm neutrals (blue/green hues and lower
     saturation read as more pleasant and less arousing: Valdez & Mehrabian 1994; Wilms & Oberfeld 2018).
     Red is kept for what truly needs attention, and is softened. */
  --accent: #2f5f6a;
  --accent-ink: #eef5f5;
  --accent-soft: #c4d8da;
  --ground: #f3f6f6;
  --surface: #ffffff;
  --ink: #1e2b30;
  --ink-2: #36474d;
  --muted: #56676c;
  --line: #d7e0e1;
  --line-soft: #e5ecec;
  --control: #a9b8bb;
  --link: #2a6575;
  --danger: #a8443a;

  --green-bg: #d9eee3;
  --green-ink: #1f5640;
  --green: #3c8a68;
  --yellow-bg: #f6ebc8;
  --yellow-ink: #5f4a10;
  --yellow: #c09a2c;
  --red-bg: #f5dcd8;
  --red-ink: #7d2f27;
  --red: #c0564a;
  --blue-bg: #dbe7f1;
  --blue-ink: #24486a;
  --blue: #5383ad;

  --sans: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}
body.no-scroll {
  overflow: hidden;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
  text-wrap: balance;
}
h2 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}
a {
  color: var(--link);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
.top :focus-visible {
  outline-color: var(--accent-ink);
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.strong {
  font-weight: 600;
}
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}
.nowrap {
  white-space: nowrap;
}
.icon {
  display: inline-flex;
  flex-shrink: 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.loading,
.empty {
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
}
.empty .btn {
  margin-top: 12px;
}

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

.top {
  background: var(--accent);
  color: var(--accent-ink);
}
.top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 14px;
}
.top-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border: 1.5px solid currentColor;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}
.brand-tag {
  font-size: 12.5px;
  line-height: 1.4;
  opacity: 0.82;
}

.lang {
  display: inline-flex;
  border: 1px solid var(--control);
  border-radius: 8px;
  overflow: hidden;
}
.lang-btn {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
}
.lang-btn[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.top .lang {
  border-color: rgba(238, 245, 245, 0.45);
}
.top .lang-btn[aria-pressed='true'] {
  background: var(--accent-ink);
  color: var(--accent);
}

.user-btn {
  min-height: 44px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: start;
  cursor: pointer;
}
.user-btn:hover {
  border-color: rgba(238, 245, 245, 0.45);
}
.user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
}
.user-role {
  font-size: 12px;
  color: var(--accent-soft);
}

.nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.nav-link {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  color: var(--accent-soft);
  font-size: 14.5px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover {
  color: #ffffff;
}
.nav-link[aria-current='page'] {
  border-bottom-color: var(--accent-ink);
  color: #ffffff;
  font-weight: 600;
}

/* -------------------------------- page --------------------------------- */

.main {
  padding-block: 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--control);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--ink-2);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.btn-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
  font-weight: 600;
}
.btn-small {
  padding: 0 12px;
  font-size: 14px;
}
.btn-icon {
  width: 44px;
  padding: 0;
}
.btn-block {
  width: 100%;
}
.btn-end {
  margin-inline-start: auto;
}

/* status colors: green, yellow, red, white */
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--control);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 16px;
}
.card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  text-align: start;
  cursor: pointer;
}
.card-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.card-label .dot {
  width: 12px;
  height: 12px;
}
.card-num {
  font-family: var(--mono);
  font-size: 44px;
  font-weight: 600;
  line-height: 1.1;
}
.card[aria-pressed='true'] {
  border-color: currentColor;
}
.card-valid,
.chip-valid {
  background: var(--green-bg);
  color: var(--green-ink);
}
.card-near,
.chip-near {
  background: var(--yellow-bg);
  color: var(--yellow-ink);
}
.card-expired,
.chip-expired {
  background: var(--red-bg);
  color: var(--red-ink);
}
.card-review,
.chip-review {
  background: var(--surface);
  color: var(--ink);
}
.card-review {
  border-color: var(--control);
}
.card-review[aria-pressed='true'] {
  border-color: var(--ink);
}
.chip-review {
  box-shadow: inset 0 0 0 1px #9aabae;
}
.card-valid .dot,
.chip-valid .dot {
  background: var(--green);
}
.card-near .dot,
.chip-near .dot {
  background: var(--yellow);
}
.card-expired .dot,
.chip-expired .dot {
  background: var(--red);
}
.card-review .dot,
.chip-review .dot {
  background: var(--surface);
  border: 2px solid #6e8085;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip .dot {
  width: 8px;
  height: 8px;
}
.note {
  font-size: 12.5px;
}
.note-near {
  color: var(--yellow-ink);
}
.note-expired {
  color: var(--red-ink);
}
.tag {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 4px;
  background: #e8eeee;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

/* panels and tables */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel.pad {
  padding: 20px 24px;
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.panel-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}
.inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
}
.files-table {
  min-width: 960px;
}
th {
  padding: 12px 20px;
  background: var(--ground);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}
td {
  padding: 10px 20px;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
  white-space: nowrap;
}
td.wrap-cell {
  white-space: normal;
  min-width: 180px;
}
.cell-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cell-stack > *,
.meta > * {
  align-self: flex-start;
}
.row-actions {
  display: flex;
  gap: 6px;
}

/* forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.hint {
  font-size: 12.5px;
  color: var(--muted);
}
input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
input[type='date'],
input[type='search'],
input[type='url'],
input[type='file'],
select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--control);
  border-radius: 8px;
  background: var(--surface);
  font-size: 15px;
}
.inline-field select {
  width: auto;
}
input:disabled,
select:disabled {
  background: var(--ground);
  color: var(--muted);
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.check input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.span-2 {
  grid-column: 1 / -1;
}
.form-error {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--red-bg);
  color: var(--red-ink);
  font-size: 14px;
  font-weight: 500;
}
.settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 720px;
}

/* dialog */
.dialog {
  width: min(600px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
}
.dialog::backdrop {
  background: rgba(30, 43, 48, 0.55);
}
.dialog form {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dialog-title {
  font-size: 20px;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toast {
  position: fixed;
  inset-block-end: 20px;
  inset-inline: 16px;
  z-index: 100;
  width: fit-content;
  max-width: calc(100vw - 32px);
  margin-inline: auto;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-size: 14.5px;
}
.toast-bad {
  background: var(--danger);
}

/* sign in */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.auth-card .lang {
  align-self: center;
}
.auth-brand {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--accent);
}

/* reader */
.doc-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}
.doc-list {
  flex: 1 1 300px;
  min-width: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.doc-list-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.doc-search {
  position: relative;
  display: flex;
  align-items: center;
}
.doc-search .icon {
  position: absolute;
  inset-inline-start: 12px;
  color: var(--muted);
  pointer-events: none;
}
.doc-search .doc-search-input {
  width: 100%;
  padding-inline-start: 38px;
}
.doc-hit {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.doc-hit-page {
  color: var(--accent);
  font-weight: 500;
}
.doc-hit-text {
  overflow-wrap: anywhere;
}
.doc-hit mark {
  background: #fdeaa8;
  color: var(--ink);
  border-radius: 3px;
  padding: 0 2px;
}
.doc-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.doc-list-head h2 {
  font-size: 15px;
}
.doc-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
}
.doc-item {
  width: 100%;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
}
.doc-item:hover {
  background: var(--ground);
}
.doc-item[aria-current='true'] {
  border-color: var(--accent);
  background: #e4eeee;
}
.doc-item[aria-current='true'] .tag {
  background: var(--surface);
}
.doc-item-name {
  font-weight: 500;
  line-height: 1.45;
}
.doc-item[aria-current='true'] .doc-item-name {
  font-weight: 600;
}
.doc-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.doc {
  flex: 4 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.doc-head {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.doc-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 16px 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-label {
  font-size: 12.5px;
  color: var(--muted);
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.meta .mono {
  font-weight: 600;
}

.pdf {
  display: flex;
  flex-direction: column;
  border: 1px solid #c8d4d6;
  border-radius: var(--radius);
  background: #dce6e7;
  overflow: hidden;
}
.pdf-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid #c8d4d6;
}
.pdf-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pdf-page {
  padding-inline: 8px;
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
}
.pdf-zoom {
  min-width: 48px;
  text-align: center;
  color: var(--ink-2);
}
.pdf-stage {
  height: 72vh;
  min-height: 360px;
  padding: 16px;
  overflow: auto;
  text-align: center;
}
.pdf-canvas {
  display: inline-block;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(30, 43, 48, 0.18);
}
.pdf-msg {
  padding: 48px 16px;
  color: var(--ink-2);
}
.pdf-full {
  position: fixed;
  inset: 0;
  z-index: 50;
  border: 0;
  border-radius: 0;
}
.pdf-full .pdf-stage {
  flex: 1;
  height: auto;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .user-text {
    display: none;
  }
  .card-num {
    font-size: 36px;
  }
  th,
  td {
    padding-inline: 14px;
  }
  .pdf-page {
    padding-inline: 2px;
  }
}

@media print {
  .top,
  .actions,
  .row-actions,
  .toast {
    display: none !important;
  }
  body {
    background: #ffffff;
  }
}

/* Read acknowledgement */
.ack-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 20px;
}
.ack-text {
  margin: 0;
  color: var(--muted);
}
.ack-ok {
  margin: 0;
  color: var(--green-ink);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ack-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ack-count {
  font-family: var(--mono);
  font-size: 13px;
}
.ack-count.ack-full {
  color: var(--green-ink);
  font-weight: 600;
}
.ack-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  max-height: 40vh;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}
.ack-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.ack-list li:last-child {
  border-bottom: 0;
}
.ack-h {
  margin: 12px 0 6px;
  font-size: 14px;
}

/* ------------------------------- branding ------------------------------- */

/* The logo sits on a white tile so any logo colours read on the dark header. */
.brand-logo {
  flex-shrink: 0;
  height: 52px;
  max-width: 200px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 8px;
}
.brand-logo img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.brand-text {
  min-width: 0;
}
.brand.has-logo .brand-name {
  overflow-wrap: anywhere;
}
/* Sign-in page: logo large and centred above the name. */
.brand-auth {
  flex-direction: column;
  text-align: center;
  gap: 14px;
}
.brand-auth.has-logo .brand-logo {
  height: auto;
  max-width: min(280px, 100%);
  padding: 0;
  background: none;
}
.brand-auth .brand-logo img {
  max-height: 104px;
}

/* Settings: logo preview and buttons */
.label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.logo-preview {
  min-height: 120px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--control);
  border-radius: 10px;
  background: var(--ground);
}
.logo-preview img {
  display: block;
  max-width: min(320px, 100%);
  max-height: 110px;
  object-fit: contain;
}
.logo-actions {
  justify-content: flex-start;
}
.field .logo-actions .btn-primary {
  font-size: 14.5px;
  color: #ffffff;
}
.btn.is-busy {
  opacity: 0.6;
  pointer-events: none;
}
.visually-hidden {
  position: absolute !important;
  inset-inline-start: 0;
  width: 1px !important;
  min-width: 0 !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.logo-actions {
  position: relative;
}
.logo-actions label.btn:focus-within,
.visually-hidden:focus-visible + label.btn {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .top .brand-logo {
    height: 42px;
    max-width: 128px;
    padding: 4px 8px;
  }
  .top .brand {
    gap: 10px;
  }
  .top .brand-name {
    font-size: 15px;
  }
  .top .brand.has-logo .brand-tag {
    display: none;
  }
}
@media (max-width: 380px) {
  .top .brand-logo {
    max-width: 104px;
  }
}

/* Sign-in page links and notices */
.auth-link {
  margin: 0;
  text-align: center;
  font-size: 14px;
}
.auth-link a:not(.btn) {
  color: var(--link);
}
.notice {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--green-bg);
  color: var(--green-ink);
}

/* ------------------------- maintenance requests ------------------------- */

input[type='tel'],
input[type='datetime-local'],
textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--control);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 15px;
  color: inherit;
}
textarea {
  resize: vertical;
  line-height: 1.6;
}
.notice-warn {
  background: var(--yellow-bg);
  color: var(--yellow-ink);
}
.pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.back-link {
  font-size: 14px;
}

/* The red count beside "Requests" in the menu. */
.badge {
  min-width: 20px;
  height: 20px;
  margin-inline-start: 6px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.ticket-title {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
.public-card .meta-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Priority and status chips */
.chip-p1 {
  background: var(--red);
  color: #ffffff;
}
.chip-p2 {
  background: var(--red-bg);
  color: var(--red-ink);
}
.chip-p3 {
  background: var(--yellow-bg);
  color: var(--yellow-ink);
}
.chip-p4 {
  background: #e8eeee;
  color: var(--ink-2);
}
.card-progress,
.chip-progress {
  background: var(--blue-bg);
  color: var(--blue-ink);
}
.card-progress .dot,
.chip-progress .dot {
  background: var(--blue);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.filters .doc-search {
  flex: 1 1 240px;
}
.tickets-table {
  min-width: 980px;
}
.tickets-table td {
  vertical-align: top;
}
.row-late td {
  background: #fbf1ef;
}
.row-late td:first-child {
  box-shadow: inset -4px 0 0 var(--red);
}
[dir='ltr'] .row-late td:first-child {
  box-shadow: inset 4px 0 0 var(--red);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
}
.kpi {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-inline-end: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.kpi-num {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  text-align: start;
}
.kpi-label {
  color: var(--muted);
  font-size: 12.5px;
}

.ticket-actions {
  flex-wrap: wrap;
}
.ticket-photo img {
  display: block;
  max-width: min(100%, 420px);
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

/* History of a request, oldest first. */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}
.steps li {
  position: relative;
  padding-block: 0 16px;
  padding-inline-start: 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.steps li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.steps li::after {
  content: '';
  position: absolute;
  inset-inline-start: 4px;
  top: 19px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.steps li:last-child {
  padding-bottom: 0;
}
.steps li:last-child::after {
  display: none;
}
.step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.step-note {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--ground);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The employees' public pages */
.public-card {
  width: min(560px, 100%);
}
.public-card h1 {
  font-size: 22px;
}
.req-h {
  padding-top: 6px;
  font-size: 16px;
}
.cat-pick {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.cat-pick legend {
  margin-bottom: 6px;
  padding: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.cat-team {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.cat-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
  gap: 8px;
}
.cat-option {
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--control);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  line-height: 1.35;
}
.cat-option input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.cat-option:has(input:checked) {
  border-color: var(--accent);
  background: #e3eff0;
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: 600;
}
.cat-option:focus-within {
  outline: 3px solid var(--link);
  outline-offset: 1px;
}
.my-tickets {
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.my-tickets li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.stars {
  display: flex;
  gap: 4px;
}
.star {
  width: 44px;
  height: 44px;
  border: 1px solid var(--control);
  border-radius: 8px;
  background: var(--surface);
  color: var(--control);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.star[aria-pressed='true'] {
  border-color: var(--yellow);
  background: var(--yellow-bg);
  color: var(--yellow);
}

/* Request link dialog and settings */
.qr-box {
  display: flex;
  justify-content: center;
}
.qr-box .qr {
  max-width: 100%;
  height: auto;
}
.copy-row input {
  font-family: var(--mono);
  font-size: 13px;
}
.sla-table td,
.sla-table th {
  padding-inline: 12px;
}
.sla-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sla-cell input {
  width: 110px;
}

/* Printed QR sheets: only the cards print, two per A4 page. */
.qr-sheet {
  display: none;
}
@media print {
  body.print-qr > *:not(.qr-sheet) {
    display: none !important;
  }
  body.print-qr .qr-sheet {
    display: block;
  }
  .qr-card {
    height: 48vh;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px dashed #9aabae;
    border-radius: 12px;
    margin-bottom: 2vh;
    break-inside: avoid;
    text-align: center;
    color: #000000;
  }
  .qr-org {
    font-size: 16px;
    font-weight: 600;
  }
  .qr-title {
    font-size: 22px;
    font-weight: 700;
  }
  .qr-place {
    font-size: 20px;
    font-weight: 700;
  }
  .qr-url {
    font-family: var(--mono);
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .public-card {
    padding: 20px 16px;
  }
  .kpi-num {
    font-size: 19px;
  }
  .filters > .inline-field {
    flex: 1 1 140px;
  }
}

/* ------------------------------- portal ------------------------------- */

.top-start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  min-width: 0;
}
/* Back to the portal, with the name of the system open now. */
.app-switch {
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(238, 245, 245, 0.35);
  border-radius: 8px;
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.app-switch:hover {
  background: rgba(255, 255, 255, 0.08);
}
.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 16px;
}
.app-card {
  position: relative;
  min-height: 190px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.app-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(47, 95, 106, 0.1);
}
.app-icon {
  position: relative;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
}
.app-icon .badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -10px;
  margin: 0;
}
.app-desk .app-icon {
  background: #4b7091;
}
.app-admin .app-icon {
  background: #6a6890;
}
.app-title {
  font-size: 19px;
  font-weight: 700;
}
.app-desc {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.app-role {
  margin-top: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--ground);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.app-soon {
  border-style: dashed;
  background: transparent;
}
.app-soon .app-icon {
  background: var(--control);
}
.app-roles {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.app-roles legend {
  padding: 0 6px;
  font-size: 13.5px;
  font-weight: 700;
}
@media (max-width: 600px) {
  .app-switch .app-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Request form: who the employee number belongs to. */
.who-card {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--green-bg);
  color: var(--green-ink);
  font-weight: 600;
}
.who-card.who-missing {
  background: var(--red-bg);
  color: var(--red-ink);
}

/* Asset Management */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block: 4px 12px;
}
.tab {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}
.tab[aria-selected='true'] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.tab[aria-selected='true'] .muted {
  color: inherit;
  opacity: 0.85;
}
.chip-pm {
  background: var(--blue-bg);
  color: var(--blue-ink);
}
.clamp {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pre-line {
  white-space: pre-line;
}
.filters > select {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
}
