html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background: linear-gradient(180deg, var(--tenant-bg-start, #c59cf0) 0%, var(--tenant-bg-end, #e1b3fa) 100%);
  color: #1f2937;
  font-family: var(--font-default);
}

.modal-dialog {
  margin: 2em auto;
}

.modal {
  --bs-modal-padding: 2rem;
  --bs-modal-header-padding: 2rem;
}

:root {
  --font-default: "Open Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --tenant-primary: #7c3aed;
  --tenant-primary-dark: #5b21b6;
  --tenant-primary-rgb: 124, 58, 237;
  --tenant-bg-start: #c59cf0;
  --tenant-bg-end: #e1b3fa;
  --bs-primary: var(--tenant-primary-dark);
  --bs-primary-rgb: var(--tenant-primary-rgb);
  --bs-link-color: var(--tenant-primary-dark);
  --bs-link-hover-color: var(--tenant-primary-dark);
  --bs-modal-padding: 2rem;
  --bs-modal-header-padding: 2rem;
}


.app-header {
  width: 100%;
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.app-logo {
  display: block;
  margin: 0 auto;
  max-width: 260px;
  width: 100%;
  height: auto;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.form-switch-lg .form-check-input {
  width: 3.25rem;
  height: 1.6rem;
  margin-top: 0.15rem;
}

.form-switch-lg .form-check-input:checked {
  background-size: 1.6rem 1.6rem;
}

.form-switch-lg .form-check-label {
  font-weight: 600;
  padding-left: 0.35rem;
}

/* Auth card interface */
.auth-page .card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 1);
  backdrop-filter: blur(8px);
  box-shadow:
    0 20px 45px rgba(31, 41, 55, 0.08),
    0 6px 12px rgba(31, 41, 55, 0.06);
}

.auth-form-col {
  max-width: 770px;
  width: 100%;
}

.auth-form-col .card {
  width: 100%;
}

.auth-card {
  overflow: hidden;
  position: relative;
}

.auth-card-header {
  background: linear-gradient(135deg, var(--tenant-bg-start) 0%, var(--tenant-bg-end) 50%, var(--tenant-bg-start) 100%);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0) 40%);
}

.auth-badge {
  position: absolute;
  left: 50%;
  top: 60px;
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f3e7ff;
  border: 4px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(91, 33, 182, 0.15);
}

.auth-badge-icon {
  font-size: 28px;
  color: var(--tenant-primary);
}

.auth-card-body {
  padding-top: 3.5rem;
}

.auth-top-wrap {
  width: 100%;
  overflow: hidden;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.auth-top-image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  border-radius: 0;
}

.auth-content {
  padding: 2.25rem;
}

.auth-page .form-label {
  font-weight: 600;
  color: #334155;
}

.auth-page .form-control,
.auth-page .input-group-text {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.auth-page .form-control:focus {
  border-color: var(--tenant-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--tenant-primary-rgb), 0.15);
}

.auth-page .input-group-text {
  background: #f8fafc;
  color: #64748b;
}

.auth-page .btn-primary {
  border: none;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--tenant-primary-dark) 0%, var(--tenant-primary) 40%, var(--tenant-primary-dark) 100%);
  box-shadow: 0 12px 20px rgba(var(--tenant-primary-rgb), 0.25);
}

.auth-primary {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}

.auth-link {
  color: var(--tenant-primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-compact {
  font-size: 0.85rem;
  color: #6b7280;
}

.auth-page .btn-primary:hover {
  filter: brightness(1.05);
}

.auth-page .btn-primary:focus,
.auth-page .btn-primary:active:focus {
  box-shadow: 0 0 0 0.2rem rgba(var(--tenant-primary-rgb), 0.2);
}

.auth-page .btn-primary.active {
  background: linear-gradient(135deg, var(--tenant-primary-dark) 0%, var(--tenant-primary) 100%);
}

.auth-page .alert {
  border-radius: 12px;
}

/* Dashboard mockup */
.dashboard-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-logo {
  max-width: 220px;
  width: 100%;
  height: auto;
}

.dashboard-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dashboard-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f3e7ff;
  color: var(--tenant-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.dashboard-user-name {
  font-weight: 700;
}

.dashboard-user-links {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #4b5563;
  align-items: center;
}

.dashboard-user-links a,
.dashboard-user-links button {
  color: #4b5563;
  background: none;
  border: none;
  padding: 0;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.dashboard-user-links a:hover,
.dashboard-user-links button:hover {
  color: var(--tenant-primary);
}

.header-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 0.4rem;
  margin-left: 0.35rem;
  text-decoration: none;
  vertical-align: middle;
  transition: background 0.15s ease;
}

.header-unread-badge:hover {
  background: #b91c1c;
  color: #ffffff;
  text-decoration: none;
}

.header-unread-badge.no-unreads {
  background: rgba(var(--tenant-primary-rgb), 0.15);
  color: var(--tenant-primary);
}

.header-unread-badge.no-unreads:hover {
  background: rgba(var(--tenant-primary-rgb), 0.25);
  color: var(--tenant-primary-dark);
}

.sidebar-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0 0.3rem;
  margin-left: auto;
}

.dashboard-user-links a.active {
  color: var(--tenant-primary);
}

/* Admin sidebar navigation */
.admin-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.2);
  border-radius: 10px;
}

