/* ============================================================
   RENTYON — design tokens & component library
   Purple / warm-neutral palette aligned with the mobile app.
   Serif display numerals, semantic accents, hairline structure.
   ============================================================ */

:root {
  /* -- color: core ------------------------------------------ */
  --paper:      #F6F3EF;
  --surface:    #FFFFFF;
  --ink:        #361F42;
  --ink-soft:   #5A4D68;
  --muted:      #7A7386;
  --line:       #DDD6CF;
  --line-soft:  #E8E3DD;
  --wash:       #EBE7F0;   /* lavender-tinted panel fill */

  /* -- color: accent (non-semantic highlight) --------------- */
  --accent:         #96C8E2;
  --accent-wash:    #EAF4FA;
  --accent-ring:    rgba(150, 200, 226, 0.42);
  --accent-border:  rgba(150, 200, 226, 0.55);

  /* -- color: semantic accents (meaning, not decoration) ---- */
  --danger:       #E24B4A;
  --danger-wash:  #FCEAEA;
  --warn:         #BA7517;
  --warn-wash:    #F8F0E3;
  --ok:           #639922;
  --ok-wash:      #EDF5E4;
  --chart-1:      #361F42;
  --chart-2:      #8B7E96;
  --chart-3:      #96C8E2;

  /* -- interactive & overlay (derived from ink / paper) ------- */
  --ink-hover:           #4A2D58;
  --danger-hover:        #C93A39;
  --danger-soft-hover:   #F5DAD8;
  --paper-on-ink-50:     rgba(246, 243, 239, 0.5);
  --paper-on-ink-55:     rgba(246, 243, 239, 0.55);
  --ink-ring:            rgba(54, 31, 66, 0.08);
  --ink-shadow-md:       rgba(54, 31, 66, 0.25);
  --backdrop:            rgba(54, 31, 66, 0.35);
  --danger-border-20:    rgba(226, 75, 74, 0.2);
  --danger-border-25:    rgba(226, 75, 74, 0.25);
  --ok-border-25:        rgba(99, 153, 34, 0.25);
  --shadow-search:       0 12px 40px rgba(54, 31, 66, 0.12);

  /* -- typography ------------------------------------------- */
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Instrument Sans", -apple-system, "Segoe UI", sans-serif;
  --text-xs: 11px; --text-sm: 13px; --text-md: 14.5px; --text-lg: 17px;
  --display-sm: 26px; --display-md: 34px; --display-lg: 44px; --display-xl: 58px;
  --tracking-caps: 0.14em;

  /* -- spacing rhythm ---------------------------------------- */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;

  /* -- radius & elevation ------------------------------------ */
  --r-sm: 4px; --r-md: 10px; --r-lg: 16px; --r-pill: 100px;
  --shadow-pop: 0 12px 32px rgba(54, 31, 66, .12), 0 2px 6px rgba(54, 31, 66, .08);
  --shadow-card: 0 1px 2px rgba(54, 31, 66, .04);
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; overflow-x: clip; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--text-md)/1.5 var(--font-body);
  font-feature-settings: "ss01";
  overflow-x: clip;
  max-width: 100%;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-soft); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1,h2,h3 { margin: 0; font-family: var(--font-display); font-weight: 400; }
button { font-family: var(--font-body); cursor: pointer; }
svg { display: block; }

.caps {
  font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--muted);
}
.serif-num { font-family: var(--font-display); font-variant-numeric: lining-nums; }

