/* =========================================================
   Jade Properties Group — Ops Portal Brand System
   ========================================================= */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Playfair+Display:wght@500;600;700&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Brand palette */
  --jade:          #1A3C34;
  --jade-light:    #245046;
  --jade-dark:     #122A24;
  --brass:         #C9A96E;
  --brass-light:   #D4BC8E;
  --brass-dark:    #B08C4A;
  --slate:         #3B3F45;
  --warm-white:    #FAF8F5;
  --off-white:     #F3F0EB;

  /* Semantic */
  --success:       #2D8659;
  --success-bg:    #E8F5EE;
  --warning:       #D4940A;
  --warning-bg:    #FFF8E6;
  --danger:        #C0392B;
  --danger-bg:     #FDECEB;
  --info:          #2980B9;
  --info-bg:       #EBF5FB;

  /* Neutrals */
  --gray-50:       #FAFAF9;
  --gray-100:      #F5F4F2;
  --gray-200:      #E8E6E3;
  --gray-300:      #D5D3CF;
  --gray-400:      #A8A5A0;
  --gray-500:      #7A7772;
  --gray-600:      #5A5753;
  --gray-700:      #3D3B38;
  --gray-800:      #262523;
  --gray-900:      #1A1918;

  /* Typography */
  --font-heading:  'Playfair Display', Georgia, serif;
  --font-body:     'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(26, 60, 52, 0.08);
  --shadow-md:     0 4px 12px rgba(26, 60, 52, 0.10);
  --shadow-lg:     0 8px 30px rgba(26, 60, 52, 0.12);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--slate);
  background: var(--warm-white);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--jade);
  line-height: 1.25;
  font-weight: 600;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

a { color: var(--brass-dark); text-decoration: none; }
a:hover { color: var(--brass); text-decoration: underline; }

/* --- App Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--jade-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand .brand-icon {
  width: 38px;
  height: 38px;
  background: var(--brass);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--jade-dark);
}

.sidebar-brand h1 {
  font-size: 1rem;
  color: #fff;
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
}

.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--brass-light);
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 1px;
}

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

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

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  padding: 8px 12px 6px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  text-decoration: none;
}

.nav-link.active {
  background: rgba(201, 169, 110, 0.15);
  color: var(--brass-light);
}

.nav-link .nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-link.active .nav-icon { opacity: 1; }

.nav-link .nav-badge {
  margin-left: auto;
  background: var(--brass);
  color: var(--jade-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.page-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header h1 {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.page-body {
  padding: 28px 32px 48px;
}

/* --- Cards --- */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 1rem;
}

.card-body {
  padding: 20px;
}

/* --- Summary Cards (Dashboard) --- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.summary-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.summary-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.summary-card .card-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-card .card-icon.jade    { background: rgba(26,60,52,0.1); color: var(--jade); }
.summary-card .card-icon.brass   { background: rgba(201,169,110,0.15); color: var(--brass-dark); }
.summary-card .card-icon.success { background: var(--success-bg); color: var(--success); }
.summary-card .card-icon.warning { background: var(--warning-bg); color: var(--warning); }
.summary-card .card-icon.danger  { background: var(--danger-bg); color: var(--danger); }
.summary-card .card-icon.info    { background: var(--info-bg); color: var(--info); }

.summary-card .card-icon svg { width: 22px; height: 22px; }

.summary-card .card-info { flex: 1; }

.summary-card .card-label {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card .card-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--jade);
  line-height: 1.2;
  margin-top: 2px;
}

.summary-card .card-detail {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 4px;
}

/* --- Data Tables --- */
.data-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.data-table thead th {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

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

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-jade      { background: rgba(26,60,52,0.1); color: var(--jade); }
.badge-brass     { background: rgba(201,169,110,0.15); color: var(--brass-dark); }
.badge-success   { background: var(--success-bg); color: var(--success); }
.badge-warning   { background: var(--warning-bg); color: var(--warning); }
.badge-danger    { background: var(--danger-bg); color: var(--danger); }
.badge-info      { background: var(--info-bg); color: var(--info); }
.badge-neutral   { background: var(--gray-100); color: var(--gray-600); }

/* --- Status Dots --- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.green  { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.red    { background: var(--danger); }
.status-dot.blue   { background: var(--info); }
.status-dot.gray   { background: var(--gray-400); }

/* --- Priority Indicators --- */
.priority-pip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
}