.admin-sidebar-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #4b5563;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-sidebar-item:hover {
  background: rgba(var(--tenant-primary-rgb), 0.1);
  color: var(--tenant-primary);
  text-decoration: none;
}

.admin-sidebar-item.active {
  background: rgba(var(--tenant-primary-rgb), 0.18);
  color: var(--tenant-primary);
}

.admin-sidebar-separator {
  width: 1px;
  height: 20px;
  background: rgba(var(--tenant-primary-rgb), 0.25);
  align-self: center;
}

.admin-sidebar-icon {
  font-size: 0.6rem;
  line-height: 1;
}

@media (max-width: 576px) {
  .admin-sidebar {
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
  }

  .admin-sidebar-item {
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
  }
}

/* Breadcrumbs */
.admin-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.admin-breadcrumb a {
  color: var(--tenant-primary);
  text-decoration: none;
  font-weight: 600;
}

.admin-breadcrumb a:hover {
  text-decoration: underline;
}

.admin-breadcrumb .separator {
  color: #d1d5db;
}

.admin-breadcrumb .current {
  color: #1f2937;
  font-weight: 600;
}

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.9rem;
  padding: 1rem 0;
}

.loading-indicator::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(var(--tenant-primary-rgb), 0.25);
  border-top-color: var(--tenant-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.dashboard-window {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.25);
  box-shadow: 0 20px 40px rgba(31, 41, 55, 0.08);
  overflow: hidden;
}

.dashboard-window-bar {
  background: #e7c6f8;
  padding: 0.5rem 0.75rem;
  display: flex;
  gap: 0.4rem;
}

.dashboard-window-bar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tenant-primary-dark);
  opacity: 0.6;
}

.dashboard-window-body {
  padding: 1.75rem 2rem 2.5rem;
}

.dashboard-tabs {
  display: flex;
  gap: 1.25rem;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  justify-content: flex-end;
}

.dashboard-tabs button {
  background: none;
  border: none;
  padding: 0;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
}

.dashboard-tabs button.active,
.dashboard-tabs button span {
  color: var(--tenant-primary);
}

.dashboard-section-title {
  color: var(--tenant-primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.dashboard-table {
  display: grid;
  gap: 0.35rem;
}

.dashboard-table-header,
.dashboard-table-row {
  display: grid;
  grid-template-columns: 120px 1fr 120px 140px;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
}

.clients-table .dashboard-table-header,
.clients-table .dashboard-table-row {
  grid-template-columns: 160px 1fr 140px 140px 110px;
}

.project-types-table .dashboard-table-header,
.project-types-table .dashboard-table-row {
  grid-template-columns: 2fr 120px 120px 140px;
}

.projects-table .dashboard-table-header,
.projects-table .dashboard-table-row {
  grid-template-columns: 2fr 1.2fr 1.6fr 100px 120px;
}

.client-projects-table .dashboard-table-header,
.client-projects-table .dashboard-table-row {
  grid-template-columns: 2fr 100px 130px 130px 1.4fr 120px;
}

.project-summary-table .dashboard-table-header,
.project-summary-table .dashboard-table-row {
  grid-template-columns: 2fr 100px 130px 130px 1.4fr;
}

.client-stage-table .dashboard-table-header,
.client-stage-table .dashboard-table-row {
  grid-template-columns: 1.4fr 1.4fr 120px 130px 90px;
}

.project-stage-table .dashboard-table-header,
.project-stage-table .dashboard-table-row {
  grid-template-columns: 1.4fr 1fr 120px 2fr;
}

.project-requirements-table .dashboard-table-header,
.project-requirements-table .dashboard-table-row {
  grid-template-columns: 1.4fr 90px 120px 2fr 90px;
}

.requirement-response-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.stage-completed {
  color: #166534;
  background: rgba(34, 197, 94, 0.18);
}

.stage-in-progress {
  color: #0f766e;
  background: rgba(20, 184, 166, 0.18);
}

.stage-pending {
  color: #6b7280;
  background: rgba(148, 163, 184, 0.2);
}

.stage-cancelled {
  color: #991b1b;
  background: rgba(239, 68, 68, 0.2);
}

.stage-details-row {
  font-size: 0.82rem;
  color: #475569;
  margin: -0.1rem 0 0.4rem;
  background: rgba(var(--tenant-primary-rgb), 0.07);
  border-left: 3px solid rgba(var(--tenant-primary-rgb), 0.45);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
}

.dashboard-files-table .dashboard-table-header,
.dashboard-files-table .dashboard-table-row {
  grid-template-columns: 130px 1.2fr 1.6fr 120px 140px;
}

.project-files-table .dashboard-table-header,
.project-files-table .dashboard-table-row {
  grid-template-columns: 130px 2fr 120px 110px 140px;
}

.messages-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  min-height: 540px;
}

.messages-sidebar {
  border-right: 1px solid rgba(148, 163, 184, 0.25);
  padding-right: 1rem;
}

.messages-client-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 520px;
  overflow-y: auto;
}

