:root {
  --color-primary-900: #0d1f3c;
  --color-primary-800: #1f3864;
  --color-primary-700: #1e4a8a;
  --color-primary-500: #2e75b6;
  --color-primary-300: #6fa8dc;
  --color-primary-100: #d9e8f6;
  --color-primary-50: #f0f7ff;
  --color-growth-900: #047857;
  --color-growth-700: #059669;
  --color-growth-500: #10b981;
  --color-growth-300: #6ee7b7;
  --color-growth-100: #d1fae5;
  --color-growth-50: #ecfdf5;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-warning-bg: #fef3c7;
  --color-text: #1a202c;
  --color-text-muted: #4a5568;
  --color-text-light: #718096;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e0;
  --color-bg: #ffffff;
  --color-bg-soft: #f7fafc;
  --color-bg-page: #f0f7ff;

  /* Legacy aliases */
  --primary: var(--color-primary-800);
  --primary-light: var(--color-primary-500);
  --dark: var(--color-primary-900);
  --success: var(--color-growth-500);
  --danger: var(--color-danger);
  --gray: var(--color-text-light);
  --border: var(--color-border);
  --text: var(--color-text);
}

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

html, body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  color: var(--color-text);
  background:
    radial-gradient(ellipse 800px 600px at 90% 0%, rgba(16, 185, 129, .08), transparent 50%),
    radial-gradient(ellipse 900px 700px at 5% 100%, rgba(46, 117, 182, .08), transparent 50%),
    linear-gradient(135deg, #f0f7ff 0%, #ffffff 50%, #ecfdf5 100%);
  -webkit-font-smoothing: antialiased;
}

/* === TOP NAV === */
.top-nav {
  position: sticky; top: 0; z-index: 99997;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: .9rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-brand {
  font-size: 1.5rem; font-weight: 900;
  color: var(--color-primary-800);
  text-decoration: none;
  letter-spacing: -.02em;
}
.nav-brand::after {
  content: '.'; color: var(--color-growth-500);
}
.nav-user {
  display: flex; align-items: center; gap: .8rem;
}
.user-info { text-align: left; }
.user-info .name { font-weight: 700; color: var(--color-text); font-size: .92rem; line-height: 1.2; }
.user-info .role { font-size: .75rem; color: var(--color-text-light); margin-top: 1px; }

.dropdown {
  position: relative;
}
.user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-800));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(31, 56, 100, .2);
  transition: all .2s;
  overflow: hidden;
}
.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(31, 56, 100, .3);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.dropdown-menu {
  position: absolute; top: calc(100% + .5rem); left: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  border: 1px solid var(--color-border);
  min-width: 220px;
  padding: .4rem;
  display: none;
  animation: slideDown .2s;
  z-index: 50;
}
.dropdown-menu.show { display: block; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
  display: block;
  padding: .65rem .9rem;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: .92rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: right;
  font-family: inherit;
  font-weight: 500;
  transition: background .15s;
}
.dropdown-item:hover {
  background: var(--color-primary-50);
  color: var(--color-primary-800);
}
.dropdown-item.danger { color: var(--color-danger); }
.dropdown-item.danger:hover { background: var(--color-danger-bg); }
.dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: .3rem 0;
}

