/* ==========================================================================
   Valdon Site Control 360 - Design System
   Construction Project Management Platform
   Navy enterprise: navy blue primary, flat solid colors (no gradients),
   sharp corners, light surface shell with soft tinted badges
   ========================================================================== */

/* ----------------------------- Fonts ----------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* ----------------------------- Tokens ----------------------------- */
:root {
  /* Palette (navy enterprise) */
  --color-primary: #1e3a8a;
  --color-primary-hover: #17296b;
  --color-primary-soft: #e8edf9;
  --color-navy-950: #0f1b3d;
  --color-navy-900: #12233f;
  --color-navy-800: #16305f;
  --color-navy-700: #1e3a8a;
  --color-surface: #ffffff;
  --color-background: #f4f6fb;
  --color-outline: #e3e7f0;
  --color-outline-strong: #c9d2e4;
  --color-border: #e3e7f0;
  --color-on-surface: #10182b;
  --color-on-surface-variant: #46536e;
  --color-muted: #8b96ab;

  --color-success: #22c55e;
  --color-success-text: #16a34a;
  --color-warning: #f59e0b;
  --color-warning-text: #d97706;
  --color-error: #ef4444;
  --color-error-text: #dc2626;
  --color-info: #3b82f6;

  /* Container tones (derived from the navy palette) */
  --color-primary-container: #e8edf9;
  --color-primary-variant: #b9c7e8;
  --color-surface-container: #f6f8fc;
  --color-surface-container-high: #eef2fa;
  --color-success-container: #d9f5e3;
  --color-error-container: #fdeaea;
  --color-danger: #dc2626;

  /* Shape / shadow (sharp corners) */
  --radius-sm: 0;
  --radius: 0;
  --radius-lg: 0;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 10px 30px rgba(16, 24, 40, 0.1);

  /* Layout */
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 72px;
  --topbar-height: 64px;
  --content-pad: 28px;

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.90625rem;
  --text-md: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.5rem;
}

/* ----------------------------- Reset ----------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--color-background);
  color: var(--color-on-surface);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-hover);
}

button {
  font-family: inherit;
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

/* ----------------------------- Material Symbols ----------------------------- */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  display: inline-block;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.icon-filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-success,
.btn-ghost,
.btn-approve,
.btn-reject {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-danger:active,
.btn-success:active,
.btn-ghost:active,
.btn-approve:active,
.btn-reject:active {
  transform: translateY(1px);
}

.btn .material-symbols-outlined,
.btn-primary .material-symbols-outlined,
.btn-secondary .material-symbols-outlined,
.btn-danger .material-symbols-outlined,
.btn-success .material-symbols-outlined {
  font-size: 17px;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-on-surface);
  border-color: var(--color-outline-strong);
}

.btn-secondary:hover {
  background: #f3f5fa;
  color: var(--color-on-surface);
  border-color: #b9c3d8;
}

.btn-danger {
  background: var(--color-error);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--color-error-text);
  color: #ffffff;
}

.btn-success {
  background: var(--color-success-text);
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-on-surface-variant);
  border-color: transparent;
}

.btn-ghost:hover {
  background: #eef1f6;
  color: var(--color-on-surface);
}

.btn-approve {
  background: var(--color-success-text);
  color: #ffffff;
  height: 30px;
  padding: 0 12px;
  font-size: var(--text-xs);
}

.btn-approve:hover {
  background: #15803d;
  color: #ffffff;
}

.btn-reject {
  background: var(--color-surface);
  color: var(--color-error-text);
  border-color: #f3b5b1;
  height: 30px;
  padding: 0 12px;
  font-size: var(--text-xs);
}

.btn-reject:hover {
  background: var(--color-error);
  border-color: var(--color-error);
  color: #ffffff;
}

.btn-small {
  height: 32px;
  padding: 0 12px;
  font-size: var(--text-xs);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-outline);
  background: var(--color-surface);
  color: var(--color-on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

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

.btn-icon .material-symbols-outlined {
  font-size: 18px;
}

.btn-block {
  display: flex;
  width: 100%;
}

/* ==========================================================================
   Status badges (soft tinted pills -> sharp)
   ========================================================================== */
.status-badge,
.report-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  line-height: 1.4;
  white-space: nowrap;
}

.status-inactive {
  color: #6b7280;
  background: #eef0f4;
}

.status-pending,
.status-planning {
  color: var(--color-primary);
  background: #e4ebfa;
}

.status-active {
  color: #15803d;
  background: #e7f6ee;
}

.status-hold {
  color: #b45309;
  background: #fef3e2;
}

.status-rejected {
  color: #b91c1c;
  background: #fdecec;
}

.status-completed {
  color: #166534;
  background: #dff3e9;
}

.status-archived {
  color: #4b5563;
  background: #e9ebef;
}

.badge-gray {
  color: #6b7280;
  background: #eef0f4;
}

.badge-blue {
  color: var(--color-primary);
  background: #e4ebfa;
}

.badge-green {
  color: #15803d;
  background: #e7f6ee;
}

.badge-orange {
  color: #b45309;
  background: #fef3e2;
}

.badge-red {
  color: #b91c1c;
  background: #fdecec;
}

.badge-dark-green {
  color: #166534;
  background: #dff3e9;
}

.badge-dark {
  color: #374151;
  background: #e9ebef;
}