/* ============ top bar ============ */
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 50; }
.topbar__inner {
  max-width: 1280px; margin: 0 auto; padding: 0 var(--sp-6);
  display: flex; align-items: center; gap: var(--sp-4); height: 68px;
  min-width: 0;
}
.brand { font-family: var(--font-display); font-size: 24px; letter-spacing: -0.01em; white-space: nowrap; flex: none; }
.brand em { font-style: italic; color: var(--muted); }
.brand--logo { display: flex; align-items: center; line-height: 0; }
.brand__logo { display: block; object-fit: contain; flex: none; }
.brand__logo--header { height: 32px; width: 32px; }
.brand__logo--login { height: 40px; width: 40px; }
.brand__logo--landing { height: 44px; width: 44px; }
.brand__logo--legal { height: 32px; width: 32px; }
.brand__logo--hero { height: 72px; width: 72px; }
.brand__logo--mkt { height: 32px; width: 32px; }
.nav {
  display: flex; gap: var(--sp-1); margin: 0 auto; height: 100%;
  flex: 1 1 auto; min-width: 0; justify-content: center;
  align-items: stretch;
}
.nav > a,
.nav__groupbtn {
  display: flex; align-items: center; padding: 0 var(--sp-3); height: 100%;
  font-size: var(--text-sm); font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; flex: none;
}
.nav > a:hover,
.nav__groupbtn:hover { color: var(--ink); }
.nav > a[aria-current="page"],
.nav__groupbtn[aria-current="page"],
.nav__group.is-active > .nav__groupbtn {
  color: var(--ink); border-bottom-color: var(--ink);
}
.nav__group {
  display: flex; height: 100%; position: relative; flex: none;
}
.nav__groupbtn {
  gap: 5px; font: 500 var(--text-sm) var(--font-body);
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer;
}
.nav__groupbtn:focus { outline: none; }
.nav__groupbtn:focus-visible {
  color: var(--ink);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 8px;
}
.nav__groupbtn svg { translate: 0 1px; opacity: .7; flex: none; transition: transform .15s ease; }
.nav__group:hover > .nav__groupbtn,
.nav__group:focus-within > .nav__groupbtn,
.nav__group.is-open > .nav__groupbtn { color: var(--ink); }
.nav__group:hover > .nav__groupbtn svg,
.nav__group:focus-within > .nav__groupbtn svg,
.nav__group.is-open > .nav__groupbtn svg { transform: rotate(180deg); opacity: 1; }
.nav__group .dd__menu {
  /* Center under the parent label; overlap slightly so hover doesn't drop */
  left: 50%;
  right: auto;
  top: calc(100% - 4px);
  transform: translateX(-50%);
  min-width: max(168px, 100%);
  padding: 6px;
  z-index: 70;
}
@media (hover: hover) and (pointer: fine) {
  .nav__group:hover > .dd__menu,
  .nav__group:focus-within > .dd__menu { display: block; }
}
.nav__group.is-open > .dd__menu { display: block; }
.nav__group .dd__item[aria-current="page"] {
  background: var(--wash);
  color: var(--ink);
  font-weight: 600;
}
.topbar__actions { display: flex; align-items: center; gap: var(--sp-3); flex: none; min-width: 0; }

/* legacy overflow "More" (unused — kept harmless) */
.nav__more { display: none; height: 100%; position: relative; }
.nav__morebtn {
  display: flex; align-items: center; gap: 6px; padding: 0 var(--sp-4); height: 100%;
  font: 500 var(--text-sm) var(--font-body); color: var(--muted); background: none;
  border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav__morebtn:hover { color: var(--ink); }
.nav__morebtn svg { translate: 0 1px; }
.nav__more:has(a[aria-current]) .nav__morebtn { color: var(--ink); border-bottom-color: var(--ink); }
.nav__more .dd__menu { top: calc(100% + 4px); }

/* mobile menu (narrow widths) */
.ibtn.menu-toggle { display: none; }
.mobnav { display: none; border-top: 1px solid var(--line); background: var(--paper); padding: var(--sp-2) var(--sp-5) var(--sp-4); }
.mobnav > a,
.mobnav__section > a {
  display: flex; align-items: center; justify-content: space-between; padding: 13px 2px;
  font-family: var(--font-display); font-size: 22px; color: var(--ink-soft);
  border-bottom: 1px solid var(--line-soft);
}
.mobnav > a:last-child { border-bottom: none; }
.mobnav a:hover { color: var(--ink); }
.mobnav a[aria-current="page"] { color: var(--ink); }
.mobnav a[aria-current="page"]::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.mobnav__section { padding: 4px 0 8px; border-bottom: 1px solid var(--line-soft); }
.mobnav__section:last-of-type { border-bottom: none; }
.mobnav__label {
  padding: 12px 2px 4px;
  font: 600 11px/1.2 var(--font-body);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.mobnav__section > a {
  font-size: 20px;
  padding: 10px 2px 10px 8px;
}

.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--muted); z-index: 1; pointer-events: none; }
.search input {
  width: 210px; height: 38px; padding: 0 var(--sp-3) 0 36px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); font: 400 var(--text-sm) var(--font-body); color: var(--ink);
  transition: border-color .15s, width .2s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ink-ring); width: 280px; }
.search input:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }

.search-panel {
  position: absolute; top: calc(100% + 8px); right: 0; left: auto;
  width: min(420px, calc(100vw - 24px)); max-height: min(70vh, 440px);
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-search); z-index: 80;
  display: flex; flex-direction: column; overflow: hidden;
}
.search-panel[hidden] { display: none !important; }
.search-panel__status {
  padding: 10px 14px 6px; font: 500 11px/1.3 var(--font-body);
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line-soft);
}
.search-panel__list { overflow: auto; padding: 6px; }
.search-panel__item {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-rows: auto auto;
  gap: 0 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; min-width: 0;
}
.search-panel__item:hover { background: var(--wash); }
.search-panel__kind {
  grid-row: 1 / span 2; align-self: center;
  font: 600 10px/1.2 var(--font-body); letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted);
}
.search-panel__title {
  font: 600 13px/1.3 var(--font-body); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.search-panel__sub {
  font: 400 12px/1.35 var(--font-body); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
html[dir="rtl"] .search-panel { right: auto; left: 0; }
html[dir="rtl"] .search-panel__item { grid-template-columns: minmax(0, 1fr) 72px; }
html[dir="rtl"] .search-panel__kind { grid-column: 2; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font: 400 14px var(--font-display); border: none; flex: none;
}
.avatar--lg { width: 52px; height: 52px; font-size: 20px; }
.avatar--wash { background: var(--wash); color: var(--ink); border: 1px solid var(--line); }

/* notification badge (shown only when unread) */
.dd--notif .js-notif-btn { position: relative; }
.notif-dot {
  position: absolute; top: 7px; right: 8px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--paper);
  pointer-events: none;
}
.dd__menu--notif {
  min-width: 340px; max-width: min(92vw, 380px); padding: 0; overflow: hidden;
}
.notif-panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 12px 8px; border-bottom: 1px solid var(--line-soft);
}
.notif-panel__head strong { font-size: var(--text-sm); }
.notif-panel__list { max-height: 360px; overflow: auto; padding: var(--sp-2); }
.notif-item {
  display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 10px; border-radius: var(--r-sm); cursor: pointer; color: inherit;
  text-decoration: none;
}
.notif-item:hover { background: var(--wash); }
.notif-item.is-unread { background: color-mix(in srgb, var(--wash) 80%, transparent); }
.notif-item__title { font-size: var(--text-sm); font-weight: 600; margin: 0 0 2px; }
.notif-item__body {
  font-size: var(--text-xs); color: var(--muted); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-item__meta { font-size: 11px; color: var(--muted); margin-top: 4px; }
.notif-empty { padding: 20px 12px; text-align: center; color: var(--muted); font-size: var(--text-sm); }

/* legacy always-on dot — prefer .notif-dot + .has-unread */
.dot-badge { position: relative; }
.dot-badge.has-unread::after {
  content: ""; position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--paper);
}

/* ============ dropdown ============ */
.dd { position: relative; }
.dd__menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: var(--sp-2); display: none; z-index: 60;
}
.dd.is-open .dd__menu { display: block; }
.dd__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: none; background: none; border-radius: var(--r-sm); text-align: left;
  font-size: var(--text-sm); font-weight: 500; color: var(--ink);
}
.dd__item svg { color: var(--muted); }
.dd__item:hover { background: var(--wash); }
.dd__item--danger { color: var(--danger); }
.dd__item--danger svg { color: var(--danger); }
.dd__item--danger:hover { background: var(--danger-wash); }
.dd__rule { height: 1px; background: var(--line-soft); margin: var(--sp-2) 0; }
.dd__id { padding: 6px 10px 10px; }
.dd__id strong { display: block; font-weight: 600; font-size: var(--text-sm); }
.dd__id span { font-size: var(--text-xs); color: var(--muted); }

/* ============ page shell ============ */
.page {
  width: 100%; max-width: 1280px; min-width: 0; margin: 0 auto;
  padding: var(--sp-7) var(--sp-6) var(--sp-8); box-sizing: border-box;
}
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-6); min-width: 0; }
.page__title { font-size: var(--display-lg); line-height: 1.05; letter-spacing: -0.01em; }
.page__kicker { margin-bottom: var(--sp-2); }
.page__meta { margin-top: var(--sp-2); color: var(--muted); font-size: var(--text-sm); }
.page__actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; min-width: 0; }
.rule { border: none; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }

/* ============ buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px;
  border-radius: var(--r-pill); border: 1px solid transparent;
  font: 500 var(--text-sm) var(--font-body); transition: .15s; white-space: nowrap;
}
.btn:disabled, .btn.is-busy { opacity: .55; cursor: progress; pointer-events: none; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--ink-hover); color: var(--paper); }
.btn--primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); color: var(--paper); }
.btn--secondary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.btn--ghost:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
a.btn--primary,
a.btn--primary:hover,
a.btn--primary:focus,
a.btn--primary:focus-visible { color: var(--paper); }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--secondary:hover { border-color: var(--ink); }
.btn--ghost { background: none; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--wash); }
.btn--danger { background: var(--danger); color: var(--surface); }
.btn--danger:hover { background: var(--danger-hover); }
.btn--danger-soft { background: var(--danger-wash); color: var(--danger); }
.btn--danger-soft:hover { background: var(--danger-soft-hover); }
.btn--sm { height: 32px; padding: 0 14px; font-size: 12.5px; }
.btn--lg { height: 46px; padding: 0 26px; font-size: var(--text-md); }
.btn--full { width: 100%; justify-content: center; }

/* icon-only button */
.ibtn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); border: 1px solid transparent; background: none; color: var(--muted);
  transition: .15s; flex: none;
}
.ibtn:hover { background: var(--wash); color: var(--ink); }
.ibtn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-ring); }
.ibtn--edit:hover { background: var(--warn-wash); color: var(--warn); }
.ibtn--danger:hover { background: var(--danger-wash); color: var(--danger); }
.ibtn--framed { border-color: var(--line); background: var(--surface); }
.ibtn--framed:hover { border-color: var(--ink); color: var(--ink); background: var(--surface); }

