/* Yorkshire Properties Portal — Brand-aligned styles
   Colors & fonts from email-template.js BRAND object */

:root {
  --yp-red: #CE272D;
  --yp-red-hover: #a81f24;
  --yp-dark: #30302E;
  --yp-bg: #FAF9F5;
  --yp-surface: #FFFFFF;
  --yp-text: #111111;
  --yp-muted: #555C66;
  --yp-border: #E5E5E0;
  --yp-success: #1565C0;
  --yp-success-bg: #DBEAFE;
  --yp-warn: #92400E;
  --yp-warn-bg: #FFFBEB;
  --yp-error: #C2410C;
  --yp-error-bg: #FFF7ED;
  --yp-primary: #7C3AED;
  --yp-primary-hover: #6D28D9;
  --yp-primary-bg: #EDE9FE;
  --yp-green: #15803D;
  --yp-green-bg: #DCFCE7;
  --yp-heading: 'Playfair Display', Georgia, serif;
  --yp-body: 'Open Sans', -apple-system, Arial, sans-serif;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
}

/* ── Reset & base ──────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--yp-bg);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--yp-body);
  color: var(--yp-text);
  line-height: 1.6;
  padding-top: 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: var(--yp-heading);
  color: var(--yp-dark);
  line-height: 1.3;
}

h1 { font-size: 1.65rem; margin-bottom: 1.25rem; }
h2 { font-size: 1.25rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }

a { color: var(--yp-red); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--yp-red-hover); }

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
}

main.container {
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
  flex: 1;
}

/* ── Top nav ───────────────────────────────────────────────────── */

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--yp-dark);
  height: 56px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-brand:hover { text-decoration: none; }

.nav-logo {
  display: block;
  border-radius: 4px;
}

.nav-title {
  font-family: var(--yp-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 0;
  padding: 0;
}

.nav-links > li {
  position: relative;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.87rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
}

.nav-links a.active {
  background: rgba(206, 39, 45, 0.5);
}

/* ── Dropdown menus ─────────────────────────────────────────── */

.nav-dropdown-btn {
  background: none !important;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 12px !important;
  border-radius: 5px;
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  margin: 0;
}
.nav-dropdown-btn:hover,
.nav-dropdown.open > .nav-dropdown-btn {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff;
}
.nav-dropdown-btn.has-active {
  color: #fff;
  background: rgba(206, 39, 45, 0.35) !important;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 6px 0;
  z-index: 200;
  list-style: none;
  margin: 0;
}

/* Invisible bridge so hover doesn't break when moving to dropdown */
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.nav-dropdown.open > .nav-dropdown-menu,
.nav-dropdown:hover > .nav-dropdown-menu {
  display: block;
}
.nav-dropdown:hover > .nav-dropdown-btn {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff;
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 16px;
  color: var(--yp-text);
  font-size: 0.85rem;
  font-weight: 400;
  border-radius: 0;
  transition: background 0.1s;
}

.nav-dropdown-menu a:hover {
  background: var(--yp-bg);
  color: var(--yp-text);
}

.nav-dropdown-menu a.active {
  background: rgba(206, 39, 45, 0.08);
  color: var(--yp-red);
  font-weight: 600;
}

/* Desktop: logout + search grouped right */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.nav-logout-btn {
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-logout-btn:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

/* Hide mobile-only search & logout in desktop */
.nav-search-mobile { display: none; }
.nav-logout-item { display: none; }

.nav-logout { opacity: 0.55; }
.nav-logout:hover { opacity: 1; }

/* ── Cards ─────────────────────────────────────────────────────── */

.card {
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-accent {
  border-top: 4px solid var(--yp-red);
}

.card-accent-dark {
  border-top: 4px solid var(--yp-dark);
}

/* ── Stats grid (dashboard) ────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-top: 4px solid var(--yp-dark);
  border-radius: var(--radius);
  text-align: center;
  padding: 1.1rem 1rem 0.9rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-card header {
  font-family: var(--yp-body);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--yp-muted);
  margin-bottom: 0.25rem;
}

.stat-number {
  font-family: var(--yp-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--yp-dark);
  line-height: 1.2;
}

.stat-card footer {
  font-size: 0.78rem;
  color: var(--yp-muted);
  margin-top: 0.35rem;
}

.stat-card footer a {
  font-weight: 500;
}

.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.stat-card-link:hover {
  text-decoration: none;
}

.stat-card-link:hover .stat-card {
  border-color: #CE272D;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card-link:hover *,
.stat-card-link:hover .stat-card *,
.stat-card-link:hover .stat-card a {
  text-decoration: none;
}

.stat-card-link .stat-card {
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.stat-warn { border-top-color: #D97706; }
.stat-warn .stat-number { color: var(--yp-warn); }

.stat-danger { border-top-color: #C2410C; }
.stat-danger .stat-number { color: #C2410C; }

.stat-ok { border-top-color: #1565C0; }
.stat-ok .stat-number { color: var(--yp-success); }

/* ── Dashboard charts ─────────────────────────────────────────── */

.dash-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.dash-chart-card {
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
}
.dash-chart-card h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--yp-muted);
  margin-bottom: 0.5rem;
}

/* ── Badges ────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #EEECEA;
  color: var(--yp-muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge-red    { background: var(--yp-error-bg); color: var(--yp-error); }
.badge-yellow { background: var(--yp-warn-bg);  color: var(--yp-warn); }
.badge-green  { background: var(--yp-success-bg); color: var(--yp-success); }
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-orange { background: #FFF7ED; color: #9A3412; }
.badge-muted  { background: #F3F4F6; color: #9CA3AF; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-warning { background: #FEF3C7; color: #92400E; }

/* ── Tables ────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table thead th {
  background: var(--yp-dark);
  color: #fff;
  font-weight: 600;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  text-align: left;
  white-space: nowrap;
}

table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--yp-border);
  vertical-align: middle;
}

table tbody tr:last-child td {
  border-bottom: none;
}

table tbody tr:hover {
  background: #FDFCFA;
}

table a {
  font-weight: 500;
}

.overflow-auto {
  overflow-x: auto;
}

/* ── Section headings ──────────────────────────────────────────── */

section {
  margin-bottom: 2rem;
}

section h2 {
  border-bottom: 2px solid var(--yp-red);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

/* ── Breadcrumb ────────────────────────────────────────────────── */

.breadcrumb {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.83rem;
  color: var(--yp-muted);
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: #ccc;
}

/* ── Property meta ─────────────────────────────────────────────── */

.property-meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: var(--yp-muted);
}

/* ── Grid layout (unit detail info) ────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.5rem 2rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

/* ── Filter bar ────────────────────────────────────────────────── */

.filter-bar {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-group a {
  padding: 4px 10px;
  border-radius: 5px;
  text-decoration: none;
  color: var(--yp-muted);
  background: #EEECEA;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.12s;
}

.filter-group a:hover {
  background: #E0DDDA;
  text-decoration: none;
}

.filter-group a.active {
  background: var(--yp-red);
  color: #fff;
}

/* ── Search bar ────────────────────────────────────────────────── */

.search-bar {
  margin-bottom: 1rem;
}

.search-bar input[type="search"] {
  max-width: 400px;
  width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--yp-border);
  border-radius: 6px;
  font-family: var(--yp-body);
  font-size: 0.9rem;
  background: var(--yp-surface);
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input[type="search"]:focus {
  border-color: var(--yp-red);
  box-shadow: 0 0 0 3px rgba(206, 39, 45, 0.12);
}

/* ── Buttons ───────────────────────────────────────────────────── */

button, .btn {
  display: inline-block;
  padding: 10px 20px;
  font-family: var(--yp-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--yp-red);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover, .btn:hover {
  background: var(--yp-red-hover);
  text-decoration: none;
}

/* ── Forms ──────────────────────────────────────────────────────── */

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--yp-dark);
  margin-bottom: 0.3rem;
}

input[type="password"],
input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--yp-border);
  border-radius: 6px;
  font-family: var(--yp-body);
  font-size: 0.9rem;
  background: var(--yp-surface);
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--yp-red);
  box-shadow: 0 0 0 3px rgba(206, 39, 45, 0.12);
}

