/* ============================================================
   ZIDOSOFT — ADMIN CONSOLE
   Dense, functional, dark. Control panel aesthetic.
   ============================================================ */

body {
  min-height: 100vh;
  background: var(--bg);
}

/* ---------- AUTH GATE ---------- */
.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}

.auth-gate.hidden {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: var(--space-8);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--line);
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.auth-brand-sub {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.auth-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-6);
}

.auth-form .form-group {
  margin-bottom: var(--space-4);
}

.auth-submit {
  width: 100%;
  margin-top: var(--space-3);
}

.auth-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  text-align: center;
}

/* ---------- APP SHELL ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell.hidden {
  display: none;
}

/* ---------- HEADER ---------- */
.admin-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  padding: 0 var(--space-5);
  height: 60px;
}

/* Brand */
.admin-brand {
  flex-shrink: 0;
}

.admin-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.admin-logo img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}



.admin-logo-text {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.admin-logo-badge {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(201, 169, 97, 0.3);
  color: var(--accent);
  border-radius: var(--radius-sm);
}

/* Nav */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.admin-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition:
    color 150ms var(--ease),
    background-color 150ms var(--ease);
}

.admin-nav-link:hover {
  color: var(--text);
  background: var(--bg-elev-1);
}

.admin-nav-link.active {
  color: var(--text);
  background: var(--bg-elev-2);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-pill);
}

.nav-badge.hidden {
  display: none;
}

/* Red variant — for urgent notifications (client messages) */
.nav-badge.badge-red {
  background: var(--danger);
  color: #FFFFFF;
}

/* Actions */
.admin-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.admin-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.admin-live-label {
  text-transform: uppercase;
}

.admin-live .pulse-wrap {
  width: 6px;
  height: 6px;
}

/* Theme toggle — compact */
.admin-actions .theme-toggle {
  height: 32px;
  padding: 3px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.admin-actions .theme-toggle button {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}

.admin-actions .theme-toggle button:hover {
  color: var(--text);
}

.admin-actions .theme-toggle button[aria-pressed="true"] {
  background: var(--bg-elev-3);
  color: var(--text);
}

.admin-actions .theme-toggle svg {
  width: 13px;
  height: 13px;
}

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

.admin-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: border-color 150ms var(--ease);
}

.admin-user-btn:hover {
  border-color: var(--line-strong);
}

.admin-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}

.admin-user-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  padding: var(--space-3);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 180ms var(--ease),
    transform 180ms var(--ease-out);
  z-index: 200;
}

.admin-user-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.admin-user-menu-header {
  padding: var(--space-3) var(--space-3) var(--space-2);
}

.admin-user-menu-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.admin-user-menu-email {
  font-size: 0.8125rem;
  color: var(--text);
  word-break: break-all;
}

.admin-user-menu-divider {
  height: 1px;
  background: var(--line);
  margin: var(--space-2) 0;
}

.admin-user-menu-item {
  display: block;
  width: 100%;
  padding: 10px var(--space-3);
  background: transparent;
  border: none;
  text-align: left;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
}

a.admin-user-menu-item {
  text-decoration: none;
}

a.admin-user-menu-item:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

.admin-user-menu-item:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

/* ---------- MAIN ---------- */
.admin-main {
  flex: 1;
  padding: var(--space-7) var(--space-5);
}

.admin-container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Page header */
.admin-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-7);
  flex-wrap: wrap;
}

.admin-page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0;
  line-height: 1.15;
}

.admin-page-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-7);
}

.kpi-card {
  padding: var(--space-5);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color 200ms var(--ease), transform 200ms var(--ease);
}

.kpi-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--space-3);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kpi-value.accent {
  color: var(--accent);
}

.kpi-value.warn {
  color: var(--warning);
}

.kpi-value.danger {
  color: var(--danger);
}

.kpi-foot {
  margin-top: var(--space-3);
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Cards */
.admin-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.admin-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
}