/* Report status variants */
.report-status.pending,
.report-status.awaiting-review {
  color: var(--color-primary);
  background: #e4ebfa;
}

.report-status.approved {
  color: #15803d;
  background: #e7f6ee;
}

.report-status.rejected {
  color: #b91c1c;
  background: #fdecec;
}

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

/* ----------------------------- Sidebar (navy) ----------------------------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-navy-950);
  color: #b6c5e8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: width 0.16s ease, min-width 0.16s ease, transform 0.2s ease;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: var(--color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.brand-logo {
  height: 80px;
  width: auto;
  min-width: 0;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.brand-name {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #ffffff;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: #7d8bb5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  color: #b6c5e8;
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-link .material-symbols-outlined {
  font-size: 19px;
  width: 22px;
  text-align: center;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.nav-link.active {
  background: var(--color-primary);
  color: #ffffff;
}

.nav-link.active:hover {
  color: #ffffff;
}

.sidebar-nav .tab-button {
  width: 100%;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-group-title {
  padding: 16px 13px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-collapse {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: none;
  background: transparent;
  color: #b6c5e8;
  font-size: var(--text-sm);
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: left;
}

.sidebar-collapse:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.logout-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: none;
  background: transparent;
  color: #fda4af;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-align: left;
}

.logout-button:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ffb3bb;
}

.logout-button .material-symbols-outlined {
  font-size: 19px;
  width: 22px;
  text-align: center;
}

/* Mobile drawer close control (hidden on desktop; shown at <=860px).
   Injected into .sidebar-brand by js/ui.js. */
.sidebar-close {
  display: none;
}

/* Mobile drawer backdrop (injected by js/ui.js; hidden unless the drawer is open) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 61, 0.45);
  z-index: 29;
}

/* Sidebar collapsed */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .collapse-label,
.sidebar.collapsed .logout-label {
  display: none;
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-user,
.sidebar.collapsed .nav-link,
.sidebar.collapsed .sidebar-collapse,
.sidebar.collapsed .logout-button {
  justify-content: center;
}

.sidebar.collapsed .sidebar-brand {
  padding: 0 10px;
}

.sidebar.collapsed .brand-logo {
  height: 26px;
}

.sidebar.collapsed .sidebar-user {
  padding: 14px 8px;
}

/* ----------------------------- Main area ----------------------------- */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left 0.16s ease;
}

.app.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed-width);
}

/* Pages without a sidebar (project picker dashboards) */
.app.no-sidebar .main {
  margin-left: 0;
}

/* ----------------------------- Topbar ----------------------------- */
.topbar {
  height: var(--topbar-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-outline);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--color-on-surface-variant);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.menu-toggle:hover {
  background: #f3f5fa;
}

.topbar-greeting {
  min-width: 0;
}

.topbar-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-navy-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-subtitle {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----------------------------- Project switcher ----------------------------- */
.project-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--color-outline);
  background: var(--color-surface);
}

.project-switcher-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-on-surface-variant);
}

.project-switcher {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
  cursor: pointer;
  max-width: 220px;
}

.project-switcher:focus {
  outline: none;
}

/* ----------------------------- Notification bell ----------------------------- */
.notification-bell {
  position: relative;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--color-on-surface-variant);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.notification-bell:hover {
  background: #f3f5fa;
  color: var(--color-on-surface);
}

.notification-bell .material-symbols-outlined {
  font-size: 21px;
}

.bell-badge {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--color-error);
  color: #ffffff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.topbar-date {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  white-space: nowrap;
  background: #f3f5fa;
  padding: 6px 12px;
}

/* ----------------------------- User menu ----------------------------- */
.user-menu {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-on-surface);
}

.user-menu-btn:hover {
  background: #f3f5fa;
}

.user-menu-btn .user-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 0.75rem;
}

.user-menu-name {
  font-size: var(--text-sm);
  font-weight: 600;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-btn .material-symbols-outlined {
  font-size: 17px;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 50;
  overflow: hidden;
}

.user-dropdown-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-outline);
  background: #fafbfd;
}

.user-dropdown-name {
  font-size: var(--text-sm);
  font-weight: 600;
}

.user-dropdown-email {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  word-break: break-all;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  color: var(--color-on-surface);
}

.user-dropdown-item:hover {
  background: #f3f5fa;
}

.user-dropdown-item.danger {
  color: var(--color-error-text);
}

.user-dropdown-item.danger:hover {
  background: #fdecec;
}

/* ----------------------------- Content area ----------------------------- */
.content {
  padding: var(--content-pad);
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* ----------------------------- Page headings + breadcrumbs ----------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-navy-800);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  margin-bottom: 10px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: #c3cbd9;
  font-weight: 400;
}

.breadcrumb-item a {
  color: var(--color-muted);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: var(--color-primary);
}

.breadcrumb-item.active {
  color: var(--color-primary);
  font-weight: 600;
}

/* Detail (project workspace) head */
.detail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.detail-head .page-title {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.detail-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-surface-variant);
  margin-right: 8px;
}

.back-link:hover {
  color: var(--color-primary);
}

/* ----------------------------- Banners ----------------------------- */
.error-banner,
.notice-banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin-bottom: 20px;
}

.error-banner {
  background: #fdecec;
  border: 1px solid #f6c6c2;
  color: var(--color-error-text);
}