/* ── Login page — hide nav, search, footer ────────────────────── */

body.login-page .top-nav,
body.login-page .site-footer { display: none; }
body.login-page .container { padding-top: 0; }

/* ── Login ─────────────────────────────────────────────────────── */

.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 70vh;
}

.login-card {
  max-width: 380px;
  width: 100%;
  padding: 2rem;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-top: 4px solid var(--yp-red);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.login-card header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-card h2 {
  font-family: var(--yp-heading);
  color: var(--yp-dark);
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.login-card button {
  width: 100%;
  margin-top: 0.25rem;
}

.error {
  background: var(--yp-error-bg);
  color: var(--yp-error);
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--yp-red);
  border-radius: 4px;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

/* ── Callout blocks (matches email template) ───────────────────── */

.callout {
  padding: 12px 16px;
  margin: 1rem 0;
  border-radius: 4px;
  font-size: 0.88rem;
}

.callout-info    { background: var(--yp-bg); border-left: 4px solid var(--yp-dark); }
.callout-warning { background: var(--yp-warn-bg); border-left: 4px solid #D97706; }
.callout-error   { background: var(--yp-error-bg); border-left: 4px solid var(--yp-red); }
.callout-success { background: var(--yp-success-bg); border-left: 4px solid #059669; }

/* ── Status dots (COI dashboard) ───────────────────────────────── */

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.dot-red    { background: var(--yp-red); }
.dot-yellow { background: #D97706; }
.dot-green  { background: #059669; }

/* ── Footer ────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--yp-border);
  padding: 1rem 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--yp-muted);
}

.footer-sep {
  margin: 0 0.5rem;
  opacity: 0.4;
}

/* ── Utilities ─────────────────────────────────────────────────── */

.muted { color: var(--yp-muted); }
.text-right { text-align: right; }

/* ── Global search ────────────────────────────────────────────── */

.nav-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 300px;
}
.nav-search input {
  width: 100%;
  padding: 7px 12px 7px 32px !important;
  font-size: 0.83rem !important;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  outline: none;
  margin-bottom: 0 !important;
  transition: background 0.15s, border-color 0.15s;
}
.nav-search::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.45)' stroke-width='2'%3E%3Cpath stroke-linecap='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E");
  background-size: contain;
  pointer-events: none;
  z-index: 1;
}
.nav-search input::placeholder { color: rgba(255,255,255,0.45); }
.nav-search input:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
  box-shadow: none;
}
.gs-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
}
.gs-results.open { display: block; }
.gs-group { padding: 4px 0; }
.gs-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--yp-muted);
  padding: 6px 12px 2px;
}
.gs-item {
  display: block;
  padding: 6px 12px;
  font-size: 0.83rem;
  color: var(--yp-text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.1s;
}
.gs-item:hover, .gs-item.gs-active {
  background: var(--yp-bg);
  text-decoration: none;
}
.gs-item small { color: var(--yp-muted); margin-left: 0.4rem; }
.gs-empty {
  padding: 12px;
  text-align: center;
  color: var(--yp-muted);
  font-size: 0.82rem;
}

/* ── Hamburger toggle ─────────────────────────────────────────── */

.nav-toggle {
  display: none;
  background: none !important;
  border: none;
  padding: 6px !important;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--yp-dark);
    flex-direction: column;
    padding: 0.5rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 99;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 0;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(255,255,255,0.08);
  }

  /* Mobile dropdowns: inline instead of absolute */
  .nav-dropdown-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 20px !important;
    font-size: 0.9rem;
  }

  .nav-dropdown-menu {
    position: static !important;
    background: rgba(0,0,0,0.15) !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
  }

  .nav-dropdown-menu a {
    color: rgba(255,255,255,0.75) !important;
    padding: 10px 20px 10px 36px !important;
  }
  .nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.08) !important;
    color: #fff !important;
  }
  .nav-dropdown-menu a.active {
    background: rgba(206,39,45,0.3) !important;
    color: #fff !important;
  }

  /* Show mobile search & logout, hide desktop versions */
  .nav-search-mobile { display: block !important; }
  .nav-search-mobile .nav-search {
    margin: 8px 20px;
    flex: none;
    width: calc(100% - 40px);
  }
  .nav-logout-item { display: block !important; }
  .nav-right { display: none !important; }

  .nav-title {
    font-size: 0.95rem;
  }

  .filter-bar {
    flex-direction: column;
    gap: 0.75rem;
  }

  table {
    font-size: 0.82rem;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  /* Scrollable table wrapper for all pages */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Minimum tap target for links & buttons */
  .btn-sm, a.btn-sm { min-height: 44px; min-width: 44px; display:inline-flex; align-items:center; justify-content:center; }

  /* Prevent iOS zoom on input focus */
  input, select, textarea { font-size: 16px !important; }
}

