html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* AI Analyze button — gradient with sparkle */
.btn-ai {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.btn-ai:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}
.btn-ai:active {
  transform: translateY(0);
}
.btn-ai::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
  animation: aiShine 3s ease-in-out infinite;
}
@keyframes aiShine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

/* Global Search */
#globalSearchResults .list-group-item-action.active,
#globalSearchResults .list-group-item-action:hover { background-color: #f0f4ff; }
#globalSearchResults::-webkit-scrollbar { width: 6px; }
#globalSearchResults::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

/* Dropzone upload area */
.dropzone-area { cursor: pointer; transition: all 0.2s; }
.dropzone-area:hover { border-color: #0d6efd !important; background-color: #f8f9fa; }
.border-dashed { border-style: dashed !important; }
/* Task photo thumbnails — placeholder when the file isn't available (e.g. local dev) */
.task-photo.photo-missing {
  display: inline-flex; align-items: center; justify-content: center;
  width: 104px; height: 104px;
  background: #e9ecef; color: #adb5bd; border-radius: .375rem;
}
.task-photo.photo-missing::after {
  font-family: "bootstrap-icons"; content: "\F3E1"; font-size: 1.8rem;
}

/* ---- Record pages (unit, owner, building, fees): compact toolbar, title, subtitle, clean tables ---- */
.ct-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.ct-toolbar .ct-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ct-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.ct-title h3 { margin: 0 .25rem 0 0; text-wrap: balance; }
.ct-sub { color: var(--bs-secondary-color); margin-bottom: 1.5rem; }
.ct-pager .ct-pos { opacity: 1; min-width: 4.5rem; font-variant-numeric: tabular-nums; }
.ct-card-title { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-secondary-color); margin-bottom: .75rem; font-weight: 600; }
.ct-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.ct-facts dt { font-weight: 400; color: var(--bs-secondary-color); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.ct-facts dd { margin: 0; font-size: 1rem; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ct-table { margin-bottom: 0; }
.ct-table > thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); font-weight: 600; background: var(--bs-tertiary-bg); border-bottom-width: 1px; white-space: nowrap; }
.ct-table > tbody td { vertical-align: middle; }
.ct-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ct-person { line-height: 1.25; }
.ct-person + .ct-person { margin-top: .35rem; }
.ct-person small { color: var(--bs-secondary-color); }
.ct-list-row { display: flex; align-items: center; gap: .85rem; padding: .65rem 1rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.ct-list-row:last-child { border-bottom: 0; }
.ct-list-row .grow { flex: 1 1 auto; min-width: 0; }
/* ---- Lists on phones: each row is a card, with its title first (site.js adds the labels) ---- */
@media (max-width: 767.98px) {
  .ct-stack, .ct-stack > tbody { display: block; }
  .ct-stack > thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .ct-stack > tbody > tr { display: flex; flex-direction: column; gap: .4rem; padding: .9rem 1rem; border-bottom: 1px solid var(--bs-border-color); }
  .ct-stack > tbody > tr:last-child { border-bottom: 0; }
  .ct-stack > tbody > tr > * { display: flow-root; width: auto; min-width: 0; padding: 0; border: 0; text-align: start !important; white-space: normal !important; overflow-wrap: anywhere; }
  /* the value wraps beside its label, never under it */
  .ct-stack > tbody > tr > [data-label] { padding-left: 8rem; }
  .ct-stack > tbody > tr > [data-label]::before { content: attr(data-label); float: left; width: 7.5rem; margin-left: -8rem; color: var(--bs-secondary-color); font-size: .8rem; line-height: 1.5rem; font-weight: 400; }
  .ct-stack > tbody > tr > .ct-stack-title { order: -1; font-size: 1.05rem; line-height: 1.35; }
  .ct-stack > tbody > tr > .ct-stack-empty { display: none; }
  .ct-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: .25rem; }
  /* the end of the page can be scrolled above the phone button */
  main { padding-bottom: 5.5rem !important; }
}