.messages-client-item {
  text-align: left;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.15);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: #ffffff;
  transition: all 0.2s ease;
}

.messages-client-item:hover,
.messages-client-item.active {
  border-color: rgba(var(--tenant-primary-rgb), 0.45);
  background: rgba(var(--tenant-primary-rgb), 0.08);
}

.messages-client-name {
  font-weight: 600;
  color: #312e81;
}

.messages-client-name.has-unread {
  font-weight: 800;
}

.messages-client-preview {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-client-time {
  font-size: 0.68rem;
  color: #9ca3af;
  margin-top: 0.15rem;
}

.messages-client-email {
  font-size: 0.75rem;
  color: #6b7280;
}

.inbox-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--tenant-primary);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 0.4rem;
  flex-shrink: 0;
}

/* Queue */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.queue-item {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.15);
  background: rgba(var(--tenant-primary-rgb), 0.04);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.queue-item:hover {
  border-color: rgba(var(--tenant-primary-rgb), 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: inherit;
}

.queue-item-overdue {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.04);
}

.queue-item-overdue:hover {
  border-color: rgba(220, 38, 38, 0.5);
}

.queue-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.queue-item-stage {
  font-weight: 700;
  font-size: 0.92rem;
  color: #1f2937;
}

.queue-item-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tenant-primary);
}

.queue-item-date.overdue {
  color: #dc2626;
}

.queue-item-project {
  font-size: 0.82rem;
  color: #4b5563;
}

.queue-item-client {
  font-size: 0.78rem;
  color: #6b7280;
}

.queue-item-details {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 0.2rem;
  font-style: italic;
}

.messages-reply-area {
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.messages-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.messages-thread-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  padding-bottom: 0.5rem;
}

.messages-thread-title {
  font-weight: 700;
  color: #312e81;
}

.messages-thread-subtitle {
  font-size: 0.8rem;
  color: #6b7280;
}

.messages-thread-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.message-bubble {
  max-width: 75%;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.12);
  position: relative;
}

.message-bubble.from-admin {
  align-self: flex-end;
  background: rgba(var(--tenant-primary-rgb), 0.18);
}

.message-bubble.from-client {
  align-self: flex-start;
}