/* ── Sortable table headers ─────────────────────────────────────────── */
table.sortable th {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.2em;
}
table.sortable th.no-sort { cursor: default; }
table.sortable th::after {
  content: '\2191\2193';
  position: absolute;
  right: 0.3em;
  opacity: 0.25;
  font-size: 0.65em;
  letter-spacing: -2px;
}
table.sortable th.sort-asc::after { content: '\2191'; opacity: 0.7; letter-spacing: normal; }
table.sortable th.sort-desc::after { content: '\2193'; opacity: 0.7; letter-spacing: normal; }
table.sortable th.no-sort::after { content: ''; }

/* ── Small buttons & inline actions ──────────────────────────────────── */
.btn-sm {
  display: inline-block;
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary-link { background: var(--yp-red); color: #fff !important; }
.btn-primary-link:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--yp-dark); border: 1px solid var(--yp-border); }
.btn-outline:hover { background: var(--yp-surface); }

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .nav-logo {
    display: none;
  }
}

/* ── Contact detail ───────────────────────────────────────────── */

.contact-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--yp-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--yp-heading);
  font-size: 1.3rem;
  font-weight: 700;
  flex-shrink: 0;
}

.contact-tagline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
  font-size: 0.88rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
}

.contact-sidebar section h2 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* Detail table (compact key-value) */
.detail-table {
  width: 100%;
  border: none;
  box-shadow: none;
  background: transparent;
}
.detail-table th {
  background: transparent;
  color: var(--yp-muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem 0.4rem 0;
  width: 100px;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--yp-border);
}
.detail-table td {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--yp-border);
}
.detail-table tr:last-child th,
.detail-table tr:last-child td { border-bottom: none; }

/* Compact inline inputs */
.dt-input {
  width: 100%;
  padding: 5px 8px !important;
  font-size: 0.85rem !important;
  margin-bottom: 0 !important;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
}
.dt-input:hover { background: var(--yp-bg); }
.dt-input:focus {
  background: var(--yp-surface);
  border-color: var(--yp-red) !important;
  box-shadow: 0 0 0 2px rgba(206,39,45,0.1);
}
select.dt-input { cursor: pointer; }
textarea.dt-input { resize: vertical; min-height: 60px; }

/* Contact list (emails, phones) */
.clist {
  list-style: none;
  margin: 0 0 0.5rem;
}
.clist-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--yp-border);
  font-size: 0.85rem;
}
.clist-item:last-child { border-bottom: none; }
.clist-main { flex: 1; font-weight: 500; }
.clist-meta { color: var(--yp-muted); font-size: 0.78rem; }
.clist-remove {
  background: none !important;
  border: none;
  color: var(--yp-muted);
  font-size: 1.1rem;
  padding: 0 4px !important;
  cursor: pointer;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}
.clist-remove:hover { opacity: 1; color: var(--yp-red); background: none !important; }

