/* ==========================================================================
   3D Glassmorphism Components
   ========================================================================== */

/* 3D Card base */
.card-3d {
  background: var(--card-bg);
  border: var(--card-border);
  border-radius: 20px;
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--card-shadow);
  cursor: default;
}
.card-3d::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 1px;
  background: var(--card-inner-glow);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
}
.card-3d:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--card-shadow-hover);
}
.card-3d-static:hover {
  transform: none;
  box-shadow: var(--card-shadow);
}

/* Stat card — large number focus */
.stat-3d {
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.stat-3d .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.stat-3d .stat-icon svg {
  width: 20px;
  height: 20px;
}
.stat-3d .stat-number {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  background: var(--stat-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-3d .stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}

/* Status colors */
.stat-good .stat-icon { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.stat-warn .stat-icon { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.stat-bad .stat-icon { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.stat-neutral .stat-icon { background: rgba(129, 140, 248, 0.15); color: #818cf8; }

.stat-good .stat-number { --stat-gradient: linear-gradient(135deg, #4ade80, #22c55e); }
.stat-warn .stat-number { --stat-gradient: linear-gradient(135deg, #fbbf24, #f59e0b); }
.stat-bad .stat-number { --stat-gradient: linear-gradient(135deg, #f87171, #ef4444); }
.stat-neutral .stat-number { --stat-gradient: linear-gradient(135deg, #818cf8, #6366f1); }

/* Grid layouts */
.stats-grid-3d {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}
.cards-grid-3d {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 28px;
}

/* Section card */
.section-3d {
  min-height: 200px;
}
.section-3d .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.section-3d .section-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.section-3d .section-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.section-3d .view-all {
  font-size: var(--text-xs);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* List items inside sections */
.list-item-3d {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: 14px;
  margin-bottom: 8px;
  transition: background 0.2s, transform 0.2s;
  cursor: pointer;
}
.list-item-3d:hover {
  background: var(--item-hover-bg);
  transform: translateX(4px);
}
.list-item-3d .item-date {
  text-align: center;
  min-width: 44px;
  flex-shrink: 0;
}
.list-item-3d .item-date .month {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}
.list-item-3d .item-date .day {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.list-item-3d .item-content {
  flex: 1;
  min-width: 0;
}
.list-item-3d .item-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.list-item-3d .item-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-3d .item-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.badge-days { background: rgba(129, 140, 248, 0.15); color: #818cf8; }
.badge-alert { background: rgba(248, 113, 113, 0.15); color: #f87171; }
.badge-progress { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.badge-agency-3d {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* Task checkbox 3D */
.task-check-3d {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: all 0.2s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-check-3d:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

/* Building icon 3D */
.building-icon-3d {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .stats-grid-3d { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .cards-grid-3d { grid-template-columns: 1fr; gap: 16px; }
  .stat-3d .stat-number { font-size: 36px; }
}

/* ==========================================================================
   Components
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  line-height: 1;
  padding: var(--space-2) var(--space-4);
  min-height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-default);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-sm {
  min-height: 28px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  min-height: 40px;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* Primary */
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  height: 36px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Danger */
.btn-danger {
  background: var(--status-error);
  color: white;
  border-color: var(--status-error);
}

.btn-danger:hover {
  background: #dc2626;
}

/* ---------- Inputs ---------- */
.input,
.select,
.textarea {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-default);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-hover);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.input::placeholder {
  color: var(--text-tertiary);
}

.textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 2rem 0 var(--space-3);
  line-height: 1.5; /* vertically center text regardless of min-height */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m2 4 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.input-sm, .select-sm {
  min-height: 28px;
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-2);
}

.input-lg, .select-lg {
  min-height: 44px;
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-4);
}

/* Form groups */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--status-error);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.card-hover:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

/* ---------- Tables ---------- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  font-size: var(--text-sm);
}

.table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 10px var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

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

/* Sortable header */
.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--text-secondary);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-default);
  cursor: pointer;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.tab svg {
  width: 14px;
  height: 14px;
}

.tab-count {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.tab.active .tab-count {
  background: var(--accent-muted);
  color: var(--accent-text);
}

.tab-panel {
  display: none;
  padding-top: var(--space-5);
}

.tab-panel.active {
  display: block;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success {
  background: var(--status-success-muted);
  color: var(--status-success);
}

.badge-warning {
  background: var(--status-warning-muted);
  color: var(--status-warning);
}

.badge-error {
  background: var(--status-error-muted);
  color: var(--status-error);
}

.badge-info {
  background: var(--status-info-muted);
  color: var(--status-info);
}

.badge-neutral {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* Dot indicator */
.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: var(--z-modal);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.modal-title {
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  animation: toast-in var(--duration-slow) var(--ease-out);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

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

/* ---------- Skeletons ---------- */
/* ---------- Skeleton Loading (Dramatic) ---------- */

@keyframes skeleton-wave {
  0% { background-position: -800px 0; }
  100% { background-position: 800px 0; }
}

@keyframes skeleton-breathe {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.002); }
}

@keyframes skeleton-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 20px -4px var(--accent-alpha, rgba(99,102,241,0.15)); }
}

@keyframes skeleton-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.skeleton {
  --accent-alpha: rgba(99,102,241,0.12);
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  animation: skeleton-breathe 2s ease-in-out infinite, skeleton-glow 2.5s ease-in-out infinite;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(128,128,128,0.08) 20%,
    rgba(128,128,128,0.18) 40%,
    rgba(255,255,255,0.12) 50%,
    rgba(128,128,128,0.18) 60%,
    rgba(128,128,128,0.08) 80%,
    transparent 100%
  );
  background-size: 800px 100%;
  animation: skeleton-wave 1.6s ease-in-out infinite;
  border-radius: inherit;
}

/* Light theme: slightly stronger shimmer */
[data-theme="light"] .skeleton {
  --accent-alpha: rgba(99,102,241,0.08);
}
[data-theme="light"] .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0,0,0,0.04) 20%,
    rgba(0,0,0,0.08) 40%,
    rgba(255,255,255,0.4) 50%,
    rgba(0,0,0,0.08) 60%,
    rgba(0,0,0,0.04) 80%,
    transparent 100%
  );
  background-size: 800px 100%;
  animation: skeleton-wave 1.6s ease-in-out infinite;
}

/* Staggered entrance for skeleton children */
.skeleton-row > .skeleton,
.skeleton-table-row > .skeleton {
  animation-delay: calc(var(--i, 0) * 0.08s);
  opacity: 0;
  animation: skeleton-fade-in 0.4s ease forwards, skeleton-breathe 2s ease-in-out 0.4s infinite, skeleton-glow 2.5s ease-in-out 0.4s infinite;
}
.skeleton-row > .skeleton:nth-child(1) { --i: 0; }
.skeleton-row > .skeleton:nth-child(2) { --i: 1; }
.skeleton-row > .skeleton:nth-child(3) { --i: 2; }
.skeleton-row > .skeleton:nth-child(4) { --i: 3; }
.skeleton-table-row:nth-child(1) { --i: 0; }
.skeleton-table-row:nth-child(2) { --i: 1; }
.skeleton-table-row:nth-child(3) { --i: 2; }
.skeleton-table-row:nth-child(4) { --i: 3; }
.skeleton-table-row:nth-child(5) { --i: 4; }

/* Stagger whole rows/cards */
.skeleton-card,
.skeleton-heading,
.skeleton-text,
.skeleton-table-row {
  opacity: 0;
  animation: skeleton-fade-in 0.35s ease forwards;
}
.skeleton-card:nth-child(1), .skeleton-heading:first-child, .skeleton-text:nth-child(1), .skeleton-table-row:nth-child(1) { animation-delay: 0s; }
.skeleton-card:nth-child(2), .skeleton-text:nth-child(2), .skeleton-table-row:nth-child(2) { animation-delay: 0.06s; }
.skeleton-card:nth-child(3), .skeleton-text:nth-child(3), .skeleton-table-row:nth-child(3) { animation-delay: 0.12s; }
.skeleton-card:nth-child(4), .skeleton-text:nth-child(4), .skeleton-table-row:nth-child(4) { animation-delay: 0.18s; }
.skeleton-card:nth-child(5), .skeleton-text:nth-child(5), .skeleton-table-row:nth-child(5) { animation-delay: 0.24s; }

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-text.w-25  { width: 25%; }
.skeleton-text.w-50  { width: 50%; }
.skeleton-text.w-75  { width: 75%; }
.skeleton-text.w-100 { width: 100%; }

.skeleton-heading {
  height: 20px;
  width: 40%;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-sm);
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}

.skeleton-row {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton-stat {
  height: 64px;
  border-radius: var(--radius-lg);
  flex: 1;
}

.skeleton-table-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.skeleton-table-row > div {
  height: 14px;
  border-radius: var(--radius-sm);
}

/* ---------- Empty State ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 320px;
}

/* ---------- Dropdown / Autocomplete ---------- */
.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-1);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.dropdown.open {
  display: block;
}

.dropdown-item {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.dropdown-item:hover,
.dropdown-item.selected {
  background: var(--bg-hover);
}

.dropdown-item:first-child {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-2xs);
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: var(--z-tooltip);
  transition: opacity var(--duration-fast);
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ---------- Stat Card ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Alert/Notice ---------- */
.notice {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border: 1px solid;
}

.notice-info {
  background: var(--status-info-muted);
  border-color: var(--status-info);
  color: var(--status-info);
}

.notice-warning {
  background: var(--status-warning-muted);
  border-color: var(--status-warning);
  color: var(--status-warning);
}

.notice-error {
  background: var(--status-error-muted);
  border-color: var(--status-error);
  color: var(--status-error);
}

.notice-success {
  background: var(--status-success-muted);
  border-color: var(--status-success);
  color: var(--status-success);
}

/* ---------- Divider ---------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

/* (skeleton styles consolidated above) */

/* Portfolio chips (tool pages building selector) */
.portfolio-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent);
  background: var(--accent-muted);
  color: var(--accent-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.portfolio-chip:hover {
  background: var(--accent);
  color: #fff;
}

/* ==========================================================================
   Page-Specific Styles
   ========================================================================== */

/* ---------- Home Page ---------- */

.home-header { margin-bottom: var(--space-4); }
.home-header h1 { font-size: var(--text-xl); font-weight: var(--weight-bold); color: var(--text-primary); }
.home-header p { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-1); }

.home-search { position: relative; margin-bottom: var(--space-4); max-width: 600px; }
.home-search .input { padding-left: 36px; height: 40px; }
.home-search-icon { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; z-index: 1; }
.home-search-icon svg { width: 16px; height: 16px; }

.health-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.health-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.health-stat-value {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1;
}
.health-stat-value.danger { color: var(--status-error); }
.health-stat-value.warning { color: var(--status-warning); }
.health-stat-value.success { color: var(--status-success); }
.health-stat-label {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.home-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.home-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.home-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.home-card-title svg { width: 16px; height: 16px; flex-shrink: 0; }
.home-card-link {
  font-size: var(--text-2xs);
  color: var(--accent-text);
  text-decoration: none;
}
.home-card-link:hover { color: var(--accent-hover); }
.home-empty {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  padding: var(--space-4) 0;
  text-align: center;
}
.home-empty a { color: var(--accent-text); text-decoration: none; }

/* Deadline items */
.deadline-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.deadline-item:last-child { border-bottom: none; }
.deadline-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
}
.deadline-date-month {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.deadline-date-day {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1;
}
.deadline-info { flex: 1; min-width: 0; }
.deadline-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.deadline-desc {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}
.deadline-badge {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}
.deadline-badge.urgent { background: var(--status-error-muted); color: var(--status-error); }
.deadline-badge.soon { background: var(--status-warning-muted); color: var(--status-warning); }

.alert-agency {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  color: var(--accent-text);
  background: var(--accent-muted);
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  margin-right: var(--space-1);
}

/* Expand detail */
.expand-detail {
  display: none;
  padding: var(--space-3) var(--space-4);
  margin-left: 52px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.6;
  border-left: 2px solid var(--border);
}
.expand-detail.open { display: block; }
.expand-detail p { margin: 0 0 var(--space-2); }
.detail-label {
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: var(--space-1);
}
.detail-link {
  color: var(--accent-text);
  text-decoration: none;
  font-size: var(--text-xs);
}
.detail-link:hover { color: var(--accent-hover); }

/* Building items (home page) */
.building-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast);
}
.building-item:hover { background: var(--bg-hover); margin: 0 calc(var(--space-3) * -1); padding-left: var(--space-3); padding-right: var(--space-3); border-radius: var(--radius-md); }
.building-icon { color: var(--text-tertiary); flex-shrink: 0; }
.building-icon svg { width: 18px; height: 18px; }
.building-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.building-stats {
  display: flex;
  gap: var(--space-2);
  margin-top: 2px;
}
.bstat {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
}
.bstat.warn { color: var(--status-warning); }
.building-borough {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Task items (home page) */
.task-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.task-info { flex: 1; min-width: 0; }
.task-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
}
.task-due {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}
.task-due.overdue { color: var(--status-error); }
.task-status {
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}
.task-status.in_progress { background: var(--status-info-muted); color: var(--status-info); }
.task-status.pending { background: var(--status-warning-muted); color: var(--status-warning); }

@media (max-width: 768px) {
  .health-bar { grid-template-columns: repeat(2, 1fr); }
  .home-grid { grid-template-columns: 1fr; }
  .home-search { max-width: 100%; }
}

/* ---------- Search Page ---------- */

.search-page { max-width: 680px; margin: 0 auto; }
.search-hero { padding: var(--space-4) 0; }
.search-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  text-align: center;
}
.search-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-align: center;
  margin-top: var(--space-1);
  margin-bottom: var(--space-5);
}

.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 200px;
  margin: 0 auto var(--space-4);
}
.mode-toggle button {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: center;
  font-family: var(--font-sans);
  transition: all var(--duration-fast);
}
.mode-toggle button:first-child { border-right: 1px solid var(--border); }
.mode-toggle button.active { background: var(--accent); color: #fff; }
.mode-toggle button:hover:not(.active) { background: var(--bg-hover); }

.search-bar-row {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.search-bar-row .select { flex: 1; }
.search-bar-row .btn { white-space: nowrap; }

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: var(--space-1);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  max-height: 280px;
  overflow-y: auto;
  display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--duration-fast);
}
.autocomplete-item:hover,
.autocomplete-item.highlighted { background: var(--bg-hover); }
.borough-label {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}

.search-chips {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-4);
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-2xs);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.chip-label {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bulk-section { display: none; margin-top: var(--space-4); }
.bulk-section.active { display: block; }
.bulk-section .textarea { min-height: 120px; font-size: var(--text-sm); }
.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
}
.bulk-count { font-size: var(--text-xs); color: var(--text-tertiary); }

.recent-section {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.recent-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}
.recent-clear {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  cursor: pointer;
}
.recent-clear:hover { color: var(--status-error); }
.recent-list { display: flex; flex-direction: column; gap: var(--space-1); }
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast);
}
.recent-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.recent-borough { font-size: var(--text-2xs); color: var(--text-tertiary); }

/* ---------- Portfolio Page ---------- */

.view-toggle { display: flex; gap: var(--space-1); }
.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.view-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.view-btn.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent-text); }
.view-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.building-list { display: flex; flex-direction: column; gap: var(--space-2); }
.building-row {
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.building-row-main { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-width: 0; }
.building-row-info { min-width: 0; }
.building-row-address {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.building-row-meta {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}
.building-row-stats { display: flex; align-items: center; gap: var(--space-4); flex-shrink: 0; }
.building-stat { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.building-stat-val {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.building-stat-val.stat-warn { color: var(--status-warning); }
.building-stat-val.stat-danger { color: var(--status-error); }
.building-stat-label { font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }
.building-row-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: all var(--duration-fast);
}
.building-row:hover .building-row-remove,
.building-card:hover .building-row-remove { opacity: 1; }
.building-row-remove:hover { background: var(--status-error-muted); color: var(--status-error); }
.building-row-remove svg { width: 14px; height: 14px; }

.building-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.building-card {
  cursor: pointer;
  padding: var(--space-4);
}

.card-health-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}
.health-val {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.health-val.stat-warn { color: var(--status-warning); }
.health-val.stat-danger { color: var(--status-error); }
.health-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Task filter active */
.task-filter.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent-text); }

/* Compliance items */
.compliance-cat.active { background: var(--accent-muted); color: var(--accent-text); }
.compliance-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}
.compliance-item:last-child { border-bottom: none; }
.compliance-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
  background: var(--text-tertiary);
}
.compliance-dot.overdue { background: var(--status-error); }
.compliance-dot.soon { background: var(--status-warning); }
.compliance-dot.upcoming { background: var(--status-success); }
.compliance-date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  min-width: 56px;
}