/* Activity feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  align-items: flex-start;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-signup {
  color: #0e7490;
  background: rgba(6, 182, 212, 0.15);
}

.badge-message {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.15);
}

.badge-reply {
  color: #7c3aed;
  background: rgba(var(--tenant-primary-rgb), 0.15);
}

.badge-read {
  color: #6b7280;
  background: rgba(148, 163, 184, 0.18);
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-summary {
  font-size: 0.88rem;
  line-height: 1.4;
}

.activity-client {
  font-weight: 700;
  color: var(--tenant-primary-dark);
  text-decoration: none;
}

.activity-client:hover {
  text-decoration: underline;
}

.activity-description {
  color: #4b5563;
}

.activity-preview {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.activity-time {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.15rem;
}


.message-sender {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4b5563;
  margin-bottom: 0.15rem;
}

.message-body {
  white-space: pre-wrap;
}

.message-meta {
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 0.35rem;
}

.message-read-receipt {
  color: #16a34a;
  font-weight: 600;
  margin-left: 0.35rem;
}

.message-attachments {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.message-attachments img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.messages-compose textarea {
  min-height: 120px;
  resize: vertical;
}

.orders-table .dashboard-table-header,
.orders-table .dashboard-table-row {
  grid-template-columns: minmax(130px, 1.2fr) 60px 90px 75px 90px 80px minmax(180px, 1fr);
  gap: 0.5rem;
}

.orders-table-client .dashboard-table-header,
.orders-table-client .dashboard-table-row {
  grid-template-columns: 70px 95px 80px 95px 85px 80px minmax(160px, 1fr);
  gap: 0.5rem;
}

.orders-table .dashboard-table-header span,
.orders-table .dashboard-table-row span,
.orders-table-client .dashboard-table-header span,
.orders-table-client .dashboard-table-row span {
  white-space: nowrap;
}

.project-type-requirements-table .dashboard-table-header,
.project-type-requirements-table .dashboard-table-row {
  grid-template-columns: 32px 1.6fr 120px 120px 140px;
}

.project-type-deliverables-table .dashboard-table-header,
.project-type-deliverables-table .dashboard-table-row {
  grid-template-columns: 32px 1.6fr 120px 140px;
}

.admin-project-requirements-table .dashboard-table-header,
.admin-project-requirements-table .dashboard-table-row {
  grid-template-columns: 32px 1.6fr 90px 120px;
}

.project-deliverables-table .dashboard-table-header,
.project-deliverables-table .dashboard-table-row {
  grid-template-columns: 1fr 180px;
}

.admin-project-stages-table .dashboard-table-header,
.admin-project-stages-table .dashboard-table-row {
  grid-template-columns: 1.2fr 110px 110px 130px 1.8fr 90px;
}

.admin-project-files-table .dashboard-table-header,
.admin-project-files-table .dashboard-table-row {
  grid-template-columns: 1.8fr 120px 90px 120px 110px;
}

.admin-project-overview-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

.admin-project-overview-label {
  color: #4b5563;
  font-weight: 700;
}

.admin-upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.admin-upload-action {
  display: flex;
  align-items: end;
}

.admin-stage-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
  align-items: end;
}

.admin-stage-editor-details {
  grid-column: 1 / span 3;
}

.admin-stage-editor-action {
  grid-column: 4;
  display: flex;
  justify-content: flex-start;
  align-items: end;
}

@media (max-width: 991.98px) {
  .admin-project-overview-grid {
    grid-template-columns: 110px 1fr;
  }

  .admin-upload-grid {
    grid-template-columns: 1fr;
  }

  .admin-stage-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-stage-editor-details {
    grid-column: 1 / span 2;
  }

  .admin-stage-editor-action {
    grid-column: 1 / span 2;
  }
}

@media (max-width: 767.98px) {
  .admin-stage-editor-grid {
    grid-template-columns: 1fr;
  }

  .admin-stage-editor-details,
  .admin-stage-editor-action {
    grid-column: 1;
  }
}

.drag-handle {
  cursor: grab;
  font-weight: 700;
  color: #6b7280;
  user-select: none;
}

.project-type-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dashboard-table-header {
  font-weight: 700;
  color: #4b5563;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(var(--tenant-primary-rgb), 0.2);
}

.dashboard-table-row {
  background: rgba(var(--tenant-primary-rgb), 0.08);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  user-select: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, opacity 120ms ease;
}

.dashboard-table-row.is-dragging {
  opacity: 0.85;
  background: rgba(var(--tenant-primary-rgb), 0.18);
  box-shadow: 0 10px 20px rgba(59, 41, 103, 0.18);
  transform: scale(1.01);
  outline: 2px dashed rgba(var(--tenant-primary-rgb), 0.6);
}

.dashboard-table-row.is-dragging .drag-handle {
  cursor: grabbing;
  color: var(--tenant-primary-dark);
}

.drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.85;
  transform: scale(1.01);
  box-shadow: 0 18px 30px rgba(59, 41, 103, 0.25);
}

.dashboard-table-row:nth-child(even) {
  background: rgba(var(--tenant-primary-rgb), 0.14);
}

.dashboard-table-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.dashboard-table-actions a {
  color: var(--tenant-primary);
  font-weight: 600;
  text-decoration: none;
}

.dashboard-table-actions a:hover {
  text-decoration: underline;
}

.status-check {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #6b7280;
  font-weight: 700;
  font-size: 0.8rem;
  background: #ffffff;
}

.status-check.done {
  border-color: rgba(34, 197, 94, 0.6);
  color: #16a34a;
  background: rgba(34, 197, 94, 0.1);
}

.order-line-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.order-line-entry {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.order-lines {
  display: grid;
  gap: 0.75rem;
}

.order-lines-header,
.order-line-row {
  display: grid;
  grid-template-columns: 2fr 1fr 120px;
  gap: 0.75rem;
  align-items: center;
}

.order-line-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.upload-panel {
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.2);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(var(--tenant-primary-rgb), 0.1) 0%, rgba(var(--tenant-primary-rgb), 0.05) 100%);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  padding: 0.9rem;
}

.upload-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.upload-panel-title {
  font-weight: 700;
  color: var(--tenant-primary-dark);
  margin: 0;
}

.upload-panel-hint {
  font-size: 0.78rem;
  color: #64748b;
}

.upload-input {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.upload-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 98px;
  border: 1px dashed rgba(var(--tenant-primary-rgb), 0.45);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #312e81;
  text-align: center;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-within {
  border-color: rgba(var(--tenant-primary-rgb), 0.8);
  box-shadow: 0 0 0 3px rgba(var(--tenant-primary-rgb), 0.14);
  transform: translateY(-1px);
}

.upload-dropzone.is-active {
  border-color: rgba(var(--tenant-primary-rgb), 0.95);
  box-shadow: 0 0 0 4px rgba(var(--tenant-primary-rgb), 0.2);
  background: rgba(238, 242, 255, 0.9);
}

.upload-input-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-dropzone-primary {
  font-weight: 700;
  font-size: 0.92rem;
}

.upload-dropzone-secondary {
  font-size: 0.78rem;
  color: #64748b;
}

.upload-panel-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.upload-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.upload-selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.3);
  background: rgba(var(--tenant-primary-rgb), 0.12);
  color: var(--tenant-primary-dark);
  font-size: 0.78rem;
  line-height: 1.2;
}

.upload-selected-remove {
  border: none;
  background: transparent;
  color: var(--tenant-primary-dark);
  font-size: 0.82rem;
  line-height: 1;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-weight: 700;
}

.upload-selected-remove:hover,
.upload-selected-remove:focus {
  color: #7f1d1d;
}

.upload-chip-progress {
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
}

@media (max-width: 576px) {
  .upload-panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

.order-line-project-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.3);
  color: var(--tenant-primary);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  flex: 0 0 auto;
}

.order-line-project-icon:hover {
  background: rgba(var(--tenant-primary-rgb), 0.12);
}

.order-lines-header {
  font-weight: 700;
  color: #4b5563;
}

.order-invoice {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.5);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.invoice-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.invoice-subtitle {
  color: #6b7280;
  font-weight: 600;
}

.invoice-meta {
  text-align: right;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.95rem;
}

.invoice-meta span {
  font-weight: 600;
  color: #1f2937;
}

.invoice-client {
  background: rgba(var(--tenant-primary-rgb), 0.06);
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.invoice-lines .order-lines-header {
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.invoice-lines .order-line-row {
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 0.75rem;
}

.invoice-totals {
  border-top: 1px dashed rgba(148, 163, 184, 0.5);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.invoice-total-row {
  display: flex;
  gap: 2rem;
  width: 260px;
  justify-content: space-between;
  font-weight: 600;
  color: #4b5563;
}

.invoice-total-row.total {
  font-size: 1.1rem;
  color: #1f2937;
}

.client-lookup {
  position: relative;
}

.client-lookup-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.2);
  border-radius: 8px;
  box-shadow: 0 12px 20px rgba(31, 41, 55, 0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 10;
  margin-top: 0.35rem;
}

.client-lookup-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
}

.client-lookup-item:hover {
  background: rgba(var(--tenant-primary-rgb), 0.08);
}

.client-lookup-name {
  font-weight: 600;
  color: #1f2937;
}

.client-lookup-email {
  font-size: 0.8rem;
  color: #6b7280;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.account-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.2);
  padding: 1.5rem;
}

.account-card h5 {
  font-weight: 700;
  margin-bottom: 1rem;
}

.account-card .form-floating > label {
  opacity: 0.5;
}

/* Inline avatar + name */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.user-chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-chip-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--tenant-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-chip-lg .user-chip-avatar,
.user-chip-lg .user-chip-initials {
  width: 32px;
  height: 32px;
  font-size: 0.65rem;
}

