/* ============================================================
   MODAL OVERLAY / CARD (used by Settings + Notifications)
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(5, 8, 14, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  animation: fadeIn 0.2s ease both;
}
.modal-overlay.drawer-overlay { justify-content: flex-end; padding: 0; align-items: stretch; }
.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  background: rgba(17, 20, 30, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.32s cubic-bezier(.2, 1.1, .3, 1) both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 28px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-eyebrow {
  font-size: 10px; letter-spacing: 2px; font-weight: 600;
  color: #F59E0B; margin-bottom: 6px;
}
.modal-title { font-size: 22px; font-weight: 700; color: #F9FAFB; letter-spacing: -0.3px; }
.modal-count {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 22px; padding: 0 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FBBF24;
  font-size: 12px; font-weight: 700;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.modal-close {
  width: 32px; height: 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #D1D5DB;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  display: grid; place-items: center;
}
.modal-close:hover { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); color: #FCA5A5; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 28px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 28px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.15);
}

.modal-tabs {
  display: flex; gap: 4px;
  padding: 0 20px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.modal-tabs button {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px;
  background: transparent;
  color: #9CA3AF;
  font-size: 13px; font-weight: 600;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}
.modal-tabs button:hover { color: #E5E7EB; }
.modal-tabs button.active {
  color: #FBBF24;
  border-bottom-color: #F59E0B;
}
.modal-tabs button span:first-child { font-size: 14px; opacity: 0.85; }

/* ============================================================
   SETTINGS — sections
   ============================================================ */