.notice-banner {
  background: var(--color-primary-soft);
  border: 1px solid #c6d3f0;
  color: var(--color-primary-hover);
}

/* ----------------------------- Loading overlay ----------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 246, 251, 0.85);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--color-outline);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ----------------------------- Current project hero ----------------------------- */
.current-project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.current-project-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.current-project-info {
  min-width: 0;
}

.current-project-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.current-project-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-navy-800);
}

.current-project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

.current-project-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.current-project-meta strong {
  color: var(--color-on-surface);
  font-weight: 600;
}

.current-project-meta .material-symbols-outlined {
  font-size: 16px;
  color: var(--color-muted);
}

.current-project-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.current-project-description {
  margin-top: 14px;
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  border-top: 1px solid var(--color-outline);
  padding-top: 14px;
}

.current-project-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-outline);
}

/* ----------------------------- Progress bars ----------------------------- */
.project-progress {
  margin-top: 12px;
  max-width: 420px;
}

.progress-bar {
  height: 8px;
  background: #eef0f3;
  overflow: hidden;
  position: relative;
}

.progress-bar.large {
  height: 14px;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

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

.progress-fill.fill-neutral {
  background: #9aa1ab;
}

/* Progress styles generated by js/ui.js */
.project-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-progress-track {
  height: 8px;
  background: #eef0f3;
  overflow: hidden;
  flex: 1;
}

.project-progress-fill {
  height: 100%;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.project-progress-fill.fill-success {
  background: var(--color-success);
}

.project-progress-fill.fill-neutral {
  background: #9aa1ab;
}

/* ----------------------------- Health indicator ----------------------------- */
.health-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-surface-variant);
}

.health-indicator::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
}

.health-indicator.good::before,
.health-indicator.health-good::before {
  background: var(--color-success);
}

.health-indicator.warning::before,
.health-indicator.health-risk::before {
  background: var(--color-warning);
}

.health-indicator.critical::before,
.health-indicator.health-bad::before {
  background: var(--color-error);
}

.health-indicator.neutral::before,
.health-indicator.health-neutral::before {
  background: #9ca3af;
}

/* ----------------------------- Stats grid (KPI cards) ----------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stats-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.stats-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.stats-grid.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.stat-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stat-icon .material-symbols-outlined {
  font-size: 22px;
}

.stat-value {
  font-size: 2.1rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--color-on-surface);
  line-height: 1.1;
}

.stat-secondary {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
}

/* Solid navy KPI cards (one flat color, no gradient ramp) */
.stats-grid .stat-card:nth-child(n) {
  background: var(--color-primary);
  border-color: transparent;
}

.stats-grid .stat-card:nth-child(n) .stat-label,
.stats-grid .stat-card:nth-child(n) .stat-value,
.stats-grid .stat-card:nth-child(n) .stat-secondary {
  color: #ffffff;
}

.stats-grid .stat-card:nth-child(n) .stat-icon {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* ----------------------------- Panels ----------------------------- */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-outline);
  background: #fbfcfe;
}

.panel-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-navy-800);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-title .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-primary);
}

.panel-body {
  padding: 24px;
}

.panel-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.panel-grid .span-5 {
  grid-column: span 5;
}

.panel-grid .span-7 {
  grid-column: span 7;
}

@media (max-width: 992px) {
  .panel-grid .span-5,
  .panel-grid .span-7 {
    grid-column: span 12;
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

/* ----------------------------- Project cards ----------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.project-card.is-current {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.project-card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-navy-800);
}

.project-card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

.project-card-row .material-symbols-outlined {
  font-size: 16px;
  color: var(--color-muted);
}

.project-card-last {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
}

.project-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--color-outline);
}

.project-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.project-card-actions .btn-primary,
.project-card-actions .btn-secondary {
  height: 32px;
  padding: 0 12px;
  font-size: var(--text-xs);
}

/* Project overview block (progress / health / end) */
.project-overview-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-overview-label {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
}

.project-overview-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.project-overview-health {
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.project-overview-end {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

/* ----------------------------- Tabs ----------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--color-outline);
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-button {
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-surface-variant);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tab-button:hover {
  color: var(--color-on-surface);
}

.tab-button.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* ----------------------------- Filter tabs (gallery) ----------------------------- */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.filter-button {
  padding: 7px 12px;
  border: 1px solid var(--color-outline-strong);
  background: var(--color-surface);
  color: var(--color-on-surface-variant);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.filter-button:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.filter-button.active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}

/* Small pill filter skin used inside panel heads */
.btn-small-skin {
  height: 30px;
  padding: 0 10px;
  font-size: var(--text-xs);
}

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

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

.data-table thead th {
  background: #f8fafd;
  color: var(--color-on-surface-variant);
  text-align: left;
  padding: 13px 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-outline);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-outline);
  vertical-align: middle;
}

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

.data-table tbody tr:hover td {
  background: #f5f8ff;
}

/* ----------------------------- Forms ----------------------------- */
.form-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  max-width: 640px;
}

.form-section-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-navy-800);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-outline);
}

.form-field {
  margin-bottom: 18px;
}

.form-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-surface);
  margin-bottom: 6px;
}

