/* App-specific styles (Tailwind handles the rest). */

/* Shared modern field chrome */
.form-input,
.form-select {
  border: 1px solid #e2e8f0; /* slate-200 */
  border-radius: 0.75rem; /* rounded-xl */
  background-color: #fff;
  color: #0f172a; /* slate-900 */
  box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:hover,
.form-select:hover {
  border-color: #cbd5e1; /* slate-300 */
}

.form-input:focus,
.form-select:focus {
  border-color: #94a3b8; /* slate-400 */
  outline: none;
  box-shadow: 0 0 0 3px rgb(15 23 42 / 0.08);
}

/* Computed totals stay visible like other amount fields — not a gray disabled box. */
.form-input[readonly] {
  background-color: #fff;
  color: #0f172a;
  cursor: default;
  opacity: 1;
  -webkit-text-fill-color: #0f172a;
}

/* Payment Total: modest emphasis over Interest / Principal / Fees. */
.form-input.payment-total-input,
.form-input.payment-total-input[readonly] {
  background-color: #ecfdf5; /* emerald-50 */
  border-color: #6ee7b7; /* emerald-300 */
  color: #0f172a; /* slate-900 */
  -webkit-text-fill-color: #0f172a;
  cursor: default;
  font-size: 1rem; /* text-base vs text-sm on other amount fields */
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.form-input.payment-total-input:hover,
.form-input.payment-total-input[readonly]:hover {
  border-color: #34d399; /* emerald-400 */
}

/* One receipt card: shared Received on / Payment type sit with period lines. */
.payment-receipt {
  border: 1px solid #e2e8f0; /* slate-200 */
  border-radius: 0.75rem;
  background-color: rgb(248 250 252 / 0.7); /* slate-50/70 */
  padding: 0.75rem;
}

.payment-receipt [data-payment-period-row] + [data-payment-period-row] {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

/* Fees + Total + submit stay a tight left-aligned cluster — no flex-grow hole. */
.payment-fees-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.payment-fees-row [data-payment-fee-list] {
  flex: 0 1 auto;
  min-width: 0;
}

/* Total + Record payment (or Save) sit as one tight control group. */
.payment-fees-row [data-payment-total-actions] {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.375rem;
}

.payment-fees-row [data-payment-total-actions] > * {
  margin: 0;
}

.form-input[readonly]::-webkit-inner-spin-button,
.form-input[readonly]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-input[readonly] {
  -moz-appearance: textfield;
}

/* Keep Rails error wrappers from breaking the form grid; show a rose border. */
.field_with_errors {
  display: contents;
}

.field_with_errors .form-input,
.field_with_errors .form-select {
  border-color: #fda4af; /* rose-300 */
}

/* Custom select: hide native arrows, soft chevron */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.15rem 1.15rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Date inputs: calendar icon affordance (Flatpickr alt input) */
.form-datepicker {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.15rem 1.15rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Flatpickr calendar — slate, modern.
   Vendor grid is 307.875px. Inner padding must be added to the
   calendar width or overflow:hidden clips Saturday. */
.flatpickr-calendar {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  box-shadow: 0 18px 40px -16px rgb(15 23 42 / 0.28), 0 4px 12px rgb(15 23 42 / 0.06);
  width: calc(307.875px + 1rem + 2px);
  overflow: hidden;
}

.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
  display: none;
}

.flatpickr-months {
  padding: 0.65rem 0.4rem 0.15rem;
  align-items: center;
}

.flatpickr-months .flatpickr-month {
  height: 2.25rem;
}

.flatpickr-current-month {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  padding-top: 0.15rem;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  top: 0.7rem;
  fill: #64748b;
  padding: 0.35rem;
  border-radius: 0.5rem;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  background: #f1f5f9;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
  fill: #0f172a;
}

.flatpickr-weekdays {
  background: transparent;
  margin-top: 0.15rem;
}

span.flatpickr-weekday {
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.flatpickr-day {
  border-radius: 0.55rem;
  color: #0f172a;
  font-weight: 500;
  /* Vendor is 7 x 39px in a 307.875px flex wrap. Auto side
     margins wrap Saturday onto a leftover row (Sept 4–5). */
  max-width: 39px;
  height: 39px;
  line-height: 39px;
  margin: 0;
  margin-top: 1px;
  border: none;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
  background: #f1f5f9;
  border-color: transparent;
}

.flatpickr-day.today {
  border: 1px solid #cbd5e1;
  font-weight: 700;
}

.flatpickr-day.today:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: #cbd5e1;
}

.flatpickr-day.inRange {
  background: #f1f5f9;
  box-shadow: none;
  border-color: transparent;
}

.flatpickr-weekdays,
.flatpickr-days,
.flatpickr-days .dayContainer {
  width: 307.875px;
  min-width: 307.875px;
  max-width: 307.875px;
}

.flatpickr-innerContainer {
  padding: 0 0.5rem 0.65rem;
}

/* Property show tabs */
.property-tab {
  display: inline-flex;
  align-items: center;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b; /* slate-500 */
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.property-tab:hover {
  background-color: rgb(255 255 255 / 0.5);
  color: #1e293b; /* slate-800 */
}

.property-tab--selected,
.property-tab--selected:hover {
  background-color: #fff;
  color: #0f172a; /* slate-900 */
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.05), 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.tab-panel-hidden {
  display: none !important;
}

/* File dropzone — drag/drop + click browse */
.file-dropzone {
  position: relative;
  display: block;
  width: 100%;
}

.file-dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-dropzone__surface {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 6.5rem;
  padding: 1.25rem 1rem;
  border: 1.5px dashed #cbd5e1; /* slate-300 */
  border-radius: 0.75rem; /* rounded-xl */
  background-color: #f8fafc; /* slate-50 */
  color: #475569; /* slate-600 */
  text-align: center;
  box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.04);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.file-dropzone:hover .file-dropzone__surface,
.file-dropzone:focus-within .file-dropzone__surface {
  border-color: #94a3b8; /* slate-400 */
  background-color: #f1f5f9; /* slate-100 */
}

.file-dropzone--active .file-dropzone__surface {
  border-color: #475569; /* slate-600 */
  border-style: solid;
  background-color: #e2e8f0; /* slate-200 */
  box-shadow: 0 0 0 3px rgb(15 23 42 / 0.08);
}

.file-dropzone--filled .file-dropzone__surface {
  border-style: solid;
  border-color: #cbd5e1;
  background-color: #fff;
}

.file-dropzone__icon {
  width: 1.5rem;
  height: 1.5rem;
  color: #64748b; /* slate-500 */
  margin-bottom: 0.15rem;
}

.file-dropzone__prompt {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.35;
  color: #475569;
}

.file-dropzone__browse {
  font-weight: 600;
  color: #0f172a; /* slate-900 */
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-dropzone__hint {
  margin: 0;
  font-size: 0.75rem;
  color: #94a3b8; /* slate-400 */
}

.file-dropzone__filename {
  margin: 0;
  max-width: 100%;
  font-size: 0.875rem;
  font-weight: 500;
  color: #0f172a;
  word-break: break-all;
}

.file-dropzone__clear {
  position: relative;
  z-index: 3;
  margin-top: 0.35rem;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-dropzone__clear:hover {
  color: #0f172a;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Portfolio data grid — dense, DataTables-like chrome. The box grows with
   visible rows so the page scrolls; no inner vertical scrollbar. */
.data-grid {
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
}

.data-grid__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.7rem 0.85rem;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}

.data-grid__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.data-grid__check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.data-grid__check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.data-grid__check-box {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  border: 1px solid #cbd5e1;
  border-radius: 0.4rem;
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.data-grid__check:hover .data-grid__check-box {
  border-color: #94a3b8;
}

.data-grid__check input:checked + .data-grid__check-box {
  border-color: #0f172a;
  background-color: #0f172a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2 6.4 11.2 12.5 4.8' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 0.8rem;
}

.data-grid__check input:focus-visible + .data-grid__check-box {
  box-shadow: 0 0 0 3px rgb(15 23 42 / 0.12);
}

.data-grid__year-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.data-grid__year {
  display: inline-flex;
  min-width: 0;
}

.data-grid__year-select {
  width: 6.75rem;
  padding: 0.35rem 2.15rem 0.35rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 0.5rem;
}

.data-grid__year-select:disabled {
  cursor: default;
  opacity: 0.65;
}

.data-grid__search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 14rem;
  justify-content: flex-end;
}

.data-grid__search-label {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
}

.data-grid__search-input {
  width: min(18rem, 100%);
  min-width: 0;
  padding: 0.4rem 0.7rem;
  border-radius: 0.5rem;
}

.data-grid__scroller {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-grid__table {
  width: 100%;
  min-width: 46rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  line-height: 1.35;
}

.data-grid__table th,
.data-grid__table td {
  padding: 0.45rem 0.7rem;
  text-align: left;
  vertical-align: middle;
  border-right: 1px solid #eef2f6;
  border-bottom: 1px solid #e8eef4;
  background: #fff;
}

.data-grid__table th:last-child,
.data-grid__table td:last-child {
  border-right: 0;
}

.data-grid__table thead th {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 #cbd5e1;
}

.data-grid__table tbody tr.is-even td {
  background: #f8fafc;
}

.data-grid__table tbody tr:hover td {
  background: #f1f5f9;
}

.data-grid__table thead th.is-sorted {
  background: #e8f1fe;
}

.data-grid__table tbody td.is-sorted {
  background: #f3f8ff;
}

.data-grid__table tbody tr.is-even td.is-sorted {
  background: #ebf3ff;
}

.data-grid__table tbody tr:hover td.is-sorted {
  background: #e0edff;
}

.data-grid__sort {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.data-grid__sort::after {
  content: "";
  display: inline-block;
  width: 0.7rem;
  height: 0.95rem;
  flex-shrink: 0;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath fill='%2394a3b8' d='M6 1.5 10.5 7H1.5z'/%3E%3Cpath fill='%2394a3b8' d='M6 14.5 1.5 9h9z'/%3E%3C/svg%3E");
}

.data-grid__table th.is-sorted-asc .data-grid__sort::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath fill='%232563eb' d='M6 1.5 10.5 7H1.5z'/%3E%3Cpath fill='%2394a3b8' d='M6 14.5 1.5 9h9z'/%3E%3C/svg%3E");
}

.data-grid__table th.is-sorted-desc .data-grid__sort::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath fill='%2394a3b8' d='M6 1.5 10.5 7H1.5z'/%3E%3Cpath fill='%232563eb' d='M6 14.5 1.5 9h9z'/%3E%3C/svg%3E");
}

.data-grid__icons-col {
  width: 8.25rem;
  min-width: 8.25rem;
  padding-left: 0.55rem !important;
  padding-right: 0.4rem !important;
}

.data-grid__flags {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.data-grid__tone {
  display: inline-block;
  width: 0.28rem;
  height: 1.15rem;
  border-radius: 999px;
  background: #94a3b8;
}

.data-grid__tone--ok { background: #22c55e; }
.data-grid__tone--alert { background: #ef4444; }
.data-grid__tone--warn { background: #f59e0b; }
.data-grid__tone--neutral { background: #64748b; }

.data-grid__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  line-height: 1;
}

.data-grid__icon--doc {
  color: #16a34a;
  text-decoration: none;
  box-sizing: content-box;
  padding: 0.35rem;
  margin: -0.35rem;
}

a.data-grid__icon--doc:hover,
a.data-grid__icon--doc:focus-visible {
  color: #15803d;
  text-decoration: none;
}

.data-grid__icon--doc svg {
  width: 1.05rem;
  height: 1.05rem;
}

.data-grid__icon--insurance {
  color: #e11d48;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1;
  text-decoration: none;
  box-sizing: content-box;
  padding: 0.35rem;
  margin: -0.35rem;
}

a.data-grid__icon--insurance:hover,
a.data-grid__icon--insurance:focus-visible {
  color: #be123c;
  text-decoration: none;
}

.data-grid__icon--tax {
  color: #7c3aed;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1;
  text-decoration: none;
  box-sizing: content-box;
  padding: 0.35rem;
  margin: -0.35rem;
}

a.data-grid__icon--tax:hover,
a.data-grid__icon--tax:focus-visible {
  color: #6d28d9;
  text-decoration: none;
}

.data-grid__icon--cash {
  color: #2563eb;
  font-size: 0.85rem;
  font-weight: 800;
}

.data-grid__icon--rented {
  width: auto;
  min-width: 1.05rem;
  padding: 0 0.22rem;
  height: 1.05rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1;
}

.data-grid__icon--sold {
  width: auto;
  min-width: 1.05rem;
  padding: 0 0.22rem;
  height: 1.05rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1;
}

.data-grid__icon--owner {
  width: auto;
  min-width: 0.85rem;
  color: #15803d;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1;
}

.data-grid__link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}

.data-grid__sub.data-grid__link {
  color: #1d4ed8;
  font-weight: 500;
}

.data-grid__link:hover {
  text-decoration: underline;
}

.data-grid__sub {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
}

.data-grid__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-grid__table th.data-grid__num .data-grid__sort {
  justify-content: flex-end;
}

.data-grid__interest {
  color: #047857;
  font-weight: 600;
}

.data-grid__unset {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.2rem;
  background: #fde047;
  color: #422006;
  font-weight: 600;
}

.data-grid__status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
}

.data-grid__status--ok {
  background: #ecfdf3;
  color: #15803d;
  box-shadow: inset 0 0 0 1px #bbf7d0;
}

.data-grid__status--alert {
  background: #fff1f2;
  color: #be123c;
  box-shadow: inset 0 0 0 1px #fecdd3;
}

.data-grid__status--warn { color: #b45309; }
.data-grid__status--neutral { color: #475569; }

.data-grid__chip--teal { color: #0f766e; }
.data-grid__chip--sky { color: #0369a1; }
.data-grid__chip--slate { color: #475569; }
.data-grid__chip--amber { color: #b45309; }

.data-grid__actions-col {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.contact-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: end;
  padding: 0.9rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.contact-row--phone {
  grid-template-columns: minmax(0, 1fr) 8.75rem auto auto;
}

.contact-row__primary {
  justify-content: center;
}

@media (max-width: 640px) {
  .contact-row,
  .contact-row--phone {
    grid-template-columns: 1fr 1fr;
  }

  .contact-row__field,
  .contact-row__label {
    grid-column: 1 / -1;
  }
}

.data-grid__year-hint {
  margin: 0;
  padding: 0.7rem 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #9a3412;
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
}

.data-grid__empty {
  margin: 0;
  padding: 1.25rem 0.85rem;
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

/* YTD PNL year-by-month grid: opened INDVL PNL (narrow left rail + 14
   columns) must fit ~1100px content / a 13" laptop without a horizontal
   scrollbar. Master PNL stays full-width with slightly roomier columns.
   Phones may still scroll the table inside overflow-x-auto. */
.ytd-pnl-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  line-height: 1.25;
}

.ytd-pnl-grid__category,
.ytd-pnl-grid__month,
.ytd-pnl-grid__total {
  padding: 0.3rem 0.18rem;
}

.ytd-pnl-grid__category {
  min-width: 6.75rem;
  padding-left: 0.45rem;
  padding-right: 0.3rem;
  white-space: normal;
}

.ytd-pnl-grid__month {
  font-variant-numeric: tabular-nums;
}

.ytd-pnl-grid__total {
  padding-left: 0.28rem;
  padding-right: 0.4rem;
  font-variant-numeric: tabular-nums;
}

/* Desktop: rail appears at Tailwind lg. Lock columns to the container
   so overflow-x-auto does not kick in on a 13" laptop. */
@media (min-width: 1024px) {
  .ytd-pnl-grid {
    table-layout: fixed;
  }

  .ytd-pnl-grid__category {
    width: 8.25rem;
    white-space: normal;
  }

  .ytd-pnl-grid__month {
    width: auto;
  }

  .ytd-pnl-grid__total {
    width: 7.25rem;
  }

  .ytd-pnl-grid--with-rail .ytd-pnl-grid__category {
    width: 7.25rem;
  }

  .ytd-pnl-grid--with-rail .ytd-pnl-grid__total {
    width: 6.25rem;
  }
}

@media (max-width: 1023px) {
  .ytd-pnl-grid {
    min-width: 52rem;
  }

  .ytd-pnl-grid__category {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .data-grid__toolbar {
    align-items: stretch;
  }

  .data-grid__filters {
    width: 100%;
  }

  .data-grid__check {
    min-height: 2.25rem;
  }

  .data-grid__year-filter {
    flex: 1 1 100%;
  }

  .data-grid__year-select {
    width: auto;
    min-width: 6.5rem;
    max-width: 8.5rem;
    min-height: 2.25rem;
  }

  .data-grid__search {
    justify-content: stretch;
    flex-basis: 100%;
  }

  .data-grid__search-input {
    width: 100%;
  }

  .data-grid__table {
    font-size: 0.8125rem;
  }

  .data-grid__table th,
  .data-grid__table td {
    padding: 0.5rem 0.65rem;
  }
}

/* Property photo expand — full-viewport dialog so padding is the close target */
.photo-lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 1.5rem;
  border: none;
  background: transparent;
  cursor: zoom-out;
}

.photo-lightbox:not([open]) {
  display: none;
}

.photo-lightbox[open] {
  display: grid;
  place-items: center;
}

.photo-lightbox::backdrop {
  background: rgb(15 23 42 / 0.72);
  backdrop-filter: blur(6px);
}

.photo-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: min(80dvh, calc(100dvh - 3rem));
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.9rem;
  box-shadow: 0 24px 48px -16px rgb(15 23 42 / 0.45);
  cursor: default;
}

html:has(.photo-lightbox[open]) {
  overflow: hidden;
}

/* In-app Turbo confirm — replaces native window.confirm (OK/Cancel) */
.app-confirm {
  width: min(calc(100vw - 2rem), 24rem);
  max-width: 24rem;
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
}

.app-confirm:not([open]) {
  display: none;
}

.app-confirm[open] {
  display: block;
}

.app-confirm::backdrop {
  background: rgb(15 23 42 / 0.48);
  backdrop-filter: blur(5px);
}

.app-confirm__panel {
  margin: 0;
  padding: 1.35rem 1.4rem 1.25rem;
  border: 1px solid #e2e8f0; /* slate-200 */
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 24px 48px -16px rgb(15 23 42 / 0.35), 0 8px 16px rgb(15 23 42 / 0.06);
}

.app-confirm__message {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: #0f172a; /* slate-900 */
}

.app-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.app-confirm__btn {
  min-height: 2.75rem;
  padding: 0.55rem 1.15rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-confirm__btn:focus {
  outline: none;
}

.app-confirm__btn:focus-visible {
  box-shadow: 0 0 0 3px rgb(15 23 42 / 0.1);
}

.app-confirm__btn--cancel {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155; /* slate-700 */
}

.app-confirm__btn--cancel:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.app-confirm__btn--confirm {
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #fff;
}

.app-confirm__btn--confirm:hover {
  background: #1e293b;
}

.app-confirm--destructive .app-confirm__btn--confirm {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

.app-confirm--destructive .app-confirm__btn--confirm:hover {
  border-color: #b91c1c;
  background: #b91c1c;
}

.app-confirm--destructive .app-confirm__btn--confirm:focus-visible {
  box-shadow: 0 0 0 3px rgb(220 38 38 / 0.22);
}

html:has(.app-confirm[open]) {
  overflow: hidden;
}

@media (max-width: 390px) {
  .app-confirm__actions {
    flex-direction: column;
  }

  .app-confirm__btn {
    width: 100%;
  }
}