.priority-pip .pip {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.priority-pip.emergency .pip { background: var(--danger); }
.priority-pip.high .pip      { background: #E67E22; }
.priority-pip.medium .pip    { background: var(--warning); }
.priority-pip.low .pip       { background: var(--info); }

/* --- Progress Bars --- */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.progress-fill.jade  { background: var(--jade); }
.progress-fill.brass { background: var(--brass); }
.progress-fill.success { background: var(--success); }

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 6px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-jade {
  background: var(--jade);
  color: #fff;
}
.btn-jade:hover { background: var(--jade-light); color: #fff; text-decoration: none; }

.btn-brass {
  background: var(--brass);
  color: var(--jade-dark);
}
.btn-brass:hover { background: var(--brass-light); color: var(--jade-dark); text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--jade);
  border: 1.5px solid var(--gray-300);
}
.btn-outline:hover { border-color: var(--jade); background: var(--gray-50); text-decoration: none; }

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

/* --- Filters Bar --- */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--jade);
  color: var(--jade);
}

.filter-btn.active {
  background: var(--jade);
  color: #fff;
  border-color: var(--jade);
}

/* --- Loading / Empty / Error States --- */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-400);
  font-size: 0.9rem;
}

.loading-spinner::before {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--jade);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 14px;
}

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.error-state {
  text-align: center;
  padding: 40px 20px;
  background: var(--danger-bg);
  border-radius: var(--radius-md);
  color: var(--danger);
}

/* --- Activity Feed --- */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brass);
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 0.88rem;
  color: var(--slate);
}

.activity-meta {
  font-size: 0.78rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* --- Phase Groups (Build Plan) --- */
.phase-group {
  margin-bottom: 28px;
}

.phase-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.phase-header h3 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.phase-stats {
  font-size: 0.82rem;
  color: var(--gray-500);
}

/* --- Quick Links Grid --- */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  color: var(--slate);
  font-weight: 500;
  font-size: 0.88rem;
  transition: all 0.15s;
  text-decoration: none;
}

.quick-link:hover {
  border-color: var(--jade);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--jade);
}

.quick-link svg {
  width: 18px;
  height: 18px;
  color: var(--brass);
  flex-shrink: 0;
}

/* --- Mobile Hamburger --- */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--jade);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle {
    display: flex;
  }
  .mobile-overlay.open {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
  .page-header {
    padding: 16px 20px;
    padding-left: 64px;
  }
  .page-body {
    padding: 20px 16px 40px;
  }
  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .filters-bar {
    gap: 6px;
  }
  .data-table {
    font-size: 0.82rem;
  }
  .data-table thead th,
  .data-table tbody td {
    padding: 10px 10px;
  }
}

/* --- Utility --- */
.text-jade   { color: var(--jade); }
.text-brass  { color: var(--brass-dark); }
.text-muted  { color: var(--gray-500); }
.text-sm     { font-size: 0.82rem; }
.text-xs     { font-size: 0.75rem; }
.fw-600      { font-weight: 600; }
.mt-0        { margin-top: 0; }
.mt-1        { margin-top: 8px; }
.mt-2        { margin-top: 16px; }
.mt-3        { margin-top: 24px; }
.mb-0        { margin-bottom: 0; }
.mb-1        { margin-bottom: 8px; }
.mb-2        { margin-bottom: 16px; }
.mb-3        { margin-bottom: 24px; }
.gap-2       { gap: 16px; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

/* --- Scrollbar Styling --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