.form-field .required {
  color: var(--color-error-text);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-outline-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field textarea {
  resize: vertical;
  min-height: 90px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  margin-top: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

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

/* Input with icon (auth) */
.input-with-icon {
  position: relative;
}

.input-with-icon .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 19px;
  color: var(--color-muted);
  pointer-events: none;
}

.input-with-icon input {
  width: 100%;
  padding: 11px 12px 11px 40px;
  border: 1px solid var(--color-outline-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-with-icon input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

/* ----------------------------- Messages ----------------------------- */
.message {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  margin-bottom: 14px;
}

.message.error {
  background: #fdecec;
  border: 1px solid #f6c6c2;
  color: var(--color-error-text);
}

.message.success {
  background: #e7f6ee;
  border: 1px solid #b8e6cd;
  color: #15803d;
}

.message.info {
  background: var(--color-primary-soft);
  border: 1px solid #c6d3f0;
  color: var(--color-primary-hover);
}

/* ----------------------------- Placeholder / empty states ----------------------------- */
.placeholder-text {
  color: var(--color-on-surface-variant);
  font-size: var(--text-sm);
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed var(--color-outline-strong);
  border-radius: var(--radius);
  background: #fbfcfe;
}

/* ----------------------------- Detail rows ----------------------------- */
.details-body {
  display: flex;
  flex-direction: column;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-outline);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row.full {
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  width: 180px;
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-on-surface-variant);
  padding-top: 2px;
}

.detail-row.full .detail-label {
  width: auto;
}

.detail-value {
  font-size: var(--text-sm);
  color: var(--color-on-surface);
}

/* ----------------------------- Timeline ----------------------------- */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--color-outline);
}

.timeline-item {
  position: relative;
  padding: 0 0 18px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 4px;
  width: 12px;
  height: 12px;
  margin-left: 1px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-outline-strong);
}

.timeline-item.done::before {
  background: var(--color-success);
  border-color: var(--color-success);
}

.timeline-item.active::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.timeline-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.timeline-item.active .timeline-label {
  color: var(--color-primary);
}

.timeline-date {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  margin-top: 2px;
}

.timeline-content {
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  margin-top: 6px;
  background: #f8fafd;
  border-left: 3px solid var(--color-primary);
  padding: 10px 12px;
}

/* ----------------------------- Activity list ----------------------------- */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-outline);
}

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

.activity-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.activity-icon .material-symbols-outlined {
  font-size: 18px;
}

.activity-text {
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  flex: 1;
}

.activity-date {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  white-space: nowrap;
}

/* ----------------------------- Notifications ----------------------------- */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-outline);
}

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

.notification-item.unread {
  background: var(--color-primary-soft);
  margin: 0 -10px;
  padding: 14px 10px;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.notification-message {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  margin-top: 2px;
}

.notification-date {
  font-size: var(--text-xs);
  color: var(--color-muted);
  white-space: nowrap;
}

.notification-actions {
  margin-left: 8px;
}

/* ----------------------------- Gallery (project workspace) ----------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.gallery-item {
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.gallery-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.gallery-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  padding: 8px 10px;
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  overflow-wrap: anywhere;
}

/* ----------------------------- Photos (dashboard) ----------------------------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.photo-item {
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.photo-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.photo-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.photo-caption {
  padding: 8px 10px;
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------- Reports ----------------------------- */
.reports-list,
.report-item {
  display: flex;
  flex-direction: column;
}

.report-card,
.report-item {
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 16px;
  margin-bottom: 14px;
  transition: box-shadow 0.15s ease;
}

.report-card:hover,
.report-item:hover {
  box-shadow: var(--shadow-sm);
}

.report-card:last-child,
.report-item:last-child {
  margin-bottom: 0;
}

.report-card-head,
.report-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.report-card-title,
.report-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.report-meta,
.report-detail {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  margin-top: 3px;
}

.report-comments {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f8fafd;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-on-surface);
}

.report-comments.approved {
  background: #e7f6ee;
  border-color: #b8e6cd;
}

.report-comments.rejected {
  background: #fdecec;
  border-color: #f6c6c2;
}

/* ----------------------------- Documents ----------------------------- */
.documents-list {
  display: flex;
  flex-direction: column;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-outline);
}

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

.document-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.document-icon .material-symbols-outlined {
  font-size: 18px;
}

.document-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-surface);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-size {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
}

.document-actions {
  display: flex;
  gap: 8px;
}

/* ----------------------------- Upload ----------------------------- */
.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  border: 1.5px dashed var(--color-outline-strong);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--color-on-surface-variant);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.upload-dropzone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.upload-dropzone .material-symbols-outlined {
  font-size: 30px;
}

.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.upload-preview {
  position: relative;
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  overflow: hidden;
}

.upload-preview-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.upload-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(17, 24, 39, 0.7);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.upload-preview-remove .material-symbols-outlined {
  font-size: 14px;
}

.upload-preview-input {
  display: none;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.upload-progress .progress-bar {
  flex: 1;
}

.upload-progress-text {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  min-width: 48px;
  text-align: right;
}

.upload-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* ----------------------------- Agent list (assign modal) ----------------------------- */
.agent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.agent-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-outline);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.agent-option:hover {
  background: #f8fafd;
}

.agent-option.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.agent-option-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-surface);
}

.agent-option-email {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
}

/* ----------------------------- Profile ----------------------------- */
.profile-body {
  display: flex;
  flex-direction: column;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-outline);
}

.profile-row:last-child {
  border-bottom: none;
}

