/* ============================================================
   Hamilton Residency PMS
   Tally-inspired professional theme
   Full consolidated stylesheet
   ============================================================ */

/* ---------- Reset & variables ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:        #12335c;
  --navy-dark:   #0b2340;
  --navy-light:  #1e4b82;
  --accent:      #f5a623;
  --bg:          #eef2f7;
  --card:        #ffffff;
  --line:        #d8e0ea;
  --text:        #1c2b3a;
  --muted:       #66768a;
  --green:       #1d8a4c;
  --red:         #c0392b;
  --amber:       #d98c00;
  --shadow:      0 2px 6px rgba(18, 51, 92, .08);
}

html, body { height: 100%; }

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

/* ============================================================
   Shell layout
   ============================================================ */
.shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  flex: 0 0 72px;
  height: 72px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #fff;
}

.brand-sub { font-size: 11px; color: #c8d5e6; margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.user-chip {
  background: rgba(255, 255, 255, .12);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip .role {
  font-size: 10px;
  background: var(--accent);
  color: #3a2a00;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.btn-sm {
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  line-height: 1.4;
}

.btn-sm:hover { background: rgba(255, 255, 255, .28); }
.btn-sm.danger { background: #b93b30; }
.btn-sm.danger:hover { background: #962d24; }
.btn-sm.ok { background: var(--green); }
.btn-sm.ok:hover { background: #166b3a; }
.btn-sm.light {
  background: #eaf1fa;
  color: var(--navy);
  border: 1px solid #cddff1;
}
.btn-sm.light:hover { background: #dbe8f7; }

.badge-count {
  background: var(--accent);
  color: #3a2a00;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
}

.logo-img {
  height: 40px;
  width: auto;
  max-width: 160px;
  margin-right: 12px;
  vertical-align: middle;
  display: inline-block;
}

/* ============================================================
   Notification bell
   ============================================================ */
.bell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .2s, color .2s, border-color .2s;
  line-height: 1.4;
}

.bell.read {
  background: rgba(29, 138, 76, .18);
  color: #b7f0cb;
  border-color: rgba(29, 138, 76, .35);
}
.bell.read:hover {
  background: rgba(29, 138, 76, .28);
  color: #ffffff;
}
.bell.read .bell-icon { color: #b7f0cb; animation: none; }

.bell.unread {
  background: rgba(192, 57, 43, .22);
  color: #ffd6d2;
  border-color: rgba(255, 200, 195, .55);
  font-weight: 700;
  animation: bell-glow 1.6s ease-in-out infinite;
}
.bell.unread:hover {
  background: rgba(192, 57, 43, .38);
  color: #ffffff;
}
.bell.unread .bell-icon {
  color: #ffd6d2;
  animation: bell-shake 1s ease-in-out infinite;
  transform-origin: 50% 4px;
  display: inline-block;
}

.bell-icon {
  display: inline-block;
  font-size: 15px;
  line-height: 1;
}

@keyframes bell-shake {
  0%   { transform: rotate(0deg); }
  10%  { transform: rotate(16deg); }
  20%  { transform: rotate(-14deg); }
  30%  { transform: rotate(11deg); }
  40%  { transform: rotate(-9deg); }
  50%  { transform: rotate(7deg); }
  60%  { transform: rotate(-5deg); }
  70%  { transform: rotate(3deg); }
  80%  { transform: rotate(-2deg); }
  90%  { transform: rotate(1deg); }
  100% { transform: rotate(0deg); }
}

@keyframes bell-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, .55); }
  50%      { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .bell.unread,
  .bell.unread .bell-icon { animation: none; }
}

/* ============================================================
   Body row — sidebar + main
   ============================================================ */
.body-row {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  height: calc(100vh - 72px);
  max-height: calc(100vh - 72px);
  overflow: hidden;
  align-items: stretch;
}

/* ============================================================
   Sidebar — outer shell (no scroll)
   ============================================================ */

.sidebar {
  width: 225px;
  flex: 0 0 225px;
  background: var(--navy-dark);
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 0;
}

.sidebar nav { padding: 0 10px; }

.sidebar-group {
  position: relative;
  padding-left: 20px;
  margin-bottom: 14px;
  display: block;
}

.sidebar-group::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 6px;
  width: var(--sidebar-line-width, 2px);
  background: var(--sidebar-line-color, #8c9eb6);
  opacity: var(--sidebar-line-opacity, 0.42);
  border-radius: 2px;
  display: var(--sidebar-show-rail, block);
}

.sidebar-group-label {
  padding: 14px 0 6px;
  color: #f5a623;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  user-select: none;
  opacity: 0.95;
  position: relative;
}

.sidebar-group-label::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 20px;
  width: 8px;
  height: 2px;
  background: rgba(245,166,35,.7);
  border-radius: 1px;
}

.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: #cfd8e3;
  text-decoration: none;
  font-size: 13px;
  border-radius: 0;
  margin: 0;
  transition: background .15s ease, color .15s ease, padding-left .18s ease;
  border-top: var(--sidebar-show-hairlines, 1px) solid
    color-mix(in srgb,
      var(--sidebar-row-line-color, #8c9eb6) calc(var(--sidebar-row-line-opacity, 0.14) * 100%),
      transparent);
  border-bottom: var(--sidebar-show-hairlines, 1px) solid
    color-mix(in srgb,
      var(--sidebar-row-line-color, #8c9eb6) calc(var(--sidebar-row-line-opacity, 0.14) * 100%),
      transparent);
}

.sidebar nav a + a { border-top: none; }

.sidebar nav a::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  width: 12px;
  height: 1px;
  background: var(--sidebar-line-color, #8c9eb6);
  opacity: calc(var(--sidebar-line-opacity, 0.42) * 0.76);
  pointer-events: none;
}

.sidebar nav a .nav-icon {
  display: inline-block;
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
}
.sidebar nav a:hover::before {
  background: rgba(245,166,35,.7);
  opacity: 1;
}

.sidebar nav a.active {
  background: rgba(245,166,35,.10);
  color: #fff;
  font-weight: 600;
}
.sidebar nav a.active::before {
  background: rgba(245,166,35,.85);
  height: 2px;
  opacity: 1;
}

.sidebar nav a .badge-count {
  margin-left: auto;
  background: #f5a623;
  color: #0b2340;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.sidebar nav a.sidebar-glow {
  background: linear-gradient(90deg, rgba(245, 166, 35, 0.18), transparent 80%);
  color: #fff;
  font-weight: 700;
  animation: sidebar-glow-pulse 1.8s ease-in-out infinite;
}
.sidebar nav a.sidebar-glow::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #f5a623;
  animation: sidebar-glow-bar 1.4s ease-in-out infinite;
}
.sidebar nav a.sidebar-glow:hover {
  background: linear-gradient(90deg, rgba(245, 166, 35, 0.34), transparent 80%);
}
@keyframes sidebar-glow-pulse {
  0%, 100% { background: linear-gradient(90deg, rgba(245, 166, 35, 0.18), transparent 80%); }
  50%      { background: linear-gradient(90deg, rgba(245, 166, 35, 0.32), transparent 80%); }
}
@keyframes sidebar-glow-bar {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar nav a.sidebar-glow,
  .sidebar nav a.sidebar-glow::before { animation: none; }
}




/* Sidebar "More…" toggle (admin only) */
.sidebar-toggle {
  display: block;
  width: 100%;
  background: transparent;
  color: #cfd8e3;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, .06);
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
  margin-top: 6px;
}

.sidebar-toggle:hover {
  background: var(--navy-light);
  color: #fff;
}

.sidebar-toggle .toggle-icon {
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  font-size: 10px;
  color: var(--accent);
}

.sidebar-toggle .toggle-label {
  color: var(--accent);
}

/* ============================================================
   Main content
   ============================================================ */
.main {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 30px;
}

.main h1 {
  font-size: 22px;
  color: var(--navy);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.card h3 {
  font-size: 14px;
  color: var(--navy);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-head h3 { margin: 0; }

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   Grid & stat tiles
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat {
  background: var(--card);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);
}

.stat .lbl {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 600;
}

.stat .val {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--navy);
}

.stat.green { border-left-color: var(--green); }
.stat.green .val { color: var(--green); }
.stat.red { border-left-color: var(--red); }
.stat.red .val { color: var(--red); }
.stat.orange { border-left-color: var(--amber); }
.stat.orange .val { color: var(--amber); }

/* ============================================================
   Tables
   ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: #f4f7fb;
  font-weight: 700;
  color: var(--navy);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--navy);
}

tr:hover td { background: #f8fbff; }

tr.total td {
  background: #eaf1fa;
  border-top: 2px solid var(--navy);
  font-weight: 600;
}

td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; }
td.actions > * { margin-right: 4px; }

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #eef6ff; transition: background .15s; }

/* ============================================================
   Forms
   ============================================================ */
label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  margin: 4px 0 3px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 8px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(18, 51, 92, .12);
}

input[type="checkbox"] { width: auto; margin: 0; }
textarea { resize: vertical; }

.row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.row > div { flex: 1 1 180px; min-width: 0; }
.row > div.btn-col { flex: 0 0 auto; }

.btn-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  align-items: center;
}