/* === MAIN LAYOUT === */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.page-header {
  margin-bottom: 2rem;
}
.page-title {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--color-primary-900);
  margin-bottom: .3rem;
  letter-spacing: -.01em;
}
.page-subtitle {
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* === GREETING - personalized welcome === */
.greeting {
  background:
    radial-gradient(ellipse 400px 300px at 90% 50%, rgba(16, 185, 129, .15), transparent),
    linear-gradient(135deg, var(--color-primary-800), var(--color-primary-700));
  color: white;
  border-radius: 18px;
  padding: 1.8rem 2rem;
  margin-bottom: 2rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
  position: relative;
  overflow: hidden;
}
.greeting::after {
  content: '';
  position: absolute; right: -50px; top: -50px;
  width: 200px; height: 200px;
  background: rgba(16, 185, 129, .12);
  border-radius: 50%;
  filter: blur(40px);
}
.greeting-text { position: relative; }
.greeting-text .hello {
  font-size: 1.4rem; font-weight: 700;
  margin-bottom: .3rem;
  color: white;
}
.greeting-text .hello strong { color: var(--color-growth-300); }
.greeting-text .sub {
  font-size: .95rem; opacity: .9;
  max-width: 540px; line-height: 1.5;
}

.greeting-cta {
  position: relative; z-index: 1;
}

/* === STATS CARDS GRID === */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 1.4rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(13, 31, 60, .04);
  transition: all .2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--color-primary-500), var(--color-growth-500));
  opacity: 0;
  transition: opacity .2s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(13, 31, 60, .1);
  border-color: var(--color-primary-300);
}
.card:hover::before { opacity: 1; }

.card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1rem;
}
.card-title {
  font-size: .82rem;
  color: var(--color-text-muted);
  font-weight: 600;
  letter-spacing: .02em;
}
.card-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.card-icon.growth {
  background: var(--color-growth-50);
  color: var(--color-growth-700);
}
.card-icon.warning {
  background: var(--color-warning-bg);
  color: #92400e;
}

.card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary-900);
  line-height: 1;
  margin-bottom: .3rem;
}
.card-label {
  font-size: .85rem;
  color: var(--color-text-light);
}

/* === SECTIONS === */
.section {
  background: white;
  border-radius: 16px;
  padding: 1.6rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(13, 31, 60, .04);
  margin-bottom: 1.5rem;
}
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap; gap: .5rem;
}
.section-header h2 {
  font-size: 1.15rem;
  color: var(--color-primary-800);
  font-weight: 700;
}
.section-header a {
  color: var(--color-primary-500);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
}
.section-header a:hover { text-decoration: underline; }

/* Info rows */
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 0;
  border-bottom: 1px solid var(--color-bg-soft);
}
.info-row:last-child { border-bottom: none; }
.info-row .label {
  color: var(--color-text-light);
  font-size: .9rem;
}
.info-row .value {
  font-weight: 600;
  color: var(--color-text);
  font-size: .92rem;
}