/* ============ payment row actions (Flooss Split / legal warning) ============ */
.pay-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: nowrap; margin-inline-start: auto;
}
.pay-actions .btn { justify-content: center; gap: 7px; white-space: nowrap; }
.pay-actions .btn svg { flex: none; }
.pay-actions__note { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }

/* Flooss offer — accent while hidden from the renter */
.btn--flooss {
  background: var(--accent-wash); color: #1C6188;
  border-color: var(--accent-border); font-weight: 600;
}
.btn--flooss:hover { background: #D9EBF6; border-color: var(--accent); color: #14506F; }
.btn--flooss:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

/* Flooss offer — neutral "turn it off" once the renter can see it */
.btn--flooss-live { background: var(--surface); color: var(--ink-soft); border-color: var(--line); }
.btn--flooss-live:hover { background: var(--wash); color: var(--ink); border-color: var(--ink); }
.btn--flooss-live:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ink-ring); }

@media (max-width: 900px) {
  .pay-actions { flex-wrap: wrap; justify-content: flex-start; }
}

/* ============ tooltip ============ */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 7px);
  translate: -50% 2px; padding: 5px 10px; border-radius: 6px; white-space: nowrap;
  background: var(--ink); color: var(--paper); font: 500 11px/1 var(--font-body);
  letter-spacing: .02em; opacity: 0; pointer-events: none; transition: .15s; z-index: 70;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; translate: -50% 0; }

/* ============ cards & panels ============ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  min-width: 0; max-width: 100%;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) 0;
}
.card__title { font-size: var(--display-sm); }
.card__body { padding: var(--sp-5); min-width: 0; }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-scroll .table { min-width: 640px; }
.card--wash { background: var(--wash); box-shadow: none; }
.card--ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.card--ink .caps { color: var(--paper-on-ink-55); }

/* ============ stat ledger (hairline-divided strip) ============ */
.ledger {
  display: grid; grid-template-columns: repeat(6, 1fr);
  border-block: 1px solid var(--line);
  min-width: 0; max-width: 100%;
}
.ledger--3 {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: var(--sp-6);
}
.ledger--5 {
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: var(--sp-6);
}
.ledger--6 {
  grid-template-columns: repeat(6, 1fr);
  margin-bottom: var(--sp-6);
}
@media (max-width: 1100px) {
  .ledger--5, .ledger--6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .ledger--5, .ledger--6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .ledger--5, .ledger--6 { grid-template-columns: 1fr; }
}
.select--sm {
  width: 170px;
  padding-block: 6px;
}
.ledger__cell { padding: var(--sp-5) var(--sp-5) var(--sp-5) 0; border-left: 1px solid var(--line); padding-left: var(--sp-5); }
.ledger__cell:first-child { border-left: none; padding-left: 0; }
.ledger__num { font-family: var(--font-display); font-size: var(--display-md); line-height: 1.1; margin: 10px 0 4px; }
.ledger__num small { font-size: 0.55em; color: var(--muted); margin-right: 2px; }
.ledger__delta { font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; }
.up { color: var(--ok); } .down { color: var(--danger); } .flat { color: var(--muted); }

/* ============ status pills ============ */
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 11px;
  border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok { background: var(--ok-wash); color: var(--ok); }
.pill--warn { background: var(--warn-wash); color: var(--warn); }
.pill--danger { background: var(--danger-wash); color: var(--danger); }
.pill--neutral { background: var(--wash); color: var(--ink-soft); }
.pill--ink { background: var(--ink); color: var(--paper); }

/* ============ tables ============ */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: var(--sp-4); border-bottom: 1px solid var(--line-soft); font-size: var(--text-sm); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--wash); }
.table tbody tr.row--legal-warn { background: var(--danger-wash); }
.table tbody tr.row--legal-warn:hover { background: #f8d9d8; }
.table .t-num { font-family: var(--font-display); font-size: var(--text-lg); white-space: nowrap; }
.table .t-right { text-align: right; }
.table .t-actions { display: flex; gap: 2px; justify-content: flex-end; }
.t-person { display: flex; align-items: center; gap: var(--sp-3); font-weight: 500; }
.t-sub { color: var(--muted); font-size: var(--text-xs); display: block; font-weight: 400; }

/* ============ accordion (collapsed panels) ============ */
.acc {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden;
}
.acc + .acc { margin-top: var(--sp-3); }
.acc__sum {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5); cursor: pointer; list-style: none;
  transition: background .12s;
}
.acc__sum::-webkit-details-marker { display: none; }
.acc__sum:hover { background: var(--wash); }
.acc__sum:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent-ring); }
.acc__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.acc__title { font-weight: 600; font-size: var(--text-md); }
.acc__hint { font-size: var(--text-xs); color: var(--muted); }
.acc__meta { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.acc__chev { flex: none; color: var(--muted); transition: transform .18s; }
.acc[open] .acc__sum { background: var(--wash); border-bottom: 1px solid var(--line); }
.acc[open] .acc__chev { transform: rotate(180deg); }
.acc__body { padding: var(--sp-5); }

/* ============ forms ============ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: 400 var(--text-md) var(--font-body);
  padding: 11px 14px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--ink-ring);
}
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder { color: var(--muted); }
.input--underline { border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 2px; background: transparent; }
.input--underline:focus { box-shadow: none; border-bottom-color: var(--ink); }
.input--underline:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A7386' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.field__hint { font-size: var(--text-xs); color: var(--muted); }
.stamp-preview {
  width: 88px; height: 88px; margin-top: 10px;
  object-fit: contain; object-position: center;
  background: var(--wash); border: 1px solid var(--line);
  border-radius: var(--r-md); display: block;
}
.field--error .input { border-color: var(--danger); }
.field--error .field__hint { color: var(--danger); }

/* toggle */
.toggle { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle i {
  position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--line);
  transition: .18s; pointer-events: none;
}
.toggle i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px var(--ink-shadow-md); transition: .18s;
}
.toggle input:focus-visible + i { box-shadow: 0 0 0 2px var(--accent-ring); }
.toggle input:checked + i { background: var(--ink); }
.toggle input:checked + i::after { left: 21px; }

