/* ── Project Tracker Pro — Dashboard CSS ────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&family=Inter:wght@400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --bg:         #0a0b0f;
  --bg-2:       #10121a;
  --bg-3:       #171a26;
  --bg-4:       #1e2232;
  --border:     #2a2f44;
  --border-2:   #323852;
  --text:       #e2e8f0;
  --text-2:     #94a3b8;
  --text-3:     #64748b;
  --accent:     #6366f1;
  --accent-2:   #4f46e5;
  --accent-glow:#6366f130;
  --success:    #22c55e;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --danger-bg:  #ef444415;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 48px rgba(0,0,0,.6);
  --font-ui:    'Inter', sans-serif;
  --font-display:'Syne', sans-serif;
  --font-mono:  'DM Mono', monospace;
  --sidebar-w:  240px;
  --topbar-h:   60px;
  --transition: 160ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--font-ui);
       -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; }
img { display: block; }

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

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.brand-icon-lg {
  font-size: 48px;
  color: var(--accent);
  display: block;
  margin: 0 auto 8px;
  text-align: center;
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .02em;
  color: var(--text);
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  font-size: .875rem;
  font-weight: 500;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--bg-3); color: var(--text); }

.nav-item--active {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent)30;
}

.nav-item--danger:hover { background: var(--danger-bg); color: var(--danger); }

.nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-label { font-size: .875rem; }

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

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-2);
}

.user-info { flex: 1; overflow: hidden; }
.user-name {
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role { font-size: .72rem; color: var(--text-3); }

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

.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .03em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
}

.app-content {
  flex: 1;
  padding: 0;
  overflow: hidden;
}

/* ── Page ──────────────────────────────────────────────────────────────────── */
.page { padding: 28px; max-width: 1400px; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

.page-sub { color: var(--text-2); font-size: .875rem; margin-top: 4px; }

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

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ── Stat Grid ─────────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--card-accent, var(--accent));
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  color: var(--text-2);
  font-size: .8rem;
  margin-top: 4px;
}

.overview-bottom { display: grid; gap: 20px; }

/* ── Condition Bars ────────────────────────────────────────────────────────── */
.condition-bars { display: flex; flex-direction: column; gap: 10px; }

.cond-bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 40px;
  align-items: center;
  gap: 12px;
}

.cond-bar-label { font-size: .8rem; color: var(--text-2); }

.cond-bar-track {
  height: 6px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
}

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

.cond-bar-count {
  font-size: .8rem;
  font-family: var(--font-mono);
  color: var(--text-2);
  text-align: right;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  transition: background var(--transition), opacity var(--transition),
              transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  line-height: 1;
  min-height: 36px;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn--primary:hover:not(:disabled) {
  background: var(--accent-2);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.btn--ghost:hover:not(:disabled) { background: var(--bg-3); color: var(--text); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.1); }

.btn--sm { padding: 5px 12px; font-size: .8rem; min-height: 30px; }
.btn--loading { pointer-events: none; }

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  transition: background var(--transition);
  color: var(--text-2);
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn--danger:hover { background: var(--danger-bg); color: var(--danger); }

.link-btn {
  color: var(--accent);
  font-size: inherit;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity var(--transition);
}
.link-btn:hover { opacity: .75; }

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.field-error { font-size: .75rem; color: var(--danger); }

.input {
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 12px;
  font-size: .875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.textarea { resize: vertical; min-height: 80px; }

select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid > * { grid-column: span 1; }
.form-grid > .form-actions { grid-column: 1 / -1; }

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  color: var(--text-2);
  cursor: pointer;
}

/* ── Filter Bar ────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  padding: 14px 18px;
}
.filter-bar .input { flex: 1; min-width: 140px; max-width: 260px; }
.filter-bar input[type="date"] { max-width: 170px; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-card { padding: 0; overflow: hidden; }

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.data-table th {
  background: var(--bg-3);
  color: var(--text-2);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text); }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border)80;
  color: var(--text);
  vertical-align: middle;
}

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

.data-table tbody tr:hover td { background: var(--bg-3)60; }

.row--overdue td { background: #ef444408 !important; }
.row--overdue:hover td { background: #ef44440f !important; }

.row--urgent td { background: #f59e0b08 !important; }

.empty-cell {
  text-align: center;
  color: var(--text-3);
  padding: 40px !important;
  font-style: italic;
}

.sort-icon { color: var(--text-3); font-size: .75rem; margin-left: 4px; }
.sort-icon--active { color: var(--accent); }

.td-id {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-3);
}

.sub-text {
  display: block;
  font-size: .75rem;
  color: var(--text-3);
  margin-top: 2px;
}

.td-actions { white-space: nowrap; }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info { font-size: .8rem; color: var(--text-3); }

.pagination-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Badge ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--badge-color);
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color) 35%, transparent);
  white-space: nowrap;
}

/* ── Deadline ──────────────────────────────────────────────────────────────── */
.deadline { font-size: .8rem; color: var(--text-2); }

.deadline--overdue {
  color: var(--danger);
  font-weight: 600;
}

.deadline--urgent {
  color: var(--warning);
  font-weight: 600;
}

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}