.badge {
  display: inline-flex; align-items: center;
  padding: .25rem .7rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-success { background: var(--color-growth-100); color: var(--color-growth-900); }
.badge-warning { background: var(--color-warning-bg); color: #92400e; }
.badge-info { background: var(--color-primary-100); color: var(--color-primary-900); }
.badge-danger { background: var(--color-danger-bg); color: #991b1b; }

/* === BUTTONS === */
.btn-primary {
  background: linear-gradient(135deg, var(--color-growth-500), var(--color-growth-700));
  color: white;
  border: none;
  padding: .7rem 1.4rem;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: all .2s;
  box-shadow: 0 4px 12px rgba(16, 185, 129, .25);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, .35);
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
  background: white;
  color: var(--color-primary-800);
  border: 2px solid var(--color-border);
  padding: .6rem 1.2rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.btn-secondary:hover {
  border-color: var(--color-primary-500);
  background: var(--color-primary-50);
}
.btn-danger {
  background: white;
  color: var(--color-danger);
  border: 1px solid #fecaca;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: var(--color-danger-bg); }
.btn-sm { padding: .4rem .9rem; font-size: .85rem; border-radius: 8px; }

/* === PROJECTS GRID === */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 1.2rem;
  width: 100%;
}

.project-card {
  background: white;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  border: 1px solid var(--color-border);
  transition: all .2s;
  position: relative;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
  border-color: var(--color-primary-300);
}
.project-card-header {
  display: flex; justify-content: space-between; align-items: start;
  gap: .5rem;
  margin-bottom: .8rem;
}
.project-card h3 {
  color: var(--color-primary-800);
  font-size: 1.15rem;
  line-height: 1.4;
  flex: 1;
  font-weight: 700;
}
.project-status {
  padding: .25rem .7rem;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-draft { background: var(--color-warning-bg); color: #92400e; }
.status-published { background: var(--color-growth-100); color: var(--color-growth-900); }
.status-in_progress { background: var(--color-primary-100); color: var(--color-primary-900); }
.status-completed { background: #e5e7eb; color: #374151; }
.status-cancelled { background: var(--color-danger-bg); color: #991b1b; }

.project-meta {
  display: flex; flex-wrap: wrap; gap: .4rem .8rem;
  margin-bottom: .8rem;
  font-size: .82rem;
  color: var(--color-text-light);
}
.project-meta span { display: inline-flex; align-items: center; gap: .25rem; }

.project-desc {
  color: var(--color-text);
  font-size: .9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.project-trades {
  display: flex; flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
}
.trade-chip {
  background: var(--color-primary-50);
  padding: .3rem .7rem;
  border-radius: 50px;
  font-size: .78rem;
  color: var(--color-primary-800);
  display: inline-flex; align-items: center; gap: .3rem;
  font-weight: 500;
}

.project-actions {
  display: flex; gap: .5rem; flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

/* === MODALS === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(13, 31, 60, .55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop.show { display: flex; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: white;
  border-radius: 20px;
  max-width: 640px; width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .3);
}
.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.modal-header h2 {
  color: var(--color-primary-900);
  font-size: 1.3rem;
  font-weight: 800;
}
.modal-close {
  background: none; border: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--color-text-light);
  font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: var(--color-bg-soft); color: var(--color-text); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex; gap: .7rem;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--color-bg-soft);
}

/* Form fields */
.form-group { margin-bottom: 1.2rem; }
.form-label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: .4rem;
}
.form-label .req { color: var(--color-danger); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .7rem 1rem;
  border: 2px solid var(--color-border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  direction: rtl;
  background: white;
  transition: border-color .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 3px rgba(46, 117, 182, .12);
}
.form-textarea { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form-hint { font-size: .8rem; color: var(--color-text-light); margin-top: .3rem; }

/* Project type picker (in modal) */
.project-type-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
}
.type-btn {
  padding: .8rem;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  font-family: inherit;
}
.type-btn:hover {
  border-color: var(--color-primary-300);
  background: var(--color-primary-50);
}
.type-btn.active {
  border-color: var(--color-growth-500);
  background: var(--color-growth-50);
}
.type-btn .ico { font-size: 1.5rem; display: block; margin-bottom: .3rem; }
.type-btn .lbl { font-size: .85rem; font-weight: 600; }

/* Trades pills */
.trades-section { margin-top: .4rem; }
.trades-category { margin-bottom: 1rem; }
.trades-category h4 {
  font-size: .85rem;
  color: var(--color-text-light);
  margin-bottom: .5rem;
  font-weight: 600;
}
.trades-pills { display: flex; flex-wrap: wrap; gap: .4rem; }
.trade-pill {
  padding: .45rem .85rem;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 50px;
  cursor: pointer;
  font-size: .85rem;
  font-family: inherit;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: .35rem;
}
.trade-pill:hover { border-color: var(--color-primary-300); }
.trade-pill.active {
  background: var(--color-primary-800);
  color: white;
  border-color: var(--color-primary-800);
}

/* === TOASTS === */
.toast {
  position: fixed; top: 80px; right: 20px;
  background: white;
  padding: 1rem 1.3rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .15);
  z-index: 2000;
  display: none;
  min-width: 280px; max-width: 400px;
  border-right: 4px solid var(--color-primary-500);
}
.toast.show { display: block; animation: slideInRight .3s; }
.toast.success { border-right-color: var(--color-success); }
.toast.error { border-right-color: var(--color-danger); }
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast-title { font-weight: 700; color: var(--color-text); margin-bottom: .2rem; }
.toast-msg { font-size: .9rem; color: var(--color-text-light); }

/* === EMPTY STATE === */
.empty-state {
  background: white;
  border: 2px dashed var(--color-border);
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
}
.empty-state .icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 {
  color: var(--color-primary-800);
  font-size: 1.3rem;
  margin-bottom: .5rem;
}
.empty-state p {
  color: var(--color-text-light);
  margin-bottom: 1.5rem;
  max-width: 420px;
  margin-left: auto; margin-right: auto;
  line-height: 1.6;
}

.page-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap; gap: 1rem;
}

/* === FILES SECTION === */
.files-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  min-width: 0;
}
.files-section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .7rem;
}
.files-section-header h4 {
  color: var(--color-primary-800);
  font-size: .95rem;
  font-weight: 700;
}
.files-section-header .files-count {
  font-size: .8rem;
  color: var(--color-text-light);
}
.files-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .7rem; }
.file-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .7rem;
  background: var(--color-primary-50);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  flex-wrap: wrap;
}
.file-icon { font-size: 1.5rem; flex-shrink: 0; width: 36px; text-align: center; }
.file-info { flex: 1 1 100px; min-width: 0; }
.file-name {
  font-size: .88rem;
  color: var(--color-text);
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta { font-size: .75rem; color: var(--color-text-light); margin-top: 2px; }
.file-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.file-visibility {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .6rem;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid;
  transition: all .15s;
  font-family: inherit;
}
.file-vis-public { background: var(--color-growth-100); color: var(--color-growth-900); border-color: var(--color-growth-300); }
.file-vis-private { background: var(--color-danger-bg); color: #991b1b; border-color: #fecaca; }
.file-action-btn {
  background: none; border: none;
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-light);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.file-action-btn:hover { background: white; color: var(--color-primary-700); }
.file-action-btn.danger:hover { color: var(--color-danger); }

.dropzone {
  display: block;
  border: 2px dashed var(--color-border);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--color-bg-soft);
  color: var(--color-text-light);
  font-size: .85rem;
  line-height: 1.4;
  box-sizing: border-box;
  width: 100%;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--color-primary-300);
  background: var(--color-primary-50);
  color: var(--color-primary-700);
}
.dropzone.uploading { pointer-events: none; opacity: .6; }
.dropzone .upload-icon { font-size: 1.3rem; display: block; margin-bottom: .2rem; }
.dropzone input { display: none; }

.visibility-modal {
  position: fixed; inset: 0;
  background: rgba(13, 31, 60, .6);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
}
.visibility-modal.show { display: flex; animation: fadeIn .2s; }
.visibility-modal-content {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 420px; width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, .3);
}
.visibility-modal h3 { color: var(--color-primary-900); margin-bottom: .5rem; font-size: 1.2rem; }
.visibility-modal p { color: var(--color-text-light); font-size: .9rem; line-height: 1.5; margin-bottom: 1.2rem; }
.vis-choice { display: flex; gap: .7rem; margin-bottom: 1rem; }
.vis-option {
  flex: 1;
  padding: 1rem;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  font-family: inherit;
}
.vis-option:hover { border-color: var(--color-primary-300); }
.vis-option.active { border-color: var(--color-growth-500); background: var(--color-growth-50); }
.vis-option .vis-icon { font-size: 1.8rem; display: block; margin-bottom: .3rem; }
.vis-option .vis-title { font-weight: 700; color: var(--color-text); margin-bottom: .2rem; font-size: .95rem; }
.vis-option .vis-desc { font-size: .78rem; color: var(--color-text-light); line-height: 1.4; }
.vis-modal-footer { display: flex; gap: .5rem; justify-content: flex-end; }

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .top-nav { padding: .8rem 1rem; }
  .user-info { display: none; }
  .main { padding: 1.2rem .9rem; }
  .greeting { padding: 1.4rem; flex-direction: column; align-items: flex-start; }
  .cards-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .modal { max-height: 100vh; border-radius: 0; }
  .form-row { grid-template-columns: 1fr; }
  .project-type-picker { grid-template-columns: 1fr 1fr; }
  .toast { right: 10px; left: 10px; min-width: auto; }
}


/* Avatar with image - white background, no gradient */
.user-avatar:has(img),
.q-avatar:has(img),
.pro-avatar:has(img),
.avatar:has(img),
[class*="avatar"]:has(img) {
  background: white !important;
  background-image: none !important;
}

.user-avatar img,
.q-avatar img,
.pro-avatar img,
.avatar img,
[class*="avatar"] img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== ACCESS MODE PICKER ===== */
.access-mode-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 600px) {
  .access-mode-picker { grid-template-columns: 1fr; }
  .mode-option .mode-desc { min-height: auto !important; }
}
.mode-option {
  position: relative;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  cursor: pointer;
  background: white;
  transition: all 0.2s;
  overflow: hidden;
  display: block;
}
.mode-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(31, 56, 100, 0.1);
}
.mode-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.mode-option .mode-header {
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  transition: all 0.2s;
}
.mode-option .mode-radio-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: all 0.2s;
}
.mode-option .mode-radio-circle::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: white;
  transform: scale(0);
  transition: transform 0.2s;
}
.mode-option .mode-emoji {
  font-size: 1.7rem;
  line-height: 1;
}
.mode-option .mode-title-text {
  font-weight: 800;
  font-size: 1.05rem;
  color: #0d1f3c;
  flex: 1;
}
.mode-option .mode-body {
  padding: 1.2rem 1.4rem;
}
.mode-option .mode-desc {
  font-size: 0.92rem;
  color: #374151;
  line-height: 1.6;
  margin-bottom: 1rem;
  min-height: 4.5em;
}
.mode-option .mode-best-for {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* OPEN selected - orange theme */
.mode-option:has(input[value="OPEN"]:checked) {
  border-color: #f59e0b;
}
.mode-option:has(input[value="OPEN"]:checked) .mode-header {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-bottom-color: #fbbf24;
}
.mode-option:has(input[value="OPEN"]:checked) .mode-radio-circle {
  border-color: #f59e0b;
  background: #f59e0b;
}
.mode-option:has(input[value="OPEN"]:checked) .mode-radio-circle::after {
  transform: scale(1);
}
.mode-option:has(input[value="OPEN"]:checked) .mode-best-for {
  background: #fde68a;
  color: #78350f;
}

/* REQUIRES_APPROVAL selected - blue theme */
.mode-option:has(input[value="REQUIRES_APPROVAL"]:checked) {
  border-color: #2e75b6;
}
.mode-option:has(input[value="REQUIRES_APPROVAL"]:checked) .mode-header {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-bottom-color: #60a5fa;
}
.mode-option:has(input[value="REQUIRES_APPROVAL"]:checked) .mode-radio-circle {
  border-color: #2e75b6;
  background: #2e75b6;
}
.mode-option:has(input[value="REQUIRES_APPROVAL"]:checked) .mode-radio-circle::after {
  transform: scale(1);
}
.mode-option:has(input[value="REQUIRES_APPROVAL"]:checked) .mode-best-for {
  background: #dbeafe;
  color: #1e3a8a;
}

/* Warning box */
.mode-warning-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 1.1rem 1.3rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: #7c2d12;
  line-height: 1.7;
  margin-top: 1rem;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.mode-warning-box .warn-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}