@media (max-width: 768px) {
  .building-card-grid { grid-template-columns: 1fr; }
  .building-row-stats { flex-wrap: wrap; gap: var(--space-2); }
  .card-health-bar { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Market Page ---------- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.market-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: var(--space-3);
  align-items: end;
}
.market-form .form-group { min-width: 0; }
.market-form .btn { height: 38px; white-space: nowrap; }
.portfolio-chips-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

@media (max-width: 768px) {
  .market-form { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .market-form .form-group:first-child { grid-column: 1 / -1; }
  .market-form .btn { grid-column: 1 / -1; width: 100%; }
}

/* ---------- Tools Index ---------- */

.tool-index { max-width: 960px; }
.tool-index__header { margin-bottom: var(--space-6); }
.tool-index__title { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text-primary); }
.tool-index__subtitle { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-1); }
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.tool-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: border-color var(--duration-fast), transform var(--duration-fast);
}
.tool-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.tool-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--accent-muted);
  margin-bottom: var(--space-4);
}
.tool-card__icon svg { width: 24px; height: 24px; color: var(--accent-text); }
.tool-card__title { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--text-primary); margin-bottom: var(--space-1); }
.tool-card__desc { font-size: var(--text-sm); color: var(--text-tertiary); line-height: var(--leading-normal); }
.tool-card__body { flex: 1; }
.tool-card__arrow {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  transition: transform var(--duration-fast), color var(--duration-fast);
}
.tool-card:hover .tool-card__arrow { transform: translateX(3px); color: var(--accent); }