/* segmented tabs */
.tabs { display: inline-flex; gap: 2px; background: var(--wash); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.tabs button {
  border: none; background: none; padding: 6px 16px; border-radius: var(--r-pill);
  font: 500 12.5px var(--font-body); color: var(--muted); transition: .15s; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-active { background: var(--ink); color: var(--paper); }

/* ============ charts ============ */
.chart-legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-xs); font-weight: 500; color: var(--muted); }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.axis-label { font: 500 10px var(--font-body); fill: var(--muted); letter-spacing: .05em; }

/* ============ activity timeline ============ */
.feed { display: flex; flex-direction: column; }
.feed__item { display: flex; gap: var(--sp-4); padding: var(--sp-4) 0; border-bottom: 1px solid var(--line-soft); }
.feed__item:last-child { border-bottom: none; }
.feed__icon {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--wash); color: var(--ink-soft); border: 1px solid var(--line);
}
.feed__icon--ok { background: var(--ok-wash); color: var(--ok); border-color: transparent; }
.feed__icon--warn { background: var(--warn-wash); color: var(--warn); border-color: transparent; }
.feed__icon--danger { background: var(--danger-wash); color: var(--danger); border-color: transparent; }
.feed__body { flex: 1; min-width: 0; font-size: var(--text-sm); }
.feed__body strong { font-weight: 600; }
.feed__time { color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }

/* ============ property card ============ */
.prop-list { display: flex; flex-direction: column; gap: var(--sp-5); }
.prop { display: block; }
.prop__top {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: var(--sp-5);
  align-items: start;
}
.prop__img {
  aspect-ratio: 16/10; border-radius: var(--r-md); background: var(--wash);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--muted); overflow: hidden;
}
.prop__main { min-width: 0; }
.prop__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.prop__head > .row { flex: none; flex-wrap: wrap; }
.prop__id { min-width: 0; }
.prop__name { font-family: var(--font-display); font-size: var(--display-sm); }
.prop__addr { color: var(--muted); font-size: var(--text-sm); margin-top: 2px; }
.prop__contact {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  margin: var(--sp-2) 0 0; color: var(--ink-soft); font-size: var(--text-sm);
}
.prop__contact svg { flex: none; color: var(--muted); }
.prop__stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}
.prop__stat { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; gap: 2px; }
.prop__stat-num { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; line-height: 1.2; }
.occ-bar {
  display: block; width: 100%; height: 5px; background: var(--line-soft);
  border-radius: var(--r-pill); overflow: hidden; margin-top: var(--sp-2);
}
.occ-bar i { display: block; height: 100%; background: var(--ink); border-radius: var(--r-pill); }
@media (max-width: 980px) {
  .prop__top { grid-template-columns: 120px minmax(0, 1fr); }
  .prop__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .prop__top { grid-template-columns: 1fr; }
  .prop__img { max-width: 160px; }
  .prop__head { flex-wrap: wrap; }
  .prop__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============ misc ============ */
.grid { display: grid; gap: var(--sp-5); min-width: 0; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.split-8-4 { grid-template-columns: 2fr 1fr; }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.thumb { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--wash); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; overflow: hidden; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--muted); margin-bottom: var(--sp-3); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--ink); }
.filters { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--sp-5); }
.chip {
  height: 32px; padding: 0 15px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface); font: 500 12.5px var(--font-body); color: var(--muted); transition: .15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-ring); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ============ login ============ */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; position: relative; }