.mode-warning-box strong {
  color: #9a3412;
  font-weight: 700;
}

/* Role picker active state - global */
.role-pick.active, .role-pick.selected, .role-card.active, .role-option.active {
  border-width: 3px !important;
  border-color: #10b981 !important;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
  box-shadow: 0 6px 20px rgba(16,185,129,.25) !important;
  position: relative !important;
}

/* === SHARED NAVBAR === */
.shared-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: white;
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.snav-spacer { height: 72px; }
.snav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.snav-brand {
  text-decoration: none;
  color: var(--color-primary-900);
  font-weight: 900;
  font-size: 1.5rem;
  display: flex;
  align-items: baseline;
  flex-shrink: 0;
}
.snav-brand-dot {
  color: var(--color-growth-500);
  margin-right: 1px;
}
.snav-links {
  display: flex;
  gap: .3rem;
  flex: 1;
  align-items: center;
}
.snav-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1rem;
  text-decoration: none;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: .95rem;
  border-radius: 10px;
  transition: all .15s;
  position: relative;
  white-space: nowrap;
}
.snav-link:hover {
  background: var(--color-bg-soft);
  color: var(--color-primary-800);
}
.snav-link.active {
  background: var(--color-primary-50);
  color: var(--color-primary-900);
  font-weight: 700;
}
.snav-icon { font-size: 1.05rem; line-height: 1; }
.snav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: white;
  font-size: .72rem;
  font-weight: 800;
  padding: .15rem .45rem;
  border-radius: 50px;
  min-width: 20px;
  height: 20px;
  margin-right: .3rem;
  box-shadow: 0 2px 6px rgba(239,68,68,.4);
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.snav-user {
  display: flex;
  align-items: center;
  gap: .8rem;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.snav-user-info { text-align: left; }
.snav-user-name {
  font-weight: 700;
  color: var(--color-primary-900);
  font-size: .92rem;
  line-height: 1.2;
}
.snav-user-role {
  font-size: .77rem;
  color: var(--color-text-muted);
  margin-top: .15rem;
}
.snav-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-800));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: transform .15s;
}
.snav-avatar:hover { transform: scale(1.05); }
.snav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.snav-avatar:has(img) { background: white !important; }
.snav-dropdown {
  z-index: 99999;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  min-width: 180px;
  padding: .5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all .15s;
}
.snav-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.snav-drop-item {
  display: block;
  width: 100%;
  text-align: right;
  padding: .7rem 1.2rem;
  text-decoration: none;
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 600;
}
.snav-drop-item:hover { background: var(--color-bg-soft); }
.snav-drop-item.danger { color: #dc2626; }
.snav-drop-divider {
  height: 1px;
  background: var(--color-border);
  margin: .3rem 0;
}
.snav-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  flex-direction: column;
  gap: 4px;
}
.snav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-primary-900);
  border-radius: 2px;
}