@media (min-width: 1100px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .tool-grid { grid-template-columns: 1fr; gap: var(--space-2); }
  .tool-card { flex-direction: row; align-items: center; padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .tool-card__icon { width: 40px; height: 40px; margin-bottom: 0; }
  .tool-card__desc { display: none; }
  .tool-card__title { margin-bottom: 0; font-size: var(--text-sm); }
  .tool-card__arrow { position: static; flex-shrink: 0; width: 14px; height: 14px; }
}

/* ---------- Tool Sub-Pages ---------- */

.tool-page { max-width: 1080px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-decoration: none;
  margin-bottom: var(--space-3);
}
.back-link:hover { color: var(--text-primary); }
.back-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.card-section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

/* Deal Analyzer */
.da-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); align-items: start; }
.da-inputs { min-width: 0; }
.da-results { min-width: 0; }
.da-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.da-segmented { display: flex; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: var(--space-5); }
.da-seg {
  flex: 1;
  padding: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  text-align: center;
  font-family: var(--font-sans);
  transition: all var(--duration-fast);
}
.da-seg:last-child { border-right: none; }
.da-seg:hover { background: var(--bg-hover); }
.da-seg.active { background: var(--accent); color: #fff; }
.da-table td { font-size: var(--text-sm); }
.da-val { text-align: right; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; white-space: nowrap; }
.da-total-row td { font-weight: var(--weight-semibold); color: var(--text-primary); border-top: 1px solid var(--border); }
.da-invest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.da-invest-item { text-align: center; padding: var(--space-3) 0; }
.da-invest-val { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.da-invest-label { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-1); }

@media (max-width: 768px) {
  .da-layout { grid-template-columns: 1fr; }
  .da-form-grid { grid-template-columns: 1fr; }
}

/* ---------- Activity Page ---------- */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

/* ---------- Property Detail Page ---------- */

.property-header {
  margin-bottom: var(--space-4);
}
.property-address {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}
.property-borough {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}
.property-ids {
  font-size: var(--text-2xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  font-family: var(--font-mono);
}
.property-ids span { color: var(--text-secondary); }
.property-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}

.tab-content { margin-top: var(--space-4); }
.tab-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-12);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}
.tab-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* Property tab sub-components */
.section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.stat-card .stat-value {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-value-unit {
  font-size: var(--text-2xs);
  font-weight: var(--weight-normal);
  color: var(--text-tertiary);
  margin-left: var(--space-1);
}

.detail-section { margin-bottom: var(--space-5); }
.detail-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}
.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.detail-key {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}
.detail-val {
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: var(--weight-medium);
  text-align: right;
}

