/* ============================================================
   SYHC Admin Dashboard — Shared Stylesheet
   ============================================================ */

:root {
  --sidebar-w:  240px;
  --sidebar-bg: #1a1f36;
  --sidebar-hover: rgba(255,255,255,.08);
  --sidebar-active: rgba(255,255,255,.14);
  --accent:  #4f6ef7;
  --bg:      #f4f6fb;
  --surface: #ffffff;
  --border:  #e2e8f0;
  --text:    #1e293b;
  --muted:   #64748b;
  --radius:  10px;
  --shadow:  0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .02em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 1.4rem; color: #7b96ff; }

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}
.sidebar-nav .nav-label {
  padding: 12px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  border-radius: 0;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-nav li a i { font-size: 1rem; width: 18px; text-align: center; }
.sidebar-nav li a:hover  { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav li a.active { background: var(--sidebar-active); color: #fff; border-right: 3px solid var(--accent); }

.sidebar-footer {
  padding: 14px 20px;
  font-size: 11px;
  color: rgba(255,255,255,.35);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ── Main area ────────────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  flex: 1;
  color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

.content { padding: 24px; flex: 1; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  font-size: 13.5px;
}
.card-body  { padding: 16px; }
.card-footer {
  background: transparent;
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 12px;
}

/* ── KPI Cards ────────────────────────────────────────────── */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.kpi-card.compact { padding: 14px 16px; }

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.kpi-icon.sm { width: 38px; height: 38px; font-size: 1rem; border-radius: 8px; }

.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.kpi-value.sm { font-size: 1.15rem; }
.kpi-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Tables ───────────────────────────────────────────────── */
.table { font-size: 13px; }
.table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  white-space: nowrap;
  padding: 10px 12px;
}
.table td { padding: 10px 12px; vertical-align: middle; border-color: var(--border); }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ── Badges ───────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }

/* ── Property cards ───────────────────────────────────────── */
.prop-card { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.prop-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.prop-img {
  height: 110px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ── Tenant avatar ────────────────────────────────────────── */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Detail groups ────────────────────────────────────────── */
.detail-group { margin-bottom: 10px; }
.detail-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-group p {
  font-size: 13.5px;
  color: var(--text);
  margin: 0;
}

/* ── Status rows (dashboard) ──────────────────────────────── */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.status-row:last-child { border-bottom: none; }

/* ── Reconciliation rows ──────────────────────────────────── */
.recon-row-matched           td:first-child { border-left: 3px solid #22c55e; }
.recon-row-partial           td:first-child { border-left: 3px solid #f59e0b; }
.recon-row-unmatched         td:first-child { border-left: 3px solid #ef4444; }
.recon-row-unmatched-candidate td:first-child { border-left: 3px solid #6366f1; }

/* ── QR code display ──────────────────────────────────────── */
.qr-img {
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  max-width: 200px;
}

/* ── Utility ──────────────────────────────────────────────── */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.hover-shadow { transition: box-shadow .15s; }
.hover-shadow:hover { box-shadow: var(--shadow-md); }

.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 5px;
}

/* ── Toast ────────────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast-item {
  background: #1e293b;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp .2s ease;
  max-width: 320px;
}
.toast-item.success { border-left: 4px solid #22c55e; }
.toast-item.danger  { border-left: 4px solid #ef4444; }
.toast-item.info    { border-left: 4px solid #6366f1; }
@keyframes slideUp { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:translateY(0); } }

/* ── Bill detail panel ────────────────────────────────────── */
.bill-panel { background: #fafafa; }

.panel-section {
  padding: 14px 16px;
}
.panel-section-title {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #64748b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.panel-label {
  font-size: .72rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 3px;
  display: block;
}
.panel-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0;
}

/* Detail-mode columns: hidden by default, visible when table has .detail-mode */
.detail-col { display: none; }
#lineTable.detail-mode .detail-col { display: table-cell; }

/* Line items table rows */
#lineItemsBody tr:hover { background: #f8fafc; }
#lineItemsBody td { vertical-align: middle; padding: 5px 6px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 991px) {
  :root { --sidebar-w: 0px; }
  #sidebar { transform: translateX(-240px); transition: transform .25s; width: 240px; }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
}
@media (max-width: 575px) {
  .content { padding: 16px; }
  .kpi-value { font-size: 1.2rem; }
}