.profile-label {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

.profile-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.profile-actions {
  margin-top: 20px;
}

/* ----------------------------- Row actions (admin tables) ----------------------------- */
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions .btn-small,
.row-actions .btn-approve,
.row-actions .btn-reject,
.row-actions .btn-icon {
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

/* ----------------------------- Modals ----------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 61, 0.55);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(15, 27, 61, 0.25);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-photo {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-outline);
  background: #fbfcfe;
}

.modal-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-on-surface);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--color-on-surface-variant);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #f3f5fa;
  color: var(--color-on-surface);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--color-outline);
  flex-wrap: wrap;
}

.photo-preview-image {
  width: 100%;
  border-radius: var(--radius);
}

.photo-preview-caption {
  margin-top: 10px;
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
}

/* ----------------------------- App footer ----------------------------- */
.app-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-outline);
  padding: 14px 28px;
}

.app-footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ----------------------------- Responsive ----------------------------- */
@media (max-width: 1200px) {
  .stats-grid.cols-3,
  .stats-grid.cols-4,
  .stats-grid.cols-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .main {
    margin-left: 0;
  }

  .app.sidebar-collapsed .main {
    margin-left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .sidebar.collapsed {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
  }

  .sidebar.collapsed .brand-name,
  .sidebar.collapsed .sidebar-user-info,
  .sidebar.collapsed .nav-group-title,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .collapse-label,
  .sidebar.collapsed .logout-label {
    display: inline;
  }

  .sidebar.collapsed .sidebar-brand,
  .sidebar.collapsed .sidebar-user,
  .sidebar.collapsed .nav-link,
  .sidebar.collapsed .sidebar-collapse,
  .sidebar.collapsed .logout-button {
    justify-content: flex-start;
  }

  .menu-toggle {
    display: inline-flex;
  }

  /* Mobile drawer: close control inside the brand row */
  .sidebar-brand {
    position: relative;
    padding-right: 48px;
  }

  .sidebar-close {
    display: inline-flex;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #b6c5e8;
    cursor: pointer;
  }

  .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
  }

  /* Prevent the page from scrolling underneath the open drawer.
     Both html and body are locked (not just body): on iOS Safari an
     overflow rule on body alone is propagated to the viewport and can
     clamp the page scroll position after the drawer closes. */
  html.drawer-locked,
  body.drawer-locked {
    overflow: hidden;
  }

  /* Topbar: let the project switcher flex instead of overflowing */
  .topbar-greeting {
    flex: 1;
    min-width: 0;
  }

  .topbar-project {
    flex: 1;
    min-width: 0;
  }

  .topbar .topbar-project .project-picker-trigger {
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  .topbar .topbar-project .filter-select {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 20px 16px;
  }

  .topbar {
    padding: 0 12px;
    gap: 10px;
  }

  .topbar-date {
    display: none;
  }

  .topbar-project-label {
    display: none;
  }

  .user-menu-name {
    display: none;
  }

  .user-menu-btn {
    padding: 4px;
  }

  .app-footer {
    padding: 14px 16px;
  }

  .stats-grid,
  .stats-grid.cols-3,
  .stats-grid.cols-4,
  .stats-grid.cols-5 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .current-project-main {
    flex-direction: column;
  }

  .current-project-foot {
    gap: 14px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-head-actions,
  .detail-head-actions {
    flex-wrap: wrap;
  }

  .detail-head-actions {
    margin-left: 0;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid,
  .photo-grid {
    grid-template-columns: 1fr 1fr;
  }

  .rail-photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-tabs {
    margin-left: 0;
  }
}

/* Extra-compact phones (<=480px): full-width actions, larger touch targets */
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .detail-row {
    flex-direction: column;
    gap: 4px;
  }

  .detail-label {
    width: auto;
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal {
    max-height: calc(100vh - 24px);
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-actions {
    padding: 12px 16px;
  }

  .modal-actions .btn,
  .modal-actions .btn-primary,
  .modal-actions .btn-secondary,
  .modal-actions .btn-danger {
    flex: 1 1 auto;
  }

  .form-actions .btn,
  .form-actions .btn-primary,
  .form-actions .btn-secondary,
  .form-actions .btn-danger {
    flex: 1 1 auto;
  }

  .form-panel {
    padding: 20px 16px;
  }

  .auth-panel {
    padding: 24px 18px;
  }

  .auth-brand {
    flex-wrap: wrap;
    gap: 10px;
  }

  .auth-brand-logo {
    height: 56px;
    max-width: 100%;
  }

  .panel-head {
    padding: 14px 16px;
  }

  .panel-body {
    padding: 16px;
  }

  .project-card {
    padding: 18px 16px;
  }

  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-danger,
  .btn-success,
  .btn-ghost {
    height: 44px;
  }

  .fin-stat-card .stat-value {
    font-size: 1.3rem;
  }
}

/* ==========================================================================
   Project Workspace (Phase 8)
   ========================================================================== */

/* ----------------------------- Workspace layout ----------------------------- */
.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.workspace-main {
  min-width: 0;
}

.workspace-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: calc(var(--topbar-height) + 16px);
  min-width: 0;
}

/* ----------------------------- Workspace hero header ----------------------------- */
.workspace-head {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.workspace-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.workspace-head-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.workspace-head-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-navy-800);
  min-width: 0;
}

.workspace-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.workspace-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px 24px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--color-outline);
}