.user-chip-xl .user-chip-avatar,
.user-chip-xl .user-chip-initials {
  width: 40px;
  height: 40px;
  font-size: 0.75rem;
}

/* Project progress stepper */
.progress-stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
  position: relative;
}

.progress-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  z-index: 1;
  border: 2px solid #d1d5db;
  background: #ffffff;
  color: #9ca3af;
  flex-shrink: 0;
}

.progress-step.completed .progress-step-dot {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.progress-step.in-progress .progress-step-dot {
  background: var(--tenant-primary);
  border-color: var(--tenant-primary);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(var(--tenant-primary-rgb), 0.2);
}

.progress-step.cancelled .progress-step-dot {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.progress-step-label {
  font-size: 0.68rem;
  color: #6b7280;
  text-align: center;
  margin-top: 0.35rem;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-step.in-progress .progress-step-label {
  color: var(--tenant-primary);
  font-weight: 700;
}

.progress-step.completed .progress-step-label {
  color: #16a34a;
}

.progress-step-connector {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #d1d5db;
  z-index: 0;
}

.progress-step.completed .progress-step-connector {
  background: #16a34a;
}

.progress-step:last-child .progress-step-connector {
  display: none;
}

.current-stage-card {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(var(--tenant-primary-rgb), 0.08);
  border-left: 3px solid var(--tenant-primary);
}

.current-stage-label {
  font-size: 0.72rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.current-stage-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tenant-primary-dark);
}

.current-stage-details {
  font-size: 0.82rem;
  color: #4b5563;
  margin-top: 0.15rem;
}

.current-stage-done {
  background: rgba(22, 163, 74, 0.08);
  border-left-color: #16a34a;
}

.current-stage-done .current-stage-name {
  color: #16a34a;
}

.your-contact-card {
  display: inline-flex;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  background: rgba(var(--tenant-primary-rgb), 0.08);
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.15);
}

/* Account profile page */
.account-profile-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  margin: -1.75rem -2rem 1.5rem;
  background: linear-gradient(135deg, var(--tenant-bg-start) 0%, var(--tenant-bg-end) 100%);
  border-radius: 0;
}