.login--solo { grid-template-columns: 1fr; }
.login--solo .login__pane { max-width: 480px; margin: 0 auto; width: 100%; }
.login__pane { display: flex; flex-direction: column; justify-content: center; padding: var(--sp-8); }
.login__art {
  background: var(--ink); color: var(--paper); display: flex; flex-direction: column;
  justify-content: space-between; padding: var(--sp-7);
}
.login__art .caps { color: var(--paper-on-ink-50); }
.login__quote { font-family: var(--font-display); font-size: var(--display-lg); line-height: 1.15; max-width: 15ch; }
.login__form { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-5); }
.login__brandrow { margin-bottom: 40px; }
.login__foot { display: flex; gap: 48px; }
.login__lang {
  position: absolute; top: var(--sp-5); inset-inline-end: var(--sp-5); z-index: 5;
}
.alert-inline {
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--danger-wash); color: var(--danger);
  font-size: var(--text-sm); border: 1px solid var(--danger-border-20);
}
.btn-spinner { margin-inline-start: 8px; }

/* ============ utilities ============ */
.u-muted { color: var(--muted); }
.u-xs { font-size: var(--text-xs); }
.u-sm { font-size: var(--text-sm); }
.u-center { text-align: center; }
.u-link { text-decoration: underline; text-underline-offset: 3px; }
.u-mt-1 { margin-top: var(--sp-2); }
.u-mt-2 { margin-top: var(--sp-4); }
.u-mt-3 { margin-top: var(--sp-5); }
.u-mb-2 { margin-top: 0; margin-bottom: var(--sp-4); }
.u-m0 { margin: 0; }
.u-flex1 { flex: 1; min-width: 0; }
.u-truncate {
  display: block; max-width: 240px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.num-lg { font-family: var(--font-display); font-size: 30px; line-height: 1.15; }
.num-xl { font-family: var(--font-display); font-size: var(--display-lg); line-height: 1.05; }
.h-md { font-size: var(--display-md); }
.mark { border-radius: var(--r-md); }
.check-label { display: inline-flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--ink-soft); cursor: pointer; }

@media (max-width: 980px) {
  .ledger { grid-template-columns: repeat(3, 1fr); }
  .ledger__cell:nth-child(4) { border-left: none; padding-left: 0; }
  .ledger__cell { border-top: 1px solid var(--line-soft); }
  .ledger__cell:nth-child(-n+3) { border-top: none; }
  .cols-2, .cols-3, .split-8-4 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login__art { display: none; }
}

@media (max-width: 740px) {
  .topbar__inner { gap: var(--sp-3); padding: 0 var(--sp-4); }
  .nav { display: none; }
  .ibtn.menu-toggle { display: inline-flex; }
  .topbar.is-open .mobnav { display: block; }
  .search input { width: 130px; }
  .search input:focus { width: 150px; }
}

/* ============ utilities & shared patterns ============ */
.d-none { display: none !important; }
.admin-grid { margin-top: var(--sp-6); }
.dash-grid { margin-top: var(--sp-6); }
.donut-wrap { display: flex; align-items: center; gap: var(--sp-5); }
.donut { position: relative; width: 150px; flex: none; }
.donut__label {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.donut__label .num-lg { font-size: 34px; }
.mini-chart { padding: var(--sp-5); }
.mini-chart .num-lg { font-size: 38px; margin: 6px 0 2px; }
.see-all {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-sm); font-weight: 500; color: var(--muted);
}
.see-all:hover { color: var(--ink); }
.prop-block { min-width: 0; }
.prop-detail { border-top: 1px solid var(--line); }
.prop-detail .card__body { padding-top: var(--sp-5); }
.occ-bar__fill { display: block; height: 100%; background: var(--ink); border-radius: var(--r-pill); width: 0; }
.chart-legend--col { flex-direction: column; align-items: flex-start; }
.filters__search {
  width: 220px; padding-block: 8px; flex: none;
}
.flash {
  margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); font-size: var(--text-sm); border: 1px solid var(--line);
}
.flash--ok { background: var(--ok-wash); color: var(--ok); border-color: var(--ok-border-25); }
.flash--danger { background: var(--danger-wash); color: var(--danger); border-color: var(--danger-border-25); }

/* ============ toasts ============ */
.toasts {
  position: fixed; z-index: 1000;
  bottom: var(--sp-5); inset-inline-end: var(--sp-5);
  display: flex; flex-direction: column; gap: 10px;
  width: min(400px, calc(100vw - var(--sp-5) * 2));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 10px 30px var(--ink-shadow-md);
  font-size: var(--text-sm); line-height: 1.45; color: var(--ink);
  pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast.is-out { animation: toast-out .2s ease-in forwards; }
.toast__icon { flex: none; display: flex; width: 18px; height: 18px; margin-top: 1px; }
.toast__icon svg { width: 18px; height: 18px; }
.toast__msg { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast__x {
  flex: none; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1; padding: 0 2px;
}
.toast__x:hover { color: var(--ink); }
.toast--ok { border-color: var(--ok-border-25); }
.toast--ok .toast__icon { color: var(--ok); }
.toast--error { border-color: var(--danger-border-25); }
.toast--error .toast__icon { color: var(--danger); }
.toast--info .toast__icon, .toast--pending .toast__icon { color: var(--muted); }
.toast__spin { animation: toast-spin .8s linear infinite; transform-origin: 50% 50%; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes toast-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.is-out { animation: none; }
  .toast__spin { animation-duration: 2s; }
}

.set-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5);
  padding: var(--sp-4) 0; border-bottom: 1px solid var(--line-soft);
}
.set-row:last-child { border-bottom: none; }
.set-row__label { font-weight: 500; }
.set-row__hint { color: var(--muted); font-size: var(--text-sm); margin-top: 2px; }