.search { max-width: 280px; }

/* ============================================================
   Buttons
   ============================================================ */
button, .btn {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: .15s;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}

button:hover, .btn:hover { background: var(--navy-dark); }
button.primary { background: var(--navy); }
button.primary:hover { background: var(--navy-dark); }
button.sec { background: #7a8798; }
button.sec:hover { background: #5e6a7c; }
button.danger { background: var(--red); }
button.danger:hover { background: #962d24; }
button.ok { background: var(--green); }
button.ok:hover { background: #166b3a; }
button.sm { padding: 5px 10px; font-size: 11.5px; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .4px;
}

.badge.paid    { background: #d5f2df; color: #0f5c2f; }
.badge.due     { background: #fbe0dd; color: #8d1f16; }
.badge.partial { background: #fdeec9; color: #7a5400; }
.badge.neutral { background: #e6ecf3; color: #3a4a5e; }
.badge.demand  { background: var(--accent); color: #3a2a00; margin-right: 6px; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  background: #d5f2df;
  color: #0f5c2f;
  border-left: 4px solid var(--green);
}

.flash.error {
  background: #fbe0dd;
  color: #8d1f16;
  border-left-color: var(--red);
}

/* ============================================================
   Chip
   ============================================================ */
.apt-chip {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 5px;
  letter-spacing: .4px;
}
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 20% 20%, rgba(245, 166, 35, .10) 0, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, .07) 0, transparent 45%),
    linear-gradient(135deg, var(--navy-dark), var(--navy-light));
}

/* ============================================================
   Login page
   ============================================================ */

.login-box {
  background: #fff;
  padding: 38px 34px;
  border-radius: 10px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  border-top: 5px solid var(--accent);
  text-align: center;
}

.login-brand h1 { color: var(--navy); font-size: 20px; margin-bottom: 4px; }
.login-brand p { color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }

.logo-login {
  display: block;
  height: 80px;
  width: auto;
  max-width: 200px;
  margin: 0 auto 14px;
}

.login-box form { text-align: left; margin-top: 18px; }
.login-box form button { width: 100%; padding: 11px; font-size: 14px; }

/* ============================================================
   Two-column layouts
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}
.two-col > .card { min-width: 0; }

@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ============================================================
   Messages
   ============================================================ */
.msg-list { max-height: 560px; overflow-y: auto; }

.msg-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.msg-item:hover { background: #f6faff; }
.msg-item.unread { background: #e8f1fb; font-weight: 600; }

.msg-item .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 400;
}

.msg-body {
  background: #f7f9fc;
  padding: 14px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
}

/* ============================================================
   Inactive user rows
   ============================================================ */
.row-reversed td {
  background: #fbf3f3;
  color: #88514d;
  text-decoration: line-through;
  text-decoration-color: rgba(180, 60, 60, .45);
}
.row-reversed td .badge,
.row-reversed td a,
.row-reversed td form,
.row-reversed td input { text-decoration: none; }

/* ============================================================
   Statement header
   ============================================================ */
.stmt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.stmt-title { font-size: 20px; font-weight: 800; color: var(--navy); letter-spacing: .3px; }
.stmt-sub { font-size: 11.5px; color: var(--muted); }
.stmt-meta { text-align: right; font-size: 12px; color: var(--text); line-height: 1.5; }
.stmt-meta b { color: var(--navy); }

/* ============================================================
   REPORT HEADER
   ============================================================ */
.report-title-block {
  display: block;
  text-align: center;
  border-bottom: 2px solid var(--navy);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.report-logo {
  display: block !important;
  height: 72px !important;
  width: auto !important;
  max-height: 72px !important;
  max-width: 220px !important;
  margin: 0 auto 10px auto !important;
  object-fit: contain;
}

.report-headings { display: block; text-align: center; }

.report-property {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
}

.report-manager { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.report-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.report-period { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.report-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr.total td {
  background: #eaf1fa;
  border-top: 2px solid var(--navy);
  font-weight: 700;
}

/* ============================================================
   KPI band
   ============================================================ */
.kpi-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #eaf1fa;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 700;
  margin-bottom: 3px;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.15;
}

.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ============================================================
   MARKETPLACE
   ============================================================ */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.market-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
}

.market-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(18, 51, 92, .14);
}

.market-photo {
  height: 150px;
  background: #f4f7fb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.market-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.market-photo-placeholder {
  font-size: 42px;
  color: #c8d5e6;
}
.market-photo-placeholder.big { font-size: 96px; }

.market-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.market-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
  line-height: 1.3;
  min-height: 36px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.market-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 6px;
}

.market-meta,
.market-seller { line-height: 1.4; }

.market-detail {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .market-detail { grid-template-columns: 1fr; }
}

.market-photo-large {
  height: 320px;
  background: #f4f7fb;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}
.market-photo-large img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ============================================================
   PARKING MODULE
   ============================================================ */
.parking-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.parking-slot {
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
  font-weight: 600;
  color: #fff;
  border: 2px solid transparent;
  transition: transform .15s, box-shadow .15s;
  text-decoration: none;
  display: block;
}
.parking-slot:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}
.parking-slot .slot-num {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .5px;
}
.parking-slot .slot-apt {
  font-size: 10.5px;
  margin-top: 4px;
  opacity: .9;
}
.parking-slot .slot-plate {
  font-size: 10px;
  margin-top: 2px;
  opacity: .85;
  font-family: "Courier New", monospace;
}

.parking-slot.assigned { background: linear-gradient(135deg, #1d8a4c, #166b3a); }
.parking-slot.free     { background: linear-gradient(135deg, #7a8798, #5e6a7c); }
.parking-slot.inactive { background: linear-gradient(135deg, #b3261e, #8d1f16); }
.parking-slot.visitor  { background: linear-gradient(135deg, #d98c00, #8a6000); }
.parking-slot.mine {
  outline: 3px solid #f5a623;
  outline-offset: 2px;
}

.parking-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 12px 0;
  font-size: 12px;
}
.parking-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.parking-legend .swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.parking-legend .swatch.assigned { background: #1d8a4c; }
.parking-legend .swatch.free     { background: #7a8798; }
.parking-legend .swatch.inactive { background: #b3261e; }
.parking-legend .swatch.visitor  { background: #d98c00; }

/* ============================================================
   Small utilities
   ============================================================ */
.small { font-size: 11.5px; }
.muted { color: var(--muted); }
.center { text-align: center; }
code {
  background: #eef3f9;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

/* ============================================================
   Print — hide chrome, keep report content
   ============================================================ */
@media print {
  .sidebar, .topbar, .page-actions, .report-actions,
  .btn-sm, .bell, button, .flash, .flash *,
  .card:first-of-type { display: none !important; }

  .body-row { display: block !important; height: auto !important; overflow: visible !important; }
  .main {
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
  }
  body { background: #fff !important; overflow: visible !important; }
  .card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  .report-title-block {
    display: block !important;
    text-align: center;
    border-bottom: 2px solid #12335c;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }
  .report-logo {
    display: block !important;
    height: 72px !important;
    max-height: 72px !important;
    width: auto !important;
    max-width: 220px !important;
    margin: 0 auto 10px auto !important;
  }
  .report-property { font-size: 20px; font-weight: 800; color: #12335c; }
  .report-manager  { font-size: 11px; color: #66768a; }
 
  .report-name     { font-size: 14px; font-weight: 700; color: #12335c;
                     margin-top: 4px; text-transform: uppercase; }
  .report-period   { font-size: 11px; color: #66768a; margin-top: 2px; }

  table { width: 100%; border-collapse: collapse; }
  th {
    background: #12335c !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  tr.total td {
    background: #eaf1fa !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .body-row {
    flex-direction: column;
    overflow: visible;
    height: auto;
    max-height: none;
  }
  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    max-height: 260px;
  }
  .sidebar-scroll {
    max-height: 260px;
  }
  .main {
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 16px;
  }
  body { overflow: auto; }
  .row > div { flex: 1 1 100%; }
  .report-logo { height: 56px !important; max-height: 56px !important; }
  .market-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .market-photo { height: 120px; }
}

/* ============================================================
   Sidebar   tree navigation (Finance group)
   ============================================================ */
.sidebar-tree-toggle { cursor: pointer; user-select: none; }
.sidebar-tree-toggle:hover { color: #fff; }
.tree-chevron {
  display: inline-block; width: 12px; margin-right: 4px;
  font-size: 10px; color: var(--accent, #f5a623);
}
.sidebar-tree-body { display: block; }
.sidebar-subgroup { display: block; margin: 0; padding: 0; }
.sidebar-subgroup-label {
  display: block; padding: 8px 20px 4px 32px;
  color: #98a5b8; font-size: 11px; font-weight: 600;
  letter-spacing: .3px; cursor: pointer; user-select: none;
  text-transform: none; border: none;
}
.sidebar-subgroup-label:hover { color: #cfd8e3; }
.sidebar-subgroup-body { display: block; }
.sidebar-subgroup-body a { padding-left: 44px !important; font-size: 12.5px; }

/* ============================================================
   Sidebar — attention badges and pulse animation
   ============================================================ */

/* Any badge attached to a group/subgroup label */
.sidebar-group-label .badge-count,
.sidebar-subgroup-label .badge-count {
  background: var(--accent, #f5a623);
  color: #3a2a00;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}

/* The label itself pulses when it has a badge */
.sidebar-group-label.attention,
.sidebar-subgroup-label.attention {
  color: #ffcc00 !important;
  animation: sidebar-attention-pulse 1.6s ease-in-out infinite;
}

@keyframes sidebar-attention-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar-group-label.attention,
  .sidebar-subgroup-label.attention {
    animation: none;
  }
}

/* Vibration for the top-bar messages button */
.btn-sm.attention,
.bell.unread {
  animation: bell-shake 1.6s ease-in-out infinite;
}

/* Small dot indicator on collapsed groups */
.sidebar-tree-toggle .attention-dot,
.sidebar-subgroup-toggle .attention-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #f5a623;
  border-radius: 50%;
  margin-left: 6px;
  animation: sidebar-attention-pulse 1.6s ease-in-out infinite;
  vertical-align: middle;
}


/* ============================================================
   Logo shown inside the top bar
   Toggle via Settings → Branding → Application Logo
   ============================================================ */
.logo-tile {
  background: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

/* ============================================================
   Workflow Timeline — vertical activity feed
   ============================================================ */

.workflow-timeline {
  position: relative;
  padding: 6px 0 4px 34px;
  font-size: 13px;
  line-height: 1.5;
}

.workflow-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: #e5ecf3;
  border-radius: 2px;
}

.workflow-step {
  position: relative;
  padding-bottom: 20px;
}

.workflow-step:last-child {
  padding-bottom: 0;
}

/* Node circle */
.workflow-step::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #12335c;
  box-sizing: border-box;
}

/* Done — solid navy */
.workflow-step.done::before {
  background: #12335c;
  border-color: #12335c;
}

/* Current — amber ring */
.workflow-step.current::before {
  background: #fff;
  border-color: #f5a623;
  border-width: 4px;
}

/* Future — dashed grey */
.workflow-step.future::before {
  background: #fff;
  border-color: #cfd8e3;
  border-style: dashed;
}

/* Rejected — solid red */
.workflow-step.rejected::before {
  background: #c0392b;
  border-color: #c0392b;
}

.workflow-step .ws-label {
  font-weight: 700;
  color: #12335c;
  font-size: 13.5px;
  line-height: 1.4;
}

.workflow-step.current .ws-label {
  color: #a06b00;
}

.workflow-step.rejected .ws-label {
  color: #c0392b;
}

.workflow-step.future .ws-label {
  color: #8896a8;
  font-weight: 500;
}

.workflow-step .ws-meta {
  font-size: 12px;
  color: #66768a;
  margin-top: 2px;
}

.workflow-step .ws-note {
  font-size: 12.5px;
  color: #33475c;
  margin-top: 6px;
  padding: 6px 10px;
  background: #f7fafd;
  border-left: 3px solid #d8e0ea;
  border-radius: 4px;
  font-style: italic;
  white-space: pre-wrap;
  word-break: break-word;
}

.workflow-step.rejected .ws-note {
  background: #fdf3f2;
  border-left-color: #c0392b;
  color: #8a2925;
}

.workflow-step.current .ws-note {
  background: #fff8e6;
  border-left-color: #f5a623;
  color: #7a5200;
}

/* Compact variant */
.workflow-timeline-compact {
  padding-left: 28px;
  font-size: 12px;
}
.workflow-timeline-compact::before {
  left: 7px;
  top: 12px;
  bottom: 12px;
}
.workflow-timeline-compact .workflow-step {
  padding-bottom: 14px;
}
.workflow-timeline-compact .workflow-step::before {
  width: 14px;
  height: 14px;
  left: -27px;
  top: 3px;
  border-width: 2px;
}
.workflow-timeline-compact .workflow-step.current::before {
  border-width: 3px;
}
.workflow-timeline-compact .ws-label {
  font-size: 12.5px;
}
.workflow-timeline-compact .ws-meta,
.workflow-timeline-compact .ws-note {
  font-size: 11.5px;
}

/* Empty state */
.wf-empty {
  padding: 20px;
  text-align: center;
  color: #8896a8;
  font-size: 13px;
  background: #f7fafd;
  border-radius: 8px;
}

/* Last marker (the trailing empty dot) */
.workflow-step-end {
  padding-bottom: 0;
}
.workflow-step-end .ws-end {
  display: block;
  height: 8px;
}

/* Card wrapper for the timeline section */
.wf-card {
  background: #fff;
  border: 1px solid #eaeff5;
  border-radius: 10px;
  padding: 18px 22px;
  margin-top: 18px;
}
.wf-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #12335c;
}
.wf-card .wf-hint {
  font-size: 12.5px;
  color: #66768a;
  margin: 0 0 16px;
}


/* ============================================================
   MOBILE RESPONSIVE — Added 2026-10-16
   Prefix: .hr- to avoid collisions with existing classes.
   All rules apply ONLY at phone width. Desktop unchanged.
   ============================================================ */

/* Hamburger button — hidden on desktop, shown on phone */
.hr-mobile-toggle {
  display: none;             /* hidden by default (desktop) */
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.hr-mobile-toggle:hover { background: rgba(255,255,255,.28); }

/* Backdrop for the drawer — hidden by default */
.hr-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 998;
  cursor: pointer;
}

/* ------------------------------------------------------------
   Phone breakpoint — 768px and below
   ------------------------------------------------------------ */
@media (max-width: 768px) {

  /* ---------- TOPBAR ---------- */
    /* ---------- TOPBAR ---------- */
    /* ---------- TOPBAR ---------- */
    /* ---------- TOPBAR ---------- */
  .topbar {
    padding-top: env(safe-area-inset-top);
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 0;
    height: calc(56px + env(safe-area-inset-top));
    flex: 0 0 calc(56px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  
  /* 1. Force the brand to truncate */
  .topbar > .brand {
    flex: 1 1 0%; /* Take available space, but allow shrinking */
    min-width: 0; /* Crucial for ellipsis */
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .brand > div {
    min-width: 0; /* Crucial: forces the inner div to shrink */
    overflow: hidden;
  }
  .brand-sub { display: none; }
  .brand-name { 
    font-size: 14px; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
  }
  .logo-img { display: none !important;  }
  .user-chip { display: none; }
  
  /* Hamburger */
  .hr-mobile-toggle { 
    display: inline-flex; 
    margin-right: 4px; 
    flex-shrink: 0;
  }

  /* 2. Force the right buttons to stay put */
  .topbar-right { 
    gap: 4px; 
    flex: 0 0 auto; /* Do not grow, do not shrink */
  }
  
  /* 3. Make buttons tiny squares */
  .topbar-right .btn-sm,
  .topbar-right .bell {
    padding: 0 !important;
    width: 34px !important;
    height: 34px !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 18px !important; 
    border-radius: 6px !important;
    flex-shrink: 0 !important;
  }
  
  /* 4. Aggressively hide text */
  .topbar-right .btn-text,
  .topbar-right .bell > span:not(.bell-icon):not(.badge-count) {
    display: none !important;
  }

  /* ---------- BODY ROW → drawer layout ---------- */
  .body-row {
    position: relative;
    height: calc(100vh - 56px - env(safe-area-inset-top));
    max-height: calc(100vh - 56px - env(safe-area-inset-top));
    overflow: hidden;
  }

  /* Sidebar becomes a fixed drawer, off-screen by default */
  .sidebar {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top));
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 82vw;
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform .22s ease-out;
    box-shadow: 4px 0 20px rgba(0,0,0,.35);
  }
  .sidebar.hr-open {
    transform: translateX(0);
  }
  .sidebar-scroll {
    max-height: none;
    overflow-y: auto;
  }

  /* Backdrop shown when drawer is open */
  .hr-sidebar-backdrop.hr-open {
    display: block;
  }

  /* Main content fills the whole width */
  .main {
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    padding: 14px;
  }
  body { overflow: hidden; }

  /* Bigger tap targets in the sidebar */
  .sidebar nav a {
    padding: 12px 14px;
    font-size: 14px;
  }
  .sidebar-group-label {
    font-size: 11px;
    padding: 16px 0 8px;
  }
  .sidebar-subgroup-label { padding: 10px 20px 6px 32px; font-size: 12px; }
  .sidebar-subgroup-body a { padding-left: 44px !important; }

  /* ---------- TYPOGRAPHY ---------- */
  .main h1 {
    font-size: 18px;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }
  .card {
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: 8px;
  }
  .card h3 { font-size: 13px; margin-bottom: 10px; }

  /* ---------- TABLES → horizontal scroll ---------- */
  .card { overflow-x: auto; }
  .card table {
    min-width: 560px;         /* force table wider than screen → scrollable */
  }
  table {
    font-size: 12.5px;
  }
  th, td {
    padding: 8px 8px;
    white-space: nowrap;      /* prevents columns collapsing on narrow screens */
  }
  th { font-size: 11px; }

  /* Exception: allow wrapping in "description" columns */
  table td.wrap, table td.long {
    white-space: normal;
    min-width: 200px;
  }

  /* ---------- FORMS → single column, bigger inputs ---------- */
  .row > div { flex: 1 1 100%; }
  .row { gap: 8px; }
  input, select, textarea {
    font-size: 15px;          /* prevents iOS zoom on focus */
    padding: 10px 12px;
  }
  label { font-size: 12px; }
  button, .btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  /* ---------- KPI TILES → stack vertically on phone ---------- */
  .grid,
  .kpi-band {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stat, .kpi { padding: 14px 16px; }
  .stat .val, .kpi-value { font-size: 20px; }

  /* ---------- MARKETPLACE ---------- */
  .market-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .market-photo { height: 110px; }
  .market-photo-large { height: 240px; }
  .market-detail { grid-template-columns: 1fr; }

  /* ---------- PARKING ---------- */
  .parking-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  /* ---------- TWO-COLUMN LAYOUTS ---------- */
  .two-col { grid-template-columns: 1fr; gap: 12px; }

  /* ---------- STATEMENT HEADER ---------- */
  .stmt-header { flex-direction: column; gap: 8px; }
  .stmt-meta { text-align: left; }

  /* ---------- REPORT HEADER ---------- */
  .report-logo { height: 56px !important; max-height: 56px !important; }

  /* ---------- MESSAGES ---------- */
  .msg-list { max-height: none; }

  /* ---------- PAGE ACTIONS ---------- */
  .page-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .page-actions .btn-sm { flex: 0 0 auto; }

  /* ---------- BUTTON ROW wraps nicely ---------- */
  .btn-row { gap: 6px; }
  .btn-row > .btn-sm,
  .btn-row > button,
  .btn-row > a { flex: 1 1 auto; text-align: center; justify-content: center; }
}

/* ------------------------------------------------------------
   Very narrow phones (≤ 400px) — extra tightening
   ------------------------------------------------------------ */
@media (max-width: 400px) {
  .topbar { padding: 0 8px; }
  .brand-name { font-size: 13px; }
  .main { padding: 12px; }
  .card { padding: 12px 14px; }
  .topbar-right .btn-sm { padding: 5px 6px; font-size: 10px; }
}