.account-profile-avatar-wrap {
  flex-shrink: 0;
  position: relative;
}

.account-avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--tenant-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background 0.15s ease;
}

.account-avatar-upload-btn:hover {
  background: var(--tenant-primary-dark);
}

.account-profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.account-profile-avatar-fallback {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--tenant-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 3px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.account-profile-name {
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.account-profile-email {
  color: #4b5563;
  font-size: 0.88rem;
}

.account-profile-specialty {
  color: var(--tenant-primary-dark);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.account-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.account-section {
  background: #ffffff;
  border: 1px solid rgba(var(--tenant-primary-rgb), 0.15);
  border-radius: 12px;
  padding: 1.5rem;
}

.account-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(var(--tenant-primary-rgb), 0.1);
}

.account-section-icon {
  font-size: 1.1rem;
  color: var(--tenant-primary);
}

.account-section-title {
  font-weight: 700;
  color: #1f2937;
  margin: 0;
  font-size: 0.95rem;
}

@media (max-width: 576px) {
  .account-profile-header {
    flex-direction: column;
    text-align: center;
    margin: -1rem -1rem 1rem;
    padding: 1.25rem;
  }
}

.account-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(var(--tenant-primary-rgb), 0.4);
}

@media (max-width: 900px) {
  .dashboard-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-table-header,
  .dashboard-table-row {
    min-width: 600px;
  }

  .orders-table .dashboard-table-header,
  .orders-table .dashboard-table-row {
    min-width: 800px;
  }
}

@media (max-width: 720px) {
  .dashboard-header {
    flex-direction: column;
  }

  .dashboard-window-body {
    padding: 1.25rem;
  }

  .messages-layout {
    grid-template-columns: 1fr;
  }

  .messages-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    padding-right: 0;
    padding-bottom: 1rem;
  }

  .messages-client-list {
    max-height: 200px;
  }
}

@media (max-width: 576px) {
  .dashboard-page {
    padding: 1rem 0.75rem 2rem;
  }

  .dashboard-window-body {
    padding: 1rem;
  }

  .account-grid {
    grid-template-columns: 1fr;
  }
}