.admin-card-meta {
  font-size: 0.8125rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Tables */
.admin-table-wrap {
  overflow-x: auto;
  margin: 0 calc(var(--space-5) * -1) calc(var(--space-5) * -1);
  padding: 0 var(--space-5) var(--space-5);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.admin-table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}

.admin-table tbody tr {
  transition: background-color 120ms var(--ease);
}

.admin-table tbody tr:hover {
  background: var(--bg-elev-2);
}

.admin-table tbody tr.clickable {
  cursor: pointer;
}

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

.admin-table .muted {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.admin-table .mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.status-pill.new {
  background: rgba(96, 165, 250, 0.12);
  color: var(--info);
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.status-pill.qualified {
  background: rgba(201, 169, 97, 0.14);
  color: var(--accent);
  border: 1px solid rgba(201, 169, 97, 0.3);
}

.status-pill.won {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-pill.overdue {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.status-pill.neutral {
  background: var(--bg-elev-2);
  color: var(--text-muted);
  border: 1px solid var(--line);
}

/* SLA countdown */
.sla {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.sla.urgent {
  color: var(--warning);
}

.sla.overdue {
  color: var(--danger);
  font-weight: 500;
}

/* Empty state */
.admin-empty {
  padding: var(--space-9) var(--space-5);
  text-align: center;
  color: var(--text-muted);
}

.admin-empty-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 var(--space-3);
}

/* Buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}

.btn-icon:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.filter-tab {
  padding: 6px 14px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--text);
}

.filter-tab.active {
  background: var(--bg-elev-3);
  color: var(--text);
}

/* Search */
.admin-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.admin-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  font-size: 0.875rem;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  transition: border-color 150ms var(--ease);
}

.admin-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8A8F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* ---------- TOASTS ---------- */
.toast-container {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: 500;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.5;
  pointer-events: auto;
  animation: toastIn 300ms var(--ease-out);
  max-width: 100%;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.info {
  border-left-color: var(--info);
}

.toast-title {
  font-weight: 500;
  margin-bottom: 2px;
}

.toast-body {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1000px) {
  .admin-nav {
    display: none;
  }
  .admin-user-email {
    display: none;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .admin-header-inner {
    padding: 0 var(--space-4);
  }
  .admin-main {
    padding: var(--space-5) var(--space-4);
  }
  .admin-live-label {
    display: none;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
}

/* ============================================================
   PIPELINE
   ============================================================ */

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(240px, 1fr));
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-4);
  min-height: calc(100vh - 260px);
}

.pipeline-column {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-height: 400px;
}

.pipeline-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.pipeline-column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.pipeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pipeline-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--bg-elev-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
}

.pipeline-column-body {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background-color 150ms var(--ease);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  min-height: 300px;
}

.pipeline-column-body.drop-active {
  background: var(--accent-dim);
  outline: 1px dashed var(--accent);
  outline-offset: -4px;
}

.pipeline-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

.pipeline-card {
  padding: 12px 14px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: grab;
  transition:
    border-color 150ms var(--ease),
    transform 150ms var(--ease),
    box-shadow 150ms var(--ease);
}

.pipeline-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.pipeline-card:active {
  cursor: grabbing;
}

.pipeline-card.dragging {
  opacity: 0.4;
  transform: rotate(1.5deg) scale(0.98);
}

.pipeline-card-ref {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.pipeline-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
  word-break: break-word;
}

.pipeline-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.pipeline-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.pipeline-card-foot .sla {
  font-size: 0.6875rem;
}

@media (max-width: 1400px) {
  .pipeline-board {
    grid-template-columns: repeat(6, 220px);
  }
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 180ms var(--ease);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp 220ms var(--ease-out);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg-elev-2);
}

.modal-body {
  padding: var(--space-6);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  margin-top: var(--space-5);
}

/* ============================================================
   PROJECT DETAIL — progress bar element reuse
   ============================================================ */

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

.project-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-elev-3);
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}

.project-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 400ms var(--ease-out);
}

/* ============================================================
   PROJECT DETAIL
   ============================================================ */

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-5);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.admin-tab {
  padding: 8px 18px;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 150ms var(--ease), color 150ms var(--ease);
  white-space: nowrap;
}

.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  background: var(--bg-elev-3);
  color: var(--text);
}

