@charset "UTF-8";

/* =====================================================================
   Tenanta Programme Manager Portal — Core Styles
   ===================================================================== */

:root {
  --navy:        #6B5F9E;
  --navy-light:  #7D71B0;
  --blue:        #2563eb;
  --blue-hover:  #1d4ed8;
  --blue-light:  #eff6ff;
  --green:       #16a34a;
  --green-light: #f0fdf4;
  --amber:       #d97706;
  --amber-light: #fffbeb;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --grey-50:     #f9fafb;
  --grey-100:    #f3f4f6;
  --grey-200:    #e5e7eb;
  --grey-400:    #9ca3af;
  --grey-600:    #4b5563;
  --grey-800:    #1f2937;
  --white:       #ffffff;
  --sidebar-w:   240px;
  --header-h:    64px;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: var(--grey-800);
  background: var(--grey-50);
  line-height: 1.5;
}

/* ── Login Page ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('/pm/images/login-bg.jpg');
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  /* Sky-blue fallback while image loads */
  background-color: #c9dff0;
}

.login-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(80, 60, 130, 0.18), 0 2px 8px rgba(0,0,0,0.10);
  border: 1px solid rgba(255,255,255,0.7);
  /* Push card up slightly so the houses are visible below */
  margin-bottom: 60px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo-img {
  max-width: 200px;
  height: auto;
}

.login-logo .brand-mark {
  width: 40px;
  height: 40px;
  background: var(--blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
}

.login-logo .brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.login-logo .brand-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--blue-light);
  color: var(--blue);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .5px;
}

.login-title {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--grey-600);
  margin-bottom: 24px;
}

/* Login page — Sign In button colour */
.login-page .btn-primary {
  background: #7B77A8;
}
.login-page .btn-primary:hover:not(:disabled) {
  background: #6A6696;
  box-shadow: 0 4px 14px rgba(123, 119, 168, 0.35);
}

/* ── Portal Layout ─────────────────────────────────────────── */
.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-header .logo-img {
  height: 32px;
  width: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--white);
}

.sidebar-header .logo-fallback {
  height: 32px;
  width: 32px;
  background: var(--blue);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}

.sidebar-header .brand {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 4px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,.1);
  color: var(--white);
}

.nav-item.active {
  background: var(--blue);
  color: var(--white);
}

.nav-item svg { flex-shrink: 0; opacity: .85; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.pm-profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.07);
}

.pm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.pm-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-role {
  font-size: 11px;
  color: rgba(255,255,255,.5);
}

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

/* Top bar */
.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--green-light);
  color: var(--green);
}

/* Page content */
.page-content {
  padding: 28px;
  flex: 1;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--grey-200);
  box-shadow: var(--shadow);
}

.card-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--grey-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
}

.card-subtitle {
  font-size: 12px;
  color: var(--grey-400);
  margin-top: 2px;
}

.card-body {
  padding: 20px;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--blue);
}

.stat-card.green::before { background: var(--green); }
.stat-card.amber::before { background: var(--amber); }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--grey-400);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stat-value.currency::before { content: '\00a3'; font-size: 16px; vertical-align: super; }

.stat-meta {
  font-size: 12px;
  color: var(--grey-400);
  margin-top: 6px;
}

.stat-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .07;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: var(--grey-50);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--grey-600);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--grey-200);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--grey-100);
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--grey-50); }

tbody td {
  padding: 12px 14px;
  color: var(--grey-800);
  vertical-align: middle;
}

.td-muted { color: var(--grey-400); font-size: 12px; }

/* ── Status Badges ─────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-active    { background: var(--green-light);  color: var(--green); }
.status-pending   { background: var(--amber-light);  color: var(--amber); }
.status-inactive  { background: var(--grey-100);     color: var(--grey-400); }
.status-terminated { background: var(--red-light);   color: var(--red); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-800);
  margin-bottom: 6px;
}

.form-label .required { color: var(--red); margin-left: 3px; }

.form-input,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  font-size: 14px;
  color: var(--grey-800);
  background: var(--white);
  outline: none;
  transition: border .15s, box-shadow .15s;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.form-input[readonly] {
  background: var(--grey-50);
  cursor: default;
  color: var(--grey-600);
}

/* ── Markup Row ────────────────────────────────────────────── */
.markup-row {
  display: grid;
  grid-template-columns: 1fr 160px 160px;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--grey-100);
}

.markup-row:last-of-type { border-bottom: none; }

.markup-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.markup-label .desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--grey-400);
  display: block;
  margin-top: 2px;
}

.markup-input-wrap {
  position: relative;
}

.markup-input {
  width: 100%;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  text-align: right;
}

.markup-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  outline: none;
}

.markup-input:disabled {
  background: var(--grey-50);
  color: var(--grey-400);
}

.markup-unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-400);
  pointer-events: none;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--blue);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-hover);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: var(--white);
  color: var(--grey-600);
  border: 1px solid var(--grey-200);
}

.btn-outline:hover:not(:disabled) { background: var(--grey-50); }

.btn-danger {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #fca5a5;
}

.btn-danger:hover:not(:disabled) { background: #fee2e2; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

.alert-error   { background: var(--red-light);   color: var(--red);   border: 1px solid #fca5a5; }
.alert-success { background: var(--green-light);  color: var(--green); border: 1px solid #86efac; }
.alert-info    { background: var(--blue-light);   color: var(--blue);  border: 1px solid #93c5fd; }

/* ── Logo Upload ───────────────────────────────────────────── */
.logo-upload-zone {
  border: 2px dashed var(--grey-200);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border .15s, background .15s;
}

.logo-upload-zone:hover,
.logo-upload-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}

.logo-preview {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--grey-200);
  margin: 0 auto 12px;
  display: block;
}

.logo-placeholder {
  width: 80px;
  height: 80px;
  background: var(--grey-100);
  border-radius: 8px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--grey-400);
}

.logo-hint {
  font-size: 12px;
  color: var(--grey-400);
  margin-top: 6px;
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--grey-100);
  margin: 20px 0;
}

/* ── Loader ─────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

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

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--grey-400);
  gap: 10px;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--grey-400);
}

.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; font-weight: 500; }
.empty-state-sub  { font-size: 12px; margin-top: 4px; }

/* ── Topbar logout button ──────────────────────────────────── */
.btn-logout {
  background: none;
  border: 1px solid var(--grey-200);
  color: var(--grey-600);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
}

.btn-logout:hover { background: var(--grey-50); }

/* ── Markup action bar ───────────────────────────────────────── */
.markup-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 18px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .markup-row { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

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