/* ---- Top bar on phones and tablets: menu, search and account, then language and association ---- */
@media (max-width: 991.98px) {
  #topNavbar { padding-left: .5rem !important; padding-right: .5rem !important; }
  #topNavbar > .container-fluid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; padding: 0; }
  #topNavbar > .container-fluid > .btn { margin: 0 !important; }
  #globalSearchWrapper { min-width: 0 !important; max-width: none !important; }
  #topNavbar .ct-top-tools { display: contents !important; }
  #topNavbar .ct-top-user { grid-row: 1; grid-column: 3; }
  #topNavbar .ct-top-choices { grid-row: 2; grid-column: 1 / -1; display: flex; gap: .5rem; min-width: 0; }
  #topNavbar .ct-top-choices > form { flex: 1 1 0; min-width: 0; }
  #topNavbar .ct-top-choices > form.ct-top-lang { flex: 0 0 auto; }
  #topNavbar .ct-top-choices > form:not(.ct-top-lang) :is(select, .input-group) { width: 100% !important; max-width: none !important; min-width: 0; }
}

.ct-empty { text-align: center; color: var(--bs-secondary-color); padding: 2rem 1rem; }

/* Lists: rows that open with a click (site.js) */
tr:has(a[data-row-link]) > td { cursor: pointer; }
tr:has(a[data-row-link]) > td:has(a.btn, button, input:not([type=hidden]), select, textarea) { cursor: auto; }

/* Read first, change after "Edit" (site.js): locked fields look like text */
.ct-locked [data-edit-only], [data-lock]:not(.ct-locked) [data-view-only] { display: none !important; }
.ct-locked [data-lock-part] .form-label { color: var(--bs-secondary-color); font-size: .8rem; font-weight: 400 !important; margin-bottom: 0; }
.ct-locked [data-lock-part] :is(.form-control, .form-select):disabled { background: none; border-color: transparent; color: inherit; opacity: 1; padding-left: 0; padding-right: 0; resize: none; -webkit-text-fill-color: currentColor; }
.ct-locked [data-lock-part] :is(.form-control, .form-select):disabled::placeholder { color: transparent; -webkit-text-fill-color: transparent; }
.ct-locked [data-lock-part] input.ct-no-value:disabled { color: transparent; -webkit-text-fill-color: transparent; }
.ct-locked [data-lock-part] input:disabled::-webkit-calendar-picker-indicator { display: none; }
.ct-locked [data-lock-part] :is(.form-check-input, .form-check-input:disabled ~ .form-check-label) { opacity: 1; }
.ct-locked [data-lock-part] .btn-check:disabled + .btn { opacity: 1; }
.ct-locked [data-lock-part] .btn-check:disabled:not(:checked) + .btn { display: none; }
.ct-locked .ct-lock-list .form-check:has(input:not(:checked)) { display: none; }

/* ---- Calendars ---- */
/* as high as the rest of the screen, instead of growing with its width */
.cal-page { --cal-h: max(440px, calc(100dvh - var(--cal-top, 130px) - 1rem)); display: grid; gap: .75rem; }
.cal-main, .cal-day { min-width: 0; min-height: 0; }
.cal-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; }
.cal-visit { border-left: 4px solid #146c43; padding: .4rem .6rem; margin-bottom: .5rem; background: var(--bs-tertiary-bg); border-radius: .25rem; overflow-wrap: anywhere; }
.cal-visit.done { border-left-color: var(--bs-secondary); }
#calendar .fc-toolbar-title { font-size: 1.15rem; }
#calendar .fc-button { padding: .25rem .6rem; font-size: .875rem; }
#calendar .fc-toolbar { margin-bottom: .6rem; gap: .4rem; }
#calendar .fc-daygrid-day { cursor: pointer; }
#calendar .fc-daygrid-day-number, #calendar .fc-col-header-cell-cushion { color: inherit; text-decoration: none; }
#calendar .fc-daygrid-event .fc-event-time { flex-shrink: 0; overflow: visible; }
#calendar .cal-chosen { box-shadow: inset 0 0 0 2px #0d6efd; }
@media (min-width: 769px) {
    .cal-main { height: var(--cal-h); }
    .cal-main .card-body, #calendar { height: 100%; min-height: 0; }
}
@media (min-width: 1200px) {
    .cal-two { grid-template-columns: minmax(0, 1fr) 320px; }
    .cal-two .cal-main { order: -1; }
    .cal-day { height: var(--cal-h); }
    #calDay { overflow-y: auto; }
}
@media (max-width: 768px) {
    #calendar .fc-toolbar { flex-direction: column; }
}