.workspace-meta-item {
  min-width: 0;
}

.workspace-meta-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-on-surface-variant);
  margin-bottom: 6px;
}

.workspace-meta-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-meta-value .material-symbols-outlined {
  font-size: 16px;
  color: var(--color-muted);
}

.workspace-meta-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace-meta-progress .project-progress-track {
  width: 100%;
  height: 8px;
}

.workspace-meta-progress .project-progress-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
  white-space: nowrap;
}

/* Quick actions */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.qa-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--color-outline-strong);
  background: var(--color-surface);
  color: var(--color-navy-800);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.qa-button:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.qa-button .material-symbols-outlined {
  font-size: 18px;
}

/* ----------------------------- Workspace rail panels ----------------------------- */
.rail-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.rail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-outline);
  background: #fbfcfe;
}

.rail-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-navy-800);
}

.rail-panel-title .material-symbols-outlined {
  font-size: 17px;
  color: var(--color-primary);
}

.rail-panel-body {
  padding: 10px 16px;
}

.rail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-outline);
}

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

.rail-item-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rail-item-icon .material-symbols-outlined {
  font-size: 17px;
}

.rail-item-main {
  min-width: 0;
  flex: 1;
}

.rail-item-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-on-surface);
  line-height: 1.35;
}

.rail-item-sub {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  margin-top: 2px;
}

.rail-item-sub.overdue {
  color: var(--color-error-text);
  font-weight: 600;
}

.rail-item-sub.soon {
  color: var(--color-warning-text);
  font-weight: 600;
}

.rail-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.rail-photo-thumb {
  aspect-ratio: 1;
  border: 1px solid var(--color-outline);
  object-fit: cover;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.rail-photo-thumb:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.rail-health {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail-health .health-indicator {
  font-size: var(--text-sm);
}

.rail-link {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.rail-link:hover {
  text-decoration: underline;
}

/* ----------------------------- Team tab ----------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.team-card {
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.team-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-avatar {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}

.team-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
  line-height: 1.3;
}

.team-card-role {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: capitalize;
  margin-top: 2px;
}

.team-card-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  min-width: 0;
}

.team-card-contact .material-symbols-outlined {
  font-size: 15px;
  color: var(--color-muted);
}

.team-card-contact a {
  color: var(--color-on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.team-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--color-outline-strong);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-on-surface-variant);
}

/* ----------------------------- Report cards (workspace) ----------------------------- */
.report-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.report-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
}

.report-meta-line .material-symbols-outlined {
  font-size: 14px;
  color: var(--color-muted);
}

.report-photo-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ----------------------------- Filter selects ----------------------------- */
.filter-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--color-outline-strong);
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-family: var(--font);
  color: var(--color-on-surface);
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.photo-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* ----------------------------- Loading skeletons ----------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e8ebf1;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.55;
  }
}

.skeleton-block {
  height: 14px;
  margin-bottom: 12px;
}

.skeleton-block.w60 {
  width: 60%;
}

.skeleton-block.w40 {
  width: 40%;
}

.skeleton-card {
  height: 110px;
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.skeleton-thumb {
  aspect-ratio: 1;
}

/* ----------------------------- Workspace responsive ----------------------------- */
@media (max-width: 1240px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .workspace-rail {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .workspace-rail {
    grid-template-columns: 1fr;
  }

  .workspace-head {
    padding: 18px 16px;
  }

  .workspace-head-actions {
    margin-left: 0;
  }

  .photo-filters {
    margin-left: 0;
  }
}

.modal-lg {
  max-width: 720px;
}

/* ==========================================================================
   Financial Transparency (Phase 2 / Core Module 1)
   ========================================================================== */

.fin-stat-card .stat-value {
  font-size: 1.55rem;
}

.fin-util-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.fin-util-row .project-progress-track {
  flex: 1;
}

.fin-util-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-on-surface-variant);
  white-space: nowrap;
}

.fin-variance-pos {
  color: #15803d;
}

.fin-variance-neg {
  color: var(--color-error-text);
}

.fin-variance-neutral {
  color: var(--color-on-surface);
}

.stage-list {
  display: flex;
  flex-direction: column;
}

.stage-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-outline);
  flex-wrap: wrap;
}

.stage-row:last-child {
  border-bottom: none;
}

.stage-row-main {
  flex: 1;
  min-width: 180px;
}

.stage-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-name .status-badge {
  margin-left: 2px;
}

.stage-budget-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 6px;
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
}

.stage-budget-info strong {
  color: var(--color-on-surface);
  font-weight: 600;
}

.stage-util {
  width: 200px;
  min-width: 140px;
}

.stage-util .fin-util-row {
  margin-top: 0;
}

.stage-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-actions .btn-small {
  height: 30px;
  font-size: var(--text-xs);
}

.fin-muted-note {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.fin-grid-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-link {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .stage-util {
    width: 100%;
  }
}

/* ==========================================================================
   Client Portal
   ========================================================================== */

.sidebar-project {
  padding: 0 16px 14px;
}

.sidebar-project-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.sidebar-project .filter-select {
  width: 100%;
}

.client-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}

.client-hero-main {
  flex: 2 1 280px;
  min-width: 240px;
}

.client-hero-stat {
  flex: 1 1 160px;
  min-width: 140px;
}