/* Phase track */
.phase-track {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.phase-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background-color 150ms var(--ease);
}

.phase-step:hover { background: var(--bg-elev-3); }

.phase-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background-color 200ms var(--ease);
}

.phase-step.active .phase-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.phase-step.past .phase-dot {
  background: var(--success);
}

.phase-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.phase-step.active .phase-label {
  color: var(--text);
}

/* Milestones */
.milestone-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

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

.milestone-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.8125rem;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
}

.milestone-body { min-width: 0; }

.milestone-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.milestone-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

.milestone-meta {
  font-size: 0.6875rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.milestone-delete {
  color: var(--text-dim);
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}

.milestone-delete:hover {
  color: var(--danger);
  background: var(--bg-elev-2);
}

@media (max-width: 700px) {
  .milestone-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .milestone-select { width: fit-content; }
}

/* Messages */
.messages-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.messages-list {
  max-height: 480px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.message.from-staff .message-avatar {
  background: var(--accent);
  color: var(--text-inverse);
}

.message.from-client .message-avatar {
  background: var(--info);
  color: var(--text-inverse);
}

.message-body {
  min-width: 0;
  padding: 12px 16px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.message.from-staff .message-body {
  border-left: 3px solid var(--accent);
}

.message.from-client .message-body {
  border-left: 3px solid var(--info);
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.75rem;
}

.message-author {
  font-weight: 500;
  color: var(--text);
}

.message-role {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.message-time {
  margin-left: auto;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.message-text {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.messages-compose {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev-1);
}

/* ============================================================
   CLIENTS
   ============================================================ */

.clients-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

@media (max-width: 1100px) {
  .clients-grid { grid-template-columns: repeat(2, 1fr); }
}

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

.client-card {
  padding: var(--space-5);
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    border-color 200ms var(--ease),
    transform 200ms var(--ease),
    box-shadow 200ms var(--ease);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.client-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.client-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.client-card-title { min-width: 0; flex: 1; }

.client-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.client-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.client-stat { text-align: center; }

.client-stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.client-stat-label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 4px;
}

.client-card-projects {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-project-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}

.client-project-link:hover {
  background: var(--bg-elev-2);
  color: var(--text);
}

.client-project-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.status-dot-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-mini.status-active { background: var(--accent); }
.status-dot-mini.status-completed { background: var(--success); }
.status-dot-mini.status-paused { background: var(--warning); }
.status-dot-mini.status-cancelled { background: var(--danger); }

.client-more {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 6px 8px;
  font-family: var(--font-mono);
}

.client-no-projects {
  font-size: 0.8125rem;
  color: var(--text-dim);
  font-style: italic;
  padding: 8px 0;
}


/* ============================================================
   CLIENT DETAIL
   ============================================================ */

.compliance-status-card {
  padding: 20px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color 200ms var(--ease);
}

.compliance-status-card.signed {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.06);
}

.compliance-status-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.compliance-status-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}

.compliance-status-card.signed .compliance-status-value {
  color: var(--success);
}

.compliance-status-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============================================================
   CREDENTIALS MODAL
   ============================================================ */

.creds-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  word-break: break-all;
}

.creds-line .btn-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  font-size: 0.9375rem;
  background: var(--bg-elev-3);
  border-color: var(--line-strong);
}

/* ============================================================
   CREDENTIALS MODAL
   ============================================================ */

.creds-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  word-break: break-all;
}

.creds-line .btn-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  font-size: 0.9375rem;
  background: var(--bg-elev-3);
  border-color: var(--line-strong);
}

/* ============================================================
   NOTIFICATION TOASTS
   ============================================================ */

.toast-notification {
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  cursor: pointer;
  transition: opacity 300ms var(--ease), transform 200ms var(--ease);
}

.toast-notification:hover {
  transform: translateX(-4px);
}

.toast-notification-submission {
  border-left-color: var(--accent);
}

.toast-notification-message {
  border-left-color: var(--danger);
}

.toast-notification-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

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

.toast-notification-message .toast-notification-dot {
  background: var(--danger);
}