.filter-bar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
  align-items: center;
}

.external-links {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-4);
}
.external-link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--duration-fast);
}
.external-link-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* Risk badge / score bar */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}
.risk-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}
.score-bar { display: flex; align-items: center; gap: var(--space-2); flex: 1; }
.score-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-slow);
}
.score-label { font-size: var(--text-2xs); color: var(--text-tertiary); min-width: 28px; text-align: right; }

/* PLUTO data grid */
.pluto-grid { margin-top: var(--space-3); }
.pluto-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}
.pluto-key { color: var(--text-tertiary); }
.pluto-val { color: var(--text-primary); font-weight: var(--weight-medium); text-align: right; }

/* Button variant: outline */
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text-primary); }

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .property-actions { flex-direction: column; }
  .property-actions .btn { width: 100%; }
}

/* ---------- AI Chat ---------- */

.message-content p { margin: 0 0 var(--space-2); }
.message-content p:last-child { margin: 0; }
.message-content ul { list-style: none; padding: 0; margin: var(--space-1) 0 var(--space-2); }
.message-content li { position: relative; padding-left: 14px; margin-bottom: var(--space-1); }
.message-content li::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; }
.message-content strong { font-weight: var(--weight-semibold); }
.message-content h3 { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin: var(--space-3) 0 var(--space-2); }
.message-content h4 { font-size: var(--text-xs); font-weight: var(--weight-semibold); margin: var(--space-2) 0 var(--space-1); }
.message-content code {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  background: var(--bg-base);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-3px); } }