@media (max-width: 900px) {
  .snav-burger { display: flex; }
  .snav-user-info { display: none; }
  .snav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: white;
    flex-direction: column;
    align-items: stretch;
    padding: .8rem;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
  }
  .snav-links.open { display: flex; }
  .snav-link { padding: .8rem 1rem; justify-content: flex-start; }
  .snav-container { gap: 1rem; padding: 0 1rem; }
}

/* === Bell Notifications === */
.snav-bell{position:relative;background:transparent;border:none;color:#374151;cursor:pointer;padding:8px;border-radius:8px;display:flex;align-items:center;justify-content:center;transition:all .15s;margin-inline-end:8px}
.snav-bell:hover{background:#f3f4f6;color:#10b981}
.snav-bell-badge{position:absolute;top:2px;left:2px;background:#dc2626;color:white;border-radius:999px;min-width:18px;height:18px;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 5px;box-shadow:0 0 0 2px white}
.snav-bell-panel{position:absolute;top:calc(100% + 8px);inset-inline-end:12px;width:360px;max-width:calc(100vw - 24px);max-height:70vh;background:white;border:1px solid #e5e7eb;border-radius:14px;box-shadow:0 10px 40px rgba(0,0,0,.15);display:none;flex-direction:column;overflow:hidden;z-index:99999}
.snav-bell-panel.show{display:flex}
.snav-bell-head{padding:14px 18px;border-bottom:1px solid #f3f4f6;display:flex;justify-content:space-between;align-items:center;font-size:15px;flex-shrink:0;background:#fafafa}
.snav-bell-list{overflow-y:auto;flex:1}
.bell-item{padding:12px 18px;border-bottom:1px solid #f3f4f6;cursor:pointer;display:flex;gap:10px;align-items:flex-start;transition:background .1s}
.bell-item:hover{background:#f9fafb}
.bell-item:last-child{border-bottom:none}
.bell-item.unread{background:#f0fdf4}
.bell-item.unread:hover{background:#ecfdf5}
.bell-dot{width:8px;height:8px;border-radius:50%;background:#10b981;flex-shrink:0;margin-top:6px}
.bell-item-content{flex:1;min-width:0}
.bell-item-title{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:2px}
.bell-item-body{font-size:13px;color:#4b5563;line-height:1.4;margin-bottom:4px}
.bell-item-time{font-size:11px;color:#9ca3af}
@media (max-width:640px){.snav-bell-panel{inset-inline-end:0;inset-inline-start:0;width:auto;border-radius:0;max-height:80vh}}
/* === END Bell Notifications === */

/* === Availability Toggle === */
.snav-avail-toggle{background:#f3f4f6;border:1px solid #e5e7eb;color:#374151;cursor:pointer;padding:6px 12px;border-radius:999px;display:flex;align-items:center;gap:6px;font-size:12px;font-weight:600;font-family:inherit;transition:all .15s;margin-inline-end:8px;white-space:nowrap}
.snav-avail-toggle:hover{background:#e5e7eb;border-color:#d1d5db}
.snav-avail-toggle.on{background:linear-gradient(135deg,#d1fae5,#a7f3d0);border-color:#10b981;color:#065f46}
.snav-avail-toggle.on:hover{background:linear-gradient(135deg,#a7f3d0,#86efac)}
.snav-avail-dot{width:8px;height:8px;border-radius:50%;background:#9ca3af;flex-shrink:0;transition:background .2s}
.snav-avail-toggle.on .snav-avail-dot{background:#10b981;animation:pulse-dot 2s infinite}
@keyframes pulse-dot{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.3);opacity:.7}}
@media (max-width:640px){
  .snav-avail-toggle .snav-avail-text{display:none}
  .snav-avail-toggle{padding:8px;width:34px;justify-content:center}
}
/* === END Availability Toggle === */

/* === Nav overflow fix === */
.snav-container{max-width:100%;flex-wrap:nowrap}
.snav-links{flex:1;min-width:0;overflow-x:auto;-ms-overflow-style:none;scrollbar-width:none}
.snav-links::-webkit-scrollbar{display:none}
/* הקטנת המקום של toggle */
@media (max-width:1100px){
  .snav-avail-toggle .snav-avail-text{display:none}
  .snav-avail-toggle{padding:8px;width:34px;justify-content:center}
}
/* === END Nav overflow fix === */

/* === MOBILE OPTIMIZATIONS - גרסה משופרת === */
@media (max-width: 768px) {
  /* Container */
  .container, .main, main { padding-inline: 12px !important; padding-top: 14px !important; }
  body { font-size: 15px; }

  /* Navbar */
  .shared-nav { padding: 0 !important; }
  .snav-container { padding: 0 12px !important; gap: .5rem !important; min-height: 56px }
  .snav-brand-text { font-size: 22px !important }
  .snav-brand-dot { font-size: 22px !important }
  .snav-burger { padding: 10px !important; width: 44px; height: 44px; justify-content: center; align-items: center }
  .snav-burger span { width: 22px !important; height: 2px !important }
  .snav-bell { width: 44px; height: 44px; padding: 10px !important; margin-inline-end: 4px !important }
  .snav-avatar { width: 38px !important; height: 38px !important }

  /* Burger menu (קישורים) */
  .snav-links.open {
    position: fixed !important;
    top: 56px !important;
    bottom: 0;
    left: 0; right: 0;
    z-index: 99990;
    overflow-y: auto;
    padding: 16px !important;
    max-height: calc(100vh - 56px);
  }
  .snav-link {
    padding: 14px 16px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
    border: 1px solid #e5e7eb;
    background: white;
    margin-bottom: 8px !important;
    min-height: 50px;
  }
  .snav-link.active { background: #f0fdf4 !important; border-color: #10b981 }
  .snav-icon { font-size: 20px !important }

  /* Cards Grid (dashboard) */
  .cards-grid { grid-template-columns: 1fr !important; gap: 10px !important }
  .card { padding: 16px !important }
  .card-value { font-size: 1.8rem !important }
  .card-icon { width: 38px; height: 38px; font-size: 18px }

  /* Greeting */
  .greeting { flex-direction: column; align-items: stretch !important; gap: 12px !important; padding: 16px !important }
  .greeting .hello { font-size: 20px !important }
  .greeting .sub { font-size: 13px !important }
  .greeting-cta { width: 100%; justify-content: center }

  /* Filters / Forms */
  .filters-bar { padding: 14px !important; gap: 10px !important }
  .filters-bar .filter-group { width: 100%; min-width: 0 !important }
  .filters-bar select, .filters-bar input { width: 100% }

  /* Project cards / Lists */
  .projects-grid { grid-template-columns: 1fr !important; gap: 12px !important }
  .project-card { padding: 14px !important }
  .project-card h3 { font-size: 16px !important; line-height: 1.3 }
  .project-card .project-desc { font-size: 13px; line-height: 1.5 }
  .project-meta { flex-wrap: wrap; gap: 6px }
  .project-meta span { font-size: 12px !important }

  /* Tabs */
  .browse-tabs { gap: 4px !important; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none }
  .browse-tabs::-webkit-scrollbar { display: none }
  .browse-tab { padding: 10px 12px !important; font-size: 13px !important; white-space: nowrap; flex-shrink: 0 }

  /* Buttons */
  .btn-primary, .btn-secondary, button.btn { min-height: 44px; font-size: 14px }
  .btn-sm { min-height: 36px }

  /* Forms */
  input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="tel"],
  textarea, select {
    font-size: 16px !important; /* מונע zoom אוטומטי באייפון */
    padding: 12px 14px !important;
    min-height: 44px;
  }
  label { font-size: 13px }

  /* Modals - תופסות כל המסך */
  div[style*="position:fixed"][style*="inset:0"] > div,
  div[style*="position: fixed"][style*="inset: 0"] > div {
    max-width: 100% !important;
    max-height: 100vh !important;
    border-radius: 12px !important;
    margin: 8px !important;
  }

  /* Action grid (3 כפתורים בdashboard-customer) */
  .action-grid { grid-template-columns: 1fr !important; gap: 8px !important }
  .action-card { padding: 16px !important }
  .ac-icon { font-size: 28px !important }
  .ac-title { font-size: 15px !important }
  .ac-desc { font-size: 12px !important }



  /* Tables - הופכים לchrtikim */
  table { font-size: 12px }
  table th, table td { padding: 8px !important }

  /* Section cards */
  .section-card { padding: 16px !important }
  .section-card h2 { font-size: 17px !important }

  /* Profile completion banner */
  #profileBanner { padding: 12px !important }
}

/* === מסך צר מאוד (380px ומטה) === */
@media (max-width: 400px) {
  .container, .main, main { padding-inline: 8px !important }
  .snav-container { padding: 0 8px !important }
  .snav-brand-text { font-size: 20px !important }
  .snav-bell { margin-inline-end: 2px !important }
  .card { padding: 12px !important }
  .card-value { font-size: 1.5rem !important }
  .greeting .hello { font-size: 18px !important }
  .project-card { padding: 12px !important }
  .browse-tab { padding: 8px 10px !important; font-size: 12px !important }
}
/* === END MOBILE OPTIMIZATIONS === */