/* Design system showcase (settings bottom template) */
.showcase { margin-top: var(--sp-7); }
.showcase__title { font-size: var(--display-md); }
.demo-block { padding: var(--sp-5) 0; border-bottom: 1px solid var(--line-soft); }
.demo-block:last-child { border-bottom: none; }
.demo-block > .caps { display: block; margin-bottom: var(--sp-4); }
.swatch-row, .demo-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.swatch { width: 120px; }
.swatch i { display: block; height: 56px; border-radius: var(--r-md); border: 1px solid var(--line); }
.swatch span { display: block; font-size: var(--text-xs); color: var(--muted); margin-top: 6px; }
.swatch__ink { background: var(--ink); }
.swatch__paper { background: var(--paper); }
.swatch__wash { background: var(--wash); }
.swatch__danger { background: var(--danger); }
.swatch__warn { background: var(--warn); }
.swatch__ok { background: var(--ok); }
.swatch__accent { background: var(--accent); }
.swatch__accent-wash { background: var(--accent-wash); border-color: var(--accent-border); }
.swatch__chart-2 { background: var(--chart-2); }
.swatch__chart-3 { background: var(--chart-3); }
.demo-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.demo-filters { margin: 0; }
.type-display { font-size: var(--display-lg); }
.card--danger-zone { border-color: var(--danger-wash); }
.card--danger-zone .card__title { color: var(--danger); }
@media (max-width: 800px) {
  .demo-fields { grid-template-columns: 1fr; }
}

/* Pagination */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-top: var(--sp-5); flex-wrap: wrap; min-width: 0;
}
.pager__meta { font-size: var(--text-sm); color: var(--muted); }
.pager__actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.pager__nums { display: inline-flex; align-items: center; gap: 2px; }
.pager__num {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); font: 500 12.5px var(--font-body);
  color: var(--muted); cursor: pointer; transition: .15s;
}
.pager__num:hover { border-color: var(--ink); color: var(--ink); }
.pager__num:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-ring); }
.pager__num.is-active {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
}
.pager__ellipsis {
  padding: 0 4px; color: var(--muted); font-size: var(--text-sm); user-select: none;
}

.kv { display: flex; flex-direction: column; gap: var(--sp-3); }
.kv > div { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--text-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; text-align: right; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: var(--backdrop);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
}
.modal {
  width: min(480px, 100%);
  max-height: 90vh; overflow: auto;
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-5) 0;
}

@media (max-width: 740px) {
  .filters__search { width: 100%; }
  .page__head { flex-direction: column; align-items: flex-start; }
  .page { padding: var(--sp-6) var(--sp-4) var(--sp-7); }
}

/* ============ language toggle ============ */
.lang-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink);
  font: 600 12px var(--font-body); letter-spacing: .04em;
  cursor: pointer; transition: .15s;
}
.lang-toggle:hover { border-color: var(--ink); }
.lang-toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-ring); }
.lang-toggle__globe { display: flex; color: var(--muted); }
.lang-toggle__code { min-width: 1.5em; text-align: center; }
.lang-toggle::after { display: none !important; }
.js-notif-btn::after { display: none !important; }

/* ============ Arabic / RTL (layout mirror, same design) ============ */
html.is-ar body,
html[lang="ar"] body {
  font-family: "IBM Plex Sans Arabic", var(--font-body);
}
html.is-ar .page__title,
html.is-ar .card__title,
html.is-ar .h-md,
html.is-ar .brand,
html[lang="ar"] .page__title,
html[lang="ar"] .card__title,
html[lang="ar"] .h-md,
html[lang="ar"] .brand {
  font-family: "IBM Plex Sans Arabic", var(--font-display);
  letter-spacing: 0;
}
html[dir="rtl"] .ledger__cell { border-left: none; border-right: 1px solid var(--line); padding-left: var(--sp-5); padding-right: var(--sp-5); }
html[dir="rtl"] .ledger__cell:first-child { border-right: none; padding-right: 0; }
html[dir="rtl"] .t-right { text-align: left; }
html[dir="rtl"] .kv dd { text-align: left; }
html[dir="rtl"] .search input { text-align: right; }
html[dir="rtl"] .dd__menu { right: auto; left: 0; }
html[dir="rtl"] .nav__group .dd__menu {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}
html[dir="rtl"] .nav__groupbtn svg,
html[dir="rtl"] .nav__morebtn svg { margin-inline-start: 4px; }
html[dir="rtl"] .mobnav__section > a { padding-left: 2px; padding-right: 8px; }