.settings-grid { display: flex; flex-direction: column; gap: 18px; }
.settings-avatar-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.settings-avatar {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 28px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}
.settings-avatar.role-pm { background: linear-gradient(135deg, #FBBF24, #F59E0B); color: #1F2937; }
.settings-avatar.role-foreman { background: rgba(255, 255, 255, 0.08); color: #9CA3AF; }
.settings-avatar-name { font-size: 18px; font-weight: 700; color: #F3F4F6; }
.settings-avatar-role { font-size: 12px; color: #9CA3AF; margin: 4px 0 10px; }

.btn-ghost-sm {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #D1D5DB;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost-sm:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.15); color: #F3F4F6; }

.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg-control.two { grid-template-columns: 1fr 1fr; }

.settings-info-block {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}
.settings-info-block.warn {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.2);
}
.sib-icon {
  width: 36px; height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.settings-info-block.warn .sib-icon { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.sib-title { font-size: 13px; font-weight: 600; color: #F3F4F6; }
.sib-sub { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
.settings-info-block > div:nth-child(2) { flex: 1; min-width: 0; }

.settings-toggle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}
.st-title { font-size: 13px; font-weight: 600; color: #F3F4F6; }
.st-sub { font-size: 11px; color: #9CA3AF; margin-top: 2px; max-width: 360px; }

.toggle {
  width: 42px; height: 24px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.25s;
  border: none;
  flex-shrink: 0;
}
.toggle.on { background: linear-gradient(135deg, #FBBF24, #F59E0B); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(.2, 1.2, .4, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.toggle.on .toggle-knob { transform: translateX(18px); }

/* ============================================================
   NOTIFICATIONS DRAWER
   ============================================================ */
.notif-drawer {
  width: 100%;
  max-width: 440px;
  height: 100vh;
  background: rgba(13, 17, 26, 0.96);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
  animation: drawerIn 0.32s cubic-bezier(.2, 1.1, .3, 1) both;
}
@keyframes drawerIn {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.notif-drawer .modal-head { padding: 24px 24px 16px; }
.notif-tools {
  display: flex; gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}
.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
  margin-bottom: 4px;
  position: relative;
  animation: slideUp 0.35s cubic-bezier(.2, .9, .3, 1) both;
}
.notif-item:hover { background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.06); }
.notif-item.read { opacity: 0.6; }
.notif-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-item.kind-ot .notif-icon { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.3); }
.notif-item.kind-budget .notif-icon { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.3); }
.notif-item.kind-log .notif-icon { background: rgba(59, 130, 246, 0.15); color: #93C5FD; border: 1px solid rgba(59, 130, 246, 0.3); }
.notif-item.kind-system .notif-icon { background: rgba(139, 92, 246, 0.15); color: #C4B5FD; border: 1px solid rgba(139, 92, 246, 0.3); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 600; color: #F3F4F6; }
.notif-text { font-size: 12px; color: #9CA3AF; margin-top: 4px; line-height: 1.5; }
.notif-time { font-size: 10px; color: #6B7280; margin-top: 6px; letter-spacing: 0.3px; }
.notif-dot {
  position: absolute;
  top: 16px; right: 14px;
  width: 8px; height: 8px;
  background: #F59E0B;
  border-radius: 50%;
  box-shadow: 0 0 8px #F59E0B;
}
.notif-empty {
  padding: 60px 24px;
  text-align: center;
}
.ne-icon { font-size: 40px; opacity: 0.4; margin-bottom: 12px; }
.ne-title { font-size: 14px; font-weight: 600; color: #E5E7EB; margin-bottom: 4px; }
.ne-sub { font-size: 12px; color: #9CA3AF; }

/* User menu small badges */
.role-notif-dot {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: #EF4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  margin-left: 2px;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: pulse 2s ease-in-out infinite;
}
.umi-badge {
  margin-left: auto;
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ============================================================
   THEME OVERRIDES (Paper mode)
   ============================================================ */
body[data-mood="paper"] .modal-card,
body[data-mood="paper"] .notif-drawer {
  background: rgba(255, 253, 248, 0.98);
  border-color: rgba(31, 41, 55, 0.1);
}
body[data-mood="paper"] .modal-head,
body[data-mood="paper"] .modal-tabs,
body[data-mood="paper"] .modal-foot,
body[data-mood="paper"] .notif-tools { border-color: rgba(31, 41, 55, 0.08); }
body[data-mood="paper"] .modal-foot,
body[data-mood="paper"] .modal-tabs { background: rgba(31, 41, 55, 0.03); }
body[data-mood="paper"] .modal-eyebrow { color: #DC2626; }
body[data-mood="paper"] .modal-title { color: #0F172A; }
body[data-mood="paper"] .modal-count { background: rgba(220, 38, 38, 0.1); color: #DC2626; border-color: rgba(220, 38, 38, 0.3); }
body[data-mood="paper"] .modal-close { background: rgba(255, 255, 255, 0.6); border-color: rgba(31, 41, 55, 0.1); color: #374151; }
body[data-mood="paper"] .modal-tabs button { color: #6B7280; }
body[data-mood="paper"] .modal-tabs button.active { color: #DC2626; border-bottom-color: #DC2626; }
body[data-mood="paper"] .settings-avatar-row,
body[data-mood="paper"] .settings-info-block,
body[data-mood="paper"] .settings-toggle { background: rgba(31, 41, 55, 0.03); border-color: rgba(31, 41, 55, 0.08); }
body[data-mood="paper"] .settings-avatar-name { color: #0F172A; }
body[data-mood="paper"] .settings-avatar-role { color: #6B7280; }
body[data-mood="paper"] .settings-avatar.role-pm { background: linear-gradient(135deg, #DC2626, #991B1B); color: white; }
body[data-mood="paper"] .btn-ghost-sm { background: rgba(255, 255, 255, 0.7); border-color: rgba(31, 41, 55, 0.1); color: #374151; }
body[data-mood="paper"] .btn-ghost-sm:hover { background: rgba(255, 255, 255, 0.95); color: #0F172A; }
body[data-mood="paper"] .sib-title, body[data-mood="paper"] .st-title { color: #0F172A; }
body[data-mood="paper"] .sib-sub, body[data-mood="paper"] .st-sub { color: #6B7280; }
body[data-mood="paper"] .sib-icon { background: rgba(31, 41, 55, 0.06); }
body[data-mood="paper"] .settings-info-block.warn { background: rgba(220, 38, 38, 0.05); border-color: rgba(220, 38, 38, 0.2); }
body[data-mood="paper"] .settings-info-block.warn .sib-icon { background: rgba(220, 38, 38, 0.12); color: #DC2626; }
body[data-mood="paper"] .toggle.on { background: linear-gradient(135deg, #DC2626, #991B1B); box-shadow: 0 0 12px rgba(220, 38, 38, 0.4); }
body[data-mood="paper"] .notif-title { color: #0F172A; }
body[data-mood="paper"] .notif-text { color: #6B7280; }
body[data-mood="paper"] .notif-time { color: #9CA3AF; }
body[data-mood="paper"] .notif-item:hover { background: rgba(31, 41, 55, 0.04); border-color: rgba(31, 41, 55, 0.08); }
body[data-mood="paper"] .ne-title { color: #1F2937; }
body[data-mood="paper"] .ne-sub { color: #6B7280; }

@media (max-width: 720px) {
  .modal-card { max-height: 96vh; }
  .modal-body { padding: 16px 20px; }
  .modal-head { padding: 18px 20px 14px; }
  .modal-foot { padding: 12px 20px 16px; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .notif-drawer { max-width: 100%; }
}