@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } }

.modal--lg { max-width: 780px; }
.modal--xl { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: background var(--transition), color var(--transition);
  font-size: .85rem;
}
.modal-close:hover { background: var(--bg-3); color: var(--text); }

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

.modal-desc { color: var(--text-2); font-size: .875rem; margin-bottom: 16px; line-height: 1.6; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease;
  max-width: 340px;
}

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

.toast--success { background: #166534; border: 1px solid var(--success)40; color: #bbf7d0; }
.toast--error   { background: #7f1d1d; border: 1px solid var(--danger)40;  color: #fecaca; }
.toast--info    { background: #1e3a5f; border: 1px solid var(--accent)40;  color: #bfdbfe; }

.toast-icon { font-weight: 800; }

/* ── Notifications ─────────────────────────────────────────────────────────── */
.notif-wrap { position: relative; }

.notif-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  position: relative;
  transition: background var(--transition);
}
.notif-btn:hover { background: var(--bg-3); }

.notif-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 320px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 300;
  animation: slideUp .15s ease;
}

.notif-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  font-weight: 600;
}

.notif-list { max-height: 360px; overflow-y: auto; }

.notif-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: .875rem; }

.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border)60;
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item:hover { background: var(--bg-3); }
.notif-item--unread { background: var(--accent-glow); }

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.notif-dot--overdue  { background: var(--danger); }
.notif-dot--due_tomorrow { background: var(--warning); }
.notif-dot--default  { background: var(--accent); }

.notif-msg  { font-size: .8rem; color: var(--text); line-height: 1.5; }
.notif-time { font-size: .72rem; color: var(--text-3); margin-top: 2px; }

/* ── Profile Dropdown ──────────────────────────────────────────────────────── */
.profile-dropdown {
  position: relative;
  margin-left: 12px;
}

.profile-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  border: 1px solid var(--border);
}
.profile-btn:hover {
  background: var(--bg-3);
  border-color: var(--border-2);
}

.profile-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  animation: slideUp .15s ease;
}

.profile-panel-header {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.profile-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

.profile-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.profile-email {
  font-size: .8rem;
  color: var(--text-2);
  margin-bottom: 2px;
}

.profile-role {
  font-size: .75rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.profile-panel-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

.profile-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  color: var(--text);
  border-bottom: 1px solid var(--border)40;
  transition: background var(--transition);
  font-size: .9rem;
}
.profile-item:hover {
  background: var(--bg-3);
}
.profile-item:last-child {
  border-bottom: none;
}
.profile-item--danger {
  color: var(--danger);
}
.profile-item--danger:hover {
  background: var(--danger-bg);
}

/* ── Profile Page ──────────────────────────────────────────────────────────── */
.profile-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-2);
}

.profile-picture-upload {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.profile-picture-preview {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-2);
  object-fit: cover;
}

.profile-picture-upload > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-text {
  font-size: .8rem;
  color: var(--text-3);
  margin-top: 4px;
}

/* ── Auth ──────────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--accent-glow), transparent);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-brand { text-align: center; margin-bottom: 28px; }

.auth-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.auth-sub { color: var(--text-2); font-size: .875rem; margin-top: 4px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger)40;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .875rem;
}

.auth-divider {
  text-align: center;
  margin: 16px 0;
  position: relative;
  color: var(--text-3);
  font-size: .8rem;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  position: relative;
  background: var(--bg-2);
  padding: 0 12px;
}

.auth-link {
  text-align: center;
  font-size: .875rem;
  color: var(--text-2);
  margin-top: 20px;
}

/* ── Teams ─────────────────────────────────────────────────────────────────── */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.team-card { display: flex; flex-direction: column; gap: 12px; }

.team-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.team-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.team-actions { display: flex; gap: 4px; }