/* ============ admin marketing ============ */
.mkt-list {
  max-height: 520px; overflow: auto;
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: var(--sp-2);
}
.mkt-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px;
  border-radius: var(--r-sm);
  border-bottom: 1px solid var(--line-soft);
}
.mkt-row:last-child { border-bottom: none; }
.mkt-row:hover { background: var(--wash); }
.mkt-row__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mkt-row .pill { flex-shrink: 0; }
.mkt-body {
  white-space: pre-wrap; word-break: break-word;
  font: 500 13px/1.55 var(--font-body);
  margin: 0; padding: var(--sp-4);
  background: var(--wash); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); max-height: 360px; overflow: auto;
}
.u-mt-2 { margin-top: var(--sp-6); }

/* ============ admin tickets / contracts ============ */
.modal--wide { width: min(720px, 100%); }
.is-clickable { cursor: pointer; }
.is-clickable:hover td { background: var(--wash); }
.tk-thread { display: flex; flex-direction: column; gap: var(--sp-3); max-height: 360px; overflow: auto; }
.tk-msg { padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--wash); }
.tk-msg p { margin: 6px 0 0; font-size: var(--text-sm); }

/* uniform attachment thumbnails (tickets, etc.) */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: var(--sp-3);
  max-width: 100%;
}
.media-grid__item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--wash);
  overflow: hidden;
  display: block;
  transition: border-color .15s, box-shadow .15s;
}
.media-grid__item:hover {
  border-color: var(--ink-soft);
  box-shadow: var(--shadow-card);
}
.media-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-grid__item.is-broken {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: center;
  padding: var(--sp-2);
  pointer-events: none;
}
.media-grid__item.is-broken svg { opacity: .45; margin-bottom: 4px; }
.tk-desc { white-space: pre-wrap; line-height: 1.55; }
.msg { border-left: 2px solid var(--line); padding-left: var(--sp-4); }
.msg--ink { border-left-color: var(--ink); }
html[dir="rtl"] .msg { border-left: none; border-right: 2px solid var(--line); padding-left: 0; padding-right: var(--sp-4); }
html[dir="rtl"] .msg--ink { border-right-color: var(--ink); }
.sig-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.sig-preview {
  display: flex; flex-direction: column; gap: 8px;
  padding: var(--sp-3); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  background: var(--wash); min-height: 120px;
}
.sig-preview img {
  max-width: 100%; max-height: 160px; object-fit: contain;
  background: var(--surface); border-radius: var(--r-sm);
}
.sig-preview--empty { justify-content: center; align-items: center; }
@media (max-width: 640px) {
  .sig-row { grid-template-columns: 1fr; }
}

/* ============ admin CMS pages / rich text ============ */
.field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4);
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}
.rte {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); overflow: hidden;
}
.rte__bar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px; border-bottom: 1px solid var(--line-soft);
  background: var(--wash);
}
.rte__bar button {
  height: 30px; min-width: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font: 600 12px var(--font-body); cursor: pointer;
}
.rte__bar button:hover { border-color: var(--ink); }
.rte__bar button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-ring); }
.rte__ed {
  min-height: 180px; max-height: 320px; overflow: auto;
  padding: var(--sp-4);
  font: 500 14px/1.55 var(--font-body);
  outline: none;
}
.rte__ed:focus { box-shadow: inset 0 0 0 1px var(--ink); }
.rte__ed:focus-visible { box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 3px var(--accent-ring); }
.rte__ed h2 { font: 600 1.15em var(--font-display); margin: 0 0 .5em; }
.rte__ed p { margin: 0 0 .75em; }
.rte__ed ul { margin: 0 0 .75em; padding-inline-start: 1.25em; }
.modal--wide { width: min(840px, 100%); }

/* ============ admin + landlord system fonts (do not leak to login/public) ============ */
html:is(.admin-app, .landlord-app) {
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tracking-caps: 0.06em;
}
html:is(.admin-app, .landlord-app) h1,
html:is(.admin-app, .landlord-app) h2,
html:is(.admin-app, .landlord-app) h3,
html:is(.admin-app, .landlord-app) .page__title,
html:is(.admin-app, .landlord-app) .card__title,
html:is(.admin-app, .landlord-app) .h-md,
html:is(.admin-app, .landlord-app) .brand,
html:is(.admin-app, .landlord-app) .mobnav a,
html:is(.admin-app, .landlord-app) .prop__name {
  font-weight: 600;
}
html:is(.admin-app, .landlord-app) .page__title {
  letter-spacing: -0.02em;
}
html:is(.admin-app, .landlord-app) .ledger__num,
html:is(.admin-app, .landlord-app) .num-lg,
html:is(.admin-app, .landlord-app) .num-xl,
html:is(.admin-app, .landlord-app) .serif-num,
html:is(.admin-app, .landlord-app) .table .t-num,
html:is(.admin-app, .landlord-app) .avatar,
html:is(.admin-app, .landlord-app) .balance__num {
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}
