/* Membershine Clickable Prototype — Design System Styles */
:root {
  --ms-primary: #00aeef;
  --ms-primary-dark: #0096d6;
  --ms-secondary: #6c757d;
  --ms-info: #00649d;
  --ms-body-text: #212529;
  --ms-muted: #6c757d;
  --ms-border: #dee2e6;
  --ms-body-bg: #f8f9fa;
  --ms-card-bg: #ffffff;
  --ms-sidebar-width: 280px;
  --ms-header-height: 70px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ms-body-text);
  background: var(--ms-body-bg);
  margin: 0;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--ms-sidebar-width);
  height: 100vh;
  background: var(--ms-card-bg);
  border-right: 1px solid var(--ms-border);
  z-index: 1030;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar:not(.show) { transform: translateX(-100%); }

.sidebar-header {
  height: var(--ms-header-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--ms-border);
}
.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo-icon { flex-shrink: 0; }
.logo-text { font-size: 1.25rem; font-weight: 600; }
.logo-hoa { color: var(--ms-body-text); }
.logo-start { color: var(--ms-primary); }

.org-switcher {
  padding: 1rem 1rem 0.5rem;
}

.sidebar-nav-container {
  padding-bottom: 2rem;
}

.nav-item { margin: 0.125rem 1rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.475rem;
  color: var(--ms-body-text);
  font-weight: 500;
  text-decoration: none;
  min-height: 44px;
  transition: all 0.15s ease;
  cursor: pointer;
}
.nav-link:hover { background: color-mix(in srgb, var(--ms-secondary) 10%, white); }
.nav-link.active {
  color: var(--ms-primary);
  background: color-mix(in srgb, var(--ms-primary) 10%, white);
  font-weight: 600;
}
.nav-icon { width: 1.25rem; text-align: center; font-size: 1rem; }
.nav-chevron { margin-left: auto; font-size: 0.75rem; transition: transform 0.2s; }
.nav-link.collapsed .nav-chevron { transform: rotate(-90deg); }

.sub-nav { display: none; padding-left: 2.5rem; }
.sub-nav.show { display: block; }
.sub-nav-link {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 0.475rem;
  color: var(--ms-muted);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.sub-nav-link:hover { color: var(--ms-primary); background: color-mix(in srgb, var(--ms-primary) 5%, white); }
.sub-nav-link.active { color: var(--ms-primary); font-weight: 600; }

/* Main Layout */
.main-layout {
  margin-left: var(--ms-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.app-header {
  height: var(--ms-header-height);
  background: var(--ms-card-bg);
  border-bottom: 1px solid var(--ms-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 998;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 0.475rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.1rem;
}
.btn-icon:hover { background: color-mix(in srgb, var(--ms-secondary) 10%, white); transform: translateY(-1px); }

.badge-notification {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--ms-primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-switcher {
  display: flex;
  gap: 0.25rem;
  background: var(--ms-body-bg);
  border-radius: 0.475rem;
  padding: 0.125rem;
}
.theme-switcher .btn-icon { width: 32px; height: 32px; font-size: 0.85rem; }
.theme-switcher .btn-icon.active { background: var(--ms-card-bg); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.user-avatar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ms-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
}
.user-name { font-weight: 500; font-size: 0.875rem; }

.main-content {
  flex: 1;
  padding: 2rem;
}

.app-footer {
  padding: 1rem 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ms-muted);
  border-top: 1px solid var(--ms-border);
}

/* Page Elements */
.page-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--ms-muted);
  margin-bottom: 1.5rem;
}

.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.action-bar-left {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.action-bar-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-primary {
  background: var(--ms-primary);
  border-color: var(--ms-primary);
  color: white;
  font-weight: 500;
  border-radius: 0.475rem;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--ms-primary-dark); border-color: var(--ms-primary-dark); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--ms-secondary);
  color: var(--ms-secondary);
  font-weight: 500;
  border-radius: 0.475rem;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

/* Tables */
.ms-table { width: 100%; border-collapse: collapse; }
.ms-table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ms-muted);
  padding: 1rem 0.75rem;
  border-bottom: 2px solid var(--ms-border);
  white-space: nowrap;
}
.ms-table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ms-border) 50%, transparent);
  vertical-align: middle;
}
.ms-table tbody tr:hover { background: color-mix(in srgb, var(--ms-primary) 3%, white); }

.text-right { text-align: right; }
.text-muted { color: var(--ms-muted) !important; }
.fw-600 { font-weight: 600; }
.font-mono { font-variant-numeric: tabular-nums; }