.clist-add {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.clist-add .dt-input { border: 1px solid var(--yp-border); background: var(--yp-surface); }
.clist-add-btn {
  width: 28px;
  height: 28px;
  padding: 0 !important;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Related lease roles on contact page */
.related-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.15rem 0 0.4rem 0;
}
.related-role {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  background: var(--yp-bg);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  font-size: 0.78rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.related-role:hover { border-color: #1565C0; }
.related-role-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.related-role-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e53935;
  color: #fff;
  border: 1.5px solid #fff;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.related-role-tag:hover .related-role-x { display: flex; }
.related-name { font-weight: 600; }
.related-detail { color: var(--yp-muted); font-size: 0.75rem; }

/* Contact notes */
.cnote {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--yp-border);
  font-size: 0.85rem;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}
.cnote:last-child { border-bottom: none; }
.cnote-delete {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--yp-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.cnote:hover .cnote-delete { opacity: 1; }
.timeline-entry:hover .cnote-delete { opacity: 1; }
.cnote-delete:hover { color: var(--yp-error); }
/* Delete button in timeline context — float right within content */
.timeline-content .cnote-delete { float: right; margin-left: 8px; }
.cnote-date {
  color: var(--yp-muted);
  font-size: 0.75rem;
  margin-right: 0.5rem;
}

/* Danger button */
.btn-danger { background: var(--yp-error-bg); color: var(--yp-error); }
.btn-danger:hover { background: var(--yp-error); color: #fff; }

/* ── Short name tags ──────────────────────────────────────────── */

.short-name-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #DBEAFE;
  color: #1E40AF;
  letter-spacing: 0.03em;
  line-height: 1.6;
}
.short-name-tag.editable {
  cursor: pointer;
  transition: background 0.15s;
}
.short-name-tag.editable:hover {
  background: #BFDBFE;
}
.short-name-tag .tag-x {
  color: #93C5FD;
  font-weight: 400;
  margin-left: 2px;
  font-size: 0.8em;
}
.short-name-tag.editable:hover .tag-x {
  color: #C2410C;
}
.short-name-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Contact category pill ────────────────────────────────────── */

.cat-area {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.contact-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #E8F4FD;
  color: #1565C0;
  border: 1px solid #BFDBF7;
  border-radius: 20px;
  padding: 2px 10px 2px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.cat-pill-remove {
  background: none;
  border: none;
  color: #64A4D8;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 1px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cat-pill-remove:hover { color: #DC2626; background: #FEE2E2; border-radius: 50%; }
.cat-pill-edit-btn {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1;
}
.cat-pill-edit-btn:hover { background: #F1F5F9; color: #1565C0; }
.cat-pill-add {
  background: none;
  border: 1px dashed #B0C4D8;
  color: #64748B;
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}
.cat-pill-add:hover { background: #F0F7FF; border-color: #1565C0; color: #1565C0; }
.cat-pill-input {
  border: 1px solid #93C5FD;
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 0.78rem;
  outline: none;
  width: 140px;
  background: #F0F7FF;
  color: #1565C0;
}
.cat-pill-input:focus { border-color: #1565C0; box-shadow: 0 0 0 2px #BFDBF7; }

/* ── Approval pages ───────────────────────────────────────────── */

.approval-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  line-height: 1.5;
}
.approval-banner-pending {
  background: var(--yp-warn-bg);
  color: var(--yp-warn);
  border: 1px solid #F59E0B33;
}
.approval-banner-approved {
  background: var(--yp-success-bg);
  color: var(--yp-success);
  border: 1px solid #1565C033;
}
.approval-banner-rejected {
  background: var(--yp-error-bg);
  color: var(--yp-error);
  border: 1px solid #C2410C33;
}
.approval-changed {
  color: var(--yp-red) !important;
  font-weight: 700;
}
.approval-actions {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.approval-actions form:first-child {
  flex: 1;
}
.btn-approve {
  display: inline-block;
  padding: 10px 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: #16A34A;
  color: #fff;
  transition: opacity 0.15s;
}
.btn-approve:hover { opacity: 0.9; }
.btn-reject {
  display: inline-block;
  padding: 10px 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: var(--yp-error);
  color: #fff;
  transition: opacity 0.15s;
}
.btn-reject:hover { opacity: 0.9; }

/* ── Add code / add user form details toggle ──────────────────── */

details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}

/* ── Communications page ──────────────────────────────────────── */

.comm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.comm-filters {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.comm-filter-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
}

.comm-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.comm-entry {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--yp-border);
  transition: background 0.1s;
  align-items: flex-start;
}
.comm-entry:hover {
  background: rgba(0, 0, 0, 0.015);
}
.comm-entry-expandable {
  cursor: pointer;
}
.comm-entry-expandable:hover {
  background: rgba(0, 0, 0, 0.03);
}
.comm-entry-expandable .comm-meta a {
  position: relative;
  z-index: 1;
}
.comm-entry:first-child {
  border-top: 1px solid var(--yp-border);
}

.comm-ts {
  flex: 0 0 110px;
  font-size: 0.78rem;
  color: var(--yp-muted);
  white-space: nowrap;
  padding-top: 2px;
}

.comm-body {
  flex: 1;
  min-width: 0;
}

.comm-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comm-dir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.comm-dir-in {
  background: #DBEAFE;
  color: #1E40AF;
}
.comm-dir-out {
  background: #d1fae5;
  color: #059669;
}

.comm-subject {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--yp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-meta {
  font-size: 0.78rem;
  color: var(--yp-muted);
  margin-top: 2px;
}

.comm-contact-link {
  font-weight: 500;
}

.comm-status-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.comm-bounce {
  font-size: 0.72rem;
  color: #dc2626;
  margin-top: 2px;
}

.comm-empty {
  text-align: center;
  color: var(--yp-muted);
  padding: 2.5rem 1rem;
  font-size: 0.92rem;
}

/* ── Communications Log (channel badges, call detail) ──────────────────── */

.comm-channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.channel-call  { background: #EDE9FE; color: #6D28D9; }
.channel-sms   { background: #DBEAFE; color: #1E40AF; }
.channel-email { background: #F3F4F6; color: #6B7280; }

.comm-log-entry {
  align-items: flex-start;
}
.comm-log-entry .comm-body {
  flex: 1;
  min-width: 0;
}

.comm-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
  padding-top: 2px;
}

.comm-action-btn {
  padding: 3px 10px !important;
  font-size: 0.73rem !important;
  white-space: nowrap;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 0.72rem;
  border-radius: 4px;
  line-height: 1.4;
}

.call-detail-panel {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--yp-bg);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.call-detail-section {
  margin-bottom: 10px;
}
.call-detail-section:last-child {
  margin-bottom: 0;
}
.call-detail-section p {
  margin: 4px 0 0 0;
  line-height: 1.5;
}
.call-transcript {
  margin-top: 4px;
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--yp-border);
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}

.comm-detail-panel {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--yp-bg);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.comm-detail-btn {
  cursor: pointer;
}

.badge-red { background: #FEE2E2; color: #DC2626; }

@media (max-width: 640px) {
  .comm-ts { flex: 0 0 80px; font-size: 0.72rem; }
  .comm-filter-bar { flex-direction: column; }
  .comm-filter-bar .dt-input { width: 100% !important; max-width: none !important; }
  .comm-actions { flex-direction: column; }
  .comm-channel-pill { font-size: 0.65rem; padding: 1px 5px; }
}

/* ── Communications Hub ──────────────────────────────────────────────────── */

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}
.hub-header h1 { margin-bottom: 0; }
.hub-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.hub-summary-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.hub-card {
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  padding: 10px 16px;
  text-align: center;
  min-width: 80px;
  flex: 1;
  box-shadow: var(--shadow-sm);
}
.hub-card-num {
  font-size: 1.35rem;
  font-weight: 700;
  font-family: var(--yp-heading);
  line-height: 1.2;
}
.hub-card-label {
  font-size: 0.72rem;
  color: var(--yp-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.hub-card-email  .hub-card-num { color: #2563EB; }
.hub-card-sms    .hub-card-num { color: #059669; }
.hub-card-call   .hub-card-num { color: #7C3AED; }
.hub-card-telegram .hub-card-num { color: #EA580C; }
.hub-card-wo     .hub-card-num { color: #DC2626; }
.hub-card-notif  .hub-card-num { color: #6B7280; }

.hub-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
  align-items: center;
}
.hub-pill-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.hub-pill-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--yp-muted);
  margin-right: 4px;
  white-space: nowrap;
}
.ch-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  color: var(--yp-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.ch-pill:hover { background: #f0f0ec; text-decoration: none; color: var(--yp-text); }
.ch-pill-active {
  background: var(--yp-dark);
  color: white;
  border-color: var(--yp-dark);
}
.ch-pill-active:hover { background: #444; color: white; }
.ch-pill-count {
  font-size: 0.68rem;
  background: rgba(0,0,0,0.08);
  padding: 0 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}
.ch-pill-active .ch-pill-count { background: rgba(255,255,255,0.2); }

.channel-telegram { background: #FFF7ED; color: #EA580C; }
.channel-wo       { background: #FEE2E2; color: #DC2626; }
.channel-notif    { background: #F3F4F6; color: #6B7280; }

/* Hub modal */
.hub-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hub-modal-content {
  background: var(--yp-surface);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.hub-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--yp-border);
}
.hub-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--yp-muted);
  line-height: 1;
  padding: 0 4px;
}
.hub-modal-close:hover { color: var(--yp-text); }

/* Compose modal tabs */
.compose-tabs {
  display: flex;
  border-bottom: 2px solid var(--yp-border);
  padding: 0 1rem;
  gap: 0;
}
.compose-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--yp-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.compose-tab:hover { color: var(--yp-text); }
.compose-tab-active {
  color: var(--yp-primary);
  border-bottom-color: var(--yp-primary);
}

/* Communications compose form */
.comm-compose {
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.comm-compose label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.comm-compose .form-row {
  margin-bottom: 0.75rem;
}

/* Template editor */
.tpl-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tpl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--yp-border);
  transition: background 0.1s;
}
.tpl-item:first-child { border-top: 1px solid var(--yp-border); }
.tpl-item:hover { background: rgba(0,0,0,0.015); }
.tpl-name { font-weight: 600; font-size: 0.88rem; }
.tpl-badges { display: flex; gap: 4px; }
.tpl-category-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #F3F4F6;
  color: #6B7280;
}
.tpl-category-tenant { background: #DBEAFE; color: #1E40AF; }
.tpl-category-vendor { background: #FFF7ED; color: #EA580C; }
.tpl-category-marketing { background: #EDE9FE; color: #7C3AED; }
.tpl-category-maintenance { background: #FEE2E2; color: #DC2626; }
.tpl-has-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
}
.tpl-has-email { background: #DBEAFE; color: #1E40AF; }
.tpl-has-sms { background: #D1FAE5; color: #059669; }

/* ── AI Assist Button ───────────────────────────────────────────────── */
.ai-assist-btn {
  background: var(--yp-bg, #fff);
  color: #6D28D9;
  border: 1px solid #D8B4FE;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
  line-height: 1.4;
  margin-top: 4px;
  float: right;
}
.ai-assist-btn:hover { background: #F3E8FF; border-color: #A78BFA; }
.ai-assist-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.ai-assist-icon { font-size: 0.82rem; }
.ai-assist-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: ai-spin 0.6s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.tpl-edit-form {
  background: var(--yp-bg);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
}
.tpl-edit-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.tpl-edit-form .form-row {
  margin-bottom: 0.75rem;
}
.tpl-preview {
  background: white;
  border: 1px solid var(--yp-border);
  border-radius: 4px;
  padding: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.comm-upcoming-section summary {
  list-style: none;
}
.comm-upcoming-section summary::-webkit-details-marker {
  display: none;
}

.comm-entry-upcoming {
  background: var(--yp-bg);
}

@media (max-width: 640px) {
  .hub-summary-cards { flex-wrap: wrap; }
  .hub-card { min-width: 60px; padding: 8px 10px; }
  .hub-card-num { font-size: 1.1rem; }
  .hub-filter-pills { flex-direction: column; align-items: flex-start; }
  .hub-pill-group { flex-wrap: wrap; }
  .tpl-item { flex-direction: column; align-items: flex-start; }
}

/* ── PDF Lightbox Modal ──────────────────────────────────────────────────── */
.pdf-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.75);
}
.pdf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 56px;
  background: var(--yp-dark, #1a1a2e);
  color: #fff;
}
.pdf-modal-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}
.pdf-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pdf-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.pdf-modal-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
}
.pdf-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  margin-left: 0.25rem;
}
.pdf-modal-close:hover {
  background: rgba(255,255,255,0.15);
}

/* ── Activity Timeline ──────────────────────────────────────── */

.timeline { border-left: 2px solid #E5E5E0; margin-left: 12px; padding-left: 0; }
.timeline-entry { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--yp-border); align-items: flex-start; position: relative; }
.timeline-entry:last-child { border-bottom: none; }
.timeline-entry::before { content: ''; position: absolute; left: -7px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: #C4B5A0; border: 2px solid #fff; }
.timeline-entry.is-note { background: #FAFAF7; }
.timeline-entry.is-note::before { background: #7C3AED; }
.timeline-icon { flex-shrink: 0; width: 28px; text-align: center; font-size: 1rem; padding-top: 2px; }
.timeline-content { flex: 1; min-width: 0; font-size: 0.84rem; }
.timeline-header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.timeline-summary { font-weight: 500; font-size: 0.875rem; }
.timeline-date { font-size: 0.75rem; color: var(--yp-muted); white-space: nowrap; margin-left: auto; flex-shrink: 0; }
.timeline-delete {
  flex-shrink: 0;
  padding: 0 5px;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.6;
  background: transparent;
  color: var(--yp-muted);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.timeline-entry:hover .timeline-delete { opacity: 1; }
.timeline-delete:hover { color: var(--yp-error) !important; background: transparent !important; }
.tl-dir-badge {
  display: inline-block;
  flex-shrink: 0;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tl-dir-out  { background: #DCFCE7; color: #166534; }
.tl-dir-in   { background: #DBEAFE; color: #1E40AF; }
.tl-dir-tenant { background: #F3E8FF; color: #6B21A8; text-transform: capitalize; }
.timeline-view-btn {
  flex-shrink: 0;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  background: transparent;
  color: var(--yp-link, #1565C0);
  border: 1px solid currentColor;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.timeline-view-btn:hover { background: #E8F4FD !important; color: #0D47A1 !important; }
.timeline-detail { font-size: 0.75rem; color: #777; margin-top: 3px; }

/* ── Auto-save indicator ────────────────────────────────────── */

.autosave-indicator { min-width: 50px; display: inline-block; }
.auto-saved { color: #00695C; font-size: 0.75rem; font-weight: 600; animation: fadeOut 2s forwards; }
@keyframes fadeOut { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }

/* ── Detail grid (global, used by lease/unit detail pages) ──── */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.4rem 1.5rem;
  font-size: 0.88rem;
}

/* ── Lease detail card layout ────────────────────────────────── */

.ld-header {
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-top: 4px solid var(--yp-red);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 1.5rem;
}

.ld-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.ld-header-title h1 {
  margin: 0 0 0.25rem;
  font-size: 1.45rem;
}

.ld-header-title .ld-subtitle {
  font-size: 0.88rem;
  color: var(--yp-muted);
}

.ld-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.ld-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.ld-summary-item {
  padding: 10px 14px;
  background: var(--yp-bg);
  border-radius: 6px;
}

.ld-summary-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--yp-muted);
  margin-bottom: 2px;
}

.ld-summary-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--yp-dark);
}

.ld-summary-value .badge {
  font-size: 0.8rem;
}

/* Lease detail section cards */
.ld-card {
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ld-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--yp-bg);
  border-bottom: 1px solid var(--yp-border);
}

.ld-card-header h2 {
  margin: 0;
  font-size: 0.95rem;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ld-card-header h2 svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
}

.ld-card-body {
  padding: 16px 20px;
}

.ld-card-body .overflow-auto {
  margin: 0 -20px;
  padding: 0 20px;
}

/* NNN current summary box */
.ld-nnn-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 14px 16px;
  background: var(--yp-bg);
  border: 1px solid var(--yp-border);
  border-radius: 6px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.ld-nnn-total {
  font-weight: 700;
  font-size: 1rem;
}

/* Rotessa integration box */
.ld-rotessa-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px 16px;
  background: var(--yp-bg);
  border: 1px solid var(--yp-border);
  border-radius: 6px;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.ld-rotessa-info {
  font-size: 0.85rem;
}

.ld-rotessa-info strong {
  display: block;
  margin-bottom: 2px;
}

.ld-rotessa-info .muted {
  font-size: 0.8rem;
}

/* Inline add forms inside cards */
.ld-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
  align-items: end;
}

.ld-add-form label {
  font-size: 0.73rem;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Lease detail structured field sections */
.ld-field-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--yp-border);
}
.ld-field-section:last-child { border-bottom: none; padding-bottom: 0; }
.ld-field-section:first-child { padding-top: 0; }

.ld-field-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--yp-muted);
  margin-bottom: 8px;
}

.ld-field-row {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.ld-field-row:last-child { margin-bottom: 0; }

.ld-field {
  flex: 1;
  min-width: 120px;
}
.ld-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 2px;
}
.ld-field input, .ld-field select {
  width: 100%;
  box-sizing: border-box;
}
.ld-field .autosave-indicator {
  font-size: 0.75rem;
}

/* Two-column layout for lease side panels */
.ld-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Two-column form grid (responsive) */
.ld-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Enhanced responsive: 768px ──────────────────────────────── */

@media (max-width: 768px) {
  /* Dashboard charts stack on tablets */
  .dash-charts {
    grid-template-columns: 1fr;
  }

  /* Detail grid: 2 columns */
  .detail-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.35rem 1rem;
  }

  /* Lease columns stack */
  .ld-columns {
    grid-template-columns: 1fr;
  }

  /* Lease header compact */
  .ld-header {
    padding: 16px;
  }

  .ld-summary-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .ld-card-body {
    padding: 12px 16px;
  }

  .ld-card-header {
    padding: 10px 16px;
  }

  /* Approval actions stack */
  .approval-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Breadcrumb allow wrapping */
  .breadcrumb {
    flex-wrap: wrap;
  }

  /* Minimum touch target 44px for all clickable elements */
  .btn-sm, a.btn-sm,
  .filter-group a,
  .comm-filter-bar button,
  .comm-filter-bar .btn-sm {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Ensure all table wrappers scroll horizontally */
  .overflow-auto,
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Lease add forms stack to 2 columns */
  .ld-add-form {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Enhanced responsive: 640px ──────────────────────────────── */

@media (max-width: 640px) {
  /* h1 smaller */
  h1 {
    font-size: 1.35rem;
  }

  /* Container tighter padding */
  .container {
    padding: 0 0.75rem;
  }

  main.container {
    padding-top: 1rem;
  }

  /* Lease header: stack title and actions */
  .ld-header-top {
    flex-direction: column;
  }

  .ld-header-actions {
    width: 100%;
  }

  .ld-header-actions .btn-sm {
    flex: 1;
    text-align: center;
  }

  .ld-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .ld-summary-item {
    padding: 8px 10px;
  }

  .ld-summary-label {
    font-size: 0.65rem;
  }

  .ld-summary-value {
    font-size: 0.85rem;
  }

  /* NNN summary stack */
  .ld-nnn-summary {
    grid-template-columns: 1fr 1fr;
  }

  /* Rotessa box stack */
  .ld-rotessa-box {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Comm entries: two-row mobile layout */
  .comm-entry {
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    padding: 0.6rem 0.5rem;
  }

  /* Timestamp takes left, actions float right — both on row 1 */
  .comm-ts {
    flex: 1 1 auto;
    font-size: 0.7rem;
    min-width: 0;
  }

  /* Push actions to the right on the same first row */
  .comm-actions {
    order: -1;
    margin-left: auto;
    padding-top: 0;
  }

  /* Direction icon + channel badge: new row */
  .comm-entry > .comm-dir,
  .comm-entry > [class*="channel-badge"],
  .comm-entry > .badge {
    order: 2;
  }

  /* Body spans full width below the ts/actions row */
  .comm-body {
    order: 3;
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Bigger tap targets on mobile */
  .comm-action-btn {
    padding: 5px 12px !important;
    font-size: 0.78rem !important;
    min-height: 32px;
  }

  /* Transcript readable on small screens */
  .transcript-turn {
    grid-template-columns: 60px 1fr;
    gap: 6px;
  }

  /* Call detail panel full width */
  .call-detail-panel {
    margin-top: 8px;
    padding: 10px;
  }

  /* Contact header: allow stacking */
  .contact-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Property meta wrap tighter */
  .property-meta {
    gap: 0.75rem;
    font-size: 0.82rem;
  }

  /* Detail grid: single column */
  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Cards tighter padding */
  .ld-card-body {
    padding: 10px 12px;
  }

  .ld-card-header {
    padding: 8px 12px;
  }

  .ld-card-body .overflow-auto {
    margin: 0 -12px;
    padding: 0 12px;
  }

  /* Table cells: compact */
  table td, table thead th {
    padding: 0.45rem 0.6rem;
  }
}

/* ── Enhanced responsive: 480px ──────────────────────────────── */

@media (max-width: 480px) {
  /* Lease summary: single column */
  .ld-summary-grid {
    grid-template-columns: 1fr;
  }

  /* NNN summary single column */
  .ld-nnn-summary {
    grid-template-columns: 1fr;
  }

  /* Inline add forms single column */
  .ld-add-form {
    grid-template-columns: 1fr;
  }

  /* Form grids single column on mobile */
  .ld-form-grid {
    grid-template-columns: 1fr;
  }

  /* Even more compact tables */
  table {
    font-size: 0.78rem;
  }

  table thead th {
    font-size: 0.68rem;
    padding: 0.5rem 0.5rem;
  }

  /* Timeline compact */
  .timeline {
    margin-left: 8px;
    padding-left: 12px;
  }

  /* Comm filter bar even more compact */
  .comm-filter-bar {
    padding: 0.5rem;
    gap: 4px;
  }

  /* Footer compact */
  .site-footer {
    font-size: 0.7rem;
    padding: 0.75rem 0;
  }
}

/* ── Shared spinners ──────────────────────────────────────── */

.upload-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid #ccc; border-top-color: var(--yp-primary);
  border-radius: 50%; animation: yp-spin 0.6s linear infinite;
  vertical-align: middle;
}

.upload-spinner-lg {
  display: inline-block; width: 32px; height: 32px;
  border: 3px solid #e0e3e8; border-top-color: var(--yp-primary);
  border-radius: 50%; animation: yp-spin 0.8s linear infinite;
}

@keyframes yp-spin { to { transform: rotate(360deg); } }

/* ── Toggle Switch ──────────────────────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
  cursor: pointer;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--yp-success);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ── Contact autocomplete dropdown ───────────────────────────────────── */
.ac-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--yp-surface);
  border: 1px solid var(--yp-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  max-height: 220px;
}
.ac-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--yp-border);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item:focus { background: var(--yp-primary-bg); outline: none; }
.ac-item strong { color: var(--yp-dark); }

/* ── Custom Audio Player ─────────────────────────────────────────────────── */
.yp-audio-player { display:block; width:100%; max-width:520px; }
.yp-audio-controls { display:flex; align-items:center; gap:8px; background:#F9FAFB; border:1px solid var(--yp-border); border-radius:8px; padding:7px 10px; }
/* Main play/pause button */
.yp-ap-btn { background:var(--yp-primary); color:white; border:none; border-radius:50%; width:36px; height:36px; min-width:36px; cursor:pointer; font-size:1.1rem; flex-shrink:0; display:flex; align-items:center; justify-content:center; transition:background 0.15s; line-height:1; }
.yp-ap-btn:hover { background:var(--yp-primary-hover, #6D28D9); }
/* Skip buttons */
.yp-ap-skip { background:none; border:1px solid var(--yp-border); border-radius:4px; color:var(--yp-muted); font-size:0.65rem; font-weight:600; padding:0 5px; height:24px; cursor:pointer; flex-shrink:0; white-space:nowrap; transition:border-color 0.15s, color 0.15s; letter-spacing:-0.02em; }
.yp-ap-skip:hover { border-color:var(--yp-primary); color:var(--yp-primary); }
/* Scrubber — range input styled as progress bar */
.yp-ap-scrubber { flex:1; min-width:60px; min-height:24px; height:8px; cursor:pointer; -webkit-appearance:none; appearance:none; background:transparent; outline:none; }
.yp-ap-scrubber::-webkit-slider-runnable-track { height:8px; border-radius:4px; background:linear-gradient(to right, var(--yp-primary) calc(var(--val,0) * 1%), #D1D5DB calc(var(--val,0) * 1%)); }
.yp-ap-scrubber::-moz-range-track { height:8px; border-radius:4px; background:#D1D5DB; }
.yp-ap-scrubber::-moz-range-progress { height:8px; border-radius:4px; background:var(--yp-primary); }
.yp-ap-scrubber::-webkit-slider-thumb { -webkit-appearance:none; width:16px; height:16px; border-radius:50%; background:var(--yp-primary); margin-top:-4px; cursor:grab; box-shadow:0 1px 3px rgba(0,0,0,0.25); transition:transform 0.1s; }
.yp-ap-scrubber:active::-webkit-slider-thumb { transform:scale(1.25); cursor:grabbing; }
.yp-ap-scrubber::-moz-range-thumb { width:16px; height:16px; border-radius:50%; background:var(--yp-primary); border:none; cursor:grab; box-shadow:0 1px 3px rgba(0,0,0,0.25); }
/* Time + speed */
.yp-ap-time { font-size:0.75rem; color:var(--yp-muted); white-space:nowrap; font-variant-numeric:tabular-nums; min-width:80px; text-align:center; }
.yp-ap-speed { border:1px solid var(--yp-border); border-radius:4px; font-size:0.75rem; padding:2px 4px; cursor:pointer; background:white; color:var(--yp-dark); flex-shrink:0; height:24px; width:56px; }

/* Call detail panel */
.call-detail-section { padding:10px 14px; border-bottom:1px solid var(--yp-border); }
.call-detail-section:last-child { border-bottom:none; }
.call-summary-structured { background:#FAFAFA; }
.call-summary-topics { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:8px; }
.call-topic-pill { background:#EEF2FF; color:#4F46E5; font-size:0.72rem; padding:2px 8px; border-radius:10px; }
.call-action-items { margin-top:4px; }
.call-action-items strong { font-size:0.82rem; color:var(--yp-dark); }
.call-action-items ul { margin:6px 0 0 0; padding-left:18px; }
.call-action-items li { font-size:0.82rem; margin-bottom:5px; }
.action-task { color:var(--yp-dark); }
.action-assignee { background:#F0FDF4; color:#166534; font-size:0.72rem; padding:1px 7px; border-radius:10px; margin-left:6px; }
.action-priority-high { background:#FEF2F2; color:#DC2626; font-size:0.72rem; padding:1px 7px; border-radius:10px; margin-left:4px; }
.call-recording-section { background:#F9FAFB; }

/* Diarized transcript */
.call-transcript { font-size:0.80rem; max-height:320px; overflow-y:auto; padding:8px 12px; }
.transcript-turn { display:grid; grid-template-columns:90px 1fr; gap:8px; padding:5px 0; border-bottom:1px solid #F3F4F6; }
.transcript-turn:last-child { border-bottom:none; }
.transcript-speaker { font-weight:600; font-size:0.75rem; color:var(--yp-primary); padding-top:1px; }
.transcript-text { color:var(--yp-dark); line-height:1.5; }

/* Review queue age labels */
.age-label { font-size: 0.75rem; color: var(--yp-muted); }
.age-warn   { color: #b45309 !important; font-weight: 600; }
.age-critical { color: #dc2626 !important; font-weight: 700; }