.client-hero-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.client-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-on-surface);
  line-height: 1.2;
}

.client-hero-big {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
}

.client-hero-sub {
  margin-top: 6px;
}

.progress-overview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
}

.progress-overview-bar {
  flex: 1 1 320px;
  min-width: 260px;
  padding-top: 6px;
}

.progress-overview-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-overview-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.progress-overview-value {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
}

.progress-overview-facts {
  flex: 1 1 280px;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-fact-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.progress-fact-value {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-on-surface);
  margin-top: 2px;
}

.client-activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.client-activity-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--color-outline);
  border-radius: 8px;
  padding: 14px;
  background: var(--color-surface-container);
}

.client-activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--color-primary-container);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.client-activity-icon .material-symbols-outlined {
  font-size: 22px;
}

.client-activity-main {
  min-width: 0;
  flex: 1;
}

.client-activity-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.client-activity-value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
  margin-top: 2px;
}

.client-activity-note {
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-top: 4px;
  line-height: 1.45;
}

.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.quick-link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  border: 1px solid var(--color-outline);
  border-radius: 8px;
  background: var(--color-surface-container);
  text-decoration: none;
  color: var(--color-on-surface);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.quick-link-card .material-symbols-outlined {
  font-size: 28px;
  color: var(--color-primary);
}

.quick-link-card:hover {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.stage-budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stage-budget-name {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-on-surface);
  margin-top: 2px;
}

.stage-budget-value {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2px;
}

.stage-budget-util {
  border-top: 1px solid var(--color-outline);
  padding-top: 16px;
}

.stage-budget-util .project-progress-track {
  height: 10px;
}

.fin-timeline {
  position: relative;
  padding-left: 0;
}

.fin-timeline-item {
  position: relative;
  display: flex;
  gap: 14px;
  padding-bottom: 22px;
}

.fin-timeline-item:last-child {
  padding-bottom: 0;
}

.fin-timeline-item::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--color-outline);
}

.fin-timeline-item:last-child::before {
  display: none;
}

.fin-timeline-dot {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-outline-strong);
  flex-shrink: 0;
  margin-top: 4px;
}

.fin-timeline-dot.done {
  background: var(--color-success);
  border-color: var(--color-success);
}

.fin-timeline-body {
  flex: 1;
  min-width: 0;
}

.fin-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.fin-timeline-date {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.fin-timeline-amount {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
}

.fin-timeline-desc {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.stage-tracker {
  display: flex;
  flex-direction: column;
}

.stage-tracker-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.stage-tracker-item:hover {
  background: var(--color-surface-container);
}

.stage-tracker-item.selected {
  background: var(--color-primary-container);
}

.stage-tracker-node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--color-surface-container-high);
  border: 2px solid var(--color-outline);
  color: var(--color-muted);
}

.stage-tracker-item .material-symbols-outlined {
  font-size: 18px;
}

.stage-tracker-item.completed .stage-tracker-node {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.stage-tracker-item.current .stage-tracker-node {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.stage-tracker-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.stage-tracker-meta {
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-left: auto;
}

.stage-tracker-line {
  width: 2px;
  height: 16px;
  margin: 2px 0 2px 27px;
  background: var(--color-outline);
}

.stage-tracker-line.done {
  background: var(--color-success);
}

.stage-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.stage-detail-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-on-surface);
  margin: 0;
}

.stage-detail-desc {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin: 4px 0 0;
  line-height: 1.5;
}

.stage-detail-pct {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

.stage-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 18px;
}

.stage-detail-subhead {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 18px 0 10px;
}

.stage-detail-subhead:first-child {
  margin-top: 0;
}

.stage-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-outline-variant, rgba(0, 0, 0, 0.06));
}

.stage-info-row:last-child {
  border-bottom: none;
}

.stage-info-row .table-link {
  font-size: var(--text-xs);
}

.update-card {
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 16px;
  margin-bottom: 14px;
  transition: box-shadow 0.15s ease;
}

.update-card:hover {
  box-shadow: var(--shadow-sm);
}

.update-card:last-child {
  margin-bottom: 0;
}

.update-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.update-card-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-on-surface);
}

.update-card-date .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-primary);
}

.update-card-work {
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-line;
}

.update-card-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-bottom: 12px;
}

.update-card-progress .project-progress-track {
  flex: 1 1 200px;
  min-width: 140px;
  height: 8px;
}

.update-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-on-surface-variant);
  background: var(--color-surface-container);
  border: 1px solid var(--color-outline);
  border-radius: 999px;
  padding: 4px 10px;
}

.chip .material-symbols-outlined {
  font-size: 15px;
}

.update-card-issues {
  font-size: var(--text-sm);
  color: var(--color-danger);
  background: var(--color-error-container);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 12px;
  line-height: 1.5;
}

.update-card-comments {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: var(--text-sm);
  color: var(--color-on-surface);
  background: var(--color-surface-container);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 12px;
  line-height: 1.5;
}

.update-card-comments .material-symbols-outlined {
  color: var(--color-primary);
  font-size: 20px;
  margin-top: 2px;
}

.update-card-comments strong {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.doc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.doc-filter {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface-variant);
  background: var(--color-surface-container);
  border: 1px solid var(--color-outline);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.doc-filter:hover {
  border-color: var(--color-primary);
}

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

.category-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-container);
  border-radius: 999px;
  padding: 2px 10px;
  margin-right: 4px;
}