/* Badges */
.badge-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 50rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: color-mix(in srgb, var(--ms-primary) 15%, white); color: var(--ms-info); }
.badge-neutral { background: #e9ecef; color: #495057; }

/* Cards */
.ms-card {
  background: var(--ms-card-bg);
  border-radius: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  padding: 1.5rem;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--ms-card-bg);
  border-radius: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  padding: 1.25rem 1.5rem;
}
.stat-card .stat-label { font-size: 0.875rem; color: var(--ms-muted); margin-bottom: 0.25rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 600; }
.stat-card .stat-value.text-primary { color: var(--ms-primary); }
.stat-card .stat-value.text-success { color: #28a745; }
.stat-card .stat-value.text-danger { color: #dc3545; }

/* Section Headers (Financial Reports) */
.section-header {
  background: var(--ms-primary);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: 0.475rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.section-header:first-of-type { margin-top: 0; }

.report-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}
.report-row:nth-child(even) { background: var(--ms-body-bg); }
.report-row .acct-code { color: var(--ms-muted); width: 4rem; font-variant-numeric: tabular-nums; }
.report-row .acct-name { flex: 1; }
.report-row .acct-amount { text-align: right; font-variant-numeric: tabular-nums; min-width: 8rem; }

.report-total {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-top: 1px solid var(--ms-border);
  background: var(--ms-body-bg);
}
.report-total .acct-amount { text-align: right; font-variant-numeric: tabular-nums; min-width: 8rem; }

.report-net {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  font-weight: 600;
  font-size: 1.25rem;
  margin-top: 1rem;
  border-top: 2px solid var(--ms-body-text);
}

/* Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--ms-border);
  border-radius: 0.475rem;
  overflow: hidden;
}
.calendar-header-cell {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ms-muted);
  background: var(--ms-body-bg);
  border-bottom: 1px solid var(--ms-border);
}
.calendar-cell {
  min-height: 100px;
  padding: 0.5rem;
  border-right: 1px solid var(--ms-border);
  border-bottom: 1px solid var(--ms-border);
  font-size: 0.8rem;
}
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-cell .day-number { font-weight: 600; margin-bottom: 0.25rem; }
.calendar-cell.today .day-number {
  background: var(--ms-primary);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-cell .event-pill {
  display: block;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-meeting { background: color-mix(in srgb, var(--ms-primary) 20%, white); color: var(--ms-info); }
.event-maintenance { background: #fff3cd; color: #856404; }
.event-financial { background: #f8d7da; color: #721c24; }
.event-social { background: #d4edda; color: #155724; }

/* Newsfeed Cards */
.feed-card {
  background: var(--ms-card-bg);
  border-radius: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.feed-card .feed-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.feed-card .feed-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.feed-card .feed-body { color: var(--ms-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.feed-card .feed-engagement { display: flex; gap: 1.5rem; color: var(--ms-muted); font-size: 0.85rem; }

/* Split Panel */
.split-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.panel-box {
  background: var(--ms-card-bg);
  border-radius: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  padding: 1.25rem;
}
.panel-box h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* Reconciliation Summary */
.recon-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 2rem;
  padding: 1rem;
  font-size: 0.9rem;
}
.recon-summary .recon-label { color: var(--ms-muted); }
.recon-summary .recon-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* Form Elements */
.form-card {
  background: var(--ms-card-bg);
  border-radius: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  padding: 1.5rem;
}
.form-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.25rem; }

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.toggle-track {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #ccc;
  position: relative;
  cursor: pointer;
}
.toggle-track.on { background: var(--ms-primary); }
.toggle-track::after {
  content: '';
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: 0.2s;
}
.toggle-track.on::after { left: 22px; }

/* Document Grid */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.doc-card {
  background: var(--ms-card-bg);
  border-radius: 1rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
}
.doc-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.doc-card .doc-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.doc-card .doc-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.25rem; }
.doc-card .doc-meta { font-size: 0.8rem; color: var(--ms-muted); }

/* Balance Card */
.balance-hero {
  text-align: center;
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.balance-hero .balance-label { font-size: 0.875rem; color: var(--ms-muted); }
.balance-hero .balance-amount { font-size: 2.5rem; font-weight: 600; margin: 0.5rem 0; }
.balance-hero .balance-due { color: var(--ms-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.balance-hero .btn-pay {
  background: var(--ms-primary);
  color: white;
  border: none;
  padding: 0.75rem 2.5rem;
  border-radius: 0.475rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

/* Table Footer */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  font-size: 0.875rem;
  color: var(--ms-muted);
}

/* Summary Bar */
.summary-bar {
  display: flex;
  gap: 2rem;
  padding: 1rem 1.5rem;
  background: var(--ms-card-bg);
  border-radius: 0.475rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--ms-border);
}
.summary-bar .summary-item span { font-weight: 600; }

/* Breadcrumb */
.breadcrumb-nav {
  font-size: 0.875rem;
  color: var(--ms-muted);
  margin-bottom: 1rem;
}
.breadcrumb-nav a { color: var(--ms-primary); text-decoration: none; }
.breadcrumb-nav a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-layout { margin-left: 0; }
  .split-panel { grid-template-columns: 1fr; }
}

/* Comparison Page */
.comparison-table { width: 100%; }
.comparison-table th { background: var(--ms-primary); color: white; padding: 0.75rem 1rem; font-weight: 600; }
.comparison-table th:first-child { background: var(--ms-body-bg); color: var(--ms-body-text); }
.comparison-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--ms-border); }
.comparison-table tr:nth-child(even) td { background: var(--ms-body-bg); }
.comparison-table .legacy { color: #dc3545; }
.comparison-table .new { color: #28a745; font-weight: 500; }