.team-desc { font-size: .85rem; color: var(--text-2); line-height: 1.5; }

.team-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .78rem;
  color: var(--text-3);
}

/* ── Member Management ─────────────────────────────────────────────────────── */
.member-add-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-row-name  { font-size: .875rem; font-weight: 500; }
.user-row-username { font-size: .75rem; color: var(--text-3); font-family: var(--font-mono); }

/* ── Team Dashboard ────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  gap: 14px;
  transition: transform var(--transition), border-color var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  border-top-color: var(--accent-2);
}

.stat-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-2);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.team-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

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

.members-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--bg-3)40;
  transition: background var(--transition);
}
.member-item:hover {
  background: var(--bg-3);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1px;
}

.member-role {
  font-size: .75rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.member-email {
  font-size: .8rem;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-item {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-3)40;
  border: 1px solid var(--border)60;
  transition: background var(--transition), border-color var(--transition);
}
.project-item:hover {
  background: var(--bg-3);
  border-color: var(--border);
}

.project-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.project-client {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

.project-developer {
  font-size: .8rem;
  color: var(--text-2);
  margin: 0 0 4px 0;
}

.project-deadline {
  font-size: .75rem;
  color: var(--text-3);
  margin: 0;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-2);
  flex-shrink: 0;
}

/* ── Project Detail ────────────────────────────────────────────────────────── */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-client {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.detail-sub { font-size: .875rem; color: var(--text-2); margin-top: 2px; }

.detail-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.detail-tab {
  padding: 8px 16px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -1px;
  text-transform: capitalize;
}
.detail-tab:hover { color: var(--text); }
.detail-tab--active { color: var(--accent); border-bottom-color: var(--accent); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

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

.detail-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border)50;
  align-items: start;
}

.detail-row--full { grid-column: 1 / -1; }

.detail-label { font-size: .75rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.detail-value { font-size: .875rem; color: var(--text); }

/* ── Extensions ────────────────────────────────────────────────────────────── */
.ext-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border)50;
}

.ext-dates {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .875rem;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.ext-arrow { color: var(--text-3); }
.ext-new   { color: var(--success); font-weight: 600; }
.ext-reason { font-size: .8rem; color: var(--text-2); margin-bottom: 4px; line-height: 1.5; }
.ext-meta   { font-size: .72rem; color: var(--text-3); }

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

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

.activity-action {
  font-size: .85rem;
  font-weight: 500;
  text-transform: capitalize;
}

.activity-meta { font-size: .75rem; color: var(--text-3); margin-top: 2px; }

/* ── Log Action ────────────────────────────────────────────────────────────── */
.log-action {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-2);
  font-family: var(--font-mono);
  text-transform: capitalize;
}

/* ── Loaders ───────────────────────────────────────────────────────────────── */
.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.loader-ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.table-loader { padding: 16px; display: flex; flex-direction: column; gap: 8px; }

.skeleton-row { display: flex; gap: 12px; padding: 10px 0; }

.skeleton-cell {
  height: 16px;
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.2s infinite;
  flex: 1;
}

.skeleton-cell:first-child { max-width: 40px; }
.skeleton-cell:nth-child(2) { flex: 2; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Empty States ──────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
  font-size: .9rem;
  background: var(--bg-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
}

.empty-text {
  text-align: center;
  color: var(--text-3);
  font-size: .875rem;
  padding: 24px 0;
  font-style: italic;
}

/* ── PT Error ──────────────────────────────────────────────────────────────── */
.pt-error {
  max-width: 500px;
  margin: 40px auto;
  padding: 20px;
  background: var(--danger-bg);
  border: 1px solid var(--danger)40;
  border-radius: var(--radius-lg);
  color: var(--danger);
  text-align: center;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 64px; }

  .brand-text, .nav-label, .user-info { display: none; }
  .sidebar-brand { padding: 16px 0; justify-content: center; }
  .brand-icon { font-size: 20px; }
  .nav-icon { width: auto; }
  .nav-item { justify-content: center; padding: 10px; }
  .user-card { justify-content: center; padding: 8px; }
  .user-avatar { width: 30px; height: 30px; }

  .page { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .teams-grid { grid-template-columns: 1fr; }
  .form-grid  { grid-template-columns: 1fr; }
  .modal { max-height: 95vh; }

  .topbar { padding: 0 16px; }
  .topbar-title { font-size: .9rem; }

  .filter-bar { padding: 10px; }
  .filter-bar .input { max-width: none; }
}
