:root {
  --purple: #6c5ce7;
  --orange: #fd9644;
  --green: #2ecc71;
  --red: #e74c3c;
  --black: #2d3436;
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #2d3436;
  --muted: #636e72;
  --primary: #2c3e50;
  --primary-dark: #1e2b38;
  --border: #dfe6e9;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

html, body {
  font-family: "Tahoma", "Segoe UI", "Arial", sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  font-size: 14px;
}

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

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: #fff;
  padding: 10px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.topbar .brand img { height: 36px; width: 36px; object-fit: contain; border-radius: 4px; background: #fff; padding: 2px; }
.topbar .actions { display: flex; align-items: center; gap: 12px; }
.topbar .user-info { font-size: 13px; opacity: 0.9; }
.topbar .btn-logout {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.topbar .btn-logout:hover { background: #c0392b; }

/* Notifications */
.notif-bell { position: relative; cursor: pointer; color: #fff; padding: 4px 8px; font-size: 18px; }
.notif-bell:hover { color: #ecf0f1; }
.notif-bell .badge {
  position: absolute;
  top: -6px;
  left: -6px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(192, 57, 43, 0.5);
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.notif-dropdown {
  position: absolute;
  top: 50px;
  left: 10px;
  width: 460px;
  max-height: 600px;
  overflow-y: auto;
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  display: none;
  z-index: 200;
  border: 1px solid rgba(0,0,0,0.06);
}
.notif-dropdown.show { display: block; }
.notif-dropdown { pointer-events: none; }
.notif-dropdown .notif-header,
.notif-dropdown .notif-item,
.notif-dropdown .notif-empty,
.notif-dropdown a { pointer-events: auto; }
.notif-dropdown::-webkit-scrollbar { width: 6px; }
.notif-dropdown::-webkit-scrollbar-thumb { background: #cbd0d4; border-radius: 3px; }
.notif-header {
  padding: 12px 14px;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: #fff;
  border-radius: 10px 10px 0 0;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notif-header .count {
  background: rgba(255,255,255,0.18);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.notif-header a { color: #fff; font-size: 11px; font-weight: 400; text-decoration: underline; }
.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: #f7f9fb; }
.notif-item.unread {
  background: linear-gradient(90deg, #f0f7ff 0%, #ffffff 100%);
  border-right: 3px solid #3498db;
}
.notif-item .icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f3f5;
}
.notif-item .body { flex: 1; min-width: 0; }
.notif-item .text { font-weight: 600; color: var(--text); line-height: 1.6; white-space: pre-line; word-wrap: break-word; overflow-wrap: break-word; font-size: 13px; }
.notif-item .note {
  color: var(--muted);
  margin-top: 6px;
  font-size: 12px;
  background: #f8f9fa;
  padding: 6px 8px;
  border-radius: 4px;
  border-right: 2px solid #bdc3c7;
  white-space: pre-line;
}
.notif-item .time {
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.notif-item.unread .time::before {
  content: "●";
  color: #3498db;
  font-size: 10px;
}
.notif-item .open-hint {
  margin-top: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s;
}
.notif-item:hover .open-hint { opacity: 0.85; }
.notif-empty {
  padding: 30px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.notif-empty .icon { font-size: 28px; opacity: 0.4; margin-bottom: 6px; }
.notif-footer {
  padding: 8px 14px;
  text-align: center;
  background: #f8f9fa;
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
}
.notif-footer a { color: var(--primary); font-size: 12px; text-decoration: none; font-weight: 600; }
.notif-footer a:hover { text-decoration: underline; }

/* Version cards (DMS) */
.version-card {
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.version-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.version-info strong { color: var(--primary); font-size: 13px; }
.version-date { color: var(--muted); }
.version-approver { color: var(--muted); }
.version-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.version-req-btn { font-size: 11px; padding: 4px 10px; }
.version-card .req-content {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-line;
}

/* Layout */
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px;
  background: #fff;
  border-left: 1px solid var(--border);
  padding: 16px 0;
}
.sidebar a {
  display: block;
  padding: 12px 20px;
  color: var(--text);
  border-right: 3px solid transparent;
  cursor: pointer;
}
.sidebar a:hover, .sidebar a.active {
  background: #f5f6fa;
  border-right-color: var(--primary);
  text-decoration: none;
}
.main { flex: 1; padding: 20px; }

/* Cards */
.project-card {
  background: var(--card);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  border-right: 5px solid var(--muted);
}
.project-card.purple { border-right-color: var(--purple); }
.project-card.orange { border-right-color: var(--orange); }
.project-card.green { border-right-color: var(--green); }
.project-card.red { border-right-color: var(--red); }
.project-card.black { border-right-color: var(--black); }

.project-card h3 { margin-bottom: 8px; font-size: 16px; }
.project-card .meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.project-card .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Progress bar (6-stage workflow) */
.pbar-wrap { margin: 8px 0 6px; }
.pbar {
  display: flex;
  height: 42px;
  border-radius: 4px;
  overflow: hidden;
  background: #ecf0f1;
  border: 1px solid #d5dbdb;
}
.pbar-seg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 1px solid rgba(255,255,255,0.3);
  transition: opacity 0.2s;
  min-width: 0;
  padding: 3px 2px;
  gap: 2px;
}
.pbar-seg:first-child { border-left: none; }
.pbar-seg.done { opacity: 0.7; }
.pbar-seg.current {
  opacity: 1;
  position: relative;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.35);
}
.pbar-seg.current::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.2) 0 6px, transparent 6px 12px);
  pointer-events: none;
}
.pbar-seg.pending { background: transparent; opacity: 0.45; }
.pbar-label {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1;
  max-width: 100%;
  line-height: 1.1;
}
.pbar-seg-time {
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  z-index: 1;
  max-width: 100%;
  line-height: 1.1;
  letter-spacing: 0.2px;
}
.pbar-seg.pending .pbar-label {
  color: #7f8c8d;
  text-shadow: none;
}
.pbar-seg.pending .pbar-seg-time {
  color: transparent;
}
.pbar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  padding: 0 2px;
}
.pbar-pct { font-weight: 700; color: var(--text); }
.pbar-legend {
  margin-top: 6px;
  padding: 6px 8px;
  background: #f8f9fa;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pbar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pbar-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Numbered steps (engineer card) */
.steps {
  margin-top: 14px;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px dashed var(--border);
}
.step:last-child { border-bottom: none; }
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.step-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.step.done .step-num { background: #27ae60; }
.step.done .step-label { color: var(--muted); text-decoration: line-through; }
.step-done-tag {
  background: #27ae60;
  color: #fff;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.steps.done-note {
  text-align: center;
  color: #27ae60;
  font-weight: 600;
  font-size: 13px;
  padding: 14px;
}

/* Buttons */
.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.btn:hover { background: var(--primary-dark); }
.btn.success { background: var(--green); }
.btn.success:hover { background: #27ae60; }
.btn.warning { background: var(--orange); }
.btn.danger { background: var(--red); }
.btn.secondary { background: #95a5a6; }
.btn.primary { background: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.modal-narrow { max-width: 500px; }
.modal-xnarrow { max-width: 420px; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); cursor: pointer; user-select: none; font-size: 16px; }
.main-narrow { max-width: 900px; margin: 0 auto; padding: 20px; }

/* Focus-visible for keyboard users */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:focus-visible { outline-offset: 2px; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 4px; font-weight: 600; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* Login page */
.login-wrap {
  max-width: 400px;
  margin: 60px auto;
  background: #fff;
  padding: 30px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.login-wrap h1 { text-align: center; margin-bottom: 24px; color: var(--primary); }
.login-wrap .logo { display: block; margin: 0 auto 16px; max-height: 64px; }
.login-error { color: var(--red); margin: 10px 0; font-size: 13px; min-height: 18px; }
.login-help { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.remember-row { display: flex; align-items: center; gap: 8px; }
.remember-label { margin: 0; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 8px;
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal h2 { margin-bottom: 16px; color: var(--primary); }
.modal .close { float: left; cursor: pointer; font-size: 24px; color: var(--muted); }
.modal .close:hover { color: var(--text); }
.modal-section { margin-bottom: 20px; }
.modal-section h3 { font-size: 14px; color: var(--primary); margin-bottom: 8px; border-right: 3px solid var(--primary); padding-right: 8px; }
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}
.assign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.msg-grid {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 12px;
  align-items: end;
}
.msg-send { display: flex; align-items: end; }
.modal-footer-row { display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }

/* Profile modal */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profile-pw-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.profile-pw-section .section-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--primary);
  margin-bottom: 2px;
}
.profile-pw-section .hint { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.profile-pw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Audit timeline compact */
.timeline .audit-row1 { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timeline .audit-row1 .who { font-weight: 600; }
.timeline .audit-row1 .who .role { font-weight: 400; color: var(--muted); font-size: 12px; }
.timeline .audit-row1 .when { color: var(--muted); font-size: 12px; }
.timeline .what { margin-top: 2px; }

/* Action modal subtitle + nextstep */
.action-subtitle {
  margin-top: 10px;
  padding: 8px 10px;
  background: #fff8e1;
  border-right: 3px solid #f39c12;
  border-radius: 4px;
  font-size: 12px;
  color: #7d5a00;
  font-weight: 600;
  line-height: 1.5;
}
.action-nextstep {
  margin-top: 8px;
  padding: 8px 10px;
  background: #e8f4fd;
  border-right: 3px solid #3498db;
  border-radius: 4px;
  font-size: 12px;
  color: #1f618d;
  font-weight: 600;
  line-height: 1.5;
}

/* Timeline */
.timeline { list-style: none; padding: 0; }
.timeline li {
  padding: 8px 12px;
  border-right: 2px solid var(--border);
  margin-right: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.timeline .who { font-weight: 600; color: var(--primary); }
.timeline .when { color: var(--muted); font-size: 11px; margin-right: 6px; }
.timeline .note { color: var(--muted); font-style: italic; margin-top: 2px; }

/* Compact audit timeline (engineer viewAudit) */
.audit-timeline { list-style: none; padding: 0; margin: 0; }
.audit-row {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.audit-row:last-child { border-bottom: none; }
.audit-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.audit-content { flex: 1; min-width: 0; }
.audit-line1 { font-weight: 600; color: var(--text); line-height: 1.4; }
.audit-line1 strong { color: var(--primary); }
.audit-role { color: var(--muted); font-weight: 400; font-size: 11px; }
.audit-line2 { color: var(--muted); font-size: 11px; margin-top: 2px; }
.audit-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  padding: 4px 8px;
  background: #f8f9fa;
  border-radius: 3px;
  border-right: 2px solid #bdc3c7;
}
.audit-footer {
  margin-top: 10px;
  padding: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  background: #f8f9fa;
  border-radius: 4px;
}

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { border: 1px solid var(--border); padding: 8px 12px; text-align: right; font-size: 13px; }
.table th { background: #f5f6fa; font-weight: 700; }

/* Search */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-bar input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2d3436;
  color: #fff;
  padding: 12px 18px;
  border-radius: 4px;
  box-shadow: var(--shadow);
  z-index: 400;
  font-size: 13px;
  opacity: 0.95;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

.empty { color: var(--muted); text-align: center; padding: 40px 20px; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.badge-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-role.admin { background: #f0e6ff; color: var(--purple); }
.badge-role.structural { background: #ffe6db; color: var(--orange); }
.badge-role.electrical { background: #e6f7ff; color: #0984e3; }
.badge-role.mechanical { background: #e6ffe6; color: var(--green); }

/* Responsive */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    display: flex;
    overflow-x: auto;
    padding: 0;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar a {
    border-right: none;
    border-bottom: 3px solid transparent;
    padding: 10px 16px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .sidebar a:hover, .sidebar a.active {
    border-right-color: transparent;
    border-bottom-color: var(--primary);
  }
  .main { padding: 14px; }
  .notif-dropdown { width: min(460px, calc(100vw - 40px)); }
  .topbar .user-info { display: none; }
  .topbar .brand { font-size: 15px; }
  .search-bar { flex-wrap: wrap; }
  .search-bar input { min-width: 0; flex: 1 1 200px; }
  .meta-grid { grid-template-columns: 1fr; }
  .assign-grid { grid-template-columns: 1fr; }
  .msg-grid { grid-template-columns: 1fr; }
  .modal-footer-row { flex-direction: column; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-pw-grid { grid-template-columns: 1fr; }
}

/* ── Small phones (iPhone SE, older iPhones) — 480px and below ── */
@media (max-width: 480px) {
  .topbar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  .topbar .brand { font-size: 14px; gap: 6px; }
  .topbar .brand img { height: 28px; width: 28px; }
  .topbar .actions { gap: 6px; }
  .topbar .user-info { display: none; }
  .topbar .btn-logout { padding: 5px 10px; font-size: 12px; }
  .notif-bell { font-size: 16px; padding: 2px 6px; }
  .notif-dropdown {
    width: calc(100vw - 20px);
    left: 10px;
    right: 10px;
    max-height: 70vh;
  }
  .notif-header { padding: 10px 12px; font-size: 12px; }
  .notif-item { padding: 10px 12px; font-size: 12px; gap: 6px; }

  .main { padding: 10px; }
  .sidebar a { padding: 8px 12px; font-size: 13px; }
  .project-card { padding: 12px; }
  .project-card h3 { font-size: 15px; }
  .meta { font-size: 12px; }

  /* Forms + modals */
  .modal { padding: 14px; max-height: 95vh; }
  .modal h2 { font-size: 16px; margin-bottom: 10px; }
  .modal-section { margin-bottom: 14px; }
  .modal-section h3 { font-size: 13px; }
  .form-group label { font-size: 13px; }
  .form-group input,
  .form-group select,
  .form-group textarea { font-size: 15px; padding: 8px 10px; }
  .form-group textarea { min-height: 70px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }
  .btn-block { width: 100%; }
  .modal-footer-row { gap: 8px; }
  .modal-footer-row .btn { width: 100%; }

  /* Action modal deadline input */
  #actionDays { font-size: 16px; padding: 8px 10px; }

  /* Steps + deadline badges */
  .steps { gap: 6px; }
  .step { padding: 8px; gap: 6px; flex-wrap: wrap; }
  .step-num { width: 24px; height: 24px; font-size: 12px; }
  .step-label { font-size: 12px; flex: 1 1 100%; order: 3; }
  .step .btn-sm { order: 4; flex: 1 1 100%; }
  .deadline-row { gap: 4px; }
  .deadline-row .meta { font-size: 12px; padding: 3px 6px; }

  /* Tables scroll horizontally on tiny screens */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 480px; }

  /* Search bar */
  .search-bar { gap: 6px; }
  .search-bar input,
  .search-bar select { font-size: 14px; padding: 7px 10px; }

  /* Project modal sections */
  .modal-meta-grid { grid-template-columns: 1fr; }
  .modal-versions-list { max-height: 250px; }

  /* Toast */
  .toast { font-size: 13px; padding: 10px 14px; left: 10px; right: 10px; bottom: 10px; max-width: none; }

  /* Login page — tighter on small phones */
  .login-wrap {
    max-width: 100%;
    margin: 20px auto;
    padding: 20px;
    border-radius: 8px;
  }
  .login-wrap .logo { max-height: 48px; margin-bottom: 12px; }
  .login-wrap h1 { font-size: 18px; margin-bottom: 16px; }
  .login-error { font-size: 12px; }
  .login-help { font-size: 12px; }

  /* Remember-me checkbox — bigger touch target on mobile */
  .remember-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--primary);
  }
  .remember-label {
    font-size: 13px;
    line-height: 1.3;
  }

  /* Password toggle eye — bigger tap target on mobile */
  .pw-toggle { font-size: 18px; padding: 6px; }
}

/* ── Very small (iPhone 5/SE 1st gen, 320px) — tighten further ── */
@media (max-width: 360px) {
  .topbar .brand { font-size: 13px; }
  .topbar .brand img { height: 24px; width: 24px; }
  .main { padding: 8px; }
  .project-card { padding: 10px; }
  .project-card h3 { font-size: 14px; }
  .modal { padding: 12px; }
  .modal h2 { font-size: 15px; }
  .btn { padding: 7px 12px; font-size: 12px; }
  .step-num { width: 22px; height: 22px; font-size: 11px; }
  .meta { font-size: 11px; }
  /* Login — even tighter on 320px */
  .login-wrap { margin: 12px auto; padding: 16px; }
  .login-wrap .logo { max-height: 40px; margin-bottom: 8px; }
  .login-wrap h1 { font-size: 16px; margin-bottom: 12px; }
}

/* ─── Deadline badge states (engineer-set days per role) ─── */
.deadline-ok    { color: #27ae60; font-weight: 600; }
.deadline-today { color: #e67e22; font-weight: 600; }
.deadline-late  { color: #c0392b; font-weight: 700; background: #fdecea; padding: 4px 8px; border-radius: 6px; display: inline-block; }
.deadline-row   { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.deadline-row .meta { font-size: 13px; }