.btn-primary.disabled,
.btn-secondary.disabled {
  opacity: 0.55;
  pointer-events: none;
  cursor: default;
}

.notif-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.notification-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--color-outline);
  border-radius: 8px;
  background: var(--color-surface);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.notification-card.unread {
  background: var(--color-primary-container);
  border-color: var(--color-primary-variant);
}

.notification-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-outline);
  flex-shrink: 0;
  margin-top: 6px;
}

.notification-card.unread .notification-dot {
  background: var(--color-primary);
}

.notification-main {
  min-width: 0;
  flex: 1;
}

.notification-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-on-surface);
}

.notification-message {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  margin-top: 2px;
  line-height: 1.5;
}

.notification-time {
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-top: 6px;
}

.rail-item.unread {
  border-left: 3px solid var(--color-primary);
  padding-left: 10px;
}

.rail-item-end {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .notif-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .stage-detail-head {
    flex-direction: column;
  }
}

/* ----------------------------- Daily report form ----------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 18px;
}

.linked-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.linked-record-card {
  border: 1px dashed var(--color-outline-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.linked-record-icon {
  font-size: 28px;
  color: var(--color-on-surface-variant);
}

.linked-record-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.linked-record-empty {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.text-muted {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

/* Draft list (site agent dashboard) */
.draft-list {
  display: flex;
  flex-direction: column;
}

.draft-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-outline);
}

.draft-row:last-child {
  border-bottom: none;
}

.draft-row-main {
  flex: 1;
  min-width: 0;
}

.draft-row-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-surface);
}

.draft-row-sub {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.page-head-actions .btn-primary,
.page-head-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ----------------------------- Site Agent workspace ----------------------------- */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.table-search {
  flex: 1 1 200px;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-on-surface);
  font-size: var(--text-sm);
}
.table-search:focus {
  outline: none;
  border-color: var(--color-primary);
}
.topbar-project {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.topbar-project label {
  font-size: var(--text-xs);
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.topbar-project .filter-select {
  min-width: 220px;
  padding: 6px 10px;
}
.photo-card {
  position: relative;
  border: 1px solid var(--color-outline);
  background: var(--color-surface);
  padding: 6px;
}
.photo-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  cursor: pointer;
}
.photo-card-caption {
  font-size: var(--text-xs);
  color: var(--color-on-surface-variant);
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}
.photo-card-date {
  font-size: 0.7rem;
  color: var(--color-muted);
}
.photo-card-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(15, 27, 61, 0.75);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-card-remove:hover {
  background: var(--color-danger);
}
.report-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--color-outline);
  background: var(--color-surface);
  margin-bottom: 10px;
}
.report-row-main {
  flex: 1;
  min-width: 0;
}
.report-row-title {
  font-weight: 600;
  color: var(--color-on-surface);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.report-row-sub {
  font-size: var(--text-sm);
  color: var(--color-on-surface-variant);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-row-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  padding: 3px 9px;
  border: 1px solid var(--color-outline-strong);
  background: var(--color-surface-container);
  color: var(--color-on-surface-variant);
  border-radius: 999px;
}
.report-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.editor-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.pm-comment-box {
  border: 1px solid var(--color-outline-strong);
  border-left: 3px solid var(--color-warning);
  background: var(--color-surface-container);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.pm-comment-box strong {
  display: block;
  font-size: var(--text-sm);
  margin-bottom: 4px;
}

/* ============ Project picker (client-style card selector) ============ */
.topbar-project {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.project-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--color-navy-800);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.project-picker-trigger:hover {
  border-color: var(--color-primary-variant);
  box-shadow: var(--shadow-sm);
}

.project-picker-trigger > .material-symbols-outlined {
  font-size: 20px;
  color: var(--color-muted);
}

.project-picker-trigger-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 460px;
  max-width: 92vw;
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  padding: 12px;
  max-height: 70vh;
  overflow-y: auto;
}

.project-picker-head {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  padding: 4px 8px 10px;
}

.project-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-picker-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-outline);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.project-picker-card:hover {
  border-color: var(--color-primary-variant);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.project-picker-card.active {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

.project-picker-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--color-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.project-picker-card.active .project-picker-icon {
  background: var(--color-primary);
}

.project-picker-icon .material-symbols-outlined {
  font-size: 22px;
  color: var(--color-primary);
}

.project-picker-card.active .project-picker-icon .material-symbols-outlined {
  color: #ffffff;
}

.project-picker-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-picker-title {
  font-weight: 600;
  color: var(--color-navy-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-picker-sub {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

.project-picker-enter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  flex: none;
}

.project-picker-enter .material-symbols-outlined {
  font-size: 18px;
}

.chart-wrap {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-wrap canvas {
  max-height: 320px;
}

/* ----------------------------- PWA install banner ----------------------------- */
.pwa-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-navy-950);
  color: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
}

.pwa-install-banner[hidden] {
  display: none;
}

.pwa-install-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.pwa-install-text strong {
  font-weight: 600;
}

.pwa-install-text span {
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-xs);
}

.pwa-install-btn {
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  flex: none;
}

.pwa-install-btn:hover {
  background: var(--color-primary-hover);
}

.pwa-install-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  flex: none;
}
